mirror of
https://github.com/python/cpython.git
synced 2025-09-15 21:26:04 +00:00
Rename contextlib.ignored() to contextlib.ignore().
This commit is contained in:
parent
a76795bf53
commit
1254b407ac
4 changed files with 13 additions and 13 deletions
|
@ -5,7 +5,7 @@ from collections import deque
|
|||
from functools import wraps
|
||||
|
||||
__all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack",
|
||||
"ignored", "redirect_stdout"]
|
||||
"ignore", "redirect_stdout"]
|
||||
|
||||
|
||||
class ContextDecorator(object):
|
||||
|
@ -179,10 +179,10 @@ class redirect_stdout:
|
|||
sys.stdout = self.old_target
|
||||
|
||||
@contextmanager
|
||||
def ignored(*exceptions):
|
||||
def ignore(*exceptions):
|
||||
"""Context manager to ignore specified exceptions
|
||||
|
||||
with ignored(OSError):
|
||||
with ignore(OSError):
|
||||
os.remove(somefile)
|
||||
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue