python3.9,removed windows build,kick vote,ban mute commands , rjcd

This commit is contained in:
imayushsaini 2021-11-10 17:26:07 +05:30
parent 94bdfb531a
commit dbe040a017
2453 changed files with 3797 additions and 437553 deletions

View file

@ -18,6 +18,7 @@ PEP_560 = sys.version_info[:3] >= (3, 7, 0)
if PEP_560:
GenericMeta = TypingMeta = type
from typing import _GenericAlias
else:
from typing import GenericMeta, TypingMeta
OLD_GENERICS = False
@ -136,7 +137,7 @@ __all__ = [
'Counter',
'Deque',
'DefaultDict',
'OrderedDict'
'OrderedDict',
'TypedDict',
# Structural checks, a.k.a. protocols.
@ -1399,7 +1400,7 @@ elif HAVE_PROTOCOLS and not PEP_560:
elif PEP_560:
from typing import _type_check, _GenericAlias, _collect_type_vars # noqa
from typing import _type_check, _collect_type_vars # noqa
def _no_init(self, *args, **kwargs):
if type(self)._is_protocol:
@ -1694,7 +1695,8 @@ else:
class _TypedDictMeta(type):
def __init__(cls, name, bases, ns, total=True):
# In Python 3.4 and 3.5 the __init__ method also needs to support the keyword arguments.
# In Python 3.4 and 3.5 the __init__ method also needs to support the
# keyword arguments.
# See https://www.python.org/dev/peps/pep-0487/#implementation-details
super(_TypedDictMeta, cls).__init__(name, bases, ns)
@ -2072,7 +2074,6 @@ if sys.version_info[:2] >= (3, 10):
get_origin = typing.get_origin
get_args = typing.get_args
elif PEP_560:
from typing import _GenericAlias
try:
# 3.9+
from typing import _BaseGenericAlias
@ -2329,6 +2330,9 @@ else:
be pickled.
"""
# Trick Generic __parameters__.
__class__ = TypeVar
@property
def args(self):
return ParamSpecArgs(self)
@ -2377,14 +2381,32 @@ else:
def __call__(self, *args, **kwargs):
pass
# Note: Can't fake ParamSpec as a TypeVar to get it to work
# with Generics. ParamSpec isn't an instance of TypeVar in 3.10.
# So encouraging code like isinstance(ParamSpec('P'), TypeVar))
# will lead to breakage in 3.10.
# This also means no accurate __parameters__ for GenericAliases.
if not PEP_560:
# Only needed in 3.6 and lower.
def _get_type_vars(self, tvars):
if self not in tvars:
tvars.append(self)
# Inherits from list as a workaround for Callable checks in Python < 3.9.2.
class _ConcatenateGenericAlias(list):
# Trick Generic into looking into this for __parameters__.
if PEP_560:
__class__ = typing._GenericAlias
elif sys.version_info[:3] == (3, 5, 2):
__class__ = typing.TypingMeta
else:
__class__ = typing._TypingBase
# Flag in 3.8.
_special = False
# Attribute in 3.6 and earlier.
if sys.version_info[:3] == (3, 5, 2):
_gorg = typing.GenericMeta
else:
_gorg = typing.Generic
def __init__(self, origin, args):
super().__init__(args)
self.__origin__ = origin
@ -2399,6 +2421,21 @@ class _ConcatenateGenericAlias(list):
def __hash__(self):
return hash((self.__origin__, self.__args__))
# Hack to get typing._type_check to pass in Generic.
def __call__(self, *args, **kwargs):
pass
@property
def __parameters__(self):
return tuple(tp for tp in self.__args__ if isinstance(tp, (TypeVar, ParamSpec)))
if not PEP_560:
# Only required in 3.6 and lower.
def _get_type_vars(self, tvars):
if self.__origin__ and self.__parameters__:
typing._get_type_vars(self.__parameters__, tvars)
@_tp_cache
def _concatenate_getitem(self, parameters):
if parameters == ():
@ -2439,7 +2476,8 @@ elif sys.version_info[:2] >= (3, 7):
def __getitem__(self, parameters):
return _concatenate_getitem(self, parameters)
Concatenate = _ConcatenateForm('Concatenate',
Concatenate = _ConcatenateForm(
'Concatenate',
doc="""Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
higher order function which adds, removes or transforms parameters of a
callable.
@ -2582,8 +2620,8 @@ elif sys.version_info[:2] >= (3, 7):
return _GenericAlias(self, (item,))
TypeGuard = _TypeGuardForm(
'TypeGuard',
doc="""Special typing form used to annotate the return type of a user-defined
'TypeGuard',
doc="""Special typing form used to annotate the return type of a user-defined
type guard function. ``TypeGuard`` only accepts a single type argument.
At runtime, functions marked this way should return a boolean.

View file

@ -8,7 +8,7 @@ from .nodes import *
from .loader import *
from .dumper import *
__version__ = '5.4.1'
__version__ = '6.0'
try:
from .cyaml import *
__with_libyaml__ = True
@ -18,41 +18,12 @@ except ImportError:
import io
#------------------------------------------------------------------------------
# Warnings control
# XXX "Warnings control" is now deprecated. Leaving in the API function to not
# break code that uses it.
#------------------------------------------------------------------------------
# 'Global' warnings state:
_warnings_enabled = {
'YAMLLoadWarning': True,
}
# Get or set global warnings' state
def warnings(settings=None):
if settings is None:
return _warnings_enabled
if type(settings) is dict:
for key in settings:
if key in _warnings_enabled:
_warnings_enabled[key] = settings[key]
# Warn when load() is called without Loader=...
class YAMLLoadWarning(RuntimeWarning):
pass
def load_warning(method):
if _warnings_enabled['YAMLLoadWarning'] is False:
return
import warnings
message = (
"calling yaml.%s() without Loader=... is deprecated, as the "
"default Loader is unsafe. Please read "
"https://msg.pyyaml.org/load for full details."
) % method
warnings.warn(message, YAMLLoadWarning, stacklevel=3)
return {}
#------------------------------------------------------------------------------
def scan(stream, Loader=Loader):
@ -100,30 +71,22 @@ def compose_all(stream, Loader=Loader):
finally:
loader.dispose()
def load(stream, Loader=None):
def load(stream, Loader):
"""
Parse the first YAML document in a stream
and produce the corresponding Python object.
"""
if Loader is None:
load_warning('load')
Loader = FullLoader
loader = Loader(stream)
try:
return loader.get_single_data()
finally:
loader.dispose()
def load_all(stream, Loader=None):
def load_all(stream, Loader):
"""
Parse all YAML documents in a stream
and produce corresponding Python objects.
"""
if Loader is None:
load_warning('load_all')
Loader = FullLoader
loader = Loader(stream)
try:
while loader.check_data():

View file

@ -369,7 +369,7 @@ Representer.add_representer(complex,
Representer.add_representer(tuple,
Representer.represent_tuple)
Representer.add_representer(type,
Representer.add_multi_representer(type,
Representer.represent_name)
Representer.add_representer(collections.OrderedDict,

View file

@ -177,7 +177,7 @@ Resolver.add_implicit_resolver(
Resolver.add_implicit_resolver(
'tag:yaml.org,2002:float',
re.compile(r'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)?
|\.[0-9_]+(?:[eE][-+][0-9]+)?
|\.[0-9][0-9_]*(?:[eE][-+][0-9]+)?
|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*
|[-+]?\.(?:inf|Inf|INF)
|\.(?:nan|NaN|NAN))$''', re.X),

View file

@ -1211,7 +1211,7 @@ class Scanner:
for k in range(length):
if self.peek(k) not in '0123456789ABCDEFabcdef':
raise ScannerError("while scanning a double-quoted scalar", start_mark,
"expected escape sequence of %d hexdecimal numbers, but found %r" %
"expected escape sequence of %d hexadecimal numbers, but found %r" %
(length, self.peek(k)), self.get_mark())
code = int(self.prefix(length), 16)
chunks.append(chr(code))
@ -1403,7 +1403,7 @@ class Scanner:
for k in range(2):
if self.peek(k) not in '0123456789ABCDEFabcdef':
raise ScannerError("while scanning a %s" % name, start_mark,
"expected URI escape sequence of 2 hexdecimal numbers, but found %r"
"expected URI escape sequence of 2 hexadecimal numbers, but found %r"
% self.peek(k), self.get_mark())
codes.append(int(self.prefix(2), 16))
self.forward(2)