class contextlib_nullcontext:
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 |