[util] add 'NullContext'

an even more minimal 'contextlib.nullcontext'
that also works on older Python versions
This commit is contained in:
Mike Fährmann
2024-09-09 20:28:18 +02:00
parent 4da3347d18
commit 4601aa9794

View File

@@ -516,6 +516,15 @@ class LazyPrompt():
return getpass.getpass()
class NullContext():
def __enter__(self):
return None
def __exit__(self, exc_type, exc_value, traceback):
pass
class CustomNone():
"""None-style type that supports more operations than regular None"""
__slots__ = ()