class documentation

class contextlib_nullcontext: (source)

View In Hierarchy

Context manager that does no additional processing.

Used as a stand-in for a normal context manager, when a particular block of code is only sometimes used with a normal context manager:

cm = optional_cm if condition else nullcontext() with cm:

# Perform operation, using optional_cm if condition is True

Note

Prefer using contextlib.nullcontext instead of this context manager.

Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Instance Variable enter_result Undocumented
def __enter__(self): (source)

Undocumented

def __exit__(self, *excinfo): (source)

Undocumented

def __init__(self, enter_result=None): (source)

Undocumented

enter_result = (source)

Undocumented