mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 04:35:24 +00:00
Merge branch 'develop' into __slots__
This commit is contained in:
commit
9f26ac9cbe
@ -40,9 +40,7 @@ class TCPAbridgedO(TCP):
|
||||
while True:
|
||||
nonce = bytearray(os.urandom(64))
|
||||
|
||||
if (nonce[0] != b"\xef"
|
||||
and nonce[:4] not in self.RESERVED
|
||||
and nonce[4:4] != b"\x00" * 4):
|
||||
if nonce[0] != b"\xef" and nonce[:4] not in self.RESERVED and nonce[4:4] != b"\x00" * 4:
|
||||
nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xef
|
||||
break
|
||||
|
||||
|
@ -41,9 +41,7 @@ class TCPIntermediateO(TCP):
|
||||
while True:
|
||||
nonce = bytearray(os.urandom(64))
|
||||
|
||||
if (nonce[0] != b"\xef"
|
||||
and nonce[:4] not in self.RESERVED
|
||||
and nonce[4:4] != b"\x00" * 4):
|
||||
if nonce[0] != b"\xef" and nonce[:4] not in self.RESERVED and nonce[4:4] != b"\x00" * 4:
|
||||
nonce[56] = nonce[57] = nonce[58] = nonce[59] = 0xee
|
||||
break
|
||||
|
||||
|
33
pyrogram/vendor/typing/typing.py
vendored
33
pyrogram/vendor/typing/typing.py
vendored
@ -1,17 +1,18 @@
|
||||
import abc
|
||||
from abc import abstractmethod, abstractproperty
|
||||
import collections
|
||||
import contextlib
|
||||
import functools
|
||||
import re as stdlib_re # Avoid confusion with the re we export.
|
||||
import sys
|
||||
import types
|
||||
from abc import abstractmethod, abstractproperty
|
||||
|
||||
try:
|
||||
import collections.abc as collections_abc
|
||||
except ImportError:
|
||||
import collections as collections_abc # Fallback for PY3.2.
|
||||
if sys.version_info[:2] >= (3, 6):
|
||||
import _collections_abc # Needed for private function _check_methods # noqa
|
||||
pass
|
||||
try:
|
||||
from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType
|
||||
except ImportError:
|
||||
@ -19,7 +20,6 @@ except ImportError:
|
||||
MethodWrapperType = type(object().__str__)
|
||||
MethodDescriptorType = type(str.join)
|
||||
|
||||
|
||||
# Please keep __all__ alphabetized within each category.
|
||||
__all__ = [
|
||||
# Super-special typing primitives.
|
||||
@ -96,6 +96,7 @@ __all__ = [
|
||||
'TYPE_CHECKING',
|
||||
]
|
||||
|
||||
|
||||
# The pseudo-submodules 're' and 'io' are part of the public
|
||||
# namespace, but excluded from __all__ because they might stomp on
|
||||
# legitimate imports of those modules.
|
||||
@ -681,6 +682,7 @@ def _tp_cache(func):
|
||||
except TypeError:
|
||||
pass # All real errors (not unhashable args) are raised below.
|
||||
return func(*args, **kwds)
|
||||
|
||||
return inner
|
||||
|
||||
|
||||
@ -1714,31 +1716,31 @@ class _Protocol(metaclass=_ProtocolMeta):
|
||||
|
||||
Hashable = collections_abc.Hashable # Not generic.
|
||||
|
||||
|
||||
if hasattr(collections_abc, 'Awaitable'):
|
||||
class Awaitable(Generic[T_co], extra=collections_abc.Awaitable):
|
||||
__slots__ = ()
|
||||
|
||||
__all__.append('Awaitable')
|
||||
|
||||
__all__.append('Awaitable')
|
||||
|
||||
if hasattr(collections_abc, 'Coroutine'):
|
||||
class Coroutine(Awaitable[V_co], Generic[T_co, T_contra, V_co],
|
||||
extra=collections_abc.Coroutine):
|
||||
__slots__ = ()
|
||||
|
||||
|
||||
__all__.append('Coroutine')
|
||||
|
||||
|
||||
if hasattr(collections_abc, 'AsyncIterable'):
|
||||
|
||||
class AsyncIterable(Generic[T_co], extra=collections_abc.AsyncIterable):
|
||||
__slots__ = ()
|
||||
|
||||
|
||||
class AsyncIterator(AsyncIterable[T_co],
|
||||
extra=collections_abc.AsyncIterator):
|
||||
__slots__ = ()
|
||||
|
||||
|
||||
__all__.append('AsyncIterable')
|
||||
__all__.append('AsyncIterator')
|
||||
|
||||
@ -1810,7 +1812,6 @@ else:
|
||||
def __reversed__(self) -> 'Iterator[T_co]':
|
||||
pass
|
||||
|
||||
|
||||
Sized = collections_abc.Sized # Not generic.
|
||||
|
||||
|
||||
@ -1823,8 +1824,8 @@ if hasattr(collections_abc, 'Collection'):
|
||||
extra=collections_abc.Collection):
|
||||
__slots__ = ()
|
||||
|
||||
__all__.append('Collection')
|
||||
|
||||
__all__.append('Collection')
|
||||
|
||||
# Callable was defined earlier.
|
||||
|
||||
@ -1881,7 +1882,6 @@ class ByteString(Sequence[int], extra=collections_abc.ByteString):
|
||||
|
||||
|
||||
class List(list, MutableSequence[T], extra=list):
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __new__(cls, *args, **kwds):
|
||||
@ -1892,7 +1892,6 @@ class List(list, MutableSequence[T], extra=list):
|
||||
|
||||
|
||||
class Deque(collections.deque, MutableSequence[T], extra=collections.deque):
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __new__(cls, *args, **kwds):
|
||||
@ -1902,7 +1901,6 @@ class Deque(collections.deque, MutableSequence[T], extra=collections.deque):
|
||||
|
||||
|
||||
class Set(set, MutableSet[T], extra=set):
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __new__(cls, *args, **kwds):
|
||||
@ -1969,12 +1967,12 @@ else:
|
||||
return True
|
||||
return NotImplemented
|
||||
|
||||
|
||||
if hasattr(contextlib, 'AbstractAsyncContextManager'):
|
||||
class AsyncContextManager(Generic[T_co],
|
||||
extra=contextlib.AbstractAsyncContextManager):
|
||||
__slots__ = ()
|
||||
|
||||
|
||||
__all__.append('AsyncContextManager')
|
||||
elif sys.version_info[:2] >= (3, 5):
|
||||
exec("""
|
||||
@ -2003,7 +2001,6 @@ __all__.append('AsyncContextManager')
|
||||
|
||||
|
||||
class Dict(dict, MutableMapping[KT, VT], extra=dict):
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __new__(cls, *args, **kwds):
|
||||
@ -2015,7 +2012,6 @@ class Dict(dict, MutableMapping[KT, VT], extra=dict):
|
||||
|
||||
class DefaultDict(collections.defaultdict, MutableMapping[KT, VT],
|
||||
extra=collections.defaultdict):
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __new__(cls, *args, **kwds):
|
||||
@ -2025,7 +2021,6 @@ class DefaultDict(collections.defaultdict, MutableMapping[KT, VT],
|
||||
|
||||
|
||||
class Counter(collections.Counter, Dict[T, int], extra=collections.Counter):
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __new__(cls, *args, **kwds):
|
||||
@ -2038,6 +2033,7 @@ if hasattr(collections, 'ChainMap'):
|
||||
# ChainMap only exists in 3.3+
|
||||
__all__.append('ChainMap')
|
||||
|
||||
|
||||
class ChainMap(collections.ChainMap, MutableMapping[KT, VT],
|
||||
extra=collections.ChainMap):
|
||||
|
||||
@ -2048,7 +2044,6 @@ if hasattr(collections, 'ChainMap'):
|
||||
return collections.ChainMap(*args, **kwds)
|
||||
return _generic_new(collections.ChainMap, cls, *args, **kwds)
|
||||
|
||||
|
||||
# Determine what base class to use for Generator.
|
||||
if hasattr(collections_abc, 'Generator'):
|
||||
# Sufficiently recent versions of 3.5 have a Generator ABC.
|
||||
@ -2074,8 +2069,8 @@ if hasattr(collections_abc, 'AsyncGenerator'):
|
||||
extra=collections_abc.AsyncGenerator):
|
||||
__slots__ = ()
|
||||
|
||||
__all__.append('AsyncGenerator')
|
||||
|
||||
__all__.append('AsyncGenerator')
|
||||
|
||||
# Internal type variable used for Type[].
|
||||
CT_co = TypeVar('CT_co', covariant=True, bound=type)
|
||||
@ -2237,7 +2232,6 @@ def NewType(name, tp):
|
||||
# Python-version-specific alias (Python 2: unicode; Python 3: str)
|
||||
Text = str
|
||||
|
||||
|
||||
# Constant that's True when type checking, but False here.
|
||||
TYPE_CHECKING = False
|
||||
|
||||
@ -2394,7 +2388,6 @@ class io:
|
||||
io.__name__ = __name__ + '.io'
|
||||
sys.modules[io.__name__] = io
|
||||
|
||||
|
||||
Pattern = _TypeAlias('Pattern', AnyStr, type(stdlib_re.compile('')),
|
||||
lambda p: p.pattern)
|
||||
Match = _TypeAlias('Match', AnyStr, type(stdlib_re.match('', '')),
|
||||
|
Loading…
Reference in New Issue
Block a user