ContextManagerModel

class astroid.interpreter.objectmodel.ContextManagerModel[source]

Bases: ObjectModel

Model for context managers.

Based on 3.3.9 of the Data Model documentation: https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers

property attr___enter__: BoundMethod

Representation of the base implementation of __enter__.

As per Python documentation: Enter the runtime context related to this object. The with statement will bind this method’s return value to the target(s) specified in the as clause of the statement, if any.

property attr___exit__: BoundMethod

Representation of the base implementation of __exit__.

As per Python documentation: Exit the runtime context related to this object. The parameters describe the exception that caused the context to be exited. If the context was exited without an exception, all three arguments will be None.