cpython/Lib/test/test_importlib/metadata/_context.py

14 lines
282 B
Python
Raw Normal View History

import contextlib
# from jaraco.context 4.3
class suppress(contextlib.suppress, contextlib.ContextDecorator):
"""
A version of contextlib.suppress with decorator support.
>>> @suppress(KeyError)
... def key_error():
... {}['']
>>> key_error()
"""