Kaydet (Commit) f3ad042b authored tarafından Brett Cannon's avatar Brett Cannon

Issue #25609: Backport typing.ContextManager.

This has no semantic impact as the class is guarded with a hasattr()
check; this is being done to keep typing.py in sync between Python 3.5
and 3.6 as requested by Guido.
üst 3c149a68
import abc import abc
from abc import abstractmethod, abstractproperty from abc import abstractmethod, abstractproperty
import collections import collections
import contextlib
import functools import functools
import re as stdlib_re # Avoid confusion with the re we export. import re as stdlib_re # Avoid confusion with the re we export.
import sys import sys
...@@ -1530,6 +1531,12 @@ class ValuesView(MappingView[VT_co], extra=collections_abc.ValuesView): ...@@ -1530,6 +1531,12 @@ class ValuesView(MappingView[VT_co], extra=collections_abc.ValuesView):
pass pass
if hasattr(contextlib, 'AbstractContextManager'):
class ContextManager(Generic[T_co], extra=contextlib.AbstractContextManager):
__slots__ = ()
__all__.append('ContextManager')
class Dict(dict, MutableMapping[KT, VT]): class Dict(dict, MutableMapping[KT, VT]):
def __new__(cls, *args, **kwds): def __new__(cls, *args, **kwds):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment