Esempio n. 1
0
 def __new__(cls, *args, **kwds):
     if typing._geqv(cls, AsyncGenerator):
         raise TypeError(
             'Type AsyncGenerator cannot be instantiated; '
             'create a subclass instead')
     return typing._generic_new(
         _collections_abc.AsyncGenerator, cls, *args, **kwds)
Esempio n. 2
0
 def __new__(cls, *args, **kwds):
     if _gorg(cls) is Protocol:
         raise TypeError("Type Protocol cannot be instantiated; "
                         "it can be used only as a base class")
     return _generic_new(cls.__next_in_mro__, cls, *args, **kwds)
Esempio n. 3
0
 def __new__(cls, *args, **kwds):
     if typing._geqv(cls, Deque):
         return collections.deque(*args, **kwds)
     return typing._generic_new(
         collections.deque, cls, *args, **kwds)
Esempio n. 4
0
 def __new__(cls, *args, **kwds):
     if typing._geqv(cls, Counter):
         return collections.Counter(*args, **kwds)
     return typing._generic_new(
         collections.Counter, cls, *args, **kwds)
Esempio n. 5
0
 def __new__(cls, *args, **kwds):
     if typing._geqv(cls, ChainMap):
         return collections.ChainMap(*args, **kwds)
     return typing._generic_new(
         collections.ChainMap, cls, *args, **kwds)
Esempio n. 6
0
 def __new__(cls, *args, **kwds):
     if _gorg(cls) is Protocol:
         raise TypeError("Type Protocol cannot be instantiated; "
                         "it can be used only as a base class")
     return _generic_new(cls.__next_in_mro__, cls, *args, **kwds)
Esempio n. 7
0
 def __new__(cls, *args, **kwds):
     if typing._geqv(cls, Deque):
         raise TypeError('Type Deque cannot be instantiated; use deque() instead')
     return typing._generic_new(deque, cls, *args, **kwds)
 def __new__(cls, *args, **kwargs):  # noqa: ANN002,ANN003,ANN204
     if _geqv(cls, OrderedDict):
         return collections.OrderedDict(*args, **kwargs)
     return _generic_new(collections.OrderedDict, cls, *args, **kwargs)
 def __new__(cls, *args, **kwargs):  # noqa: ANN002,ANN003,ANN204
     if _geqv(cls, Counter):
         return collections.Counter(*args, **kwargs)
     return _generic_new(collections.Counter, cls, *args, **kwargs)
 def __new__(cls, *args, **kwargs):  # noqa: ANN002,ANN003,ANN204
     if _geqv(cls, ChainMap):
         return collections.ChainMap(*args, **kwargs)
     return _generic_new(collections.ChainMap, cls, *args, **kwargs)
Esempio n. 11
0
 def __new__(cls, *args, **kwds):
     if cls._gorg is FrozenCounter:
         return FrozenCounter(*args, **kwds)
     return _generic_new(FrozenCounter, cls, *args, **kwds)