mirror of
https://github.com/python/cpython.git
synced 2025-07-08 20:05:28 +00:00

* Ensure importlib.metadata tests do not leak references in sys.modules. * Move importlib.metadata tests to their own package for easier syncing with importlib_metadata. * Update owners and makefile for new directories. * Add blurb
13 lines
282 B
Python
13 lines
282 B
Python
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()
|
|
"""
|