diff --git a/www/src/Lib/sys.py b/www/src/Lib/sys.py index b94118a3d..d740aeb47 100644 --- a/www/src/Lib/sys.py +++ b/www/src/Lib/sys.py @@ -1,13 +1,38 @@ # hack to return special attributes from _sys import * +import _sys -import browser -import javascript +_getframe = _sys._getframe -class Error(Exception): - pass +class _dataclass(tuple): + + def __init__(self, **kwargs): + self.keys = list(kwargs) + self.__dict__.update(kwargs) + + def __getitem__(self, key): + if isinstance(key, int) and 0 <= key <= len(self.keys): + return self.__dict__[self.keys[key]] + raise KeyError(key) -_getframe = Getframe + def __iter__(self): + return (self.__dict__[key] for key in self.keys) + + def __len__(self): + return len(self.keys) + + def __repr__(self): + s = ', '.join(f'{k}={self.__dict__[k]}' for k in self.keys) + return f'sys.{self.__class__.__name__}({s})' + + +def make_dataclass(name, bases=None): + bases = [_dataclass] if bases is None else [*bases, _dataclass] + cls = type(name, bases, {}) + return cls + + +__breakpointhook__ = breakpointhook abiflags = 0 # required in sysconfig @@ -42,27 +67,24 @@ def displayhook(value): def exit(i=None): raise SystemExit('') -class flag_class: - - def __init__(self): - self.debug = 0 - self.inspect = 0 - self.interactive = 0 - self.optimize = 0 - self.dont_write_bytecode = 0 - self.no_user_site = 0 - self.no_site = 0 - self.ignore_environment = 0 - self.verbose = 0 - self.bytes_warning = 0 - self.quiet = 0 - self.hash_randomization = 1 - self.isolated = 0 - self.dev_mode = False - self.utf8_mode = 0 - self.warn_default_encoding = 0 - -flags = flag_class() +flags = make_dataclass('flags')( + debug = 0, + inspect = 0, + interactive = 0, + optimize = 0, + dont_write_bytecode = 0, + no_user_site = 0, + no_site = 0, + ignore_environment = 0, + verbose = 0, + bytes_warning = 0, + quiet = 0, + hash_randomization = 1, + isolated = 0, + dev_mode = False, + utf8_mode = 0, + warn_default_encoding = 0 + ) def getfilesystemencoding(*args, **kw): """getfilesystemencoding() -> string @@ -76,11 +98,11 @@ def getfilesystemencodeerrors(): def intern(string): return string -class int_info: - bits_per_digit = 30 - sizeof_digit = 4 - default_max_str_digits = __BRYTHON__.int_max_str_digits - str_digits_check_threshold = __BRYTHON__.str_digits_check_threshold +int_info = make_dataclass('int_info')( + bits_per_digit = 30, + sizeof_digit = 4, + default_max_str_digits = __BRYTHON__.int_max_str_digits, + str_digits_check_threshold = __BRYTHON__.str_digits_check_threshold) def get_int_max_str_digits(): return __BRYTHON__.int_max_str_digits @@ -113,20 +135,7 @@ def set_int_max_str_digits(value): % __BRYTHON__.compiled_date hexversion = 0x030800f0 # python 3.8 -class _version_info: - - def __init__(self, version_info): - self.version_info = version_info - self.major = version_info[0] - self.minor = version_info[1] - self.micro = version_info[2] - self.releaselevel = version_info[3] - self.serial = version_info[4] - - def __getitem__(self, index): - if isinstance(self.version_info[index], list): - return tuple(self.version_info[index]) - return self.version_info[index] +class _comparable: def hexversion(self): try: @@ -134,62 +143,70 @@ def hexversion(self): finally: #probably some invalid char in minor (rc, etc) return '0%d0000' % (self.major) - def __str__(self): - _s = "sys.version(major=%d, minor=%d, micro=%d, releaselevel='%s', " \ - "serial=%d)" - return _s % (self.major, self.minor, self.micro, - self.releaselevel, self.serial) - - __repr__ = __str__ - def __eq__(self, other): if isinstance(other, tuple): return (self.major, self.minor, self.micro) == other - raise Error("Error! I don't know how to compare!") + return NotImplemented def __ge__(self, other): if isinstance(other, tuple): return (self.major, self.minor, self.micro) >= other - raise Error("Error! I don't know how to compare!") + return NotImplemented def __gt__(self, other): if isinstance(other, tuple): return (self.major, self.minor, self.micro) > other - raise Error("Error! I don't know how to compare!") + return NotImplemented def __le__(self, other): if isinstance(other, tuple): return (self.major, self.minor, self.micro) <= other - raise Error("Error! I don't know how to compare!") + return NotImplemented def __lt__(self, other): if isinstance(other, tuple): return (self.major, self.minor, self.micro) < other - raise Error("Error! I don't know how to compare!") + return NotImplemented def __ne__(self, other): if isinstance(other, tuple): return (self.major, self.minor, self.micro) != other - raise Error("Error! I don't know how to compare!") + return NotImplemented #eventually this needs to be the real python version such as 3.0, 3.1, etc -version_info = _version_info(__BRYTHON__.version_info) +version_info = make_dataclass('version_info', [_comparable])( + major = __BRYTHON__.version_info[0], + minor = __BRYTHON__.version_info[1], + micro = __BRYTHON__.version_info[2], + releaselevel = __BRYTHON__.version_info[3], + serial = __BRYTHON__.version_info[4]) + class SimpleNamespace: def __init__(self, /, **kwargs): + self.keys = list(kwargs) self.__dict__.update(kwargs) + def __getitem__(self, key): + if isinstance(key, int) and 0 <= key <= len(self.keys): + return getattr(self, self.keys[key]) + raise KeyError(key) + + def __iter__(self): + return iter(self.__dict__.values()) + def __repr__(self): - items = (f"{k}={v!r}" for k, v in self.__dict__.items()) - return "{}({})".format("namespace", ", ".join(items)) + items = (f"{k}={v!r}" for k, v in self.__dict__.items() + if k in self.keys) + return f"namespace({', '.join(items)})" def __eq__(self, other): if isinstance(self, SimpleNamespace) and isinstance(other, SimpleNamespace): @@ -198,105 +215,39 @@ def __eq__(self, other): SimpleNamespace.__module__ = "types" -vi = _version_info(__BRYTHON__.implementation) -implementation = SimpleNamespace(name = "brython", - version=vi, - hexversion = vi.hexversion(), - cache_tag = None) - -class _hash_info: - - def __init__(self): - self.width = 32 - self.modulus = 2147483647 - self.inf = 314159 - self.nan = 0 - self.imag = 1000003 - self.algorithm = 'siphash24' - self.hash_bits = 64 - self.seed_bits = 128 +implementation = SimpleNamespace( + version = version_info, + major = __BRYTHON__.version_info[0], + minor = __BRYTHON__.version_info[1], + micro = __BRYTHON__.version_info[2], + releaselevel = __BRYTHON__.version_info[3], + serial = __BRYTHON__.version_info[4]) + +hash_info = make_dataclass('hash_info')( + width = 32, + modulus = 2147483647, + inf = 314159, + nan = 0, + imag = 1000003, + algorithm = 'siphash24', + hash_bits = 64, + seed_bits = 128, cutoff=0 - - def __repr__(self): - #fix me - return "sys.hash_info(width=32, modulus=2147483647, inf=314159, " \ - "nan=0, imag=1000003, algorithm='siphash24', hash_bits=64, " \ - "seed_bits=128, cutoff=0)" - -hash_info = _hash_info() - -class _float_info: - """ - | A structseq holding information about the float type. It contains low level - | information about the precision and internal representation. - | - | Brython's float is based on Javascript's Number type which is a - | double-precision 64-bit binary format IEEE 754 value - | (number between -(2**53 -1) and 2**53 -1). For more information see: - | - | https://developer.mozilla.org/cs/docs/Web/JavaScript/Data_structures - | http://en.wikipedia.org/wiki/Double_precision_floating-point_format - | - | ---------------------------------------------------------------------- - | Data descriptors defined here: - | - | dig - | DBL_DIG -- digits - | - | epsilon - | DBL_EPSILON -- Difference between 1 and the next representable float - | - | mant_dig - | DBL_MANT_DIG -- mantissa digits - | - | max - | DBL_MAX -- maximum representable finite float - | - | max_10_exp - | DBL_MAX_10_EXP -- maximum int e such that 10**e is representable - | - | max_exp - | DBL_MAX_EXP -- maximum int e such that radix**(e-1) is representable - | - | min - | DBL_MIN -- Minimum positive normalized float - | - | min_10_exp - | DBL_MIN_10_EXP -- minimum int e such that 10**e is a normalized float - | - | min_exp - | DBL_MIN_EXP -- minimum int e such that radix**(e-1) is a normalized float - | - | radix - | FLT_RADIX -- radix of exponent - | - | rounds - | FLT_ROUNDS -- integer constant representing the rounding mode used for arithmetic operations. This reflects the value of the system FLT_ROUNDS macro at - | interpreter startup time. See section 5.2.4.2.2 of the C99 standard for an explanation of the possible values and their meanings. - """ - def __init__(self): - self.dig = 15 - self.epsilon = 2 ** -52 - self.mant_dig = 53 - self.max = __BRYTHON__.MAX_VALUE - self.max_exp = 2 ** 10 - self.max_10_exp = 308 - self.min = __BRYTHON__.MIN_VALUE - self.min_exp = -1021 - self.min_10_exp = -307 - self.radix = 2 - self.rounds = 1 - self._tuple = (self.max, self.max_exp, self.max_10_exp, self.min, - self.min_exp, self.min_10_exp, self.dig, self.mant_dig, self.epsilon, - self.radix, self.rounds) - - def __getitem__(self, k): - return self._tuple[k] - - def __iter__(self): - return iter(self._tuple) - -float_info = _float_info() + ) + +float_info = make_dataclass('float_info')( + dig = 15, + epsilon = 2 ** -52, + mant_dig = 53, + max = __BRYTHON__.MAX_VALUE, + max_exp = 2 ** 10, + max_10_exp = 308, + min = __BRYTHON__.MIN_VALUE, + min_exp = -1021, + min_10_exp = -307, + radix = 2, + rounds = 1 + ) warnoptions = [] diff --git a/www/src/brython_stdlib.js b/www/src/brython_stdlib.js index e3357d11c..fbd7b4290 100644 --- a/www/src/brython_stdlib.js +++ b/www/src/brython_stdlib.js @@ -1,3 +1,3 @@ __BRYTHON__.use_VFS = true; -var scripts = {"$timestamp": 1697959011545, "array": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\nvar typecodes = {\n 'b': Int8Array, // signed char, 1 byte\n 'B': Uint8Array, // unsigned char, 1\n 'u': Uint32Array, // Py_UNICODE Unicode character, 2 (deprecated)\n 'h': Int16Array, // signed short, 2\n 'H': Uint16Array, // unsigned short, 2\n 'i': Int16Array, // signed int, 2\n 'I': Uint16Array, // unsigned int, 2\n 'l': Int32Array, // signed long, 4\n 'L': Uint32Array, // unsigned long, 4\n 'q': null, // signed long, 8 (not implemented)\n 'Q': null, // unsigned long, 8 (not implemented)\n 'f': Float32Array, // float, 4\n 'd': Float64Array // double float, 8\n}\n\nvar array = $B.make_class(\"array\",\n function(){\n var missing = {},\n $ = $B.args(\"array\", 2, {typecode: null, initializer: null},\n [\"typecode\", \"initializer\"], arguments, {initializer: missing},\n null, null),\n typecode = $.typecode,\n initializer = $.initializer\n if(! typecodes.hasOwnProperty(typecode)){\n throw _b_.ValueError.$factory(\"bad typecode (must be b, \" +\n \"B, u, h, H, i, I, l, L, q, Q, f or d)\")\n }\n if(typecodes[typecode] === null){\n console.log(\"array factory, $\", $, typecode)\n throw _b_.NotImplementedError.$factory(\"type code \" +\n typecode + \" is not implemented\")\n }\n var res = {\n __class__: array,\n typecode: typecode,\n obj: null\n }\n if(initializer !== missing){\n if(Array.isArray(initializer)){\n array.fromlist(res, initializer)\n }else if($B.$isinstance(initializer, _b_.bytes)){\n array.frombytes(res, initializer)\n }else{\n array.extend(res, initializer)\n }\n }\n return res\n }\n)\n\narray.$buffer_protocol = true\narray.$match_sequence_pattern = true // for Pattern Matching (PEP 634)\n\narray.__getitem__ = function(self, key){\n if(self.obj && self.obj[key] !== undefined){\n return self.obj[key]\n }\n throw _b_.IndexError.$factory(\"array index out of range\")\n}\n\nvar array_iterator = $B.make_iterator_class(\"array_iterator\")\narray.__iter__ = function(self){\n return array_iterator.$factory(self.obj === null ? [] : self.obj)\n}\n\narray.__len__ = function(self){\n return self.obj === null ? 0 : self.obj.length\n}\n\narray.__mul__ = function(self, nb){\n if(typeof nb == \"number\" || $B.$isinstance(nb, _b_.int)){\n var t = [],\n copy = self.obj.slice()\n for(var i = 0; i < nb; i++){\n t = t.concat(copy)\n }\n return {\n __class__: array,\n typecode: self.typecode,\n obj: t\n }\n }\n throw _b_.ValueError.$factory(\"cannot multiply array by \" +\n $B.class_name(nb))\n}\n\narray.__setitem__ = function(_self, index, value){\n if(_self.obj[index] === undefined){\n throw _b_.IndexError.$factory(\"array index out of range\")\n }\n _self.obj[index] = value\n}\n\narray.__str__ = function(self){\n $B.args(\"__str__\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n var res = \"array('\" + self.typecode + \"'\"\n if(self.obj !== null){\n res += \", [\" + self.obj + \"]\"\n }\n return res + \")\"\n}\n\nfunction normalize_index(self, i){\n // return an index i between 0 and self.obj.length - 1\n if(i < 0){\n i = self.obj.length + i\n }\n if(i < 0){i = 0}\n else if(i > self.obj.length - 1){\n i = self.obj.length\n }\n return i\n}\n\narray.append = function(self, value){\n $B.args(\"append\", 2, {self: null, value: null},\n [\"self\", \"value\"], arguments, {}, null, null)\n var pos = self.obj === null ? 0 : self.obj.length\n return array.insert(self, pos, value)\n}\n\narray.count = function(self, x){\n $B.args(\"count\", 2, {self: null, x: null},\n [\"self\", \"x\"], arguments, {}, null, null)\n if(self.obj === null){return 0}\n return self.obj.filter(function(item){return item == x}).length\n}\n\narray.extend = function(self, iterable){\n $B.args(\"extend\", 2, {self: null, iterable: null},\n [\"self\", \"iterable\"], arguments, {}, null, null)\n if(iterable.__class__ === array){\n if(iterable.typecode !== self.typecode){\n throw _b_.TypeError.$factory(\"can only extend with array \" +\n \"of same kind\")\n }\n if(iterable.obj === null){return _b_.None}\n // create new object with length = sum of lengths\n var newobj = new typecodes[self.typecode](self.obj.length +\n iterable.obj.length)\n // copy self.obj\n newobj.set(self.obj)\n // copy iterable.obj\n newobj.set(iterable.obj, self.obj.length)\n self.obj = newobj\n }else{\n var it = _b_.iter(iterable)\n while(true){\n try{\n var item = _b_.next(it)\n array.append(self, item)\n }catch(err){\n if(err.__class__ !== _b_.StopIteration){\n throw err\n }\n break\n }\n }\n }\n return _b_.None\n}\n\narray.frombytes = function(self, s){\n $B.args(\"frombytes\", 2, {self: null, s: null},\n [\"self\", \"s\"], arguments, {}, null, null)\n if(! $B.$isinstance(s, _b_.bytes)){\n throw _b_.TypeError.$factory(\"a bytes-like object is required, \" +\n \"not '\" + $B.class_name(s) + \"'\")\n }\n self.obj = new typecodes[self.typecode](s.source)\n return _b_.None\n}\n\narray.fromlist = function(self, list){\n $B.args(\"fromlist\", 2, {self: null, list: null},\n [\"self\", \"list\"], arguments, {}, null, null)\n var it = _b_.iter(list)\n while(true){\n try{\n var item = _b_.next(it)\n try{\n array.append(self, item)\n }catch(err){\n console.log(err)\n return _b_.None\n }\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n return _b_.None\n }\n throw err\n }\n }\n}\n\narray.fromstring = array.frombytes\n\narray.index = function(self, x){\n $B.args(\"index\", 2, {self: null, x: null},\n [\"self\", \"x\"], arguments, {}, null, null)\n var res = self.obj.findIndex(function(item){return x == item})\n if(res == -1){\n throw _b_.ValueError.$factory(\"array.index(x): x not in array\")\n }\n return res\n}\n\narray.insert = function(self, i, value){\n $B.args(\"insert\", 3, {self: null, i: null, value: null},\n [\"self\", \"i\", \"value\"], arguments, {}, null, null)\n if(self.obj === null){\n self.obj = [value]\n }else{\n self.obj.splice(i, 0, value)\n }\n return _b_.None\n}\n\narray.itemsize = function(self){\n return typecodes[self.typecode].BYTES_PER_ELEMENT\n}\n\narray.pop = function(self, i){\n var $ = $B.args(\"count\", 2, {self: null, i: null},\n [\"self\", \"i\"], arguments, {i: -1}, null, null)\n i = $.i\n if(self.obj === null){\n throw _b_.IndexError.$factory(\"pop from empty array\")\n }else if(self.obj.length == 1){\n var res = self.obj[0]\n self.obj = null\n return res\n }\n i = normalize_index(self, i)\n // store value to return\n var res = self.obj[i]\n // create new array, size = previous size - 1\n var newobj = new typecodes[self.typecode](self.obj.length - 1)\n // fill new array with values until i excluded\n newobj.set(self.obj.slice(0, i))\n // fill with values after i\n newobj.set(self.obj.slice(i + 1), i)\n // set self.obj to new array\n self.obj = newobj\n // return stored value\n return res\n}\n\narray.remove = function(self, x){\n $B.args(\"remove\", 2, {self: null, x: null},\n [\"self\", \"x\"], arguments, {}, null, null)\n var res = self.obj.findIndex(function(item){return x == item})\n if(res == -1){\n throw _b_.ValueError.$factory(\"array.remove(x): x not in array\")\n }\n array.pop(self, res)\n return _b_.None\n}\n\narray.reverse = function(self){\n $B.args(\"reverse\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n if(self.obj === null){return _b_.None}\n self.obj.reverse()\n return _b_.None\n}\n\narray.tobytes = function(self){\n $B.args(\"tobytes\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n var items = Array.prototype.slice.call(self.obj),\n res = []\n items.forEach(function(item){\n while(item > 256){\n res.push(item % 256)\n item = Math.floor(item / 256)\n }\n res.push(item)\n })\n return _b_.bytes.$factory(res)\n}\n\narray.tolist = function(self){\n $B.args(\"tolist\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n if(self.obj === null){\n return $B.$list([])\n }\n return Array.prototype.slice.call(self.obj)\n}\n\narray.tostring = array.tobytes\n\narray.typecode = function(self){\n return self.typecode\n}\n\n$B.set_func_names(array, \"array\")\n\nreturn {\n array: array,\n typecodes: Object.keys(typecodes).join('')\n}\n\n})(__BRYTHON__)\n"], "builtins": [".js", "var $module = (function(){\n var obj = {\n __class__: __BRYTHON__.module,\n __name__: 'builtins'\n },\n builtin_names = ['ArithmeticError', 'AssertionError',\n 'AttributeError', 'BaseException', 'BaseExceptionGroup',\n 'BlockingIOError', 'BrokenPipeError', 'BufferError',\n 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError',\n 'ConnectionError', 'ConnectionRefusedError',\n 'ConnectionResetError', 'DeprecationWarning', 'EOFError',\n 'Ellipsis', 'EncodingWarning', 'EnvironmentError', 'Exception',\n 'ExceptionGroup', 'False', 'FileExistsError', 'FileNotFoundError',\n 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError',\n 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError',\n 'InterruptedError', 'IsADirectoryError', 'KeyError',\n 'KeyboardInterrupt', 'LookupError', 'MemoryError',\n 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError',\n 'NotImplemented', 'NotImplementedError', 'OSError',\n 'OverflowError', 'PendingDeprecationWarning', 'PermissionError',\n 'ProcessLookupError', 'RecursionError', 'ReferenceError',\n 'ResourceWarning', 'RuntimeError', 'RuntimeWarning',\n 'StopAsyncIteration', 'StopIteration', 'SyntaxError',\n 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError',\n 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError',\n 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError',\n 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',\n 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError',\n '_', '__build_class__', '__debug__', '__import__',\n 'abs', 'aiter', 'all', 'anext', 'any', 'ascii', 'bin', 'bool',\n 'breakpoint', 'bytearray', 'bytes', 'callable', 'chr',\n 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir',\n 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float',\n 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash',\n 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass',\n 'iter', 'len', 'list', 'locals', 'map', 'max', 'memoryview',\n 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print',\n 'property', 'quit', 'range', 'repr', 'reversed', 'round', 'set',\n 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum',\n 'super', 'tuple', 'type', 'vars', 'zip']\n for(var key of builtin_names){\n if(__BRYTHON__.builtins[key] !== undefined){\n obj[key] = __BRYTHON__.builtins[key]\n }\n }\n obj.__doc__ = 'builtins module'\n obj.copyright = 'CPython copyright'\n obj.credits = 'CPython builtins credits'\n obj.license = 'CPython license'\n return obj\n})()\n"], "dis": [".js", "var $module=(function($B){\n\nvar dict = $B.builtins.dict\nvar mod = {\n dis:function(src){\n $B.$py_module_path['__main__'] = $B.brython_path\n return __BRYTHON__.py2js(src,'__main__','__main__',\n $B.builtins_scope).to_js()\n },\n OPTIMIZED: 1,\n NEWLOCALS: 2,\n VARARGS: 4,\n VARKEYWORDS: 8,\n NESTED: 16,\n GENERATOR: 32,\n NOFREE: 64,\n COROUTINE: 128,\n ITERABLE_COROUTINE: 256,\n ASYNC_GENERATOR: 512,\n COMPILER_FLAG_NAMES: $B.builtins.dict.$factory()\n}\nmod.COMPILER_FLAG_NAMES = dict.$factory([\n [1, \"OPTIMIZED\"],\n [2, \"NEWLOCALS\"],\n [4, \"VARARGS\"],\n [8, \"VARKEYWORDS\"],\n [16, \"NESTED\"],\n [32, \"GENERATOR\"],\n [64, \"NOFREE\"],\n [128, \"COROUTINE\"],\n [256, \"ITERABLE_COROUTINE\"],\n [512, \"ASYNC_GENERATOR\"]\n])\n\nreturn mod\n\n})(__BRYTHON__)"], "encoding_cp932": [".js", "var _table = [0x00, 0x0000,0x01, 0x0001,0x02, 0x0002,0x03, 0x0003,0x04, 0x0004,0x05, 0x0005,0x06, 0x0006,0x07, 0x0007,0x08, 0x0008,0x09, 0x0009,0x0A, 0x000A,0x0B, 0x000B,0x0C, 0x000C,0x0D, 0x000D,0x0E, 0x000E,0x0F, 0x000F,0x10, 0x0010,0x11, 0x0011,0x12, 0x0012,0x13, 0x0013,0x14, 0x0014,0x15, 0x0015,0x16, 0x0016,0x17, 0x0017,0x18, 0x0018,0x19, 0x0019,0x1A, 0x001A,0x1B, 0x001B,0x1C, 0x001C,0x1D, 0x001D,0x1E, 0x001E,0x1F, 0x001F,0x20, 0x0020,0x21, 0x0021,0x22, 0x0022,0x23, 0x0023,0x24, 0x0024,0x25, 0x0025,0x26, 0x0026,0x27, 0x0027,0x28, 0x0028,0x29, 0x0029,0x2A, 0x002A,0x2B, 0x002B,0x2C, 0x002C,0x2D, 0x002D,0x2E, 0x002E,0x2F, 0x002F,0x30, 0x0030,0x31, 0x0031,0x32, 0x0032,0x33, 0x0033,0x34, 0x0034,0x35, 0x0035,0x36, 0x0036,0x37, 0x0037,0x38, 0x0038,0x39, 0x0039,0x3A, 0x003A,0x3B, 0x003B,0x3C, 0x003C,0x3D, 0x003D,0x3E, 0x003E,0x3F, 0x003F,0x40, 0x0040,0x41, 0x0041,0x42, 0x0042,0x43, 0x0043,0x44, 0x0044,0x45, 0x0045,0x46, 0x0046,0x47, 0x0047,0x48, 0x0048,0x49, 0x0049,0x4A, 0x004A,0x4B, 0x004B,0x4C, 0x004C,0x4D, 0x004D,0x4E, 0x004E,0x4F, 0x004F,0x50, 0x0050,0x51, 0x0051,0x52, 0x0052,0x53, 0x0053,0x54, 0x0054,0x55, 0x0055,0x56, 0x0056,0x57, 0x0057,0x58, 0x0058,0x59, 0x0059,0x5A, 0x005A,0x5B, 0x005B,0x5C, 0x005C,0x5D, 0x005D,0x5E, 0x005E,0x5F, 0x005F,0x60, 0x0060,0x61, 0x0061,0x62, 0x0062,0x63, 0x0063,0x64, 0x0064,0x65, 0x0065,0x66, 0x0066,0x67, 0x0067,0x68, 0x0068,0x69, 0x0069,0x6A, 0x006A,0x6B, 0x006B,0x6C, 0x006C,0x6D, 0x006D,0x6E, 0x006E,0x6F, 0x006F,0x70, 0x0070,0x71, 0x0071,0x72, 0x0072,0x73, 0x0073,0x74, 0x0074,0x75, 0x0075,0x76, 0x0076,0x77, 0x0077,0x78, 0x0078,0x79, 0x0079,0x7A, 0x007A,0x7B, 0x007B,0x7C, 0x007C,0x7D, 0x007D,0x7E, 0x007E,0x7F, 0x007F,0x80, -1,0x81, -1,0x82, -1,0x83, -1,0x84, -1,0x85, -1,0x86, -1,0x87, -1,0x88, -1,0x89, -1,0x8A, -1,0x8B, -1,0x8C, -1,0x8D, -1,0x8E, -1,0x8F, -1,0x90, -1,0x91, -1,0x92, -1,0x93, -1,0x94, -1,0x95, -1,0x96, -1,0x97, -1,0x98, -1,0x99, -1,0x9A, -1,0x9B, -1,0x9C, -1,0x9D, -1,0x9E, -1,0x9F, -1,0xA0, -1,0xA1, 0xFF61,0xA2, 0xFF62,0xA3, 0xFF63,0xA4, 0xFF64,0xA5, 0xFF65,0xA6, 0xFF66,0xA7, 0xFF67,0xA8, 0xFF68,0xA9, 0xFF69,0xAA, 0xFF6A,0xAB, 0xFF6B,0xAC, 0xFF6C,0xAD, 0xFF6D,0xAE, 0xFF6E,0xAF, 0xFF6F,0xB0, 0xFF70,0xB1, 0xFF71,0xB2, 0xFF72,0xB3, 0xFF73,0xB4, 0xFF74,0xB5, 0xFF75,0xB6, 0xFF76,0xB7, 0xFF77,0xB8, 0xFF78,0xB9, 0xFF79,0xBA, 0xFF7A,0xBB, 0xFF7B,0xBC, 0xFF7C,0xBD, 0xFF7D,0xBE, 0xFF7E,0xBF, 0xFF7F,0xC0, 0xFF80,0xC1, 0xFF81,0xC2, 0xFF82,0xC3, 0xFF83,0xC4, 0xFF84,0xC5, 0xFF85,0xC6, 0xFF86,0xC7, 0xFF87,0xC8, 0xFF88,0xC9, 0xFF89,0xCA, 0xFF8A,0xCB, 0xFF8B,0xCC, 0xFF8C,0xCD, 0xFF8D,0xCE, 0xFF8E,0xCF, 0xFF8F,0xD0, 0xFF90,0xD1, 0xFF91,0xD2, 0xFF92,0xD3, 0xFF93,0xD4, 0xFF94,0xD5, 0xFF95,0xD6, 0xFF96,0xD7, 0xFF97,0xD8, 0xFF98,0xD9, 0xFF99,0xDA, 0xFF9A,0xDB, 0xFF9B,0xDC, 0xFF9C,0xDD, 0xFF9D,0xDE, 0xFF9E,0xDF, 0xFF9F,0xE0, -1,0xE1, -1,0xE2, -1,0xE3, -1,0xE4, -1,0xE5, -1,0xE6, -1,0xE7, -1,0xE8, -1,0xE9, -1,0xEA, -1,0xEB, -1,0xEC, -1,0xED, -1,0xEE, -1,0xEF, -1,0xF0, -1,0xF1, -1,0xF2, -1,0xF3, -1,0xF4, -1,0xF5, -1,0xF6, -1,0xF7, -1,0xF8, -1,0xF9, -1,0xFA, -1,0xFB, -1,0xFC, -1,0xFD, -1,0xFE, -1,0xFF, -1,0x8140, 0x3000,0x8141, 0x3001,0x8142, 0x3002,0x8143, 0xFF0C,0x8144, 0xFF0E,0x8145, 0x30FB,0x8146, 0xFF1A,0x8147, 0xFF1B,0x8148, 0xFF1F,0x8149, 0xFF01,0x814A, 0x309B,0x814B, 0x309C,0x814C, 0x00B4,0x814D, 0xFF40,0x814E, 0x00A8,0x814F, 0xFF3E,0x8150, 0xFFE3,0x8151, 0xFF3F,0x8152, 0x30FD,0x8153, 0x30FE,0x8154, 0x309D,0x8155, 0x309E,0x8156, 0x3003,0x8157, 0x4EDD,0x8158, 0x3005,0x8159, 0x3006,0x815A, 0x3007,0x815B, 0x30FC,0x815C, 0x2015,0x815D, 0x2010,0x815E, 0xFF0F,0x815F, 0xFF3C,0x8160, 0xFF5E,0x8161, 0x2225,0x8162, 0xFF5C,0x8163, 0x2026,0x8164, 0x2025,0x8165, 0x2018,0x8166, 0x2019,0x8167, 0x201C,0x8168, 0x201D,0x8169, 0xFF08,0x816A, 0xFF09,0x816B, 0x3014,0x816C, 0x3015,0x816D, 0xFF3B,0x816E, 0xFF3D,0x816F, 0xFF5B,0x8170, 0xFF5D,0x8171, 0x3008,0x8172, 0x3009,0x8173, 0x300A,0x8174, 0x300B,0x8175, 0x300C,0x8176, 0x300D,0x8177, 0x300E,0x8178, 0x300F,0x8179, 0x3010,0x817A, 0x3011,0x817B, 0xFF0B,0x817C, 0xFF0D,0x817D, 0x00B1,0x817E, 0x00D7,0x8180, 0x00F7,0x8181, 0xFF1D,0x8182, 0x2260,0x8183, 0xFF1C,0x8184, 0xFF1E,0x8185, 0x2266,0x8186, 0x2267,0x8187, 0x221E,0x8188, 0x2234,0x8189, 0x2642,0x818A, 0x2640,0x818B, 0x00B0,0x818C, 0x2032,0x818D, 0x2033,0x818E, 0x2103,0x818F, 0xFFE5,0x8190, 0xFF04,0x8191, 0xFFE0,0x8192, 0xFFE1,0x8193, 0xFF05,0x8194, 0xFF03,0x8195, 0xFF06,0x8196, 0xFF0A,0x8197, 0xFF20,0x8198, 0x00A7,0x8199, 0x2606,0x819A, 0x2605,0x819B, 0x25CB,0x819C, 0x25CF,0x819D, 0x25CE,0x819E, 0x25C7,0x819F, 0x25C6,0x81A0, 0x25A1,0x81A1, 0x25A0,0x81A2, 0x25B3,0x81A3, 0x25B2,0x81A4, 0x25BD,0x81A5, 0x25BC,0x81A6, 0x203B,0x81A7, 0x3012,0x81A8, 0x2192,0x81A9, 0x2190,0x81AA, 0x2191,0x81AB, 0x2193,0x81AC, 0x3013,0x81B8, 0x2208,0x81B9, 0x220B,0x81BA, 0x2286,0x81BB, 0x2287,0x81BC, 0x2282,0x81BD, 0x2283,0x81BE, 0x222A,0x81BF, 0x2229,0x81C8, 0x2227,0x81C9, 0x2228,0x81CA, 0xFFE2,0x81CB, 0x21D2,0x81CC, 0x21D4,0x81CD, 0x2200,0x81CE, 0x2203,0x81DA, 0x2220,0x81DB, 0x22A5,0x81DC, 0x2312,0x81DD, 0x2202,0x81DE, 0x2207,0x81DF, 0x2261,0x81E0, 0x2252,0x81E1, 0x226A,0x81E2, 0x226B,0x81E3, 0x221A,0x81E4, 0x223D,0x81E5, 0x221D,0x81E6, 0x2235,0x81E7, 0x222B,0x81E8, 0x222C,0x81F0, 0x212B,0x81F1, 0x2030,0x81F2, 0x266F,0x81F3, 0x266D,0x81F4, 0x266A,0x81F5, 0x2020,0x81F6, 0x2021,0x81F7, 0x00B6,0x81FC, 0x25EF,0x824F, 0xFF10,0x8250, 0xFF11,0x8251, 0xFF12,0x8252, 0xFF13,0x8253, 0xFF14,0x8254, 0xFF15,0x8255, 0xFF16,0x8256, 0xFF17,0x8257, 0xFF18,0x8258, 0xFF19,0x8260, 0xFF21,0x8261, 0xFF22,0x8262, 0xFF23,0x8263, 0xFF24,0x8264, 0xFF25,0x8265, 0xFF26,0x8266, 0xFF27,0x8267, 0xFF28,0x8268, 0xFF29,0x8269, 0xFF2A,0x826A, 0xFF2B,0x826B, 0xFF2C,0x826C, 0xFF2D,0x826D, 0xFF2E,0x826E, 0xFF2F,0x826F, 0xFF30,0x8270, 0xFF31,0x8271, 0xFF32,0x8272, 0xFF33,0x8273, 0xFF34,0x8274, 0xFF35,0x8275, 0xFF36,0x8276, 0xFF37,0x8277, 0xFF38,0x8278, 0xFF39,0x8279, 0xFF3A,0x8281, 0xFF41,0x8282, 0xFF42,0x8283, 0xFF43,0x8284, 0xFF44,0x8285, 0xFF45,0x8286, 0xFF46,0x8287, 0xFF47,0x8288, 0xFF48,0x8289, 0xFF49,0x828A, 0xFF4A,0x828B, 0xFF4B,0x828C, 0xFF4C,0x828D, 0xFF4D,0x828E, 0xFF4E,0x828F, 0xFF4F,0x8290, 0xFF50,0x8291, 0xFF51,0x8292, 0xFF52,0x8293, 0xFF53,0x8294, 0xFF54,0x8295, 0xFF55,0x8296, 0xFF56,0x8297, 0xFF57,0x8298, 0xFF58,0x8299, 0xFF59,0x829A, 0xFF5A,0x829F, 0x3041,0x82A0, 0x3042,0x82A1, 0x3043,0x82A2, 0x3044,0x82A3, 0x3045,0x82A4, 0x3046,0x82A5, 0x3047,0x82A6, 0x3048,0x82A7, 0x3049,0x82A8, 0x304A,0x82A9, 0x304B,0x82AA, 0x304C,0x82AB, 0x304D,0x82AC, 0x304E,0x82AD, 0x304F,0x82AE, 0x3050,0x82AF, 0x3051,0x82B0, 0x3052,0x82B1, 0x3053,0x82B2, 0x3054,0x82B3, 0x3055,0x82B4, 0x3056,0x82B5, 0x3057,0x82B6, 0x3058,0x82B7, 0x3059,0x82B8, 0x305A,0x82B9, 0x305B,0x82BA, 0x305C,0x82BB, 0x305D,0x82BC, 0x305E,0x82BD, 0x305F,0x82BE, 0x3060,0x82BF, 0x3061,0x82C0, 0x3062,0x82C1, 0x3063,0x82C2, 0x3064,0x82C3, 0x3065,0x82C4, 0x3066,0x82C5, 0x3067,0x82C6, 0x3068,0x82C7, 0x3069,0x82C8, 0x306A,0x82C9, 0x306B,0x82CA, 0x306C,0x82CB, 0x306D,0x82CC, 0x306E,0x82CD, 0x306F,0x82CE, 0x3070,0x82CF, 0x3071,0x82D0, 0x3072,0x82D1, 0x3073,0x82D2, 0x3074,0x82D3, 0x3075,0x82D4, 0x3076,0x82D5, 0x3077,0x82D6, 0x3078,0x82D7, 0x3079,0x82D8, 0x307A,0x82D9, 0x307B,0x82DA, 0x307C,0x82DB, 0x307D,0x82DC, 0x307E,0x82DD, 0x307F,0x82DE, 0x3080,0x82DF, 0x3081,0x82E0, 0x3082,0x82E1, 0x3083,0x82E2, 0x3084,0x82E3, 0x3085,0x82E4, 0x3086,0x82E5, 0x3087,0x82E6, 0x3088,0x82E7, 0x3089,0x82E8, 0x308A,0x82E9, 0x308B,0x82EA, 0x308C,0x82EB, 0x308D,0x82EC, 0x308E,0x82ED, 0x308F,0x82EE, 0x3090,0x82EF, 0x3091,0x82F0, 0x3092,0x82F1, 0x3093,0x8340, 0x30A1,0x8341, 0x30A2,0x8342, 0x30A3,0x8343, 0x30A4,0x8344, 0x30A5,0x8345, 0x30A6,0x8346, 0x30A7,0x8347, 0x30A8,0x8348, 0x30A9,0x8349, 0x30AA,0x834A, 0x30AB,0x834B, 0x30AC,0x834C, 0x30AD,0x834D, 0x30AE,0x834E, 0x30AF,0x834F, 0x30B0,0x8350, 0x30B1,0x8351, 0x30B2,0x8352, 0x30B3,0x8353, 0x30B4,0x8354, 0x30B5,0x8355, 0x30B6,0x8356, 0x30B7,0x8357, 0x30B8,0x8358, 0x30B9,0x8359, 0x30BA,0x835A, 0x30BB,0x835B, 0x30BC,0x835C, 0x30BD,0x835D, 0x30BE,0x835E, 0x30BF,0x835F, 0x30C0,0x8360, 0x30C1,0x8361, 0x30C2,0x8362, 0x30C3,0x8363, 0x30C4,0x8364, 0x30C5,0x8365, 0x30C6,0x8366, 0x30C7,0x8367, 0x30C8,0x8368, 0x30C9,0x8369, 0x30CA,0x836A, 0x30CB,0x836B, 0x30CC,0x836C, 0x30CD,0x836D, 0x30CE,0x836E, 0x30CF,0x836F, 0x30D0,0x8370, 0x30D1,0x8371, 0x30D2,0x8372, 0x30D3,0x8373, 0x30D4,0x8374, 0x30D5,0x8375, 0x30D6,0x8376, 0x30D7,0x8377, 0x30D8,0x8378, 0x30D9,0x8379, 0x30DA,0x837A, 0x30DB,0x837B, 0x30DC,0x837C, 0x30DD,0x837D, 0x30DE,0x837E, 0x30DF,0x8380, 0x30E0,0x8381, 0x30E1,0x8382, 0x30E2,0x8383, 0x30E3,0x8384, 0x30E4,0x8385, 0x30E5,0x8386, 0x30E6,0x8387, 0x30E7,0x8388, 0x30E8,0x8389, 0x30E9,0x838A, 0x30EA,0x838B, 0x30EB,0x838C, 0x30EC,0x838D, 0x30ED,0x838E, 0x30EE,0x838F, 0x30EF,0x8390, 0x30F0,0x8391, 0x30F1,0x8392, 0x30F2,0x8393, 0x30F3,0x8394, 0x30F4,0x8395, 0x30F5,0x8396, 0x30F6,0x839F, 0x0391,0x83A0, 0x0392,0x83A1, 0x0393,0x83A2, 0x0394,0x83A3, 0x0395,0x83A4, 0x0396,0x83A5, 0x0397,0x83A6, 0x0398,0x83A7, 0x0399,0x83A8, 0x039A,0x83A9, 0x039B,0x83AA, 0x039C,0x83AB, 0x039D,0x83AC, 0x039E,0x83AD, 0x039F,0x83AE, 0x03A0,0x83AF, 0x03A1,0x83B0, 0x03A3,0x83B1, 0x03A4,0x83B2, 0x03A5,0x83B3, 0x03A6,0x83B4, 0x03A7,0x83B5, 0x03A8,0x83B6, 0x03A9,0x83BF, 0x03B1,0x83C0, 0x03B2,0x83C1, 0x03B3,0x83C2, 0x03B4,0x83C3, 0x03B5,0x83C4, 0x03B6,0x83C5, 0x03B7,0x83C6, 0x03B8,0x83C7, 0x03B9,0x83C8, 0x03BA,0x83C9, 0x03BB,0x83CA, 0x03BC,0x83CB, 0x03BD,0x83CC, 0x03BE,0x83CD, 0x03BF,0x83CE, 0x03C0,0x83CF, 0x03C1,0x83D0, 0x03C3,0x83D1, 0x03C4,0x83D2, 0x03C5,0x83D3, 0x03C6,0x83D4, 0x03C7,0x83D5, 0x03C8,0x83D6, 0x03C9,0x8440, 0x0410,0x8441, 0x0411,0x8442, 0x0412,0x8443, 0x0413,0x8444, 0x0414,0x8445, 0x0415,0x8446, 0x0401,0x8447, 0x0416,0x8448, 0x0417,0x8449, 0x0418,0x844A, 0x0419,0x844B, 0x041A,0x844C, 0x041B,0x844D, 0x041C,0x844E, 0x041D,0x844F, 0x041E,0x8450, 0x041F,0x8451, 0x0420,0x8452, 0x0421,0x8453, 0x0422,0x8454, 0x0423,0x8455, 0x0424,0x8456, 0x0425,0x8457, 0x0426,0x8458, 0x0427,0x8459, 0x0428,0x845A, 0x0429,0x845B, 0x042A,0x845C, 0x042B,0x845D, 0x042C,0x845E, 0x042D,0x845F, 0x042E,0x8460, 0x042F,0x8470, 0x0430,0x8471, 0x0431,0x8472, 0x0432,0x8473, 0x0433,0x8474, 0x0434,0x8475, 0x0435,0x8476, 0x0451,0x8477, 0x0436,0x8478, 0x0437,0x8479, 0x0438,0x847A, 0x0439,0x847B, 0x043A,0x847C, 0x043B,0x847D, 0x043C,0x847E, 0x043D,0x8480, 0x043E,0x8481, 0x043F,0x8482, 0x0440,0x8483, 0x0441,0x8484, 0x0442,0x8485, 0x0443,0x8486, 0x0444,0x8487, 0x0445,0x8488, 0x0446,0x8489, 0x0447,0x848A, 0x0448,0x848B, 0x0449,0x848C, 0x044A,0x848D, 0x044B,0x848E, 0x044C,0x848F, 0x044D,0x8490, 0x044E,0x8491, 0x044F,0x849F, 0x2500,0x84A0, 0x2502,0x84A1, 0x250C,0x84A2, 0x2510,0x84A3, 0x2518,0x84A4, 0x2514,0x84A5, 0x251C,0x84A6, 0x252C,0x84A7, 0x2524,0x84A8, 0x2534,0x84A9, 0x253C,0x84AA, 0x2501,0x84AB, 0x2503,0x84AC, 0x250F,0x84AD, 0x2513,0x84AE, 0x251B,0x84AF, 0x2517,0x84B0, 0x2523,0x84B1, 0x2533,0x84B2, 0x252B,0x84B3, 0x253B,0x84B4, 0x254B,0x84B5, 0x2520,0x84B6, 0x252F,0x84B7, 0x2528,0x84B8, 0x2537,0x84B9, 0x253F,0x84BA, 0x251D,0x84BB, 0x2530,0x84BC, 0x2525,0x84BD, 0x2538,0x84BE, 0x2542,0x8740, 0x2460,0x8741, 0x2461,0x8742, 0x2462,0x8743, 0x2463,0x8744, 0x2464,0x8745, 0x2465,0x8746, 0x2466,0x8747, 0x2467,0x8748, 0x2468,0x8749, 0x2469,0x874A, 0x246A,0x874B, 0x246B,0x874C, 0x246C,0x874D, 0x246D,0x874E, 0x246E,0x874F, 0x246F,0x8750, 0x2470,0x8751, 0x2471,0x8752, 0x2472,0x8753, 0x2473,0x8754, 0x2160,0x8755, 0x2161,0x8756, 0x2162,0x8757, 0x2163,0x8758, 0x2164,0x8759, 0x2165,0x875A, 0x2166,0x875B, 0x2167,0x875C, 0x2168,0x875D, 0x2169,0x875F, 0x3349,0x8760, 0x3314,0x8761, 0x3322,0x8762, 0x334D,0x8763, 0x3318,0x8764, 0x3327,0x8765, 0x3303,0x8766, 0x3336,0x8767, 0x3351,0x8768, 0x3357,0x8769, 0x330D,0x876A, 0x3326,0x876B, 0x3323,0x876C, 0x332B,0x876D, 0x334A,0x876E, 0x333B,0x876F, 0x339C,0x8770, 0x339D,0x8771, 0x339E,0x8772, 0x338E,0x8773, 0x338F,0x8774, 0x33C4,0x8775, 0x33A1,0x877E, 0x337B,0x8780, 0x301D,0x8781, 0x301F,0x8782, 0x2116,0x8783, 0x33CD,0x8784, 0x2121,0x8785, 0x32A4,0x8786, 0x32A5,0x8787, 0x32A6,0x8788, 0x32A7,0x8789, 0x32A8,0x878A, 0x3231,0x878B, 0x3232,0x878C, 0x3239,0x878D, 0x337E,0x878E, 0x337D,0x878F, 0x337C,0x8790, 0x2252,0x8791, 0x2261,0x8792, 0x222B,0x8793, 0x222E,0x8794, 0x2211,0x8795, 0x221A,0x8796, 0x22A5,0x8797, 0x2220,0x8798, 0x221F,0x8799, 0x22BF,0x879A, 0x2235,0x879B, 0x2229,0x879C, 0x222A,0x889F, 0x4E9C,0x88A0, 0x5516,0x88A1, 0x5A03,0x88A2, 0x963F,0x88A3, 0x54C0,0x88A4, 0x611B,0x88A5, 0x6328,0x88A6, 0x59F6,0x88A7, 0x9022,0x88A8, 0x8475,0x88A9, 0x831C,0x88AA, 0x7A50,0x88AB, 0x60AA,0x88AC, 0x63E1,0x88AD, 0x6E25,0x88AE, 0x65ED,0x88AF, 0x8466,0x88B0, 0x82A6,0x88B1, 0x9BF5,0x88B2, 0x6893,0x88B3, 0x5727,0x88B4, 0x65A1,0x88B5, 0x6271,0x88B6, 0x5B9B,0x88B7, 0x59D0,0x88B8, 0x867B,0x88B9, 0x98F4,0x88BA, 0x7D62,0x88BB, 0x7DBE,0x88BC, 0x9B8E,0x88BD, 0x6216,0x88BE, 0x7C9F,0x88BF, 0x88B7,0x88C0, 0x5B89,0x88C1, 0x5EB5,0x88C2, 0x6309,0x88C3, 0x6697,0x88C4, 0x6848,0x88C5, 0x95C7,0x88C6, 0x978D,0x88C7, 0x674F,0x88C8, 0x4EE5,0x88C9, 0x4F0A,0x88CA, 0x4F4D,0x88CB, 0x4F9D,0x88CC, 0x5049,0x88CD, 0x56F2,0x88CE, 0x5937,0x88CF, 0x59D4,0x88D0, 0x5A01,0x88D1, 0x5C09,0x88D2, 0x60DF,0x88D3, 0x610F,0x88D4, 0x6170,0x88D5, 0x6613,0x88D6, 0x6905,0x88D7, 0x70BA,0x88D8, 0x754F,0x88D9, 0x7570,0x88DA, 0x79FB,0x88DB, 0x7DAD,0x88DC, 0x7DEF,0x88DD, 0x80C3,0x88DE, 0x840E,0x88DF, 0x8863,0x88E0, 0x8B02,0x88E1, 0x9055,0x88E2, 0x907A,0x88E3, 0x533B,0x88E4, 0x4E95,0x88E5, 0x4EA5,0x88E6, 0x57DF,0x88E7, 0x80B2,0x88E8, 0x90C1,0x88E9, 0x78EF,0x88EA, 0x4E00,0x88EB, 0x58F1,0x88EC, 0x6EA2,0x88ED, 0x9038,0x88EE, 0x7A32,0x88EF, 0x8328,0x88F0, 0x828B,0x88F1, 0x9C2F,0x88F2, 0x5141,0x88F3, 0x5370,0x88F4, 0x54BD,0x88F5, 0x54E1,0x88F6, 0x56E0,0x88F7, 0x59FB,0x88F8, 0x5F15,0x88F9, 0x98F2,0x88FA, 0x6DEB,0x88FB, 0x80E4,0x88FC, 0x852D,0x8940, 0x9662,0x8941, 0x9670,0x8942, 0x96A0,0x8943, 0x97FB,0x8944, 0x540B,0x8945, 0x53F3,0x8946, 0x5B87,0x8947, 0x70CF,0x8948, 0x7FBD,0x8949, 0x8FC2,0x894A, 0x96E8,0x894B, 0x536F,0x894C, 0x9D5C,0x894D, 0x7ABA,0x894E, 0x4E11,0x894F, 0x7893,0x8950, 0x81FC,0x8951, 0x6E26,0x8952, 0x5618,0x8953, 0x5504,0x8954, 0x6B1D,0x8955, 0x851A,0x8956, 0x9C3B,0x8957, 0x59E5,0x8958, 0x53A9,0x8959, 0x6D66,0x895A, 0x74DC,0x895B, 0x958F,0x895C, 0x5642,0x895D, 0x4E91,0x895E, 0x904B,0x895F, 0x96F2,0x8960, 0x834F,0x8961, 0x990C,0x8962, 0x53E1,0x8963, 0x55B6,0x8964, 0x5B30,0x8965, 0x5F71,0x8966, 0x6620,0x8967, 0x66F3,0x8968, 0x6804,0x8969, 0x6C38,0x896A, 0x6CF3,0x896B, 0x6D29,0x896C, 0x745B,0x896D, 0x76C8,0x896E, 0x7A4E,0x896F, 0x9834,0x8970, 0x82F1,0x8971, 0x885B,0x8972, 0x8A60,0x8973, 0x92ED,0x8974, 0x6DB2,0x8975, 0x75AB,0x8976, 0x76CA,0x8977, 0x99C5,0x8978, 0x60A6,0x8979, 0x8B01,0x897A, 0x8D8A,0x897B, 0x95B2,0x897C, 0x698E,0x897D, 0x53AD,0x897E, 0x5186,0x8980, 0x5712,0x8981, 0x5830,0x8982, 0x5944,0x8983, 0x5BB4,0x8984, 0x5EF6,0x8985, 0x6028,0x8986, 0x63A9,0x8987, 0x63F4,0x8988, 0x6CBF,0x8989, 0x6F14,0x898A, 0x708E,0x898B, 0x7114,0x898C, 0x7159,0x898D, 0x71D5,0x898E, 0x733F,0x898F, 0x7E01,0x8990, 0x8276,0x8991, 0x82D1,0x8992, 0x8597,0x8993, 0x9060,0x8994, 0x925B,0x8995, 0x9D1B,0x8996, 0x5869,0x8997, 0x65BC,0x8998, 0x6C5A,0x8999, 0x7525,0x899A, 0x51F9,0x899B, 0x592E,0x899C, 0x5965,0x899D, 0x5F80,0x899E, 0x5FDC,0x899F, 0x62BC,0x89A0, 0x65FA,0x89A1, 0x6A2A,0x89A2, 0x6B27,0x89A3, 0x6BB4,0x89A4, 0x738B,0x89A5, 0x7FC1,0x89A6, 0x8956,0x89A7, 0x9D2C,0x89A8, 0x9D0E,0x89A9, 0x9EC4,0x89AA, 0x5CA1,0x89AB, 0x6C96,0x89AC, 0x837B,0x89AD, 0x5104,0x89AE, 0x5C4B,0x89AF, 0x61B6,0x89B0, 0x81C6,0x89B1, 0x6876,0x89B2, 0x7261,0x89B3, 0x4E59,0x89B4, 0x4FFA,0x89B5, 0x5378,0x89B6, 0x6069,0x89B7, 0x6E29,0x89B8, 0x7A4F,0x89B9, 0x97F3,0x89BA, 0x4E0B,0x89BB, 0x5316,0x89BC, 0x4EEE,0x89BD, 0x4F55,0x89BE, 0x4F3D,0x89BF, 0x4FA1,0x89C0, 0x4F73,0x89C1, 0x52A0,0x89C2, 0x53EF,0x89C3, 0x5609,0x89C4, 0x590F,0x89C5, 0x5AC1,0x89C6, 0x5BB6,0x89C7, 0x5BE1,0x89C8, 0x79D1,0x89C9, 0x6687,0x89CA, 0x679C,0x89CB, 0x67B6,0x89CC, 0x6B4C,0x89CD, 0x6CB3,0x89CE, 0x706B,0x89CF, 0x73C2,0x89D0, 0x798D,0x89D1, 0x79BE,0x89D2, 0x7A3C,0x89D3, 0x7B87,0x89D4, 0x82B1,0x89D5, 0x82DB,0x89D6, 0x8304,0x89D7, 0x8377,0x89D8, 0x83EF,0x89D9, 0x83D3,0x89DA, 0x8766,0x89DB, 0x8AB2,0x89DC, 0x5629,0x89DD, 0x8CA8,0x89DE, 0x8FE6,0x89DF, 0x904E,0x89E0, 0x971E,0x89E1, 0x868A,0x89E2, 0x4FC4,0x89E3, 0x5CE8,0x89E4, 0x6211,0x89E5, 0x7259,0x89E6, 0x753B,0x89E7, 0x81E5,0x89E8, 0x82BD,0x89E9, 0x86FE,0x89EA, 0x8CC0,0x89EB, 0x96C5,0x89EC, 0x9913,0x89ED, 0x99D5,0x89EE, 0x4ECB,0x89EF, 0x4F1A,0x89F0, 0x89E3,0x89F1, 0x56DE,0x89F2, 0x584A,0x89F3, 0x58CA,0x89F4, 0x5EFB,0x89F5, 0x5FEB,0x89F6, 0x602A,0x89F7, 0x6094,0x89F8, 0x6062,0x89F9, 0x61D0,0x89FA, 0x6212,0x89FB, 0x62D0,0x89FC, 0x6539,0x8A40, 0x9B41,0x8A41, 0x6666,0x8A42, 0x68B0,0x8A43, 0x6D77,0x8A44, 0x7070,0x8A45, 0x754C,0x8A46, 0x7686,0x8A47, 0x7D75,0x8A48, 0x82A5,0x8A49, 0x87F9,0x8A4A, 0x958B,0x8A4B, 0x968E,0x8A4C, 0x8C9D,0x8A4D, 0x51F1,0x8A4E, 0x52BE,0x8A4F, 0x5916,0x8A50, 0x54B3,0x8A51, 0x5BB3,0x8A52, 0x5D16,0x8A53, 0x6168,0x8A54, 0x6982,0x8A55, 0x6DAF,0x8A56, 0x788D,0x8A57, 0x84CB,0x8A58, 0x8857,0x8A59, 0x8A72,0x8A5A, 0x93A7,0x8A5B, 0x9AB8,0x8A5C, 0x6D6C,0x8A5D, 0x99A8,0x8A5E, 0x86D9,0x8A5F, 0x57A3,0x8A60, 0x67FF,0x8A61, 0x86CE,0x8A62, 0x920E,0x8A63, 0x5283,0x8A64, 0x5687,0x8A65, 0x5404,0x8A66, 0x5ED3,0x8A67, 0x62E1,0x8A68, 0x64B9,0x8A69, 0x683C,0x8A6A, 0x6838,0x8A6B, 0x6BBB,0x8A6C, 0x7372,0x8A6D, 0x78BA,0x8A6E, 0x7A6B,0x8A6F, 0x899A,0x8A70, 0x89D2,0x8A71, 0x8D6B,0x8A72, 0x8F03,0x8A73, 0x90ED,0x8A74, 0x95A3,0x8A75, 0x9694,0x8A76, 0x9769,0x8A77, 0x5B66,0x8A78, 0x5CB3,0x8A79, 0x697D,0x8A7A, 0x984D,0x8A7B, 0x984E,0x8A7C, 0x639B,0x8A7D, 0x7B20,0x8A7E, 0x6A2B,0x8A80, 0x6A7F,0x8A81, 0x68B6,0x8A82, 0x9C0D,0x8A83, 0x6F5F,0x8A84, 0x5272,0x8A85, 0x559D,0x8A86, 0x6070,0x8A87, 0x62EC,0x8A88, 0x6D3B,0x8A89, 0x6E07,0x8A8A, 0x6ED1,0x8A8B, 0x845B,0x8A8C, 0x8910,0x8A8D, 0x8F44,0x8A8E, 0x4E14,0x8A8F, 0x9C39,0x8A90, 0x53F6,0x8A91, 0x691B,0x8A92, 0x6A3A,0x8A93, 0x9784,0x8A94, 0x682A,0x8A95, 0x515C,0x8A96, 0x7AC3,0x8A97, 0x84B2,0x8A98, 0x91DC,0x8A99, 0x938C,0x8A9A, 0x565B,0x8A9B, 0x9D28,0x8A9C, 0x6822,0x8A9D, 0x8305,0x8A9E, 0x8431,0x8A9F, 0x7CA5,0x8AA0, 0x5208,0x8AA1, 0x82C5,0x8AA2, 0x74E6,0x8AA3, 0x4E7E,0x8AA4, 0x4F83,0x8AA5, 0x51A0,0x8AA6, 0x5BD2,0x8AA7, 0x520A,0x8AA8, 0x52D8,0x8AA9, 0x52E7,0x8AAA, 0x5DFB,0x8AAB, 0x559A,0x8AAC, 0x582A,0x8AAD, 0x59E6,0x8AAE, 0x5B8C,0x8AAF, 0x5B98,0x8AB0, 0x5BDB,0x8AB1, 0x5E72,0x8AB2, 0x5E79,0x8AB3, 0x60A3,0x8AB4, 0x611F,0x8AB5, 0x6163,0x8AB6, 0x61BE,0x8AB7, 0x63DB,0x8AB8, 0x6562,0x8AB9, 0x67D1,0x8ABA, 0x6853,0x8ABB, 0x68FA,0x8ABC, 0x6B3E,0x8ABD, 0x6B53,0x8ABE, 0x6C57,0x8ABF, 0x6F22,0x8AC0, 0x6F97,0x8AC1, 0x6F45,0x8AC2, 0x74B0,0x8AC3, 0x7518,0x8AC4, 0x76E3,0x8AC5, 0x770B,0x8AC6, 0x7AFF,0x8AC7, 0x7BA1,0x8AC8, 0x7C21,0x8AC9, 0x7DE9,0x8ACA, 0x7F36,0x8ACB, 0x7FF0,0x8ACC, 0x809D,0x8ACD, 0x8266,0x8ACE, 0x839E,0x8ACF, 0x89B3,0x8AD0, 0x8ACC,0x8AD1, 0x8CAB,0x8AD2, 0x9084,0x8AD3, 0x9451,0x8AD4, 0x9593,0x8AD5, 0x9591,0x8AD6, 0x95A2,0x8AD7, 0x9665,0x8AD8, 0x97D3,0x8AD9, 0x9928,0x8ADA, 0x8218,0x8ADB, 0x4E38,0x8ADC, 0x542B,0x8ADD, 0x5CB8,0x8ADE, 0x5DCC,0x8ADF, 0x73A9,0x8AE0, 0x764C,0x8AE1, 0x773C,0x8AE2, 0x5CA9,0x8AE3, 0x7FEB,0x8AE4, 0x8D0B,0x8AE5, 0x96C1,0x8AE6, 0x9811,0x8AE7, 0x9854,0x8AE8, 0x9858,0x8AE9, 0x4F01,0x8AEA, 0x4F0E,0x8AEB, 0x5371,0x8AEC, 0x559C,0x8AED, 0x5668,0x8AEE, 0x57FA,0x8AEF, 0x5947,0x8AF0, 0x5B09,0x8AF1, 0x5BC4,0x8AF2, 0x5C90,0x8AF3, 0x5E0C,0x8AF4, 0x5E7E,0x8AF5, 0x5FCC,0x8AF6, 0x63EE,0x8AF7, 0x673A,0x8AF8, 0x65D7,0x8AF9, 0x65E2,0x8AFA, 0x671F,0x8AFB, 0x68CB,0x8AFC, 0x68C4,0x8B40, 0x6A5F,0x8B41, 0x5E30,0x8B42, 0x6BC5,0x8B43, 0x6C17,0x8B44, 0x6C7D,0x8B45, 0x757F,0x8B46, 0x7948,0x8B47, 0x5B63,0x8B48, 0x7A00,0x8B49, 0x7D00,0x8B4A, 0x5FBD,0x8B4B, 0x898F,0x8B4C, 0x8A18,0x8B4D, 0x8CB4,0x8B4E, 0x8D77,0x8B4F, 0x8ECC,0x8B50, 0x8F1D,0x8B51, 0x98E2,0x8B52, 0x9A0E,0x8B53, 0x9B3C,0x8B54, 0x4E80,0x8B55, 0x507D,0x8B56, 0x5100,0x8B57, 0x5993,0x8B58, 0x5B9C,0x8B59, 0x622F,0x8B5A, 0x6280,0x8B5B, 0x64EC,0x8B5C, 0x6B3A,0x8B5D, 0x72A0,0x8B5E, 0x7591,0x8B5F, 0x7947,0x8B60, 0x7FA9,0x8B61, 0x87FB,0x8B62, 0x8ABC,0x8B63, 0x8B70,0x8B64, 0x63AC,0x8B65, 0x83CA,0x8B66, 0x97A0,0x8B67, 0x5409,0x8B68, 0x5403,0x8B69, 0x55AB,0x8B6A, 0x6854,0x8B6B, 0x6A58,0x8B6C, 0x8A70,0x8B6D, 0x7827,0x8B6E, 0x6775,0x8B6F, 0x9ECD,0x8B70, 0x5374,0x8B71, 0x5BA2,0x8B72, 0x811A,0x8B73, 0x8650,0x8B74, 0x9006,0x8B75, 0x4E18,0x8B76, 0x4E45,0x8B77, 0x4EC7,0x8B78, 0x4F11,0x8B79, 0x53CA,0x8B7A, 0x5438,0x8B7B, 0x5BAE,0x8B7C, 0x5F13,0x8B7D, 0x6025,0x8B7E, 0x6551,0x8B80, 0x673D,0x8B81, 0x6C42,0x8B82, 0x6C72,0x8B83, 0x6CE3,0x8B84, 0x7078,0x8B85, 0x7403,0x8B86, 0x7A76,0x8B87, 0x7AAE,0x8B88, 0x7B08,0x8B89, 0x7D1A,0x8B8A, 0x7CFE,0x8B8B, 0x7D66,0x8B8C, 0x65E7,0x8B8D, 0x725B,0x8B8E, 0x53BB,0x8B8F, 0x5C45,0x8B90, 0x5DE8,0x8B91, 0x62D2,0x8B92, 0x62E0,0x8B93, 0x6319,0x8B94, 0x6E20,0x8B95, 0x865A,0x8B96, 0x8A31,0x8B97, 0x8DDD,0x8B98, 0x92F8,0x8B99, 0x6F01,0x8B9A, 0x79A6,0x8B9B, 0x9B5A,0x8B9C, 0x4EA8,0x8B9D, 0x4EAB,0x8B9E, 0x4EAC,0x8B9F, 0x4F9B,0x8BA0, 0x4FA0,0x8BA1, 0x50D1,0x8BA2, 0x5147,0x8BA3, 0x7AF6,0x8BA4, 0x5171,0x8BA5, 0x51F6,0x8BA6, 0x5354,0x8BA7, 0x5321,0x8BA8, 0x537F,0x8BA9, 0x53EB,0x8BAA, 0x55AC,0x8BAB, 0x5883,0x8BAC, 0x5CE1,0x8BAD, 0x5F37,0x8BAE, 0x5F4A,0x8BAF, 0x602F,0x8BB0, 0x6050,0x8BB1, 0x606D,0x8BB2, 0x631F,0x8BB3, 0x6559,0x8BB4, 0x6A4B,0x8BB5, 0x6CC1,0x8BB6, 0x72C2,0x8BB7, 0x72ED,0x8BB8, 0x77EF,0x8BB9, 0x80F8,0x8BBA, 0x8105,0x8BBB, 0x8208,0x8BBC, 0x854E,0x8BBD, 0x90F7,0x8BBE, 0x93E1,0x8BBF, 0x97FF,0x8BC0, 0x9957,0x8BC1, 0x9A5A,0x8BC2, 0x4EF0,0x8BC3, 0x51DD,0x8BC4, 0x5C2D,0x8BC5, 0x6681,0x8BC6, 0x696D,0x8BC7, 0x5C40,0x8BC8, 0x66F2,0x8BC9, 0x6975,0x8BCA, 0x7389,0x8BCB, 0x6850,0x8BCC, 0x7C81,0x8BCD, 0x50C5,0x8BCE, 0x52E4,0x8BCF, 0x5747,0x8BD0, 0x5DFE,0x8BD1, 0x9326,0x8BD2, 0x65A4,0x8BD3, 0x6B23,0x8BD4, 0x6B3D,0x8BD5, 0x7434,0x8BD6, 0x7981,0x8BD7, 0x79BD,0x8BD8, 0x7B4B,0x8BD9, 0x7DCA,0x8BDA, 0x82B9,0x8BDB, 0x83CC,0x8BDC, 0x887F,0x8BDD, 0x895F,0x8BDE, 0x8B39,0x8BDF, 0x8FD1,0x8BE0, 0x91D1,0x8BE1, 0x541F,0x8BE2, 0x9280,0x8BE3, 0x4E5D,0x8BE4, 0x5036,0x8BE5, 0x53E5,0x8BE6, 0x533A,0x8BE7, 0x72D7,0x8BE8, 0x7396,0x8BE9, 0x77E9,0x8BEA, 0x82E6,0x8BEB, 0x8EAF,0x8BEC, 0x99C6,0x8BED, 0x99C8,0x8BEE, 0x99D2,0x8BEF, 0x5177,0x8BF0, 0x611A,0x8BF1, 0x865E,0x8BF2, 0x55B0,0x8BF3, 0x7A7A,0x8BF4, 0x5076,0x8BF5, 0x5BD3,0x8BF6, 0x9047,0x8BF7, 0x9685,0x8BF8, 0x4E32,0x8BF9, 0x6ADB,0x8BFA, 0x91E7,0x8BFB, 0x5C51,0x8BFC, 0x5C48,0x8C40, 0x6398,0x8C41, 0x7A9F,0x8C42, 0x6C93,0x8C43, 0x9774,0x8C44, 0x8F61,0x8C45, 0x7AAA,0x8C46, 0x718A,0x8C47, 0x9688,0x8C48, 0x7C82,0x8C49, 0x6817,0x8C4A, 0x7E70,0x8C4B, 0x6851,0x8C4C, 0x936C,0x8C4D, 0x52F2,0x8C4E, 0x541B,0x8C4F, 0x85AB,0x8C50, 0x8A13,0x8C51, 0x7FA4,0x8C52, 0x8ECD,0x8C53, 0x90E1,0x8C54, 0x5366,0x8C55, 0x8888,0x8C56, 0x7941,0x8C57, 0x4FC2,0x8C58, 0x50BE,0x8C59, 0x5211,0x8C5A, 0x5144,0x8C5B, 0x5553,0x8C5C, 0x572D,0x8C5D, 0x73EA,0x8C5E, 0x578B,0x8C5F, 0x5951,0x8C60, 0x5F62,0x8C61, 0x5F84,0x8C62, 0x6075,0x8C63, 0x6176,0x8C64, 0x6167,0x8C65, 0x61A9,0x8C66, 0x63B2,0x8C67, 0x643A,0x8C68, 0x656C,0x8C69, 0x666F,0x8C6A, 0x6842,0x8C6B, 0x6E13,0x8C6C, 0x7566,0x8C6D, 0x7A3D,0x8C6E, 0x7CFB,0x8C6F, 0x7D4C,0x8C70, 0x7D99,0x8C71, 0x7E4B,0x8C72, 0x7F6B,0x8C73, 0x830E,0x8C74, 0x834A,0x8C75, 0x86CD,0x8C76, 0x8A08,0x8C77, 0x8A63,0x8C78, 0x8B66,0x8C79, 0x8EFD,0x8C7A, 0x981A,0x8C7B, 0x9D8F,0x8C7C, 0x82B8,0x8C7D, 0x8FCE,0x8C7E, 0x9BE8,0x8C80, 0x5287,0x8C81, 0x621F,0x8C82, 0x6483,0x8C83, 0x6FC0,0x8C84, 0x9699,0x8C85, 0x6841,0x8C86, 0x5091,0x8C87, 0x6B20,0x8C88, 0x6C7A,0x8C89, 0x6F54,0x8C8A, 0x7A74,0x8C8B, 0x7D50,0x8C8C, 0x8840,0x8C8D, 0x8A23,0x8C8E, 0x6708,0x8C8F, 0x4EF6,0x8C90, 0x5039,0x8C91, 0x5026,0x8C92, 0x5065,0x8C93, 0x517C,0x8C94, 0x5238,0x8C95, 0x5263,0x8C96, 0x55A7,0x8C97, 0x570F,0x8C98, 0x5805,0x8C99, 0x5ACC,0x8C9A, 0x5EFA,0x8C9B, 0x61B2,0x8C9C, 0x61F8,0x8C9D, 0x62F3,0x8C9E, 0x6372,0x8C9F, 0x691C,0x8CA0, 0x6A29,0x8CA1, 0x727D,0x8CA2, 0x72AC,0x8CA3, 0x732E,0x8CA4, 0x7814,0x8CA5, 0x786F,0x8CA6, 0x7D79,0x8CA7, 0x770C,0x8CA8, 0x80A9,0x8CA9, 0x898B,0x8CAA, 0x8B19,0x8CAB, 0x8CE2,0x8CAC, 0x8ED2,0x8CAD, 0x9063,0x8CAE, 0x9375,0x8CAF, 0x967A,0x8CB0, 0x9855,0x8CB1, 0x9A13,0x8CB2, 0x9E78,0x8CB3, 0x5143,0x8CB4, 0x539F,0x8CB5, 0x53B3,0x8CB6, 0x5E7B,0x8CB7, 0x5F26,0x8CB8, 0x6E1B,0x8CB9, 0x6E90,0x8CBA, 0x7384,0x8CBB, 0x73FE,0x8CBC, 0x7D43,0x8CBD, 0x8237,0x8CBE, 0x8A00,0x8CBF, 0x8AFA,0x8CC0, 0x9650,0x8CC1, 0x4E4E,0x8CC2, 0x500B,0x8CC3, 0x53E4,0x8CC4, 0x547C,0x8CC5, 0x56FA,0x8CC6, 0x59D1,0x8CC7, 0x5B64,0x8CC8, 0x5DF1,0x8CC9, 0x5EAB,0x8CCA, 0x5F27,0x8CCB, 0x6238,0x8CCC, 0x6545,0x8CCD, 0x67AF,0x8CCE, 0x6E56,0x8CCF, 0x72D0,0x8CD0, 0x7CCA,0x8CD1, 0x88B4,0x8CD2, 0x80A1,0x8CD3, 0x80E1,0x8CD4, 0x83F0,0x8CD5, 0x864E,0x8CD6, 0x8A87,0x8CD7, 0x8DE8,0x8CD8, 0x9237,0x8CD9, 0x96C7,0x8CDA, 0x9867,0x8CDB, 0x9F13,0x8CDC, 0x4E94,0x8CDD, 0x4E92,0x8CDE, 0x4F0D,0x8CDF, 0x5348,0x8CE0, 0x5449,0x8CE1, 0x543E,0x8CE2, 0x5A2F,0x8CE3, 0x5F8C,0x8CE4, 0x5FA1,0x8CE5, 0x609F,0x8CE6, 0x68A7,0x8CE7, 0x6A8E,0x8CE8, 0x745A,0x8CE9, 0x7881,0x8CEA, 0x8A9E,0x8CEB, 0x8AA4,0x8CEC, 0x8B77,0x8CED, 0x9190,0x8CEE, 0x4E5E,0x8CEF, 0x9BC9,0x8CF0, 0x4EA4,0x8CF1, 0x4F7C,0x8CF2, 0x4FAF,0x8CF3, 0x5019,0x8CF4, 0x5016,0x8CF5, 0x5149,0x8CF6, 0x516C,0x8CF7, 0x529F,0x8CF8, 0x52B9,0x8CF9, 0x52FE,0x8CFA, 0x539A,0x8CFB, 0x53E3,0x8CFC, 0x5411,0x8D40, 0x540E,0x8D41, 0x5589,0x8D42, 0x5751,0x8D43, 0x57A2,0x8D44, 0x597D,0x8D45, 0x5B54,0x8D46, 0x5B5D,0x8D47, 0x5B8F,0x8D48, 0x5DE5,0x8D49, 0x5DE7,0x8D4A, 0x5DF7,0x8D4B, 0x5E78,0x8D4C, 0x5E83,0x8D4D, 0x5E9A,0x8D4E, 0x5EB7,0x8D4F, 0x5F18,0x8D50, 0x6052,0x8D51, 0x614C,0x8D52, 0x6297,0x8D53, 0x62D8,0x8D54, 0x63A7,0x8D55, 0x653B,0x8D56, 0x6602,0x8D57, 0x6643,0x8D58, 0x66F4,0x8D59, 0x676D,0x8D5A, 0x6821,0x8D5B, 0x6897,0x8D5C, 0x69CB,0x8D5D, 0x6C5F,0x8D5E, 0x6D2A,0x8D5F, 0x6D69,0x8D60, 0x6E2F,0x8D61, 0x6E9D,0x8D62, 0x7532,0x8D63, 0x7687,0x8D64, 0x786C,0x8D65, 0x7A3F,0x8D66, 0x7CE0,0x8D67, 0x7D05,0x8D68, 0x7D18,0x8D69, 0x7D5E,0x8D6A, 0x7DB1,0x8D6B, 0x8015,0x8D6C, 0x8003,0x8D6D, 0x80AF,0x8D6E, 0x80B1,0x8D6F, 0x8154,0x8D70, 0x818F,0x8D71, 0x822A,0x8D72, 0x8352,0x8D73, 0x884C,0x8D74, 0x8861,0x8D75, 0x8B1B,0x8D76, 0x8CA2,0x8D77, 0x8CFC,0x8D78, 0x90CA,0x8D79, 0x9175,0x8D7A, 0x9271,0x8D7B, 0x783F,0x8D7C, 0x92FC,0x8D7D, 0x95A4,0x8D7E, 0x964D,0x8D80, 0x9805,0x8D81, 0x9999,0x8D82, 0x9AD8,0x8D83, 0x9D3B,0x8D84, 0x525B,0x8D85, 0x52AB,0x8D86, 0x53F7,0x8D87, 0x5408,0x8D88, 0x58D5,0x8D89, 0x62F7,0x8D8A, 0x6FE0,0x8D8B, 0x8C6A,0x8D8C, 0x8F5F,0x8D8D, 0x9EB9,0x8D8E, 0x514B,0x8D8F, 0x523B,0x8D90, 0x544A,0x8D91, 0x56FD,0x8D92, 0x7A40,0x8D93, 0x9177,0x8D94, 0x9D60,0x8D95, 0x9ED2,0x8D96, 0x7344,0x8D97, 0x6F09,0x8D98, 0x8170,0x8D99, 0x7511,0x8D9A, 0x5FFD,0x8D9B, 0x60DA,0x8D9C, 0x9AA8,0x8D9D, 0x72DB,0x8D9E, 0x8FBC,0x8D9F, 0x6B64,0x8DA0, 0x9803,0x8DA1, 0x4ECA,0x8DA2, 0x56F0,0x8DA3, 0x5764,0x8DA4, 0x58BE,0x8DA5, 0x5A5A,0x8DA6, 0x6068,0x8DA7, 0x61C7,0x8DA8, 0x660F,0x8DA9, 0x6606,0x8DAA, 0x6839,0x8DAB, 0x68B1,0x8DAC, 0x6DF7,0x8DAD, 0x75D5,0x8DAE, 0x7D3A,0x8DAF, 0x826E,0x8DB0, 0x9B42,0x8DB1, 0x4E9B,0x8DB2, 0x4F50,0x8DB3, 0x53C9,0x8DB4, 0x5506,0x8DB5, 0x5D6F,0x8DB6, 0x5DE6,0x8DB7, 0x5DEE,0x8DB8, 0x67FB,0x8DB9, 0x6C99,0x8DBA, 0x7473,0x8DBB, 0x7802,0x8DBC, 0x8A50,0x8DBD, 0x9396,0x8DBE, 0x88DF,0x8DBF, 0x5750,0x8DC0, 0x5EA7,0x8DC1, 0x632B,0x8DC2, 0x50B5,0x8DC3, 0x50AC,0x8DC4, 0x518D,0x8DC5, 0x6700,0x8DC6, 0x54C9,0x8DC7, 0x585E,0x8DC8, 0x59BB,0x8DC9, 0x5BB0,0x8DCA, 0x5F69,0x8DCB, 0x624D,0x8DCC, 0x63A1,0x8DCD, 0x683D,0x8DCE, 0x6B73,0x8DCF, 0x6E08,0x8DD0, 0x707D,0x8DD1, 0x91C7,0x8DD2, 0x7280,0x8DD3, 0x7815,0x8DD4, 0x7826,0x8DD5, 0x796D,0x8DD6, 0x658E,0x8DD7, 0x7D30,0x8DD8, 0x83DC,0x8DD9, 0x88C1,0x8DDA, 0x8F09,0x8DDB, 0x969B,0x8DDC, 0x5264,0x8DDD, 0x5728,0x8DDE, 0x6750,0x8DDF, 0x7F6A,0x8DE0, 0x8CA1,0x8DE1, 0x51B4,0x8DE2, 0x5742,0x8DE3, 0x962A,0x8DE4, 0x583A,0x8DE5, 0x698A,0x8DE6, 0x80B4,0x8DE7, 0x54B2,0x8DE8, 0x5D0E,0x8DE9, 0x57FC,0x8DEA, 0x7895,0x8DEB, 0x9DFA,0x8DEC, 0x4F5C,0x8DED, 0x524A,0x8DEE, 0x548B,0x8DEF, 0x643E,0x8DF0, 0x6628,0x8DF1, 0x6714,0x8DF2, 0x67F5,0x8DF3, 0x7A84,0x8DF4, 0x7B56,0x8DF5, 0x7D22,0x8DF6, 0x932F,0x8DF7, 0x685C,0x8DF8, 0x9BAD,0x8DF9, 0x7B39,0x8DFA, 0x5319,0x8DFB, 0x518A,0x8DFC, 0x5237,0x8E40, 0x5BDF,0x8E41, 0x62F6,0x8E42, 0x64AE,0x8E43, 0x64E6,0x8E44, 0x672D,0x8E45, 0x6BBA,0x8E46, 0x85A9,0x8E47, 0x96D1,0x8E48, 0x7690,0x8E49, 0x9BD6,0x8E4A, 0x634C,0x8E4B, 0x9306,0x8E4C, 0x9BAB,0x8E4D, 0x76BF,0x8E4E, 0x6652,0x8E4F, 0x4E09,0x8E50, 0x5098,0x8E51, 0x53C2,0x8E52, 0x5C71,0x8E53, 0x60E8,0x8E54, 0x6492,0x8E55, 0x6563,0x8E56, 0x685F,0x8E57, 0x71E6,0x8E58, 0x73CA,0x8E59, 0x7523,0x8E5A, 0x7B97,0x8E5B, 0x7E82,0x8E5C, 0x8695,0x8E5D, 0x8B83,0x8E5E, 0x8CDB,0x8E5F, 0x9178,0x8E60, 0x9910,0x8E61, 0x65AC,0x8E62, 0x66AB,0x8E63, 0x6B8B,0x8E64, 0x4ED5,0x8E65, 0x4ED4,0x8E66, 0x4F3A,0x8E67, 0x4F7F,0x8E68, 0x523A,0x8E69, 0x53F8,0x8E6A, 0x53F2,0x8E6B, 0x55E3,0x8E6C, 0x56DB,0x8E6D, 0x58EB,0x8E6E, 0x59CB,0x8E6F, 0x59C9,0x8E70, 0x59FF,0x8E71, 0x5B50,0x8E72, 0x5C4D,0x8E73, 0x5E02,0x8E74, 0x5E2B,0x8E75, 0x5FD7,0x8E76, 0x601D,0x8E77, 0x6307,0x8E78, 0x652F,0x8E79, 0x5B5C,0x8E7A, 0x65AF,0x8E7B, 0x65BD,0x8E7C, 0x65E8,0x8E7D, 0x679D,0x8E7E, 0x6B62,0x8E80, 0x6B7B,0x8E81, 0x6C0F,0x8E82, 0x7345,0x8E83, 0x7949,0x8E84, 0x79C1,0x8E85, 0x7CF8,0x8E86, 0x7D19,0x8E87, 0x7D2B,0x8E88, 0x80A2,0x8E89, 0x8102,0x8E8A, 0x81F3,0x8E8B, 0x8996,0x8E8C, 0x8A5E,0x8E8D, 0x8A69,0x8E8E, 0x8A66,0x8E8F, 0x8A8C,0x8E90, 0x8AEE,0x8E91, 0x8CC7,0x8E92, 0x8CDC,0x8E93, 0x96CC,0x8E94, 0x98FC,0x8E95, 0x6B6F,0x8E96, 0x4E8B,0x8E97, 0x4F3C,0x8E98, 0x4F8D,0x8E99, 0x5150,0x8E9A, 0x5B57,0x8E9B, 0x5BFA,0x8E9C, 0x6148,0x8E9D, 0x6301,0x8E9E, 0x6642,0x8E9F, 0x6B21,0x8EA0, 0x6ECB,0x8EA1, 0x6CBB,0x8EA2, 0x723E,0x8EA3, 0x74BD,0x8EA4, 0x75D4,0x8EA5, 0x78C1,0x8EA6, 0x793A,0x8EA7, 0x800C,0x8EA8, 0x8033,0x8EA9, 0x81EA,0x8EAA, 0x8494,0x8EAB, 0x8F9E,0x8EAC, 0x6C50,0x8EAD, 0x9E7F,0x8EAE, 0x5F0F,0x8EAF, 0x8B58,0x8EB0, 0x9D2B,0x8EB1, 0x7AFA,0x8EB2, 0x8EF8,0x8EB3, 0x5B8D,0x8EB4, 0x96EB,0x8EB5, 0x4E03,0x8EB6, 0x53F1,0x8EB7, 0x57F7,0x8EB8, 0x5931,0x8EB9, 0x5AC9,0x8EBA, 0x5BA4,0x8EBB, 0x6089,0x8EBC, 0x6E7F,0x8EBD, 0x6F06,0x8EBE, 0x75BE,0x8EBF, 0x8CEA,0x8EC0, 0x5B9F,0x8EC1, 0x8500,0x8EC2, 0x7BE0,0x8EC3, 0x5072,0x8EC4, 0x67F4,0x8EC5, 0x829D,0x8EC6, 0x5C61,0x8EC7, 0x854A,0x8EC8, 0x7E1E,0x8EC9, 0x820E,0x8ECA, 0x5199,0x8ECB, 0x5C04,0x8ECC, 0x6368,0x8ECD, 0x8D66,0x8ECE, 0x659C,0x8ECF, 0x716E,0x8ED0, 0x793E,0x8ED1, 0x7D17,0x8ED2, 0x8005,0x8ED3, 0x8B1D,0x8ED4, 0x8ECA,0x8ED5, 0x906E,0x8ED6, 0x86C7,0x8ED7, 0x90AA,0x8ED8, 0x501F,0x8ED9, 0x52FA,0x8EDA, 0x5C3A,0x8EDB, 0x6753,0x8EDC, 0x707C,0x8EDD, 0x7235,0x8EDE, 0x914C,0x8EDF, 0x91C8,0x8EE0, 0x932B,0x8EE1, 0x82E5,0x8EE2, 0x5BC2,0x8EE3, 0x5F31,0x8EE4, 0x60F9,0x8EE5, 0x4E3B,0x8EE6, 0x53D6,0x8EE7, 0x5B88,0x8EE8, 0x624B,0x8EE9, 0x6731,0x8EEA, 0x6B8A,0x8EEB, 0x72E9,0x8EEC, 0x73E0,0x8EED, 0x7A2E,0x8EEE, 0x816B,0x8EEF, 0x8DA3,0x8EF0, 0x9152,0x8EF1, 0x9996,0x8EF2, 0x5112,0x8EF3, 0x53D7,0x8EF4, 0x546A,0x8EF5, 0x5BFF,0x8EF6, 0x6388,0x8EF7, 0x6A39,0x8EF8, 0x7DAC,0x8EF9, 0x9700,0x8EFA, 0x56DA,0x8EFB, 0x53CE,0x8EFC, 0x5468,0x8F40, 0x5B97,0x8F41, 0x5C31,0x8F42, 0x5DDE,0x8F43, 0x4FEE,0x8F44, 0x6101,0x8F45, 0x62FE,0x8F46, 0x6D32,0x8F47, 0x79C0,0x8F48, 0x79CB,0x8F49, 0x7D42,0x8F4A, 0x7E4D,0x8F4B, 0x7FD2,0x8F4C, 0x81ED,0x8F4D, 0x821F,0x8F4E, 0x8490,0x8F4F, 0x8846,0x8F50, 0x8972,0x8F51, 0x8B90,0x8F52, 0x8E74,0x8F53, 0x8F2F,0x8F54, 0x9031,0x8F55, 0x914B,0x8F56, 0x916C,0x8F57, 0x96C6,0x8F58, 0x919C,0x8F59, 0x4EC0,0x8F5A, 0x4F4F,0x8F5B, 0x5145,0x8F5C, 0x5341,0x8F5D, 0x5F93,0x8F5E, 0x620E,0x8F5F, 0x67D4,0x8F60, 0x6C41,0x8F61, 0x6E0B,0x8F62, 0x7363,0x8F63, 0x7E26,0x8F64, 0x91CD,0x8F65, 0x9283,0x8F66, 0x53D4,0x8F67, 0x5919,0x8F68, 0x5BBF,0x8F69, 0x6DD1,0x8F6A, 0x795D,0x8F6B, 0x7E2E,0x8F6C, 0x7C9B,0x8F6D, 0x587E,0x8F6E, 0x719F,0x8F6F, 0x51FA,0x8F70, 0x8853,0x8F71, 0x8FF0,0x8F72, 0x4FCA,0x8F73, 0x5CFB,0x8F74, 0x6625,0x8F75, 0x77AC,0x8F76, 0x7AE3,0x8F77, 0x821C,0x8F78, 0x99FF,0x8F79, 0x51C6,0x8F7A, 0x5FAA,0x8F7B, 0x65EC,0x8F7C, 0x696F,0x8F7D, 0x6B89,0x8F7E, 0x6DF3,0x8F80, 0x6E96,0x8F81, 0x6F64,0x8F82, 0x76FE,0x8F83, 0x7D14,0x8F84, 0x5DE1,0x8F85, 0x9075,0x8F86, 0x9187,0x8F87, 0x9806,0x8F88, 0x51E6,0x8F89, 0x521D,0x8F8A, 0x6240,0x8F8B, 0x6691,0x8F8C, 0x66D9,0x8F8D, 0x6E1A,0x8F8E, 0x5EB6,0x8F8F, 0x7DD2,0x8F90, 0x7F72,0x8F91, 0x66F8,0x8F92, 0x85AF,0x8F93, 0x85F7,0x8F94, 0x8AF8,0x8F95, 0x52A9,0x8F96, 0x53D9,0x8F97, 0x5973,0x8F98, 0x5E8F,0x8F99, 0x5F90,0x8F9A, 0x6055,0x8F9B, 0x92E4,0x8F9C, 0x9664,0x8F9D, 0x50B7,0x8F9E, 0x511F,0x8F9F, 0x52DD,0x8FA0, 0x5320,0x8FA1, 0x5347,0x8FA2, 0x53EC,0x8FA3, 0x54E8,0x8FA4, 0x5546,0x8FA5, 0x5531,0x8FA6, 0x5617,0x8FA7, 0x5968,0x8FA8, 0x59BE,0x8FA9, 0x5A3C,0x8FAA, 0x5BB5,0x8FAB, 0x5C06,0x8FAC, 0x5C0F,0x8FAD, 0x5C11,0x8FAE, 0x5C1A,0x8FAF, 0x5E84,0x8FB0, 0x5E8A,0x8FB1, 0x5EE0,0x8FB2, 0x5F70,0x8FB3, 0x627F,0x8FB4, 0x6284,0x8FB5, 0x62DB,0x8FB6, 0x638C,0x8FB7, 0x6377,0x8FB8, 0x6607,0x8FB9, 0x660C,0x8FBA, 0x662D,0x8FBB, 0x6676,0x8FBC, 0x677E,0x8FBD, 0x68A2,0x8FBE, 0x6A1F,0x8FBF, 0x6A35,0x8FC0, 0x6CBC,0x8FC1, 0x6D88,0x8FC2, 0x6E09,0x8FC3, 0x6E58,0x8FC4, 0x713C,0x8FC5, 0x7126,0x8FC6, 0x7167,0x8FC7, 0x75C7,0x8FC8, 0x7701,0x8FC9, 0x785D,0x8FCA, 0x7901,0x8FCB, 0x7965,0x8FCC, 0x79F0,0x8FCD, 0x7AE0,0x8FCE, 0x7B11,0x8FCF, 0x7CA7,0x8FD0, 0x7D39,0x8FD1, 0x8096,0x8FD2, 0x83D6,0x8FD3, 0x848B,0x8FD4, 0x8549,0x8FD5, 0x885D,0x8FD6, 0x88F3,0x8FD7, 0x8A1F,0x8FD8, 0x8A3C,0x8FD9, 0x8A54,0x8FDA, 0x8A73,0x8FDB, 0x8C61,0x8FDC, 0x8CDE,0x8FDD, 0x91A4,0x8FDE, 0x9266,0x8FDF, 0x937E,0x8FE0, 0x9418,0x8FE1, 0x969C,0x8FE2, 0x9798,0x8FE3, 0x4E0A,0x8FE4, 0x4E08,0x8FE5, 0x4E1E,0x8FE6, 0x4E57,0x8FE7, 0x5197,0x8FE8, 0x5270,0x8FE9, 0x57CE,0x8FEA, 0x5834,0x8FEB, 0x58CC,0x8FEC, 0x5B22,0x8FED, 0x5E38,0x8FEE, 0x60C5,0x8FEF, 0x64FE,0x8FF0, 0x6761,0x8FF1, 0x6756,0x8FF2, 0x6D44,0x8FF3, 0x72B6,0x8FF4, 0x7573,0x8FF5, 0x7A63,0x8FF6, 0x84B8,0x8FF7, 0x8B72,0x8FF8, 0x91B8,0x8FF9, 0x9320,0x8FFA, 0x5631,0x8FFB, 0x57F4,0x8FFC, 0x98FE,0x9040, 0x62ED,0x9041, 0x690D,0x9042, 0x6B96,0x9043, 0x71ED,0x9044, 0x7E54,0x9045, 0x8077,0x9046, 0x8272,0x9047, 0x89E6,0x9048, 0x98DF,0x9049, 0x8755,0x904A, 0x8FB1,0x904B, 0x5C3B,0x904C, 0x4F38,0x904D, 0x4FE1,0x904E, 0x4FB5,0x904F, 0x5507,0x9050, 0x5A20,0x9051, 0x5BDD,0x9052, 0x5BE9,0x9053, 0x5FC3,0x9054, 0x614E,0x9055, 0x632F,0x9056, 0x65B0,0x9057, 0x664B,0x9058, 0x68EE,0x9059, 0x699B,0x905A, 0x6D78,0x905B, 0x6DF1,0x905C, 0x7533,0x905D, 0x75B9,0x905E, 0x771F,0x905F, 0x795E,0x9060, 0x79E6,0x9061, 0x7D33,0x9062, 0x81E3,0x9063, 0x82AF,0x9064, 0x85AA,0x9065, 0x89AA,0x9066, 0x8A3A,0x9067, 0x8EAB,0x9068, 0x8F9B,0x9069, 0x9032,0x906A, 0x91DD,0x906B, 0x9707,0x906C, 0x4EBA,0x906D, 0x4EC1,0x906E, 0x5203,0x906F, 0x5875,0x9070, 0x58EC,0x9071, 0x5C0B,0x9072, 0x751A,0x9073, 0x5C3D,0x9074, 0x814E,0x9075, 0x8A0A,0x9076, 0x8FC5,0x9077, 0x9663,0x9078, 0x976D,0x9079, 0x7B25,0x907A, 0x8ACF,0x907B, 0x9808,0x907C, 0x9162,0x907D, 0x56F3,0x907E, 0x53A8,0x9080, 0x9017,0x9081, 0x5439,0x9082, 0x5782,0x9083, 0x5E25,0x9084, 0x63A8,0x9085, 0x6C34,0x9086, 0x708A,0x9087, 0x7761,0x9088, 0x7C8B,0x9089, 0x7FE0,0x908A, 0x8870,0x908B, 0x9042,0x908C, 0x9154,0x908D, 0x9310,0x908E, 0x9318,0x908F, 0x968F,0x9090, 0x745E,0x9091, 0x9AC4,0x9092, 0x5D07,0x9093, 0x5D69,0x9094, 0x6570,0x9095, 0x67A2,0x9096, 0x8DA8,0x9097, 0x96DB,0x9098, 0x636E,0x9099, 0x6749,0x909A, 0x6919,0x909B, 0x83C5,0x909C, 0x9817,0x909D, 0x96C0,0x909E, 0x88FE,0x909F, 0x6F84,0x90A0, 0x647A,0x90A1, 0x5BF8,0x90A2, 0x4E16,0x90A3, 0x702C,0x90A4, 0x755D,0x90A5, 0x662F,0x90A6, 0x51C4,0x90A7, 0x5236,0x90A8, 0x52E2,0x90A9, 0x59D3,0x90AA, 0x5F81,0x90AB, 0x6027,0x90AC, 0x6210,0x90AD, 0x653F,0x90AE, 0x6574,0x90AF, 0x661F,0x90B0, 0x6674,0x90B1, 0x68F2,0x90B2, 0x6816,0x90B3, 0x6B63,0x90B4, 0x6E05,0x90B5, 0x7272,0x90B6, 0x751F,0x90B7, 0x76DB,0x90B8, 0x7CBE,0x90B9, 0x8056,0x90BA, 0x58F0,0x90BB, 0x88FD,0x90BC, 0x897F,0x90BD, 0x8AA0,0x90BE, 0x8A93,0x90BF, 0x8ACB,0x90C0, 0x901D,0x90C1, 0x9192,0x90C2, 0x9752,0x90C3, 0x9759,0x90C4, 0x6589,0x90C5, 0x7A0E,0x90C6, 0x8106,0x90C7, 0x96BB,0x90C8, 0x5E2D,0x90C9, 0x60DC,0x90CA, 0x621A,0x90CB, 0x65A5,0x90CC, 0x6614,0x90CD, 0x6790,0x90CE, 0x77F3,0x90CF, 0x7A4D,0x90D0, 0x7C4D,0x90D1, 0x7E3E,0x90D2, 0x810A,0x90D3, 0x8CAC,0x90D4, 0x8D64,0x90D5, 0x8DE1,0x90D6, 0x8E5F,0x90D7, 0x78A9,0x90D8, 0x5207,0x90D9, 0x62D9,0x90DA, 0x63A5,0x90DB, 0x6442,0x90DC, 0x6298,0x90DD, 0x8A2D,0x90DE, 0x7A83,0x90DF, 0x7BC0,0x90E0, 0x8AAC,0x90E1, 0x96EA,0x90E2, 0x7D76,0x90E3, 0x820C,0x90E4, 0x8749,0x90E5, 0x4ED9,0x90E6, 0x5148,0x90E7, 0x5343,0x90E8, 0x5360,0x90E9, 0x5BA3,0x90EA, 0x5C02,0x90EB, 0x5C16,0x90EC, 0x5DDD,0x90ED, 0x6226,0x90EE, 0x6247,0x90EF, 0x64B0,0x90F0, 0x6813,0x90F1, 0x6834,0x90F2, 0x6CC9,0x90F3, 0x6D45,0x90F4, 0x6D17,0x90F5, 0x67D3,0x90F6, 0x6F5C,0x90F7, 0x714E,0x90F8, 0x717D,0x90F9, 0x65CB,0x90FA, 0x7A7F,0x90FB, 0x7BAD,0x90FC, 0x7DDA,0x9140, 0x7E4A,0x9141, 0x7FA8,0x9142, 0x817A,0x9143, 0x821B,0x9144, 0x8239,0x9145, 0x85A6,0x9146, 0x8A6E,0x9147, 0x8CCE,0x9148, 0x8DF5,0x9149, 0x9078,0x914A, 0x9077,0x914B, 0x92AD,0x914C, 0x9291,0x914D, 0x9583,0x914E, 0x9BAE,0x914F, 0x524D,0x9150, 0x5584,0x9151, 0x6F38,0x9152, 0x7136,0x9153, 0x5168,0x9154, 0x7985,0x9155, 0x7E55,0x9156, 0x81B3,0x9157, 0x7CCE,0x9158, 0x564C,0x9159, 0x5851,0x915A, 0x5CA8,0x915B, 0x63AA,0x915C, 0x66FE,0x915D, 0x66FD,0x915E, 0x695A,0x915F, 0x72D9,0x9160, 0x758F,0x9161, 0x758E,0x9162, 0x790E,0x9163, 0x7956,0x9164, 0x79DF,0x9165, 0x7C97,0x9166, 0x7D20,0x9167, 0x7D44,0x9168, 0x8607,0x9169, 0x8A34,0x916A, 0x963B,0x916B, 0x9061,0x916C, 0x9F20,0x916D, 0x50E7,0x916E, 0x5275,0x916F, 0x53CC,0x9170, 0x53E2,0x9171, 0x5009,0x9172, 0x55AA,0x9173, 0x58EE,0x9174, 0x594F,0x9175, 0x723D,0x9176, 0x5B8B,0x9177, 0x5C64,0x9178, 0x531D,0x9179, 0x60E3,0x917A, 0x60F3,0x917B, 0x635C,0x917C, 0x6383,0x917D, 0x633F,0x917E, 0x63BB,0x9180, 0x64CD,0x9181, 0x65E9,0x9182, 0x66F9,0x9183, 0x5DE3,0x9184, 0x69CD,0x9185, 0x69FD,0x9186, 0x6F15,0x9187, 0x71E5,0x9188, 0x4E89,0x9189, 0x75E9,0x918A, 0x76F8,0x918B, 0x7A93,0x918C, 0x7CDF,0x918D, 0x7DCF,0x918E, 0x7D9C,0x918F, 0x8061,0x9190, 0x8349,0x9191, 0x8358,0x9192, 0x846C,0x9193, 0x84BC,0x9194, 0x85FB,0x9195, 0x88C5,0x9196, 0x8D70,0x9197, 0x9001,0x9198, 0x906D,0x9199, 0x9397,0x919A, 0x971C,0x919B, 0x9A12,0x919C, 0x50CF,0x919D, 0x5897,0x919E, 0x618E,0x919F, 0x81D3,0x91A0, 0x8535,0x91A1, 0x8D08,0x91A2, 0x9020,0x91A3, 0x4FC3,0x91A4, 0x5074,0x91A5, 0x5247,0x91A6, 0x5373,0x91A7, 0x606F,0x91A8, 0x6349,0x91A9, 0x675F,0x91AA, 0x6E2C,0x91AB, 0x8DB3,0x91AC, 0x901F,0x91AD, 0x4FD7,0x91AE, 0x5C5E,0x91AF, 0x8CCA,0x91B0, 0x65CF,0x91B1, 0x7D9A,0x91B2, 0x5352,0x91B3, 0x8896,0x91B4, 0x5176,0x91B5, 0x63C3,0x91B6, 0x5B58,0x91B7, 0x5B6B,0x91B8, 0x5C0A,0x91B9, 0x640D,0x91BA, 0x6751,0x91BB, 0x905C,0x91BC, 0x4ED6,0x91BD, 0x591A,0x91BE, 0x592A,0x91BF, 0x6C70,0x91C0, 0x8A51,0x91C1, 0x553E,0x91C2, 0x5815,0x91C3, 0x59A5,0x91C4, 0x60F0,0x91C5, 0x6253,0x91C6, 0x67C1,0x91C7, 0x8235,0x91C8, 0x6955,0x91C9, 0x9640,0x91CA, 0x99C4,0x91CB, 0x9A28,0x91CC, 0x4F53,0x91CD, 0x5806,0x91CE, 0x5BFE,0x91CF, 0x8010,0x91D0, 0x5CB1,0x91D1, 0x5E2F,0x91D2, 0x5F85,0x91D3, 0x6020,0x91D4, 0x614B,0x91D5, 0x6234,0x91D6, 0x66FF,0x91D7, 0x6CF0,0x91D8, 0x6EDE,0x91D9, 0x80CE,0x91DA, 0x817F,0x91DB, 0x82D4,0x91DC, 0x888B,0x91DD, 0x8CB8,0x91DE, 0x9000,0x91DF, 0x902E,0x91E0, 0x968A,0x91E1, 0x9EDB,0x91E2, 0x9BDB,0x91E3, 0x4EE3,0x91E4, 0x53F0,0x91E5, 0x5927,0x91E6, 0x7B2C,0x91E7, 0x918D,0x91E8, 0x984C,0x91E9, 0x9DF9,0x91EA, 0x6EDD,0x91EB, 0x7027,0x91EC, 0x5353,0x91ED, 0x5544,0x91EE, 0x5B85,0x91EF, 0x6258,0x91F0, 0x629E,0x91F1, 0x62D3,0x91F2, 0x6CA2,0x91F3, 0x6FEF,0x91F4, 0x7422,0x91F5, 0x8A17,0x91F6, 0x9438,0x91F7, 0x6FC1,0x91F8, 0x8AFE,0x91F9, 0x8338,0x91FA, 0x51E7,0x91FB, 0x86F8,0x91FC, 0x53EA,0x9240, 0x53E9,0x9241, 0x4F46,0x9242, 0x9054,0x9243, 0x8FB0,0x9244, 0x596A,0x9245, 0x8131,0x9246, 0x5DFD,0x9247, 0x7AEA,0x9248, 0x8FBF,0x9249, 0x68DA,0x924A, 0x8C37,0x924B, 0x72F8,0x924C, 0x9C48,0x924D, 0x6A3D,0x924E, 0x8AB0,0x924F, 0x4E39,0x9250, 0x5358,0x9251, 0x5606,0x9252, 0x5766,0x9253, 0x62C5,0x9254, 0x63A2,0x9255, 0x65E6,0x9256, 0x6B4E,0x9257, 0x6DE1,0x9258, 0x6E5B,0x9259, 0x70AD,0x925A, 0x77ED,0x925B, 0x7AEF,0x925C, 0x7BAA,0x925D, 0x7DBB,0x925E, 0x803D,0x925F, 0x80C6,0x9260, 0x86CB,0x9261, 0x8A95,0x9262, 0x935B,0x9263, 0x56E3,0x9264, 0x58C7,0x9265, 0x5F3E,0x9266, 0x65AD,0x9267, 0x6696,0x9268, 0x6A80,0x9269, 0x6BB5,0x926A, 0x7537,0x926B, 0x8AC7,0x926C, 0x5024,0x926D, 0x77E5,0x926E, 0x5730,0x926F, 0x5F1B,0x9270, 0x6065,0x9271, 0x667A,0x9272, 0x6C60,0x9273, 0x75F4,0x9274, 0x7A1A,0x9275, 0x7F6E,0x9276, 0x81F4,0x9277, 0x8718,0x9278, 0x9045,0x9279, 0x99B3,0x927A, 0x7BC9,0x927B, 0x755C,0x927C, 0x7AF9,0x927D, 0x7B51,0x927E, 0x84C4,0x9280, 0x9010,0x9281, 0x79E9,0x9282, 0x7A92,0x9283, 0x8336,0x9284, 0x5AE1,0x9285, 0x7740,0x9286, 0x4E2D,0x9287, 0x4EF2,0x9288, 0x5B99,0x9289, 0x5FE0,0x928A, 0x62BD,0x928B, 0x663C,0x928C, 0x67F1,0x928D, 0x6CE8,0x928E, 0x866B,0x928F, 0x8877,0x9290, 0x8A3B,0x9291, 0x914E,0x9292, 0x92F3,0x9293, 0x99D0,0x9294, 0x6A17,0x9295, 0x7026,0x9296, 0x732A,0x9297, 0x82E7,0x9298, 0x8457,0x9299, 0x8CAF,0x929A, 0x4E01,0x929B, 0x5146,0x929C, 0x51CB,0x929D, 0x558B,0x929E, 0x5BF5,0x929F, 0x5E16,0x92A0, 0x5E33,0x92A1, 0x5E81,0x92A2, 0x5F14,0x92A3, 0x5F35,0x92A4, 0x5F6B,0x92A5, 0x5FB4,0x92A6, 0x61F2,0x92A7, 0x6311,0x92A8, 0x66A2,0x92A9, 0x671D,0x92AA, 0x6F6E,0x92AB, 0x7252,0x92AC, 0x753A,0x92AD, 0x773A,0x92AE, 0x8074,0x92AF, 0x8139,0x92B0, 0x8178,0x92B1, 0x8776,0x92B2, 0x8ABF,0x92B3, 0x8ADC,0x92B4, 0x8D85,0x92B5, 0x8DF3,0x92B6, 0x929A,0x92B7, 0x9577,0x92B8, 0x9802,0x92B9, 0x9CE5,0x92BA, 0x52C5,0x92BB, 0x6357,0x92BC, 0x76F4,0x92BD, 0x6715,0x92BE, 0x6C88,0x92BF, 0x73CD,0x92C0, 0x8CC3,0x92C1, 0x93AE,0x92C2, 0x9673,0x92C3, 0x6D25,0x92C4, 0x589C,0x92C5, 0x690E,0x92C6, 0x69CC,0x92C7, 0x8FFD,0x92C8, 0x939A,0x92C9, 0x75DB,0x92CA, 0x901A,0x92CB, 0x585A,0x92CC, 0x6802,0x92CD, 0x63B4,0x92CE, 0x69FB,0x92CF, 0x4F43,0x92D0, 0x6F2C,0x92D1, 0x67D8,0x92D2, 0x8FBB,0x92D3, 0x8526,0x92D4, 0x7DB4,0x92D5, 0x9354,0x92D6, 0x693F,0x92D7, 0x6F70,0x92D8, 0x576A,0x92D9, 0x58F7,0x92DA, 0x5B2C,0x92DB, 0x7D2C,0x92DC, 0x722A,0x92DD, 0x540A,0x92DE, 0x91E3,0x92DF, 0x9DB4,0x92E0, 0x4EAD,0x92E1, 0x4F4E,0x92E2, 0x505C,0x92E3, 0x5075,0x92E4, 0x5243,0x92E5, 0x8C9E,0x92E6, 0x5448,0x92E7, 0x5824,0x92E8, 0x5B9A,0x92E9, 0x5E1D,0x92EA, 0x5E95,0x92EB, 0x5EAD,0x92EC, 0x5EF7,0x92ED, 0x5F1F,0x92EE, 0x608C,0x92EF, 0x62B5,0x92F0, 0x633A,0x92F1, 0x63D0,0x92F2, 0x68AF,0x92F3, 0x6C40,0x92F4, 0x7887,0x92F5, 0x798E,0x92F6, 0x7A0B,0x92F7, 0x7DE0,0x92F8, 0x8247,0x92F9, 0x8A02,0x92FA, 0x8AE6,0x92FB, 0x8E44,0x92FC, 0x9013,0x9340, 0x90B8,0x9341, 0x912D,0x9342, 0x91D8,0x9343, 0x9F0E,0x9344, 0x6CE5,0x9345, 0x6458,0x9346, 0x64E2,0x9347, 0x6575,0x9348, 0x6EF4,0x9349, 0x7684,0x934A, 0x7B1B,0x934B, 0x9069,0x934C, 0x93D1,0x934D, 0x6EBA,0x934E, 0x54F2,0x934F, 0x5FB9,0x9350, 0x64A4,0x9351, 0x8F4D,0x9352, 0x8FED,0x9353, 0x9244,0x9354, 0x5178,0x9355, 0x586B,0x9356, 0x5929,0x9357, 0x5C55,0x9358, 0x5E97,0x9359, 0x6DFB,0x935A, 0x7E8F,0x935B, 0x751C,0x935C, 0x8CBC,0x935D, 0x8EE2,0x935E, 0x985B,0x935F, 0x70B9,0x9360, 0x4F1D,0x9361, 0x6BBF,0x9362, 0x6FB1,0x9363, 0x7530,0x9364, 0x96FB,0x9365, 0x514E,0x9366, 0x5410,0x9367, 0x5835,0x9368, 0x5857,0x9369, 0x59AC,0x936A, 0x5C60,0x936B, 0x5F92,0x936C, 0x6597,0x936D, 0x675C,0x936E, 0x6E21,0x936F, 0x767B,0x9370, 0x83DF,0x9371, 0x8CED,0x9372, 0x9014,0x9373, 0x90FD,0x9374, 0x934D,0x9375, 0x7825,0x9376, 0x783A,0x9377, 0x52AA,0x9378, 0x5EA6,0x9379, 0x571F,0x937A, 0x5974,0x937B, 0x6012,0x937C, 0x5012,0x937D, 0x515A,0x937E, 0x51AC,0x9380, 0x51CD,0x9381, 0x5200,0x9382, 0x5510,0x9383, 0x5854,0x9384, 0x5858,0x9385, 0x5957,0x9386, 0x5B95,0x9387, 0x5CF6,0x9388, 0x5D8B,0x9389, 0x60BC,0x938A, 0x6295,0x938B, 0x642D,0x938C, 0x6771,0x938D, 0x6843,0x938E, 0x68BC,0x938F, 0x68DF,0x9390, 0x76D7,0x9391, 0x6DD8,0x9392, 0x6E6F,0x9393, 0x6D9B,0x9394, 0x706F,0x9395, 0x71C8,0x9396, 0x5F53,0x9397, 0x75D8,0x9398, 0x7977,0x9399, 0x7B49,0x939A, 0x7B54,0x939B, 0x7B52,0x939C, 0x7CD6,0x939D, 0x7D71,0x939E, 0x5230,0x939F, 0x8463,0x93A0, 0x8569,0x93A1, 0x85E4,0x93A2, 0x8A0E,0x93A3, 0x8B04,0x93A4, 0x8C46,0x93A5, 0x8E0F,0x93A6, 0x9003,0x93A7, 0x900F,0x93A8, 0x9419,0x93A9, 0x9676,0x93AA, 0x982D,0x93AB, 0x9A30,0x93AC, 0x95D8,0x93AD, 0x50CD,0x93AE, 0x52D5,0x93AF, 0x540C,0x93B0, 0x5802,0x93B1, 0x5C0E,0x93B2, 0x61A7,0x93B3, 0x649E,0x93B4, 0x6D1E,0x93B5, 0x77B3,0x93B6, 0x7AE5,0x93B7, 0x80F4,0x93B8, 0x8404,0x93B9, 0x9053,0x93BA, 0x9285,0x93BB, 0x5CE0,0x93BC, 0x9D07,0x93BD, 0x533F,0x93BE, 0x5F97,0x93BF, 0x5FB3,0x93C0, 0x6D9C,0x93C1, 0x7279,0x93C2, 0x7763,0x93C3, 0x79BF,0x93C4, 0x7BE4,0x93C5, 0x6BD2,0x93C6, 0x72EC,0x93C7, 0x8AAD,0x93C8, 0x6803,0x93C9, 0x6A61,0x93CA, 0x51F8,0x93CB, 0x7A81,0x93CC, 0x6934,0x93CD, 0x5C4A,0x93CE, 0x9CF6,0x93CF, 0x82EB,0x93D0, 0x5BC5,0x93D1, 0x9149,0x93D2, 0x701E,0x93D3, 0x5678,0x93D4, 0x5C6F,0x93D5, 0x60C7,0x93D6, 0x6566,0x93D7, 0x6C8C,0x93D8, 0x8C5A,0x93D9, 0x9041,0x93DA, 0x9813,0x93DB, 0x5451,0x93DC, 0x66C7,0x93DD, 0x920D,0x93DE, 0x5948,0x93DF, 0x90A3,0x93E0, 0x5185,0x93E1, 0x4E4D,0x93E2, 0x51EA,0x93E3, 0x8599,0x93E4, 0x8B0E,0x93E5, 0x7058,0x93E6, 0x637A,0x93E7, 0x934B,0x93E8, 0x6962,0x93E9, 0x99B4,0x93EA, 0x7E04,0x93EB, 0x7577,0x93EC, 0x5357,0x93ED, 0x6960,0x93EE, 0x8EDF,0x93EF, 0x96E3,0x93F0, 0x6C5D,0x93F1, 0x4E8C,0x93F2, 0x5C3C,0x93F3, 0x5F10,0x93F4, 0x8FE9,0x93F5, 0x5302,0x93F6, 0x8CD1,0x93F7, 0x8089,0x93F8, 0x8679,0x93F9, 0x5EFF,0x93FA, 0x65E5,0x93FB, 0x4E73,0x93FC, 0x5165,0x9440, 0x5982,0x9441, 0x5C3F,0x9442, 0x97EE,0x9443, 0x4EFB,0x9444, 0x598A,0x9445, 0x5FCD,0x9446, 0x8A8D,0x9447, 0x6FE1,0x9448, 0x79B0,0x9449, 0x7962,0x944A, 0x5BE7,0x944B, 0x8471,0x944C, 0x732B,0x944D, 0x71B1,0x944E, 0x5E74,0x944F, 0x5FF5,0x9450, 0x637B,0x9451, 0x649A,0x9452, 0x71C3,0x9453, 0x7C98,0x9454, 0x4E43,0x9455, 0x5EFC,0x9456, 0x4E4B,0x9457, 0x57DC,0x9458, 0x56A2,0x9459, 0x60A9,0x945A, 0x6FC3,0x945B, 0x7D0D,0x945C, 0x80FD,0x945D, 0x8133,0x945E, 0x81BF,0x945F, 0x8FB2,0x9460, 0x8997,0x9461, 0x86A4,0x9462, 0x5DF4,0x9463, 0x628A,0x9464, 0x64AD,0x9465, 0x8987,0x9466, 0x6777,0x9467, 0x6CE2,0x9468, 0x6D3E,0x9469, 0x7436,0x946A, 0x7834,0x946B, 0x5A46,0x946C, 0x7F75,0x946D, 0x82AD,0x946E, 0x99AC,0x946F, 0x4FF3,0x9470, 0x5EC3,0x9471, 0x62DD,0x9472, 0x6392,0x9473, 0x6557,0x9474, 0x676F,0x9475, 0x76C3,0x9476, 0x724C,0x9477, 0x80CC,0x9478, 0x80BA,0x9479, 0x8F29,0x947A, 0x914D,0x947B, 0x500D,0x947C, 0x57F9,0x947D, 0x5A92,0x947E, 0x6885,0x9480, 0x6973,0x9481, 0x7164,0x9482, 0x72FD,0x9483, 0x8CB7,0x9484, 0x58F2,0x9485, 0x8CE0,0x9486, 0x966A,0x9487, 0x9019,0x9488, 0x877F,0x9489, 0x79E4,0x948A, 0x77E7,0x948B, 0x8429,0x948C, 0x4F2F,0x948D, 0x5265,0x948E, 0x535A,0x948F, 0x62CD,0x9490, 0x67CF,0x9491, 0x6CCA,0x9492, 0x767D,0x9493, 0x7B94,0x9494, 0x7C95,0x9495, 0x8236,0x9496, 0x8584,0x9497, 0x8FEB,0x9498, 0x66DD,0x9499, 0x6F20,0x949A, 0x7206,0x949B, 0x7E1B,0x949C, 0x83AB,0x949D, 0x99C1,0x949E, 0x9EA6,0x949F, 0x51FD,0x94A0, 0x7BB1,0x94A1, 0x7872,0x94A2, 0x7BB8,0x94A3, 0x8087,0x94A4, 0x7B48,0x94A5, 0x6AE8,0x94A6, 0x5E61,0x94A7, 0x808C,0x94A8, 0x7551,0x94A9, 0x7560,0x94AA, 0x516B,0x94AB, 0x9262,0x94AC, 0x6E8C,0x94AD, 0x767A,0x94AE, 0x9197,0x94AF, 0x9AEA,0x94B0, 0x4F10,0x94B1, 0x7F70,0x94B2, 0x629C,0x94B3, 0x7B4F,0x94B4, 0x95A5,0x94B5, 0x9CE9,0x94B6, 0x567A,0x94B7, 0x5859,0x94B8, 0x86E4,0x94B9, 0x96BC,0x94BA, 0x4F34,0x94BB, 0x5224,0x94BC, 0x534A,0x94BD, 0x53CD,0x94BE, 0x53DB,0x94BF, 0x5E06,0x94C0, 0x642C,0x94C1, 0x6591,0x94C2, 0x677F,0x94C3, 0x6C3E,0x94C4, 0x6C4E,0x94C5, 0x7248,0x94C6, 0x72AF,0x94C7, 0x73ED,0x94C8, 0x7554,0x94C9, 0x7E41,0x94CA, 0x822C,0x94CB, 0x85E9,0x94CC, 0x8CA9,0x94CD, 0x7BC4,0x94CE, 0x91C6,0x94CF, 0x7169,0x94D0, 0x9812,0x94D1, 0x98EF,0x94D2, 0x633D,0x94D3, 0x6669,0x94D4, 0x756A,0x94D5, 0x76E4,0x94D6, 0x78D0,0x94D7, 0x8543,0x94D8, 0x86EE,0x94D9, 0x532A,0x94DA, 0x5351,0x94DB, 0x5426,0x94DC, 0x5983,0x94DD, 0x5E87,0x94DE, 0x5F7C,0x94DF, 0x60B2,0x94E0, 0x6249,0x94E1, 0x6279,0x94E2, 0x62AB,0x94E3, 0x6590,0x94E4, 0x6BD4,0x94E5, 0x6CCC,0x94E6, 0x75B2,0x94E7, 0x76AE,0x94E8, 0x7891,0x94E9, 0x79D8,0x94EA, 0x7DCB,0x94EB, 0x7F77,0x94EC, 0x80A5,0x94ED, 0x88AB,0x94EE, 0x8AB9,0x94EF, 0x8CBB,0x94F0, 0x907F,0x94F1, 0x975E,0x94F2, 0x98DB,0x94F3, 0x6A0B,0x94F4, 0x7C38,0x94F5, 0x5099,0x94F6, 0x5C3E,0x94F7, 0x5FAE,0x94F8, 0x6787,0x94F9, 0x6BD8,0x94FA, 0x7435,0x94FB, 0x7709,0x94FC, 0x7F8E,0x9540, 0x9F3B,0x9541, 0x67CA,0x9542, 0x7A17,0x9543, 0x5339,0x9544, 0x758B,0x9545, 0x9AED,0x9546, 0x5F66,0x9547, 0x819D,0x9548, 0x83F1,0x9549, 0x8098,0x954A, 0x5F3C,0x954B, 0x5FC5,0x954C, 0x7562,0x954D, 0x7B46,0x954E, 0x903C,0x954F, 0x6867,0x9550, 0x59EB,0x9551, 0x5A9B,0x9552, 0x7D10,0x9553, 0x767E,0x9554, 0x8B2C,0x9555, 0x4FF5,0x9556, 0x5F6A,0x9557, 0x6A19,0x9558, 0x6C37,0x9559, 0x6F02,0x955A, 0x74E2,0x955B, 0x7968,0x955C, 0x8868,0x955D, 0x8A55,0x955E, 0x8C79,0x955F, 0x5EDF,0x9560, 0x63CF,0x9561, 0x75C5,0x9562, 0x79D2,0x9563, 0x82D7,0x9564, 0x9328,0x9565, 0x92F2,0x9566, 0x849C,0x9567, 0x86ED,0x9568, 0x9C2D,0x9569, 0x54C1,0x956A, 0x5F6C,0x956B, 0x658C,0x956C, 0x6D5C,0x956D, 0x7015,0x956E, 0x8CA7,0x956F, 0x8CD3,0x9570, 0x983B,0x9571, 0x654F,0x9572, 0x74F6,0x9573, 0x4E0D,0x9574, 0x4ED8,0x9575, 0x57E0,0x9576, 0x592B,0x9577, 0x5A66,0x9578, 0x5BCC,0x9579, 0x51A8,0x957A, 0x5E03,0x957B, 0x5E9C,0x957C, 0x6016,0x957D, 0x6276,0x957E, 0x6577,0x9580, 0x65A7,0x9581, 0x666E,0x9582, 0x6D6E,0x9583, 0x7236,0x9584, 0x7B26,0x9585, 0x8150,0x9586, 0x819A,0x9587, 0x8299,0x9588, 0x8B5C,0x9589, 0x8CA0,0x958A, 0x8CE6,0x958B, 0x8D74,0x958C, 0x961C,0x958D, 0x9644,0x958E, 0x4FAE,0x958F, 0x64AB,0x9590, 0x6B66,0x9591, 0x821E,0x9592, 0x8461,0x9593, 0x856A,0x9594, 0x90E8,0x9595, 0x5C01,0x9596, 0x6953,0x9597, 0x98A8,0x9598, 0x847A,0x9599, 0x8557,0x959A, 0x4F0F,0x959B, 0x526F,0x959C, 0x5FA9,0x959D, 0x5E45,0x959E, 0x670D,0x959F, 0x798F,0x95A0, 0x8179,0x95A1, 0x8907,0x95A2, 0x8986,0x95A3, 0x6DF5,0x95A4, 0x5F17,0x95A5, 0x6255,0x95A6, 0x6CB8,0x95A7, 0x4ECF,0x95A8, 0x7269,0x95A9, 0x9B92,0x95AA, 0x5206,0x95AB, 0x543B,0x95AC, 0x5674,0x95AD, 0x58B3,0x95AE, 0x61A4,0x95AF, 0x626E,0x95B0, 0x711A,0x95B1, 0x596E,0x95B2, 0x7C89,0x95B3, 0x7CDE,0x95B4, 0x7D1B,0x95B5, 0x96F0,0x95B6, 0x6587,0x95B7, 0x805E,0x95B8, 0x4E19,0x95B9, 0x4F75,0x95BA, 0x5175,0x95BB, 0x5840,0x95BC, 0x5E63,0x95BD, 0x5E73,0x95BE, 0x5F0A,0x95BF, 0x67C4,0x95C0, 0x4E26,0x95C1, 0x853D,0x95C2, 0x9589,0x95C3, 0x965B,0x95C4, 0x7C73,0x95C5, 0x9801,0x95C6, 0x50FB,0x95C7, 0x58C1,0x95C8, 0x7656,0x95C9, 0x78A7,0x95CA, 0x5225,0x95CB, 0x77A5,0x95CC, 0x8511,0x95CD, 0x7B86,0x95CE, 0x504F,0x95CF, 0x5909,0x95D0, 0x7247,0x95D1, 0x7BC7,0x95D2, 0x7DE8,0x95D3, 0x8FBA,0x95D4, 0x8FD4,0x95D5, 0x904D,0x95D6, 0x4FBF,0x95D7, 0x52C9,0x95D8, 0x5A29,0x95D9, 0x5F01,0x95DA, 0x97AD,0x95DB, 0x4FDD,0x95DC, 0x8217,0x95DD, 0x92EA,0x95DE, 0x5703,0x95DF, 0x6355,0x95E0, 0x6B69,0x95E1, 0x752B,0x95E2, 0x88DC,0x95E3, 0x8F14,0x95E4, 0x7A42,0x95E5, 0x52DF,0x95E6, 0x5893,0x95E7, 0x6155,0x95E8, 0x620A,0x95E9, 0x66AE,0x95EA, 0x6BCD,0x95EB, 0x7C3F,0x95EC, 0x83E9,0x95ED, 0x5023,0x95EE, 0x4FF8,0x95EF, 0x5305,0x95F0, 0x5446,0x95F1, 0x5831,0x95F2, 0x5949,0x95F3, 0x5B9D,0x95F4, 0x5CF0,0x95F5, 0x5CEF,0x95F6, 0x5D29,0x95F7, 0x5E96,0x95F8, 0x62B1,0x95F9, 0x6367,0x95FA, 0x653E,0x95FB, 0x65B9,0x95FC, 0x670B,0x9640, 0x6CD5,0x9641, 0x6CE1,0x9642, 0x70F9,0x9643, 0x7832,0x9644, 0x7E2B,0x9645, 0x80DE,0x9646, 0x82B3,0x9647, 0x840C,0x9648, 0x84EC,0x9649, 0x8702,0x964A, 0x8912,0x964B, 0x8A2A,0x964C, 0x8C4A,0x964D, 0x90A6,0x964E, 0x92D2,0x964F, 0x98FD,0x9650, 0x9CF3,0x9651, 0x9D6C,0x9652, 0x4E4F,0x9653, 0x4EA1,0x9654, 0x508D,0x9655, 0x5256,0x9656, 0x574A,0x9657, 0x59A8,0x9658, 0x5E3D,0x9659, 0x5FD8,0x965A, 0x5FD9,0x965B, 0x623F,0x965C, 0x66B4,0x965D, 0x671B,0x965E, 0x67D0,0x965F, 0x68D2,0x9660, 0x5192,0x9661, 0x7D21,0x9662, 0x80AA,0x9663, 0x81A8,0x9664, 0x8B00,0x9665, 0x8C8C,0x9666, 0x8CBF,0x9667, 0x927E,0x9668, 0x9632,0x9669, 0x5420,0x966A, 0x982C,0x966B, 0x5317,0x966C, 0x50D5,0x966D, 0x535C,0x966E, 0x58A8,0x966F, 0x64B2,0x9670, 0x6734,0x9671, 0x7267,0x9672, 0x7766,0x9673, 0x7A46,0x9674, 0x91E6,0x9675, 0x52C3,0x9676, 0x6CA1,0x9677, 0x6B86,0x9678, 0x5800,0x9679, 0x5E4C,0x967A, 0x5954,0x967B, 0x672C,0x967C, 0x7FFB,0x967D, 0x51E1,0x967E, 0x76C6,0x9680, 0x6469,0x9681, 0x78E8,0x9682, 0x9B54,0x9683, 0x9EBB,0x9684, 0x57CB,0x9685, 0x59B9,0x9686, 0x6627,0x9687, 0x679A,0x9688, 0x6BCE,0x9689, 0x54E9,0x968A, 0x69D9,0x968B, 0x5E55,0x968C, 0x819C,0x968D, 0x6795,0x968E, 0x9BAA,0x968F, 0x67FE,0x9690, 0x9C52,0x9691, 0x685D,0x9692, 0x4EA6,0x9693, 0x4FE3,0x9694, 0x53C8,0x9695, 0x62B9,0x9696, 0x672B,0x9697, 0x6CAB,0x9698, 0x8FC4,0x9699, 0x4FAD,0x969A, 0x7E6D,0x969B, 0x9EBF,0x969C, 0x4E07,0x969D, 0x6162,0x969E, 0x6E80,0x969F, 0x6F2B,0x96A0, 0x8513,0x96A1, 0x5473,0x96A2, 0x672A,0x96A3, 0x9B45,0x96A4, 0x5DF3,0x96A5, 0x7B95,0x96A6, 0x5CAC,0x96A7, 0x5BC6,0x96A8, 0x871C,0x96A9, 0x6E4A,0x96AA, 0x84D1,0x96AB, 0x7A14,0x96AC, 0x8108,0x96AD, 0x5999,0x96AE, 0x7C8D,0x96AF, 0x6C11,0x96B0, 0x7720,0x96B1, 0x52D9,0x96B2, 0x5922,0x96B3, 0x7121,0x96B4, 0x725F,0x96B5, 0x77DB,0x96B6, 0x9727,0x96B7, 0x9D61,0x96B8, 0x690B,0x96B9, 0x5A7F,0x96BA, 0x5A18,0x96BB, 0x51A5,0x96BC, 0x540D,0x96BD, 0x547D,0x96BE, 0x660E,0x96BF, 0x76DF,0x96C0, 0x8FF7,0x96C1, 0x9298,0x96C2, 0x9CF4,0x96C3, 0x59EA,0x96C4, 0x725D,0x96C5, 0x6EC5,0x96C6, 0x514D,0x96C7, 0x68C9,0x96C8, 0x7DBF,0x96C9, 0x7DEC,0x96CA, 0x9762,0x96CB, 0x9EBA,0x96CC, 0x6478,0x96CD, 0x6A21,0x96CE, 0x8302,0x96CF, 0x5984,0x96D0, 0x5B5F,0x96D1, 0x6BDB,0x96D2, 0x731B,0x96D3, 0x76F2,0x96D4, 0x7DB2,0x96D5, 0x8017,0x96D6, 0x8499,0x96D7, 0x5132,0x96D8, 0x6728,0x96D9, 0x9ED9,0x96DA, 0x76EE,0x96DB, 0x6762,0x96DC, 0x52FF,0x96DD, 0x9905,0x96DE, 0x5C24,0x96DF, 0x623B,0x96E0, 0x7C7E,0x96E1, 0x8CB0,0x96E2, 0x554F,0x96E3, 0x60B6,0x96E4, 0x7D0B,0x96E5, 0x9580,0x96E6, 0x5301,0x96E7, 0x4E5F,0x96E8, 0x51B6,0x96E9, 0x591C,0x96EA, 0x723A,0x96EB, 0x8036,0x96EC, 0x91CE,0x96ED, 0x5F25,0x96EE, 0x77E2,0x96EF, 0x5384,0x96F0, 0x5F79,0x96F1, 0x7D04,0x96F2, 0x85AC,0x96F3, 0x8A33,0x96F4, 0x8E8D,0x96F5, 0x9756,0x96F6, 0x67F3,0x96F7, 0x85AE,0x96F8, 0x9453,0x96F9, 0x6109,0x96FA, 0x6108,0x96FB, 0x6CB9,0x96FC, 0x7652,0x9740, 0x8AED,0x9741, 0x8F38,0x9742, 0x552F,0x9743, 0x4F51,0x9744, 0x512A,0x9745, 0x52C7,0x9746, 0x53CB,0x9747, 0x5BA5,0x9748, 0x5E7D,0x9749, 0x60A0,0x974A, 0x6182,0x974B, 0x63D6,0x974C, 0x6709,0x974D, 0x67DA,0x974E, 0x6E67,0x974F, 0x6D8C,0x9750, 0x7336,0x9751, 0x7337,0x9752, 0x7531,0x9753, 0x7950,0x9754, 0x88D5,0x9755, 0x8A98,0x9756, 0x904A,0x9757, 0x9091,0x9758, 0x90F5,0x9759, 0x96C4,0x975A, 0x878D,0x975B, 0x5915,0x975C, 0x4E88,0x975D, 0x4F59,0x975E, 0x4E0E,0x975F, 0x8A89,0x9760, 0x8F3F,0x9761, 0x9810,0x9762, 0x50AD,0x9763, 0x5E7C,0x9764, 0x5996,0x9765, 0x5BB9,0x9766, 0x5EB8,0x9767, 0x63DA,0x9768, 0x63FA,0x9769, 0x64C1,0x976A, 0x66DC,0x976B, 0x694A,0x976C, 0x69D8,0x976D, 0x6D0B,0x976E, 0x6EB6,0x976F, 0x7194,0x9770, 0x7528,0x9771, 0x7AAF,0x9772, 0x7F8A,0x9773, 0x8000,0x9774, 0x8449,0x9775, 0x84C9,0x9776, 0x8981,0x9777, 0x8B21,0x9778, 0x8E0A,0x9779, 0x9065,0x977A, 0x967D,0x977B, 0x990A,0x977C, 0x617E,0x977D, 0x6291,0x977E, 0x6B32,0x9780, 0x6C83,0x9781, 0x6D74,0x9782, 0x7FCC,0x9783, 0x7FFC,0x9784, 0x6DC0,0x9785, 0x7F85,0x9786, 0x87BA,0x9787, 0x88F8,0x9788, 0x6765,0x9789, 0x83B1,0x978A, 0x983C,0x978B, 0x96F7,0x978C, 0x6D1B,0x978D, 0x7D61,0x978E, 0x843D,0x978F, 0x916A,0x9790, 0x4E71,0x9791, 0x5375,0x9792, 0x5D50,0x9793, 0x6B04,0x9794, 0x6FEB,0x9795, 0x85CD,0x9796, 0x862D,0x9797, 0x89A7,0x9798, 0x5229,0x9799, 0x540F,0x979A, 0x5C65,0x979B, 0x674E,0x979C, 0x68A8,0x979D, 0x7406,0x979E, 0x7483,0x979F, 0x75E2,0x97A0, 0x88CF,0x97A1, 0x88E1,0x97A2, 0x91CC,0x97A3, 0x96E2,0x97A4, 0x9678,0x97A5, 0x5F8B,0x97A6, 0x7387,0x97A7, 0x7ACB,0x97A8, 0x844E,0x97A9, 0x63A0,0x97AA, 0x7565,0x97AB, 0x5289,0x97AC, 0x6D41,0x97AD, 0x6E9C,0x97AE, 0x7409,0x97AF, 0x7559,0x97B0, 0x786B,0x97B1, 0x7C92,0x97B2, 0x9686,0x97B3, 0x7ADC,0x97B4, 0x9F8D,0x97B5, 0x4FB6,0x97B6, 0x616E,0x97B7, 0x65C5,0x97B8, 0x865C,0x97B9, 0x4E86,0x97BA, 0x4EAE,0x97BB, 0x50DA,0x97BC, 0x4E21,0x97BD, 0x51CC,0x97BE, 0x5BEE,0x97BF, 0x6599,0x97C0, 0x6881,0x97C1, 0x6DBC,0x97C2, 0x731F,0x97C3, 0x7642,0x97C4, 0x77AD,0x97C5, 0x7A1C,0x97C6, 0x7CE7,0x97C7, 0x826F,0x97C8, 0x8AD2,0x97C9, 0x907C,0x97CA, 0x91CF,0x97CB, 0x9675,0x97CC, 0x9818,0x97CD, 0x529B,0x97CE, 0x7DD1,0x97CF, 0x502B,0x97D0, 0x5398,0x97D1, 0x6797,0x97D2, 0x6DCB,0x97D3, 0x71D0,0x97D4, 0x7433,0x97D5, 0x81E8,0x97D6, 0x8F2A,0x97D7, 0x96A3,0x97D8, 0x9C57,0x97D9, 0x9E9F,0x97DA, 0x7460,0x97DB, 0x5841,0x97DC, 0x6D99,0x97DD, 0x7D2F,0x97DE, 0x985E,0x97DF, 0x4EE4,0x97E0, 0x4F36,0x97E1, 0x4F8B,0x97E2, 0x51B7,0x97E3, 0x52B1,0x97E4, 0x5DBA,0x97E5, 0x601C,0x97E6, 0x73B2,0x97E7, 0x793C,0x97E8, 0x82D3,0x97E9, 0x9234,0x97EA, 0x96B7,0x97EB, 0x96F6,0x97EC, 0x970A,0x97ED, 0x9E97,0x97EE, 0x9F62,0x97EF, 0x66A6,0x97F0, 0x6B74,0x97F1, 0x5217,0x97F2, 0x52A3,0x97F3, 0x70C8,0x97F4, 0x88C2,0x97F5, 0x5EC9,0x97F6, 0x604B,0x97F7, 0x6190,0x97F8, 0x6F23,0x97F9, 0x7149,0x97FA, 0x7C3E,0x97FB, 0x7DF4,0x97FC, 0x806F,0x9840, 0x84EE,0x9841, 0x9023,0x9842, 0x932C,0x9843, 0x5442,0x9844, 0x9B6F,0x9845, 0x6AD3,0x9846, 0x7089,0x9847, 0x8CC2,0x9848, 0x8DEF,0x9849, 0x9732,0x984A, 0x52B4,0x984B, 0x5A41,0x984C, 0x5ECA,0x984D, 0x5F04,0x984E, 0x6717,0x984F, 0x697C,0x9850, 0x6994,0x9851, 0x6D6A,0x9852, 0x6F0F,0x9853, 0x7262,0x9854, 0x72FC,0x9855, 0x7BED,0x9856, 0x8001,0x9857, 0x807E,0x9858, 0x874B,0x9859, 0x90CE,0x985A, 0x516D,0x985B, 0x9E93,0x985C, 0x7984,0x985D, 0x808B,0x985E, 0x9332,0x985F, 0x8AD6,0x9860, 0x502D,0x9861, 0x548C,0x9862, 0x8A71,0x9863, 0x6B6A,0x9864, 0x8CC4,0x9865, 0x8107,0x9866, 0x60D1,0x9867, 0x67A0,0x9868, 0x9DF2,0x9869, 0x4E99,0x986A, 0x4E98,0x986B, 0x9C10,0x986C, 0x8A6B,0x986D, 0x85C1,0x986E, 0x8568,0x986F, 0x6900,0x9870, 0x6E7E,0x9871, 0x7897,0x9872, 0x8155,0x989F, 0x5F0C,0x98A0, 0x4E10,0x98A1, 0x4E15,0x98A2, 0x4E2A,0x98A3, 0x4E31,0x98A4, 0x4E36,0x98A5, 0x4E3C,0x98A6, 0x4E3F,0x98A7, 0x4E42,0x98A8, 0x4E56,0x98A9, 0x4E58,0x98AA, 0x4E82,0x98AB, 0x4E85,0x98AC, 0x8C6B,0x98AD, 0x4E8A,0x98AE, 0x8212,0x98AF, 0x5F0D,0x98B0, 0x4E8E,0x98B1, 0x4E9E,0x98B2, 0x4E9F,0x98B3, 0x4EA0,0x98B4, 0x4EA2,0x98B5, 0x4EB0,0x98B6, 0x4EB3,0x98B7, 0x4EB6,0x98B8, 0x4ECE,0x98B9, 0x4ECD,0x98BA, 0x4EC4,0x98BB, 0x4EC6,0x98BC, 0x4EC2,0x98BD, 0x4ED7,0x98BE, 0x4EDE,0x98BF, 0x4EED,0x98C0, 0x4EDF,0x98C1, 0x4EF7,0x98C2, 0x4F09,0x98C3, 0x4F5A,0x98C4, 0x4F30,0x98C5, 0x4F5B,0x98C6, 0x4F5D,0x98C7, 0x4F57,0x98C8, 0x4F47,0x98C9, 0x4F76,0x98CA, 0x4F88,0x98CB, 0x4F8F,0x98CC, 0x4F98,0x98CD, 0x4F7B,0x98CE, 0x4F69,0x98CF, 0x4F70,0x98D0, 0x4F91,0x98D1, 0x4F6F,0x98D2, 0x4F86,0x98D3, 0x4F96,0x98D4, 0x5118,0x98D5, 0x4FD4,0x98D6, 0x4FDF,0x98D7, 0x4FCE,0x98D8, 0x4FD8,0x98D9, 0x4FDB,0x98DA, 0x4FD1,0x98DB, 0x4FDA,0x98DC, 0x4FD0,0x98DD, 0x4FE4,0x98DE, 0x4FE5,0x98DF, 0x501A,0x98E0, 0x5028,0x98E1, 0x5014,0x98E2, 0x502A,0x98E3, 0x5025,0x98E4, 0x5005,0x98E5, 0x4F1C,0x98E6, 0x4FF6,0x98E7, 0x5021,0x98E8, 0x5029,0x98E9, 0x502C,0x98EA, 0x4FFE,0x98EB, 0x4FEF,0x98EC, 0x5011,0x98ED, 0x5006,0x98EE, 0x5043,0x98EF, 0x5047,0x98F0, 0x6703,0x98F1, 0x5055,0x98F2, 0x5050,0x98F3, 0x5048,0x98F4, 0x505A,0x98F5, 0x5056,0x98F6, 0x506C,0x98F7, 0x5078,0x98F8, 0x5080,0x98F9, 0x509A,0x98FA, 0x5085,0x98FB, 0x50B4,0x98FC, 0x50B2,0x9940, 0x50C9,0x9941, 0x50CA,0x9942, 0x50B3,0x9943, 0x50C2,0x9944, 0x50D6,0x9945, 0x50DE,0x9946, 0x50E5,0x9947, 0x50ED,0x9948, 0x50E3,0x9949, 0x50EE,0x994A, 0x50F9,0x994B, 0x50F5,0x994C, 0x5109,0x994D, 0x5101,0x994E, 0x5102,0x994F, 0x5116,0x9950, 0x5115,0x9951, 0x5114,0x9952, 0x511A,0x9953, 0x5121,0x9954, 0x513A,0x9955, 0x5137,0x9956, 0x513C,0x9957, 0x513B,0x9958, 0x513F,0x9959, 0x5140,0x995A, 0x5152,0x995B, 0x514C,0x995C, 0x5154,0x995D, 0x5162,0x995E, 0x7AF8,0x995F, 0x5169,0x9960, 0x516A,0x9961, 0x516E,0x9962, 0x5180,0x9963, 0x5182,0x9964, 0x56D8,0x9965, 0x518C,0x9966, 0x5189,0x9967, 0x518F,0x9968, 0x5191,0x9969, 0x5193,0x996A, 0x5195,0x996B, 0x5196,0x996C, 0x51A4,0x996D, 0x51A6,0x996E, 0x51A2,0x996F, 0x51A9,0x9970, 0x51AA,0x9971, 0x51AB,0x9972, 0x51B3,0x9973, 0x51B1,0x9974, 0x51B2,0x9975, 0x51B0,0x9976, 0x51B5,0x9977, 0x51BD,0x9978, 0x51C5,0x9979, 0x51C9,0x997A, 0x51DB,0x997B, 0x51E0,0x997C, 0x8655,0x997D, 0x51E9,0x997E, 0x51ED,0x9980, 0x51F0,0x9981, 0x51F5,0x9982, 0x51FE,0x9983, 0x5204,0x9984, 0x520B,0x9985, 0x5214,0x9986, 0x520E,0x9987, 0x5227,0x9988, 0x522A,0x9989, 0x522E,0x998A, 0x5233,0x998B, 0x5239,0x998C, 0x524F,0x998D, 0x5244,0x998E, 0x524B,0x998F, 0x524C,0x9990, 0x525E,0x9991, 0x5254,0x9992, 0x526A,0x9993, 0x5274,0x9994, 0x5269,0x9995, 0x5273,0x9996, 0x527F,0x9997, 0x527D,0x9998, 0x528D,0x9999, 0x5294,0x999A, 0x5292,0x999B, 0x5271,0x999C, 0x5288,0x999D, 0x5291,0x999E, 0x8FA8,0x999F, 0x8FA7,0x99A0, 0x52AC,0x99A1, 0x52AD,0x99A2, 0x52BC,0x99A3, 0x52B5,0x99A4, 0x52C1,0x99A5, 0x52CD,0x99A6, 0x52D7,0x99A7, 0x52DE,0x99A8, 0x52E3,0x99A9, 0x52E6,0x99AA, 0x98ED,0x99AB, 0x52E0,0x99AC, 0x52F3,0x99AD, 0x52F5,0x99AE, 0x52F8,0x99AF, 0x52F9,0x99B0, 0x5306,0x99B1, 0x5308,0x99B2, 0x7538,0x99B3, 0x530D,0x99B4, 0x5310,0x99B5, 0x530F,0x99B6, 0x5315,0x99B7, 0x531A,0x99B8, 0x5323,0x99B9, 0x532F,0x99BA, 0x5331,0x99BB, 0x5333,0x99BC, 0x5338,0x99BD, 0x5340,0x99BE, 0x5346,0x99BF, 0x5345,0x99C0, 0x4E17,0x99C1, 0x5349,0x99C2, 0x534D,0x99C3, 0x51D6,0x99C4, 0x535E,0x99C5, 0x5369,0x99C6, 0x536E,0x99C7, 0x5918,0x99C8, 0x537B,0x99C9, 0x5377,0x99CA, 0x5382,0x99CB, 0x5396,0x99CC, 0x53A0,0x99CD, 0x53A6,0x99CE, 0x53A5,0x99CF, 0x53AE,0x99D0, 0x53B0,0x99D1, 0x53B6,0x99D2, 0x53C3,0x99D3, 0x7C12,0x99D4, 0x96D9,0x99D5, 0x53DF,0x99D6, 0x66FC,0x99D7, 0x71EE,0x99D8, 0x53EE,0x99D9, 0x53E8,0x99DA, 0x53ED,0x99DB, 0x53FA,0x99DC, 0x5401,0x99DD, 0x543D,0x99DE, 0x5440,0x99DF, 0x542C,0x99E0, 0x542D,0x99E1, 0x543C,0x99E2, 0x542E,0x99E3, 0x5436,0x99E4, 0x5429,0x99E5, 0x541D,0x99E6, 0x544E,0x99E7, 0x548F,0x99E8, 0x5475,0x99E9, 0x548E,0x99EA, 0x545F,0x99EB, 0x5471,0x99EC, 0x5477,0x99ED, 0x5470,0x99EE, 0x5492,0x99EF, 0x547B,0x99F0, 0x5480,0x99F1, 0x5476,0x99F2, 0x5484,0x99F3, 0x5490,0x99F4, 0x5486,0x99F5, 0x54C7,0x99F6, 0x54A2,0x99F7, 0x54B8,0x99F8, 0x54A5,0x99F9, 0x54AC,0x99FA, 0x54C4,0x99FB, 0x54C8,0x99FC, 0x54A8,0x9A40, 0x54AB,0x9A41, 0x54C2,0x9A42, 0x54A4,0x9A43, 0x54BE,0x9A44, 0x54BC,0x9A45, 0x54D8,0x9A46, 0x54E5,0x9A47, 0x54E6,0x9A48, 0x550F,0x9A49, 0x5514,0x9A4A, 0x54FD,0x9A4B, 0x54EE,0x9A4C, 0x54ED,0x9A4D, 0x54FA,0x9A4E, 0x54E2,0x9A4F, 0x5539,0x9A50, 0x5540,0x9A51, 0x5563,0x9A52, 0x554C,0x9A53, 0x552E,0x9A54, 0x555C,0x9A55, 0x5545,0x9A56, 0x5556,0x9A57, 0x5557,0x9A58, 0x5538,0x9A59, 0x5533,0x9A5A, 0x555D,0x9A5B, 0x5599,0x9A5C, 0x5580,0x9A5D, 0x54AF,0x9A5E, 0x558A,0x9A5F, 0x559F,0x9A60, 0x557B,0x9A61, 0x557E,0x9A62, 0x5598,0x9A63, 0x559E,0x9A64, 0x55AE,0x9A65, 0x557C,0x9A66, 0x5583,0x9A67, 0x55A9,0x9A68, 0x5587,0x9A69, 0x55A8,0x9A6A, 0x55DA,0x9A6B, 0x55C5,0x9A6C, 0x55DF,0x9A6D, 0x55C4,0x9A6E, 0x55DC,0x9A6F, 0x55E4,0x9A70, 0x55D4,0x9A71, 0x5614,0x9A72, 0x55F7,0x9A73, 0x5616,0x9A74, 0x55FE,0x9A75, 0x55FD,0x9A76, 0x561B,0x9A77, 0x55F9,0x9A78, 0x564E,0x9A79, 0x5650,0x9A7A, 0x71DF,0x9A7B, 0x5634,0x9A7C, 0x5636,0x9A7D, 0x5632,0x9A7E, 0x5638,0x9A80, 0x566B,0x9A81, 0x5664,0x9A82, 0x562F,0x9A83, 0x566C,0x9A84, 0x566A,0x9A85, 0x5686,0x9A86, 0x5680,0x9A87, 0x568A,0x9A88, 0x56A0,0x9A89, 0x5694,0x9A8A, 0x568F,0x9A8B, 0x56A5,0x9A8C, 0x56AE,0x9A8D, 0x56B6,0x9A8E, 0x56B4,0x9A8F, 0x56C2,0x9A90, 0x56BC,0x9A91, 0x56C1,0x9A92, 0x56C3,0x9A93, 0x56C0,0x9A94, 0x56C8,0x9A95, 0x56CE,0x9A96, 0x56D1,0x9A97, 0x56D3,0x9A98, 0x56D7,0x9A99, 0x56EE,0x9A9A, 0x56F9,0x9A9B, 0x5700,0x9A9C, 0x56FF,0x9A9D, 0x5704,0x9A9E, 0x5709,0x9A9F, 0x5708,0x9AA0, 0x570B,0x9AA1, 0x570D,0x9AA2, 0x5713,0x9AA3, 0x5718,0x9AA4, 0x5716,0x9AA5, 0x55C7,0x9AA6, 0x571C,0x9AA7, 0x5726,0x9AA8, 0x5737,0x9AA9, 0x5738,0x9AAA, 0x574E,0x9AAB, 0x573B,0x9AAC, 0x5740,0x9AAD, 0x574F,0x9AAE, 0x5769,0x9AAF, 0x57C0,0x9AB0, 0x5788,0x9AB1, 0x5761,0x9AB2, 0x577F,0x9AB3, 0x5789,0x9AB4, 0x5793,0x9AB5, 0x57A0,0x9AB6, 0x57B3,0x9AB7, 0x57A4,0x9AB8, 0x57AA,0x9AB9, 0x57B0,0x9ABA, 0x57C3,0x9ABB, 0x57C6,0x9ABC, 0x57D4,0x9ABD, 0x57D2,0x9ABE, 0x57D3,0x9ABF, 0x580A,0x9AC0, 0x57D6,0x9AC1, 0x57E3,0x9AC2, 0x580B,0x9AC3, 0x5819,0x9AC4, 0x581D,0x9AC5, 0x5872,0x9AC6, 0x5821,0x9AC7, 0x5862,0x9AC8, 0x584B,0x9AC9, 0x5870,0x9ACA, 0x6BC0,0x9ACB, 0x5852,0x9ACC, 0x583D,0x9ACD, 0x5879,0x9ACE, 0x5885,0x9ACF, 0x58B9,0x9AD0, 0x589F,0x9AD1, 0x58AB,0x9AD2, 0x58BA,0x9AD3, 0x58DE,0x9AD4, 0x58BB,0x9AD5, 0x58B8,0x9AD6, 0x58AE,0x9AD7, 0x58C5,0x9AD8, 0x58D3,0x9AD9, 0x58D1,0x9ADA, 0x58D7,0x9ADB, 0x58D9,0x9ADC, 0x58D8,0x9ADD, 0x58E5,0x9ADE, 0x58DC,0x9ADF, 0x58E4,0x9AE0, 0x58DF,0x9AE1, 0x58EF,0x9AE2, 0x58FA,0x9AE3, 0x58F9,0x9AE4, 0x58FB,0x9AE5, 0x58FC,0x9AE6, 0x58FD,0x9AE7, 0x5902,0x9AE8, 0x590A,0x9AE9, 0x5910,0x9AEA, 0x591B,0x9AEB, 0x68A6,0x9AEC, 0x5925,0x9AED, 0x592C,0x9AEE, 0x592D,0x9AEF, 0x5932,0x9AF0, 0x5938,0x9AF1, 0x593E,0x9AF2, 0x7AD2,0x9AF3, 0x5955,0x9AF4, 0x5950,0x9AF5, 0x594E,0x9AF6, 0x595A,0x9AF7, 0x5958,0x9AF8, 0x5962,0x9AF9, 0x5960,0x9AFA, 0x5967,0x9AFB, 0x596C,0x9AFC, 0x5969,0x9B40, 0x5978,0x9B41, 0x5981,0x9B42, 0x599D,0x9B43, 0x4F5E,0x9B44, 0x4FAB,0x9B45, 0x59A3,0x9B46, 0x59B2,0x9B47, 0x59C6,0x9B48, 0x59E8,0x9B49, 0x59DC,0x9B4A, 0x598D,0x9B4B, 0x59D9,0x9B4C, 0x59DA,0x9B4D, 0x5A25,0x9B4E, 0x5A1F,0x9B4F, 0x5A11,0x9B50, 0x5A1C,0x9B51, 0x5A09,0x9B52, 0x5A1A,0x9B53, 0x5A40,0x9B54, 0x5A6C,0x9B55, 0x5A49,0x9B56, 0x5A35,0x9B57, 0x5A36,0x9B58, 0x5A62,0x9B59, 0x5A6A,0x9B5A, 0x5A9A,0x9B5B, 0x5ABC,0x9B5C, 0x5ABE,0x9B5D, 0x5ACB,0x9B5E, 0x5AC2,0x9B5F, 0x5ABD,0x9B60, 0x5AE3,0x9B61, 0x5AD7,0x9B62, 0x5AE6,0x9B63, 0x5AE9,0x9B64, 0x5AD6,0x9B65, 0x5AFA,0x9B66, 0x5AFB,0x9B67, 0x5B0C,0x9B68, 0x5B0B,0x9B69, 0x5B16,0x9B6A, 0x5B32,0x9B6B, 0x5AD0,0x9B6C, 0x5B2A,0x9B6D, 0x5B36,0x9B6E, 0x5B3E,0x9B6F, 0x5B43,0x9B70, 0x5B45,0x9B71, 0x5B40,0x9B72, 0x5B51,0x9B73, 0x5B55,0x9B74, 0x5B5A,0x9B75, 0x5B5B,0x9B76, 0x5B65,0x9B77, 0x5B69,0x9B78, 0x5B70,0x9B79, 0x5B73,0x9B7A, 0x5B75,0x9B7B, 0x5B78,0x9B7C, 0x6588,0x9B7D, 0x5B7A,0x9B7E, 0x5B80,0x9B80, 0x5B83,0x9B81, 0x5BA6,0x9B82, 0x5BB8,0x9B83, 0x5BC3,0x9B84, 0x5BC7,0x9B85, 0x5BC9,0x9B86, 0x5BD4,0x9B87, 0x5BD0,0x9B88, 0x5BE4,0x9B89, 0x5BE6,0x9B8A, 0x5BE2,0x9B8B, 0x5BDE,0x9B8C, 0x5BE5,0x9B8D, 0x5BEB,0x9B8E, 0x5BF0,0x9B8F, 0x5BF6,0x9B90, 0x5BF3,0x9B91, 0x5C05,0x9B92, 0x5C07,0x9B93, 0x5C08,0x9B94, 0x5C0D,0x9B95, 0x5C13,0x9B96, 0x5C20,0x9B97, 0x5C22,0x9B98, 0x5C28,0x9B99, 0x5C38,0x9B9A, 0x5C39,0x9B9B, 0x5C41,0x9B9C, 0x5C46,0x9B9D, 0x5C4E,0x9B9E, 0x5C53,0x9B9F, 0x5C50,0x9BA0, 0x5C4F,0x9BA1, 0x5B71,0x9BA2, 0x5C6C,0x9BA3, 0x5C6E,0x9BA4, 0x4E62,0x9BA5, 0x5C76,0x9BA6, 0x5C79,0x9BA7, 0x5C8C,0x9BA8, 0x5C91,0x9BA9, 0x5C94,0x9BAA, 0x599B,0x9BAB, 0x5CAB,0x9BAC, 0x5CBB,0x9BAD, 0x5CB6,0x9BAE, 0x5CBC,0x9BAF, 0x5CB7,0x9BB0, 0x5CC5,0x9BB1, 0x5CBE,0x9BB2, 0x5CC7,0x9BB3, 0x5CD9,0x9BB4, 0x5CE9,0x9BB5, 0x5CFD,0x9BB6, 0x5CFA,0x9BB7, 0x5CED,0x9BB8, 0x5D8C,0x9BB9, 0x5CEA,0x9BBA, 0x5D0B,0x9BBB, 0x5D15,0x9BBC, 0x5D17,0x9BBD, 0x5D5C,0x9BBE, 0x5D1F,0x9BBF, 0x5D1B,0x9BC0, 0x5D11,0x9BC1, 0x5D14,0x9BC2, 0x5D22,0x9BC3, 0x5D1A,0x9BC4, 0x5D19,0x9BC5, 0x5D18,0x9BC6, 0x5D4C,0x9BC7, 0x5D52,0x9BC8, 0x5D4E,0x9BC9, 0x5D4B,0x9BCA, 0x5D6C,0x9BCB, 0x5D73,0x9BCC, 0x5D76,0x9BCD, 0x5D87,0x9BCE, 0x5D84,0x9BCF, 0x5D82,0x9BD0, 0x5DA2,0x9BD1, 0x5D9D,0x9BD2, 0x5DAC,0x9BD3, 0x5DAE,0x9BD4, 0x5DBD,0x9BD5, 0x5D90,0x9BD6, 0x5DB7,0x9BD7, 0x5DBC,0x9BD8, 0x5DC9,0x9BD9, 0x5DCD,0x9BDA, 0x5DD3,0x9BDB, 0x5DD2,0x9BDC, 0x5DD6,0x9BDD, 0x5DDB,0x9BDE, 0x5DEB,0x9BDF, 0x5DF2,0x9BE0, 0x5DF5,0x9BE1, 0x5E0B,0x9BE2, 0x5E1A,0x9BE3, 0x5E19,0x9BE4, 0x5E11,0x9BE5, 0x5E1B,0x9BE6, 0x5E36,0x9BE7, 0x5E37,0x9BE8, 0x5E44,0x9BE9, 0x5E43,0x9BEA, 0x5E40,0x9BEB, 0x5E4E,0x9BEC, 0x5E57,0x9BED, 0x5E54,0x9BEE, 0x5E5F,0x9BEF, 0x5E62,0x9BF0, 0x5E64,0x9BF1, 0x5E47,0x9BF2, 0x5E75,0x9BF3, 0x5E76,0x9BF4, 0x5E7A,0x9BF5, 0x9EBC,0x9BF6, 0x5E7F,0x9BF7, 0x5EA0,0x9BF8, 0x5EC1,0x9BF9, 0x5EC2,0x9BFA, 0x5EC8,0x9BFB, 0x5ED0,0x9BFC, 0x5ECF,0x9C40, 0x5ED6,0x9C41, 0x5EE3,0x9C42, 0x5EDD,0x9C43, 0x5EDA,0x9C44, 0x5EDB,0x9C45, 0x5EE2,0x9C46, 0x5EE1,0x9C47, 0x5EE8,0x9C48, 0x5EE9,0x9C49, 0x5EEC,0x9C4A, 0x5EF1,0x9C4B, 0x5EF3,0x9C4C, 0x5EF0,0x9C4D, 0x5EF4,0x9C4E, 0x5EF8,0x9C4F, 0x5EFE,0x9C50, 0x5F03,0x9C51, 0x5F09,0x9C52, 0x5F5D,0x9C53, 0x5F5C,0x9C54, 0x5F0B,0x9C55, 0x5F11,0x9C56, 0x5F16,0x9C57, 0x5F29,0x9C58, 0x5F2D,0x9C59, 0x5F38,0x9C5A, 0x5F41,0x9C5B, 0x5F48,0x9C5C, 0x5F4C,0x9C5D, 0x5F4E,0x9C5E, 0x5F2F,0x9C5F, 0x5F51,0x9C60, 0x5F56,0x9C61, 0x5F57,0x9C62, 0x5F59,0x9C63, 0x5F61,0x9C64, 0x5F6D,0x9C65, 0x5F73,0x9C66, 0x5F77,0x9C67, 0x5F83,0x9C68, 0x5F82,0x9C69, 0x5F7F,0x9C6A, 0x5F8A,0x9C6B, 0x5F88,0x9C6C, 0x5F91,0x9C6D, 0x5F87,0x9C6E, 0x5F9E,0x9C6F, 0x5F99,0x9C70, 0x5F98,0x9C71, 0x5FA0,0x9C72, 0x5FA8,0x9C73, 0x5FAD,0x9C74, 0x5FBC,0x9C75, 0x5FD6,0x9C76, 0x5FFB,0x9C77, 0x5FE4,0x9C78, 0x5FF8,0x9C79, 0x5FF1,0x9C7A, 0x5FDD,0x9C7B, 0x60B3,0x9C7C, 0x5FFF,0x9C7D, 0x6021,0x9C7E, 0x6060,0x9C80, 0x6019,0x9C81, 0x6010,0x9C82, 0x6029,0x9C83, 0x600E,0x9C84, 0x6031,0x9C85, 0x601B,0x9C86, 0x6015,0x9C87, 0x602B,0x9C88, 0x6026,0x9C89, 0x600F,0x9C8A, 0x603A,0x9C8B, 0x605A,0x9C8C, 0x6041,0x9C8D, 0x606A,0x9C8E, 0x6077,0x9C8F, 0x605F,0x9C90, 0x604A,0x9C91, 0x6046,0x9C92, 0x604D,0x9C93, 0x6063,0x9C94, 0x6043,0x9C95, 0x6064,0x9C96, 0x6042,0x9C97, 0x606C,0x9C98, 0x606B,0x9C99, 0x6059,0x9C9A, 0x6081,0x9C9B, 0x608D,0x9C9C, 0x60E7,0x9C9D, 0x6083,0x9C9E, 0x609A,0x9C9F, 0x6084,0x9CA0, 0x609B,0x9CA1, 0x6096,0x9CA2, 0x6097,0x9CA3, 0x6092,0x9CA4, 0x60A7,0x9CA5, 0x608B,0x9CA6, 0x60E1,0x9CA7, 0x60B8,0x9CA8, 0x60E0,0x9CA9, 0x60D3,0x9CAA, 0x60B4,0x9CAB, 0x5FF0,0x9CAC, 0x60BD,0x9CAD, 0x60C6,0x9CAE, 0x60B5,0x9CAF, 0x60D8,0x9CB0, 0x614D,0x9CB1, 0x6115,0x9CB2, 0x6106,0x9CB3, 0x60F6,0x9CB4, 0x60F7,0x9CB5, 0x6100,0x9CB6, 0x60F4,0x9CB7, 0x60FA,0x9CB8, 0x6103,0x9CB9, 0x6121,0x9CBA, 0x60FB,0x9CBB, 0x60F1,0x9CBC, 0x610D,0x9CBD, 0x610E,0x9CBE, 0x6147,0x9CBF, 0x613E,0x9CC0, 0x6128,0x9CC1, 0x6127,0x9CC2, 0x614A,0x9CC3, 0x613F,0x9CC4, 0x613C,0x9CC5, 0x612C,0x9CC6, 0x6134,0x9CC7, 0x613D,0x9CC8, 0x6142,0x9CC9, 0x6144,0x9CCA, 0x6173,0x9CCB, 0x6177,0x9CCC, 0x6158,0x9CCD, 0x6159,0x9CCE, 0x615A,0x9CCF, 0x616B,0x9CD0, 0x6174,0x9CD1, 0x616F,0x9CD2, 0x6165,0x9CD3, 0x6171,0x9CD4, 0x615F,0x9CD5, 0x615D,0x9CD6, 0x6153,0x9CD7, 0x6175,0x9CD8, 0x6199,0x9CD9, 0x6196,0x9CDA, 0x6187,0x9CDB, 0x61AC,0x9CDC, 0x6194,0x9CDD, 0x619A,0x9CDE, 0x618A,0x9CDF, 0x6191,0x9CE0, 0x61AB,0x9CE1, 0x61AE,0x9CE2, 0x61CC,0x9CE3, 0x61CA,0x9CE4, 0x61C9,0x9CE5, 0x61F7,0x9CE6, 0x61C8,0x9CE7, 0x61C3,0x9CE8, 0x61C6,0x9CE9, 0x61BA,0x9CEA, 0x61CB,0x9CEB, 0x7F79,0x9CEC, 0x61CD,0x9CED, 0x61E6,0x9CEE, 0x61E3,0x9CEF, 0x61F6,0x9CF0, 0x61FA,0x9CF1, 0x61F4,0x9CF2, 0x61FF,0x9CF3, 0x61FD,0x9CF4, 0x61FC,0x9CF5, 0x61FE,0x9CF6, 0x6200,0x9CF7, 0x6208,0x9CF8, 0x6209,0x9CF9, 0x620D,0x9CFA, 0x620C,0x9CFB, 0x6214,0x9CFC, 0x621B,0x9D40, 0x621E,0x9D41, 0x6221,0x9D42, 0x622A,0x9D43, 0x622E,0x9D44, 0x6230,0x9D45, 0x6232,0x9D46, 0x6233,0x9D47, 0x6241,0x9D48, 0x624E,0x9D49, 0x625E,0x9D4A, 0x6263,0x9D4B, 0x625B,0x9D4C, 0x6260,0x9D4D, 0x6268,0x9D4E, 0x627C,0x9D4F, 0x6282,0x9D50, 0x6289,0x9D51, 0x627E,0x9D52, 0x6292,0x9D53, 0x6293,0x9D54, 0x6296,0x9D55, 0x62D4,0x9D56, 0x6283,0x9D57, 0x6294,0x9D58, 0x62D7,0x9D59, 0x62D1,0x9D5A, 0x62BB,0x9D5B, 0x62CF,0x9D5C, 0x62FF,0x9D5D, 0x62C6,0x9D5E, 0x64D4,0x9D5F, 0x62C8,0x9D60, 0x62DC,0x9D61, 0x62CC,0x9D62, 0x62CA,0x9D63, 0x62C2,0x9D64, 0x62C7,0x9D65, 0x629B,0x9D66, 0x62C9,0x9D67, 0x630C,0x9D68, 0x62EE,0x9D69, 0x62F1,0x9D6A, 0x6327,0x9D6B, 0x6302,0x9D6C, 0x6308,0x9D6D, 0x62EF,0x9D6E, 0x62F5,0x9D6F, 0x6350,0x9D70, 0x633E,0x9D71, 0x634D,0x9D72, 0x641C,0x9D73, 0x634F,0x9D74, 0x6396,0x9D75, 0x638E,0x9D76, 0x6380,0x9D77, 0x63AB,0x9D78, 0x6376,0x9D79, 0x63A3,0x9D7A, 0x638F,0x9D7B, 0x6389,0x9D7C, 0x639F,0x9D7D, 0x63B5,0x9D7E, 0x636B,0x9D80, 0x6369,0x9D81, 0x63BE,0x9D82, 0x63E9,0x9D83, 0x63C0,0x9D84, 0x63C6,0x9D85, 0x63E3,0x9D86, 0x63C9,0x9D87, 0x63D2,0x9D88, 0x63F6,0x9D89, 0x63C4,0x9D8A, 0x6416,0x9D8B, 0x6434,0x9D8C, 0x6406,0x9D8D, 0x6413,0x9D8E, 0x6426,0x9D8F, 0x6436,0x9D90, 0x651D,0x9D91, 0x6417,0x9D92, 0x6428,0x9D93, 0x640F,0x9D94, 0x6467,0x9D95, 0x646F,0x9D96, 0x6476,0x9D97, 0x644E,0x9D98, 0x652A,0x9D99, 0x6495,0x9D9A, 0x6493,0x9D9B, 0x64A5,0x9D9C, 0x64A9,0x9D9D, 0x6488,0x9D9E, 0x64BC,0x9D9F, 0x64DA,0x9DA0, 0x64D2,0x9DA1, 0x64C5,0x9DA2, 0x64C7,0x9DA3, 0x64BB,0x9DA4, 0x64D8,0x9DA5, 0x64C2,0x9DA6, 0x64F1,0x9DA7, 0x64E7,0x9DA8, 0x8209,0x9DA9, 0x64E0,0x9DAA, 0x64E1,0x9DAB, 0x62AC,0x9DAC, 0x64E3,0x9DAD, 0x64EF,0x9DAE, 0x652C,0x9DAF, 0x64F6,0x9DB0, 0x64F4,0x9DB1, 0x64F2,0x9DB2, 0x64FA,0x9DB3, 0x6500,0x9DB4, 0x64FD,0x9DB5, 0x6518,0x9DB6, 0x651C,0x9DB7, 0x6505,0x9DB8, 0x6524,0x9DB9, 0x6523,0x9DBA, 0x652B,0x9DBB, 0x6534,0x9DBC, 0x6535,0x9DBD, 0x6537,0x9DBE, 0x6536,0x9DBF, 0x6538,0x9DC0, 0x754B,0x9DC1, 0x6548,0x9DC2, 0x6556,0x9DC3, 0x6555,0x9DC4, 0x654D,0x9DC5, 0x6558,0x9DC6, 0x655E,0x9DC7, 0x655D,0x9DC8, 0x6572,0x9DC9, 0x6578,0x9DCA, 0x6582,0x9DCB, 0x6583,0x9DCC, 0x8B8A,0x9DCD, 0x659B,0x9DCE, 0x659F,0x9DCF, 0x65AB,0x9DD0, 0x65B7,0x9DD1, 0x65C3,0x9DD2, 0x65C6,0x9DD3, 0x65C1,0x9DD4, 0x65C4,0x9DD5, 0x65CC,0x9DD6, 0x65D2,0x9DD7, 0x65DB,0x9DD8, 0x65D9,0x9DD9, 0x65E0,0x9DDA, 0x65E1,0x9DDB, 0x65F1,0x9DDC, 0x6772,0x9DDD, 0x660A,0x9DDE, 0x6603,0x9DDF, 0x65FB,0x9DE0, 0x6773,0x9DE1, 0x6635,0x9DE2, 0x6636,0x9DE3, 0x6634,0x9DE4, 0x661C,0x9DE5, 0x664F,0x9DE6, 0x6644,0x9DE7, 0x6649,0x9DE8, 0x6641,0x9DE9, 0x665E,0x9DEA, 0x665D,0x9DEB, 0x6664,0x9DEC, 0x6667,0x9DED, 0x6668,0x9DEE, 0x665F,0x9DEF, 0x6662,0x9DF0, 0x6670,0x9DF1, 0x6683,0x9DF2, 0x6688,0x9DF3, 0x668E,0x9DF4, 0x6689,0x9DF5, 0x6684,0x9DF6, 0x6698,0x9DF7, 0x669D,0x9DF8, 0x66C1,0x9DF9, 0x66B9,0x9DFA, 0x66C9,0x9DFB, 0x66BE,0x9DFC, 0x66BC,0x9E40, 0x66C4,0x9E41, 0x66B8,0x9E42, 0x66D6,0x9E43, 0x66DA,0x9E44, 0x66E0,0x9E45, 0x663F,0x9E46, 0x66E6,0x9E47, 0x66E9,0x9E48, 0x66F0,0x9E49, 0x66F5,0x9E4A, 0x66F7,0x9E4B, 0x670F,0x9E4C, 0x6716,0x9E4D, 0x671E,0x9E4E, 0x6726,0x9E4F, 0x6727,0x9E50, 0x9738,0x9E51, 0x672E,0x9E52, 0x673F,0x9E53, 0x6736,0x9E54, 0x6741,0x9E55, 0x6738,0x9E56, 0x6737,0x9E57, 0x6746,0x9E58, 0x675E,0x9E59, 0x6760,0x9E5A, 0x6759,0x9E5B, 0x6763,0x9E5C, 0x6764,0x9E5D, 0x6789,0x9E5E, 0x6770,0x9E5F, 0x67A9,0x9E60, 0x677C,0x9E61, 0x676A,0x9E62, 0x678C,0x9E63, 0x678B,0x9E64, 0x67A6,0x9E65, 0x67A1,0x9E66, 0x6785,0x9E67, 0x67B7,0x9E68, 0x67EF,0x9E69, 0x67B4,0x9E6A, 0x67EC,0x9E6B, 0x67B3,0x9E6C, 0x67E9,0x9E6D, 0x67B8,0x9E6E, 0x67E4,0x9E6F, 0x67DE,0x9E70, 0x67DD,0x9E71, 0x67E2,0x9E72, 0x67EE,0x9E73, 0x67B9,0x9E74, 0x67CE,0x9E75, 0x67C6,0x9E76, 0x67E7,0x9E77, 0x6A9C,0x9E78, 0x681E,0x9E79, 0x6846,0x9E7A, 0x6829,0x9E7B, 0x6840,0x9E7C, 0x684D,0x9E7D, 0x6832,0x9E7E, 0x684E,0x9E80, 0x68B3,0x9E81, 0x682B,0x9E82, 0x6859,0x9E83, 0x6863,0x9E84, 0x6877,0x9E85, 0x687F,0x9E86, 0x689F,0x9E87, 0x688F,0x9E88, 0x68AD,0x9E89, 0x6894,0x9E8A, 0x689D,0x9E8B, 0x689B,0x9E8C, 0x6883,0x9E8D, 0x6AAE,0x9E8E, 0x68B9,0x9E8F, 0x6874,0x9E90, 0x68B5,0x9E91, 0x68A0,0x9E92, 0x68BA,0x9E93, 0x690F,0x9E94, 0x688D,0x9E95, 0x687E,0x9E96, 0x6901,0x9E97, 0x68CA,0x9E98, 0x6908,0x9E99, 0x68D8,0x9E9A, 0x6922,0x9E9B, 0x6926,0x9E9C, 0x68E1,0x9E9D, 0x690C,0x9E9E, 0x68CD,0x9E9F, 0x68D4,0x9EA0, 0x68E7,0x9EA1, 0x68D5,0x9EA2, 0x6936,0x9EA3, 0x6912,0x9EA4, 0x6904,0x9EA5, 0x68D7,0x9EA6, 0x68E3,0x9EA7, 0x6925,0x9EA8, 0x68F9,0x9EA9, 0x68E0,0x9EAA, 0x68EF,0x9EAB, 0x6928,0x9EAC, 0x692A,0x9EAD, 0x691A,0x9EAE, 0x6923,0x9EAF, 0x6921,0x9EB0, 0x68C6,0x9EB1, 0x6979,0x9EB2, 0x6977,0x9EB3, 0x695C,0x9EB4, 0x6978,0x9EB5, 0x696B,0x9EB6, 0x6954,0x9EB7, 0x697E,0x9EB8, 0x696E,0x9EB9, 0x6939,0x9EBA, 0x6974,0x9EBB, 0x693D,0x9EBC, 0x6959,0x9EBD, 0x6930,0x9EBE, 0x6961,0x9EBF, 0x695E,0x9EC0, 0x695D,0x9EC1, 0x6981,0x9EC2, 0x696A,0x9EC3, 0x69B2,0x9EC4, 0x69AE,0x9EC5, 0x69D0,0x9EC6, 0x69BF,0x9EC7, 0x69C1,0x9EC8, 0x69D3,0x9EC9, 0x69BE,0x9ECA, 0x69CE,0x9ECB, 0x5BE8,0x9ECC, 0x69CA,0x9ECD, 0x69DD,0x9ECE, 0x69BB,0x9ECF, 0x69C3,0x9ED0, 0x69A7,0x9ED1, 0x6A2E,0x9ED2, 0x6991,0x9ED3, 0x69A0,0x9ED4, 0x699C,0x9ED5, 0x6995,0x9ED6, 0x69B4,0x9ED7, 0x69DE,0x9ED8, 0x69E8,0x9ED9, 0x6A02,0x9EDA, 0x6A1B,0x9EDB, 0x69FF,0x9EDC, 0x6B0A,0x9EDD, 0x69F9,0x9EDE, 0x69F2,0x9EDF, 0x69E7,0x9EE0, 0x6A05,0x9EE1, 0x69B1,0x9EE2, 0x6A1E,0x9EE3, 0x69ED,0x9EE4, 0x6A14,0x9EE5, 0x69EB,0x9EE6, 0x6A0A,0x9EE7, 0x6A12,0x9EE8, 0x6AC1,0x9EE9, 0x6A23,0x9EEA, 0x6A13,0x9EEB, 0x6A44,0x9EEC, 0x6A0C,0x9EED, 0x6A72,0x9EEE, 0x6A36,0x9EEF, 0x6A78,0x9EF0, 0x6A47,0x9EF1, 0x6A62,0x9EF2, 0x6A59,0x9EF3, 0x6A66,0x9EF4, 0x6A48,0x9EF5, 0x6A38,0x9EF6, 0x6A22,0x9EF7, 0x6A90,0x9EF8, 0x6A8D,0x9EF9, 0x6AA0,0x9EFA, 0x6A84,0x9EFB, 0x6AA2,0x9EFC, 0x6AA3,0x9F40, 0x6A97,0x9F41, 0x8617,0x9F42, 0x6ABB,0x9F43, 0x6AC3,0x9F44, 0x6AC2,0x9F45, 0x6AB8,0x9F46, 0x6AB3,0x9F47, 0x6AAC,0x9F48, 0x6ADE,0x9F49, 0x6AD1,0x9F4A, 0x6ADF,0x9F4B, 0x6AAA,0x9F4C, 0x6ADA,0x9F4D, 0x6AEA,0x9F4E, 0x6AFB,0x9F4F, 0x6B05,0x9F50, 0x8616,0x9F51, 0x6AFA,0x9F52, 0x6B12,0x9F53, 0x6B16,0x9F54, 0x9B31,0x9F55, 0x6B1F,0x9F56, 0x6B38,0x9F57, 0x6B37,0x9F58, 0x76DC,0x9F59, 0x6B39,0x9F5A, 0x98EE,0x9F5B, 0x6B47,0x9F5C, 0x6B43,0x9F5D, 0x6B49,0x9F5E, 0x6B50,0x9F5F, 0x6B59,0x9F60, 0x6B54,0x9F61, 0x6B5B,0x9F62, 0x6B5F,0x9F63, 0x6B61,0x9F64, 0x6B78,0x9F65, 0x6B79,0x9F66, 0x6B7F,0x9F67, 0x6B80,0x9F68, 0x6B84,0x9F69, 0x6B83,0x9F6A, 0x6B8D,0x9F6B, 0x6B98,0x9F6C, 0x6B95,0x9F6D, 0x6B9E,0x9F6E, 0x6BA4,0x9F6F, 0x6BAA,0x9F70, 0x6BAB,0x9F71, 0x6BAF,0x9F72, 0x6BB2,0x9F73, 0x6BB1,0x9F74, 0x6BB3,0x9F75, 0x6BB7,0x9F76, 0x6BBC,0x9F77, 0x6BC6,0x9F78, 0x6BCB,0x9F79, 0x6BD3,0x9F7A, 0x6BDF,0x9F7B, 0x6BEC,0x9F7C, 0x6BEB,0x9F7D, 0x6BF3,0x9F7E, 0x6BEF,0x9F80, 0x9EBE,0x9F81, 0x6C08,0x9F82, 0x6C13,0x9F83, 0x6C14,0x9F84, 0x6C1B,0x9F85, 0x6C24,0x9F86, 0x6C23,0x9F87, 0x6C5E,0x9F88, 0x6C55,0x9F89, 0x6C62,0x9F8A, 0x6C6A,0x9F8B, 0x6C82,0x9F8C, 0x6C8D,0x9F8D, 0x6C9A,0x9F8E, 0x6C81,0x9F8F, 0x6C9B,0x9F90, 0x6C7E,0x9F91, 0x6C68,0x9F92, 0x6C73,0x9F93, 0x6C92,0x9F94, 0x6C90,0x9F95, 0x6CC4,0x9F96, 0x6CF1,0x9F97, 0x6CD3,0x9F98, 0x6CBD,0x9F99, 0x6CD7,0x9F9A, 0x6CC5,0x9F9B, 0x6CDD,0x9F9C, 0x6CAE,0x9F9D, 0x6CB1,0x9F9E, 0x6CBE,0x9F9F, 0x6CBA,0x9FA0, 0x6CDB,0x9FA1, 0x6CEF,0x9FA2, 0x6CD9,0x9FA3, 0x6CEA,0x9FA4, 0x6D1F,0x9FA5, 0x884D,0x9FA6, 0x6D36,0x9FA7, 0x6D2B,0x9FA8, 0x6D3D,0x9FA9, 0x6D38,0x9FAA, 0x6D19,0x9FAB, 0x6D35,0x9FAC, 0x6D33,0x9FAD, 0x6D12,0x9FAE, 0x6D0C,0x9FAF, 0x6D63,0x9FB0, 0x6D93,0x9FB1, 0x6D64,0x9FB2, 0x6D5A,0x9FB3, 0x6D79,0x9FB4, 0x6D59,0x9FB5, 0x6D8E,0x9FB6, 0x6D95,0x9FB7, 0x6FE4,0x9FB8, 0x6D85,0x9FB9, 0x6DF9,0x9FBA, 0x6E15,0x9FBB, 0x6E0A,0x9FBC, 0x6DB5,0x9FBD, 0x6DC7,0x9FBE, 0x6DE6,0x9FBF, 0x6DB8,0x9FC0, 0x6DC6,0x9FC1, 0x6DEC,0x9FC2, 0x6DDE,0x9FC3, 0x6DCC,0x9FC4, 0x6DE8,0x9FC5, 0x6DD2,0x9FC6, 0x6DC5,0x9FC7, 0x6DFA,0x9FC8, 0x6DD9,0x9FC9, 0x6DE4,0x9FCA, 0x6DD5,0x9FCB, 0x6DEA,0x9FCC, 0x6DEE,0x9FCD, 0x6E2D,0x9FCE, 0x6E6E,0x9FCF, 0x6E2E,0x9FD0, 0x6E19,0x9FD1, 0x6E72,0x9FD2, 0x6E5F,0x9FD3, 0x6E3E,0x9FD4, 0x6E23,0x9FD5, 0x6E6B,0x9FD6, 0x6E2B,0x9FD7, 0x6E76,0x9FD8, 0x6E4D,0x9FD9, 0x6E1F,0x9FDA, 0x6E43,0x9FDB, 0x6E3A,0x9FDC, 0x6E4E,0x9FDD, 0x6E24,0x9FDE, 0x6EFF,0x9FDF, 0x6E1D,0x9FE0, 0x6E38,0x9FE1, 0x6E82,0x9FE2, 0x6EAA,0x9FE3, 0x6E98,0x9FE4, 0x6EC9,0x9FE5, 0x6EB7,0x9FE6, 0x6ED3,0x9FE7, 0x6EBD,0x9FE8, 0x6EAF,0x9FE9, 0x6EC4,0x9FEA, 0x6EB2,0x9FEB, 0x6ED4,0x9FEC, 0x6ED5,0x9FED, 0x6E8F,0x9FEE, 0x6EA5,0x9FEF, 0x6EC2,0x9FF0, 0x6E9F,0x9FF1, 0x6F41,0x9FF2, 0x6F11,0x9FF3, 0x704C,0x9FF4, 0x6EEC,0x9FF5, 0x6EF8,0x9FF6, 0x6EFE,0x9FF7, 0x6F3F,0x9FF8, 0x6EF2,0x9FF9, 0x6F31,0x9FFA, 0x6EEF,0x9FFB, 0x6F32,0x9FFC, 0x6ECC,0xE040, 0x6F3E,0xE041, 0x6F13,0xE042, 0x6EF7,0xE043, 0x6F86,0xE044, 0x6F7A,0xE045, 0x6F78,0xE046, 0x6F81,0xE047, 0x6F80,0xE048, 0x6F6F,0xE049, 0x6F5B,0xE04A, 0x6FF3,0xE04B, 0x6F6D,0xE04C, 0x6F82,0xE04D, 0x6F7C,0xE04E, 0x6F58,0xE04F, 0x6F8E,0xE050, 0x6F91,0xE051, 0x6FC2,0xE052, 0x6F66,0xE053, 0x6FB3,0xE054, 0x6FA3,0xE055, 0x6FA1,0xE056, 0x6FA4,0xE057, 0x6FB9,0xE058, 0x6FC6,0xE059, 0x6FAA,0xE05A, 0x6FDF,0xE05B, 0x6FD5,0xE05C, 0x6FEC,0xE05D, 0x6FD4,0xE05E, 0x6FD8,0xE05F, 0x6FF1,0xE060, 0x6FEE,0xE061, 0x6FDB,0xE062, 0x7009,0xE063, 0x700B,0xE064, 0x6FFA,0xE065, 0x7011,0xE066, 0x7001,0xE067, 0x700F,0xE068, 0x6FFE,0xE069, 0x701B,0xE06A, 0x701A,0xE06B, 0x6F74,0xE06C, 0x701D,0xE06D, 0x7018,0xE06E, 0x701F,0xE06F, 0x7030,0xE070, 0x703E,0xE071, 0x7032,0xE072, 0x7051,0xE073, 0x7063,0xE074, 0x7099,0xE075, 0x7092,0xE076, 0x70AF,0xE077, 0x70F1,0xE078, 0x70AC,0xE079, 0x70B8,0xE07A, 0x70B3,0xE07B, 0x70AE,0xE07C, 0x70DF,0xE07D, 0x70CB,0xE07E, 0x70DD,0xE080, 0x70D9,0xE081, 0x7109,0xE082, 0x70FD,0xE083, 0x711C,0xE084, 0x7119,0xE085, 0x7165,0xE086, 0x7155,0xE087, 0x7188,0xE088, 0x7166,0xE089, 0x7162,0xE08A, 0x714C,0xE08B, 0x7156,0xE08C, 0x716C,0xE08D, 0x718F,0xE08E, 0x71FB,0xE08F, 0x7184,0xE090, 0x7195,0xE091, 0x71A8,0xE092, 0x71AC,0xE093, 0x71D7,0xE094, 0x71B9,0xE095, 0x71BE,0xE096, 0x71D2,0xE097, 0x71C9,0xE098, 0x71D4,0xE099, 0x71CE,0xE09A, 0x71E0,0xE09B, 0x71EC,0xE09C, 0x71E7,0xE09D, 0x71F5,0xE09E, 0x71FC,0xE09F, 0x71F9,0xE0A0, 0x71FF,0xE0A1, 0x720D,0xE0A2, 0x7210,0xE0A3, 0x721B,0xE0A4, 0x7228,0xE0A5, 0x722D,0xE0A6, 0x722C,0xE0A7, 0x7230,0xE0A8, 0x7232,0xE0A9, 0x723B,0xE0AA, 0x723C,0xE0AB, 0x723F,0xE0AC, 0x7240,0xE0AD, 0x7246,0xE0AE, 0x724B,0xE0AF, 0x7258,0xE0B0, 0x7274,0xE0B1, 0x727E,0xE0B2, 0x7282,0xE0B3, 0x7281,0xE0B4, 0x7287,0xE0B5, 0x7292,0xE0B6, 0x7296,0xE0B7, 0x72A2,0xE0B8, 0x72A7,0xE0B9, 0x72B9,0xE0BA, 0x72B2,0xE0BB, 0x72C3,0xE0BC, 0x72C6,0xE0BD, 0x72C4,0xE0BE, 0x72CE,0xE0BF, 0x72D2,0xE0C0, 0x72E2,0xE0C1, 0x72E0,0xE0C2, 0x72E1,0xE0C3, 0x72F9,0xE0C4, 0x72F7,0xE0C5, 0x500F,0xE0C6, 0x7317,0xE0C7, 0x730A,0xE0C8, 0x731C,0xE0C9, 0x7316,0xE0CA, 0x731D,0xE0CB, 0x7334,0xE0CC, 0x732F,0xE0CD, 0x7329,0xE0CE, 0x7325,0xE0CF, 0x733E,0xE0D0, 0x734E,0xE0D1, 0x734F,0xE0D2, 0x9ED8,0xE0D3, 0x7357,0xE0D4, 0x736A,0xE0D5, 0x7368,0xE0D6, 0x7370,0xE0D7, 0x7378,0xE0D8, 0x7375,0xE0D9, 0x737B,0xE0DA, 0x737A,0xE0DB, 0x73C8,0xE0DC, 0x73B3,0xE0DD, 0x73CE,0xE0DE, 0x73BB,0xE0DF, 0x73C0,0xE0E0, 0x73E5,0xE0E1, 0x73EE,0xE0E2, 0x73DE,0xE0E3, 0x74A2,0xE0E4, 0x7405,0xE0E5, 0x746F,0xE0E6, 0x7425,0xE0E7, 0x73F8,0xE0E8, 0x7432,0xE0E9, 0x743A,0xE0EA, 0x7455,0xE0EB, 0x743F,0xE0EC, 0x745F,0xE0ED, 0x7459,0xE0EE, 0x7441,0xE0EF, 0x745C,0xE0F0, 0x7469,0xE0F1, 0x7470,0xE0F2, 0x7463,0xE0F3, 0x746A,0xE0F4, 0x7476,0xE0F5, 0x747E,0xE0F6, 0x748B,0xE0F7, 0x749E,0xE0F8, 0x74A7,0xE0F9, 0x74CA,0xE0FA, 0x74CF,0xE0FB, 0x74D4,0xE0FC, 0x73F1,0xE140, 0x74E0,0xE141, 0x74E3,0xE142, 0x74E7,0xE143, 0x74E9,0xE144, 0x74EE,0xE145, 0x74F2,0xE146, 0x74F0,0xE147, 0x74F1,0xE148, 0x74F8,0xE149, 0x74F7,0xE14A, 0x7504,0xE14B, 0x7503,0xE14C, 0x7505,0xE14D, 0x750C,0xE14E, 0x750E,0xE14F, 0x750D,0xE150, 0x7515,0xE151, 0x7513,0xE152, 0x751E,0xE153, 0x7526,0xE154, 0x752C,0xE155, 0x753C,0xE156, 0x7544,0xE157, 0x754D,0xE158, 0x754A,0xE159, 0x7549,0xE15A, 0x755B,0xE15B, 0x7546,0xE15C, 0x755A,0xE15D, 0x7569,0xE15E, 0x7564,0xE15F, 0x7567,0xE160, 0x756B,0xE161, 0x756D,0xE162, 0x7578,0xE163, 0x7576,0xE164, 0x7586,0xE165, 0x7587,0xE166, 0x7574,0xE167, 0x758A,0xE168, 0x7589,0xE169, 0x7582,0xE16A, 0x7594,0xE16B, 0x759A,0xE16C, 0x759D,0xE16D, 0x75A5,0xE16E, 0x75A3,0xE16F, 0x75C2,0xE170, 0x75B3,0xE171, 0x75C3,0xE172, 0x75B5,0xE173, 0x75BD,0xE174, 0x75B8,0xE175, 0x75BC,0xE176, 0x75B1,0xE177, 0x75CD,0xE178, 0x75CA,0xE179, 0x75D2,0xE17A, 0x75D9,0xE17B, 0x75E3,0xE17C, 0x75DE,0xE17D, 0x75FE,0xE17E, 0x75FF,0xE180, 0x75FC,0xE181, 0x7601,0xE182, 0x75F0,0xE183, 0x75FA,0xE184, 0x75F2,0xE185, 0x75F3,0xE186, 0x760B,0xE187, 0x760D,0xE188, 0x7609,0xE189, 0x761F,0xE18A, 0x7627,0xE18B, 0x7620,0xE18C, 0x7621,0xE18D, 0x7622,0xE18E, 0x7624,0xE18F, 0x7634,0xE190, 0x7630,0xE191, 0x763B,0xE192, 0x7647,0xE193, 0x7648,0xE194, 0x7646,0xE195, 0x765C,0xE196, 0x7658,0xE197, 0x7661,0xE198, 0x7662,0xE199, 0x7668,0xE19A, 0x7669,0xE19B, 0x766A,0xE19C, 0x7667,0xE19D, 0x766C,0xE19E, 0x7670,0xE19F, 0x7672,0xE1A0, 0x7676,0xE1A1, 0x7678,0xE1A2, 0x767C,0xE1A3, 0x7680,0xE1A4, 0x7683,0xE1A5, 0x7688,0xE1A6, 0x768B,0xE1A7, 0x768E,0xE1A8, 0x7696,0xE1A9, 0x7693,0xE1AA, 0x7699,0xE1AB, 0x769A,0xE1AC, 0x76B0,0xE1AD, 0x76B4,0xE1AE, 0x76B8,0xE1AF, 0x76B9,0xE1B0, 0x76BA,0xE1B1, 0x76C2,0xE1B2, 0x76CD,0xE1B3, 0x76D6,0xE1B4, 0x76D2,0xE1B5, 0x76DE,0xE1B6, 0x76E1,0xE1B7, 0x76E5,0xE1B8, 0x76E7,0xE1B9, 0x76EA,0xE1BA, 0x862F,0xE1BB, 0x76FB,0xE1BC, 0x7708,0xE1BD, 0x7707,0xE1BE, 0x7704,0xE1BF, 0x7729,0xE1C0, 0x7724,0xE1C1, 0x771E,0xE1C2, 0x7725,0xE1C3, 0x7726,0xE1C4, 0x771B,0xE1C5, 0x7737,0xE1C6, 0x7738,0xE1C7, 0x7747,0xE1C8, 0x775A,0xE1C9, 0x7768,0xE1CA, 0x776B,0xE1CB, 0x775B,0xE1CC, 0x7765,0xE1CD, 0x777F,0xE1CE, 0x777E,0xE1CF, 0x7779,0xE1D0, 0x778E,0xE1D1, 0x778B,0xE1D2, 0x7791,0xE1D3, 0x77A0,0xE1D4, 0x779E,0xE1D5, 0x77B0,0xE1D6, 0x77B6,0xE1D7, 0x77B9,0xE1D8, 0x77BF,0xE1D9, 0x77BC,0xE1DA, 0x77BD,0xE1DB, 0x77BB,0xE1DC, 0x77C7,0xE1DD, 0x77CD,0xE1DE, 0x77D7,0xE1DF, 0x77DA,0xE1E0, 0x77DC,0xE1E1, 0x77E3,0xE1E2, 0x77EE,0xE1E3, 0x77FC,0xE1E4, 0x780C,0xE1E5, 0x7812,0xE1E6, 0x7926,0xE1E7, 0x7820,0xE1E8, 0x792A,0xE1E9, 0x7845,0xE1EA, 0x788E,0xE1EB, 0x7874,0xE1EC, 0x7886,0xE1ED, 0x787C,0xE1EE, 0x789A,0xE1EF, 0x788C,0xE1F0, 0x78A3,0xE1F1, 0x78B5,0xE1F2, 0x78AA,0xE1F3, 0x78AF,0xE1F4, 0x78D1,0xE1F5, 0x78C6,0xE1F6, 0x78CB,0xE1F7, 0x78D4,0xE1F8, 0x78BE,0xE1F9, 0x78BC,0xE1FA, 0x78C5,0xE1FB, 0x78CA,0xE1FC, 0x78EC,0xE240, 0x78E7,0xE241, 0x78DA,0xE242, 0x78FD,0xE243, 0x78F4,0xE244, 0x7907,0xE245, 0x7912,0xE246, 0x7911,0xE247, 0x7919,0xE248, 0x792C,0xE249, 0x792B,0xE24A, 0x7940,0xE24B, 0x7960,0xE24C, 0x7957,0xE24D, 0x795F,0xE24E, 0x795A,0xE24F, 0x7955,0xE250, 0x7953,0xE251, 0x797A,0xE252, 0x797F,0xE253, 0x798A,0xE254, 0x799D,0xE255, 0x79A7,0xE256, 0x9F4B,0xE257, 0x79AA,0xE258, 0x79AE,0xE259, 0x79B3,0xE25A, 0x79B9,0xE25B, 0x79BA,0xE25C, 0x79C9,0xE25D, 0x79D5,0xE25E, 0x79E7,0xE25F, 0x79EC,0xE260, 0x79E1,0xE261, 0x79E3,0xE262, 0x7A08,0xE263, 0x7A0D,0xE264, 0x7A18,0xE265, 0x7A19,0xE266, 0x7A20,0xE267, 0x7A1F,0xE268, 0x7980,0xE269, 0x7A31,0xE26A, 0x7A3B,0xE26B, 0x7A3E,0xE26C, 0x7A37,0xE26D, 0x7A43,0xE26E, 0x7A57,0xE26F, 0x7A49,0xE270, 0x7A61,0xE271, 0x7A62,0xE272, 0x7A69,0xE273, 0x9F9D,0xE274, 0x7A70,0xE275, 0x7A79,0xE276, 0x7A7D,0xE277, 0x7A88,0xE278, 0x7A97,0xE279, 0x7A95,0xE27A, 0x7A98,0xE27B, 0x7A96,0xE27C, 0x7AA9,0xE27D, 0x7AC8,0xE27E, 0x7AB0,0xE280, 0x7AB6,0xE281, 0x7AC5,0xE282, 0x7AC4,0xE283, 0x7ABF,0xE284, 0x9083,0xE285, 0x7AC7,0xE286, 0x7ACA,0xE287, 0x7ACD,0xE288, 0x7ACF,0xE289, 0x7AD5,0xE28A, 0x7AD3,0xE28B, 0x7AD9,0xE28C, 0x7ADA,0xE28D, 0x7ADD,0xE28E, 0x7AE1,0xE28F, 0x7AE2,0xE290, 0x7AE6,0xE291, 0x7AED,0xE292, 0x7AF0,0xE293, 0x7B02,0xE294, 0x7B0F,0xE295, 0x7B0A,0xE296, 0x7B06,0xE297, 0x7B33,0xE298, 0x7B18,0xE299, 0x7B19,0xE29A, 0x7B1E,0xE29B, 0x7B35,0xE29C, 0x7B28,0xE29D, 0x7B36,0xE29E, 0x7B50,0xE29F, 0x7B7A,0xE2A0, 0x7B04,0xE2A1, 0x7B4D,0xE2A2, 0x7B0B,0xE2A3, 0x7B4C,0xE2A4, 0x7B45,0xE2A5, 0x7B75,0xE2A6, 0x7B65,0xE2A7, 0x7B74,0xE2A8, 0x7B67,0xE2A9, 0x7B70,0xE2AA, 0x7B71,0xE2AB, 0x7B6C,0xE2AC, 0x7B6E,0xE2AD, 0x7B9D,0xE2AE, 0x7B98,0xE2AF, 0x7B9F,0xE2B0, 0x7B8D,0xE2B1, 0x7B9C,0xE2B2, 0x7B9A,0xE2B3, 0x7B8B,0xE2B4, 0x7B92,0xE2B5, 0x7B8F,0xE2B6, 0x7B5D,0xE2B7, 0x7B99,0xE2B8, 0x7BCB,0xE2B9, 0x7BC1,0xE2BA, 0x7BCC,0xE2BB, 0x7BCF,0xE2BC, 0x7BB4,0xE2BD, 0x7BC6,0xE2BE, 0x7BDD,0xE2BF, 0x7BE9,0xE2C0, 0x7C11,0xE2C1, 0x7C14,0xE2C2, 0x7BE6,0xE2C3, 0x7BE5,0xE2C4, 0x7C60,0xE2C5, 0x7C00,0xE2C6, 0x7C07,0xE2C7, 0x7C13,0xE2C8, 0x7BF3,0xE2C9, 0x7BF7,0xE2CA, 0x7C17,0xE2CB, 0x7C0D,0xE2CC, 0x7BF6,0xE2CD, 0x7C23,0xE2CE, 0x7C27,0xE2CF, 0x7C2A,0xE2D0, 0x7C1F,0xE2D1, 0x7C37,0xE2D2, 0x7C2B,0xE2D3, 0x7C3D,0xE2D4, 0x7C4C,0xE2D5, 0x7C43,0xE2D6, 0x7C54,0xE2D7, 0x7C4F,0xE2D8, 0x7C40,0xE2D9, 0x7C50,0xE2DA, 0x7C58,0xE2DB, 0x7C5F,0xE2DC, 0x7C64,0xE2DD, 0x7C56,0xE2DE, 0x7C65,0xE2DF, 0x7C6C,0xE2E0, 0x7C75,0xE2E1, 0x7C83,0xE2E2, 0x7C90,0xE2E3, 0x7CA4,0xE2E4, 0x7CAD,0xE2E5, 0x7CA2,0xE2E6, 0x7CAB,0xE2E7, 0x7CA1,0xE2E8, 0x7CA8,0xE2E9, 0x7CB3,0xE2EA, 0x7CB2,0xE2EB, 0x7CB1,0xE2EC, 0x7CAE,0xE2ED, 0x7CB9,0xE2EE, 0x7CBD,0xE2EF, 0x7CC0,0xE2F0, 0x7CC5,0xE2F1, 0x7CC2,0xE2F2, 0x7CD8,0xE2F3, 0x7CD2,0xE2F4, 0x7CDC,0xE2F5, 0x7CE2,0xE2F6, 0x9B3B,0xE2F7, 0x7CEF,0xE2F8, 0x7CF2,0xE2F9, 0x7CF4,0xE2FA, 0x7CF6,0xE2FB, 0x7CFA,0xE2FC, 0x7D06,0xE340, 0x7D02,0xE341, 0x7D1C,0xE342, 0x7D15,0xE343, 0x7D0A,0xE344, 0x7D45,0xE345, 0x7D4B,0xE346, 0x7D2E,0xE347, 0x7D32,0xE348, 0x7D3F,0xE349, 0x7D35,0xE34A, 0x7D46,0xE34B, 0x7D73,0xE34C, 0x7D56,0xE34D, 0x7D4E,0xE34E, 0x7D72,0xE34F, 0x7D68,0xE350, 0x7D6E,0xE351, 0x7D4F,0xE352, 0x7D63,0xE353, 0x7D93,0xE354, 0x7D89,0xE355, 0x7D5B,0xE356, 0x7D8F,0xE357, 0x7D7D,0xE358, 0x7D9B,0xE359, 0x7DBA,0xE35A, 0x7DAE,0xE35B, 0x7DA3,0xE35C, 0x7DB5,0xE35D, 0x7DC7,0xE35E, 0x7DBD,0xE35F, 0x7DAB,0xE360, 0x7E3D,0xE361, 0x7DA2,0xE362, 0x7DAF,0xE363, 0x7DDC,0xE364, 0x7DB8,0xE365, 0x7D9F,0xE366, 0x7DB0,0xE367, 0x7DD8,0xE368, 0x7DDD,0xE369, 0x7DE4,0xE36A, 0x7DDE,0xE36B, 0x7DFB,0xE36C, 0x7DF2,0xE36D, 0x7DE1,0xE36E, 0x7E05,0xE36F, 0x7E0A,0xE370, 0x7E23,0xE371, 0x7E21,0xE372, 0x7E12,0xE373, 0x7E31,0xE374, 0x7E1F,0xE375, 0x7E09,0xE376, 0x7E0B,0xE377, 0x7E22,0xE378, 0x7E46,0xE379, 0x7E66,0xE37A, 0x7E3B,0xE37B, 0x7E35,0xE37C, 0x7E39,0xE37D, 0x7E43,0xE37E, 0x7E37,0xE380, 0x7E32,0xE381, 0x7E3A,0xE382, 0x7E67,0xE383, 0x7E5D,0xE384, 0x7E56,0xE385, 0x7E5E,0xE386, 0x7E59,0xE387, 0x7E5A,0xE388, 0x7E79,0xE389, 0x7E6A,0xE38A, 0x7E69,0xE38B, 0x7E7C,0xE38C, 0x7E7B,0xE38D, 0x7E83,0xE38E, 0x7DD5,0xE38F, 0x7E7D,0xE390, 0x8FAE,0xE391, 0x7E7F,0xE392, 0x7E88,0xE393, 0x7E89,0xE394, 0x7E8C,0xE395, 0x7E92,0xE396, 0x7E90,0xE397, 0x7E93,0xE398, 0x7E94,0xE399, 0x7E96,0xE39A, 0x7E8E,0xE39B, 0x7E9B,0xE39C, 0x7E9C,0xE39D, 0x7F38,0xE39E, 0x7F3A,0xE39F, 0x7F45,0xE3A0, 0x7F4C,0xE3A1, 0x7F4D,0xE3A2, 0x7F4E,0xE3A3, 0x7F50,0xE3A4, 0x7F51,0xE3A5, 0x7F55,0xE3A6, 0x7F54,0xE3A7, 0x7F58,0xE3A8, 0x7F5F,0xE3A9, 0x7F60,0xE3AA, 0x7F68,0xE3AB, 0x7F69,0xE3AC, 0x7F67,0xE3AD, 0x7F78,0xE3AE, 0x7F82,0xE3AF, 0x7F86,0xE3B0, 0x7F83,0xE3B1, 0x7F88,0xE3B2, 0x7F87,0xE3B3, 0x7F8C,0xE3B4, 0x7F94,0xE3B5, 0x7F9E,0xE3B6, 0x7F9D,0xE3B7, 0x7F9A,0xE3B8, 0x7FA3,0xE3B9, 0x7FAF,0xE3BA, 0x7FB2,0xE3BB, 0x7FB9,0xE3BC, 0x7FAE,0xE3BD, 0x7FB6,0xE3BE, 0x7FB8,0xE3BF, 0x8B71,0xE3C0, 0x7FC5,0xE3C1, 0x7FC6,0xE3C2, 0x7FCA,0xE3C3, 0x7FD5,0xE3C4, 0x7FD4,0xE3C5, 0x7FE1,0xE3C6, 0x7FE6,0xE3C7, 0x7FE9,0xE3C8, 0x7FF3,0xE3C9, 0x7FF9,0xE3CA, 0x98DC,0xE3CB, 0x8006,0xE3CC, 0x8004,0xE3CD, 0x800B,0xE3CE, 0x8012,0xE3CF, 0x8018,0xE3D0, 0x8019,0xE3D1, 0x801C,0xE3D2, 0x8021,0xE3D3, 0x8028,0xE3D4, 0x803F,0xE3D5, 0x803B,0xE3D6, 0x804A,0xE3D7, 0x8046,0xE3D8, 0x8052,0xE3D9, 0x8058,0xE3DA, 0x805A,0xE3DB, 0x805F,0xE3DC, 0x8062,0xE3DD, 0x8068,0xE3DE, 0x8073,0xE3DF, 0x8072,0xE3E0, 0x8070,0xE3E1, 0x8076,0xE3E2, 0x8079,0xE3E3, 0x807D,0xE3E4, 0x807F,0xE3E5, 0x8084,0xE3E6, 0x8086,0xE3E7, 0x8085,0xE3E8, 0x809B,0xE3E9, 0x8093,0xE3EA, 0x809A,0xE3EB, 0x80AD,0xE3EC, 0x5190,0xE3ED, 0x80AC,0xE3EE, 0x80DB,0xE3EF, 0x80E5,0xE3F0, 0x80D9,0xE3F1, 0x80DD,0xE3F2, 0x80C4,0xE3F3, 0x80DA,0xE3F4, 0x80D6,0xE3F5, 0x8109,0xE3F6, 0x80EF,0xE3F7, 0x80F1,0xE3F8, 0x811B,0xE3F9, 0x8129,0xE3FA, 0x8123,0xE3FB, 0x812F,0xE3FC, 0x814B,0xE440, 0x968B,0xE441, 0x8146,0xE442, 0x813E,0xE443, 0x8153,0xE444, 0x8151,0xE445, 0x80FC,0xE446, 0x8171,0xE447, 0x816E,0xE448, 0x8165,0xE449, 0x8166,0xE44A, 0x8174,0xE44B, 0x8183,0xE44C, 0x8188,0xE44D, 0x818A,0xE44E, 0x8180,0xE44F, 0x8182,0xE450, 0x81A0,0xE451, 0x8195,0xE452, 0x81A4,0xE453, 0x81A3,0xE454, 0x815F,0xE455, 0x8193,0xE456, 0x81A9,0xE457, 0x81B0,0xE458, 0x81B5,0xE459, 0x81BE,0xE45A, 0x81B8,0xE45B, 0x81BD,0xE45C, 0x81C0,0xE45D, 0x81C2,0xE45E, 0x81BA,0xE45F, 0x81C9,0xE460, 0x81CD,0xE461, 0x81D1,0xE462, 0x81D9,0xE463, 0x81D8,0xE464, 0x81C8,0xE465, 0x81DA,0xE466, 0x81DF,0xE467, 0x81E0,0xE468, 0x81E7,0xE469, 0x81FA,0xE46A, 0x81FB,0xE46B, 0x81FE,0xE46C, 0x8201,0xE46D, 0x8202,0xE46E, 0x8205,0xE46F, 0x8207,0xE470, 0x820A,0xE471, 0x820D,0xE472, 0x8210,0xE473, 0x8216,0xE474, 0x8229,0xE475, 0x822B,0xE476, 0x8238,0xE477, 0x8233,0xE478, 0x8240,0xE479, 0x8259,0xE47A, 0x8258,0xE47B, 0x825D,0xE47C, 0x825A,0xE47D, 0x825F,0xE47E, 0x8264,0xE480, 0x8262,0xE481, 0x8268,0xE482, 0x826A,0xE483, 0x826B,0xE484, 0x822E,0xE485, 0x8271,0xE486, 0x8277,0xE487, 0x8278,0xE488, 0x827E,0xE489, 0x828D,0xE48A, 0x8292,0xE48B, 0x82AB,0xE48C, 0x829F,0xE48D, 0x82BB,0xE48E, 0x82AC,0xE48F, 0x82E1,0xE490, 0x82E3,0xE491, 0x82DF,0xE492, 0x82D2,0xE493, 0x82F4,0xE494, 0x82F3,0xE495, 0x82FA,0xE496, 0x8393,0xE497, 0x8303,0xE498, 0x82FB,0xE499, 0x82F9,0xE49A, 0x82DE,0xE49B, 0x8306,0xE49C, 0x82DC,0xE49D, 0x8309,0xE49E, 0x82D9,0xE49F, 0x8335,0xE4A0, 0x8334,0xE4A1, 0x8316,0xE4A2, 0x8332,0xE4A3, 0x8331,0xE4A4, 0x8340,0xE4A5, 0x8339,0xE4A6, 0x8350,0xE4A7, 0x8345,0xE4A8, 0x832F,0xE4A9, 0x832B,0xE4AA, 0x8317,0xE4AB, 0x8318,0xE4AC, 0x8385,0xE4AD, 0x839A,0xE4AE, 0x83AA,0xE4AF, 0x839F,0xE4B0, 0x83A2,0xE4B1, 0x8396,0xE4B2, 0x8323,0xE4B3, 0x838E,0xE4B4, 0x8387,0xE4B5, 0x838A,0xE4B6, 0x837C,0xE4B7, 0x83B5,0xE4B8, 0x8373,0xE4B9, 0x8375,0xE4BA, 0x83A0,0xE4BB, 0x8389,0xE4BC, 0x83A8,0xE4BD, 0x83F4,0xE4BE, 0x8413,0xE4BF, 0x83EB,0xE4C0, 0x83CE,0xE4C1, 0x83FD,0xE4C2, 0x8403,0xE4C3, 0x83D8,0xE4C4, 0x840B,0xE4C5, 0x83C1,0xE4C6, 0x83F7,0xE4C7, 0x8407,0xE4C8, 0x83E0,0xE4C9, 0x83F2,0xE4CA, 0x840D,0xE4CB, 0x8422,0xE4CC, 0x8420,0xE4CD, 0x83BD,0xE4CE, 0x8438,0xE4CF, 0x8506,0xE4D0, 0x83FB,0xE4D1, 0x846D,0xE4D2, 0x842A,0xE4D3, 0x843C,0xE4D4, 0x855A,0xE4D5, 0x8484,0xE4D6, 0x8477,0xE4D7, 0x846B,0xE4D8, 0x84AD,0xE4D9, 0x846E,0xE4DA, 0x8482,0xE4DB, 0x8469,0xE4DC, 0x8446,0xE4DD, 0x842C,0xE4DE, 0x846F,0xE4DF, 0x8479,0xE4E0, 0x8435,0xE4E1, 0x84CA,0xE4E2, 0x8462,0xE4E3, 0x84B9,0xE4E4, 0x84BF,0xE4E5, 0x849F,0xE4E6, 0x84D9,0xE4E7, 0x84CD,0xE4E8, 0x84BB,0xE4E9, 0x84DA,0xE4EA, 0x84D0,0xE4EB, 0x84C1,0xE4EC, 0x84C6,0xE4ED, 0x84D6,0xE4EE, 0x84A1,0xE4EF, 0x8521,0xE4F0, 0x84FF,0xE4F1, 0x84F4,0xE4F2, 0x8517,0xE4F3, 0x8518,0xE4F4, 0x852C,0xE4F5, 0x851F,0xE4F6, 0x8515,0xE4F7, 0x8514,0xE4F8, 0x84FC,0xE4F9, 0x8540,0xE4FA, 0x8563,0xE4FB, 0x8558,0xE4FC, 0x8548,0xE540, 0x8541,0xE541, 0x8602,0xE542, 0x854B,0xE543, 0x8555,0xE544, 0x8580,0xE545, 0x85A4,0xE546, 0x8588,0xE547, 0x8591,0xE548, 0x858A,0xE549, 0x85A8,0xE54A, 0x856D,0xE54B, 0x8594,0xE54C, 0x859B,0xE54D, 0x85EA,0xE54E, 0x8587,0xE54F, 0x859C,0xE550, 0x8577,0xE551, 0x857E,0xE552, 0x8590,0xE553, 0x85C9,0xE554, 0x85BA,0xE555, 0x85CF,0xE556, 0x85B9,0xE557, 0x85D0,0xE558, 0x85D5,0xE559, 0x85DD,0xE55A, 0x85E5,0xE55B, 0x85DC,0xE55C, 0x85F9,0xE55D, 0x860A,0xE55E, 0x8613,0xE55F, 0x860B,0xE560, 0x85FE,0xE561, 0x85FA,0xE562, 0x8606,0xE563, 0x8622,0xE564, 0x861A,0xE565, 0x8630,0xE566, 0x863F,0xE567, 0x864D,0xE568, 0x4E55,0xE569, 0x8654,0xE56A, 0x865F,0xE56B, 0x8667,0xE56C, 0x8671,0xE56D, 0x8693,0xE56E, 0x86A3,0xE56F, 0x86A9,0xE570, 0x86AA,0xE571, 0x868B,0xE572, 0x868C,0xE573, 0x86B6,0xE574, 0x86AF,0xE575, 0x86C4,0xE576, 0x86C6,0xE577, 0x86B0,0xE578, 0x86C9,0xE579, 0x8823,0xE57A, 0x86AB,0xE57B, 0x86D4,0xE57C, 0x86DE,0xE57D, 0x86E9,0xE57E, 0x86EC,0xE580, 0x86DF,0xE581, 0x86DB,0xE582, 0x86EF,0xE583, 0x8712,0xE584, 0x8706,0xE585, 0x8708,0xE586, 0x8700,0xE587, 0x8703,0xE588, 0x86FB,0xE589, 0x8711,0xE58A, 0x8709,0xE58B, 0x870D,0xE58C, 0x86F9,0xE58D, 0x870A,0xE58E, 0x8734,0xE58F, 0x873F,0xE590, 0x8737,0xE591, 0x873B,0xE592, 0x8725,0xE593, 0x8729,0xE594, 0x871A,0xE595, 0x8760,0xE596, 0x875F,0xE597, 0x8778,0xE598, 0x874C,0xE599, 0x874E,0xE59A, 0x8774,0xE59B, 0x8757,0xE59C, 0x8768,0xE59D, 0x876E,0xE59E, 0x8759,0xE59F, 0x8753,0xE5A0, 0x8763,0xE5A1, 0x876A,0xE5A2, 0x8805,0xE5A3, 0x87A2,0xE5A4, 0x879F,0xE5A5, 0x8782,0xE5A6, 0x87AF,0xE5A7, 0x87CB,0xE5A8, 0x87BD,0xE5A9, 0x87C0,0xE5AA, 0x87D0,0xE5AB, 0x96D6,0xE5AC, 0x87AB,0xE5AD, 0x87C4,0xE5AE, 0x87B3,0xE5AF, 0x87C7,0xE5B0, 0x87C6,0xE5B1, 0x87BB,0xE5B2, 0x87EF,0xE5B3, 0x87F2,0xE5B4, 0x87E0,0xE5B5, 0x880F,0xE5B6, 0x880D,0xE5B7, 0x87FE,0xE5B8, 0x87F6,0xE5B9, 0x87F7,0xE5BA, 0x880E,0xE5BB, 0x87D2,0xE5BC, 0x8811,0xE5BD, 0x8816,0xE5BE, 0x8815,0xE5BF, 0x8822,0xE5C0, 0x8821,0xE5C1, 0x8831,0xE5C2, 0x8836,0xE5C3, 0x8839,0xE5C4, 0x8827,0xE5C5, 0x883B,0xE5C6, 0x8844,0xE5C7, 0x8842,0xE5C8, 0x8852,0xE5C9, 0x8859,0xE5CA, 0x885E,0xE5CB, 0x8862,0xE5CC, 0x886B,0xE5CD, 0x8881,0xE5CE, 0x887E,0xE5CF, 0x889E,0xE5D0, 0x8875,0xE5D1, 0x887D,0xE5D2, 0x88B5,0xE5D3, 0x8872,0xE5D4, 0x8882,0xE5D5, 0x8897,0xE5D6, 0x8892,0xE5D7, 0x88AE,0xE5D8, 0x8899,0xE5D9, 0x88A2,0xE5DA, 0x888D,0xE5DB, 0x88A4,0xE5DC, 0x88B0,0xE5DD, 0x88BF,0xE5DE, 0x88B1,0xE5DF, 0x88C3,0xE5E0, 0x88C4,0xE5E1, 0x88D4,0xE5E2, 0x88D8,0xE5E3, 0x88D9,0xE5E4, 0x88DD,0xE5E5, 0x88F9,0xE5E6, 0x8902,0xE5E7, 0x88FC,0xE5E8, 0x88F4,0xE5E9, 0x88E8,0xE5EA, 0x88F2,0xE5EB, 0x8904,0xE5EC, 0x890C,0xE5ED, 0x890A,0xE5EE, 0x8913,0xE5EF, 0x8943,0xE5F0, 0x891E,0xE5F1, 0x8925,0xE5F2, 0x892A,0xE5F3, 0x892B,0xE5F4, 0x8941,0xE5F5, 0x8944,0xE5F6, 0x893B,0xE5F7, 0x8936,0xE5F8, 0x8938,0xE5F9, 0x894C,0xE5FA, 0x891D,0xE5FB, 0x8960,0xE5FC, 0x895E,0xE640, 0x8966,0xE641, 0x8964,0xE642, 0x896D,0xE643, 0x896A,0xE644, 0x896F,0xE645, 0x8974,0xE646, 0x8977,0xE647, 0x897E,0xE648, 0x8983,0xE649, 0x8988,0xE64A, 0x898A,0xE64B, 0x8993,0xE64C, 0x8998,0xE64D, 0x89A1,0xE64E, 0x89A9,0xE64F, 0x89A6,0xE650, 0x89AC,0xE651, 0x89AF,0xE652, 0x89B2,0xE653, 0x89BA,0xE654, 0x89BD,0xE655, 0x89BF,0xE656, 0x89C0,0xE657, 0x89DA,0xE658, 0x89DC,0xE659, 0x89DD,0xE65A, 0x89E7,0xE65B, 0x89F4,0xE65C, 0x89F8,0xE65D, 0x8A03,0xE65E, 0x8A16,0xE65F, 0x8A10,0xE660, 0x8A0C,0xE661, 0x8A1B,0xE662, 0x8A1D,0xE663, 0x8A25,0xE664, 0x8A36,0xE665, 0x8A41,0xE666, 0x8A5B,0xE667, 0x8A52,0xE668, 0x8A46,0xE669, 0x8A48,0xE66A, 0x8A7C,0xE66B, 0x8A6D,0xE66C, 0x8A6C,0xE66D, 0x8A62,0xE66E, 0x8A85,0xE66F, 0x8A82,0xE670, 0x8A84,0xE671, 0x8AA8,0xE672, 0x8AA1,0xE673, 0x8A91,0xE674, 0x8AA5,0xE675, 0x8AA6,0xE676, 0x8A9A,0xE677, 0x8AA3,0xE678, 0x8AC4,0xE679, 0x8ACD,0xE67A, 0x8AC2,0xE67B, 0x8ADA,0xE67C, 0x8AEB,0xE67D, 0x8AF3,0xE67E, 0x8AE7,0xE680, 0x8AE4,0xE681, 0x8AF1,0xE682, 0x8B14,0xE683, 0x8AE0,0xE684, 0x8AE2,0xE685, 0x8AF7,0xE686, 0x8ADE,0xE687, 0x8ADB,0xE688, 0x8B0C,0xE689, 0x8B07,0xE68A, 0x8B1A,0xE68B, 0x8AE1,0xE68C, 0x8B16,0xE68D, 0x8B10,0xE68E, 0x8B17,0xE68F, 0x8B20,0xE690, 0x8B33,0xE691, 0x97AB,0xE692, 0x8B26,0xE693, 0x8B2B,0xE694, 0x8B3E,0xE695, 0x8B28,0xE696, 0x8B41,0xE697, 0x8B4C,0xE698, 0x8B4F,0xE699, 0x8B4E,0xE69A, 0x8B49,0xE69B, 0x8B56,0xE69C, 0x8B5B,0xE69D, 0x8B5A,0xE69E, 0x8B6B,0xE69F, 0x8B5F,0xE6A0, 0x8B6C,0xE6A1, 0x8B6F,0xE6A2, 0x8B74,0xE6A3, 0x8B7D,0xE6A4, 0x8B80,0xE6A5, 0x8B8C,0xE6A6, 0x8B8E,0xE6A7, 0x8B92,0xE6A8, 0x8B93,0xE6A9, 0x8B96,0xE6AA, 0x8B99,0xE6AB, 0x8B9A,0xE6AC, 0x8C3A,0xE6AD, 0x8C41,0xE6AE, 0x8C3F,0xE6AF, 0x8C48,0xE6B0, 0x8C4C,0xE6B1, 0x8C4E,0xE6B2, 0x8C50,0xE6B3, 0x8C55,0xE6B4, 0x8C62,0xE6B5, 0x8C6C,0xE6B6, 0x8C78,0xE6B7, 0x8C7A,0xE6B8, 0x8C82,0xE6B9, 0x8C89,0xE6BA, 0x8C85,0xE6BB, 0x8C8A,0xE6BC, 0x8C8D,0xE6BD, 0x8C8E,0xE6BE, 0x8C94,0xE6BF, 0x8C7C,0xE6C0, 0x8C98,0xE6C1, 0x621D,0xE6C2, 0x8CAD,0xE6C3, 0x8CAA,0xE6C4, 0x8CBD,0xE6C5, 0x8CB2,0xE6C6, 0x8CB3,0xE6C7, 0x8CAE,0xE6C8, 0x8CB6,0xE6C9, 0x8CC8,0xE6CA, 0x8CC1,0xE6CB, 0x8CE4,0xE6CC, 0x8CE3,0xE6CD, 0x8CDA,0xE6CE, 0x8CFD,0xE6CF, 0x8CFA,0xE6D0, 0x8CFB,0xE6D1, 0x8D04,0xE6D2, 0x8D05,0xE6D3, 0x8D0A,0xE6D4, 0x8D07,0xE6D5, 0x8D0F,0xE6D6, 0x8D0D,0xE6D7, 0x8D10,0xE6D8, 0x9F4E,0xE6D9, 0x8D13,0xE6DA, 0x8CCD,0xE6DB, 0x8D14,0xE6DC, 0x8D16,0xE6DD, 0x8D67,0xE6DE, 0x8D6D,0xE6DF, 0x8D71,0xE6E0, 0x8D73,0xE6E1, 0x8D81,0xE6E2, 0x8D99,0xE6E3, 0x8DC2,0xE6E4, 0x8DBE,0xE6E5, 0x8DBA,0xE6E6, 0x8DCF,0xE6E7, 0x8DDA,0xE6E8, 0x8DD6,0xE6E9, 0x8DCC,0xE6EA, 0x8DDB,0xE6EB, 0x8DCB,0xE6EC, 0x8DEA,0xE6ED, 0x8DEB,0xE6EE, 0x8DDF,0xE6EF, 0x8DE3,0xE6F0, 0x8DFC,0xE6F1, 0x8E08,0xE6F2, 0x8E09,0xE6F3, 0x8DFF,0xE6F4, 0x8E1D,0xE6F5, 0x8E1E,0xE6F6, 0x8E10,0xE6F7, 0x8E1F,0xE6F8, 0x8E42,0xE6F9, 0x8E35,0xE6FA, 0x8E30,0xE6FB, 0x8E34,0xE6FC, 0x8E4A,0xE740, 0x8E47,0xE741, 0x8E49,0xE742, 0x8E4C,0xE743, 0x8E50,0xE744, 0x8E48,0xE745, 0x8E59,0xE746, 0x8E64,0xE747, 0x8E60,0xE748, 0x8E2A,0xE749, 0x8E63,0xE74A, 0x8E55,0xE74B, 0x8E76,0xE74C, 0x8E72,0xE74D, 0x8E7C,0xE74E, 0x8E81,0xE74F, 0x8E87,0xE750, 0x8E85,0xE751, 0x8E84,0xE752, 0x8E8B,0xE753, 0x8E8A,0xE754, 0x8E93,0xE755, 0x8E91,0xE756, 0x8E94,0xE757, 0x8E99,0xE758, 0x8EAA,0xE759, 0x8EA1,0xE75A, 0x8EAC,0xE75B, 0x8EB0,0xE75C, 0x8EC6,0xE75D, 0x8EB1,0xE75E, 0x8EBE,0xE75F, 0x8EC5,0xE760, 0x8EC8,0xE761, 0x8ECB,0xE762, 0x8EDB,0xE763, 0x8EE3,0xE764, 0x8EFC,0xE765, 0x8EFB,0xE766, 0x8EEB,0xE767, 0x8EFE,0xE768, 0x8F0A,0xE769, 0x8F05,0xE76A, 0x8F15,0xE76B, 0x8F12,0xE76C, 0x8F19,0xE76D, 0x8F13,0xE76E, 0x8F1C,0xE76F, 0x8F1F,0xE770, 0x8F1B,0xE771, 0x8F0C,0xE772, 0x8F26,0xE773, 0x8F33,0xE774, 0x8F3B,0xE775, 0x8F39,0xE776, 0x8F45,0xE777, 0x8F42,0xE778, 0x8F3E,0xE779, 0x8F4C,0xE77A, 0x8F49,0xE77B, 0x8F46,0xE77C, 0x8F4E,0xE77D, 0x8F57,0xE77E, 0x8F5C,0xE780, 0x8F62,0xE781, 0x8F63,0xE782, 0x8F64,0xE783, 0x8F9C,0xE784, 0x8F9F,0xE785, 0x8FA3,0xE786, 0x8FAD,0xE787, 0x8FAF,0xE788, 0x8FB7,0xE789, 0x8FDA,0xE78A, 0x8FE5,0xE78B, 0x8FE2,0xE78C, 0x8FEA,0xE78D, 0x8FEF,0xE78E, 0x9087,0xE78F, 0x8FF4,0xE790, 0x9005,0xE791, 0x8FF9,0xE792, 0x8FFA,0xE793, 0x9011,0xE794, 0x9015,0xE795, 0x9021,0xE796, 0x900D,0xE797, 0x901E,0xE798, 0x9016,0xE799, 0x900B,0xE79A, 0x9027,0xE79B, 0x9036,0xE79C, 0x9035,0xE79D, 0x9039,0xE79E, 0x8FF8,0xE79F, 0x904F,0xE7A0, 0x9050,0xE7A1, 0x9051,0xE7A2, 0x9052,0xE7A3, 0x900E,0xE7A4, 0x9049,0xE7A5, 0x903E,0xE7A6, 0x9056,0xE7A7, 0x9058,0xE7A8, 0x905E,0xE7A9, 0x9068,0xE7AA, 0x906F,0xE7AB, 0x9076,0xE7AC, 0x96A8,0xE7AD, 0x9072,0xE7AE, 0x9082,0xE7AF, 0x907D,0xE7B0, 0x9081,0xE7B1, 0x9080,0xE7B2, 0x908A,0xE7B3, 0x9089,0xE7B4, 0x908F,0xE7B5, 0x90A8,0xE7B6, 0x90AF,0xE7B7, 0x90B1,0xE7B8, 0x90B5,0xE7B9, 0x90E2,0xE7BA, 0x90E4,0xE7BB, 0x6248,0xE7BC, 0x90DB,0xE7BD, 0x9102,0xE7BE, 0x9112,0xE7BF, 0x9119,0xE7C0, 0x9132,0xE7C1, 0x9130,0xE7C2, 0x914A,0xE7C3, 0x9156,0xE7C4, 0x9158,0xE7C5, 0x9163,0xE7C6, 0x9165,0xE7C7, 0x9169,0xE7C8, 0x9173,0xE7C9, 0x9172,0xE7CA, 0x918B,0xE7CB, 0x9189,0xE7CC, 0x9182,0xE7CD, 0x91A2,0xE7CE, 0x91AB,0xE7CF, 0x91AF,0xE7D0, 0x91AA,0xE7D1, 0x91B5,0xE7D2, 0x91B4,0xE7D3, 0x91BA,0xE7D4, 0x91C0,0xE7D5, 0x91C1,0xE7D6, 0x91C9,0xE7D7, 0x91CB,0xE7D8, 0x91D0,0xE7D9, 0x91D6,0xE7DA, 0x91DF,0xE7DB, 0x91E1,0xE7DC, 0x91DB,0xE7DD, 0x91FC,0xE7DE, 0x91F5,0xE7DF, 0x91F6,0xE7E0, 0x921E,0xE7E1, 0x91FF,0xE7E2, 0x9214,0xE7E3, 0x922C,0xE7E4, 0x9215,0xE7E5, 0x9211,0xE7E6, 0x925E,0xE7E7, 0x9257,0xE7E8, 0x9245,0xE7E9, 0x9249,0xE7EA, 0x9264,0xE7EB, 0x9248,0xE7EC, 0x9295,0xE7ED, 0x923F,0xE7EE, 0x924B,0xE7EF, 0x9250,0xE7F0, 0x929C,0xE7F1, 0x9296,0xE7F2, 0x9293,0xE7F3, 0x929B,0xE7F4, 0x925A,0xE7F5, 0x92CF,0xE7F6, 0x92B9,0xE7F7, 0x92B7,0xE7F8, 0x92E9,0xE7F9, 0x930F,0xE7FA, 0x92FA,0xE7FB, 0x9344,0xE7FC, 0x932E,0xE840, 0x9319,0xE841, 0x9322,0xE842, 0x931A,0xE843, 0x9323,0xE844, 0x933A,0xE845, 0x9335,0xE846, 0x933B,0xE847, 0x935C,0xE848, 0x9360,0xE849, 0x937C,0xE84A, 0x936E,0xE84B, 0x9356,0xE84C, 0x93B0,0xE84D, 0x93AC,0xE84E, 0x93AD,0xE84F, 0x9394,0xE850, 0x93B9,0xE851, 0x93D6,0xE852, 0x93D7,0xE853, 0x93E8,0xE854, 0x93E5,0xE855, 0x93D8,0xE856, 0x93C3,0xE857, 0x93DD,0xE858, 0x93D0,0xE859, 0x93C8,0xE85A, 0x93E4,0xE85B, 0x941A,0xE85C, 0x9414,0xE85D, 0x9413,0xE85E, 0x9403,0xE85F, 0x9407,0xE860, 0x9410,0xE861, 0x9436,0xE862, 0x942B,0xE863, 0x9435,0xE864, 0x9421,0xE865, 0x943A,0xE866, 0x9441,0xE867, 0x9452,0xE868, 0x9444,0xE869, 0x945B,0xE86A, 0x9460,0xE86B, 0x9462,0xE86C, 0x945E,0xE86D, 0x946A,0xE86E, 0x9229,0xE86F, 0x9470,0xE870, 0x9475,0xE871, 0x9477,0xE872, 0x947D,0xE873, 0x945A,0xE874, 0x947C,0xE875, 0x947E,0xE876, 0x9481,0xE877, 0x947F,0xE878, 0x9582,0xE879, 0x9587,0xE87A, 0x958A,0xE87B, 0x9594,0xE87C, 0x9596,0xE87D, 0x9598,0xE87E, 0x9599,0xE880, 0x95A0,0xE881, 0x95A8,0xE882, 0x95A7,0xE883, 0x95AD,0xE884, 0x95BC,0xE885, 0x95BB,0xE886, 0x95B9,0xE887, 0x95BE,0xE888, 0x95CA,0xE889, 0x6FF6,0xE88A, 0x95C3,0xE88B, 0x95CD,0xE88C, 0x95CC,0xE88D, 0x95D5,0xE88E, 0x95D4,0xE88F, 0x95D6,0xE890, 0x95DC,0xE891, 0x95E1,0xE892, 0x95E5,0xE893, 0x95E2,0xE894, 0x9621,0xE895, 0x9628,0xE896, 0x962E,0xE897, 0x962F,0xE898, 0x9642,0xE899, 0x964C,0xE89A, 0x964F,0xE89B, 0x964B,0xE89C, 0x9677,0xE89D, 0x965C,0xE89E, 0x965E,0xE89F, 0x965D,0xE8A0, 0x965F,0xE8A1, 0x9666,0xE8A2, 0x9672,0xE8A3, 0x966C,0xE8A4, 0x968D,0xE8A5, 0x9698,0xE8A6, 0x9695,0xE8A7, 0x9697,0xE8A8, 0x96AA,0xE8A9, 0x96A7,0xE8AA, 0x96B1,0xE8AB, 0x96B2,0xE8AC, 0x96B0,0xE8AD, 0x96B4,0xE8AE, 0x96B6,0xE8AF, 0x96B8,0xE8B0, 0x96B9,0xE8B1, 0x96CE,0xE8B2, 0x96CB,0xE8B3, 0x96C9,0xE8B4, 0x96CD,0xE8B5, 0x894D,0xE8B6, 0x96DC,0xE8B7, 0x970D,0xE8B8, 0x96D5,0xE8B9, 0x96F9,0xE8BA, 0x9704,0xE8BB, 0x9706,0xE8BC, 0x9708,0xE8BD, 0x9713,0xE8BE, 0x970E,0xE8BF, 0x9711,0xE8C0, 0x970F,0xE8C1, 0x9716,0xE8C2, 0x9719,0xE8C3, 0x9724,0xE8C4, 0x972A,0xE8C5, 0x9730,0xE8C6, 0x9739,0xE8C7, 0x973D,0xE8C8, 0x973E,0xE8C9, 0x9744,0xE8CA, 0x9746,0xE8CB, 0x9748,0xE8CC, 0x9742,0xE8CD, 0x9749,0xE8CE, 0x975C,0xE8CF, 0x9760,0xE8D0, 0x9764,0xE8D1, 0x9766,0xE8D2, 0x9768,0xE8D3, 0x52D2,0xE8D4, 0x976B,0xE8D5, 0x9771,0xE8D6, 0x9779,0xE8D7, 0x9785,0xE8D8, 0x977C,0xE8D9, 0x9781,0xE8DA, 0x977A,0xE8DB, 0x9786,0xE8DC, 0x978B,0xE8DD, 0x978F,0xE8DE, 0x9790,0xE8DF, 0x979C,0xE8E0, 0x97A8,0xE8E1, 0x97A6,0xE8E2, 0x97A3,0xE8E3, 0x97B3,0xE8E4, 0x97B4,0xE8E5, 0x97C3,0xE8E6, 0x97C6,0xE8E7, 0x97C8,0xE8E8, 0x97CB,0xE8E9, 0x97DC,0xE8EA, 0x97ED,0xE8EB, 0x9F4F,0xE8EC, 0x97F2,0xE8ED, 0x7ADF,0xE8EE, 0x97F6,0xE8EF, 0x97F5,0xE8F0, 0x980F,0xE8F1, 0x980C,0xE8F2, 0x9838,0xE8F3, 0x9824,0xE8F4, 0x9821,0xE8F5, 0x9837,0xE8F6, 0x983D,0xE8F7, 0x9846,0xE8F8, 0x984F,0xE8F9, 0x984B,0xE8FA, 0x986B,0xE8FB, 0x986F,0xE8FC, 0x9870,0xE940, 0x9871,0xE941, 0x9874,0xE942, 0x9873,0xE943, 0x98AA,0xE944, 0x98AF,0xE945, 0x98B1,0xE946, 0x98B6,0xE947, 0x98C4,0xE948, 0x98C3,0xE949, 0x98C6,0xE94A, 0x98E9,0xE94B, 0x98EB,0xE94C, 0x9903,0xE94D, 0x9909,0xE94E, 0x9912,0xE94F, 0x9914,0xE950, 0x9918,0xE951, 0x9921,0xE952, 0x991D,0xE953, 0x991E,0xE954, 0x9924,0xE955, 0x9920,0xE956, 0x992C,0xE957, 0x992E,0xE958, 0x993D,0xE959, 0x993E,0xE95A, 0x9942,0xE95B, 0x9949,0xE95C, 0x9945,0xE95D, 0x9950,0xE95E, 0x994B,0xE95F, 0x9951,0xE960, 0x9952,0xE961, 0x994C,0xE962, 0x9955,0xE963, 0x9997,0xE964, 0x9998,0xE965, 0x99A5,0xE966, 0x99AD,0xE967, 0x99AE,0xE968, 0x99BC,0xE969, 0x99DF,0xE96A, 0x99DB,0xE96B, 0x99DD,0xE96C, 0x99D8,0xE96D, 0x99D1,0xE96E, 0x99ED,0xE96F, 0x99EE,0xE970, 0x99F1,0xE971, 0x99F2,0xE972, 0x99FB,0xE973, 0x99F8,0xE974, 0x9A01,0xE975, 0x9A0F,0xE976, 0x9A05,0xE977, 0x99E2,0xE978, 0x9A19,0xE979, 0x9A2B,0xE97A, 0x9A37,0xE97B, 0x9A45,0xE97C, 0x9A42,0xE97D, 0x9A40,0xE97E, 0x9A43,0xE980, 0x9A3E,0xE981, 0x9A55,0xE982, 0x9A4D,0xE983, 0x9A5B,0xE984, 0x9A57,0xE985, 0x9A5F,0xE986, 0x9A62,0xE987, 0x9A65,0xE988, 0x9A64,0xE989, 0x9A69,0xE98A, 0x9A6B,0xE98B, 0x9A6A,0xE98C, 0x9AAD,0xE98D, 0x9AB0,0xE98E, 0x9ABC,0xE98F, 0x9AC0,0xE990, 0x9ACF,0xE991, 0x9AD1,0xE992, 0x9AD3,0xE993, 0x9AD4,0xE994, 0x9ADE,0xE995, 0x9ADF,0xE996, 0x9AE2,0xE997, 0x9AE3,0xE998, 0x9AE6,0xE999, 0x9AEF,0xE99A, 0x9AEB,0xE99B, 0x9AEE,0xE99C, 0x9AF4,0xE99D, 0x9AF1,0xE99E, 0x9AF7,0xE99F, 0x9AFB,0xE9A0, 0x9B06,0xE9A1, 0x9B18,0xE9A2, 0x9B1A,0xE9A3, 0x9B1F,0xE9A4, 0x9B22,0xE9A5, 0x9B23,0xE9A6, 0x9B25,0xE9A7, 0x9B27,0xE9A8, 0x9B28,0xE9A9, 0x9B29,0xE9AA, 0x9B2A,0xE9AB, 0x9B2E,0xE9AC, 0x9B2F,0xE9AD, 0x9B32,0xE9AE, 0x9B44,0xE9AF, 0x9B43,0xE9B0, 0x9B4F,0xE9B1, 0x9B4D,0xE9B2, 0x9B4E,0xE9B3, 0x9B51,0xE9B4, 0x9B58,0xE9B5, 0x9B74,0xE9B6, 0x9B93,0xE9B7, 0x9B83,0xE9B8, 0x9B91,0xE9B9, 0x9B96,0xE9BA, 0x9B97,0xE9BB, 0x9B9F,0xE9BC, 0x9BA0,0xE9BD, 0x9BA8,0xE9BE, 0x9BB4,0xE9BF, 0x9BC0,0xE9C0, 0x9BCA,0xE9C1, 0x9BB9,0xE9C2, 0x9BC6,0xE9C3, 0x9BCF,0xE9C4, 0x9BD1,0xE9C5, 0x9BD2,0xE9C6, 0x9BE3,0xE9C7, 0x9BE2,0xE9C8, 0x9BE4,0xE9C9, 0x9BD4,0xE9CA, 0x9BE1,0xE9CB, 0x9C3A,0xE9CC, 0x9BF2,0xE9CD, 0x9BF1,0xE9CE, 0x9BF0,0xE9CF, 0x9C15,0xE9D0, 0x9C14,0xE9D1, 0x9C09,0xE9D2, 0x9C13,0xE9D3, 0x9C0C,0xE9D4, 0x9C06,0xE9D5, 0x9C08,0xE9D6, 0x9C12,0xE9D7, 0x9C0A,0xE9D8, 0x9C04,0xE9D9, 0x9C2E,0xE9DA, 0x9C1B,0xE9DB, 0x9C25,0xE9DC, 0x9C24,0xE9DD, 0x9C21,0xE9DE, 0x9C30,0xE9DF, 0x9C47,0xE9E0, 0x9C32,0xE9E1, 0x9C46,0xE9E2, 0x9C3E,0xE9E3, 0x9C5A,0xE9E4, 0x9C60,0xE9E5, 0x9C67,0xE9E6, 0x9C76,0xE9E7, 0x9C78,0xE9E8, 0x9CE7,0xE9E9, 0x9CEC,0xE9EA, 0x9CF0,0xE9EB, 0x9D09,0xE9EC, 0x9D08,0xE9ED, 0x9CEB,0xE9EE, 0x9D03,0xE9EF, 0x9D06,0xE9F0, 0x9D2A,0xE9F1, 0x9D26,0xE9F2, 0x9DAF,0xE9F3, 0x9D23,0xE9F4, 0x9D1F,0xE9F5, 0x9D44,0xE9F6, 0x9D15,0xE9F7, 0x9D12,0xE9F8, 0x9D41,0xE9F9, 0x9D3F,0xE9FA, 0x9D3E,0xE9FB, 0x9D46,0xE9FC, 0x9D48,0xEA40, 0x9D5D,0xEA41, 0x9D5E,0xEA42, 0x9D64,0xEA43, 0x9D51,0xEA44, 0x9D50,0xEA45, 0x9D59,0xEA46, 0x9D72,0xEA47, 0x9D89,0xEA48, 0x9D87,0xEA49, 0x9DAB,0xEA4A, 0x9D6F,0xEA4B, 0x9D7A,0xEA4C, 0x9D9A,0xEA4D, 0x9DA4,0xEA4E, 0x9DA9,0xEA4F, 0x9DB2,0xEA50, 0x9DC4,0xEA51, 0x9DC1,0xEA52, 0x9DBB,0xEA53, 0x9DB8,0xEA54, 0x9DBA,0xEA55, 0x9DC6,0xEA56, 0x9DCF,0xEA57, 0x9DC2,0xEA58, 0x9DD9,0xEA59, 0x9DD3,0xEA5A, 0x9DF8,0xEA5B, 0x9DE6,0xEA5C, 0x9DED,0xEA5D, 0x9DEF,0xEA5E, 0x9DFD,0xEA5F, 0x9E1A,0xEA60, 0x9E1B,0xEA61, 0x9E1E,0xEA62, 0x9E75,0xEA63, 0x9E79,0xEA64, 0x9E7D,0xEA65, 0x9E81,0xEA66, 0x9E88,0xEA67, 0x9E8B,0xEA68, 0x9E8C,0xEA69, 0x9E92,0xEA6A, 0x9E95,0xEA6B, 0x9E91,0xEA6C, 0x9E9D,0xEA6D, 0x9EA5,0xEA6E, 0x9EA9,0xEA6F, 0x9EB8,0xEA70, 0x9EAA,0xEA71, 0x9EAD,0xEA72, 0x9761,0xEA73, 0x9ECC,0xEA74, 0x9ECE,0xEA75, 0x9ECF,0xEA76, 0x9ED0,0xEA77, 0x9ED4,0xEA78, 0x9EDC,0xEA79, 0x9EDE,0xEA7A, 0x9EDD,0xEA7B, 0x9EE0,0xEA7C, 0x9EE5,0xEA7D, 0x9EE8,0xEA7E, 0x9EEF,0xEA80, 0x9EF4,0xEA81, 0x9EF6,0xEA82, 0x9EF7,0xEA83, 0x9EF9,0xEA84, 0x9EFB,0xEA85, 0x9EFC,0xEA86, 0x9EFD,0xEA87, 0x9F07,0xEA88, 0x9F08,0xEA89, 0x76B7,0xEA8A, 0x9F15,0xEA8B, 0x9F21,0xEA8C, 0x9F2C,0xEA8D, 0x9F3E,0xEA8E, 0x9F4A,0xEA8F, 0x9F52,0xEA90, 0x9F54,0xEA91, 0x9F63,0xEA92, 0x9F5F,0xEA93, 0x9F60,0xEA94, 0x9F61,0xEA95, 0x9F66,0xEA96, 0x9F67,0xEA97, 0x9F6C,0xEA98, 0x9F6A,0xEA99, 0x9F77,0xEA9A, 0x9F72,0xEA9B, 0x9F76,0xEA9C, 0x9F95,0xEA9D, 0x9F9C,0xEA9E, 0x9FA0,0xEA9F, 0x582F,0xEAA0, 0x69C7,0xEAA1, 0x9059,0xEAA2, 0x7464,0xEAA3, 0x51DC,0xEAA4, 0x7199,0xED40, 0x7E8A,0xED41, 0x891C,0xED42, 0x9348,0xED43, 0x9288,0xED44, 0x84DC,0xED45, 0x4FC9,0xED46, 0x70BB,0xED47, 0x6631,0xED48, 0x68C8,0xED49, 0x92F9,0xED4A, 0x66FB,0xED4B, 0x5F45,0xED4C, 0x4E28,0xED4D, 0x4EE1,0xED4E, 0x4EFC,0xED4F, 0x4F00,0xED50, 0x4F03,0xED51, 0x4F39,0xED52, 0x4F56,0xED53, 0x4F92,0xED54, 0x4F8A,0xED55, 0x4F9A,0xED56, 0x4F94,0xED57, 0x4FCD,0xED58, 0x5040,0xED59, 0x5022,0xED5A, 0x4FFF,0xED5B, 0x501E,0xED5C, 0x5046,0xED5D, 0x5070,0xED5E, 0x5042,0xED5F, 0x5094,0xED60, 0x50F4,0xED61, 0x50D8,0xED62, 0x514A,0xED63, 0x5164,0xED64, 0x519D,0xED65, 0x51BE,0xED66, 0x51EC,0xED67, 0x5215,0xED68, 0x529C,0xED69, 0x52A6,0xED6A, 0x52C0,0xED6B, 0x52DB,0xED6C, 0x5300,0xED6D, 0x5307,0xED6E, 0x5324,0xED6F, 0x5372,0xED70, 0x5393,0xED71, 0x53B2,0xED72, 0x53DD,0xED73, 0xFA0E,0xED74, 0x549C,0xED75, 0x548A,0xED76, 0x54A9,0xED77, 0x54FF,0xED78, 0x5586,0xED79, 0x5759,0xED7A, 0x5765,0xED7B, 0x57AC,0xED7C, 0x57C8,0xED7D, 0x57C7,0xED7E, 0xFA0F,0xED80, 0xFA10,0xED81, 0x589E,0xED82, 0x58B2,0xED83, 0x590B,0xED84, 0x5953,0xED85, 0x595B,0xED86, 0x595D,0xED87, 0x5963,0xED88, 0x59A4,0xED89, 0x59BA,0xED8A, 0x5B56,0xED8B, 0x5BC0,0xED8C, 0x752F,0xED8D, 0x5BD8,0xED8E, 0x5BEC,0xED8F, 0x5C1E,0xED90, 0x5CA6,0xED91, 0x5CBA,0xED92, 0x5CF5,0xED93, 0x5D27,0xED94, 0x5D53,0xED95, 0xFA11,0xED96, 0x5D42,0xED97, 0x5D6D,0xED98, 0x5DB8,0xED99, 0x5DB9,0xED9A, 0x5DD0,0xED9B, 0x5F21,0xED9C, 0x5F34,0xED9D, 0x5F67,0xED9E, 0x5FB7,0xED9F, 0x5FDE,0xEDA0, 0x605D,0xEDA1, 0x6085,0xEDA2, 0x608A,0xEDA3, 0x60DE,0xEDA4, 0x60D5,0xEDA5, 0x6120,0xEDA6, 0x60F2,0xEDA7, 0x6111,0xEDA8, 0x6137,0xEDA9, 0x6130,0xEDAA, 0x6198,0xEDAB, 0x6213,0xEDAC, 0x62A6,0xEDAD, 0x63F5,0xEDAE, 0x6460,0xEDAF, 0x649D,0xEDB0, 0x64CE,0xEDB1, 0x654E,0xEDB2, 0x6600,0xEDB3, 0x6615,0xEDB4, 0x663B,0xEDB5, 0x6609,0xEDB6, 0x662E,0xEDB7, 0x661E,0xEDB8, 0x6624,0xEDB9, 0x6665,0xEDBA, 0x6657,0xEDBB, 0x6659,0xEDBC, 0xFA12,0xEDBD, 0x6673,0xEDBE, 0x6699,0xEDBF, 0x66A0,0xEDC0, 0x66B2,0xEDC1, 0x66BF,0xEDC2, 0x66FA,0xEDC3, 0x670E,0xEDC4, 0xF929,0xEDC5, 0x6766,0xEDC6, 0x67BB,0xEDC7, 0x6852,0xEDC8, 0x67C0,0xEDC9, 0x6801,0xEDCA, 0x6844,0xEDCB, 0x68CF,0xEDCC, 0xFA13,0xEDCD, 0x6968,0xEDCE, 0xFA14,0xEDCF, 0x6998,0xEDD0, 0x69E2,0xEDD1, 0x6A30,0xEDD2, 0x6A6B,0xEDD3, 0x6A46,0xEDD4, 0x6A73,0xEDD5, 0x6A7E,0xEDD6, 0x6AE2,0xEDD7, 0x6AE4,0xEDD8, 0x6BD6,0xEDD9, 0x6C3F,0xEDDA, 0x6C5C,0xEDDB, 0x6C86,0xEDDC, 0x6C6F,0xEDDD, 0x6CDA,0xEDDE, 0x6D04,0xEDDF, 0x6D87,0xEDE0, 0x6D6F,0xEDE1, 0x6D96,0xEDE2, 0x6DAC,0xEDE3, 0x6DCF,0xEDE4, 0x6DF8,0xEDE5, 0x6DF2,0xEDE6, 0x6DFC,0xEDE7, 0x6E39,0xEDE8, 0x6E5C,0xEDE9, 0x6E27,0xEDEA, 0x6E3C,0xEDEB, 0x6EBF,0xEDEC, 0x6F88,0xEDED, 0x6FB5,0xEDEE, 0x6FF5,0xEDEF, 0x7005,0xEDF0, 0x7007,0xEDF1, 0x7028,0xEDF2, 0x7085,0xEDF3, 0x70AB,0xEDF4, 0x710F,0xEDF5, 0x7104,0xEDF6, 0x715C,0xEDF7, 0x7146,0xEDF8, 0x7147,0xEDF9, 0xFA15,0xEDFA, 0x71C1,0xEDFB, 0x71FE,0xEDFC, 0x72B1,0xEE40, 0x72BE,0xEE41, 0x7324,0xEE42, 0xFA16,0xEE43, 0x7377,0xEE44, 0x73BD,0xEE45, 0x73C9,0xEE46, 0x73D6,0xEE47, 0x73E3,0xEE48, 0x73D2,0xEE49, 0x7407,0xEE4A, 0x73F5,0xEE4B, 0x7426,0xEE4C, 0x742A,0xEE4D, 0x7429,0xEE4E, 0x742E,0xEE4F, 0x7462,0xEE50, 0x7489,0xEE51, 0x749F,0xEE52, 0x7501,0xEE53, 0x756F,0xEE54, 0x7682,0xEE55, 0x769C,0xEE56, 0x769E,0xEE57, 0x769B,0xEE58, 0x76A6,0xEE59, 0xFA17,0xEE5A, 0x7746,0xEE5B, 0x52AF,0xEE5C, 0x7821,0xEE5D, 0x784E,0xEE5E, 0x7864,0xEE5F, 0x787A,0xEE60, 0x7930,0xEE61, 0xFA18,0xEE62, 0xFA19,0xEE63, 0xFA1A,0xEE64, 0x7994,0xEE65, 0xFA1B,0xEE66, 0x799B,0xEE67, 0x7AD1,0xEE68, 0x7AE7,0xEE69, 0xFA1C,0xEE6A, 0x7AEB,0xEE6B, 0x7B9E,0xEE6C, 0xFA1D,0xEE6D, 0x7D48,0xEE6E, 0x7D5C,0xEE6F, 0x7DB7,0xEE70, 0x7DA0,0xEE71, 0x7DD6,0xEE72, 0x7E52,0xEE73, 0x7F47,0xEE74, 0x7FA1,0xEE75, 0xFA1E,0xEE76, 0x8301,0xEE77, 0x8362,0xEE78, 0x837F,0xEE79, 0x83C7,0xEE7A, 0x83F6,0xEE7B, 0x8448,0xEE7C, 0x84B4,0xEE7D, 0x8553,0xEE7E, 0x8559,0xEE80, 0x856B,0xEE81, 0xFA1F,0xEE82, 0x85B0,0xEE83, 0xFA20,0xEE84, 0xFA21,0xEE85, 0x8807,0xEE86, 0x88F5,0xEE87, 0x8A12,0xEE88, 0x8A37,0xEE89, 0x8A79,0xEE8A, 0x8AA7,0xEE8B, 0x8ABE,0xEE8C, 0x8ADF,0xEE8D, 0xFA22,0xEE8E, 0x8AF6,0xEE8F, 0x8B53,0xEE90, 0x8B7F,0xEE91, 0x8CF0,0xEE92, 0x8CF4,0xEE93, 0x8D12,0xEE94, 0x8D76,0xEE95, 0xFA23,0xEE96, 0x8ECF,0xEE97, 0xFA24,0xEE98, 0xFA25,0xEE99, 0x9067,0xEE9A, 0x90DE,0xEE9B, 0xFA26,0xEE9C, 0x9115,0xEE9D, 0x9127,0xEE9E, 0x91DA,0xEE9F, 0x91D7,0xEEA0, 0x91DE,0xEEA1, 0x91ED,0xEEA2, 0x91EE,0xEEA3, 0x91E4,0xEEA4, 0x91E5,0xEEA5, 0x9206,0xEEA6, 0x9210,0xEEA7, 0x920A,0xEEA8, 0x923A,0xEEA9, 0x9240,0xEEAA, 0x923C,0xEEAB, 0x924E,0xEEAC, 0x9259,0xEEAD, 0x9251,0xEEAE, 0x9239,0xEEAF, 0x9267,0xEEB0, 0x92A7,0xEEB1, 0x9277,0xEEB2, 0x9278,0xEEB3, 0x92E7,0xEEB4, 0x92D7,0xEEB5, 0x92D9,0xEEB6, 0x92D0,0xEEB7, 0xFA27,0xEEB8, 0x92D5,0xEEB9, 0x92E0,0xEEBA, 0x92D3,0xEEBB, 0x9325,0xEEBC, 0x9321,0xEEBD, 0x92FB,0xEEBE, 0xFA28,0xEEBF, 0x931E,0xEEC0, 0x92FF,0xEEC1, 0x931D,0xEEC2, 0x9302,0xEEC3, 0x9370,0xEEC4, 0x9357,0xEEC5, 0x93A4,0xEEC6, 0x93C6,0xEEC7, 0x93DE,0xEEC8, 0x93F8,0xEEC9, 0x9431,0xEECA, 0x9445,0xEECB, 0x9448,0xEECC, 0x9592,0xEECD, 0xF9DC,0xEECE, 0xFA29,0xEECF, 0x969D,0xEED0, 0x96AF,0xEED1, 0x9733,0xEED2, 0x973B,0xEED3, 0x9743,0xEED4, 0x974D,0xEED5, 0x974F,0xEED6, 0x9751,0xEED7, 0x9755,0xEED8, 0x9857,0xEED9, 0x9865,0xEEDA, 0xFA2A,0xEEDB, 0xFA2B,0xEEDC, 0x9927,0xEEDD, 0xFA2C,0xEEDE, 0x999E,0xEEDF, 0x9A4E,0xEEE0, 0x9AD9,0xEEE1, 0x9ADC,0xEEE2, 0x9B75,0xEEE3, 0x9B72,0xEEE4, 0x9B8F,0xEEE5, 0x9BB1,0xEEE6, 0x9BBB,0xEEE7, 0x9C00,0xEEE8, 0x9D70,0xEEE9, 0x9D6B,0xEEEA, 0xFA2D,0xEEEB, 0x9E19,0xEEEC, 0x9ED1,0xEEEF, 0x2170,0xEEF0, 0x2171,0xEEF1, 0x2172,0xEEF2, 0x2173,0xEEF3, 0x2174,0xEEF4, 0x2175,0xEEF5, 0x2176,0xEEF6, 0x2177,0xEEF7, 0x2178,0xEEF8, 0x2179,0xEEF9, 0xFFE2,0xEEFA, 0xFFE4,0xEEFB, 0xFF07,0xEEFC, 0xFF02,0xFA40, 0x2170,0xFA41, 0x2171,0xFA42, 0x2172,0xFA43, 0x2173,0xFA44, 0x2174,0xFA45, 0x2175,0xFA46, 0x2176,0xFA47, 0x2177,0xFA48, 0x2178,0xFA49, 0x2179,0xFA4A, 0x2160,0xFA4B, 0x2161,0xFA4C, 0x2162,0xFA4D, 0x2163,0xFA4E, 0x2164,0xFA4F, 0x2165,0xFA50, 0x2166,0xFA51, 0x2167,0xFA52, 0x2168,0xFA53, 0x2169,0xFA54, 0xFFE2,0xFA55, 0xFFE4,0xFA56, 0xFF07,0xFA57, 0xFF02,0xFA58, 0x3231,0xFA59, 0x2116,0xFA5A, 0x2121,0xFA5B, 0x2235,0xFA5C, 0x7E8A,0xFA5D, 0x891C,0xFA5E, 0x9348,0xFA5F, 0x9288,0xFA60, 0x84DC,0xFA61, 0x4FC9,0xFA62, 0x70BB,0xFA63, 0x6631,0xFA64, 0x68C8,0xFA65, 0x92F9,0xFA66, 0x66FB,0xFA67, 0x5F45,0xFA68, 0x4E28,0xFA69, 0x4EE1,0xFA6A, 0x4EFC,0xFA6B, 0x4F00,0xFA6C, 0x4F03,0xFA6D, 0x4F39,0xFA6E, 0x4F56,0xFA6F, 0x4F92,0xFA70, 0x4F8A,0xFA71, 0x4F9A,0xFA72, 0x4F94,0xFA73, 0x4FCD,0xFA74, 0x5040,0xFA75, 0x5022,0xFA76, 0x4FFF,0xFA77, 0x501E,0xFA78, 0x5046,0xFA79, 0x5070,0xFA7A, 0x5042,0xFA7B, 0x5094,0xFA7C, 0x50F4,0xFA7D, 0x50D8,0xFA7E, 0x514A,0xFA80, 0x5164,0xFA81, 0x519D,0xFA82, 0x51BE,0xFA83, 0x51EC,0xFA84, 0x5215,0xFA85, 0x529C,0xFA86, 0x52A6,0xFA87, 0x52C0,0xFA88, 0x52DB,0xFA89, 0x5300,0xFA8A, 0x5307,0xFA8B, 0x5324,0xFA8C, 0x5372,0xFA8D, 0x5393,0xFA8E, 0x53B2,0xFA8F, 0x53DD,0xFA90, 0xFA0E,0xFA91, 0x549C,0xFA92, 0x548A,0xFA93, 0x54A9,0xFA94, 0x54FF,0xFA95, 0x5586,0xFA96, 0x5759,0xFA97, 0x5765,0xFA98, 0x57AC,0xFA99, 0x57C8,0xFA9A, 0x57C7,0xFA9B, 0xFA0F,0xFA9C, 0xFA10,0xFA9D, 0x589E,0xFA9E, 0x58B2,0xFA9F, 0x590B,0xFAA0, 0x5953,0xFAA1, 0x595B,0xFAA2, 0x595D,0xFAA3, 0x5963,0xFAA4, 0x59A4,0xFAA5, 0x59BA,0xFAA6, 0x5B56,0xFAA7, 0x5BC0,0xFAA8, 0x752F,0xFAA9, 0x5BD8,0xFAAA, 0x5BEC,0xFAAB, 0x5C1E,0xFAAC, 0x5CA6,0xFAAD, 0x5CBA,0xFAAE, 0x5CF5,0xFAAF, 0x5D27,0xFAB0, 0x5D53,0xFAB1, 0xFA11,0xFAB2, 0x5D42,0xFAB3, 0x5D6D,0xFAB4, 0x5DB8,0xFAB5, 0x5DB9,0xFAB6, 0x5DD0,0xFAB7, 0x5F21,0xFAB8, 0x5F34,0xFAB9, 0x5F67,0xFABA, 0x5FB7,0xFABB, 0x5FDE,0xFABC, 0x605D,0xFABD, 0x6085,0xFABE, 0x608A,0xFABF, 0x60DE,0xFAC0, 0x60D5,0xFAC1, 0x6120,0xFAC2, 0x60F2,0xFAC3, 0x6111,0xFAC4, 0x6137,0xFAC5, 0x6130,0xFAC6, 0x6198,0xFAC7, 0x6213,0xFAC8, 0x62A6,0xFAC9, 0x63F5,0xFACA, 0x6460,0xFACB, 0x649D,0xFACC, 0x64CE,0xFACD, 0x654E,0xFACE, 0x6600,0xFACF, 0x6615,0xFAD0, 0x663B,0xFAD1, 0x6609,0xFAD2, 0x662E,0xFAD3, 0x661E,0xFAD4, 0x6624,0xFAD5, 0x6665,0xFAD6, 0x6657,0xFAD7, 0x6659,0xFAD8, 0xFA12,0xFAD9, 0x6673,0xFADA, 0x6699,0xFADB, 0x66A0,0xFADC, 0x66B2,0xFADD, 0x66BF,0xFADE, 0x66FA,0xFADF, 0x670E,0xFAE0, 0xF929,0xFAE1, 0x6766,0xFAE2, 0x67BB,0xFAE3, 0x6852,0xFAE4, 0x67C0,0xFAE5, 0x6801,0xFAE6, 0x6844,0xFAE7, 0x68CF,0xFAE8, 0xFA13,0xFAE9, 0x6968,0xFAEA, 0xFA14,0xFAEB, 0x6998,0xFAEC, 0x69E2,0xFAED, 0x6A30,0xFAEE, 0x6A6B,0xFAEF, 0x6A46,0xFAF0, 0x6A73,0xFAF1, 0x6A7E,0xFAF2, 0x6AE2,0xFAF3, 0x6AE4,0xFAF4, 0x6BD6,0xFAF5, 0x6C3F,0xFAF6, 0x6C5C,0xFAF7, 0x6C86,0xFAF8, 0x6C6F,0xFAF9, 0x6CDA,0xFAFA, 0x6D04,0xFAFB, 0x6D87,0xFAFC, 0x6D6F,0xFB40, 0x6D96,0xFB41, 0x6DAC,0xFB42, 0x6DCF,0xFB43, 0x6DF8,0xFB44, 0x6DF2,0xFB45, 0x6DFC,0xFB46, 0x6E39,0xFB47, 0x6E5C,0xFB48, 0x6E27,0xFB49, 0x6E3C,0xFB4A, 0x6EBF,0xFB4B, 0x6F88,0xFB4C, 0x6FB5,0xFB4D, 0x6FF5,0xFB4E, 0x7005,0xFB4F, 0x7007,0xFB50, 0x7028,0xFB51, 0x7085,0xFB52, 0x70AB,0xFB53, 0x710F,0xFB54, 0x7104,0xFB55, 0x715C,0xFB56, 0x7146,0xFB57, 0x7147,0xFB58, 0xFA15,0xFB59, 0x71C1,0xFB5A, 0x71FE,0xFB5B, 0x72B1,0xFB5C, 0x72BE,0xFB5D, 0x7324,0xFB5E, 0xFA16,0xFB5F, 0x7377,0xFB60, 0x73BD,0xFB61, 0x73C9,0xFB62, 0x73D6,0xFB63, 0x73E3,0xFB64, 0x73D2,0xFB65, 0x7407,0xFB66, 0x73F5,0xFB67, 0x7426,0xFB68, 0x742A,0xFB69, 0x7429,0xFB6A, 0x742E,0xFB6B, 0x7462,0xFB6C, 0x7489,0xFB6D, 0x749F,0xFB6E, 0x7501,0xFB6F, 0x756F,0xFB70, 0x7682,0xFB71, 0x769C,0xFB72, 0x769E,0xFB73, 0x769B,0xFB74, 0x76A6,0xFB75, 0xFA17,0xFB76, 0x7746,0xFB77, 0x52AF,0xFB78, 0x7821,0xFB79, 0x784E,0xFB7A, 0x7864,0xFB7B, 0x787A,0xFB7C, 0x7930,0xFB7D, 0xFA18,0xFB7E, 0xFA19,0xFB80, 0xFA1A,0xFB81, 0x7994,0xFB82, 0xFA1B,0xFB83, 0x799B,0xFB84, 0x7AD1,0xFB85, 0x7AE7,0xFB86, 0xFA1C,0xFB87, 0x7AEB,0xFB88, 0x7B9E,0xFB89, 0xFA1D,0xFB8A, 0x7D48,0xFB8B, 0x7D5C,0xFB8C, 0x7DB7,0xFB8D, 0x7DA0,0xFB8E, 0x7DD6,0xFB8F, 0x7E52,0xFB90, 0x7F47,0xFB91, 0x7FA1,0xFB92, 0xFA1E,0xFB93, 0x8301,0xFB94, 0x8362,0xFB95, 0x837F,0xFB96, 0x83C7,0xFB97, 0x83F6,0xFB98, 0x8448,0xFB99, 0x84B4,0xFB9A, 0x8553,0xFB9B, 0x8559,0xFB9C, 0x856B,0xFB9D, 0xFA1F,0xFB9E, 0x85B0,0xFB9F, 0xFA20,0xFBA0, 0xFA21,0xFBA1, 0x8807,0xFBA2, 0x88F5,0xFBA3, 0x8A12,0xFBA4, 0x8A37,0xFBA5, 0x8A79,0xFBA6, 0x8AA7,0xFBA7, 0x8ABE,0xFBA8, 0x8ADF,0xFBA9, 0xFA22,0xFBAA, 0x8AF6,0xFBAB, 0x8B53,0xFBAC, 0x8B7F,0xFBAD, 0x8CF0,0xFBAE, 0x8CF4,0xFBAF, 0x8D12,0xFBB0, 0x8D76,0xFBB1, 0xFA23,0xFBB2, 0x8ECF,0xFBB3, 0xFA24,0xFBB4, 0xFA25,0xFBB5, 0x9067,0xFBB6, 0x90DE,0xFBB7, 0xFA26,0xFBB8, 0x9115,0xFBB9, 0x9127,0xFBBA, 0x91DA,0xFBBB, 0x91D7,0xFBBC, 0x91DE,0xFBBD, 0x91ED,0xFBBE, 0x91EE,0xFBBF, 0x91E4,0xFBC0, 0x91E5,0xFBC1, 0x9206,0xFBC2, 0x9210,0xFBC3, 0x920A,0xFBC4, 0x923A,0xFBC5, 0x9240,0xFBC6, 0x923C,0xFBC7, 0x924E,0xFBC8, 0x9259,0xFBC9, 0x9251,0xFBCA, 0x9239,0xFBCB, 0x9267,0xFBCC, 0x92A7,0xFBCD, 0x9277,0xFBCE, 0x9278,0xFBCF, 0x92E7,0xFBD0, 0x92D7,0xFBD1, 0x92D9,0xFBD2, 0x92D0,0xFBD3, 0xFA27,0xFBD4, 0x92D5,0xFBD5, 0x92E0,0xFBD6, 0x92D3,0xFBD7, 0x9325,0xFBD8, 0x9321,0xFBD9, 0x92FB,0xFBDA, 0xFA28,0xFBDB, 0x931E,0xFBDC, 0x92FF,0xFBDD, 0x931D,0xFBDE, 0x9302,0xFBDF, 0x9370,0xFBE0, 0x9357,0xFBE1, 0x93A4,0xFBE2, 0x93C6,0xFBE3, 0x93DE,0xFBE4, 0x93F8,0xFBE5, 0x9431,0xFBE6, 0x9445,0xFBE7, 0x9448,0xFBE8, 0x9592,0xFBE9, 0xF9DC,0xFBEA, 0xFA29,0xFBEB, 0x969D,0xFBEC, 0x96AF,0xFBED, 0x9733,0xFBEE, 0x973B,0xFBEF, 0x9743,0xFBF0, 0x974D,0xFBF1, 0x974F,0xFBF2, 0x9751,0xFBF3, 0x9755,0xFBF4, 0x9857,0xFBF5, 0x9865,0xFBF6, 0xFA2A,0xFBF7, 0xFA2B,0xFBF8, 0x9927,0xFBF9, 0xFA2C,0xFBFA, 0x999E,0xFBFB, 0x9A4E,0xFBFC, 0x9AD9,0xFC40, 0x9ADC,0xFC41, 0x9B75,0xFC42, 0x9B72,0xFC43, 0x9B8F,0xFC44, 0x9BB1,0xFC45, 0x9BBB,0xFC46, 0x9C00,0xFC47, 0x9D70,0xFC48, 0x9D6B,0xFC49, 0xFA2D,0xFC4A, 0x9E19,0xFC4B, 0x9ED1,]\nvar decoding_table = [],\n encoding_table = []\nfor(var i = 0, len = _table.length; i < len; i += 2){\nvar value = _table[i + 1]\nif(value !== null){\n encoding_table[value] = _table[i]\n}\ndecoding_table[_table[i]] = _table[i + 1]\n}\n$module = {encoding_table, decoding_table}\n"], "hashlib": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins\n\nvar $mod = {\n\n __getattr__ : function(attr){\n if(attr == 'new'){return hash.$factory}\n return this[attr]\n },\n md5: function(obj){return hash.$factory('md5', obj)},\n sha1: function(obj){return hash.$factory('sha1', obj)},\n sha224: function(obj){return hash.$factory('sha224', obj)},\n sha256: function(obj){return hash.$factory('sha256', obj)},\n sha384: function(obj){return hash.$factory('sha384', obj)},\n sha512: function(obj){return hash.$factory('sha512', obj)},\n\n algorithms_guaranteed: ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'],\n algorithms_available: ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']\n}\n\n//todo: eventually move this function to a \"utility\" file or use ajax module?\nfunction $get_CryptoJS_lib(alg){\n if($B.VFS !== undefined && $B.VFS.hashlib){\n // use file in brython_stdlib.js\n var lib = $B.VFS[\"crypto_js.rollups.\" + alg]\n if (lib === undefined){\n throw _b_.ImportError.$factory(\"can't import hashlib.\" + alg)\n }\n var res = lib[1]\n try{\n eval(res + \"; $B.CryptoJS = CryptoJS;\")\n return\n }catch(err){\n throw Error(\"JS Eval Error\",\n \"Cannot eval CryptoJS algorithm '\" + alg + \"' : error:\" + err)\n }\n }\n\n var module = {__name__: 'CryptoJS', $is_package: false}\n var res = $B.$download_module(module, $B.brython_path + 'libs/crypto_js/rollups/' + alg + '.js');\n\n try{\n eval(res + \"; $B.CryptoJS = CryptoJS;\")\n }catch(err){\n throw Error(\"JS Eval Error\",\n \"Cannot eval CryptoJS algorithm '\" + alg + \"' : error:\" + err)\n }\n}\n\nfunction bytes2WordArray(obj){\n // Transform a bytes object into an instance of class WordArray\n // defined in CryptoJS\n if(!$B.$isinstance(obj, _b_.bytes)){\n throw _b_.TypeError(\"expected bytes, got \" + $B.class_name(obj))\n }\n\n var words = []\n for(var i = 0; i < obj.source.length; i += 4){\n var word = obj.source.slice(i, i + 4)\n while(word.length < 4){word.push(0)}\n var w = word[3] + (word[2] << 8) + (word[1] << 16) + (word[0] << 24)\n words.push(w)\n }\n return {words: words, sigBytes: obj.source.length}\n}\n\nvar hash = {\n __class__: _b_.type,\n __mro__: [_b_.object],\n __qualname__: 'hash',\n __name__: 'hash'\n}\n\nhash.update = function(self, msg){\n self.hash.update(bytes2WordArray(msg))\n}\n\nhash.copy = function(self){\n return self.hash.clone()\n}\n\nhash.digest = function(self){\n var obj = self.hash.clone().finalize().toString(),\n res = []\n for(var i = 0; i < obj.length; i += 2){\n res.push(parseInt(obj.substr(i, 2), 16))\n }\n return _b_.bytes.$factory(res)\n}\n\nhash.hexdigest = function(self) {\n return self.hash.clone().finalize().toString()\n}\n\nhash.$factory = function(alg, obj) {\n var res = {\n __class__: hash\n }\n\n switch(alg) {\n case 'md5':\n case 'sha1':\n case 'sha224':\n case 'sha256':\n case 'sha384':\n case 'sha512':\n var ALG = alg.toUpperCase()\n if($B.Crypto === undefined ||\n $B.CryptoJS.algo[ALG] === undefined){$get_CryptoJS_lib(alg)}\n\n res.hash = $B.CryptoJS.algo[ALG].create()\n if(obj !== undefined){\n res.hash.update(bytes2WordArray(obj))\n }\n break\n default:\n throw $B.builtins.AttributeError.$factory('Invalid hash algorithm: ' + alg)\n }\n\n return res\n}\n\nreturn $mod\n\n})(__BRYTHON__)\n"], "html_parser": [".js", "var $module = (function($B){\n\n_b_ = $B.builtins\n\nvar ELEMENT_NODE = 1,\n TEXT_NODE = 3,\n COMMENT_NODE = 8,\n DOCUMENT_TYPE_NODE = 10\n\nvar HTMLNode = $B.make_class(\"HTMLNode\",\n function(){\n return {\n __class__: HTMLNode,\n nodeType: TEXT_NODE,\n text: \"\"\n }\n }\n)\n\nHTMLNode.__str__ = function(self){\n return self.text\n}\n\n$B.set_func_names(HTMLNode, \"_html_parser\")\n\nfunction* tokenize(src){\n var node = HTMLNode.$factory(),\n pos = 0,\n tag = \"\",\n type = \"text\"\n while(pos < src.length){\n var char = src[pos]\n switch(type){\n case \"text\":\n if(char == \"<\"){\n // starts a tag if immediately followed by a letter or by /\n var tag_mo = /^(\\/?)[a-zA-Z]+/.exec(src.substr(pos + 1))\n if(tag_mo){\n yield node\n node = HTMLNode.$factory()\n type = \"tag\"\n node.tagName = \"\"\n node.nodeType = ELEMENT_NODE\n node.closing = tag_mo[1] != \"\"\n node.attrs = []\n }else{\n // doctype declaration\n var decl_mo = /^/i.exec(src.substr(pos))\n if(decl_mo){\n yield node\n node = HTMLNode.$factory()\n node.text = decl_mo[0]\n node.doctype = decl_mo[1]\n node.nodeType = DOCUMENT_TYPE_NODE\n yield node\n node = HTMLNode.$factory()\n type = \"text\"\n pos += decl_mo[0].length\n break\n }else{\n // comment\n var comment_mo = /^\\/.exec(src.substr(pos))\n if(comment_mo){\n yield node\n node = HTMLNode.$factory()\n node.text = comment_mo[0]\n node.comment = comment_mo[1]\n node.nodeType = COMMENT_NODE\n yield node\n node = HTMLNode.$factory()\n type = \"text\"\n pos += comment_mo[0].length\n break\n }\n }\n }\n }\n pos++\n node.text += char\n break\n case \"tag\":\n if(char.search(/[_a-zA-Z]/) > -1){\n var mo = /\\w+/.exec(src.substr(pos))\n if(mo !== null){\n pos += mo[0].length\n if(node.tagName == \"\"){\n node.tagName = mo[0].toUpperCase()\n }\n node.text += mo[0]\n }else{\n pos++\n }\n }else if(char == \">\"){\n node.text += char\n yield node\n node = HTMLNode.$factory()\n type = \"text\"\n pos++\n }else if(char == \"=\"){\n node.text += char\n pos++\n }else if(char == \"'\" || char == '\"'){\n var i = pos + 1,\n found_string_end = false\n while(i < src.length){\n if(src[i] == char){\n var nb_escape = 0\n while(src[i - 1 - nb_escape] == '/'){\n nb_escape++\n }\n if(nb_escape % 2 == 0){\n node.text += src.substr(pos, i + 1 - pos)\n pos = i + 1\n found_string_end = true\n break\n }else{\n i++\n }\n }else if(src[i] == '>'){\n break\n }else{\n i++\n }\n }\n if(! found_string_end){\n // unterminated string: ignore\n pos++\n }\n }else{\n node.text += char\n pos++\n }\n break\n default:\n pos++\n }\n }\n yield node\n}\nreturn {\n ELEMENT_NODE: 1,\n TEXT_NODE: 3,\n COMMENT_NODE: 8,\n DOCUMENT_TYPE_NODE: 10,\n tokenize: tokenize\n}\n\n})(__BRYTHON__)\n"], "marshal": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\nreturn {\n loads: function(){\n var $ = $B.args('loads', 1, {obj:null}, ['obj'], arguments, {},\n null, null)\n return $B.structuredclone2pyobj(JSON.parse($.obj))\n },\n load: function(){\n var $ = $B.args('load', 1, {file:null}, ['file'], arguments, {},\n null, null)\n var content = $B.$call($B.$getattr($.file, \"read\"))()\n return $module.loads(_b_.bytes.decode(content, \"latin-1\"));\n },\n dump: function(){\n var $ = $B.args('dump', 2, {value:null, file: null},\n ['value', 'file'], arguments, {}, null, null)\n var s = JSON.stringify($B.pyobj2structuredclone($.value))\n $B.$getattr($.file, \"write\")(_b_.str.encode(s, 'latin-1'))\n var flush = $B.$getattr($.file, \"flush\", null)\n if(flush !== null){\n $B.$call(flush)()\n }\n return _b_.None\n },\n dumps: function(){\n var $ = $B.args('dumps', 1, {obj:null}, ['obj'], arguments, {},\n null, null)\n return JSON.stringify($B.pyobj2structuredclone($.obj))\n }\n}\n\n})(__BRYTHON__)\n"], "math": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\nconst INF = $B.fast_float(Number.POSITIVE_INFINITY),\n NINF = $B.fast_float(Number.NEGATIVE_INFINITY),\n ZERO = $B.fast_float(0),\n NAN = $B.fast_float(Number.NaN)\n\nvar float_check = function(x) {\n // Returns a Javascript number\n if(x.__class__ === $B.long_int){\n var res = parseInt(x.value)\n if(! isFinite(res)){\n throw _b_.OverflowError.$factory('int too big for float')\n }\n return res\n }else if(x.__class__ === _b_.float){\n return x.value\n }\n return _b_.float.$factory(x).value\n}\n\nfunction check_int(x){\n if(! $B.$isinstance(x, _b_.int)){\n throw _b_.TypeError.$factory(\"'\" + $B.class_name(x) +\n \"' object cannot be interpreted as an integer\")\n }\n}\n\nfunction check_int_or_round_float(x){\n return ($B.$isinstance(x, _b_.float) && Number.isInteger(x.value)) ||\n $B.$isinstance(x, _b_.int)\n}\n\nvar isWholeNumber = function(x){return (x * 10) % 10 == 0}\n\nvar isOdd = function(x) {return isWholeNumber(x) && 2 * Math.floor(x / 2) != x}\n\nvar isNegZero = function(x) {return x === 0 && Math.atan2(x,x) < 0}\n\nfunction overflow(){\n throw _b_.OverflowError.$factory(\"math range error\")\n}\n\nfunction value_error(){\n throw _b_.ValueError.$factory(\"math range error\")\n}\n\nvar EPSILON = Math.pow(2, -52),\n MAX_VALUE = (2 - EPSILON) * Math.pow(2, 1023),\n MIN_VALUE = Math.pow(2, -1022),\n Py_HUGE_VAL = Number.POSITIVE_INFINITY,\n logpi = 1.144729885849400174143427351353058711647,\n sqrtpi = 1.772453850905516027298167483341145182798\n\nfunction nextUp(x){\n if(x !== x){ // NaN\n return x\n }\n if(_b_.float.$funcs.isinf(x)){\n if(_b_.float.$funcs.isninf(x)){\n return -MAX_VALUE\n }\n return _mod.inf\n }\n if($B.$isinstance(x, $B.long_int)){\n x = Number(x.value)\n }else if($B.$isinstance(x, _b_.float)){\n x = x.value\n }\n\n if(x == +MAX_VALUE){\n return +1 / 0\n }\n if(typeof x == \"number\"){\n var y = x * (x < 0 ? 1 - EPSILON / 2 : 1 + EPSILON)\n if(y == x){\n y = MIN_VALUE * EPSILON > 0 ? x + MIN_VALUE * EPSILON : x + MIN_VALUE\n }\n if(y === +1 / 0){\n y = +MAX_VALUE\n }\n var b = x + (y - x) / 2\n if(x < b && b < y){\n y = b;\n }\n var c = (y + x) / 2\n if(x < c && c < y){\n y = c;\n }\n return y === 0 ? -0 : y\n }else{\n var factor = $B.rich_comp('__lt__', x, 0) ? 1 - EPSILON / 2 :\n 1 + EPSILON\n var y = $B.rich_op(\"__mul__\", x , factor)\n if(y == x){\n y = MIN_VALUE * EPSILON > 0 ?\n $B.rich_op('__add__', x, MIN_VALUE * EPSILON) :\n $B.rich_op('__add__', x, MIN_VALUE)\n }\n if(y === +1 / 0){\n y = +MAX_VALUE\n }\n var y_minus_x = $B.rich_op('__sub__', y, x)\n var z = $B.rich_op('__truediv__', y_minus_x, 2) // (y - x) / 2\n\n var b = $B.rich_op('__add__', x, z)\n if($B.rich_comp('__lt__', x, b) && $B.rich_comp('__lt__', b, y)){\n y = b;\n }\n var c = $B.rich_op('__truediv__', $B.rich_op('__add__', y, x), 2)\n if($B.rich_comp('__lt__', x, c) && $B.rich_comp('__lt__', c, y)){\n y = c;\n }\n return y === 0 ? -0 : y\n }\n}\n\nfunction gcd2(a, b){\n // GCD of 2 factors\n if($B.rich_comp(\"__gt__\", b, a)){\n var temp = a\n a = b\n b = temp\n }\n while(true){\n if(b == 0){\n return a\n }\n a = $B.rich_op(\"__mod__\", a, b)\n if(a == 0){\n return b\n }\n b = $B.rich_op(\"__mod__\", b, a)\n }\n}\n\nconst LANCZOS_N = 13,\n lanczos_g = 6.024680040776729583740234375,\n lanczos_g_minus_half = 5.524680040776729583740234375,\n lanczos_num_coeffs = [\n 23531376880.410759688572007674451636754734846804940,\n 42919803642.649098768957899047001988850926355848959,\n 35711959237.355668049440185451547166705960488635843,\n 17921034426.037209699919755754458931112671403265390,\n 6039542586.3520280050642916443072979210699388420708,\n 1439720407.3117216736632230727949123939715485786772,\n 248874557.86205415651146038641322942321632125127801,\n 31426415.585400194380614231628318205362874684987640,\n 2876370.6289353724412254090516208496135991145378768,\n 186056.26539522349504029498971604569928220784236328,\n 8071.6720023658162106380029022722506138218516325024,\n 210.82427775157934587250973392071336271166969580291,\n 2.5066282746310002701649081771338373386264310793408\n ],\n /* denominator is x*(x+1)*...*(x+LANCZOS_N-2) */\n lanczos_den_coeffs = [\n 0.0, 39916800.0, 120543840.0, 150917976.0, 105258076.0, 45995730.0,\n 13339535.0, 2637558.0, 357423.0, 32670.0, 1925.0, 66.0, 1.0],\n /* gamma values for small positive integers, 1 though NGAMMA_INTEGRAL */\n NGAMMA_INTEGRAL = 23,\n gamma_integral = [\n 1.0, 1.0, 2.0, 6.0, 24.0, 120.0, 720.0, 5040.0, 40320.0, 362880.0,\n 3628800.0, 39916800.0, 479001600.0, 6227020800.0, 87178291200.0,\n 1307674368000.0, 20922789888000.0, 355687428096000.0,\n 6402373705728000.0, 121645100408832000.0, 2432902008176640000.0,\n 51090942171709440000.0, 1124000727777607680000.0]\n\n/* Lanczos' sum L_g(x), for positive x */\nfunction lanczos_sum(x){\n var num = 0.0,\n den = 0.0,\n i\n /* evaluate the rational function lanczos_sum(x). For large\n x, the obvious algorithm risks overflow, so we instead\n rescale the denominator and numerator of the rational\n function by x**(1-LANCZOS_N) and treat this as a\n rational function in 1/x. This also reduces the error for\n larger x values. The choice of cutoff point (5.0 below) is\n somewhat arbitrary; in tests, smaller cutoff values than\n this resulted in lower accuracy. */\n if (x < 5.0) {\n for (i = LANCZOS_N; --i >= 0; ) {\n num = num * x + lanczos_num_coeffs[i];\n den = den * x + lanczos_den_coeffs[i];\n }\n }else{\n for (i = 0; i < LANCZOS_N; i++) {\n num = num / x + lanczos_num_coeffs[i];\n den = den / x + lanczos_den_coeffs[i];\n }\n }\n return num/den;\n}\n\nfunction m_sinpi(x){\n // x is float\n // returns a float\n var r,\n y = fmod(fabs(x), 2.0), // float\n n = _b_.round($B.fast_float(2.0 * y.value)) // int\n switch(n){\n case 0:\n r = sin(pi.value * y.value);\n break;\n case 1:\n r = cos(pi.value * (y.value - 0.5));\n break;\n case 2:\n /* N.B. -sin(pi*(y-1.0)) is *not* equivalent: it would give\n -0.0 instead of 0.0 when y == 1.0. */\n r = sin(pi.value * (1.0 - y.value));\n break;\n case 3:\n r = _b_.float.__neg__(cos(pi.value *(y.value - 1.5)))\n break;\n case 4:\n r = sin(pi.value * (y.value - 2.0));\n break;\n }\n return $B.fast_float(copysign(1.0, x).value * r.value);\n}\n\n/*\n lgamma: natural log of the absolute value of the Gamma function.\n For large arguments, Lanczos' formula works extremely well here.\n*/\nfunction m_lgamma(x){\n var r,\n absx\n\n /* special cases */\n if(! isfinite(x)){\n if(isnan(x)){\n return x; /* lgamma(nan) = nan */\n }else{\n return $B.fast_float(Number.POSITIVE_INFINITY); /* lgamma(+-inf) = +inf */\n }\n }\n\n /* integer arguments */\n var x1 = float_check(x)\n if(Number.isInteger(x1) && x1 <= 2.0){\n if(x1 <= 0.0){\n value_error()\n }else{\n return $B.fast_float(0.0); /* lgamma(1) = lgamma(2) = 0.0 */\n }\n }\n\n absx = fabs(x)\n /* tiny arguments: lgamma(x) ~ -log(fabs(x)) for small x */\n if (absx.value < 1e-20){\n return $B.fast_float(-log(absx).value);\n }\n /* Lanczos' formula. We could save a fraction of a ulp in accuracy by\n having a second set of numerator coefficients for lanczos_sum that\n absorbed the exp(-lanczos_g) term, and throwing out the lanczos_g\n subtraction below; it's probably not worth it. */\n var lsum = $B.fast_float(lanczos_sum(absx.value))\n r = log(lsum).value - lanczos_g;\n r += (absx.value - 0.5) *\n (log($B.fast_float(absx.value + lanczos_g - 0.5)).value - 1)\n if (x1 < 0.0){\n /* Use reflection formula to get value for negative x. */\n r = logpi - log(fabs(m_sinpi(absx))).value - log(absx).value - r\n }\n r = $B.fast_float(r)\n if(isinf(r)){\n overflow()\n }\n return r;\n}\n\nfunction acos(x){\n $B.check_nb_args('acos', 1, arguments)\n $B.check_no_kw('acos', x)\n if(_mod.isinf(x)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }else if(_mod.isnan(x)){\n return _mod.nan\n }else{\n x = float_check(x)\n if(x > 1 || x < -1){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return _b_.float.$factory(Math.acos(x))\n }\n}\n\nfunction acosh(x){\n $B.check_nb_args('acosh', 1, arguments)\n $B.check_no_kw('acosh', x)\n\n if(_b_.float.$funcs.isinf(x)){\n if(_b_.float.$funcs.isninf(x)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return _mod.inf\n }else if(_mod.isnan(x)){\n return _mod.nan\n }\n var y = float_check(x)\n if(y <= 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if(y > Math.pow(2, 28)){ // issue 1590\n return _b_.float.$factory(_mod.log(y).value + _mod.log(2).value)\n }\n return _b_.float.$factory(Math.log(y + Math.sqrt(y * y - 1)))\n}\n\nfunction asin(x){\n $B.check_nb_args('asin', 1, arguments)\n $B.check_no_kw('asin', x)\n if(_mod.isinf(x)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }else if(_mod.isnan(x)){\n return _mod.nan\n }else{\n x = float_check(x)\n if(x > 1 || x < -1){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return _b_.float.$factory(Math.asin(x))\n }\n}\n\nfunction asinh(x){\n $B.check_nb_args('asinh', 1, arguments)\n $B.check_no_kw('asinh', x)\n\n var y = float_check(x)\n if(_b_.float.$funcs.isninf(x)){\n return NINF\n }else if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n if(y == 0 && 1 / y === -Infinity){\n return $B.fast_float(-0.0)\n }\n return _b_.float.$factory(Math.asinh(y))\n}\n\nfunction atan(x){\n $B.check_nb_args('atan', 1, arguments)\n $B.check_no_kw('atan', x)\n\n if(_b_.float.$funcs.isninf(x)){return _b_.float.$factory(-Math.PI / 2)}\n if(_b_.float.$funcs.isinf(x)){return _b_.float.$factory(Math.PI / 2)}\n return _b_.float.$factory(Math.atan(float_check(x)))\n}\n\nfunction atan2(x, y){\n $B.check_nb_args('atan2', 2, arguments)\n $B.check_no_kw('atan2', x, y)\n\n return _b_.float.$factory(Math.atan2(float_check(x), float_check(y)))\n}\n\nfunction atanh(x){\n $B.check_nb_args('atanh', 1, arguments)\n $B.check_no_kw('atanh', x)\n if(_b_.float.$funcs.isinf(x)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n var y = float_check(x)\n if(y == 0){\n return 0\n }else if(y <= -1 || y >= 1){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return _b_.float.$factory(0.5 * Math.log((1 / y + 1)/(1 / y - 1)));\n}\n\nfunction cbrt(x){\n // Cubic root\n $B.check_nb_args('cbrt ', 1, arguments)\n $B.check_no_kw('cbrt ', x)\n\n var y = float_check(x)\n if(_b_.float.$funcs.isninf(x)){\n return NINF\n }else if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n var _r = $B.fast_float(Math.cbrt(y))\n if(_b_.float.$funcs.isinf(_r)){\n throw _b_.OverflowError.$factory(\"math range error\")\n }\n return _r\n}\n\nfunction ceil(x){\n $B.check_nb_args('ceil', 1, arguments)\n $B.check_no_kw('ceil', x)\n\n var res\n\n if($B.$isinstance(x, _b_.float)){\n if(_b_.float.$funcs.isinf(x)){\n throw _b_.OverflowError.$factory(\n \"cannot convert float infinity to integer\")\n }else if(_mod.isnan(x)){\n throw _b_.OverflowError.$factory(\n \"cannot convert float NaN to integer\")\n }\n }\n\n var klass = x.__class__ || $B.get_class(x)\n\n try{\n // Use attribute of the object's class, not of the object\n // itself (special method)\n return $B.$call($B.$getattr(klass, '__ceil__'))(x)\n }catch(err){\n if(! $B.is_exc(err, [_b_.AttributeError])){\n throw err\n }\n }\n\n try{\n x = $B.$call($B.$getattr(klass, '__float__'))(x)\n }catch(err){\n if(! $B.is_exc(err, [_b_.AttributeError])){\n throw err\n }else{\n throw _b_.TypeError.$factory(\"must be real number, not \" +\n $B.class_name(x))\n }\n }\n return _mod.ceil(x)\n}\n\nconst ULLONG_MAX = 2n ** 64n - 1n,\n LONG_MAX = 2147483647,\n LONG_MIN = -2147483647,\n LLONG_MAX = 9223372036854775807n,\n LLONG_MIN = -9223372036854775807n,\n p2_64 = 2n ** 64n\n\nconst reduced_factorial_odd_part = [\n 0x0000000000000001n, 0x0000000000000001n, 0x0000000000000001n, 0x0000000000000003n,\n 0x0000000000000003n, 0x000000000000000fn, 0x000000000000002dn, 0x000000000000013bn,\n 0x000000000000013bn, 0x0000000000000b13n, 0x000000000000375fn, 0x0000000000026115n,\n 0x000000000007233fn, 0x00000000005cca33n, 0x0000000002898765n, 0x00000000260eeeebn,\n 0x00000000260eeeebn, 0x0000000286fddd9bn, 0x00000016beecca73n, 0x000001b02b930689n,\n 0x00000870d9df20adn, 0x0000b141df4dae31n, 0x00079dd498567c1bn, 0x00af2e19afc5266dn,\n 0x020d8a4d0f4f7347n, 0x335281867ec241efn, 0x9b3093d46fdd5923n, 0x5e1f9767cc5866b1n,\n 0x92dd23d6966aced7n, 0xa30d0f4f0a196e5bn, 0x8dc3e5a1977d7755n, 0x2ab8ce915831734bn,\n 0x2ab8ce915831734bn, 0x81d2a0bc5e5fdcabn, 0x9efcac82445da75bn, 0xbc8b95cf58cde171n,\n 0xa0e8444a1f3cecf9n, 0x4191deb683ce3ffdn, 0xddd3878bc84ebfc7n, 0xcb39a64b83ff3751n,\n 0xf8203f7993fc1495n, 0xbd2a2a78b35f4bddn, 0x84757be6b6d13921n, 0x3fbbcfc0b524988bn,\n 0xbd11ed47c8928df9n, 0x3c26b59e41c2f4c5n, 0x677a5137e883fdb3n, 0xff74e943b03b93ddn,\n 0xfe5ebbcb10b2bb97n, 0xb021f1de3235e7e7n, 0x33509eb2e743a58fn, 0x390f9da41279fb7dn,\n 0xe5cb0154f031c559n, 0x93074695ba4ddb6dn, 0x81c471caa636247fn, 0xe1347289b5a1d749n,\n 0x286f21c3f76ce2ffn, 0x00be84a2173e8ac7n, 0x1595065ca215b88bn, 0xf95877595b018809n,\n 0x9c2efe3c5516f887n, 0x373294604679382bn, 0xaf1ff7a888adcd35n, 0x18ddf279a2c5800bn,\n 0x18ddf279a2c5800bn, 0x505a90e2542582cbn, 0x5bacad2cd8d5dc2bn, 0xfe3152bcbff89f41n,\n 0xe1467e88bf829351n, 0xb8001adb9e31b4d5n, 0x2803ac06a0cbb91fn, 0x1904b5d698805799n,\n 0xe12a648b5c831461n, 0x3516abbd6160cfa9n, 0xac46d25f12fe036dn, 0x78bfa1da906b00efn,\n 0xf6390338b7f111bdn, 0x0f25f80f538255d9n, 0x4ec8ca55b8db140fn, 0x4ff670740b9b30a1n,\n 0x8fd032443a07f325n, 0x80dfe7965c83eeb5n, 0xa3dc1714d1213afdn, 0x205b7bbfcdc62007n,\n 0xa78126bbe140a093n, 0x9de1dc61ca7550cfn, 0x84f0046d01b492c5n, 0x2d91810b945de0f3n,\n 0xf5408b7f6008aa71n, 0x43707f4863034149n, 0xdac65fb9679279d5n, 0xc48406e7d1114eb7n,\n 0xa7dc9ed3c88e1271n, 0xfb25b2efdb9cb30dn, 0x1bebda0951c4df63n, 0x5c85e975580ee5bdn,\n 0x1591bc60082cb137n, 0x2c38606318ef25d7n, 0x76ca72f7c5c63e27n, 0xf04a75d17baa0915n,\n 0x77458175139ae30dn, 0x0e6c1330bc1b9421n, 0xdf87d2b5797e8293n, 0xefa5c703e1e68925n,\n 0x2b6b1b3278b4f6e1n, 0xceee27b382394249n, 0xd74e3829f5dab91dn, 0xfdb17989c26b5f1fn,\n 0xc1b7d18781530845n, 0x7b4436b2105a8561n, 0x7ba7c0418372a7d7n, 0x9dbc5c67feb6c639n,\n 0x502686d7f6ff6b8fn, 0x6101855406be7a1fn, 0x9956afb5806930e7n, 0xe1f0ee88af40f7c5n,\n 0x984b057bda5c1151n, 0x9a49819acc13ea05n, 0x8ef0dead0896ef27n, 0x71f7826efe292b21n,\n 0xad80a480e46986efn, 0x01cdc0ebf5e0c6f7n, 0x6e06f839968f68dbn, 0xdd5943ab56e76139n,\n 0xcdcf31bf8604c5e7n, 0x7e2b4a847054a1cbn, 0x0ca75697a4d3d0f5n, 0x4703f53ac514a98bn,\n];\n\nconst inverted_factorial_odd_part = [\n 0x0000000000000001n, 0x0000000000000001n, 0x0000000000000001n, 0xaaaaaaaaaaaaaaabn,\n 0xaaaaaaaaaaaaaaabn, 0xeeeeeeeeeeeeeeefn, 0x4fa4fa4fa4fa4fa5n, 0x2ff2ff2ff2ff2ff3n,\n 0x2ff2ff2ff2ff2ff3n, 0x938cc70553e3771bn, 0xb71c27cddd93e49fn, 0xb38e3229fcdee63dn,\n 0xe684bb63544a4cbfn, 0xc2f684917ca340fbn, 0xf747c9cba417526dn, 0xbb26eb51d7bd49c3n,\n 0xbb26eb51d7bd49c3n, 0xb0a7efb985294093n, 0xbe4b8c69f259eabbn, 0x6854d17ed6dc4fb9n,\n 0xe1aa904c915f4325n, 0x3b8206df131cead1n, 0x79c6009fea76fe13n, 0xd8c5d381633cd365n,\n 0x4841f12b21144677n, 0x4a91ff68200b0d0fn, 0x8f9513a58c4f9e8bn, 0x2b3e690621a42251n,\n 0x4f520f00e03c04e7n, 0x2edf84ee600211d3n, 0xadcaa2764aaacdfdn, 0x161f4f9033f4fe63n,\n 0x161f4f9033f4fe63n, 0xbada2932ea4d3e03n, 0xcec189f3efaa30d3n, 0xf7475bb68330bf91n,\n 0x37eb7bf7d5b01549n, 0x46b35660a4e91555n, 0xa567c12d81f151f7n, 0x4c724007bb2071b1n,\n 0x0f4a0cce58a016bdn, 0xfa21068e66106475n, 0x244ab72b5a318ae1n, 0x366ce67e080d0f23n,\n 0xd666fdae5dd2a449n, 0xd740ddd0acc06a0dn, 0xb050bbbb28e6f97bn, 0x70b003fe890a5c75n,\n 0xd03aabff83037427n, 0x13ec4ca72c783bd7n, 0x90282c06afdbd96fn, 0x4414ddb9db4a95d5n,\n 0xa2c68735ae6832e9n, 0xbf72d71455676665n, 0xa8469fab6b759b7fn, 0xc1e55b56e606caf9n,\n 0x40455630fc4a1cffn, 0x0120a7b0046d16f7n, 0xa7c3553b08faef23n, 0x9f0bfd1b08d48639n,\n 0xa433ffce9a304d37n, 0xa22ad1d53915c683n, 0xcb6cbc723ba5dd1dn, 0x547fb1b8ab9d0ba3n,\n 0x547fb1b8ab9d0ba3n, 0x8f15a826498852e3n, 0x32e1a03f38880283n, 0x3de4cce63283f0c1n,\n 0x5dfe6667e4da95b1n, 0xfda6eeeef479e47dn, 0xf14de991cc7882dfn, 0xe68db79247630ca9n,\n 0xa7d6db8207ee8fa1n, 0x255e1f0fcf034499n, 0xc9a8990e43dd7e65n, 0x3279b6f289702e0fn,\n 0xe7b5905d9b71b195n, 0x03025ba41ff0da69n, 0xb7df3d6d3be55aefn, 0xf89b212ebff2b361n,\n 0xfe856d095996f0adn, 0xd6e533e9fdf20f9dn, 0xf8c0e84a63da3255n, 0xa677876cd91b4db7n,\n 0x07ed4f97780d7d9bn, 0x90a8705f258db62fn, 0xa41bbb2be31b1c0dn, 0x6ec28690b038383bn,\n 0xdb860c3bb2edd691n, 0x0838286838a980f9n, 0x558417a74b36f77dn, 0x71779afc3646ef07n,\n 0x743cda377ccb6e91n, 0x7fdf9f3fe89153c5n, 0xdc97d25df49b9a4bn, 0x76321a778eb37d95n,\n 0x7cbb5e27da3bd487n, 0x9cff4ade1a009de7n, 0x70eb166d05c15197n, 0xdcf0460b71d5fe3dn,\n 0x5ac1ee5260b6a3c5n, 0xc922dedfdd78efe1n, 0xe5d381dc3b8eeb9bn, 0xd57e5347bafc6aadn,\n 0x86939040983acd21n, 0x395b9d69740a4ff9n, 0x1467299c8e43d135n, 0x5fe440fcad975cdfn,\n 0xcaa9a39794a6ca8dn, 0xf61dbd640868dea1n, 0xac09d98d74843be7n, 0x2b103b9e1a6b4809n,\n 0x2ab92d16960f536fn, 0x6653323d5e3681dfn, 0xefd48c1c0624e2d7n, 0xa496fefe04816f0dn,\n 0x1754a7b07bbdd7b1n, 0x23353c829a3852cdn, 0xbf831261abd59097n, 0x57a8e656df0618e1n,\n 0x16e9206c3100680fn, 0xadad4c6ee921dac7n, 0x635f2b3860265353n, 0xdd6d0059f44b3d09n,\n 0xac4dd6b894447dd7n, 0x42ea183eeaa87be3n, 0x15612d1550ee5b5dn, 0x226fa19d656cb623n,\n]\n\nconst factorial_trailing_zeros = [\n 0, 0, 1, 1, 3, 3, 4, 4, 7, 7, 8, 8, 10, 10, 11, 11, // 0-15\n 15, 15, 16, 16, 18, 18, 19, 19, 22, 22, 23, 23, 25, 25, 26, 26, // 16-31\n 31, 31, 32, 32, 34, 34, 35, 35, 38, 38, 39, 39, 41, 41, 42, 42, // 32-47\n 46, 46, 47, 47, 49, 49, 50, 50, 53, 53, 54, 54, 56, 56, 57, 57, // 48-63\n 63, 63, 64, 64, 66, 66, 67, 67, 70, 70, 71, 71, 73, 73, 74, 74, // 64-79\n 78, 78, 79, 79, 81, 81, 82, 82, 85, 85, 86, 86, 88, 88, 89, 89, // 80-95\n 94, 94, 95, 95, 97, 97, 98, 98, 101, 101, 102, 102, 104, 104, 105, 105, // 96-111\n 109, 109, 110, 110, 112, 112, 113, 113, 116, 116, 117, 117, 119, 119, 120, 120, // 112-127\n].map(BigInt)\n\nconst NULL = undefined\n\n/* Calculate C(n, k) for n in the 63-bit range. */\n\nfunction perm_comb_small(n, k, iscomb){\n if(k == 0){\n return 1n\n }\n\n /* For small enough n and k the result fits in the 64-bit range and can\n * be calculated without allocating intermediate PyLong objects. */\n if(iscomb){\n /* Maps k to the maximal n so that 2*k-1 <= n <= 127 and C(n, k)\n * fits into a uint64_t. Exclude k = 1, because the second fast\n * path is faster for this case.*/\n var fast_comb_limits1 = [\n 0, 0, 127, 127, 127, 127, 127, 127, // 0-7\n 127, 127, 127, 127, 127, 127, 127, 127, // 8-15\n 116, 105, 97, 91, 86, 82, 78, 76, // 16-23\n 74, 72, 71, 70, 69, 68, 68, 67, // 24-31\n 67, 67, 67 // 32-34\n ];\n if(k < fast_comb_limits1.length && n <= fast_comb_limits1[k]){\n /*\n comb(n, k) fits into a uint64_t. We compute it as\n comb_odd_part << shift\n where 2**shift is the largest power of two dividing comb(n, k)\n and comb_odd_part is comb(n, k) >> shift. comb_odd_part can be\n calculated efficiently via arithmetic modulo 2**64, using three\n lookups and two uint64_t multiplications.\n */\n var comb_odd_part = reduced_factorial_odd_part[n]\n * inverted_factorial_odd_part[k]\n * inverted_factorial_odd_part[n - k];\n comb_odd_part %= p2_64\n var shift = factorial_trailing_zeros[n]\n - factorial_trailing_zeros[k]\n - factorial_trailing_zeros[n - k];\n return comb_odd_part << shift;\n }\n\n /* Maps k to the maximal n so that 2*k-1 <= n <= 127 and C(n, k)*k\n * fits into a long long (which is at least 64 bit). Only contains\n * items larger than in fast_comb_limits1. */\n var fast_comb_limits2 = [\n 0, ULLONG_MAX, 4294967296, 3329022, 102570, 13467, 3612, 1449, // 0-7\n 746, 453, 308, 227, 178, 147 // 8-13\n ];\n if (k < fast_comb_limits2.length && n <= fast_comb_limits2[k]) {\n /* C(n, k) = C(n, k-1) * (n-k+1) / k */\n var result = n,\n i = 1n;\n while(i < k){\n result *= --n;\n result /= ++i;\n }\n return result;\n }\n }else{\n /* Maps k to the maximal n so that k <= n and P(n, k)\n * fits into a long long (which is at least 64 bit). */\n var fast_perm_limits = [\n 0, ULLONG_MAX, 4294967296, 2642246, 65537, 7133, 1627, 568, // 0-7\n 259, 142, 88, 61, 45, 36, 30, 26, // 8-15\n 24, 22, 21, 20, 20 // 16-20\n ];\n if (k < fast_perm_limits.length && n <= fast_perm_limits[k]) {\n if(n <= 127){\n /* P(n, k) fits into a uint64_t. */\n var perm_odd_part = reduced_factorial_odd_part[n]\n * inverted_factorial_odd_part[n - k];\n perm_odd_part %= p2_64\n var shift = factorial_trailing_zeros[n]\n - factorial_trailing_zeros[n - k];\n var res = perm_odd_part << shift\n\n return res;\n }\n\n /* P(n, k) = P(n, k-1) * (n-k+1) */\n var result = n;\n for (var i = 1; i < k; i++) {\n result *= --n;\n }\n return result\n }\n }\n\n /* For larger n use recursive formulas:\n *\n * P(n, k) = P(n, j) * P(n-j, k-j)\n * C(n, k) = C(n, j) * C(n-j, k-j) // C(k, j)\n */\n var j = k / 2n;\n var a = perm_comb_small(n, j, iscomb);\n var b = perm_comb_small(n - j, k - j, iscomb);\n a = a * b;\n if(iscomb){\n b = perm_comb_small(k, j, 1);\n a = a / b;\n }\n return a;\n}\n\n/* Calculate P(n, k) or C(n, k) using recursive formulas.\n * It is more efficient than sequential multiplication thanks to\n * Karatsuba multiplication.\n */\nfunction perm_comb(n, k, iscomb){\n if(k == 0){\n return 1;\n }\n if(k == 1){\n return n;\n }\n\n /* P(n, k) = P(n, j) * P(n-j, k-j) */\n /* C(n, k) = C(n, j) * C(n-j, k-j) // C(k, j) */\n var j = k / 2n\n var a = perm_comb(n, j, iscomb);\n //var t = j\n //n = n - t;\n var b = perm_comb(n - j, k - j, iscomb);\n a = a * b;\n if(iscomb){\n b = perm_comb_small(k, j, 1);\n a = a / b;\n }\n return a;\n}\n\nfunction comb(n, k){\n var $ = $B.args('comb', 2, {n: null, k: null}, ['n', 'k'],\n arguments, {}, null, null),\n n = $.n,\n k = $.k\n\n var result = NULL,\n temp,\n overflow, cmp;\n\n // accept integers or objects with __index__\n n = $B.PyNumber_Index(n)\n k = $B.PyNumber_Index(k)\n\n n = _b_.int.$to_bigint(n);\n k = _b_.int.$to_bigint(k);\n\n if(n < 0){\n throw _b_.ValueError.$factory(\n \"n must be a non-negative integer\");\n }\n if(k < 0){\n throw _b_.ValueError.$factory(\n \"k must be a non-negative integer\");\n }\n\n overflow = n > LLONG_MAX || n < LLONG_MIN\n if(! overflow){\n overflow = k > LLONG_MAX || k < LLONG_MIN\n if (overflow || k > n) {\n result = 0n;\n }else{\n if(n - k < k){\n k = n - k\n }\n if (k > 1) {\n result = perm_comb_small(n, k, 1);\n }\n }\n /* For k == 1 just return the original n in perm_comb(). */\n }else{\n /* k = min(k, n - k) */\n temp = n - k\n if(temp < 0) {\n result = 0n;\n }\n if (temp < k) {\n k = temp\n }\n\n overflow = k > LLONG_MAX || k < LLONG_MIN\n if (overflow) {\n throw _b_.OverflowError.$factory(\n \"min(n - k, k) must not exceed \" +\n LLONG_MAX);\n }\n }\n if(result === undefined){\n result = perm_comb(n, k, 1);\n }\n\n return _b_.int.$int_or_long(result)\n}\n\n\nfunction copysign(x, y){\n $B.check_nb_args_no_kw('copysign', 2, arguments)\n\n var x1 = Math.abs(float_check(x))\n var y1 = float_check(y)\n var sign = Math.sign(y1)\n sign = (sign == 1 || Object.is(sign, +0)) ? 1 : - 1\n return _b_.float.$factory(x1 * sign)\n}\n\nfunction cos(x){\n $B.check_nb_args('cos ', 1, arguments)\n $B.check_no_kw('cos ', x)\n return _b_.float.$factory(Math.cos(float_check(x)))\n}\n\nfunction cosh(x){\n $B.check_nb_args('cosh', 1, arguments)\n $B.check_no_kw('cosh', x)\n\n if(_b_.float.$funcs.isinf(x)){return INF}\n var y = float_check(x)\n if(Math.cosh !== undefined){return _b_.float.$factory(Math.cosh(y))}\n return _b_.float.$factory((Math.pow(Math.E, y) +\n Math.pow(Math.E, -y)) / 2)\n}\n\nfunction degrees(x){\n $B.check_nb_args('degrees', 1, arguments)\n $B.check_no_kw('degrees', x)\n return _b_.float.$factory(float_check(x) * 180 / Math.PI)\n}\n\nfunction dist(p, q){\n $B.check_nb_args_no_kw('dist', 2, arguments)\n\n function test(x){\n if(typeof x === \"number\"){\n return x\n }else if(x.__class__ === _b_.float){\n return x.value\n }\n var y = $B.$getattr(x, '__float__', null)\n if(y === null){\n throw _b_.TypeError.$factory('not a float')\n }\n return $B.$call(y)().value\n }\n\n // build list of differences (as floats) between coordinates of p and q\n var diffs = [],\n diff\n\n if(Array.isArray(p) && Array.isArray(q)){\n // simple case : p and q are lists of tuples\n if(p.length != q.length){\n throw _b_.ValueError.$factory(\"both points must have \" +\n \"the same number of dimensions\")\n }\n p = p.map(test)\n q = q.map(test)\n for(var i = 0, len = p.length; i < len; i++){\n var next_p = p[i],\n next_q = q[i]\n var diff = Math.abs(next_p - next_q)\n diffs.push(diff)\n }\n }else{\n var itp = _b_.iter(p),\n itq = _b_.iter(q),\n res = 0\n\n while(true){\n try{\n var next_p = _b_.next(itp)\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n // check that the other iterator is also exhausted\n try{\n var next_q = _b_.next(itq)\n throw _b_.ValueError.$factory(\"both points must have \" +\n \"the same number of dimensions\")\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n break\n }\n throw err\n }\n }\n throw err\n }\n next_p = test(next_p)\n try{\n var next_q = _b_.next(itq)\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n throw _b_.ValueError.$factory(\"both points must have \" +\n \"the same number of dimensions\")\n }\n throw err\n }\n next_q = test(next_q)\n diff = Math.abs(next_p - next_q)\n diffs.push(diff)\n }\n }\n for(var diff of diffs){\n if(! isFinite(diff) && ! isNaN(diff)){\n return _mod.inf\n }\n }\n for(var diff of diffs){\n if(isNaN(diff)){\n return _mod.nan\n }\n }\n\n var res = 0,\n scale = 1,\n max_diff = Math.max(...diffs),\n min_diff = Math.min(...diffs)\n max_value = Math.sqrt(Number.MAX_VALUE) / p.length,\n min_value = Math.sqrt(Number.MIN_VALUE) * p.length\n if(max_diff > max_value){\n var nb = 0\n while(max_diff > max_value){\n scale *= 2\n max_diff /= 2\n nb++\n }\n for(var diff of diffs){\n diff = diff / scale\n res += diff * diff\n }\n return $B.fast_float(scale * Math.sqrt(res))\n }else if(min_diff !== 0 && min_diff < min_value){\n while(min_diff < min_value){\n scale *= 2\n min_diff *= 2\n }\n for(var diff of diffs){\n diff = diff * scale\n res += diff * diff\n }\n return $B.fast_float(Math.sqrt(res) / scale)\n }else{\n for(var diff of diffs){\n res += Math.pow(diff, 2)\n }\n return $B.fast_float(Math.sqrt(res))\n }\n}\n\nconst e = _b_.float.$factory(Math.E)\n\nconst ERF_SERIES_CUTOFF = 1.5,\n ERF_SERIES_TERMS = 25,\n ERFC_CONTFRAC_CUTOFF = 30.0,\n ERFC_CONTFRAC_TERMS = 50\n\n/*\n Error function, via power series.\n Given a finite float x, return an approximation to erf(x).\n Converges reasonably fast for small x.\n*/\n\nfunction m_erf_series(x){\n var x2, acc, fk, result\n var i\n\n x2 = x * x\n acc = 0.0\n fk = ERF_SERIES_TERMS + 0.5\n for(i = 0; i < ERF_SERIES_TERMS; i++){\n acc = 2.0 + x2 * acc / fk\n fk -= 1.0\n }\n result = acc * x * exp(-x2).value / sqrtpi\n return result\n}\n\nfunction m_erfc_contfrac(x){\n var x2, a, da, p, p_last, q, q_last, b, result;\n var i\n\n if(x >= ERFC_CONTFRAC_CUTOFF){\n return 0.0\n }\n\n x2 = x * x\n a = 0.0\n da = 0.5\n p = 1.0\n p_last = 0.0\n q = da + x2\n q_last = 1.0\n for(i = 0; i < ERFC_CONTFRAC_TERMS; i++){\n var temp\n a += da\n da += 2.0\n b = da + x2\n temp = p; p = b * p - a * p_last; p_last = temp\n temp = q; q = b * q - a * q_last; q_last = temp\n }\n result = p / q * x * exp(-x2).value / sqrtpi\n return result\n}\n\n\nfunction erf(x){\n var absx,\n cf\n var x1 = float_check(x)\n if(isNaN(x1)){\n return x\n }\n absx = fabs(x)\n if(absx.value < ERF_SERIES_CUTOFF){\n return $B.fast_float(m_erf_series(x1))\n }else{\n cf = m_erfc_contfrac(absx.value)\n return $B.fast_float(x1 > 0.0 ? 1.0 - cf : cf - 1.0)\n }\n}\n\nfunction erfc(x){\n\n // inspired from\n // http://stackoverflow.com/questions/457408/is-there-an-easily-available-implementation-of-erf-for-python\n var y = float_check(x)\n var t = 1.0 / (1.0 + 0.5 * Math.abs(y))\n var ans = 1 - t * Math.exp( -y * y - 1.26551223 +\n t * ( 1.00002368 +\n t * ( 0.37409196 +\n t * ( 0.09678418 +\n t * (-0.18628806 +\n t * ( 0.27886807 +\n t * (-1.13520398 +\n t * ( 1.48851587 +\n t * (-0.82215223 +\n t * 0.17087277)))))))))\n if(y >= 0.0){return 1 - ans}\n return 1 + ans\n}\n\nfunction erfc(x){\n $B.check_nb_args_no_kw('erfc', 1, arguments)\n var absx, cf;\n\n var x1 = float_check(x)\n if(isNaN(x1)){\n return x\n }\n absx = fabs(x);\n if(absx.value < ERF_SERIES_CUTOFF){\n return $B.fast_float(1.0 - m_erf_series(x1))\n }else{\n cf = m_erfc_contfrac(absx.value)\n return $B.fast_float(x1 > 0.0 ? cf : 2.0 - cf)\n }\n}\n\nfunction exp(x){\n $B.check_nb_args('exp', 1, arguments)\n $B.check_no_kw('exp', x)\n\n if(_b_.float.$funcs.isninf(x)){\n return _b_.float.$factory(0)\n }\n if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n var _r = Math.exp(float_check(x))\n if(! isNaN(_r) && ! isFinite(_r)){\n throw _b_.OverflowError.$factory(\"math range error\")\n }\n return _b_.float.$factory(_r)\n}\n\nfunction exp2(x){\n return pow(2, x)\n}\n\nfunction expm1(x){\n $B.check_nb_args('expm1', 1, arguments)\n $B.check_no_kw('expm1', x)\n\n if(_b_.float.$funcs.isninf(x)){\n return $B.fast_float(-1)\n }else if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n var _r = Math.expm1(float_check(x))\n if((! isNaN(_r)) && ! isFinite(_r)){\n overflow()\n }\n return $B.fast_float(_r)\n}\n\nfunction fabs(x){\n $B.check_nb_args_no_kw('fabs', 1, arguments)\n return _b_.float.$funcs.fabs(float_check(x)) // located in py_float.js\n}\n\n// factorial implementation, adapted from CPython's mathmodule.c\n\nconst SmallFactorials = [\n 1n, 1n, 2n, 6n, 24n, 120n, 720n, 5040n, 40320n,\n 362880n, 3628800n, 39916800n, 479001600n,\n 6227020800n, 87178291200n, 1307674368000n,\n 20922789888000n, 355687428096000n, 6402373705728000n,\n 121645100408832000n, 2432902008176640000n\n ]\n\nconst SIZEOF_LONG = 4\n\nfunction _Py_bit_length(x){\n const BIT_LENGTH_TABLE = [\n 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,\n 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5\n ]\n var msb = 0;\n while(x >= 32n){\n msb += 6;\n x >>= 6n;\n }\n msb += BIT_LENGTH_TABLE[parseInt(x)];\n return msb\n}\nfunction count_set_bits(n){\n var count = 0n;\n while(n != 0){\n ++count;\n n &= n - 1n; /* clear least significant bit */\n }\n return count;\n}\n\nfunction factorial_partial_product(start, stop, max_bits){\n var midpoint,\n num_operands,\n left,\n right,\n result\n\n /* If the return value will fit an unsigned long, then we can\n * multiply in a tight, fast loop where each multiply is O(1).\n * Compute an upper bound on the number of bits required to store\n * the answer.\n *\n * Storing some integer z requires floor(lg(z))+1 bits, which is\n * conveniently the value returned by bit_length(z). The\n * product x*y will require at most\n * bit_length(x) + bit_length(y) bits to store, based\n * on the idea that lg product = lg x + lg y.\n *\n * We know that stop - 2 is the largest number to be multiplied. From\n * there, we have: bit_length(answer) <= num_operands *\n * bit_length(stop - 2)\n */\n\n num_operands = (stop - start) / 2n;\n max_bits = BigInt(max_bits)\n /* The \"num_operands <= 8 * SIZEOF_LONG\" check guards against the\n * unlikely case of an overflow in num_operands * max_bits. */\n if(num_operands <= 8 * SIZEOF_LONG &&\n num_operands * max_bits <= 8 * SIZEOF_LONG) {\n var j,\n total;\n for (total = start, j = start + 2n; j < stop; j += 2n){\n total *= j;\n }\n return total\n }\n\n /* find midpoint of range(start, stop), rounded up to next odd number. */\n midpoint = (start + num_operands) | 1n;\n left = factorial_partial_product(start, midpoint,\n _Py_bit_length(midpoint - 2n));\n right = factorial_partial_product(midpoint, stop, max_bits);\n result = left * right\n return result;\n}\n\n\nfunction factorial_odd_part(n){\n var i,\n v, lower, upper,\n partial, tmp, inner, outer;\n\n inner = 1n\n outer = inner;\n upper = 3n;\n for (i = BigInt(_Py_bit_length(n)) - 2n; i >= 0; i--) {\n v = n >> i;\n if (v <= 2){\n continue\n }\n lower = upper;\n /* (v + 1) | 1 = least odd integer strictly larger than n / 2**i */\n upper = (v + 1n) | 1n;\n /* Here inner is the product of all odd integers j in the range (0,\n n/2**(i+1)]. The factorial_partial_product call below gives the\n product of all odd integers j in the range (n/2**(i+1), n/2**i]. */\n partial = factorial_partial_product(lower, upper,\n _Py_bit_length(upper-2n));\n /* inner *= partial */\n tmp = inner * partial\n inner = tmp;\n /* Now inner is the product of all odd integers j in the range (0,\n n/2**i], giving the inner product in the formula above. */\n\n /* outer *= inner; */\n tmp = outer * inner\n outer = tmp;\n }\n return outer;\n}\n\nfunction factorial(arg){\n var x,\n two_valuation,\n overflow,\n result,\n odd_part;\n // Check that arg can be converted to an integer, and transform it to\n // a bigint\n x = _b_.int.$to_bigint($B.PyNumber_Index(arg))\n overflow = x > LONG_MAX || x < LONG_MIN\n if(x > LONG_MAX) {\n throw _b_.OverflowError.$factory(\n \"factorial() argument should not exceed \" +\n LONG_MAX)\n }else if(x < 0) {\n throw _b_.ValueError.$factory(\n \"factorial() not defined for negative values\");\n }\n\n /* use lookup table if x is small */\n if (x < SmallFactorials.length){\n return _b_.int.$int_or_long(SmallFactorials[x]);\n }\n /* else express in the form odd_part * 2**two_valuation, and compute as\n odd_part << two_valuation. */\n odd_part = factorial_odd_part(x);\n two_valuation = x - count_set_bits(x);\n return _b_.int.$int_or_long(odd_part << two_valuation);\n}\n\nfunction floor(x){\n $B.check_nb_args_no_kw('floor', 1, arguments)\n\n if(typeof x == \"number\" || x.__class__ === _b_.float){\n return Math.floor(float_check(x))\n }\n var klass = $B.get_class(x)\n try{\n return $B.$call($B.$getattr(klass, \"__floor__\"))(x)\n }catch(err){\n if($B.is_exc(err, [_b_.AttributeError])){\n try{\n var float = $B.$call($B.$getattr(klass, \"__float__\"))(x)\n return floor(float)\n }catch(err){\n if($B.is_exc(err, [_b_.AttributeError])){\n throw _b_.TypeError.$factory(\"no __float__\")\n }\n throw err\n }\n }\n }\n}\n\nfunction fmod(x, y){\n $B.check_nb_args_no_kw('fmod', 2, arguments)\n if($B.$isinstance(x, _b_.float)){\n if(_b_.float.$funcs.isinf(x)){\n throw _b_.ValueError.$factory('math domain error')\n }\n }\n y = float_check(y)\n if(y == 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n return _b_.float.$factory(float_check(x) % float_check(y))\n}\n\nfunction frexp(x){\n $B.check_nb_args_no_kw('frexp', 1, arguments)\n\n var _l = _b_.float.$funcs.frexp(x)\n return _b_.tuple.$factory([_b_.float.$factory(_l[0]), _l[1]])\n}\n\nfunction fsum(x){\n $B.check_nb_args_no_kw('fsum', 1, arguments)\n\n /* Translation into Javascript of the function msum in an Active\n State Cookbook recipe : https://code.activestate.com/recipes/393090/\n by Raymond Hettinger\n */\n var partials = [],\n res = new Number(),\n _it = _b_.iter(x)\n while(true){\n try{\n var x = _b_.next(_it),\n i = 0\n x = float_check(x)\n for(var j = 0, len = partials.length; j < len; j++){\n var y = float_check(partials[j])\n if(Math.abs(x) < Math.abs(y)){\n var z = x\n x = y\n y = z\n }\n var hi = x + y,\n lo = y - (hi - x)\n if(lo){\n partials[i] = lo\n i++\n }\n x = hi\n }\n partials = partials.slice(0, i).concat([x])\n }catch(err){\n if($B.$isinstance(err, _b_.StopIteration)){break}\n throw err\n }\n }\n var res = 0\n for(var i = 0; i < partials.length; i++){\n res += partials[i]\n }\n return $B.fast_float(res)\n}\n\nfunction gamma(x){\n $B.check_nb_args('gamma', 1, arguments)\n $B.check_no_kw('gamma', x)\n var x_as_number = x,\n r,\n y,\n z,\n sqrtpow\n\n /* special cases */\n if($B.$isinstance(x, _b_.float)){\n x_as_number = x.value\n }else if(! $B.$isinstance(x, _b_.int)){\n throw _b_.TypeError.$factory(\"must be real number, not \" +\n $B.class_name(x))\n }\n if(x_as_number === Number.POSITIVE_INFINITY || isNaN(x_as_number)){\n return x\n }else if(x_as_number === Number.NEGATIVE_INFINITY || x_as_number == 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n\n /* integer arguments */\n if(Number.isInteger(x_as_number)){\n if($B.rich_comp('__lt__', x, 0.0)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if($B.rich_comp('__le__', x, NGAMMA_INTEGRAL)){\n return $B.fast_float(gamma_integral[x_as_number - 1])\n }\n }\n var absx = fabs(x)\n\n /* tiny arguments: tgamma(x) ~ 1/x for x near 0 */\n if(absx.value < 1e-20){\n r = 1.0 / x_as_number\n if(r === Infinity || r === -Infinity){\n overflow()\n }\n return $B.fast_float(r)\n }\n\n /* large arguments: assuming IEEE 754 doubles, tgamma(x) overflows for\n x > 200, and underflows to +-0.0 for x < -200, not a negative\n integer. */\n if(absx.value > 200.0){\n if(x_as_number < 0.0){\n return $B.fast_float(0.0 / m_sinpi(x).value);\n }else{\n overflow()\n }\n }\n\n y = absx.value + lanczos_g_minus_half;\n /* compute error in sum */\n if (absx.value > lanczos_g_minus_half) {\n /* note: the correction can be foiled by an optimizing\n compiler that (incorrectly) thinks that an expression like\n a + b - a - b can be optimized to 0.0. This shouldn't\n happen in a standards-conforming compiler. */\n var q = y - absx.value;\n z = q - lanczos_g_minus_half;\n }else{\n var q = y - lanczos_g_minus_half;\n z = q - absx.value;\n }\n z = z * lanczos_g / y;\n if (x_as_number < 0.0) {\n r = -pi.value / m_sinpi(absx).value /\n absx.value * _mod.exp(y).value /\n lanczos_sum(absx.value);\n r -= z * r;\n if(absx.value < 140.0){\n r /= pow(y, absx.value - 0.5).value;\n }else{\n sqrtpow = pow(y, absx.value / 2.0 - 0.25);\n r /= sqrtpow.value;\n r /= sqrtpow.value;\n }\n }else{\n r = lanczos_sum(absx.value) / exp(y).value;\n r += z * r;\n if(absx.value < 140.0){\n r *= pow(y, absx.value - 0.5).value;\n }else{\n sqrtpow = pow(y, absx.value / 2.0 - 0.25);\n r *= sqrtpow.value;\n r *= sqrtpow.value;\n }\n }\n if(r === Number.POSITIVE_INFINITY){\n overflow()\n }\n return $B.fast_float(r);\n}\n\n\n// GCD algorithm. Javascript adaptation of Python script at\n// https://gist.github.com/cmpute/baa545f0c2b6be8b628e9ded3c19f6c1\n// by Jacob Zhong\nfunction bit_length(x){\n return x.toString(2).length\n}\n\n$B.nb_simple_gcd = 0\n\nfunction simple_gcd(a, b){\n /* a fits into a long, so b must too */\n $B.nb_simple_gcd++\n var x = a >= 0 ? a : -a,\n y = b >= 0 ? b : -b\n\n /* usual Euclidean algorithm for longs */\n while (y != 0) {\n t = y;\n y = x % y;\n x = t;\n }\n return x\n}\n\nfunction lgcd(x, y){\n var a, b, c, d\n if(x < y){\n return lgcd(y, x)\n }\n var shift = BigInt(Math.max(Math.floor(bit_length(x) / 64),\n Math.floor(bit_length(y) / 64))),\n xbar = x >> (shift * 64n),\n ybar = y >> (shift * 64n)\n while(y > p2_64){\n [a, b, c, d] = [1n, 0n, 0n, 1n]\n while(ybar + c != 0 && ybar + d != 0){\n q = (xbar + a) / (ybar + c)\n p = (xbar + b) / (ybar + d)\n if(q != p){\n break\n }\n [a, c] = [c, a - q * c]\n [b, d] = [d, b - q * d]\n [xbar, ybar] = [ybar, xbar - q * ybar]\n }\n if(b == 0){\n [x, y] = [y, x % y]\n }else{\n [x, y] = [a * x + b * y, c * x + d * y]\n }\n }\n return simple_gcd(x, y)\n}\n\nfunction xgcd(x, y){\n var xneg = x < 0 ? -1n : 1n,\n yneg = y < 0 ? -1n : 1n,\n last_r,\n last_s,\n last_t,\n q, r, s, t;\n\n [x, y] = [x >= 0 ? x : -x, y >= 0 ? y : -y];\n\n // it's maintained that r = s * x + t * y, last_r = last_s * x + last_t * y\n [last_r, r] = [x, y];\n [last_s, s] = [1n, 0n];\n [last_t, t] = [0n, 1n];\n\n while(r > 0){\n q = last_r / r;\n [last_r, r] = [r, last_r - q * r];\n [last_s, s] = [s, last_s - q * s];\n [last_t, t] = [t, last_t - q * t];\n }\n return [last_r, last_s * xneg, last_t * yneg]\n}\n\nfunction lxgcd(x, y){\n var g, cy, cx,\n s, last_s,\n t, last_t,\n a, b, c, d\n x = x >= 0 ? x : -x\n y = y >= 0 ? y : -y\n\n if(x < y){\n [g, cy, cx] = xgcd(y, x)\n return [g, cx, cy]\n }\n\n var shift = BigInt(Math.max(Math.floor(bit_length(x) / 64),\n Math.floor(bit_length(y) / 64))),\n xbar = x >> (shift * 64n),\n ybar = y >> (shift * 64n);\n\n [last_s, s] = [1n, 0n];\n [last_t, t] = [0n, 1n];\n\n while(y > p2_64){\n [a, b, c, d] = [1n, 0n, 0n, 1n]\n while(ybar + c != 0 && ybar + d != 0){\n q = (xbar + a) / (ybar + c)\n p = (xbar + b) / (ybar + d)\n if(q != p){\n break\n };\n [a, c = c], [a - q * c];\n [b, d = d], [b - q * d];\n [xbar, ybar] = [ybar, xbar - q * ybar];\n }\n if(b == 0){\n q = x / y;\n [x, y] = [y, x % y];\n [last_s, s] = [s, last_s - q * s];\n [last_t, t] = [t, last_t - q * t];\n }else{\n [x, y] = [a * x + b * y, c * x + d * y];\n [last_s, s] = [a * last_s + b * s, c * last_s + d * s];\n [last_t, t] = [a * last_t + b * t, c * last_t + d * t];\n }\n }\n // notice that here x, y could be negative\n [g, cx, cy] = xgcd(x, y)\n\n return [g, cx * last_s + cy * s, cx * last_t + cy * t]\n}\n\nfunction gcd(x, y){\n var $ = $B.args(\"gcd\", 0, {}, [], arguments, {}, 'args', null)\n var args = $.args.map($B.PyNumber_Index)\n if(args.length == 0){\n return 0\n }else if(args.length == 1){\n return _b_.abs(args[0])\n }\n x = _b_.int.$to_bigint(args[0])\n y = _b_.int.$to_bigint(args[1])\n var res = lxgcd(x, y)[0],\n i = 2\n while(i < args.length){\n res = lxgcd(res, _b_.int.$to_bigint(args[i]))[0]\n i++\n }\n return _b_.int.$int_or_long(res)\n}\n\n\nfunction hypot(x, y){\n var $ = $B.args(\"hypot\", 0, {}, [],\n arguments, {}, \"args\", null)\n var args = []\n for(var arg of $.args){\n try{\n args.push(float_check(arg))\n }catch(err){\n if($B.is_exc(err, [_b_.ValueError])){\n throw _b_.TypeError.$factory('must be real number, not ' +\n $B.class_name(arg))\n }\n throw err\n }\n }\n return $B.fast_float(Math.hypot(...args))\n}\n\nvar inf = INF\n\nfunction isclose(){\n var $ = $B.args(\"isclose\",\n 4,\n {a: null, b: null, rel_tol: null, abs_tol: null},\n ['a', 'b', 'rel_tol', 'abs_tol'],\n arguments,\n {rel_tol: $B.fast_float(1e-09),\n abs_tol: $B.fast_float(0.0)},\n '*',\n null)\n var a = float_check($.a),\n b = float_check($.b),\n rel_tol = float_check($.rel_tol),\n abs_tol = float_check($.abs_tol)\n\n if(rel_tol < 0.0 || abs_tol < 0.0){\n throw _b_.ValueError.$factory('tolerances must be non-negative')\n }\n\n if(a == b){\n return _b_.True\n }\n if(_b_.float.$funcs.isinf(a) || _b_.float.$funcs.isinf(b)){\n return a === b\n }\n // isclose(a, b, rel_tol, abs_tol) is the same as\n // abs_diff = abs(a - b)\n // max_ab = max(abs(a), abs(b))\n // abs_diff <= abs_tol or abs_diff / max_ab <= rel_tol\n // This is more correct than in Python docs:\n // \"abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)\"\n // because this fails for Decimal instances, which do not support\n // multiplication by floats\n\n var diff = b - a,\n abs_diff = Math.abs(diff)\n if(abs_diff <= abs_tol){\n return true\n }\n var abs_a = Math.abs(a),\n abs_b = Math.abs(b),\n max_ab = Math.max(abs_a, abs_b)\n return abs_diff / max_ab <= rel_tol\n}\n\nfunction isfinite(x){\n $B.check_nb_args('isfinite', 1, arguments)\n $B.check_no_kw('isfinite', x)\n return isFinite(float_check(x))\n}\n\nfunction isinf(x){\n $B.check_nb_args('isinf', 1, arguments)\n $B.check_no_kw('isinf', x)\n return _b_.float.$funcs.isinf(x)\n}\n\nfunction isnan(x){\n $B.check_nb_args('isnan', 1, arguments)\n $B.check_no_kw('isnan', x)\n return isNaN(float_check(x))\n}\n\nfunction isqrt(x){\n $B.check_nb_args_no_kw('isqrt', 1, arguments)\n\n x = $B.PyNumber_Index(x)\n if($B.rich_comp(\"__lt__\", x, 0)){\n throw _b_.ValueError.$factory(\n \"isqrt() argument must be nonnegative\")\n }\n if(typeof x == \"number\"){\n return Math.floor(Math.sqrt(x))\n }else{ // big integer\n // adapted from code in mathmodule.c\n var n = x.value,\n bit_length = n.toString(2).length,\n c = BigInt(Math.floor((bit_length - 1) / 2)),\n c_bit_length = c.toString(2).length,\n a = 1n,\n d = 0n,\n e\n\n for(var s = BigInt(c_bit_length - 1); s >= 0; s--){\n // Loop invariant: (a-1)**2 < (n >> 2*(c - d)) < (a+1)**2\n e = d\n d = c >> s\n a = (a << d - e - 1n) + (n >> 2n*c - e - d + 1n) / a\n }\n return _b_.int.$int_or_long(a - (a * a > n ? 1n : 0n))\n }\n}\n\nfunction lcm(){\n var $ = $B.args(\"lcm\", 0, {}, [], arguments, {}, 'args', null),\n product = 1\n\n var args = $.args.map($B.PyNumber_Index)\n if(args.length == 0){\n return 1\n }else if(args.length == 1){\n return _b_.abs(args[0])\n }\n var a = _b_.abs(args[0]),\n b,\n product, gcd\n for(var i = 0, len = args.length; i < len; i++){\n b = _b_.abs(args[i])\n if(b == 0){\n return 0\n }\n gcd = gcd2(a, b)\n product = $B.rich_op('__mul__', a, b)\n a = $B.$getattr(product, \"__floordiv__\")(gcd)\n }\n return a\n}\n\nfunction ldexp(x, i){\n $B.check_nb_args('ldexp', 2, arguments)\n $B.check_no_kw('ldexp', x, i)\n return _b_.float.$funcs.ldexp(x, i) // in py_float.js\n}\n\nfunction lgamma(x){\n $B.check_nb_args('lgamma', 1, arguments)\n $B.check_no_kw('lgamma', x)\n\n return m_lgamma(x)\n}\n\nfunction longint_mant_exp(long_int){\n // Returns mantissa and exponent of a long integer\n var value = long_int.value,\n exp = value.toString(2).length,\n exp1 = exp,\n nb = 0n\n // 2 ** exp is infinite if n > 1023\n var nb = Math.floor(exp / 1023),\n exp1 = BigInt(exp - 1023 * nb)\n nb = BigInt(nb)\n var reduced_value = long_int.value / 2n ** (nb * 1023n)\n var mant = Number(reduced_value) / Number(2n ** exp1)\n return [mant, exp]\n}\n\nvar log10_func = Math.log10 || (x => Math.log(x) / Math.log(10)),\n log2_func = Math.log2 || (x => Math.log(x) / Math.log(2))\n\nfunction log(x, base){\n var $ = $B.args(\"log\", 2, {x: null, base: null}, ['x', 'base'],\n arguments, {base: _b_.None}, null, null),\n x = $.x,\n base = $.base\n if(base == 10){\n return log10(x)\n }else if(base == 2){\n return log2(x)\n }\n var log\n if($B.$isinstance(x, $B.long_int)){\n if(x.value <= 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n var mant_exp = longint_mant_exp(x)\n log = Math.log(mant_exp[0]) + Math.log(2) * mant_exp[1]\n }else if($B.$isinstance(x, _b_.int)){\n x = _b_.int.$int_value(x)\n if(x <= 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n log = Math.log(x)\n }else{\n var x1 = float_check(x)\n if(x1 <= 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n log = Math.log(x1)\n }\n if(x1 <= 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if(base === _b_.None){\n return $B.fast_float(log)\n }\n var denom = _mod.log(base).value\n if(denom == 0){\n throw _b_.ZeroDivisionError.$factory('float division by zero')\n }\n return $B.fast_float(log / denom)\n}\n\nfunction log1p(x){\n $B.check_nb_args('log1p', 1, arguments)\n $B.check_no_kw('log1p', x)\n if($B.$isinstance(x, $B.long_int)){\n if($B.long_int.bit_length(x) > 1024){\n throw _b_.OverflowError.$factory(\n \"int too large to convert to float\")\n }\n x = $B.long_int.$log2($B.fast_long_int(x.value + 1n))\n return $B.fast_float(Number(x.value) * Math.LN2)\n }\n x = float_check(x)\n if(x + 1 <= 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return $B.fast_float(Math.log1p(x))\n}\n\nfunction log2(x){\n $B.check_nb_args('log2', 1, arguments)\n $B.check_no_kw('log2', x)\n var log2_func = Math.log2 || (x => Math.log(x) / Math.LN2)\n if($B.$isinstance(x, $B.long_int)){\n if(x.value <= 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n var mant_exp = longint_mant_exp(x)\n return $B.fast_float(log2_func(mant_exp[0]) + mant_exp[1])\n }\n if(_b_.float.$funcs.isninf(x)){\n throw _b_.ValueError.$factory('')\n }\n x = float_check(x)\n if(x == 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if(isNaN(x)){\n return _b_.float.$factory('nan')\n }\n if(x < 0.0){\n throw _b_.ValueError.$factory('math domain error')\n }\n return $B.fast_float(log2_func(x))\n}\n\nfunction log10(x){\n $B.check_nb_args('log10', 1, arguments)\n $B.check_no_kw('log10', x)\n if($B.$isinstance(x, $B.long_int)){\n return $B.fast_float($B.long_int.$log10(x).value)\n }\n x = float_check(x)\n if(x <= 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return $B.fast_float(Math.log10(x))\n}\n\nfunction modf(x){\n $B.check_nb_args('modf', 1, arguments)\n $B.check_no_kw('modf', x)\n\n if(_b_.float.$funcs.isninf(x)){\n return _b_.tuple.$factory([0.0, NINF])\n }\n if(_b_.float.$funcs.isinf(x)){\n return _b_.tuple.$factory([0.0, INF])\n }\n var x1 = float_check(x)\n\n if(isNaN(x1)){\n return _b_.tuple.$factory([_b_.float.$factory('nan'),\n _b_.float.$factory('nan')])\n }\n\n if(x1 > 0){\n var i = _b_.float.$factory(x1 - Math.floor(x1))\n return _b_.tuple.$factory([i, _b_.float.$factory(x1 - i.value)])\n }\n\n var x2 = Math.ceil(x1)\n var i = _b_.float.$factory(x1 - x2)\n return _b_.tuple.$factory([i, _b_.float.$factory(x2)])\n}\n\nvar nan = _b_.float.$factory('nan')\n\nfunction _nextafter(x, y){\n // always returns a Javascript number\n if($B.rich_comp('__lt__', y, x)){\n var nu = nextUp($B.rich_op('__mul__', -1, x))\n return -nu\n }else if($B.rich_comp('__gt__', y, x)){\n return nextUp(x)\n }else{\n var res = x !== x ? x : y\n res = typeof res == 'number' ? res : res.value\n return res\n }\n}\n\nfunction make_float(x){\n return typeof x == 'number' ? $B.fast_float(x) : x\n}\n\nfunction make_number(x){\n return typeof x == 'number' ? x : x.value\n}\n\nfunction doubleToByteArray(number) {\n // adapted from https://stackoverflow.com/questions/\n // 25942516/double-to-byte-array-conversion-in-javascript\n var buffer = new ArrayBuffer(8); // JS numbers are 8 bytes long, or 64 bits\n var longNum = new Float64Array(buffer); // so equivalent to Float64\n\n longNum[0] = number;\n\n return Array.from(new Uint8Array(buffer)).reverse(); // reverse to get little endian\n}\n\nfunction byteArrayToDouble(bytearray) {\n // adapted from https://stackoverflow.com/questions/\n // 42699162/javascript-convert-array-of-4-bytes-into-a-float-value-from-modbustcp-read\n // Create a buffer\n var buf = new ArrayBuffer(8);\n // Create a data view of it\n var view = new DataView(buf);\n\n // set bytes\n bytearray.forEach(function (b, i) {\n view.setUint8(i, b);\n });\n\n // Read the bits as a float\n var num = view.getFloat64(0);\n // Done\n return num\n}\n\nfunction addSteps(array, steps){\n // convert to BigInt, avoids issue when steps >= 2 ** 32\n if(steps.__class__ == $B.long_int){\n steps = steps.value\n }else{\n steps = BigInt(steps)\n }\n var positive = steps > 0n\n if(steps < 0n){\n steps = -steps\n }\n var x1 = steps >> 32n,\n x2 = steps - x1 * 2n ** 32n\n var buffer = new ArrayBuffer(8)\n var longStep = new BigInt64Array(buffer)\n longStep[0] = steps\n var stepArray = Array.from(new Uint8Array(buffer)).reverse()\n if(positive){\n var carry = 0\n for(var i = 7; i >= 0; i--){\n array[i] += stepArray[i] + carry\n if(array[i] > 255){\n carry = 1\n array[i] -= 256\n }else{\n carry = 0\n }\n }\n }else{\n var carry = 0\n for(var i = 7; i >= 0; i--){\n array[i] -= stepArray[i] - carry\n if(array[i] < 0){\n carry = -1\n array[i] += 256\n }else{\n carry = 0\n }\n }\n }\n}\n\nfunction nextafter(){\n var $ = $B.args(\"nextafter\", 3, {x: null, y: null, steps: null},\n ['x', 'y', 'steps'], arguments, {steps: _b_.None}, null, null),\n x = $.x,\n y = $.y,\n steps = $.steps\n if(! $B.$isinstance(x, [_b_.int, _b_.float])){\n throw _b_.TypeError.$factory('must be a real number, not ' +\n $B.class_name(x))\n }\n if(! $B.$isinstance(y, [_b_.int, _b_.float])){\n throw _b_.TypeError.$factory('must be a real number, not ' +\n $B.class_name(y))\n }\n if(isnan(x)){\n return make_float(x)\n }\n if(isnan(y)){\n return make_float(y)\n }\n if(steps === _b_.None){\n return $B.fast_float(_nextafter(x, y))\n }\n steps = $B.PyNumber_Index(steps);\n if(steps < 0) {\n throw _b_.ValueError.$factory(\n \"steps must be a non-negative integer\");\n }\n if(steps == 0){\n return make_float(x)\n }\n if(isnan(x)){\n return make_float(x)\n }\n if(isnan(y)){\n return make_float(y)\n }\n var x1 = make_number(x),\n y1 = make_number(y)\n\n if(y1 == x1){\n return make_float(y)\n }else if(y1 > x1){\n var x_uint64 = doubleToByteArray(x1)\n addSteps(x_uint64, steps)\n var res = byteArrayToDouble(x_uint64)\n return res >= y1 ? y : make_float(res)\n }else{\n var x_uint64 = doubleToByteArray(x1)\n addSteps(x_uint64, -steps)\n var res = byteArrayToDouble(x_uint64)\n return res <= y1 ? y : make_float(res)\n }\n}\n\nfunction perm(n, k){\n var $ = $B.args(\"perm\", 2, {n: null, k: null}, ['n', 'k'],\n arguments, {k: _b_.None}, null, null),\n n = $.n,\n k = $.k\n\n if(k === _b_.None){\n check_int(n)\n return _mod.factorial(n)\n }\n // raise TypeError if n or k is not an integer\n n = $B.PyNumber_Index(n)\n k = $B.PyNumber_Index(k)\n\n // transform to Javascript BigInt\n var n1 = _b_.int.$to_bigint(n),\n k1 = _b_.int.$to_bigint(k);\n\n if(k1 < 0){\n throw _b_.ValueError.$factory(\"k must be a non-negative integer\")\n }\n if(n1 < 0){\n throw _b_.ValueError.$factory(\"n must be a non-negative integer\")\n }\n if(k1 == 0){\n return 1\n }\n if(k1 == 1){\n return n\n }\n if(k1 == 2){\n return _b_.int.$int_or_long(n1 * (n1 - 1n))\n }\n if(k1 > n1){\n return 0\n }\n // Evaluates to n! / (n - k)!\n var fn = _mod.factorial(n),\n fn_k = _mod.factorial(n - k)\n return $B.rich_op('__floordiv__', fn, fn_k)\n}\n\nconst pi = $B.fast_float(Math.PI)\n\nfunction pow(){\n var $ = $B.args(\"pow\", 2, {base: null, exp: null}, ['base', 'exp'],\n arguments, {}, null, null),\n x = $.base,\n y = $.exp\n\n var x1 = float_check(x)\n var y1 = float_check(y)\n\n if(y1 == 0){\n return _b_.float.$factory(1)\n }\n if(x1 == 0 && y1 < 0){\n if(y1 === -Infinity){\n return INF\n }\n throw _b_.ValueError.$factory('math domain error')\n }\n if(isFinite(x1) && x1 < 0 && isFinite(y1) && ! Number.isInteger(y1)){\n throw _b_.ValueError.$factory('math domain error')\n }\n\n if(isNaN(y1)){\n if(x1 == 1){return _b_.float.$factory(1)}\n return NAN\n }\n if(x1 == 0){\n return ZERO\n }\n\n if(_b_.float.$funcs.isninf(y)){\n if(_b_.float.$funcs.isinf(x)){ // pow(INF, NINF) = 0.0\n return ZERO\n }else if(_b_.float.$funcs.isninf(x)){ // pow(NINF, NINF) = 0.0\n return ZERO\n }\n if(x1 == 1 || x1 == -1){return _b_.float.$factory(1)}\n if(x1 < 1 && x1 > -1){return INF}\n return ZERO\n }\n if(_b_.float.$funcs.isinf(y)){\n if(_b_.float.$funcs.isinf(x)){ // pow(INF, INF)\n return INF\n }\n if(_b_.float.$funcs.isninf(x)){\n return INF\n }\n if(x1 == 1 || x1 == -1){return _b_.float.$factory(1)}\n if(x1 < 1 && x1 > -1){return ZERO}\n return INF\n }\n\n if(isNaN(x1)){return _b_.float.$factory('nan')}\n if(_b_.float.$funcs.isninf(x)){\n if(y1 > 0 && isOdd(y1)){return NINF}\n if(y1 > 0){return INF} // this is even or a float\n if(y1 < 0){return ZERO}\n if(_b_.float.$float.isinf(y)){return INF}\n return _b_.float.$factory(1)\n }\n\n if(_b_.float.$funcs.isinf(x)){\n if(y1 > 0){return INF}\n if(y1 < 0){return ZERO}\n return _b_.float.$factory(1)\n }\n\n var r = Math.pow(x1, y1)\n if(isNaN(r)){\n return NAN\n }\n if(! isFinite(r)){\n overflow()\n }\n return _b_.float.$factory(r)\n}\n\nfunction prod(){\n var $ = $B.args(\"prod\", 1, {iterable:null, start:null},\n [\"iterable\", \"start\"], arguments, {start: 1}, \"*\",\n null),\n iterable = $.iterable,\n start = $.start\n var res = start,\n it = _b_.iter(iterable),\n x\n while(true){\n try{\n x = _b_.next(it)\n if(x == 0){\n return 0\n }\n res = $B.rich_op('__mul__', res, x)\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n return res\n }\n throw err\n }\n }\n}\n\nfunction radians(x){\n $B.check_nb_args('radians', 1, arguments)\n $B.check_no_kw('radians', x)\n\n return _b_.float.$factory(float_check(x) * Math.PI / 180)\n}\n\nfunction is_finite(x){\n return typeof x == \"number\" ||\n (x.__class__ === _b_.floar && isFinite(x.value)) ||\n $B.$isinstance(x, _b_.int) ||\n ($B.$isinstance(x, _b_.float) && isFinite(x.value))\n}\n\nfunction remainder(x, y){\n $B.check_nb_args_no_kw('remainder', 2, arguments)\n float_check(x) // might raise TypeError\n /* Deal with most common case first. */\n if(is_finite(x) && is_finite(y)){\n var absx,\n absy,\n c,\n m,\n r;\n\n if(float_check(y) == 0.0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n\n absx = fabs(x);\n absy = fabs(y);\n m = fmod(absx, absy);\n\n c = absy.value - m.value\n if(m.value < c){\n r = m.value\n }else if(m.value > c){\n r = -c\n }else{\n r = m.value -\n 2.0 * fmod($B.fast_float(0.5 * (absx.value - m.value)), absy).value;\n }\n return $B.fast_float(copysign(1.0, x).value * r);\n }\n\n /* Special values. */\n if(float_check(y) == 0){\n if(isnan(x)){\n return x\n }\n }\n if(isinf(x)){\n if(isnan(y)){\n return y\n }\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if(isnan(y)){\n return y;\n }\n return x;\n}\n\nfunction sin(x){\n $B.check_nb_args('sin ', 1, arguments)\n $B.check_no_kw('sin ', x)\n return _b_.float.$factory(Math.sin(float_check(x)))\n}\n\nfunction sinh(x) {\n $B.check_nb_args('sinh', 1, arguments)\n $B.check_no_kw('sinh', x)\n\n var y = float_check(x)\n if(Math.sinh !== undefined){\n return _b_.float.$factory(Math.sinh(y))\n }\n return _b_.float.$factory(\n (Math.pow(Math.E, y) - Math.pow(Math.E, -y)) / 2)\n}\n\nfunction sqrt(x){\n $B.check_nb_args('sqrt ', 1, arguments)\n $B.check_no_kw('sqrt ', x)\n\n if(_b_.float.$funcs.isninf(x)){\n value_error()\n }else if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n var y = float_check(x)\n if(y < 0){\n value_error()\n }\n var _r = $B.fast_float(Math.sqrt(y))\n if(_b_.float.$funcs.isinf(_r)){\n overflow()\n }\n return _r\n}\n\n/*[clinic input]\nmath.sumprod\n\n p: object\n q: object\n /\n\nReturn the sum of products of values from two iterables p and q.\n\nRoughly equivalent to:\n\n sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))\n\nFor float and mixed int/float inputs, the intermediate products\nand sums are computed with extended precision.\n[clinic start generated code]*/\n\nconst tl_zero = {hi: 0, lo: 0, tiny: 0}\n\nfunction _check_long_mult_overflow(a, b) {\n\n /* From Python2's int_mul code:\n\n Integer overflow checking for * is painful: Python tried a couple ways, but\n they didn't work on all platforms, or failed in endcases (a product of\n -sys.maxint-1 has been a particular pain).\n\n Here's another way:\n\n The native long product x*y is either exactly right or *way* off, being\n just the last n bits of the true product, where n is the number of bits\n in a long (the delivered product is the true product plus i*2**n for\n some integer i).\n\n The native double product (double)x * (double)y is subject to three\n rounding errors: on a sizeof(long)==8 box, each cast to double can lose\n info, and even on a sizeof(long)==4 box, the multiplication can lose info.\n But, unlike the native long product, it's not in *range* trouble: even\n if sizeof(long)==32 (256-bit longs), the product easily fits in the\n dynamic range of a double. So the leading 50 (or so) bits of the double\n product are correct.\n\n We check these two ways against each other, and declare victory if they're\n approximately the same. Else, because the native long product is the only\n one that can lose catastrophic amounts of information, it's the native long\n product that must have overflowed.\n\n */\n\n /*\n\n var longprod = (long)((unsigned long)a * b);\n double doubleprod = (double)a * (double)b;\n double doubled_longprod = (double)longprod;\n\n if (doubled_longprod == doubleprod) {\n return 0;\n }\n\n const double diff = doubled_longprod - doubleprod;\n const double absdiff = diff >= 0.0 ? diff : -diff;\n const double absprod = doubleprod >= 0.0 ? doubleprod : -doubleprod;\n\n if (32.0 * absdiff <= absprod) {\n return 0;\n }\n\n return 1;\n */\n return 0\n}\n\nfunction long_add_would_overflow(a, b){\n return (a > 0n) ? (b > BigInt(LONG_MAX) - a) : (b < BigInt(LONG_MIN) - a);\n}\n\nfunction PyLong_CheckExact(n){\n return typeof n == 'number' || n.__class__ === $B.long_int\n}\n\n/*\n The default implementation of dl_mul() depends on the C math library\n having an accurate fma() function as required by \u00a7 7.12.13.1 of the\n C99 standard.\n\n The UNRELIABLE_FMA option is provided as a slower but accurate\n alternative for builds where the fma() function is found wanting.\n The speed penalty may be modest (17% slower on an Apple M1 Max),\n so don't hesitate to enable this build option.\n\n The algorithms are from the T. J. Dekker paper:\n A Floating-Point Technique for Extending the Available Precision\n https://csclub.uwaterloo.ca/~pbarfuss/dekker1971.pdf\n*/\n\nfunction dl_split(x) {\n // Dekker (5.5) and (5.6).\n var t = x * 134217729.0; // Veltkamp constant = 2.0 ** 27 + 1\n var hi = t - (t - x);\n var lo = x - hi;\n return {hi, lo};\n}\n\nfunction dl_mul(x, y){\n // Dekker (5.12) and mul12()\n var xx = dl_split(x);\n var yy = dl_split(y);\n var p = xx.hi * yy.hi;\n var q = xx.hi * yy.lo + xx.lo * yy.hi;\n var z = p + q;\n var zz = p - z + q + xx.lo * yy.lo;\n return {hi: z, lo: zz};\n}\n\nfunction dl_sum(a, b){\n /* Algorithm 3.1 Error-free transformation of the sum */\n var x = a + b;\n var z = x - a;\n var y = (a - (x - z)) + (b - z);\n return {hi: x, lo: y};\n}\n\nfunction tl_fma(x, y, total){\n /* Algorithm 5.10 with SumKVert for K=3 */\n var pr = dl_mul(x, y);\n var sm = dl_sum(total.hi, pr.hi);\n var r1 = dl_sum(total.lo, pr.lo);\n var r2 = dl_sum(r1.hi, sm.lo);\n return {hi: sm.hi, lo: r2.hi, tiny: total.tiny + r1.lo + r2.lo}\n}\n\nfunction tl_to_d(total){\n var last = dl_sum(total.lo, total.hi);\n return total.tiny + last.lo + last.hi;\n}\n\nfunction sumprod(p, q){\n var $ = $B.args('sumprod', 2, {p: null, q: null}, ['p', 'q'],\n arguments, {}, null, null)\n var p_i = NULL,\n q_i = NULL,\n term_i = NULL,\n new_total = NULL;\n var p_it, q_it, total;\n var p_next, q_next;\n var p_stopped = false, q_stopped = false;\n var int_path_enabled = true,\n int_total_in_use = false;\n var flt_path_enabled = true,\n flt_total_in_use = false;\n var int_total = 0n;\n var flt_total = tl_zero;\n\n p_it = $B.make_js_iterator(p);\n q_it = $B.make_js_iterator(q);\n total = 0\n p_next = p_it.next\n q_next = q_it.next\n while (1) {\n var finished;\n p_i = p_it.next()\n if (p_i.done) {\n /*\n if (PyErr_Occurred()) {\n if (!PyErr_ExceptionMatches(PyExc_StopIteration)) {\n goto err_exit;\n }\n PyErr_Clear();\n }\n */\n p_stopped = true;\n }else{\n p_i = p_i.value\n }\n q_i = q_it.next()\n if (q_i.done) {\n /*\n if (PyErr_Occurred()) {\n if (!PyErr_ExceptionMatches(PyExc_StopIteration)) {\n goto err_exit;\n }\n PyErr_Clear();\n }\n */\n q_stopped = true;\n }else{\n q_i = q_i.value\n }\n if (p_stopped != q_stopped) {\n throw _b_.ValueError.$factory(\"Inputs are not the same length\");\n }\n\n finished = p_stopped & q_stopped;\n\n if (int_path_enabled) {\n\n if (! finished && PyLong_CheckExact(p_i) & PyLong_CheckExact(q_i)) {\n var overflow;\n var int_p, int_q, int_prod;\n\n int_p = _b_.int.$to_bigint($B.PyNumber_Index(p_i))\n overflow = int_p > LONG_MAX || int_p < LONG_MIN\n\n if (overflow) {\n finalize_int_path()\n }\n int_q = _b_.int.$to_bigint($B.PyNumber_Index(q_i));\n overflow = int_q > LONG_MAX || int_q < LONG_MIN\n if (overflow) {\n finalize_int_path()\n }\n if (_check_long_mult_overflow(int_p, int_q)) {\n finalize_int_path()\n }\n int_prod = int_p * int_q;\n if (long_add_would_overflow(int_total, int_prod)) {\n finalize_int_path()\n }\n if(int_path_enabled){\n int_total = int_total + int_prod;\n int_total_in_use = true;\n continue;\n }\n }\n\n if(finished){\n finalize_int_path()\n }\n\n function finalize_int_path(){\n // We're finished, overflowed, or have a non-int\n int_path_enabled = false;\n if (int_total_in_use) {\n term_i = _b_.int.$int_or_long(int_total);\n new_total = $B.rich_op('__add__', total, term_i);\n total = new_total\n new_total = NULL;\n int_total = 0; // An ounce of prevention, ...\n int_total_in_use = false;\n }\n }\n }\n\n if (flt_path_enabled) {\n\n if (!finished) {\n var flt_p, flt_q;\n var p_type_float = p_i.__class__ === _b_.float;\n var q_type_float = q_i.__class__ === _b_.float\n if(p_type_float && q_type_float) {\n flt_p = p_i;\n flt_q = q_i;\n }else if (p_type_float && (PyLong_CheckExact(q_i) ||\n typeof q_i == 'boolean')){\n /* We care about float/int pairs and int/float pairs because\n they arise naturally in several use cases such as price\n times quantity, measurements with integer weights, or\n data selected by a vector of bools. */\n flt_p = p_i\n flt_q = _b_.int.$int_value(q_i)\n }else if(q_type_float && (PyLong_CheckExact(p_i) ||\n typeof p_i == 'boolean')) {\n flt_q = q_i\n flt_p = _b_.int.$int_value(p_i)\n }else{\n finalize_flt_path()\n }\n if(flt_path_enabled){\n var new_flt_total = tl_fma(flt_p.value, flt_q.value, flt_total);\n if (isfinite(new_flt_total.hi)) {\n flt_total = new_flt_total;\n flt_total_in_use = true;\n continue;\n }\n }\n }\n if(finished){\n finalize_flt_path()\n }\n\n function finalize_flt_path(){\n // We're finished, overflowed, have a non-float, or got a non-finite value\n flt_path_enabled = false;\n if(flt_total_in_use){\n term_i = $B.fast_float(tl_to_d(flt_total));\n if (term_i == NULL) {\n err_exit()\n }\n new_total = $B.rich_op('__add__', total, term_i);\n total = new_total\n new_total = NULL\n flt_total = tl_zero;\n flt_total_in_use = false;\n }\n }\n }\n\n if (finished) {\n return total\n }\n term_i = $B.rich_op('__mul__', p_i, q_i);\n new_total = $B.rich_op('__add__', total, term_i);\n total = new_total\n new_total = NULL;\n }\n\n}\n\n\n\nfunction tan(x) {\n $B.check_nb_args('tan', 1, arguments)\n $B.check_no_kw('tan', x)\n\n var y = float_check(x)\n return _b_.float.$factory(Math.tan(y))\n}\n\nfunction tanh(x) {\n $B.check_nb_args('tanh', 1, arguments)\n $B.check_no_kw('tanh', x)\n\n var y = float_check(x)\n if(Math.tanh !== undefined){return _b_.float.$factory(Math.tanh(y))}\n return _b_.float.$factory((Math.pow(Math.E, y) - Math.pow(Math.E, -y))/\n (Math.pow(Math.E, y) + Math.pow(Math.E, -y)))\n}\n\nconst tau = $B.fast_float(2 * Math.PI)\n\nfunction trunc(x) {\n $B.check_nb_args('trunc', 1, arguments)\n $B.check_no_kw('trunc', x)\n\n try{return $B.$getattr(x, '__trunc__')()}catch(err){}\n var x1 = float_check(x)\n if(!isNaN(parseFloat(x1)) && isFinite(x1)){\n if(Math.trunc !== undefined){return _b_.int.$factory(Math.trunc(x1))}\n if(x1 > 0){return _b_.int.$factory(Math.floor(x1))}\n return _b_.int.$factory(Math.ceil(x1)) // x1 < 0\n }\n throw _b_.ValueError.$factory(\n 'object is not a number and does not contain __trunc__')\n}\n\nfunction ulp(){\n var $ = $B.args(\"ulp\", 1, {x: null}, ['x'], arguments, {}, null, null),\n x = $.x\n if($B.$isinstance(x, _b_.float)){\n if(_b_.float.$funcs.isinf(x)){\n return _mod.inf\n }else if(_b_.float.$funcs.isnan(x)){\n return _mod.nan\n }\n }\n if(typeof x == \"number\"){\n return x >= 0 ? $B.fast_float(nextUp(x) - x) :\n $B.fast_float(x - (-nextUp(-x)))\n }else if($B.$isinstance(x, $B.long_int)){\n x = Number(_b_.int.$to_bigint(x))\n return x > 0 ? $B.fast_float(nextUp(x) - x) :\n $B.fast_float(x - (-nextUp(-x)))\n }else{\n if($B.rich_comp('__ge__', x, 0)){\n return $B.rich_op('__sub__', $B.fast_float(nextUp(x.value)), x)\n }else{\n var neg_x = $B.$call($B.$getattr(x, \"__neg__\"))()\n return $B.rich_op('__sub__', x,\n $B.$call($B.$getattr($B.fast_float(nextUp(neg_x.value)), '__neg__'))())\n }\n }\n}\n\nvar _mod = {\n acos,\n acosh,\n asin,\n asinh,\n atan,\n atan2,\n atanh,\n cbrt,\n ceil,\n comb,\n copysign,\n cos,\n cosh,\n degrees,\n dist,\n e,\n erf,\n erfc,\n exp,\n exp2,\n expm1,\n fabs,\n factorial,\n floor,\n fmod,\n frexp,\n fsum,\n gamma,\n gcd,\n hypot,\n inf,\n isclose,\n isfinite,\n isinf,\n isnan,\n isqrt,\n lcm,\n ldexp,\n lgamma,\n log,\n log1p,\n log2,\n log10,\n modf,\n nan,\n nextafter,\n perm,\n pi,\n pow,\n prod,\n radians,\n remainder,\n sin,\n sinh,\n sqrt,\n sumprod,\n tan,\n tanh,\n tau,\n trunc,\n ulp\n}\n\nfor(var $attr in _mod){\n if(typeof _mod[$attr] === 'function'){\n _mod[$attr].__class__ = $B.builtin_function_or_method\n }\n}\n\nreturn _mod\n\n})(__BRYTHON__)\n"], "modulefinder": [".js", "var $module=(function($B){\n\nvar _b_=$B.builtins\nvar _mod = {}\n\n$ModuleFinderDict = {__class__:_b_.type,__name__:'ModuleFinder'}\n$ModuleFinderDict.__mro__ = [_b_.object]\n\n$ModuleFinderDict.run_script = function(self, pathname){\n // pathname is the url of a Python script\n var py_src = _b_.$open(pathname).read()\n // transform into internal Brython tree structure\n var root = $B.py2js(py_src)\n // walk the tree to find occurences of imports\n function walk(node){\n var modules = []\n var ctx = node.context\n if(ctx && ctx.type=='node'){ctx = ctx.tree[0]}\n\n if(ctx && ctx.type==\"import\"){\n for(var i=0, _len_i = ctx.tree.length; i < _len_i;i++){\n if(modules.indexOf(ctx.tree[i].name)==-1){\n modules.push(ctx.tree[i].name)\n }\n }\n }else if(ctx && ctx.type==\"from\"){\n if(modules.indexOf(ctx.module)==-1){\n modules.push(ctx.module)\n }\n }\n \n for(var i=0, _len_i = node.children.length; i < _len_i;i++){\n mods = walk(node.children[i])\n for(var j=0, _len_j = mods.length; j < _len_j;j++){\n if(modules.indexOf(mods[j])==-1){modules.push(mods[j])}\n }\n }\n return modules\n }\n self.modules = walk(root)\n}\n\n_mod.ModuleFinder = function(){return {__class__:$ModuleFinderDict}\n}\n_mod.ModuleFinder.$dict = $ModuleFinderDict\n_mod.ModuleFinder.__class__ = $B.$factory\n$ModuleFinderDict.$factory = _mod.ModuleFinder\n\nreturn _mod\n})(__BRYTHON__)\n"], "posix": [".js", "/*\nThis module provides access to operating system functionality that is\nstandardized by the C Standard and the POSIX standard (a thinly\ndisguised Unix interface). Refer to the library manual and\ncorresponding Unix manual entries for more information on calls.\n*/\n\nvar $B = __BRYTHON__,\n _b_ = $B.builtins\n\nfunction _randint(a, b){\n return parseInt(Math.random() * (b - a + 1) + a)\n}\n\nvar stat_result = $B.make_class(\"stat_result\",\n function(filename){\n filename = _b_.str.$factory(filename)\n if($B.file_cache && $B.file_cache.hasOwnProperty(filename)){\n var f = $B.file_cache[filename],\n res = {\n __class__: stat_result,\n st_atime: __BRYTHON__.timestamp,\n st_ctime: f.ctime,\n st_mtime: f.mtime,\n st_uid: -1,\n st_gid: -1,\n st_ino: -1,\n st_mode: 0,\n st_size: f.length\n };\n [\"mtime\", \"ctime\", \"atime_ns\", \"mtime_ns\", \"ctime_ns\"].\n forEach(function(item){\n res[\"st_\" + item] = res.st_atime\n });\n return res\n }else{\n try{\n var xhr = new XMLHttpRequest()\n }catch(err){\n console.log('err', filename, err.message)\n console.log('stack', $B.make_frames_stack())\n throw err\n }\n xhr.open('HEAD', filename, false)\n var infos = {}\n xhr.onreadystatechange = function(){\n if(this.readyState == 4){\n var res = {\n __class__: stat_result,\n st_atime: __BRYTHON__.timestamp,\n st_uid: -1,\n st_gid: -1,\n st_ino: -1,\n st_mode: filename.endsWith('/') ? 16895 : 33206,\n st_size: this.getResponseHeader('content-length')\n };\n [\"mtime\", \"ctime\", \"atime_ns\", \"mtime_ns\", \"ctime_ns\"].\n forEach(function(item){\n res[\"st_\" + item] = res.st_atime\n });\n infos.value = res\n $B.file_cache[filename] = this.responseText\n }\n }\n xhr.send()\n return infos.value\n }\n }\n)\n$B.set_func_names(stat_result, \"posix\")\n\nvar $module = {\n F_OK: 0,\n O_APPEND: 8,\n O_BINARY: 32768,\n O_CREAT: 256,\n O_EXCL: 1024,\n O_NOINHERIT: 128,\n O_RANDOM: 16,\n O_RDONLY: 0,\n O_RDWR: 2,\n O_SEQUENTIAL: 32,\n O_SHORT_LIVED: 4096,\n O_TEMPORARY: 64,\n O_TEXT: 16384,\n O_TRUNC: 512,\n O_WRONLY: 1,\n P_DETACH: 4,\n P_NOWAIT: 1,\n P_NOWAITO: 3,\n P_OVERLAY: 2,\n P_WAIT: 0,\n R_OK: 4,\n TMP_MAX: 32767,\n W_OK: 2,\n X_OK: 1,\n _have_functions: ['MS_WINDOWS'],\n environ: _b_.dict.$factory(\n [['PYTHONPATH', $B.brython_path],\n ['PYTHONUSERBASE', ' ']]),\n error: _b_.OSError,\n fspath: function(path){\n return path\n },\n getcwd: function(){return $B.brython_path},\n getpid: function(){return 0},\n lstat: function(filename){\n return stat_result.$factory(filename)\n },\n open: function(path, flags){return _b_.open(path, flags)},\n stat: function(filename){return stat_result.$factory(filename)},\n stat_result: function(filename){return stat_result.$factory(filename)},\n urandom: function(n){\n const randbytes = new Uint8Array(n);\n crypto.getRandomValues(randbytes);\n return _b_.bytes.$factory(Array.from(randbytes));\n },\n WTERMSIG: function(){return 0},\n WNOHANG: function(){return _b_.tuple.$factory([0, 0])}\n};\n\n[\"WCOREDUMP\", \"WIFCONTINUED\", \"WIFSTOPPED\", \"WIFSIGNALED\", \"WIFEXITED\"].forEach(function(funcname){\n $module[funcname] = function(){return false}\n });\n\n[\"WEXITSTATUS\", \"WSTOPSIG\", \"WTERMSIG\"].\n forEach(function(funcname){\n $module[funcname] = function(){return _b_.None}\n });\n\n[\"_exit\", \"_getdiskusage\", \"_getfileinformation\", \"_getfinalpathname\",\n \"_getfullpathname\", \"_isdir\", \"abort\", \"access\", \"chdir\", \"chmod\",\n \"close\", \"closerange\", \"device_encoding\", \"dup\", \"dup2\",\n \"execv\", \"execve\", \"fsat\", \"fsync\", \"get_terminal_size\", \"getcwdb\",\n \"getlogin\", \"getppid\", \"isatty\", \"kill\", \"link\", \"listdir\", \"lseek\",\n \"mkdir\", \"pipe\", \"putenv\", \"read\", \"readlink\", \"remove\", \"rename\",\n \"replace\", \"rmdir\", \"spawnv\", \"spawnve\", \"startfile\", \"stat_float_times\",\n \"statvfs_result\", \"strerror\", \"symlink\", \"system\", \"terminal_size\",\n \"times\", \"times_result\", \"umask\", \"uname_result\", \"unlink\", \"utime\",\n \"waitpid\", \"write\"].forEach(function(funcname){\n $module[funcname] = function(){\n throw _b_.NotImplementedError.$factory(\"posix.\" + funcname +\n \" is not implemented\")\n }\n });\n"], "python_re": [".js", "// Regular expression\n\n\nvar _debug = {value: 0}\n\nvar $B = __BRYTHON__,\n _b_ = $B.builtins\n\nvar MAXGROUPS = 2147483647,\n MAXREPEAT = 2147483648\n\nvar word_gcs = ['Ll', 'Lu', 'Lm', 'Lt', 'Lo',\n 'Nd',\n 'Mc', 'Me', 'Mn',\n 'Pc']\n\nfunction is_word(cp){\n if((cp >= 97 && cp <= 122) // a-z\n || (cp >= 65 && cp <= 90) // A-Z\n ){\n return true\n }\n for(var word_gc of word_gcs){\n if(! $B.in_unicode_category(word_gc, cp)){\n return false\n }\n }\n return true\n}\n\nvar ascii_word = {}\n\nfor(var cp = 0; cp <= 127; cp++){\n if(is_word(cp)){\n ascii_word[cp] = true\n }\n}\n\nfunction is_ascii_word(cp){\n return ascii_word[cp] !== undefined\n}\n\nfunction is_digit(cp){\n if(cp >= 48 && cp <= 57){\n return true\n }\n return $B.in_unicode_category('Nd', cp)\n}\n\nfunction is_ascii_digit(cp){\n return cp <= 127 && is_digit(cp)\n}\n\nvar $error_2 = {\n $name: \"error\",\n $qualname: \"error\",\n $is_class: true,\n __module__: \"re\"\n}\n\nvar error = $B.make_class(\"error\",\n function(message){\n return {\n __class__: error,\n msg: message,\n args: $B.fast_tuple([]),\n __cause__: _b_.None,\n __context__: _b_.None,\n __suppress_context__: false\n }\n })\nerror.__bases__ = [_b_.Exception, _b_.object]\nerror.__mro__ = [_b_.Exception, _b_.BaseException, _b_.object]\n\nerror.__str__ = function(self){\n var s = self.msg + ' at position ' + self.pos\n if(self.lineno > 1){\n s += ` (line ${self.lineno}, column ${self.colno})`\n }\n return s\n}\n\n$B.set_func_names(error, \"re\")\n\nfunction $last(t){\n return t[t.length - 1]\n}\n\nfunction fail(message, pos, pattern){\n var err = error.$factory(message)\n err.msg = message\n err.pos = pos\n if(pattern){\n err.pattern = pattern.py_obj // Python object passed to compile()\n err.lineno = 1\n var linestart = 0\n for(var i = 0, len = pattern.string.length; i < pos; i++){\n if(pattern.string[i] == '\\n'){\n err.lineno++\n linestart = i + 1\n }\n }\n err.colno = pos - linestart + 1\n }\n throw err\n}\n\nfunction warn(klass, message, pos, text){\n var frame = $B.frame_obj.frame,\n file = frame[3].__file__,\n src = $B.file_cache[file]\n if(text === undefined){\n var lineno = frame[1].$lineno\n var lines = src.split('\\n'),\n line = lines[lineno - 1]\n }else{\n if(Array.isArray(text)){\n text = from_codepoint_list(text)\n }\n var lineno = 1,\n line_start = 0\n for(var i = 0; i < pos; i++){\n if(text[i] == '\\n'){\n lineno++\n line_start = i + 1\n }\n }\n var line_end = text.substr(line_start).search('\\n'),\n line\n if(line_end == -1){\n line = text.substr(line_start)\n }else{\n line = text.substr(line_start, line_end)\n }\n var col_offset = pos - line_start\n }\n var warning = klass.$factory(message)\n warning.pos = pos\n warning.args[1] = [file, lineno, col_offset, lineno, col_offset,\n line]\n warning.filename = file\n warning.lineno = warning.end_lineno = lineno\n warning.offset = warning.end_offset = col_offset\n warning.line = line\n // module _warning is in builtin_modules.js\n $B.imported._warnings.warn(warning)\n}\n\nfunction chr(i){\n if(i < 0 || i > 1114111){\n throw _b_.ValueError.$factory('Outside valid range')\n }else if(i >= 0x10000 && i <= 0x10FFFF){\n var code = (i - 0x10000)\n return String.fromCodePoint(0xD800 | (code >> 10)) +\n String.fromCodePoint(0xDC00 | (code & 0x3FF))\n }else{\n return String.fromCodePoint(i)\n }\n}\n\nfunction ord(char){\n return char.charCodeAt(0)\n}\n\nconst LETTERS = {\n b: ord('b'),\n N: ord('N'),\n P: ord('P'),\n u: ord('u'),\n U: ord('U'),\n x: ord('x')\n}\n\nconst PARENTH_OPEN = ord('('),\n PARENTH_CLOSE = ord(')'),\n BRACKET_OPEN = ord('['),\n BRACKET_CLOSE = ord(']'),\n BRACE_OPEN = ord('{'),\n BRACE_CLOSE = ord('}'),\n EQUAL = ord('='),\n SUP = ord('>'),\n INF = ord('<'),\n MINUS = ord('-'),\n PLUS = ord('+'),\n OR = ord('|'),\n DOT = ord('.'),\n QUESTION_MARK = ord('?'),\n EXCLAMATION_MARK = ord('!'),\n COLON = ord(':'),\n BACKSLASH = ord('\\\\'),\n DOLLAR = ord('$'),\n CARET = ord('^'),\n LINEFEED = ord('\\n')\n\n// pattern tokenizer\n\nfunction is_ascii(name){\n return /^[\\x00-\\x7F]*$/.test(name)\n}\n\nfunction open_unicode_db(){\n if($B.unicodedb === undefined){\n var xhr = new XMLHttpRequest\n xhr.open(\"GET\",\n $B.brython_path + \"unicode.txt?\" + (new Date()).getTime(), false)\n xhr.onreadystatechange = function(){\n if(this.readyState == 4){\n if(this.status == 200){\n $B.unicodedb = this.responseText\n }else{\n console.log(\n \"Warning - could not load unicode.txt\")\n }\n }\n }\n xhr.send()\n }\n}\n\nfunction validate_named_char(description, pos){\n // validate that \\N{} is in the Unicode db\n // Load unicode table if not already loaded\n if(description.length == 0){\n fail(\"missing character name\", pos)\n }\n open_unicode_db()\n if($B.unicodedb !== undefined){\n var re = new RegExp(\"^([0-9A-F]+);\" +\n description.toUpperCase() + \";.*$\", \"m\")\n search = re.exec($B.unicodedb)\n if(search === null){\n fail(`undefined character name '${description}'`, pos)\n }\n return parseInt(search[1], 16)\n }else{\n fail(\"could not load unicode.txt\", pos)\n }\n}\n\nfunction validate_group_name(sname, pos, is_bytes){\n // sname is an instance of StringObj\n if(! _b_.str.isidentifier(sname.string)){\n fail(`bad character in group name '${sname.string}'`, pos + 4)\n }\n if(is_bytes && ! is_ascii(sname.string)){\n var s = _b_.bytes.decode(_b_.bytes.$factory(sname.codepoints),\n 'ascii', 'backslashreplace')\n warn(_b_.DeprecationWarning,\n `bad character in group name '${s}' at position ${pos + 4}`)\n }\n return true\n}\n\nfunction validate_group_num(so, pos){\n var s = so.string\n if(s.match(/^\\d+$/)){\n return true\n }\n try{\n var num = _b_.int.$factory(s)\n warn(_b_.DeprecationWarning,\n `bad character in group name '${s}' at position ${pos + 3}`,\n pos + 3, s)\n so.string = num + ''\n return true\n }catch(err){\n return false\n }\n}\n\nfunction validate_num_or_name(so, pos, is_bytes){\n return validate_group_num(so, pos, is_bytes) ||\n validate_group_name(so, pos - 1, is_bytes)\n}\n\nvar character_classes = {\n in_charset: to_codepoint_list('dDsSwW'),\n in_re: to_codepoint_list('AbBdDsSwWZ')\n}\n\nfunction escaped_char(args){\n var cps = args.codepoints,\n pos = args.pos,\n in_charset = args.in_charset,\n is_bytes = args.is_bytes // if pattern is bytes\n var special = cps[pos + 1]\n if(special === undefined){\n fail('bad escape (end of pattern)', pos)\n }\n var key = in_charset ? 'in_charset' : 'in_re'\n if(in_charset && special == LETTERS.b){\n // Inside a character range, \\b represents the backspace character,\n // for compatibility with Python\u2019s string literals.\n return '\\b'\n }\n if(character_classes[key].indexOf(special) > -1){\n return new CharacterClass(pos, special, 2)\n }else if(special == LETTERS.N && ! is_bytes){\n if(cps[pos + 2] != BRACE_OPEN){\n fail('missing {', pos)\n }\n var i = pos + 3,\n description = []\n while(i < cps.length){\n if(cps[i] == BRACE_CLOSE){\n break\n }\n description.push(cps[i])\n i++\n }\n if(description.length == 0){\n fail(\"missing character name\", pos)\n }\n if(i == cps.length){\n fail(\"missing }, unterminated name\", pos)\n }\n var cp = validate_named_char(from_codepoint_list(description), pos)\n return {\n type: 'N',\n ord: cp,\n char: chr(cp),\n length: i - pos + 1\n }\n }else if(special == LETTERS.x){\n // \\xhh = character with hex value hh\n var rest = from_codepoint_list(cps.slice(pos + 2)),\n mo = /^[0-9a-fA-F]{0,2}/.exec(rest),\n hh = mo ? mo[0] : ''\n if(mo && mo[0].length == 2){\n var cp = parseInt(mo[0], 16)\n return {\n type: 'x',\n ord: cp,\n char: chr(cp),\n length: 2 + mo[0].length\n }\n }\n fail('incomplete escape \\\\x' + hh, pos)\n }else if(special == LETTERS.u){\n // \\uxxxx = character with 16-bit hex value xxxx\n var rest = from_codepoint_list(cps.slice(pos + 2)),\n mo = /^[0-9a-fA-F]{0,4}/.exec(rest),\n xx = mo ? mo[0] : ''\n if(mo && mo[0].length == 4){\n var cp = parseInt(mo[0], 16)\n return {\n type: 'u',\n ord: cp,\n char: chr(cp),\n length: 2 + mo[0].length\n }\n }\n fail('incomplete escape \\\\u' + xx, pos)\n }else if(special == LETTERS.U){\n // \\Uxxxxxxxx = character with 32-bit hex value xxxxxxxx\n var rest = from_codepoint_list(cps.slice(pos + 2)),\n mo = /^[0-9a-fA-F]{0,8}/.exec(rest),\n xx = mo ? mo[0] : ''\n if(mo && mo[0].length == 8){\n var cp = parseInt(mo[0], 16)\n if(cp > 0x10FFFF){\n fail(`bad escape \\\\U${mo[0]}`, pos)\n }\n return {\n type: 'U',\n ord: cp,\n char: chr(cp),\n length: 2 + mo[0].length\n }\n }\n fail('incomplete escape \\\\U' + xx, pos)\n }else{\n // octal ?\n // If the first digit of number is 0, or number is 3 octal digits\n // long, it will not be interpreted as a group match, but as the\n // character with octal value number\n var rest = from_codepoint_list(cps.slice(pos + 1)),\n mo = /^[0-7]{3}/.exec(rest)\n if(in_charset){\n try{\n var res = $B.test_escape(rest, -1)\n if(res){\n return {\n type: 'u',\n ord: res[0].codePointAt(0),\n char: res[0],\n length: res[1]\n }\n }\n }catch(err){\n // ignore\n }\n }\n if(mo == null){\n mo = /^0[0-7]*/.exec(rest)\n }\n if(mo){\n var octal_value = parseInt(mo[0], 8)\n if(octal_value > 0o377){\n fail(`octal escape value \\\\` +\n `${mo[0]} outside of range 0-0o377`, pos)\n }\n return {\n type: 'o',\n ord: octal_value,\n char: chr(octal_value),\n length: 1 + mo[0].length\n }\n }\n var mo = /^\\d{1,2}/.exec(rest) // backref is at most 99\n if(mo){\n return {\n type: 'backref',\n value: parseInt(mo[0]),\n length: 1 + mo[0].length\n }\n }\n var trans = {a: chr(7), f: '\\f', n: '\\n', r: '\\r', t: '\\t', v: '\\v'},\n res = trans[chr(special)]\n if(res){\n return ord(res)\n }\n if(chr(special).match(/[a-zA-Z]/)){\n fail(\"bad escape \\\\\" + chr(special), pos)\n }else{\n return special\n }\n }\n}\n\nfunction check_character_range(t, positions){\n // Check if last 2 items in t are a valid character range\n var start = t[t.length - 2],\n end = t[t.length - 1]\n if(start instanceof CharacterClass || end instanceof CharacterClass){\n fail(`bad character range ${start}-${end}`,\n positions[positions.length - 2])\n }else if(end < start){\n fail(`bad character range ${start}-${end}`,\n positions[positions.length - 2])\n }\n t.splice(t.length - 2, 2, {\n type: 'character_range',\n start: start,\n end: end,\n ord: [start.ord, end.ord]\n })\n}\n\nfunction parse_character_set(text, pos, is_bytes){\n // Parse character set starting at position \"pos\" in \"text\"\n // pos is the position of the leading \"[\"\n var start = pos,\n result = {items: []},\n positions = []\n pos++\n if(text[pos] == CARET){\n result.neg = true\n pos++\n }else if(text[pos] == BRACKET_CLOSE){\n // a leading ] is the character \"]\", not the set end\n result.items.push(']')\n positions.push(pos)\n pos++\n }else if(text[pos] == BRACKET_OPEN){\n // send FutureWarning\n warn(_b_.FutureWarning, \"Possible nested set\", pos, text)\n }\n var range = false\n while(pos < text.length){\n var cp = text[pos],\n char = chr(cp)\n if(char == ']'){\n if(pos == start + 2 && result.neg){\n // in \"[^]]\", the first ] is the character \"]\"\n result.items.push(']')\n }else{\n return [result, pos]\n }\n }\n if(char == '\\\\'){\n var escape = escaped_char({\n codepoints: text,\n pos,\n in_charset: true,\n is_bytes\n })\n if(typeof escape == \"number\"){\n var s = chr(escape)\n escape = {\n ord: escape,\n length: 2,\n toString: function(){\n return s\n }\n }\n }\n if(escape.type == \"num\"){\n // [\\9] is invalid\n fail(\"bad escape 1 \\\\\" +\n escape.value.toString()[0], pos)\n }\n result.items.push(escape)\n positions.push(pos)\n if(range){\n check_character_range(result.items, positions)\n }\n range = false\n pos += escape.length\n }else if(char == '-'){\n // Character range, or character \"-\"\n if(pos == start + 1 ||\n (result.neg && pos == start + 2) ||\n pos == text.length - 2 || // [a-]\n range ||\n (result.items.length > 0 &&\n result.items[result.items.length - 1].type ==\n \"character_range\")){\n result.items.push({\n ord: cp,\n char,\n toString: function(){\n return this.char\n }\n })\n if(text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set difference\", pos, text)\n }\n pos++\n if(range){\n check_character_range(result.items, positions)\n }\n range = false\n }else{\n range = true\n if(text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set difference\", pos, text)\n }\n pos++\n }\n }else{\n positions.push(pos)\n result.items.push({\n ord: cp,\n char,\n toString: function(){\n return this.char\n }\n })\n if(range){\n check_character_range(result.items, positions)\n }\n range = false\n // FutureWarning for consecutive \"&\", \"|\" or \"~\"\n if(char == \"&\" && text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set intersection\", pos, text)\n }else if(char == \"|\" && text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set union\", pos, text)\n }else if(char == \"~\" && text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set symmetric difference\",\n pos, text)\n }\n pos++\n }\n }\n fail(\"unterminated character set\", start)\n}\n\nfunction* tokenize(pattern, type, _verbose){\n // pattern is a list of codepoints\n var is_bytes = type == \"bytes\"\n // verbose_stack is the stack of verbose state for each group in the regex\n var verbose_stack = [_verbose],\n verbose = _verbose,\n parenth_pos\n var pos = 0\n while(pos < pattern.length){\n var cp = pattern[pos],\n char = String.fromCharCode(cp)\n if(verbose){\n // current group is in verbose mode\n if(char == \"#\"){\n // skip until next line feed\n while(pos < pattern.length && pattern[pos] != 10){\n pos++\n }\n pos++\n continue\n }else{\n while(pos < pattern.length &&\n [9, 10, 11, 12, 13, 32].indexOf(pattern[pos]) > -1){\n pos++\n }\n }\n cp = pattern[pos]\n if(cp === undefined){\n break\n }\n char = String.fromCharCode(cp)\n if(char == '#'){\n continue\n }\n }\n if(char == '('){\n parenth_pos = pos\n if(pattern[pos + 1] == QUESTION_MARK){\n if(pattern[pos + 2] == LETTERS.P){\n if(pattern[pos + 3] == INF){\n var name = [],\n i = pos + 4\n while(i < pattern.length){\n if(pattern[i] == SUP){\n break\n }else if(pattern[i] == PARENTH_CLOSE){\n fail(\"missing >, unterminated name\", pos)\n }\n name.push(pattern[i])\n i++\n }\n var sname = StringObj.from_codepoints(name)\n validate_group_name(sname, pos, is_bytes)\n name = sname\n if(i == pattern.length){\n fail(\"missing >, unterminated name\", pos)\n }\n yield new Group(pos, {type: 'name_def', value: name})\n verbose_stack.push(verbose)\n pos = i + 1\n continue\n }else if(pattern[pos + 3] == EQUAL){\n var name = [],\n i = pos + 4\n while(i < pattern.length){\n if(pattern[i] == PARENTH_CLOSE){\n break\n }\n name.push(pattern[i])\n i++\n }\n name = StringObj.from_codepoints(name)\n validate_group_name(name, pos, is_bytes)\n if(i == pattern.length){\n fail(\"missing ), unterminated name\", pos)\n }\n yield new BackReference(pos, 'name', name.string)\n pos = i + 1\n continue\n }else if(pattern[pos + 3] === undefined){\n fail(\"unexpected end of pattern\", pos)\n }else{\n fail(\"unknown extension ?P\" + chr(pattern[pos + 3]), pos)\n }\n }else if(pattern[pos + 2] == PARENTH_OPEN){\n var ref = [],\n i = pos + 3\n while(i < pattern.length){\n if(pattern[i] == PARENTH_CLOSE){\n break\n }\n ref.push(pattern[i])\n i++\n }\n var sref = StringObj.from_codepoints(ref)\n if(sref.string.match(/^\\d+$/)){\n ref = parseInt(sref.string)\n }else{\n validate_num_or_name(sref, pos, is_bytes)\n ref = sref.string\n }\n if(i == pattern.length){\n fail(\"missing ), unterminated name\", pos)\n }\n yield new ConditionalBackref(pos, ref)\n pos = i + 1\n continue\n }else if(pattern[pos + 2] == EQUAL){\n // (?=...) : lookahead assertion\n yield new Group(pos, {type: 'lookahead_assertion'})\n verbose_stack.push(verbose)\n pos += 3\n continue\n }else if(pattern[pos + 2] == EXCLAMATION_MARK){\n // (?!...) : negative lookahead assertion\n yield new Group(pos, {type: 'negative_lookahead_assertion'})\n verbose_stack.push(verbose)\n pos += 3\n continue\n }else if(from_codepoint_list(pattern.slice(pos + 2, pos + 4)) == ' -1){\n if(pattern[pos + 2] == MINUS){\n var on_flags = [],\n has_off = true,\n off_flags = []\n pos += 3\n }else{\n var on_flags = [chr(pattern[pos + 2])],\n has_off = false,\n off_flags = [],\n auL = auL_flags.indexOf(pattern[pos + 2]) > -1 ?\n 1 : 0,\n closed = false\n pos += 3\n while(pos < pattern.length){\n if(flags.indexOf(pattern[pos]) > -1){\n if(auL_flags.indexOf(pattern[pos]) > -1){\n auL++\n if(auL > 1){\n fail(\"bad inline flags: flags 'a', 'u'\" +\n \" and 'L' are incompatible\", pos)\n }\n }\n on_flags.push(chr(pattern[pos]))\n pos++\n }else if(pattern[pos] == MINUS){\n has_off = true\n closed = true\n pos++\n break\n }else if(String.fromCharCode(pattern[pos]).\n match(/[a-zA-Z]/)){\n fail(\"unknown flag\", pos)\n }else if(pattern[pos] == PARENTH_CLOSE){\n closed = true\n break\n }else if(pattern[pos] == COLON){\n yield new Group(pos, {name: \"Group\", type: \"flags\"})\n verbose_stack.push(verbose)\n closed = true\n break\n }else{\n fail(\"missing -, : or )\", pos)\n }\n }\n if(! closed){\n fail(\"missing -, : or )\", pos)\n }\n }\n if(has_off){\n while(pos < pattern.length){\n if(flags.indexOf(pattern[pos]) > -1){\n if(auL_flags.indexOf(pattern[pos]) > -1){\n fail(\"bad inline flags: cannot turn off \" +\n \"flags 'a', 'u' and 'L'\", pos)\n }\n if(on_flags.indexOf(chr(pattern[pos])) > -1){\n fail(\"bad inline flags: flag turned on and off\", pos)\n }\n off_flags.push(chr(pattern[pos]))\n pos++\n }else if(pattern[pos] == COLON){\n yield new Group(pos, {name: \"Group\", type: \"flags\"})\n verbose_stack.push(verbose)\n break\n }else if(String.fromCharCode(pattern[pos]).\n match(/[a-zA-Z]/)){\n fail(\"unknown flag\", pos)\n }else if(off_flags.length == 0){\n fail(\"missing flag\", pos)\n }else{\n fail(\"missing :\", pos)\n }\n }\n if(off_flags.length == 0){\n fail(\"missing flag\", pos)\n }\n }\n if(has_off && pattern[pos] != COLON){\n fail(\"missing :\", pos)\n }\n if(on_flags.length == 0 && off_flags.length == 0){\n fail(\"missing flag\", pos)\n }\n var set_flags = new SetFlags(flags_start,\n {on_flags, off_flags})\n\n yield set_flags\n // reset verbose\n if(on_flags.indexOf('x') > -1){\n verbose = true\n verbose_stack.push(verbose)\n }\n if(off_flags.indexOf('x') > -1){\n verbose = false\n }\n if(! closed){\n node = set_flags\n }\n pos++\n }else if(pattern[pos + 2] == ord('#')){\n pos += 3\n while(pos < pattern.length){\n if(pattern[pos] == PARENTH_CLOSE){\n break\n }\n pos++\n }\n if(pos == pattern.length){\n fail(\"missing ), unterminated comment\", pos)\n }\n pos++\n continue\n }else{\n fail(\"unknown extension ?\" + _b_.chr(pattern[pos + 2]),\n pos)\n }\n }else{\n yield new Group(pos)\n verbose_stack.push(verbose)\n pos++\n }\n }else if(cp == PARENTH_CLOSE){\n yield new GroupEnd(pos)\n verbose_stack.pop()\n verbose = $last(verbose_stack)\n pos++\n }else if(cp == BACKSLASH){\n var escape = escaped_char({codepoints: pattern, pos, is_bytes})\n if(escape instanceof CharacterClass){\n yield escape\n pos += escape.length\n }else if(escape.char !== undefined){\n yield new Char(pos, escape.ord)\n pos += escape.length\n }else if(escape.type == \"backref\"){\n var len = escape.length\n if(escape.value.length > 2){\n escape.value = escape.value.substr(0, 2)\n len = 2\n }\n yield new BackReference(pos, \"num\", escape.value)\n pos += len\n }else if(typeof escape == \"number\"){\n // eg \"\\.\"\n var esc = new Char(pos, escape)\n esc.escaped = true\n yield esc\n pos += 2\n }else{\n yield new Char(pos, escape)\n pos += escape.length\n }\n }else if(cp == BRACKET_OPEN){\n // Set of characters\n var set,\n end_pos\n [set, end_pos] = parse_character_set(pattern, pos, is_bytes)\n yield new CharacterSet(pos, set)\n pos = end_pos + 1\n }else if('+?*'.indexOf(char) > -1){\n yield new Repeater(pos, char)\n pos++\n }else if(cp == BRACE_OPEN){\n var reps = /\\{(\\d*)((,)(\\d*))?\\}/.exec(\n from_codepoint_list(pattern.slice(pos)))\n if(reps && reps[0] != '{}'){\n if(reps[1] == \"\"){\n var limits = [0]\n }else{\n var limits = [parseInt(reps[1])]\n }\n if(reps[4] !== undefined){\n if(reps[4] == \"\"){\n var max = Number.POSITIVE_INFINITY\n }else{\n var max = parseInt(reps[4])\n }\n limits.push(max)\n }\n yield new Repeater(pos, limits)\n pos += reps[0].length\n }else if(pattern[pos + 1] == BRACE_CLOSE){\n // {} is the characters \"{\" and \"}\"\n yield new Char(pos, BRACE_OPEN)\n pos++\n }else{\n yield new Char(pos, BRACE_OPEN)\n pos++\n }\n }else if(cp == OR){\n yield new Or(pos)\n pos++\n }else if(cp == DOT){\n yield new CharacterClass(pos, cp, 1)\n pos++\n }else if(cp == CARET){\n yield new StringStart(pos)\n pos++\n }else if(cp == DOLLAR){\n yield new StringEnd(pos)\n pos++\n }else{\n yield new Char(pos, cp)\n pos++\n }\n }\n}\n\nfunction transform_repl(data, pattern){\n // data.repl is a StringObj instance\n var repl = data.repl.string\n repl = repl.replace(/\\\\n/g, '\\n')\n repl = repl.replace(/\\\\r/g, '\\r')\n repl = repl.replace(/\\\\t/g, '\\t')\n repl = repl.replace(/\\\\b/g, '\\b')\n repl = repl.replace(/\\\\v/g, '\\v')\n repl = repl.replace(/\\\\f/g, '\\f')\n repl = repl.replace(/\\\\a/g, '\\x07')\n // detect backreferences\n var pos = 0,\n escaped = false,\n br = false,\n repl1 = \"\",\n has_backref = false\n while(pos < repl.length){\n br = false\n if(repl[pos] == \"\\\\\"){\n escaped = ! escaped\n if(escaped){\n pos++\n continue\n }\n }else if(escaped){\n escaped = false\n var mo = /^\\d+/.exec(repl.substr(pos))\n if(mo){\n var cps = to_codepoint_list(repl)\n var escape = escaped_char({\n codepoints: cps,\n pos: pos - 1,\n is_bytes: cps.type == \"bytes\"\n })\n if(escape.type == \"o\"){\n if(escape.ord > 0o377){\n fail(`octal escape value \\\\${mo[0]} ` +\n \" outside of range 0-0o377\", pos)\n }\n repl1 += escape.char\n pos += escape.length - 1\n continue\n }else if(escape.type != \"backref\"){\n var group_num = mo[0].substr(0,\n Math.min(2, mo[0].length))\n fail(`invalid group reference ${group_num}`, pos)\n }else{\n // only keep first 2 digits\n var group_num = mo[0].substr(0,\n Math.min(2, mo[0].length))\n // check that pattern has the specified group num\n if(pattern.groups === undefined){\n throw _b_.AttributeError.$factory(\"$groups\")\n }\n if(pattern.groups[group_num] === undefined){\n fail(`invalid group reference ${group_num}`,\n pos)\n }else{\n mo[0] = group_num\n }\n }\n if(! has_backref){\n var parts = [repl.substr(0, pos - 1),\n parseInt(mo[0])]\n }else{\n parts.push(repl.substring(next_pos, pos - 1))\n parts.push(parseInt(mo[0]))\n }\n has_backref = true\n var next_pos = pos + mo[0].length\n br = true\n pos += mo[0].length\n }else if(repl[pos] == \"g\"){\n pos++\n if(repl[pos] != '<'){\n fail(\"missing <\", pos)\n }\n pos++\n mo = /(.*?)>/.exec(repl.substr(pos))\n if(mo){\n if(mo[1] == \"\"){\n pos += mo[0].length\n fail(\"missing group name\", pos - 1)\n }\n var group_name = mo[1]\n if(group_name == '0'){\n // The backreference \\g<0> substitutes in the entire\n // substring matched by the RE.\n }else if(/^\\d+$/.exec(group_name)){\n if(pattern.groups[group_name] === undefined){\n fail(`invalid group reference ${group_name}`,\n pos)\n }\n }else{\n try{\n var group_num = _b_.int.$factory(group_name)\n if(group_num < 0){\n fail(`bad character in group name ` +\n `'${group_name}' at position ${pos}`, pos)\n }\n warn(_b_.DeprecationWarning,\n `bad character in group name '${group_name}' ` +\n `at position ${pos}`)\n mo[1] = group_name = group_num + ''\n }catch(err){\n if(! _b_.str.isidentifier(group_name)){\n var cps = to_codepoint_list(group_name)\n if(! $B.is_XID_Start(cps[0])){\n fail(\"bad character in group name '\" +\n group_name + \"'\", pos)\n }else{\n for(cp of cps.slice(1)){\n if(! $B.is_XID_Continue(cp)){\n fail(\"bad character in group name '\" +\n group_name + \"'\", pos)\n }\n }\n }\n }else if(data.type == \"bytes\" && ! is_ascii(group_name)){\n var b = _b_.bytes.$factory(group_name, 'latin-1'),\n s = _b_.bytes.decode(b, 'ascii', 'backslashreplace')\n warn(_b_.DeprecationWarning,\n `bad character in group name '${s}'` +\n ` at position ${pos}`)\n }\n }\n if(pattern.groups[group_name] === undefined){\n throw _b_.IndexError.$factory(\n `unknown group name '${group_name}'`,\n pos)\n }\n }\n if(! has_backref){\n var parts = [repl.substr(0, pos - 3),\n mo[1]]\n }else{\n parts.push(repl.substring(next_pos, pos - 3))\n parts.push(mo[1])\n }\n has_backref = true\n var next_pos = pos + mo[0].length\n br = true\n pos = next_pos\n }else{\n if(repl.substr(pos).length > 0){\n fail(\"missing >, unterminated name\", pos)\n }else{\n fail(\"missing group name\", pos)\n }\n }\n }else{\n if(/[a-zA-Z]/.exec(repl[pos])){\n fail(\"unknown escape\", pos)\n }\n pos += repl[pos]\n }\n }\n if(! br){\n repl1 += repl[pos]\n pos ++\n }\n }\n data.repl1 = repl1\n if(has_backref){\n parts.push(repl.substr(next_pos))\n data.repl = function(bmo){\n var mo = bmo.mo,\n res = parts[0],\n groups = mo.$groups,\n s = mo.string,\n group,\n is_bytes = s.type == 'bytes'\n for(var i = 1, len = parts.length; i < len; i += 2){\n if(parts[i] == 0){\n var x = s.substring(mo.start, mo.end)\n if(is_bytes){\n x = _b_.bytes.decode(x, 'latin-1')\n }\n res += x\n }else if(groups[parts[i]] === undefined){\n if(mo.node.$groups[parts[i]] !== undefined){\n // group is defined in the RE, but didn't contribute\n // to the match\n // groups[parts[i]] = ''\n }else{\n // group is not defined in the RE\n pos++\n group_num = parts[i].toString().substr(0, 2)\n fail(`invalid group reference ${group_num}`, pos)\n }\n }else{\n group = groups[parts[i]]\n var x = s.substring(group.start, group.end)\n if(is_bytes){\n x = _b_.bytes.decode(x, 'latin-1')\n }\n res += x\n }\n res += parts[i + 1]\n }\n return res\n }\n }else{\n data.repl = new StringObj(repl)\n }\n return data\n}\n\n\n\nvar Flag = $B.make_class(\"Flag\",\n function(value){\n return {\n __class__: Flag,\n value\n }\n }\n)\n\nFlag.__and__ = function(self, other){\n if(other.__class__ === Flag){\n return Flag.$factory(self.value & other.value)\n }else if(typeof other == \"number\" || typeof other == \"boolean\"){\n return Flag.$factory(self.value & other)\n }\n return _b_.NotImplemented\n}\n\nFlag.__index__ = function(self){\n return self.value\n}\n\nFlag.__invert__ = function(self){\n return Flag.$factory(~self.value)\n}\n\nFlag.__eq__ = function(self, other){\n return self.value == other.value\n}\n\nFlag.__or__ = function(self, other){\n if(other.__class__ === Flag){\n return Flag.$factory(self.value | other.value)\n }else if(typeof other == \"number\" || typeof other == \"boolean\"){\n return Flag.$factory(self.value | other)\n }\n return _b_.NotImplemented\n}\n\nFlag.__rand__ = function(self, other){\n if(typeof other == \"number\" || $B.$isinstance(other, _b_.int)){\n if(other == 0){\n return false // Flag.$factory(self.value)\n }\n return self.value & other\n }\n return _b_.NotImplemented\n}\n\nFlag.__ror__ = function(self, other){\n if(typeof other == \"number\" || $B.$isinstance(other, _b_.int)){\n if(other == 0){\n return self.value\n }\n return self.value | other\n }\n return _b_.NotImplemented\n}\n\nFlag.__repr__ = Flag.__str__ = function(self){\n if(self.value == 0){\n return \"re.none\"\n }\n var inverted = self.value < 0\n\n var t = [],\n value = inverted ? ~self.value : self.value\n for(var flag in inline_flags){\n if(value & inline_flags[flag].value){\n t.push('re.' + flag_names[flag])\n value &= ~inline_flags[flag].value\n }\n }\n if(value > 0){\n t.push('0x' + value.toString(16))\n }\n var res = t.join('|')\n if(inverted){\n if(t.length > 1){\n return '~(' + res + ')'\n }else{\n return '~' + res\n }\n }\n return res\n}\n\nFlag.__xor__ = function(self, other){\n return Flag.$factory(self.value ^ other.value)\n}\n\n$B.set_func_names(Flag, \"re\")\n\nvar no_flag = {}\n\nvar Scanner = $B.make_class(\"Scanner\",\n function(pattern, string, pos, endpos){\n var $ = $B.args('__init__', 4,\n {pattern: null, string: null, pos: null, endpos:null},\n ['pattern', 'string', 'pos', 'endpos'],\n arguments, {pos: 0, endpos: _b_.None}, null, null),\n endpos = endpos === _b_.None ? $.string.length : endpos\n return {\n __class__: Scanner,\n $string: $.string,\n pattern: $.pattern,\n pos: $.pos,\n endpos\n }\n }\n)\n\nScanner.match = function(self){\n return Pattern.match(self.pattern, self.$string)\n}\n\nScanner.search = function(self){\n if(! self.$iterator){\n self.$iterator = $module.finditer(self.pattern, self.$string)\n }\n // return last match\n var mo = _b_.None\n for(mo of self.$iterator.js_gen){\n // set mo\n }\n return mo\n}\n\nvar GroupIndex = $B.make_class(\"GroupIndex\",\n function(self, _default){\n var res = $B.empty_dict()\n res.__class__ = GroupIndex\n for(var key in self.$groups){\n if(isNaN(parseInt(key))){\n _b_.dict.$setitem(res, key, self.$groups[key].num)\n }\n }\n return res\n }\n)\nGroupIndex.__mro__ = [_b_.dict, _b_.object]\nGroupIndex.__setitem__ = function(){\n throw _b_.TypeError.$factory(\"read only\")\n}\n\n$B.set_func_names(GroupIndex, \"re\")\n\nvar Pattern = $B.make_class(\"Pattern\",\n function(pattern){\n var nb_groups = 0\n for(var key in pattern.groups){\n if(isFinite(key)){\n nb_groups++\n }\n }\n return {\n __class__: Pattern,\n pattern: pattern.text,\n groups: nb_groups,\n flags: pattern.flags,\n $groups: pattern.groups,\n $pattern: pattern\n }\n }\n)\n\nPattern.__copy__ = function(self){\n return self\n}\n\nPattern.__deepcopy__ = function(self){\n return self\n}\n\nPattern.__eq__ = function(self, other){\n if(other.$pattern && self.$pattern.type != other.$pattern.$type){\n // warn(_b_.BytesWarning, \"cannot compare str and bytes pattern\", 1)\n }\n return self.pattern == other.pattern &&\n self.flags.value == other.flags.value\n}\n\nPattern.__hash__ = function(self){\n // best effort ;-)\n return _b_.hash(self.pattern) + self.flags.value\n}\n\nPattern.__new__ = Pattern.$factory\n\nPattern.__reduce__ = function(self){\n return Pattern.__reduce_ex__(self, 4)\n}\n\nPattern.__reduce_ex__ = function(self, protocol){\n var res = _reconstructor,\n state = [self.__class__].concat(self.__class__.__mro__)\n var d = $B.empty_dict()\n _b_.dict.$setitem(d, 'pattern', self.pattern)\n _b_.dict.$setitem(d, 'flags', self.flags.value)\n state.push(d)\n return $B.fast_tuple([res, $B.fast_tuple(state)])\n}\n\nfunction _reconstructor(cls, base, state){\n var pattern = _b_.dict.$getitem(state, 'pattern'),\n flags = Flag.$factory(_b_.dict.$getitem(state, 'flags'))\n return $module.compile(pattern, flags)\n}\n\nPattern.__repr__ = Pattern.__str__ = function(self){\n var text = self.$pattern.text,\n s = text\n if(self.$pattern.type == \"bytes\"){\n s = _b_.str.$factory(_b_.str.encode(s, 'latin-1'))\n }else{\n s = _b_.repr(s)\n }\n s = s.substr(0, 200)\n var res = `re.compile(${s}`,\n flags = self.$pattern.flags\n if(flags === no_flag){\n return res + ')'\n }\n // mask UNICODE flag\n if(flags.__class__ === Flag){\n // copy flag, otherwise U.value would become 0\n flags = Flag.$factory(flags.value)\n flags.value &= ~U.value\n }else if(typeof flags == \"number\"){\n flags &= ~U.value\n }\n if(flags != 0 && flags.value != 0){\n res += `, ${_b_.str.$factory(flags)}`\n }\n return res + ')'\n}\n\nPattern.findall = function(self){\n var iter = Pattern.finditer.apply(null, arguments).js_gen,\n res = []\n\n while(true){\n var next = iter.next()\n if(next.done){\n return res\n }\n var bmo = next.value,\n mo = bmo.mo,\n groups = MatchObject.groups(bmo)\n\n // replace None by the empty string\n for(var i = 0, len = groups.length; i < len; i++){\n groups[i] = groups[i] === _b_.None ? \"\" : groups[i]\n }\n if(groups.length > 0){\n if(groups.length == 1){\n res.push(groups[0])\n }else{\n res.push($B.fast_tuple(groups))\n }\n }else{\n res.push(mo.string.substring(mo.start, mo.end))\n }\n }\n}\n\nPattern.finditer = function(self){\n var $ = $B.args(\"finditer\", 4,\n {self: null, string: null, pos: null, endpos: null},\n 'self string pos endpos'.split(' '), arguments,\n {pos: 0, endpos: _b_.None}, null, null)\n var original_string = $.string,\n data = prepare({string: $.string})\n var endpos = $.endpos === _b_.None ? data.string.length : $.endpos\n return $B.generator.$factory(iterator)(self.$pattern, data.string,\n no_flag, $.string, $.pos, endpos)\n}\n\nPattern.fullmatch = function(self, string){\n var $ = $B.args(\"match\", 4,\n {self: null, string: null, pos: null, endpos: null},\n [\"self\", \"string\", \"pos\", \"endpos\"], arguments,\n {pos: 0, endpos: _b_.None}, null, null)\n if($.endpos === _b_.None){\n $.endpos = $.string.length\n }\n var data = prepare({string: $.string})\n if(self.$pattern.type != data.string.type){\n throw _b_.TypeError.$factory(\"not the same type for pattern \" +\n \"and string\")\n }\n var fullmatch_pattern = create_fullmatch_pattern($.self.$pattern)\n var mo = match(fullmatch_pattern, data.string, $.pos, $.endpos)\n if(mo && mo.end - mo.start == $.endpos - $.pos){\n return MatchObject.$factory(mo)\n }else{\n return _b_.None\n }\n}\n\nPattern.groupindex = {\n __get__: function(self){\n return GroupIndex.$factory(self)\n }\n}\n\nPattern.match = function(self, string){\n var $ = $B.args(\"match\", 4,\n {self: null, string: null, pos: null, endpos: null},\n [\"self\", \"string\", \"pos\", \"endpos\"], arguments,\n {pos: 0, endpos: _b_.None}, null, null)\n if($.endpos === _b_.None){\n $.endpos = $.string.length\n }\n var data = prepare({string: $.string})\n if(self.$pattern.type != data.string.type){\n throw _b_.TypeError.$factory(\"not the same type for pattern \" +\n \"and string\")\n }\n var mo = match($.self.$pattern, data.string, $.pos,\n $.endpos)\n return mo ? MatchObject.$factory(mo) : _b_.None\n}\n\nPattern.scanner = function(self, string, pos, endpos){\n return Scanner.$factory.apply(null, arguments) // self, string, pos, endpos)\n}\n\nPattern.search = function(self, string){\n var $ = $B.args(\"match\", 4,\n {self: null, string: null, pos: null, endpos: null},\n [\"self\", \"string\", \"pos\", \"endpos\"], arguments,\n {pos: 0, endpos: _b_.None}, null, null)\n var data = prepare({string: $.string})\n if(self.$pattern.type != data.string.type){\n throw _b_.TypeError.$factory(\"not the same type for pattern \" +\n \"and string\")\n }\n if($.endpos === _b_.None){\n $.endpos = data.string.length\n }\n var pos = $.pos\n while(pos <= $.endpos){\n var mo = match(self.$pattern, data.string, pos)\n if(mo){\n return MatchObject.$factory(mo)\n }else{\n pos++\n }\n }\n return _b_.None\n}\n\nPattern.split = function(){\n return $module.split.apply(null, arguments)\n}\n\nPattern.sub = function(){\n var $ = $B.args(\"match\", 4,\n {self: null, repl: null, string: null, count: null},\n \"self repl string count\".split(' '), arguments,\n {count: 0}, null, null)\n var data = prepare({string: $.string})\n if($.self.$pattern.type != data.string.type){\n throw _b_.TypeError.$factory(\"not the same type for pattern \" +\n \"and string\")\n }\n\n return $module.sub($.self, $.repl, $.string, $.count)\n}\n\n$B.set_func_names(Pattern, \"re\")\n\nfunction Node(parent){\n this.parent = parent\n this.items = []\n}\n\nNode.prototype.add = function(item){\n this.items.push(item)\n item.parent = this\n}\n\nNode.prototype.fixed_length = function(){\n // Return the sum of items lengths if fixed, else undefined\n if(this.repeat){\n return false\n }\n var len = 0\n for(var item of this.items){\n if(item.fixed_length === undefined){\n console.log(\"pas de fixed length\", item)\n alert()\n }\n var sublen = item.fixed_length()\n if(sublen === false){\n return false\n }\n len += sublen\n }\n return len\n}\n\nfunction get_top(node){\n var top = node.parent\n while(top.parent){\n top = top.parent\n }\n return top\n}\n\nvar BackReference = function(pos, type, value){\n // for \"\\number\"\n this.name = \"BackReference\"\n this.pos = pos\n this.type = type // \"name\" or \"num\"\n this.value = value\n this.groups = []\n}\n\nBackReference.prototype.fixed_length = function(){\n // Return length of referenced group if it is fixed, else undefined\n if(this.repeat){\n return undefined\n }\n var group = this.get_group()\n if(group.fixed_length === undefined){\n console.log(\"group\", group, \"no fixed length\")\n }\n return group === undefined ? false : group.fixed_length()\n}\n\nBackReference.prototype.get_group = function(){\n var top = get_top(this)\n return top.$groups[this.value]\n}\n\nBackReference.prototype.match = function(string, pos, endpos, groups){\n this.repeat = this.repeat || {min: 1, max: 1}\n\n var group = groups[this.value]\n if(group === undefined){\n if(this.repeat.min == 0){\n return {\n nb_min: 0,\n nb_max: 0\n }\n }\n return false\n }\n\n // Get the codepoints matched by the referenced group\n group_cps = string.codepoints.slice(group.start, group.end)\n\n // search (repetitions of) the matched group codepoints\n var _pos = pos,\n nb = 0,\n group_len = group_cps.length,\n flag,\n cp\n while(string.cp_at(_pos) !== undefined && nb < this.repeat.max){\n flag = true\n for(var i = 0; i < group_len; i++){\n cp = string.cp_at(_pos + i)\n if(cp != group_cps[i]){\n flag = false\n break\n }\n }\n if(flag){\n nb++\n _pos += group_len\n }else{\n break\n }\n }\n if(nb >= this.repeat.min){\n // Returns the accepted minimum and maximum number of repeats\n // and the length of each repeat\n return {\n nb_min: this.repeat.min,\n nb_max: nb,\n group_len\n }\n }\n return false\n}\n\nBackReference.prototype.toString = function(){\n return \"BackRef to group\" + this.value\n}\n\nvar Case = function(){\n this.name = \"Case\"\n this.items = []\n this.groups = []\n this.text = 'Case '\n}\n\nCase.prototype.add = function(item){\n this.items.push(item)\n item.parent = this\n}\n\nCase.prototype.fixed_length = function(){\n var len\n for(var item of this.items){\n var fl = item.fixed_length()\n if(fl === false){\n return false\n }else if(len === undefined){\n len = fl\n }else{\n len += fl\n }\n }\n return len\n}\n\nCase.prototype.toString = function(){\n var res = 'Case '\n res += this.items.map(x => x + '').join(' ')\n return this.text = res\n}\n\nvar Choice = function(){\n this.type = \"choice\"\n this.items = []\n this.groups = []\n}\n\nChoice.prototype.add = Node.prototype.add\n\nChoice.prototype.fixed_length = function(){\n var len\n for(var item of this.items){\n var fl = item.fixed_length()\n if(fl === false){\n return false\n }else if(len === undefined){\n len = fl\n }else if(len != fl){\n return false\n }\n }\n return len\n}\n\nChoice.prototype.toString = function(){\n return 'Choice'\n}\n\nvar EmptyString = {\n toString: function(){\n return ''\n },\n match: function(string, pos, endpos){\n return {nb_min: 0, nb_max: 0}\n },\n fixed_length: function(){\n return 1\n },\n length: 0\n },\n Flags = function(flags){\n this.flags = flags\n },\n GroupEnd = function(pos){\n this.name = \"GroupEnd\"\n this.pos = pos\n this.text = ')'\n this.toString = function(){\n return '[end of group #' + this.group.num + ']'\n }\n },\n Or = function(pos){\n this.name = \"Or\"\n this.pos = pos\n this.text = '|'\n this.toString = function(){\n return '|'\n }\n },\n Repeater = function(pos, op){\n this.name = \"Repeater\"\n this.pos = pos\n this.op = op\n }\n\nfunction cased_cps(cp, ignore_case, ascii){\n // If cp is the codepoint of a cased Unicode character, return the list\n // of the codepoints that match the character in a case-insensitive way\n\n // ignore_case = this.flags && this.flags.value & IGNORECASE.value\n // ascii = this.flags.value & ASCII.value\n var cps,\n char = $B.codepoint2jsstring(cp)\n if(! ignore_case){\n return [cp]\n }\n if(ascii){\n // only test ASCII letters\n ignore_case = ignore_case && (\n (char >= 'a' && char <= 'z') ||\n (char >= 'A' && char <= 'Z'))\n }\n if(ignore_case){\n var char_up = char.toUpperCase(),\n char_low = char.toLowerCase(),\n cps = new Set([cp, $B.jsstring2codepoint(char_low),\n $B.jsstring2codepoint(char_up)])\n // special cases\n if(char.toLowerCase() == \"k\"){\n cps.add(0x212a) // Kelvin sign\n }\n if(cp == 0x212a){\n cps.add(ord('k'))\n cps.add(ord('K'))\n }\n if(char.toLowerCase() == \"s\"){\n cps.add(0x017f) // (Latin small letter long s)\n }\n if(cp == 0x017f){\n cps.add(ord('s'))\n cps.add(ord('S'))\n }\n if(char.toLowerCase() == 'i'){\n cps.add(0x0130) // (Latin capital letter I with dot above)\n cps.add(0x0131) // (Latin small letter dotless i)\n }\n if(cp == 0x0130 || cp == 0x0131){\n cps.add(ord('i'))\n cps.add(ord('I'))\n }\n return Array.from(cps)\n }else{\n cps = [cp]\n }\n return cps\n}\n\nvar Char = function(pos, cp, groups){\n // character in a regular expression or in a character set\n // pos : position of the character in the pattern string\n // cp : the character's codepoint\n // groups (optional) : the groups that contain the character\n this.pos = pos\n this.cp = cp\n this.char = chr(this.cp)\n this.text = this.char\n}\n\nChar.prototype.fixed_length = function(){\n if(this.repeat){\n return this.repeat.min\n }\n return this.char === EmptyString ? 0 : 1\n}\n\nChar.prototype.match = function(string, pos, endpos){\n // Returns {pos1, pos2} such that \"this\" matches all the substrings\n // string[pos:i] with pos1 <= i < pos2, or false if no match\n this.repeat = this.repeat || {min: 1, max: 1}\n\n var i = 0\n\n // browse string codepoints until they don't match, or the number of\n // matches is above the maximum allowed\n if(this.flags){\n if(this.flags.value & ASCII.value){\n if(this.cp > 127){\n return false\n }\n }\n if(this.flags.value & IGNORECASE.value &&\n (! this.is_bytes || this.cp <= 127)){\n // Flag IGNORECASE set\n // For bytes pattern, case insensitive matching only works\n // for ASCII characters\n var char_upper = this.char.toUpperCase(),\n char_lower = this.char.toLowerCase(),\n cp\n while(i < this.repeat.max && pos + i < endpos){\n cp = string.cp_at(pos + i)\n var char = chr(cp)\n if(char.toUpperCase() != char_upper &&\n char.toLowerCase() != char_lower){\n break\n }\n i++\n }\n }else{\n while(pos + i < endpos &&\n string.cp_at(pos + i) == this.cp &&\n i < this.repeat.max){\n i++\n }\n }\n }else{\n while(pos + i < endpos &&\n string.cp_at(pos + i) == this.cp &&\n i < this.repeat.max){\n i++\n }\n }\n var nb = i\n if(nb >= this.repeat.min){\n // Number of repeats ok\n return {\n nb_min: this.repeat.min,\n nb_max: nb\n }\n }else{\n return false\n }\n}\n\nChar.prototype.toString = function(){\n var res = 'Char ' + this.text\n if(this.repeat !== undefined){\n res += ' repeat {' + this.repeat.min + ',' + this.repeat.max + '}'\n if(this.non_greedy){\n res += '?'\n }\n }\n return res\n}\n\nfunction CharSeq(chars, flags){\n // sequence of consecutive characters\n this.chars = chars\n this.flags = flags\n this.merge_same_chars()\n}\n\nCharSeq.prototype.add_char = function(char){\n this.chars.push(char)\n this.merge_same_chars()\n}\n\nCharSeq.prototype.fixed_length = function(){\n var len = 0,\n cps = [],\n char_len\n for(var char of this.chars){\n if(! char.repeat){\n char_len = 1\n }else if(char.repeat.min == char.repeat.max){\n char_len = char.repeat.min\n }else{\n len = false\n break\n }\n for(var i = 0; i < char_len; i++){\n cps.push(char.cp)\n }\n len += char_len\n }\n this.cps = cps\n return this.len = len\n}\n\nCharSeq.prototype.match = function(string, pos, endpos){\n var mos = [],\n i = 0,\n backtrack,\n nb\n this.len = this.len === undefined ? this.fixed_length() : this.len\n // optimization if character sequence has a fixed length\n if(this.len !== false && ! (this.flags.value & IGNORECASE.value)){\n for(var i = 0; i < this.len; i++){\n if(string.cp_at(pos + i) !== this.cps[i]){\n return false\n }\n }\n return {nb_min: this.len, nb_max: this.len}\n }\n for(var i = 0, len = this.chars.length; i < len; i++){\n var char = this.chars[i],\n mo = char.match(string, pos, endpos) // form {nb_min, nb_max}\n if(_debug.value){\n console.log('CharSeq match, pos', pos, 'char', char, 'mo', mo)\n alert()\n }\n if(mo){\n nb = char.non_greedy ? mo.nb_min : mo.nb_max\n mos.push({nb,\n nb_min: mo.nb_min,\n nb_max: mo.nb_max,\n non_greedy: !!char.non_greedy\n })\n pos += nb\n }else{\n // backtrack\n backtrack = false\n while(mos.length > 0){\n i--\n mo = mos.pop()\n pos -= mo.nb\n nb = mo.nb\n if(mo.non_greedy && nb < mo.nb_max){\n nb += 1\n backtrack = true\n }else if(! mo.non_greedy && nb - 1 >= mo.nb_min){\n nb -= 1\n backtrack = true\n }\n if(backtrack){\n pos += nb\n mo.nb = nb\n mos.push(mo)\n break\n }\n }\n if(mos.length == 0){\n return false\n }\n }\n }\n var nb = 0,\n last_mo = $B.last(mos)\n for(var mo of mos.slice(0, mos.length - 1)){\n nb += mo.nb\n }\n var res = {\n nb_min: nb + last_mo.nb_min,\n nb_max: nb + last_mo.nb_max\n }\n return res\n}\n\nCharSeq.prototype.merge_same_chars = function(){\n // b?b merged into b+ etc.\n var current,\n chars = [],\n merged\n for(var item of this.chars){\n if(current && current.char == item.char &&\n current.non_greedy === item.non_greedy){\n if(! current.repeat){\n current.repeat = {min: 1, max: 1}\n }\n if(item.repeat){\n current.repeat.min += item.repeat.min\n current.repeat.max += item.repeat.max\n }else{\n current.repeat.min += 1\n current.repeat.max += 1\n }\n merged = true\n }else{\n chars.push(item)\n }\n current = item\n }\n if(merged){\n this.chars = chars\n }\n}\n\nCharSeq.prototype.toString = function(){\n var res = ''\n for(var char of this.chars){\n res += char.text\n }\n return 'CharSeq ' + res\n}\n\nfunction CharacterClass(pos, cp, length, groups){\n this.cp = cp\n this.value = chr(cp)\n this.length = length\n this.pos = pos\n\n var flags = this.flags\n\n // Test function : test(string, pos) returns:\n // - true if \"this\" matches 1 character string[pos]\n // - [true, 0] if \"this\" matches the empty string at pos\n // - false or undefined if \"this\" doesn't match\n switch(this.value){\n case 'A':\n this.test_func = function(string, pos){\n if(pos == 0){\n return [true, 0]\n }\n }\n break\n case 's':\n this.test_func = function(string, pos){\n var cp = string.cp_at(pos)\n return $B.in_unicode_category('Zs', cp) ||\n $B.unicode_bidi_whitespace.indexOf(cp) > -1\n }\n break\n case 'S':\n this.test_func = function(string, pos){\n var cp = string.cp_at(pos)\n return cp !== undefined &&\n ! $B.in_unicode_category('Zs', cp) &&\n $B.unicode_bidi_whitespace.indexOf(cp) == -1\n }\n break\n case '.':\n this.test_func = function(string, pos){\n if(string.cp_at(pos) === undefined){\n return false\n }\n if(this.flags.value & DOTALL.value){\n return true\n }else{\n return string.cp_at(pos) != 10\n }\n }\n break\n case 'd':\n this.test_func = function(string, pos){\n if(this.flags === undefined){\n console.log(\"\\\\d, no flags\", this)\n }\n var cp = string.cp_at(pos),\n tester = (this.flags.value & ASCII.value) ?\n is_ascii_digit : is_digit\n return tester(cp)\n }\n break\n case 'D':\n this.test_func = function(string, pos){\n var cp = string.cp_at(pos),\n tester = (this.flags.value & ASCII.value) ?\n is_ascii_digit : is_digit\n return ! tester(cp)\n }\n break\n case 'b':\n this.test_func = function(string, pos){\n var tester = is_word\n if(this.is_bytes || (this.flags.value & ASCII.value)){\n tester = is_ascii_word\n }\n var cp = string.cp_at(pos),\n ok = {nb_min: 0, nb_max: 0}\n\n // return true if char at pos is at the beginning or start\n // of a word\n if(pos == 0 && tester(cp)){\n return ok\n }\n if(string.cp_at(pos) === undefined && tester(string.cp_at(pos - 1))){\n return ok\n }\n if(pos > 0 && string.cp_at(pos) !== undefined){\n if((tester(string.cp_at(pos - 1))) !==\n tester(cp)){\n return ok\n }\n }\n return false\n }\n break\n case 'B':\n this.test_func = function(string, pos){\n var tester = is_word\n if(this.is_bytes || (this.flags.value & ASCII.value)){\n tester = is_ascii_word\n }\n\n var cp = string.cp_at(pos),\n ok = {nb_min: 0, nb_max: 0}\n // test is true if char at pos is not at the beginning or\n // start of a word\n if(pos == 0 && cp === undefined){\n // empty string\n return false\n }\n if(pos == 0 && tester(cp)){\n return false\n }\n if(cp === undefined &&\n tester(string.cp_at(pos - 1))){\n return false\n }\n if(pos > 0 && cp !== undefined){\n if(tester(string.cp_at(pos - 1)) !== tester(cp)){\n return false\n }\n }\n return ok\n }\n break\n case 'w':\n this.test_func = function(string, pos){\n var tester = is_word\n if(this.is_bytes || (this.flags.value & ASCII.value)){\n tester = is_ascii_word\n }\n return tester(string.cp_at(pos))\n }\n break\n case 'W':\n this.test_func = function(string, pos){\n var tester = is_word\n if(this.is_bytes || (this.flags.value & ASCII.value)){\n tester = is_ascii_word\n }\n return ! tester(string.cp_at(pos))\n }\n break\n case 'Z':\n this.test_func = function(string, pos){\n if(string.cp_at(pos) === undefined){\n return {nb_min: 0, nb_max: 0}\n }\n }\n break\n }\n}\n\nCharacterClass.prototype.fixed_length = function(){\n return this.repeat ? false : 1\n}\n\nCharacterClass.prototype.match = function(string, pos, endpos){\n // Returns {pos1, pos2} such that \"this\" matches all the substrings\n // string[pos:i] with pos1 <= i < pos2, or false if no match\n if(pos === undefined){\n console.log('no pos')\n throw Error()\n }\n var len = string.length\n this.repeat = this.repeat || {min: 1, max: 1}\n\n // browse string codepoints until they don't match, or the number of\n // matches is above the maximum allowed\n var i = 0\n while(i < this.repeat.max && i < len){\n var test = this.test_func(string, pos + i, this.flags)\n if(! test){\n break\n }\n i++\n }\n\n var nb = i\n if(nb >= this.repeat.min){\n // Number of repeats ok\n if('bBAZ'.indexOf(this.value) > -1 ){\n return {nb_min: 0, nb_max: 0}\n }\n return {\n nb_min: this.repeat.min,\n nb_max: nb\n }\n }else{\n return false\n }\n}\n\nCharacterClass.prototype.nb_repeats = Char.prototype.nb_repeats\n\nCharacterClass.prototype.toString = function(){\n return '\\\\' + this.value\n}\n\nvar CharacterSet = function(pos, set, groups){\n // character set\n this.pos = pos\n this.set = set\n this.neg = set.neg\n}\n\nCharacterSet.prototype.fixed_length = function(){\n return 1\n}\n\nCharacterSet.prototype.match = function(string, pos, endpos){\n var ignore_case = this.flags && (this.flags.value & IGNORECASE.value),\n test,\n match = false,\n i = 0,\n cp\n\n this.repeat = this.repeat || {min: 1, max: 1}\n\n while(i < this.repeat.max && (cp = string.cp_at(pos + i)) !== undefined){\n test = false\n\n if(string.cp_at(pos) === undefined){\n cp = EmptyString\n }\n try{\n $B.codepoint2jsstring(cp)\n }catch(err){\n console.log(err.message)\n console.log('cp', cp, '\\nstring', string, 'pos', pos)\n console.log($B.print_stack())\n throw _b_.Exception.$factory('bad codepoint')\n }\n var char = $B.codepoint2jsstring(cp),\n cps = cased_cps(cp, ignore_case, this.flags.value & ASCII.value),\n char_is_cased = cps.length > 1\n\n for(var cp1 of cps){\n for(var item of this.set.items){\n if(typeof item == 'string'){\n\n }\n if(Array.isArray(item.ord)){\n if(cp1 >= item.ord[0] &&\n cp1 <= item.ord[1]){\n test = true\n break\n }else if(ignore_case && char_is_cased){\n var start1 = chr(item.ord[0]).toUpperCase(),\n end1 = chr(item.ord[1]).toUpperCase(),\n char1 = char.toUpperCase()\n if(char1 >= start1 && char1 <= end1){\n test = true\n }\n var start1 = chr(item.ord[0]).toLowerCase(),\n end1 = chr(item.ord[1]).toLowerCase(),\n char1 = char.toLowerCase()\n if(char1 >= start1 && char1 <= end1){\n test = true\n }\n }\n }else if(item instanceof CharacterClass){\n test = !! item.match(string, pos + i, endpos) // boolean\n }else{\n if(item.ord == cp1){\n test = true\n break\n }\n item_str = typeof item == 'string' ? item : chr(item.ord)\n if(item_str == char){\n test = true\n break\n }\n if(ignore_case && char_is_cased &&\n (char.toUpperCase() == item_str.toUpperCase() ||\n char.toLowerCase() == item_str.toLowerCase())){\n test = true\n break\n }\n }\n }\n }\n if(this.neg){\n test = ! test\n }\n if(test){\n i++\n }else{\n break\n }\n }\n var nb = i\n if(nb >= this.repeat.min){\n // Number of repeats ok\n return {\n nb_min: this.repeat.min,\n nb_max: nb\n }\n }else{\n return false\n }\n\n}\n\nCharacterSet.prototype.nb_repeats = Char.prototype.nb_repeats\n\nCharacterSet.prototype.toString = function(){\n return 'CharSet'\n}\n\nvar ConditionalBackref = function(pos, group_ref){\n this.type = \"conditional backref\"\n this.pos = pos\n this.group_ref = group_ref\n this.chars = []\n this.match_codepoints = []\n this.nb_success = 0\n this.re_if_exists = new Group(pos)\n this.re_if_not_exists = new Group(pos)\n this.nb_options = 1\n}\n\nConditionalBackref.prototype.add = function(item){\n if(this.nb_options == 1){\n this.re_if_exists.add(item)\n }else if(this.nb_options == 2){\n this.re_if_not_exists.add(item)\n }\n item.parent = this\n}\n\nConditionalBackref.prototype.fixed_length = function(){\n var len = this.re_if_exists.fixed_length()\n if(len !== false && len == this.re_if_not_exists.fixed_length()){\n return len\n }\n return false\n}\n\nConditionalBackref.prototype.match = function(string, pos, endpos, groups){\n var re = groups[this.group_ref] ? this.re_if_exists :\n this.re_if_not_exists,\n pattern = {node: re, text: re + ''},\n mo = match(pattern, string, pos, endpos, false, groups)\n if(mo){\n return {nb_min: mo.end - mo.start, nb_max: mo.end - mo.start}\n }\n return false\n}\n\nConditionalBackref.prototype.toString = function(){\n return 'ConditionalBackref'\n}\n\nvar Group = function(pos, extension){\n this.type = \"group\"\n this.pos = pos\n this.items = []\n this.chars = []\n this.groups = []\n for(var key in extension){\n this[key] = extension[key]\n }\n if(extension && extension.type){\n if(extension.type.indexOf('lookahead') > -1){\n this.is_lookahead = true\n }else if(extension.type.indexOf('lookbehind') > -1){\n this.is_lookbehind = true\n }\n }\n}\n\nGroup.prototype.add = Node.prototype.add\n\nGroup.prototype.toString = function(){\n if(this.num === undefined){\n var res = 'Group ' + this.type + ' ' + this.pattern\n }else{\n var res = 'Group #' + this.num + ' ' + this.pattern\n }\n if(this.repeat !== undefined){\n res += ' repeat {' + this.repeat.min + ',' + this.repeat.max + '}'\n if(this.non_greedy){\n res += '?'\n }\n }\n return res\n}\n\nBackReference.prototype.nb_repeats = Group.prototype.nb_repeats\n\nGroup.prototype.fixed_length = Node.prototype.fixed_length\n\nfunction groups_in(pattern, group_list){\n if(group_list === undefined){\n group_list = new Set()\n }\n if(pattern instanceof Group && pattern.hasOwnProperty('num')){\n group_list.add(pattern.num)\n }\n if(pattern.items){\n for(var subpattern of pattern.items){\n for(var group of groups_in(subpattern, group_list)){\n group_list.add(group)\n }\n }\n }\n return group_list\n}\n\nfunction GroupRef(group_num, item){\n this.num = group_num\n this.item = item\n}\n\nGroupRef.prototype.fixed_length = function(){\n return this.item.fixed_length()\n}\n\nfunction Lookbehind(item){\n this.re = item\n this.neg = this.re.type == \"negative_lookbehind\"\n}\n\nLookbehind.prototype.match = function(string, pos, endpos, groups){\n var ok = {nb_min: 0, nb_max: 0},\n pattern = {node: this.re, text: this.re + ''},\n length = this.re.length,\n mo\n if(pos - length < 0){\n mo = false\n }else{\n mo = match(pattern, string, pos - length, endpos, false, groups)\n }\n if(mo){\n return this.neg ? false : ok\n }else{\n return this.neg ? ok : false\n }\n}\n\nLookbehind.prototype.fixed_length = function(){\n return this.re.fixed_length()\n}\n\nLookbehind.prototype.toString = function(){\n return \"Lookbehind\"\n}\n\nfunction SetFlags(pos, flags){\n this.pos = pos\n this.on_flags = flags.on_flags\n this.off_flags = flags.off_flags\n this.items = []\n}\n\nSetFlags.prototype.add = Node.prototype.add\n\nfunction StringStart(pos){\n this.pos = pos\n}\n\nStringStart.prototype.match = function(string, pos, endpos){\n var ok = {nb_min:0, nb_max: 0}\n if(this.flags.value & MULTILINE.value){\n return (pos == 0 || string.cp_at(pos - 1) == 10) ? ok : false\n }\n return pos == 0 ? ok : false\n}\n\nStringStart.prototype.fixed_length = function(){\n return 0\n}\n\nStringStart.prototype.toString = function(){\n return '^'\n}\n\nfunction StringEnd(pos){\n this.pos = pos\n}\n\nStringEnd.prototype.match = function(string, pos, endpos){\n var ok = {nb_min:0, nb_max: 0},\n cp = string.cp_at(pos)\n if(this.flags.value & MULTILINE.value){\n return (pos > string.codepoints.length - 1 ||\n cp == 10) ? ok : false\n }\n return pos > endpos - 1 ? ok :\n (pos == endpos - 1 && cp == 10) ? ok : false\n}\n\nStringEnd.prototype.fixed_length = function(){\n return 0\n}\n\nStringEnd.prototype.toString = function(){\n return '$'\n}\n\nvar cache = new Map()\n\nfunction compile(pattern, flags){\n if(pattern.__class__ === Pattern){\n if(flags !== no_flag){\n throw _b_.ValueError.$factory(\"no flags\")\n }\n return pattern\n }\n if(cache.has(pattern.py_obj)){\n if(cache.get(pattern.py_obj).has(flags.value || 0)){\n return cache.get(pattern.py_obj).get(flags.value || 0)\n }\n }\n var original_pattern = pattern,\n original_flags = flags,\n type = pattern.type,\n choices,\n allow_global_flags = true\n pattern = pattern.codepoints\n var is_bytes = type !== \"str\"\n if(is_bytes && flags && (flags.value & U.value)){\n throw _b_.ValueError.$factory(\"cannot use UNICODE flag with \" +\n \"a bytes pattern\")\n }\n if(flags && (flags.value & U.value) &&\n (flags.value & ASCII.value)){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n if(is_bytes){\n // bytes patterns ignore re.ASCII flag\n flags = Flag.$factory(flags.value || 0)\n //flags.value &= ~ASCII.value\n }\n var group_num = 0,\n group_stack = [],\n groups = {},\n pos,\n lookbehind,\n node = new Node(),\n accept_inline_flag = true,\n verbose = (flags.value || 0) & VERBOSE.value,\n comment = false,\n backrefs = {}\n node.$groups = groups\n for(var item of tokenize(pattern, type, verbose)){\n item.flags = flags\n item.is_bytes = is_bytes\n if(lookbehind){\n item.lookbehind = lookbehind\n lookbehind.parent = item\n lookbehind = false\n }\n if(allow_global_flags &&\n (group_stack.length > 0 || ! (item instanceof SetFlags))){\n allow_global_flags = false\n }\n if(item instanceof Group){\n group_stack.push(item)\n node.add(item)\n item.state = \"open\"\n group_num++\n item.num = group_num\n node = item // next items will be stored as group's items\n pos = item.pos\n if(item.non_capturing){\n delete item.num\n group_num--\n }else if(item.type == \"name_def\"){\n var value = item.value\n if(groups[value.string] !== undefined){\n fail(`redefinition of group name` +\n ` '${value.string}' as group ${group_num}; was group` +\n ` ${groups[value.string].num}`, pos)\n }\n item.name = value.string\n groups[value.string] = groups[group_num] =\n new GroupRef(group_num, item)\n }else if(item.is_lookahead){\n // a lookahead assertion is relative to the previous regexp\n group_num--\n while(node.items.length > 0){\n item.add(node.items.shift())\n }\n node = item\n }else if(item.is_lookbehind){\n // a lookbehind assertion is relative to the next regexp\n node.parent.items.pop() // remove from node items\n // temporarily create a group\n groups[group_num] = new GroupRef(group_num, item)\n }else if(item.type == \"flags\"){\n // save flags before a group with inline flags, eg \"(?i:a)\"\n item.flags_before = Flag.$factory(flags.value | 0)\n }else{\n groups[group_num] = new GroupRef(group_num, item)\n }\n }else if(item instanceof GroupEnd){\n end_pos = item.pos\n if(group_stack.length == 0){\n fail(\"unbalanced parenthesis\", end_pos, original_pattern)\n }\n var item = group_stack.pop()\n item.end_pos = end_pos\n try{\n item.pattern = from_codepoint_list(\n pattern.slice(item.pos, end_pos + 1))\n }catch(err){\n console.log(\"err avec pattern substring\", pattern)\n throw err\n }\n if(item.is_lookbehind){\n delete groups[group_num]\n group_num--\n // check that all elements have a fixed length\n item.length = item.fixed_length()\n if(item.length === false){\n fail(\"look-behind requires fixed-width pattern\", pos)\n }\n item.parent.add(new Lookbehind(item))\n item.non_capturing = true\n // store in variable \"lookbehind\", will be applied to next item\n lookbehind = item\n }else if(item.is_lookahead){\n delete item.num\n }\n if(item instanceof Group && item.items.length == 0){\n item.add(EmptyString)\n }else if(item instanceof ConditionalBackref){\n if(groups[item.group_ref] === undefined){\n // might be defined later; store in backrefs and check\n // when all items have been processed\n backrefs[item.group_ref] = backrefs[item.group_ref] | pos + 3\n }\n if(item.re_if_exists.items.length == 0){\n item.re_if_exists.add(EmptyString)\n }else if(item.re_if_not_exists.items.length == 0){\n item.re_if_not_exists.pos = pos\n item.re_if_not_exists.add(EmptyString)\n }\n }else if(item.type == \"flags\"){\n // restore flags when entering the group\n flags = Flag.$factory(item.flags_before.value)\n }\n item.state = 'closed'\n node = item.parent\n }else if(item instanceof ConditionalBackref){\n var pos = item.pos,\n group_ref = item.group_ref\n if(typeof group_ref == \"number\"){\n if(group_ref == 0){\n fail(`bad group number`, pos + 3)\n }else if(group_ref >= MAXGROUPS){\n fail(`invalid group reference ${group_ref}`, pos + 1)\n }else if(groups[group_ref] &&\n groups[group_ref].item.state == \"open\"){\n fail(\"cannot refer to an open group\", pos)\n }\n }else if(groups[group_ref] !== undefined){\n if(groups[group_ref].item.state == \"open\"){\n fail(\"cannot refer to an open group\", pos)\n }\n }else{\n fail(`unknown group name '${group_ref}'`, pos)\n }\n group_stack.push(item)\n node.add(item)\n item.state = \"open\"\n node = item // next items will be stored as group's items\n }else if(item instanceof BackReference){\n pos = item.pos\n if(item.type == \"num\" && item.value > 99){\n var head = item.value.toString().substr(0, 2)\n fail(`invalid group reference ${head}`, pos + 1)\n }\n if(groups[item.value] !== undefined){\n if(groups[item.value].item.state == \"open\"){\n fail(\"cannot refer to an open group\", pos)\n }\n var ref_item = groups[item.value].item.parent\n while(ref_item){\n if(ref_item.is_lookbehind){\n fail(\"cannot refer to group defined in the same lookbehind subpattern\", pos)\n }\n ref_item = ref_item.parent\n }\n }else if(item.type == \"name\"){\n fail(`unknown group name '${item.value}'`, pos)\n }else if(item.type == \"num\"){\n fail(`invalid group reference ${item.value}`, pos)\n }\n node.add(item)\n }else if(item instanceof Char ||\n item instanceof CharacterClass ||\n item instanceof CharacterSet){\n if(item instanceof CharacterSet){\n for(var elt of item.set.items){\n elt.flags = flags\n }\n }\n var added_to_charseq = false\n if(item instanceof Char){\n if(node.items && node.items.length > 0){\n var previous = $last(node.items)\n if(previous instanceof CharSeq){\n previous.add_char(item)\n added_to_charseq = true\n }else if(previous instanceof Char && ! previous.repeater){\n node.items.pop()\n node.items.push(new CharSeq([previous, item], flags))\n added_to_charseq = true\n }\n }\n }\n if(! added_to_charseq){\n node.add(item)\n }\n }else if(item instanceof Repeater){\n // check that item is not in a lookbehind group\n var pnode = node\n while(pnode){\n if(pnode.extension && pnode.extension.type &&\n pnode.extension.type.indexOf(\"lookbehind\") > -1){\n fail(\"look-behind requires fixed-width pattern\", pos)\n }\n pnode = pnode.parent\n }\n pos = item.pos\n if(node.items.length == 0){\n fail(\"nothing to repeat\", pos)\n }\n previous = $last(node.items)\n if(previous instanceof Char ||\n previous instanceof CharSeq ||\n previous instanceof CharacterClass ||\n previous instanceof CharacterSet ||\n previous instanceof Group ||\n previous instanceof BackReference){\n if(previous instanceof GroupEnd){\n // associate repeat with Group\n previous = previous.group\n }else if(previous instanceof CharSeq){\n previous = $last(previous.chars)\n }\n if(previous.repeater){\n if(item.op == '?' && ! previous.non_greedy){\n if(previous.possessive){\n fail('multiple repeat', pos)\n }\n previous.non_greedy = true\n if(previous instanceof CharacterClass &&\n previous.value == '.'){\n previous.min_repeat_one = true\n }\n }else{\n if(item instanceof Repeater && item.op == '+'){\n if(previous.possessive || previous.non_greedy){\n fail('multiple repeat', pos)\n }\n previous.possessive = true\n }else{\n fail(\"multiple repeat\", pos)\n }\n }\n }else{\n // convert to minimum and maximum number of repeats\n var min = 1,\n max = 1\n if(Array.isArray(item.op)){\n min = item.op[0]\n if(min >= MAXREPEAT){\n throw _b_.OverflowError.$factory(\n \"the repetition number is too large\")\n }\n max = item.op[1] === undefined ? min : item.op[1]\n if(isFinite(max) && max >= MAXREPEAT){\n throw _b_.OverflowError.$factory(\n \"the repetition number is too large\")\n }\n if(max < min){\n fail('min repeat greater than max repeat', pos)\n }\n }else if(item.op == \"?\"){\n min = 0\n max = 1\n }else if(item.op == \"*\"){\n min = 0\n max = Number.POSITIVE_INFINITY\n }else if(item.op == \"+\"){\n min = 1\n max = Number.POSITIVE_INFINITY\n }\n previous.repeater = item\n previous.repeat = {min, max}\n // mark all parents of item as no fixed length\n var parent = item\n while(parent){\n parent.fixed_length = false\n parent = parent.parent\n }\n }\n }else{\n fail(\"nothing to repeat\", pos)\n }\n }else if(item instanceof Or){\n if(group_stack.length > 0){\n item.group = group_stack[group_stack.length - 1]\n }else{\n item.group = false\n }\n pos = item.pos\n if(node instanceof ConditionalBackref){\n // case '(?(num)a|'\n if(node.nb_options == 1){\n node.nb_options++\n }else{\n fail('conditional backref with more than ' +\n 'two branches', pos)\n }\n }else if(node.items.length == 0){\n // token \"|\" in \"(|...)\" : first option is the empty string\n var choice = new Choice(),\n case1 = new Case()\n case1.add(new Char(pos, EmptyString))\n choice.add(case1)\n node.add(choice)\n var case2 = new Case()\n choice.add(case2)\n node = case2\n }else if(node instanceof Case){\n // node.parent is already a Choice\n var new_case = new Case()\n node.parent.add(new_case)\n node = new_case\n }else{\n // token \"|\" in \"(ab|...)\"\n var previous = node.items[node.items.length - 1]\n if(previous instanceof Case){\n var new_case = new Case()\n previous.add(new_case)\n node = new_case\n }else{\n var choice = new Choice(),\n case1 = new Case(),\n first_rank = node.items[0].rank\n while(node.items.length > 0){\n case1.add(node.items.shift())\n }\n case1.groups = node.$groups\n for(var group of group_stack){\n choice.groups.push(group)\n }\n choice.add(case1)\n node.add(choice)\n var case2 = new Case()\n choice.add(case2)\n node = case2\n }\n }\n }else if(item instanceof StringStart ||\n item instanceof StringEnd){\n node.add(item)\n }else if(item instanceof SetFlags){\n if(group_stack.length == 0 && ! allow_global_flags){\n // pattern like (?x) only allowed as first in reg exp\n fail('global flags not at the start of the ' +\n 'expression', item.pos)\n }\n // copy flags, otherwise re.ASCII etc might be modified\n flags = Flag.$factory(flags.value || U.value)\n if(item.on_flags.indexOf('u') > -1){\n if(is_bytes){\n fail(\"re.error: bad inline flags: cannot use 'u' flag \" +\n \"with a bytes pattern\", pos)\n }\n if(flags && flags.value & ASCII.value){\n // switch to Unicode\n flags.value ^= ASCII.value\n }\n if(group_stack.length == 0 &&\n original_flags && original_flags.value & ASCII.value){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n if(item.on_flags.indexOf('a') > -1){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n }\n if(item.on_flags.indexOf('a') > -1){\n if(group_stack.length == 0 &&\n original_flags && original_flags.value & U.value){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n if(flags && flags.value & U.value){\n // switch to ASCII\n flags.value ^= U.value\n }\n if(item.on_flags.indexOf('u') > -1){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n }\n if(flags.value === undefined){\n flags.value = 32\n }\n if(item.items.length == 0){\n if(! accept_inline_flag && group_stack.length == 0){\n var s = from_codepoint_list(pattern)\n warn(_b_.DeprecationWarning,\n `Flags not at the start of the expression '${s}'`,\n pos)\n }\n for(var on_flag of item.on_flags){\n if(! is_bytes || on_flag !== 'a'){\n flags.value |= inline_flags[on_flag].value\n }\n }\n for(var off_flag of item.off_flags){\n if(! is_bytes || off_flag !== 'a'){\n flags.value ^= inline_flags[off_flag].value\n }\n }\n }else{\n node.add(item)\n }\n }else{\n fail(\"unknown item type \" + item, pos)\n }\n if(! (item instanceof SetFlags) &&\n ! (item instanceof Group && item.type == \"flags\")){\n accept_inline_flag = false\n }\n }\n for(ref in backrefs){\n if(groups[ref] === undefined){\n fail('invalid group name ' + ref, backrefs[ref])\n }\n }\n if(group_stack.length > 0){\n var last = group_stack[group_stack.length - 1]\n fail(\"missing ), unterminated subpattern\", last.pos)\n }\n while(node.parent){\n node = node.parent\n }\n node.pattern = from_codepoint_list(pattern)\n node.groups = group_num\n flags = flags === no_flag ? 32 : flags\n node.flags = flags\n var res = {\n node,\n groups,\n flags,\n original_flags,\n text: from_codepoint_list(pattern),\n type, // \"str\" or \"bytes\"\n fixed_length: node.fixed_length()\n }\n if(! cache.has(original_pattern.py_obj)){\n cache.set(original_pattern.py_obj, new Map())\n }\n cache.get(original_pattern.py_obj).set(original_flags.value || 0, res)\n if(_debug.value){\n show(node)\n }\n return res\n}\n\nfunction show(node, indent){\n indent = indent === undefined ? 0 : indent\n if(indent == 0){\n log('root', node)\n }\n log(' '.repeat(indent) + node)\n if(node.items !== undefined){\n for(var item of node.items){\n show(item, indent + 1)\n }\n }\n}\n\nfunction to_codepoint_list(s){\n var items = []\n if(typeof s == \"string\" || $B.$isinstance(s, _b_.str)){\n if(typeof s != \"string\"){\n s = s.valueOf()\n }\n for(var char of s){\n items.push(char.codePointAt(0))\n }\n items.type = \"unicode\"\n }else if($B.$isinstance(s, [_b_.bytes, _b_.bytearray, _b_.memoryview])){\n if($B.$isinstance(s, _b_.memoryview)){\n items = s.obj.source\n }else{\n items = s.source\n }\n items.type = \"bytes\"\n }else{\n throw Error('invalid type ' + $B.class_name(s))\n }\n return items\n}\n\n$B.nb_from_cp = 0\nfunction from_codepoint_list(codepoints, type){\n $B.nb_from_cp++\n // Return a string\n if(type == \"bytes\"){\n return _b_.bytes.$factory(codepoints)\n }\n var s = ''\n for(var cp of codepoints){\n s += _b_.chr(cp)\n }\n return $B.String(s)\n}\n\nfunction string2bytes(s){\n var t = []\n for(var i = 0, len = s.length; i < len; i++){\n t.push(s.charCodeAt(i))\n }\n return _b_.bytes.$factory(t)\n}\n\nfunction check_pattern_flags(pattern, flags){\n if(pattern.__class__ === Pattern){\n if(flags !== no_flag){\n throw _b_.ValueError.$factory(\n \"cannot process flags argument with a compiled pattern\")\n }\n }\n return pattern\n}\n\nfunction StringObj(obj){\n // A StringObj object is a bridge between a Python string or bytes-like\n // object and Javascript\n // obj is the Python object\n // this.string is a Javascript string\n this.py_obj = obj\n this.codepoints = []\n this.type = \"str\"\n this.is_string = typeof obj == 'string'\n if(typeof obj == \"string\" ||\n (obj instanceof String && ! obj.codepoints)){\n // Python object represented as a Javascript string\n this.string = obj\n // Maps a position in codepoints to position in string\n this.index_map = {}\n for(var i = 0, len = obj.length; i < len; i++){\n this.index_map[this.codepoints.length] = i\n var cp = obj.codePointAt(i)\n this.codepoints.push(cp)\n if(cp >= 0x10000){\n i++\n }\n }\n this.length = _b_.str.__len__(obj)\n if(obj instanceof String){\n // store for next use\n obj.codepoints = this.codepoints\n obj.index_map = this.index_map\n }\n }else if(obj instanceof String){\n // string with surrogate pairs\n this.string = obj.string\n this.codepoints = obj.codepoints\n this.index_map = obj.index_map\n this.length = _b_.str.__len__(obj)\n }else if($B.$isinstance(obj, _b_.str)){ // str subclass\n var so = new StringObj(_b_.str.$factory(obj))\n this.string = so.string\n this.codepoints = so.codepoints\n this.length = _b_.str.__len__(obj)\n }else if($B.$isinstance(obj, [_b_.bytes, _b_.bytearray])){\n this.string = _b_.bytes.decode(obj, 'latin1')\n this.codepoints = obj.source\n this.type = \"bytes\"\n }else if($B.$isinstance(obj, _b_.memoryview)){\n this.string = _b_.bytes.decode(obj.obj, 'latin1')\n this.codepoints = obj.obj.source\n this.type = \"bytes\"\n }else if(obj.__class__ && obj.__class__.$buffer_protocol){\n // eg array.array\n this.codepoints = _b_.list.$factory(obj)\n this.string = from_codepoint_list(this.codepoints, \"bytes\")\n this.type = \"bytes\"\n }else if(Array.isArray(obj)){\n // list of codepoints\n this.codepoints = obj\n }else{\n throw _b_.TypeError.$factory(\n `expected string or bytes-like object, got '${$B.class_name(obj)}'`)\n }\n if(this.length === undefined){\n this.length = this.codepoints.length\n }\n}\n\nStringObj.prototype.cp_at = function(pos){\n if(pos >= this.length){\n return undefined\n }\n /*\n if(typeof this.string == 'string'){\n return this.string.charCodeAt(pos)\n }\n */\n var res = this.codepoints[pos]\n if(res !== undefined){\n return res\n }\n}\n\nStringObj.prototype.substring = function(start, end){\n // Returns a string\n var s\n if(this.string && this.index_map){\n if(this.index_map[start] === undefined){\n return ''\n }\n if(end === undefined){\n return this.string.substr(this.index_map[start])\n }\n return this.string.substring(this.index_map[start],\n this.index_map[end])\n }\n var codepoints,\n res = ''\n if(end === undefined){\n codepoints = this.codepoints.slice(start)\n }else{\n codepoints = this.codepoints.slice(start, end)\n }\n return from_codepoint_list(codepoints, this.type)\n}\n\nStringObj.prototype.to_str = function(){\n if(this.hasOwnProperty('string')){\n return this.string\n }\n return from_codepoint_list(this.codepoints, this.type)\n}\n\nStringObj.from_codepoints = function(cps){\n var res = new StringObj('')\n res.codepoints = cps\n for(var cp of cps){\n res.string += _b_.chr(cp)\n }\n return res\n}\n\nfunction prepare(args){\n // Check that all arguments are of the same type (string or bytes-like).\n // Return an object with all attributes transformed into StringObj\n // instances\n var res = {},\n keys = Object.keys(args),\n first = keys[0]\n res[first] = new StringObj(args[first])\n res.type = res[first].type\n for(var key of keys.slice(1)){\n res[key] = new StringObj(args[key])\n if(res[key].type != res.type){\n throw _b_.TypeError.$factory(`not the same type for ${first} and ${key}`)\n }\n }\n return res\n}\n\n\nfunction subn(pattern, repl, string, count, flags){\n // string is a StringObj instance\n // pattern is either a Pattern instance or a StringObj instance\n var t0 = window.performance.now()\n var res = '',\n pos = 0,\n nb_sub = 0\n\n if(pattern instanceof StringObj){\n pattern = compile(pattern, flags)\n }\n if(typeof repl != \"function\"){\n var data1 = transform_repl({repl}, pattern)\n repl1 = data1.repl1\n }\n pos = 0\n var s = string.to_str()\n for(var bmo of $module.finditer(Pattern.$factory(pattern), s).js_gen){\n // finditer yields instances of MatchObject\n var mo = bmo.mo // instance of MO\n res += from_codepoint_list(string.codepoints.slice(pos, mo.start))\n if(typeof repl == \"function\"){\n var x = $B.$call(repl)(bmo)\n if(x.__class__ === _b_.bytes){\n x = _b_.bytes.decode(x, 'latin-1')\n }\n res += x // $B.$call(repl)(bmo)\n }else{\n res += repl1\n }\n nb_sub++\n pos = mo.end\n if(count != 0 && nb_sub >= count){\n break\n }\n }\n if(string.is_string){\n res += string.string.substr(pos)\n }else{\n res += from_codepoint_list(string.codepoints.slice(pos))\n }\n if(pattern.type === \"bytes\"){\n res = _b_.str.encode(res, \"latin-1\")\n }\n return [res, nb_sub]\n}\n\n// escaped chars : '\\t\\n\\x0b\\x0c\\r #$&()*+-.?[\\\\]^{|}~'\nvar escaped = [9, 10, 11, 12, 13, 32, 35, 36, 38, 40, 41, 42, 43, 45, 46, 63,\n 91, 92, 93, 94, 123, 124, 125, 126]\n\nfunction starts_with_string_start(pattern){\n // returns true if the pattern starts with ^ or \\A\n if(pattern.node){\n pattern = pattern.node\n }\n if(pattern.items){\n if(pattern.items.length == 0){\n return false\n }\n return starts_with_string_start(pattern.items[0])\n }else if(pattern instanceof CharacterClass){\n return pattern.value == 'A'\n }else if(pattern instanceof StringStart){\n return true\n }else{\n return false\n }\n}\n\nfunction* iterator(pattern, string, flags, original_string, pos, endpos){\n var result = [],\n pos = pos | 0,\n cp,\n accept_one = true // used to test one position after string end\n while((cp = string.cp_at(pos)) !== undefined || accept_one){\n var mo = match(pattern, string, pos, endpos)\n if(mo){\n yield MatchObject.$factory(mo)\n if(mo.end == mo.start){\n // If match has zero with, retry at the same position but\n // with the flag no_zero_width set, to avoid infinite loops\n mo = match(pattern, string, pos, endpos, true)\n if(mo){\n yield MatchObject.$factory(mo)\n pos = mo.end\n }else{\n pos++ // at least 1, else infinite loop\n }\n }else{\n pos = mo.end\n }\n }else{\n pos++\n }\n if(cp === undefined){\n accept_one = false\n }\n if(starts_with_string_start(pattern)){\n break\n }\n }\n delete original_string.in_iteration\n}\n\n\nfunction MO(node, pos, mo, len){\n // Match Object\n this.node = node\n this.start = pos\n this.mo = mo\n this.nb_min = mo.nb_min\n this.nb_max = mo.nb_max\n this.len = len\n this.nb = this.node.non_greedy ? mo.nb_min : mo.nb_max\n this.end = pos + len * this.nb\n}\n\nMO.prototype.backtrack = function(string, groups){\n if(this.node.possessive){\n return false\n }\n if(this.node.non_greedy && this.nb < this.nb_max){\n this.nb++\n this.end = this.start + this.len * this.nb\n return true\n }else if((! this.node.non_greedy) && this.nb > this.nb_min){\n this.nb--\n this.end = this.start + this.len * this.nb\n return true\n }else{\n return false\n }\n}\n\nfunction del_groups(groups, node){\n if(node.num !== undefined){\n delete groups[node.num]\n groups.$last.splice(groups.$last.indexOf(node.num), 1)\n if(node.name !== undefined){\n delete groups[node.name]\n }\n }\n for(var child of node.items){\n if(child instanceof Group){\n del_groups(groups, child)\n }\n }\n}\n\nfunction GroupMO(node, start, matches, string, groups, endpos){\n // Match Object for Groups\n this.node = node\n this.start = start\n this.matches = matches\n this.string = string\n this.end = matches.length > 0 ? $last(matches).end : start\n this.endpos = endpos === undefined ? this.end : endpos\n this.$groups = groups\n}\n\n$B.nb_group_backtrack = 0\n$B.t_group_backtrack = 0\n\nGroupMO.prototype.backtrack = function(string, groups){\n if(_debug.value){\n console.log('group MO backtrack, this', this)\n alert()\n }\n $B.nb_group_backtrack++\n var t0 = performance.now()\n // Try backtracking in the last match\n if(this.node.possessive || this.node.atomic){\n return false\n }\n if(this.matches.length > 0){\n var _match = $last(this.matches),\n mos = _match.mos,\n nb0 = mos.length\n while(mos.length > 0){\n var mo = mos.pop()\n if(mo.node instanceof Case){\n var rank = mo.node.parent.items.indexOf(mo.node)\n for(var _case of mo.node.parent.items.slice(rank + 1)){\n var _mo = match({node: _case, text: _case.text},\n string, mo.start)\n if(_mo){\n // update GroupMO object\n mos.push(_mo)\n this.end = _mo.end\n if(this.$groups.$last.length > 0){\n var ix = this.$groups.$last[this.$groups.$last.length - 1]\n this.$groups[ix].end = _mo.end\n }\n $B.t_group_backtrack += performance.now() - t0\n return true\n }\n }\n }\n if(mo.backtrack(string, groups)){\n mos.push(mo)\n if(this.node.num !== undefined){\n groups[this.node.num].end = mo.end\n }\n this.end = mo.end\n $B.t_group_backtrack += performance.now() - t0\n return true\n }\n }\n }\n // Else, remove last match if possible\n if(this.matches.length > this.node.repeat.min &&\n this.matches.length >= 1){\n this.matches.pop()\n if(this.matches.length > 0){\n this.end = $last(this.matches).end\n }else{\n // remove this group and its children from groups\n del_groups(groups, this.node)\n this.end = this.start\n }\n $B.t_group_backtrack += performance.now() - t0\n return true\n }\n // Group fails; if some of its subgroups succeded, remove them from\n // groups\n if(this.node.repeat.min > 0){\n del_groups(groups, this.node)\n }\n $B.t_group_backtrack += performance.now() - t0\n return false\n}\n\nGroupMO.prototype.toString = function(){\n var repr = _b_.repr(this.string.substring(this.start, this.end))\n repr = repr.substring(0, 50)\n return ''\n}\n\nGroupMO.prototype.groups = function(_default){\n var res = [],\n groupobj = this.$groups\n\n for(var key in this.node.$groups){\n if(isFinite(key)){\n res[key] = groupobj[key] === undefined ? _default :\n this.string.substring(groupobj[key].start, groupobj[key].end)\n }\n }\n res.shift()\n return $B.fast_tuple(res)\n}\n\n// Brython MatchObject\nvar MatchObject = $B.make_class(\"Match\",\n function(mo){\n return {\n __class__: MatchObject,\n mo\n }\n }\n)\n\nMatchObject.__copy__ = function(self){\n return self\n}\n\nMatchObject.__deepcopy__ = function(self){\n return self\n}\n\nMatchObject.__getitem__ = function(){\n var $ = $B.args(\"__getitem__\", 2, {self: null, key: null},\n ['self', 'key'], arguments, {}, null, null),\n self = $.self,\n key = $.key\n if(Array.isArray(key)){\n throw _b_.IndexError.$factory(\"no such group\")\n }\n if(key == 0){\n return self.mo.string.substring(self.mo.start, self.mo.end)\n }\n var match = self.mo.$groups[key]\n if(match !== undefined){\n return self.mo.string.substring(match.start, match.end)\n }else if(self.mo.node.$groups[key] !== undefined){\n return _b_.None\n }\n throw _b_.IndexError.$factory(\"no such group\")\n}\n\nMatchObject.__repr__ = MatchObject.__str__ = function(self){\n return self.mo.toString()\n}\n\nMatchObject.end = function(self){\n var $ = $B.args('end', 2, {self: null, group: null}, ['self', 'group'],\n arguments, {group: 0}, null, null)\n var group = MatchObject.group(self, $.group)\n if(group === _b_.None){\n return -1\n }else if($.group == 0){\n return self.mo.end\n }else{\n return self.mo.$groups[$.group].end\n }\n}\n\nMatchObject.endpos = _b_.property.$factory(\n function(self){\n return self.mo.endpos\n }\n)\n\nMatchObject.expand = function(){\n var $ = $B.args(\"expand\", 2, {self: null, template: null},\n ['self', 'template'], arguments, {}, null, null)\n var data = {\n repl: new StringObj($.template),\n }\n data = transform_repl(data, {groups: $.self.mo.node.$groups})\n if(typeof data.repl == \"function\"){\n return $B.$call(data.repl)(MatchObject.$factory($.self.mo))\n }else{\n return data.repl1\n }\n}\n\nMatchObject.group = function(self){\n var $ = $B.args(\"group\", 1, {self: null}, ['self'], arguments,\n {}, 'args', null),\n self = $.self,\n args = $.args\n if(args.length == 0){\n args[0] = 0\n }\n var groupobj = self.mo.$groups,\n result = []\n for(var group_id of args){\n if($B.rich_comp('__eq__', group_id, 0)){\n result.push(self.mo.string.substring(self.mo.start, self.mo.end))\n continue\n }\n try{\n // Convert group_id to int if possible\n group_id = $B.PyNumber_Index(group_id) // in py_utils.js\n }catch(err){\n // group_id can be an identifier\n }\n if(self.mo.node.$groups[group_id] === undefined){\n throw _b_.IndexError.$factory(\"no such group\")\n }\n var group = groupobj[group_id] // found in match\n result.push(group === undefined ?\n _b_.None :\n self.mo.string.substring(group.start, group.end))\n }\n if(args.length == 1){\n return result[0]\n }\n return $B.fast_tuple(result)\n}\n\nMatchObject.groupdict = function(){\n /*\n Return a dictionary containing all the named subgroups of the match, keyed\n by the subgroup name. The default argument is used for groups that did not\n participate in the match; it defaults to None.\n */\n var $ = $B.args(\"groupdict\", 2, {self: null, default: null},\n ['self', 'default'], arguments, {default: _b_.None},\n null, null),\n self = $.self,\n groupobj = $.self.mo.$groups,\n d = $B.empty_dict()\n for(var key in $.self.mo.node.$groups){\n if(! isFinite(key)){\n var value = groupobj[key] === undefined ? $.default :\n groupobj[key]\n if(value !== $.default){\n value = self.mo.string.substring(value.start, value.end)\n }\n _b_.dict.$setitem(d, key, value)\n }\n }\n return d\n}\n\nMatchObject.groups = function(self){\n var $ = $B.args(\"group\", 2, {self: null, default: null},\n ['self', 'default'], arguments,\n {default: _b_.None}, null, null),\n self = $.self,\n _default = $.default\n return self.mo.groups(_default)\n}\n\nMatchObject.lastindex = _b_.property.$factory(\n function(self){\n /* The integer index of the last matched capturing group, or None if\n no group was matched at all.\n */\n var last = self.mo.$groups.$last\n if(last.length == 0){\n return _b_.None\n }\n return parseInt($last(last))\n }\n)\n\nMatchObject.lastgroup = _b_.property.$factory(\n function(self){\n /* The name of the last matched capturing group, or None if the group\n didn't have a name, or if no group was matched at all.\n */\n var lastindex = MatchObject.lastindex.fget(self)\n if(lastindex === _b_.None){\n return _b_.None\n }\n var group = self.mo.node.$groups[lastindex],\n name = group.item.name\n return name === undefined ? _b_.None : name\n }\n)\n\nMatchObject.pos = _b_.property.$factory(\n function(self){\n return self.mo.start\n }\n)\n\nMatchObject.re = _b_.property.$factory(\n function(self){\n return self.mo.node.pattern\n }\n)\n\nMatchObject.regs = _b_.property.$factory(\n function(self){\n var res = [$B.fast_tuple($B.fast_tuple([self.mo.start, self.mo.end]))]\n for(var group_num in self.mo.node.$groups){\n if(isFinite(group_num)){\n var group = self.mo.node.$groups[group_num].item\n // group.pattern includes the opening and closing brackets\n res.push($B.fast_tuple([group.pos,\n group.pos + group.pattern.length - 2]))\n }\n }\n return $B.fast_tuple(res)\n }\n)\n\nMatchObject.span = function(){\n /*\n Match.span([group])\n\n For a match m, return the 2-tuple (m.start(group), m.end(group)). Note\n that if group did not contribute to the match, this is (-1, -1). group\n defaults to zero, the entire match.\n */\n var $ = $B.args(\"span\", 2, {self: null, group: null},\n ['self', 'group'], arguments,\n {group: 0}, null, null),\n self = $.self,\n group = $.group\n if(group == 0){\n return $B.fast_tuple([self.mo.start, self.mo.end])\n }\n var span = self.mo.$groups[group]\n if(span === undefined){\n return $B.fast_tuple([-1, -1])\n }\n return $B.fast_tuple([span.start, span.end])\n}\n\nMatchObject.start = function(self){\n var $ = $B.args('end', 2, {self: null, group: null}, ['self', 'group'],\n arguments, {group: 0}, null, null)\n var group = MatchObject.group(self, $.group)\n if(group === _b_.None){\n return -1\n }else if($.group == 0){\n return self.mo.start\n }else{\n return self.mo.$groups[$.group].start\n }\n}\n\nMatchObject.string = _b_.property.$factory(\n function(self){\n return self.mo.string.to_str()\n }\n)\n\n$B.set_func_names(MatchObject, 're')\n\nfunction log(){\n if(_debug.value){\n console.log.apply(null, arguments)\n }\n}\n\nfunction create_fullmatch_pattern(pattern){\n // transform into \"(?:)$\"\n // use a new pattern object, otherwise if pattern is in cache the\n // value in cache would be changed\n var new_pattern = {}\n for(var key in pattern){\n if(key == 'node'){\n continue\n }\n new_pattern[key] = pattern[key]\n }\n\n var ncgroup = new Group() // non-capturing group\n ncgroup.pos = 0\n ncgroup.non_capturing = true\n for(var item of pattern.node.items){\n ncgroup.add(item)\n }\n var se = new StringEnd()\n se.flags = Flag.$factory(32)\n new_pattern.node = new Node()\n new_pattern.node.add(ncgroup)\n new_pattern.node.add(se)\n return new_pattern\n}\n\nfunction match(pattern, string, pos, endpos, no_zero_width, groups){\n // Follow the pattern tree structure\n if(_debug.value){\n console.log('match pattern', pattern.text, 'pos', pos, string.substring(pos))\n alert()\n }\n if(endpos !== undefined){\n if(endpos < pos){\n return false\n }\n }else{\n endpos = string.length\n }\n if(pattern.node instanceof Node){\n show(pattern.node)\n }\n if(groups === undefined){\n groups = {$last:[]}\n }\n if(pattern.text === undefined){\n console.log('no text', pattern)\n }\n var node = pattern.node,\n mo\n if(node.items){\n // node is either a Choice between several items, or a sequence of\n // items\n if(node instanceof Choice){\n mo = false\n for(var _case of node.items){\n mo = match({node: _case, text: _case.text}, string, pos,\n endpos, no_zero_width, groups)\n if(mo){\n // remove groups inside choice and before successful case\n // that did not contribute to the match\n var groups_succeed = groups_in(_case),\n min_num = Math.min(Array.from(groups_succeed))\n for(var group_num of groups_in(node)){\n if(group_num < min_num){\n delete groups[group_num]\n }\n }\n if(_debug.value){\n console.log('case', _case + '', 'of choice', node +\n ' succeeds, groups', groups)\n }\n return mo\n }else{\n if(_debug.value){\n console.log('case', _case + '', 'of choice', node +\n ' fails')\n }\n }\n }\n return false\n }else{\n // sequence of items\n node.repeat = node.repeat === undefined ? {min: 1, max: 1} :\n node.repeat\n var start = pos,\n nb_repeat = 0,\n nb_zerolength_repeat = 0,\n matches = [],\n mos,\n match_start,\n empty_matches = {}\n // loop until we get enough repetitions\n while(true){\n if(empty_matches[pos]){\n // no use trying again\n return matches.length == 0 ? false :\n new GroupMO(node, start, matches, string, groups,\n endpos)\n }\n var initial_groups = Object.keys(groups)\n mos = []\n match_start = pos\n if(_debug.value){\n console.log(\"pattern\", pattern.text,\n \"loop in group match, match start\", match_start)\n }\n var i = 0\n while(i < node.items.length){\n var item = node.items[i]\n if(_debug.value){\n console.log('item', i, '/', node.items.length - 1,\n 'of pattern', pattern.text)\n }\n var mo = match({node: item, text: item + ''}, string, pos,\n endpos, no_zero_width, groups)\n if(mo){\n if(item instanceof Group &&\n item.type == \"lookahead_assertion\"){\n log(\"lookahead assertion\", item + '',\n \"succeeds, mo\", mo)\n }else{\n mos.push(mo)\n pos = mo.end\n }\n i++\n }else if(false && item instanceof Group &&\n item.type == \"negative_lookahead_assertion\"){\n log(\"negative lookahead assertion\", item, \"fails : ok !\")\n i++\n }else{\n if(_debug.value){\n console.log('item ' + item, 'of group fails, nb_repeat',\n nb_repeat, 'node repeat', node.repeat)\n }\n var backtrack = false\n while(mos.length > 0){\n var mo = mos.pop()\n if(mo.backtrack === undefined){\n log('no backtrack for', mo)\n }\n if(_debug.value){\n console.log('try backtrack on mo', mo)\n }\n if(mo.backtrack(string, groups)){\n log('can backtrack, mo', mo)\n mos.push(mo)\n i = mos.length\n log('mos', mos, 'restart at item', i)\n pos = mo.end\n backtrack = true\n break\n }\n }\n if(backtrack){\n log('backtrack ok')\n continue\n }else{\n if(node.type == \"negative_lookahead_assertion\"){\n // If a negative lookahead assertion fails,\n // return a match\n var res = new GroupMO(node, start, matches,\n string, groups, endpos)\n return res\n }\n if(nb_repeat == 0){\n // remove the groups introduced before\n // reaching this point\n for(var key in groups){\n if(initial_groups.indexOf(key) == -1){\n delete groups[key]\n }\n }\n }\n if(nb_repeat >= node.repeat.min){\n log(\"enough repetitions for node\", node)\n if(node.type == \"negative_lookahead_assertion\"){\n return false\n }\n return new GroupMO(node, start, matches, string,\n groups, endpos)\n }\n return false\n }\n }\n }\n if(node.type == \"negative_lookahead_assertion\"){\n // If a negative lookahead succeeds, return false\n return false\n }\n nb_repeat++\n if(pos > match_start){\n nb_zerolength_repeat = 0\n }else{\n nb_zerolength_repeat++\n empty_matches[pos] = true\n }\n matches.push({start: match_start, end: pos, mos})\n if(node.num !== undefined){\n groups[node.num] = $last(matches)\n if(node.name !== undefined){\n groups[node.name] = groups[node.num]\n }\n if(node.num != $last(groups.$last)){\n var ix = groups.$last.indexOf(node.num)\n if(ix > -1){\n groups.$last.splice(ix, 1)\n }\n groups.$last.push(node.num)\n }\n }\n if(nb_repeat >= node.repeat.max){\n var res = new GroupMO(node, start, matches, string,\n groups, endpos)\n if(res.start == res.end && no_zero_width){\n // no_zero_width is set when previous match in\n // iterator() had length 0; avoids infinite loops\n return false\n }\n return res\n }\n log('loop on group', pattern.text, 'nb repeats', nb_repeat,\n 'nb zero length', nb_zerolength_repeat, 'groups', groups)\n if(nb_zerolength_repeat == 65535){\n return matches.length == 0 ? false :\n new GroupMO(node, start, matches, string, groups,\n endpos)\n }\n }\n }\n }else{\n // for BackReference, Char, CharSeq, CharacterClass, CharacterSet,\n // ConditionalBackref, Lookbehind, StringStart, StringEnd\n var mo = node.match(string, pos, endpos, groups)\n if(_debug.value){\n console.log(node + '', \"mo\", mo)\n }\n if(mo){\n var len = mo.group_len === undefined ? 1 : mo.group_len,\n ix = node.non_greedy ? mo.nb_min : mo.nb_max,\n end = pos + len * ix\n return new MO(node, pos, mo, len)\n }else{\n return false\n }\n }\n}\n\n// expose re module API\nvar $module = {\n cache: cache,\n compile: function(){\n var $ = $B.args(\"compile\", 2, {pattern: null, flags: null},\n ['pattern', 'flags'], arguments, {flags: no_flag},\n null, null)\n if($.pattern && $.pattern.__class__ === Pattern){\n if($.flags !== no_flag){\n throw _b_.ValueError.$factory(\n \"cannot process flags argument with a compiled pattern\")\n }\n return $.pattern\n }\n $.pattern = check_pattern_flags($.pattern, $.flags)\n var data = prepare({pattern: $.pattern})\n if(typeof $.flags == \"number\"){\n $.flags = Flag.$factory($.flags)\n }\n var jspat = compile(data.pattern, $.flags)\n return Pattern.$factory(jspat)\n },\n error: error,\n escape: function(){\n var $ = $B.args(\"escape\", 1, {pattern: null}, ['pattern'], arguments,\n {}, null, null),\n data = prepare({pattern: $.pattern}),\n pattern = data.pattern,\n res = []\n for(var cp of pattern.codepoints){\n if(escaped.indexOf(cp) > -1){\n res.push(BACKSLASH)\n }\n res.push(cp)\n }\n res = from_codepoint_list(res, data.type)\n if(data.type == \"bytes\" && $B.$isinstance(res, _b_.str)){\n res = _b_.str.encode(res, 'latin1')\n }\n return res\n },\n findall: function(){\n /* Return all non-overlapping matches of pattern in string, as a list\n of strings. The string is scanned left-to-right, and matches are\n returned in the order found. If one or more groups are present in\n the pattern, return a list of groups; this will be a list of tuples\n if the pattern has more than one group. Empty matches are included\n in the result.\n */\n var $ = $B.args(\"findall\", 3,\n {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags,\n data\n pattern = check_pattern_flags(pattern, flags)\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n }else{\n data = prepare({string, pattern})\n pattern = Pattern.$factory(compile(data.pattern, flags))\n }\n if(data.type === \"str\"){\n function conv(s){\n return s === EmptyString ? '' : s\n }\n }else{\n function conv(s){\n return string2bytes(s)\n }\n }\n\n var iter = $module.finditer.apply(null, arguments).js_gen,\n res = []\n while(true){\n var next = iter.next()\n if(next.done){\n return res\n }\n var bmo = next.value,\n mo = bmo.mo,\n groups = MatchObject.groups(bmo)\n\n // replace None by the empty string\n for(var i = 0, len = groups.length; i < len; i++){\n groups[i] = groups[i] === _b_.None ? \"\" : groups[i]\n }\n if(groups.length > 0){\n if(groups.length == 1){\n res.push(groups[0])\n }else{\n res.push($B.fast_tuple(groups))\n }\n }else{\n res.push(mo.string.substring(mo.start, mo.end))\n }\n }\n console.log(\"end findall\")\n },\n finditer: function(){\n var $ = $B.args(\"finditer\", 3,\n {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags\n if($B.$isinstance(string, [_b_.bytearray, _b_.memoryview])){\n string.in_iteration = true\n }\n var original_string = string,\n data\n pattern = check_pattern_flags(pattern, flags)\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n flags = pattern.flags\n }else{\n data = prepare({string, pattern})\n pattern = Pattern.$factory(compile(data.pattern, flags))\n }\n if(pattern.__class__ !== Pattern){\n throw Error(\"pattern not a Python object\")\n }\n return $B.generator.$factory(iterator)(pattern.$pattern, data.string,\n flags, original_string)\n },\n fullmatch: function(){\n var $ = $B.args(\"fullmatch\", 3, {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags\n pattern = check_pattern_flags(pattern, flags)\n var data\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n pattern = pattern.$pattern\n }else{\n data = prepare({pattern, string})\n pattern = compile(data.pattern, flags)\n }\n\n var new_pattern = create_fullmatch_pattern(pattern)\n\n // match transformed RE\n var res = match(new_pattern, data.string, 0)\n var bmo = res === false ? _b_.None : MatchObject.$factory(res)\n if(bmo !== _b_.None){\n if(bmo.mo.string.codepoints.length != bmo.mo.end - bmo.mo.start){\n return _b_.None\n }else{\n return bmo\n }\n }\n return _b_.None\n },\n Match: MatchObject,\n match: function(){\n var $ = $B.args(\"match\", 3, {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags\n pattern = check_pattern_flags(pattern, flags)\n var data\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n pattern = pattern.$pattern\n }else{\n data = prepare({pattern, string})\n pattern = compile(data.pattern, flags)\n }\n var res = match(pattern, data.string, 0)\n return res === false ? _b_.None : MatchObject.$factory(res)\n },\n Pattern,\n purge: function(){\n var $ = $B.args(\"purge\", 0, {}, [], arguments, {}, null, null)\n cache.clear()\n return _b_.None\n },\n _reconstructor,\n Scanner,\n search: function(){\n var $ = $B.args(\"search\", 3, {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags,\n data\n pattern = check_pattern_flags(pattern, flags)\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n }else{\n data = prepare({string, pattern})\n pattern = Pattern.$factory(compile(data.pattern, flags))\n }\n data.pattern = pattern\n // optimizations\n if(pattern.pattern.startsWith('\\\\A') ||\n pattern.pattern.startsWith('^')){\n if(! (pattern.$pattern.node.items[0] instanceof Choice)){\n var mo = match(data.pattern.$pattern, data.string, 0)\n if(mo){\n return MatchObject.$factory(mo)\n }else if(pattern.flags.value & MULTILINE.value){\n var pos = 0,\n cp\n while((cp = data.string.cp_at(pos)) !== undefined){\n if(cp == LINEFEED){\n mo = match(data.pattern.$pattern, data.string, pos + 1)\n if(mo){\n return MatchObject.$factory(mo)\n }\n }\n pos++\n }\n }else{\n return _b_.None\n }\n }\n }\n if(pattern.$pattern.fixed_length !== false &&\n isFinite(pattern.$pattern.fixed_length) &&\n pattern.pattern.endsWith('$') &&\n ! (pattern.flags.value & MULTILINE.value)){\n var mo = match(data.pattern.$pattern, data.string,\n data.string.length - pattern.$pattern.fixed_length)\n if(mo){\n return MatchObject.$factory(mo)\n }\n return _b_.None\n }\n var pos = 0\n if(data.string.codepoints.length == 0){\n mo = match(data.pattern.$pattern, data.string, 0)\n if(mo){\n mo.start = mo.end = 0\n }\n return mo ? MatchObject.$factory(mo) : _b_.None\n }\n while(pos < data.string.codepoints.length){\n var mo = match(data.pattern.$pattern, data.string, pos)\n if(mo){\n return MatchObject.$factory(mo)\n }else{\n pos++\n }\n }\n return _b_.None\n },\n set_debug: function(value){\n _debug.value = value\n },\n split: function(){\n var $ = $B.args(\"split\", 4,\n {pattern: null, string: null, maxsplit: null, flags: null},\n ['pattern', 'string', 'maxsplit', 'flags'],\n arguments, {maxsplit: 0, flags: no_flag}, null, null)\n var res = [],\n pattern = $.pattern,\n string = $.string,\n flags = $.flags,\n pos = 0,\n nb_split = 0,\n data\n if(pattern.__class__ !== Pattern){\n data = prepare({pattern, string})\n var comp = compile(data.pattern, flags)\n pattern = Pattern.$factory(comp)\n }else{\n data = {pattern, string}\n }\n for(var bmo of $module.finditer(pattern, $.string).js_gen){\n var mo = bmo.mo, // finditer returns instances of MatchObject\n groupobj = mo.$groups\n res.push(data.string.substring(pos, mo.start))\n for(var key in mo.node.$groups){\n if(isFinite(key)){\n if(groupobj[key] !== undefined){\n res.push(data.string.substring(groupobj[key].start,\n groupobj[key].end))\n }else{\n res.push(_b_.None)\n }\n }\n }\n nb_split++\n pos = mo.end\n if(pos >= $.string.length){\n break\n }\n if($.maxsplit != 0 && nb_split >= $.maxsplit){\n break\n }\n }\n res.push(data.string.substring(pos))\n if(data.type === \"bytes\"){\n res = res.map(\n function(x){\n return $B.$isinstance(x, _b_.bytes) ?\n x :\n _b_.str.encode(x, \"latin-1\")\n }\n )\n }\n return res\n },\n sub: function(){\n var $ = $B.args(\"sub\", 5,\n {pattern: null, repl: null, string: null, count: null, flags: null},\n ['pattern', 'repl', 'string', 'count', 'flags'],\n arguments, {count: 0, flags: no_flag}, null, null),\n pattern = $.pattern,\n repl = $.repl,\n string = $.string,\n count = $.count,\n flags = $.flags,\n data\n check_pattern_flags(pattern, flags)\n if(typeof repl != \"function\"){\n if(pattern.__class__ != Pattern){\n data = prepare({pattern, string, repl})\n pattern = compile(data.pattern, flags)\n }else{\n data = prepare({string, repl})\n flags = pattern.flags\n pattern = pattern.$pattern\n }\n data = transform_repl(data, pattern)\n }else{\n if(pattern.__class__ != Pattern){\n data = prepare({pattern, string})\n pattern = compile(data.pattern, flags)\n }else{\n data = prepare({string})\n flags = pattern.flags\n pattern = pattern.$pattern\n }\n data.repl = repl\n }\n return subn(pattern, data.repl, data.string, count, flags)[0]\n },\n subn: function(){\n var $ = $B.args(\"sub\", 5,\n {pattern: null, repl: null, string: null, count: null, flags: null},\n ['pattern', 'repl', 'string', 'count', 'flags'],\n arguments, {count: 0, flags: no_flag}, null, null),\n pattern = $.pattern,\n repl = $.repl,\n string = $.string,\n count = $.count,\n flags = $.flags,\n data\n if(pattern.__class__ != Pattern){\n data = prepare({pattern, repl, string})\n }else{\n data = prepare({repl, string})\n data.pattern = pattern.$pattern\n }\n return $B.fast_tuple(subn(data.pattern, data.repl, data.string, count,\n flags))\n }\n\n}\n\nvar ASCII = $module.A = $module.ASCII = Flag.$factory(256)\nvar IGNORECASE = $module.I = $module.IGNORECASE = Flag.$factory(2)\nvar LOCALE = $module.L = $module.LOCALE = Flag.$factory(4)\nvar MULTILINE = $module.M = $module.MULTILINE = Flag.$factory(8)\nvar DOTALL = $module.S = $module.DOTALL = Flag.$factory(16)\nvar U = $module.U = $module.UNICODE = Flag.$factory(32)\nvar VERBOSE = $module.X = $module.VERBOSE = Flag.$factory(64)\n$module.cache = cache\n$module._compile = $module.compile\n\n\nvar inline_flags = {\n i: IGNORECASE,\n L: LOCALE,\n m: MULTILINE,\n s: DOTALL,\n u: U,\n x: VERBOSE,\n a: ASCII\n}\n\nvar flag_names = {\n i: 'IGNORECASE',\n L: 'LOCALE',\n m: 'MULTILINE',\n s: 'DOTALL',\n u: 'U',\n x: 'VERBOSE',\n a: 'ASCII'\n}\n"], "unicodedata": [".js", "// Implementation of unicodedata\n\nvar $module = (function($B){\n\n var _b_ = $B.builtins\n\n // Load unicode table if not already loaded\n if($B.unicodedb === undefined){\n var xhr = new XMLHttpRequest\n xhr.open(\"GET\",\n $B.brython_path + \"unicode.txt\", false)\n xhr.onreadystatechange = function(){\n if(this.readyState == 4){\n if(this.status == 200){\n $B.unicodedb = this.responseText\n }else{\n console.log(\"Warning - could not \" +\n \"load unicode.txt\")\n }\n }\n }\n xhr.send()\n }\n\n function _info(chr){\n var ord = _b_.ord(chr),\n hex = ord.toString(16).toUpperCase()\n while(hex.length < 4){hex = \"0\" + hex}\n var re = new RegExp(\"^\" + hex +\";(.+?);(.*?);(.*?);(.*?);(.*?);(.*);(.*);(.*)$\",\n \"m\"),\n search = re.exec($B.unicodedb)\n if(search === null){\n return null\n }else{\n return {\n name: search[1],\n category: search[2],\n combining: search[3],\n bidirectional: search[4],\n decomposition: search[5],\n decimal: search[6],\n digit: search[7],\n numeric: search[8]\n }\n }\n }\n\n function bidirectional(chr){\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr, hex)\n throw _b_.KeyError.$factory(chr)\n }\n return search.bidirectional\n }\n\n function category(chr){\n // Returns the general category assigned to the character chr as\n // string.\n if(/\\p{Cn}/u.test(chr.charAt(0))){\n return \"Cn\"\n }\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return search.category\n }\n\n function combining(chr){\n // Returns the general category assigned to the character chr as\n // string.\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return parseInt(search.combining)\n }\n\n function decimal(chr, _default){\n // Returns the decimal value assigned to the character chr as integer.\n // If no such value is defined, default is returned, or, if not given,\n // ValueError is raised.\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return parseInt(search.decimal)\n }\n\n function decomposition(chr, _default){\n // Returns the decimal value assigned to the character chr as integer.\n // If no such value is defined, default is returned, or, if not given,\n // ValueError is raised.\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return search.decomposition\n }\n\n function digit(chr, _default){\n // Returns the decimal value assigned to the character chr as integer.\n // If no such value is defined, default is returned, or, if not given,\n // ValueError is raised.\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return parseInt(search.digit)\n }\n\n function lookup(name){\n // Look up character by name. If a character with the given name is\n // found, return the corresponding character. If not found, KeyError\n // is raised.\n var re = new RegExp(\"^([0-9A-F]+);\" +\n name + \";(.*)$\", \"m\")\n search = re.exec($B.unicodedb)\n if(search === null){\n throw _b_.KeyError.$factory(\"undefined character name '\" +\n name + \"'\")\n }\n var res = parseInt(search[1], 16)\n return _b_.chr(res)\n }\n\n function name(chr, _default){\n // Returns the name assigned to the character chr as a string. If no\n // name is defined, default is returned, or, if not given, ValueError\n // is raised.\n var search = _info(chr)\n if(search === null){\n if(_default){return _default}\n throw _b_.KeyError.$factory(\"undefined character name '\" +\n chr + \"'\")\n }\n return search.name\n }\n\n function _norm(form, chr){\n var search = _info(chr)\n if(search === null){\n throw _b_.KeyError.$factory(chr)\n }\n switch(form){\n case \"NFC\":\n return chr\n case \"NFD\":\n var decomp = decomposition(chr),\n parts = decomp.split(\" \"),\n res = \"\"\n if(parts[0].startsWith(\"<\")){\n return chr\n }\n parts.forEach(function(part){\n if(! part.startsWith(\"<\")){\n res += _b_.chr(parseInt(part, 16))\n }\n })\n return res\n case \"NFKC\":\n var decomp = decomposition(chr),\n parts = decomp.split(\" \")\n if(parts[0] == \"\"){\n var res = \"\"\n parts.slice(1).forEach(function(part){\n res += _b_.chr(parseInt(part, 16))\n })\n return res\n }\n return chr\n case \"NFKD\":\n var decomp = decomposition(chr),\n parts = decomp.split(\" \")\n if(parts[0] == \"\"){\n var res = \"\"\n parts.slice(1).forEach(function(part){\n res += _b_.chr(parseInt(part, 16))\n })\n return res\n }\n return chr\n\n default:\n throw _b_.ValueError.$factory(\"invalid normalization form\")\n }\n }\n\n function normalize(form, unistr){\n var res = \"\"\n for(var i = 0, len = unistr.length; i < len; i++){\n res += _norm(form, unistr.charAt(i))\n }\n return res\n }\n\n function numeric(chr, _default){\n // Returns the decimal value assigned to the character chr as integer.\n // If no such value is defined, default is returned, or, if not given,\n // ValueError is raised.\n var search = _info(chr)\n if(search === null){\n if(_default){return _default}\n throw _b_.KeyError.$factory(chr)\n }\n var parts = search.numeric.split('/'),\n value\n if(parts.length == 1){\n value = parseFloat(search.numeric)\n }else{\n value = parseInt(parts[0]) / parseInt(parts[1])\n }\n return $B.fast_float(value)\n }\n\n var module = {\n bidirectional: bidirectional,\n category: category,\n combining: combining,\n decimal: decimal,\n decomposition: decomposition,\n digit: digit,\n lookup: lookup,\n name: name,\n normalize: normalize,\n numeric: numeric,\n unidata_version: \"11.0.0\"\n }\n module.ucd_3_2_0 = {}\n for(var key in module){\n if(key == \"unidata_version\"){\n module.ucd_3_2_0[key] = '3.2.0'\n }else{\n module.ucd_3_2_0[key] = module[key] // approximation...\n }\n }\n return module\n\n})(__BRYTHON__)"], "_aio": [".js", "// Replacement for asyncio.\n//\n// CPython asyncio can't be implemented for Brython because it relies on\n// blocking function (eg run(), run_until_complete()), and such functions\n// can't be defined in Javascript. It also manages an event loop, and a\n// browser only has its own built-in event loop.\n//\n// This module exposes functions whose result can be \"await\"-ed inside\n// asynchrounous functions defined by \"async def\".\n\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\n\nvar responseType = {\n \"text\": \"text\",\n \"binary\": \"arraybuffer\",\n \"dataURL\": \"arraybuffer\"\n}\n\nfunction handle_kwargs(kw, method){\n // kw was created with $B.obj_dict(), its keys/values are in kw.$jsobj\n var data,\n cache = false,\n format = \"text\",\n headers = {},\n timeout = {}\n for(var key in kw.$jsobj){\n if(key == \"data\"){\n var params = kw.$jsobj[key]\n if(typeof params == \"string\"){\n data = params\n }else if($B.$isinstance(params, _b_.bytes)){\n data = new ArrayBuffer(params.source.length)\n var array = new Int8Array(data)\n for(var i = 0, len = params.source.length; i < len; i++){\n array[i] = params.source[i]\n }\n }else{\n if(params.__class__ !== _b_.dict){\n throw _b_.TypeError.$factory(\"wrong type for data, \" +\n \"expected dict, bytes or str, got \" +\n $B.class_name(params))\n }\n var items = []\n for(var key of _b_.dict.$keys_string(params)){\n var value = _b_.dict.$getitem_string(params, key)\n items.push(encodeURIComponent(key) + \"=\" +\n encodeURIComponent($B.pyobj2jsobj(value)))\n }\n data = items.join(\"&\")\n }\n }else if(key == \"headers\"){\n var value = kw.$jsobj[key]\n if(! $B.$isinstance(value, _b_.dict)){\n throw _b_.ValueError.$factory(\n \"headers must be a dict, not \" + $B.class_name(value))\n }\n for(var key of _b_.dict.$keys_string(value)){\n headers[key.toLowerCase()] = _b_.dict.$getitem_string(value, key)\n }\n }else if(key.startsWith(\"on\")){\n var event = key.substr(2)\n if(event == \"timeout\"){\n timeout.func = kw.$jsobj[key]\n }else{\n ajax.bind(self, event, kw.$jsobj[key])\n }\n }else if(key == \"timeout\"){\n timeout.seconds = kw.$jsobj[key]\n }else if(key == \"cache\"){\n cache = kw.$jsobj[key]\n }else if(key == \"format\"){\n format = kw.$jsobj[key]\n }\n }\n if(method == \"post\"){\n // For POST requests, set default header\n if(! headers.hasOwnProperty(\"Content-type\")){\n headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n }\n }\n return {\n body: data,\n cache,\n format,\n timeout,\n headers\n }\n}\n\nfunction ajax(){\n var $ = $B.args(\"ajax\", 2, {method: null, url: null},\n [\"method\", \"url\"], arguments, {},\n null, \"kw\"),\n method = $.method.toUpperCase(),\n url = $.url,\n kw = $.kw\n var args = handle_kwargs(kw, \"get\")\n if(method == \"GET\" && ! args.cache){\n url = url + \"?ts\" + (new Date()).getTime() + \"=0\"\n }\n if(args.body && method == \"GET\"){\n url = url + (args.cache ? \"?\" : \"&\") + args.body\n }\n var func = function(){\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest()\n xhr.open(method, url, true)\n for(var key in args.headers){\n xhr.setRequestHeader(key, args.headers[key])\n }\n xhr.format = args.format\n xhr.responseType = responseType[args.format]\n xhr.onreadystatechange = function(){\n if(this.readyState == 4){\n this.__class__ = HTTPRequest\n resolve(this)\n }\n }\n if(args.body &&\n ['POST', 'PUT', 'DELETE', 'PATCH'].indexOf(method) > -1){\n xhr.send(args.body)\n }else{\n xhr.send()\n }\n })\n }\n func.$infos = {\n __name__: \"ajax_\" + method\n }\n return {\n __class__: $B.coroutine,\n $args: [url, args],\n $func: func\n }\n}\n\nfunction event(){\n // event(element, *names) is a Promise on the events \"names\" happening on\n // the element. This promise always resolves (never rejects) with the\n // first triggered DOM event.\n var $ = $B.args(\"event\", 1, {element: null},\n [\"element\"], arguments, {}, \"names\", null),\n element = $.element,\n names = $.names\n return new Promise(function(resolve){\n var callbacks = []\n names.forEach(function(name){\n var callback = function(evt){\n // When one of the handled events is triggered, all bindings\n // are removed\n callbacks.forEach(function(items){\n $B.DOMNode.unbind(element, items[0], items[1])\n })\n resolve($B.$DOMEvent(evt))\n }\n callbacks.push([name, callback])\n $B.DOMNode.bind(element, name, callback)\n })\n })\n}\n\nvar HTTPRequest = $B.make_class(\"Request\")\n\nHTTPRequest.data = _b_.property.$factory(function(self){\n if(self.format == \"binary\"){\n var view = new Uint8Array(self.response)\n return _b_.bytes.$factory(Array.from(view))\n }else if(self.format == \"text\"){\n return self.responseText\n }else if(self.format == \"dataURL\"){\n var base64String = btoa(String.fromCharCode.apply(null,\n new Uint8Array(self.response)))\n return \"data:\" + self.getResponseHeader(\"Content-Type\") +\n \";base64,\" + base64String\n }\n})\n\nHTTPRequest.response_headers = _b_.property.$factory(function(self){\n var headers = self.getAllResponseHeaders()\n if(headers === null){return _b_.None}\n var res = $B.empty_dict()\n if(headers.length > 0){\n // Convert the header string into an array\n // of individual headers\n var lines = headers.trim().split(/[\\r\\n]+/)\n // Create a map of header names to values\n lines.forEach(function(line){\n var parts = line.split(': ')\n var header = parts.shift()\n var value = parts.join(': ')\n _b_.dict.$setitem(res, header, value)\n })\n }\n return res\n})\n\nfunction get(){\n return ajax.bind(null, \"GET\").apply(null, arguments)\n}\n\nfunction iscoroutine(f){\n return f.__class__ === $B.coroutine\n}\n\nfunction iscoroutinefunction(f){\n return (f.$infos.__code__.co_flags & 128) != 0\n}\n\nfunction post(){\n return ajax.bind(null, \"POST\").apply(null, arguments)\n}\n\nfunction run(coro){\n var handle_success = function(){\n $B.leave_frame()\n },\n handle_error = $B.show_error\n\n var $ = $B.args(\"run\", 3, {coro: null, onsuccess: null, onerror: null},\n [\"coro\", \"onsuccess\", \"onerror\"], arguments,\n {onsuccess: handle_success, onerror: handle_error},\n null, null),\n coro = $.coro,\n onsuccess = $.onsuccess,\n onerror = $.onerror\n\n if(onerror !== handle_error){\n function error_func(exc){\n try{\n onerror(exc)\n }catch(err){\n handle_error(err)\n }\n }\n }else{\n error_func = handle_error\n }\n\n var save_frame_obj = $B.frame_obj\n $B.coroutine.send(coro).then(onsuccess).catch(error_func)\n $B.frame_obj = save_frame_obj\n return _b_.None\n}\n\nfunction sleep(seconds){\n if(seconds.__class__ === _b_.float){\n seconds = seconds.value\n }else if(typeof seconds != \"number\"){\n throw _b_.TypeError.$factory(\"'sleep' argument must be \" +\n \"int or float, not \" + $B.class_name(seconds))\n }\n var func = function(){\n return new Promise(resolve => setTimeout(\n function(){resolve(_b_.None)}, 1000 * seconds))\n }\n func.$infos = {\n __name__: \"sleep\"\n }\n return {\n __class__: $B.coroutine,\n $args: [seconds],\n $func: func\n }\n}\n\nfunction make_error(name, module){\n var error_obj = {\n $name: name,\n $qualname: module + '.' + name,\n $is_class: true,\n __module__: module\n }\n var error = $B.$class_constructor(name, error_obj,\n _b_.tuple.$factory([_b_.Exception]), [\"_b_.Exception\"], [])\n error.__doc__ = _b_.None\n error.$factory = $B.$instance_creator(error)\n $B.set_func_names(error, module)\n return error\n}\n\n\nvar InvalidStateError = $B.make_class('InvalidStateError')\nInvalidStateError.__bases__ = [_b_.Exception, _b_.object]\nInvalidStateError.__mro__ = [_b_.Exception, _b_.object]\n$B.set_func_names(InvalidStateError, 'browser.aio')\n\nvar CancelledError = $B.make_class('CancelledError')\nCancelledError.__bases__ = [_b_.Exception, _b_.object]\nCancelledError.__mro__ = [_b_.Exception, _b_.object]\n$B.set_func_names(CancelledError, 'browser.aio')\n\n\nvar Future = $B.make_class(\"Future\",\n function(){\n var methods = {}\n var promise = new Promise(function(resolve, reject){\n methods.resolve = resolve\n methods.reject = reject\n })\n promise._methods = methods\n promise._done = false\n promise.__class__ = Future\n return promise\n }\n)\n\nFuture.done = function(){\n var $ = $B.args('done', 1, {self:null},\n ['self'], arguments, {}, null, null)\n return !! self._done\n}\n\nFuture.set_result = function(self, value){\n var $ = $B.args('set_result', 2, {self:null, value: null},\n ['self', 'value'], arguments, {}, null, null)\n self._done = true\n return self._methods.resolve(value)\n}\n\nFuture.set_exception = function(self, exception){\n var $ = $B.args('set_exception', 2, {self:null, exception: null},\n ['self', 'exception'], arguments, {}, null, null)\n self._done = true\n return self._methods.reject(exception)\n}\n\n$B.set_func_names(Future, 'browser.aio')\n\nreturn {\n ajax,\n event,\n get,\n iscoroutine,\n iscoroutinefunction,\n post,\n run,\n sleep,\n Future\n}\n\n})(__BRYTHON__)\n"], "_ajax": [".js", "// ajax\nvar $module = (function($B){\n\n\nvar $N = $B.builtins.None,\n _b_ = $B.builtins\n\nvar add_to_res = function(res, key, val) {\n if($B.$isinstance(val, _b_.list)){\n for (j = 0; j < val.length; j++) {\n add_to_res(res, key, val[j])\n }\n }else if (val instanceof File || val instanceof Blob){\n res.append(key, val)\n }else{res.append(key, _b_.str.$factory(val))}\n}\n\nfunction set_timeout(self, timeout){\n if(timeout.seconds !== undefined){\n self.js.$requestTimer = setTimeout(\n function() {\n self.js.abort()\n if(timeout.func){\n timeout.func()\n }\n },\n timeout.seconds * 1000)\n }\n}\n\nfunction _read(req){\n var xhr = req.js\n if(xhr.responseType == \"json\"){\n return $B.structuredclone2pyobj(xhr.response)\n }\n if(req.charset_user_defined){\n // on blocking mode, xhr.response is a string\n var bytes = []\n for(var i = 0, len = xhr.response.length; i < len; i++){\n var cp = xhr.response.codePointAt(i)\n if(cp > 0xf700){\n bytes.push(cp - 0xf700)\n }else{\n bytes.push(cp)\n }\n }\n }else if(typeof xhr.response == \"string\"){\n if(req.mode == 'binary'){\n return _b_.str.encode(xhr.response, req.encoding || 'utf-8')\n }\n return xhr.response\n }else{\n // else it's an ArrayBuffer\n var buf = new Uint8Array(xhr.response),\n bytes = Array.from(buf.values())\n }\n var b = _b_.bytes.$factory(bytes)\n if(req.mode == \"binary\"){\n return b\n }else if(req.mode == \"document\"){\n return $B.JSObj.$factory(xhr.response)\n }else{\n var encoding = req.encoding || \"utf-8\"\n return _b_.bytes.decode(b, encoding)\n }\n}\n\nfunction stringify(d){\n var items = []\n for(var entry of $B.make_js_iterator(_b_.dict.items(d))){\n items.push(encodeURIComponent(entry[0]) + \"=\" +\n encodeURIComponent(entry[1]))\n }\n return items.join(\"&\")\n}\n\nfunction handle_kwargs(self, kw, method){\n // kw was created with $B.obj_dict(), its keys/values are in kw.$jsobj\n var data,\n encoding,\n headers={},\n cache,\n mode = \"text\",\n timeout = {}\n\n for(var key in kw.$jsobj){\n if(key == \"data\"){\n var params = kw.$jsobj[key]\n if(typeof params == \"string\" || params instanceof FormData){\n data = params\n }else if(params.__class__ === _b_.dict){\n var from_dict = []\n for(var key of $B.make_js_iterator(_b_.dict.keys(params))){\n if(typeof key !== 'string'){\n throw _b_.ValueError.$factory(\n 'data only supports string keys, got ' +\n `'${$B.class_name(key)}' object`)\n }\n from_dict.push(`${key}=${_b_.dict.$getitem(params, key)}`)\n }\n data = from_dict.join('&')\n }else{\n throw _b_.TypeError.$factory(\"wrong type for data: \" +\n $B.class_name(params))\n }\n }else if(key == \"encoding\"){\n encoding = kw.$jsobj[key]\n }else if(key == \"headers\"){\n var value = kw.$jsobj[key]\n if(! $B.$isinstance(value, _b_.dict)){\n throw _b_.ValueError.$factory(\n \"headers must be a dict, not \" + $B.class_name(value))\n }\n for(var key of _b_.dict.$keys_string(value)){\n headers[key.toLowerCase()] = _b_.dict.$getitem_string(value, key)\n }\n }else if(key.startsWith(\"on\")){\n var event = key.substr(2)\n if(event == \"timeout\"){\n timeout.func = kw.$jsobj[key]\n }else{\n var f = kw.$jsobj[key]\n ajax.bind(self, event, f)\n }\n }else if(key == \"mode\"){\n var mode = kw.$jsobj[key]\n }else if(key == \"timeout\"){\n timeout.seconds = kw.$jsobj[key]\n }else if(key == \"cache\"){\n cache = kw.$jsobj[key]\n }\n }\n if(encoding && mode != \"text\"){\n throw _b_.ValueError.$factory(\"encoding not supported for mode \" +\n mode)\n }\n if((method == \"post\" || method == \"put\") && ! headers){\n // For POST requests, set default header\n self.js.setRequestHeader(\"Content-type\",\n \"application/x-www-form-urlencoded\")\n }\n\n return {cache, data, encoding, headers, mode, timeout}\n}\n\nvar ajax = $B.make_class('ajax')\n\najax.__repr__ = function(self){\n return ''\n}\n\najax.__getattribute__ = function(self, attr){\n if(ajax[attr] !== undefined){\n return function(){\n return ajax[attr].call(null, self, ...arguments)\n }\n }else if(attr == \"text\"){\n return _read(self)\n }else if(attr == \"json\"){\n if(self.js.responseType == \"json\"){\n return _read(self)\n }else{\n var resp = _read(self)\n try{\n return $B.structuredclone2pyobj(JSON.parse(resp))\n }catch(err){\n console.log('attr json, invalid resp', resp)\n throw err\n }\n }\n }else if(self.js[attr] !== undefined){\n if(typeof self.js[attr] == \"function\"){\n return function(){\n if(attr == \"setRequestHeader\"){\n ajax.set_header.call(null, self, ...arguments)\n }else{\n if(attr == 'overrideMimeType'){\n console.log('override mime type')\n self.hasMimeType = true\n }\n return self.js[attr](...arguments)\n }\n }\n }else{\n return self.js[attr]\n }\n }else if(attr == \"xml\"){\n return $B.JSObj.$factory(self.js.responseXML)\n }\n}\n\najax.bind = function(self, evt, func){\n // req.bind(evt,func) is the same as req.onevt = func\n self.js['on' + evt] = function(){\n try{\n return func.apply(null, arguments)\n }catch(err){\n $B.handle_error(err)\n }\n }\n return _b_.None\n}\n\najax.open = function(){\n var $ = $B.args('open', 4,\n {self: null, method: null, url: null, async: null},\n ['self', 'method', 'url', 'async'], arguments,\n {async: true}, null, null),\n self = $.self,\n method = $.method,\n url = $.url,\n async = $.async\n if(typeof method !== \"string\"){\n throw _b_.TypeError.$factory(\n 'open() argument method should be string, got ' +\n $B.class_name(method))\n }\n if(typeof url !== \"string\"){\n throw _b_.TypeError.$factory(\n 'open() argument url should be string, got ' +\n $B.class_name(url))\n }\n self.$method = method\n self.blocking = ! self.async\n self.js.open(method, url, async)\n}\n\najax.read = function(self){\n return _read(self)\n}\n\najax.send = function(self, params){\n // params can be Python dictionary or string\n var content_type\n for(var key in self.headers){\n var value = self.headers[key]\n self.js.setRequestHeader(key, value)\n if(key == 'content-type'){\n content_type = value\n }\n }\n if((self.encoding || self.blocking) && ! self.hasMimeType){\n // On blocking mode, or if an encoding has been specified,\n // override Mime type so that bytes are not processed\n // (unless the Mime type has been explicitely set)\n self.js.overrideMimeType('text/plain;charset=x-user-defined')\n self.charset_user_defined = true\n }\n var res = ''\n if(! params){\n self.js.send()\n return _b_.None\n }\n if($B.$isinstance(params, _b_.str)){\n res = params\n }else if($B.$isinstance(params, _b_.dict)){\n if(content_type == 'multipart/form-data'){\n // The FormData object serializes the data in the 'multipart/form-data'\n // content-type so we may as well override that header if it was set\n // by the user.\n res = new FormData()\n var items = _b_.list.$factory(_b_.dict.items(params))\n for(var i = 0, len = items.length; i < len; i++){\n add_to_res(res, _b_.str.$factory(items[i][0]), items[i][1])\n }\n }else{\n if(self.$method && self.$method.toUpperCase() == \"POST\" &&\n ! content_type){\n // Set default Content-Type for POST requests\n self.js.setRequestHeader(\"Content-Type\",\n \"application/x-www-form-urlencoded\")\n }\n var items = _b_.list.$factory(_b_.dict.items(params))\n for(var i = 0, len = items.length; i < len; i++){\n var key = encodeURIComponent(_b_.str.$factory(items[i][0]));\n if($B.$isinstance(items[i][1], _b_.list)){\n for (j = 0; j < items[i][1].length; j++) {\n res += key +'=' +\n encodeURIComponent(_b_.str.$factory(items[i][1][j])) + '&'\n }\n }else{\n res += key + '=' +\n encodeURIComponent(_b_.str.$factory(items[i][1])) + '&'\n }\n }\n res = res.substr(0, res.length - 1)\n }\n }else if(params instanceof FormData){\n res = params\n }else{\n throw _b_.TypeError.$factory(\n \"send() argument must be string or dictionary, not '\" +\n _b_.str.$factory(params.__class__) + \"'\")\n }\n self.js.send(res)\n return _b_.None\n}\n\najax.set_header = function(self, key, value){\n self.headers[key.toLowerCase()] = value\n}\n\najax.set_timeout = function(self, seconds, func){\n self.js.$requestTimer = setTimeout(\n function() {\n self.js.abort()\n func()\n },\n seconds * 1000)\n}\n\najax.$factory = function(){\n\n if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari\n var xmlhttp = new XMLHttpRequest()\n }else{// code for IE6, IE5\n var xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\")\n }\n xmlhttp.onreadystatechange = function(){\n // here, \"this\" refers to xmlhttp\n var state = this.readyState\n if(this.responseType == \"\" || this.responseType == \"text\"){\n res.js.text = this.responseText\n }\n var timer = this.$requestTimer\n if(state == 0 && this.onuninitialized){\n this.onuninitialized(res)\n }else if(state == 1 && this.onloading){\n this.onloading(res)\n }else if(state == 2 && this.onloaded){\n this.onloaded(res)\n }else if(state == 3 && this.oninteractive){\n this.oninteractive(res)\n }else if(state == 4 && this.oncomplete){\n if(timer !== null){\n window.clearTimeout(timer)\n }\n this.oncomplete(res)\n }\n }\n var res = {\n __class__: ajax,\n js: xmlhttp,\n headers: {}\n }\n return res\n}\n\nfunction _request_without_body(method){\n var $ = $B.args(method, 3, {method: null, url: null, blocking: null},\n [\"method\", \"url\", \"blocking\"], arguments, {blocking: false},\n null, \"kw\"),\n method = $.method,\n url = $.url,\n async = !$.blocking,\n kw = $.kw\n var self = ajax.$factory()\n self.blocking = $.blocking\n var items = handle_kwargs(self, kw, method),\n mode = self.mode = items.mode,\n encoding = self.encoding = items.encoding\n qs = items.data,\n timeout = items.timeout\n set_timeout(self, timeout)\n if(qs){\n url += \"?\" + qs\n }\n if(! (items.cache === true)){\n url += (qs ? \"&\" : \"?\") + (new Date()).getTime()\n }\n self.js.open(method.toUpperCase(), url, async)\n\n if(async){\n if(mode == \"json\" || mode == \"document\"){\n self.js.responseType = mode\n }else{\n self.js.responseType = \"arraybuffer\"\n if(mode != \"text\" && mode != \"binary\"){\n throw _b_.ValueError.$factory(\"invalid mode: \" + mode)\n }\n }\n }else{\n self.js.overrideMimeType('text/plain;charset=x-user-defined')\n self.charset_user_defined = true\n }\n for(var key in items.headers){\n self.js.setRequestHeader(key, items.headers[key])\n }\n // Add function read() to return str or bytes according to mode\n self.js.send()\n}\n\nfunction _request_with_body(method){\n var $ = $B.args(method, 3, {method: null, url: null, blocking: null},\n [\"method\", \"url\", \"blocking\"], arguments, {blocking: false},\n null, \"kw\"),\n method = $.method,\n url = $.url,\n async = !$.blocking,\n kw = $.kw,\n content_type\n var self = ajax.$factory()\n self.js.open(method.toUpperCase(), url, async)\n var items = handle_kwargs(self, kw, method),\n data = items.data,\n timeout = items.timeout\n if($B.$isinstance(data, _b_.dict)){\n data = stringify(data)\n }\n\n set_timeout(self, timeout)\n for(var key in items.headers){\n var value = items.headers[key]\n self.js.setRequestHeader(key, value)\n if(key == 'content-type'){\n content_type = value\n }\n }\n if(method.toUpperCase() == 'POST' && !content_type){\n // set default Content-Type for POST requests\n self.js.setRequestHeader('Content-Type',\n 'application/x-www-form-urlencoded')\n }\n\n // Add function read() to return str or bytes according to mode\n self.js.read = function(){\n return _read(self)\n }\n self.js.send(data)\n}\n\nfunction form_data(form){\n var missing = {},\n $ = $B.args('form_data', 1, {form: null}, ['form'], arguments,\n {form: missing}, null, null)\n if($.form === missing){\n return new FormData()\n }else{\n return new FormData($.form)\n }\n}\n\nfunction connect(){\n _request_without_body.call(null, \"connect\", ...arguments)\n}\n\nfunction _delete(){\n _request_without_body.call(null, \"delete\", ...arguments)\n}\n\nfunction get(){\n _request_without_body.call(null, \"get\", ...arguments)\n}\n\nfunction head(){\n _request_without_body.call(null, \"head\", ...arguments)\n}\n\nfunction options(){\n _request_without_body.call(null, \"options\", ...arguments)\n}\n\nfunction patch(){\n _request_with_body.call(null, \"put\", ...arguments)\n}\n\nfunction post(){\n _request_with_body.call(null, \"post\", ...arguments)\n}\n\nfunction put(){\n _request_with_body.call(null, \"put\", ...arguments)\n}\n\nfunction trace(){\n _request_without_body.call(null, \"trace\", ...arguments)\n}\n\nfunction file_upload(){\n // ajax.file_upload(url, file, method=\"POST\", **callbacks)\n var $ = $B.args(\"file_upload\", 2, {url: null, \"file\": file},\n [\"url\", \"file\"], arguments, {}, null, \"kw\"),\n url = $.url,\n file = $.file,\n kw = $.kw\n\n var self = ajax.$factory(),\n method = 'POST',\n field_name = 'filetosave'\n\n var items = handle_kwargs(self, kw, method),\n data = items.data,\n headers = items.headers,\n timeout = items.timeout\n\n for(var key in items.headers){\n var value = items.headers[key]\n self.js.setRequestHeader(key, value)\n if(key == 'content-type'){\n content_type = value\n }\n }\n set_timeout(self, timeout)\n\n if(kw.$jsobj.hasOwnProperty('method')){\n method = kw.$jsobj.method\n }\n\n if(kw.$jsobj.hasOwnProperty('field_name')){\n field_name = kw.$jsobj.field_name\n }\n\n var formdata = new FormData()\n formdata.append(field_name, file, file.name)\n\n if(items.data){\n if(items.data instanceof FormData){\n // append additional data\n for(var d of items.data){\n formdata.append(d[0], d[1])\n }\n }else if($B.$isinstance(items.data, _b_.dict)){\n for(var d of _b_.list.$factory(_b_.dict.items(items.data))){\n formdata.append(d[0], d[1])\n }\n }else{\n throw _b_.ValueError.$factory(\n 'data value must be a dict of form_data')\n }\n }\n\n self.js.open(method, url, _b_.True)\n self.js.send(formdata)\n\n for(var key in kw.$jsobj){\n if(key.startsWith(\"on\")){\n ajax.bind(self, key.substr(2), kw.$jsobj[key])\n }\n }\n}\n\n$B.set_func_names(ajax)\n\nreturn {\n ajax: ajax,\n Ajax: ajax,\n delete: _delete,\n file_upload: file_upload,\n connect,\n form_data,\n get,\n head,\n options,\n patch,\n post,\n put,\n trace\n}\n\n})(__BRYTHON__)\n"], "_ast": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins,\n ast = $B.ast, // created in py2js\n mod = {}\nmod.PyCF_ONLY_AST = $B.PyCF_ONLY_AST\nmod.AST = $B.AST // in builtin_modules.js\n$B.create_python_ast_classes() // in py_ast.js\nfor(var klass in ast){\n mod[klass] = $B.python_ast_classes[klass]\n}\n\nvar Load = 'Load',\n Store = 'Store',\n Del = 'Del'\n\n// Note: the ensure_literal_* functions are only used to validate a restricted\n// set of non-recursive literals that have already been checked with\n// validate_expr, so they don't accept the validator state\nfunction ensure_literal_number(exp, allow_real, allow_imaginary){\n if(exp.__class__ !== mod.Constant){\n return false\n }\n var value = exp.value\n if(allow_real && $B.$isinstance(value, [_b_.int, _b_.float])){\n return true\n }\n if(allow_imaginary && $B.$isinstance(value, _b_.complex)){\n return true\n }\n return false\n}\n\nfunction ensure_literal_negative(exp, allow_real, allow_imaginary){\n if(exp.__class__ !== mod.UnaryOp){\n return false\n }\n // Must be negation ...\n if(exp.op !== mod.USub) {\n return false\n }\n // ... of a constant ...\n var operand = exp.operand\n if(operand.__class__ !== mod.Constant){\n return false\n }\n // ... number\n return ensure_literal_number(operand, allow_real, allow_imaginary)\n}\n\nfunction ensure_literal_complex(exp){\n if(exp.__class__ !== mod.BinOp){\n return false\n }\n var left = exp.left,\n right = exp.right;\n // Ensure op is addition or subtraction\n if(exp.op !== mod.Add && exp.op !== mod.Sub){\n return false\n }\n // Check LHS is a real number (potentially signed)\n switch(left.__class__){\n case mod.Constant:\n if(!ensure_literal_number(left, true, false)){\n return false\n }\n break;\n case mod.UnaryOp:\n if(!ensure_literal_negative(left, true, false)){\n return false\n }\n break;\n default:\n return false\n }\n // Check RHS is an imaginary number (no separate sign allowed)\n switch(right.__class__){\n case mod.Constant:\n if(!ensure_literal_number(right, false, true)){\n return false\n }\n break;\n default:\n return false\n }\n return true\n}\n\nfunction validate_arguments(args){\n validate_args(args.posonlyargs)\n validate_args(args.args)\n if(args.vararg && args.vararg.annotation){\n validate_expr(args.vararg.annotation, Load)\n }\n validate_args(args.kwonlyargs)\n if(args.kwarg && args.kwarg.annotation){\n validate_expr(args.kwarg.annotation, Load)\n }\n if(args.defaults.length > args.posonlyargs.length + args.args.length){\n throw _b_.ValueError.$factory(\n \"more positional defaults than args on arguments\")\n }\n if(args.kw_defaults.length != args.kwonlyargs.length){\n throw _b_.ValueError.$factory(\n \"length of kwonlyargs is not the same as \" +\n \"kw_defaults on arguments\")\n }\n validate_exprs(args.defaults, Load, 0)\n validate_exprs(args.kw_defaults, Load, 1)\n}\n\nfunction validate_pattern(p, star_ok){\n var ret = -1\n switch(p.__class__) {\n case mod.MatchValue:\n validate_pattern_match_value(p.value)\n break;\n case mod.MatchSingleton:\n if([_b_.None, _b_.True, _b_.False].indexOf(p.value) == -1){\n throw _b_.ValueError(\n \"MatchSingleton can only contain True, False and None\")\n }\n break;\n case mod.MatchSequence:\n validate_patterns(p.patterns, 1);\n break;\n case mod.MatchMapping:\n if(p.keys.length != p.patterns.length){\n throw _b_.ValueError.$factory(\n \"MatchMapping doesn't have the same number of keys as patterns\");\n }\n if(p.rest){\n validate_capture(p.rest)\n }\n\n var keys = p.keys;\n for(var key of keys){\n if(key.__class__ === mod.Constant) {\n var literal = key.value;\n if([_b_.None, _b_.True, _b_.False].indexOf(literal) > -1){\n /* validate_pattern_match_value will ensure the key\n doesn't contain True, False and None but it is\n syntactically valid, so we will pass those on in\n a special case. */\n continue;\n }\n }\n validate_pattern_match_value(key)\n }\n validate_patterns(p.patterns, 0);\n break;\n case mod.MatchClass:\n if(p.kwd_attrs.length != p.kwd_patterns.length){\n throw _b_.ValueError.$factory(\n \"MatchClass doesn't have the same number of \" +\n \"keyword attributes as patterns\")\n }\n validate_expr(p.cls, Load)\n var cls = p.cls;\n while(true){\n if(cls.__class__ === mod.Name){\n break\n }else if(cls.__class__ === mod.Attribute) {\n cls = cls.value;\n continue;\n }else {\n throw _b_.ValueError.$factory(\n \"MatchClass cls field can only contain Name \" +\n \"or Attribute nodes.\")\n }\n }\n\n for(var identifier of p.kwd_attrs){\n validate_name(identifier)\n }\n\n validate_patterns(p.patterns, 0)\n validate_patterns(p.kwd_patterns, 0);\n break;\n case mod.MatchStar:\n if (!star_ok) {\n throw _b_.ValueError.$factory(\"can't use MatchStar here\")\n }\n if(p.name === undefined){\n validate_capture(p.name)\n }\n break;\n case mod.MatchAs:\n if(p.name){\n validate_capture(p.name)\n }\n if(p.pattern == undefined){\n ret = 1;\n }else if(p.name == undefined){\n throw _b_.ValueError.$factory(\n \"MatchAs must specify a target name if a pattern is given\")\n }else{\n validate_pattern(p.pattern, 0);\n }\n break;\n case mod.MatchOr:\n if(p.patterns.length < 2){\n throw _b_.ValueError.$factory(\n \"MatchOr requires at least 2 patterns\")\n }\n validate_patterns(p.patterns, 0)\n break;\n // No default case, so the compiler will emit a warning if new pattern\n // kinds are added without being handled here\n }\n if(ret < 0){\n throw _b_.SystemError.$factory(\"unexpected pattern\")\n }\n return true\n}\n\nfunction validate_patterns(patterns, star_ok){\n for(var pattern of patterns){\n validate_pattern(pattern, star_ok)\n }\n return true\n}\n\nfunction validate_pattern_match_value(exp){\n validate_expr(exp, Load)\n switch (exp.__class__){\n case mod.Constant:\n /* Ellipsis and immutable sequences are not allowed.\n For True, False and None, MatchSingleton() should\n be used */\n validate_expr(exp, Load)\n var literal = exp.value\n if($B.$isinstance(literal, [_b_.int, _b_.float, _b_.bytes,\n _b_.complex, _b_.str])){\n return true\n }\n throw _b_.ValueError.$factory(\n \"unexpected constant inside of a literal pattern\")\n case mod.Attribute:\n // Constants and attribute lookups are always permitted\n return true\n case mod.UnaryOp:\n // Negated numbers are permitted (whether real or imaginary)\n // Compiler will complain if AST folding doesn't create a constant\n if(ensure_literal_negative(exp, true, true)){\n return true\n }\n break;\n case mod.BinOp:\n // Complex literals are permitted\n // Compiler will complain if AST folding doesn't create a constant\n if(ensure_literal_complex(exp)){\n return true\n }\n break;\n case mod.JoinedStr:\n // Handled in the later stages\n return 1;\n default:\n break;\n }\n throw _b_.ValueError.$factory(\n \"patterns may only match literals and attribute lookups\")\n}\n\nfunction validate_capture(name){\n if(name == \"_\"){\n throw _b_.ValueError.$factory(\"can't capture name '_' in patterns\")\n }\n validate_name(name)\n}\n\nfunction validate_name(name){\n var forbidden = [\"None\", \"True\", \"False\"]\n if(forbidden.indexOf(name) > -1){\n throw _b_.ValueError.$factory(`identifier field can't represent` +\n ` '${name}' constant\", forbidden[i]`)\n }\n return true\n}\n\nfunction validate_comprehension(gens){\n if(gens.length == 0) {\n throw _b_.ValueError.$factory(\"comprehension with no generators\")\n }\n for(var comp of gens){\n validate_expr(comp.target, Store)\n validate_expr(comp.iter, Load)\n validate_exprs(comp.ifs, Load, 0)\n }\n return true\n}\n\nfunction validate_keywords(keywords){\n for(var keyword of keywords){\n validate_expr(keyword.value, Load)\n }\n return true\n}\n\nfunction validate_args(args){\n for(var arg of args){\n if(arg.annotation){\n validate_expr(arg.annotation, Load)\n }\n }\n return true\n}\n\nfunction validate_nonempty_seq(seq, what, owner){\n if(seq.length > 0){\n return true\n }\n throw _b_.ValueError.$factory(`empty ${what} on ${owner}`)\n}\n\nfunction validate_assignlist(targets, ctx){\n validate_nonempty_seq(targets, \"targets\", ctx == Del ? \"Delete\" : \"Assign\")\n validate_exprs(targets, ctx, 0)\n}\n\nfunction validate_body(body, owner){\n validate_nonempty_seq(body, \"body\", owner)\n validate_stmts(body)\n}\n\nfunction validate_exprs(exprs, ctx, null_ok){\n for(var expr of exprs){\n if(expr !== _b_.None){\n validate_expr(expr, ctx)\n }else if(!null_ok){\n throw _b_.ValueError.$factory(\n \"None disallowed in expression list\")\n }\n\n }\n return true\n}\n\nfunction validate_expr(exp, ctx){\n var check_ctx = 1,\n actual_ctx;\n\n /* First check expression context. */\n switch (exp.__class__) {\n case mod.Name:\n validate_name(exp.id)\n actual_ctx = exp.ctx\n break;\n case mod.Attribute:\n case mod.Subscript:\n case mod.Starred:\n case mod.List:\n case mod.Tuple:\n actual_ctx = exp.ctx;\n break\n default:\n if(ctx != Load){\n throw _b_.ValueError.$factory(\"expression which can't be \" +\n `assigned to in ${ctx} context`)\n }\n check_ctx = 0;\n /* set actual_ctx to prevent gcc warning */\n actual_ctx = 0;\n }\n actual_ctx = actual_ctx === 0 ? actual_ctx :\n actual_ctx.__class__.__name__\n if(check_ctx && actual_ctx != ctx){\n throw _b_.ValueError.$factory(`expression must have ` +\n `${ctx} context but has ${actual_ctx} instead`)\n }\n\n /* Now validate expression. */\n switch (exp.__class__) {\n case mod.BoolOp:\n if(exp.values.length < 2){\n throw _b_.ValueError.$factory(\"BoolOp with less than 2 values\")\n }\n validate_exprs(exp.values, Load, 0);\n break;\n case mod.BinOp:\n validate_expr(exp.left, Load)\n validate_expr(exp.right, Load)\n break;\n case mod.UnaryOp:\n validate_expr(exp.operand, Load);\n break;\n case mod.Lambda:\n validate_arguments(exp.args)\n validate_expr(exp.body, Load);\n break;\n case mod.IfExp:\n validate_expr(exp.test, Load)\n validate_expr(exp.body, Load)\n validate_expr(exp.orelse, Load)\n break;\n case mod.Dict:\n if(exp.keys.length != exp.values.length){\n throw _b_.ValueError.$factory(\n \"Dict doesn't have the same number of keys as values\");\n }\n /* null_ok=1 for keys expressions to allow dict unpacking to work in\n dict literals, i.e. ``{**{a:b}}`` */\n validate_exprs(exp.keys, Load, 1)\n validate_exprs(exp.values, Load, 0);\n break;\n case mod.Set:\n validate_exprs(exp.elts, Load, 0);\n break;\n case mod.ListComp:\n case mod.SetComp:\n case mod.GeneratorExp:\n validate_comprehension(exp.generators)\n validate_expr(exp.elt, Load)\n break;\n case mod.DictComp:\n validate_comprehension(exp.generators)\n validate_expr(exp.key, Load)\n validate_expr(exp.value, Load)\n break;\n case mod.Yield:\n if(exp.value){\n validate_expr(exp.value, Load)\n }\n break;\n case mod.YieldFrom:\n validate_expr(exp.value, Load)\n break;\n case mod.Await:\n validate_expr(exp.value, Load)\n break;\n case mod.Compare:\n if(exp.comparators.length == 0){\n throw _b_.ValueError.$factory(\"Compare with no comparators\")\n }\n if(exp.comparators.length != exp.ops){\n throw _b_.ValueError.$factory(\"Compare has a different number \" +\n \"of comparators and operands\")\n }\n validate_exprs(exp.comparators, Load, 0)\n validate_expr(exp.left, Load)\n break;\n case mod.Call:\n validate_expr(exp.func, Load)\n validate_exprs(exp.args, Load, 0)\n validate_keywords(exp.keywords)\n break;\n case mod.Constant:\n validate_constant(exp.value)\n break;\n case mod.JoinedStr:\n validate_exprs(exp.values, Load, 0)\n break;\n case mod.FormattedValue:\n validate_expr(exp.value, Load)\n if (exp.format_spec) {\n validate_expr(exp.format_spec, Load)\n break;\n }\n break;\n case mod.Attribute:\n validate_expr(exp.value, Load)\n break;\n case mod.Subscript:\n validate_expr(exp.slice, Load)\n validate_expr(exp.value, Load)\n break;\n case mod.Starred:\n validate_expr(exp.value, ctx)\n break;\n case mod.Slice:\n if(exp.lower){\n validate_expr(exp.lower, Load)\n }\n if(exp.upper){\n validate_expr(exp.upper, Load)\n }\n if(exp.step){\n validate_expr(exp.step, Load)\n }\n break;\n case mod.List:\n validate_exprs(exp.elts, ctx, 0)\n break;\n case mod.Tuple:\n validate_exprs(exp.elts, ctx, 0)\n break;\n case mod.NamedExpr:\n validate_expr(exp.value, Load)\n break;\n /* This last case doesn't have any checking. */\n case mod.Name:\n ret = 1;\n break;\n // No default case mod.so compiler emits warning for unhandled cases\n }\n return true\n}\n\nfunction validate_constant(value){\n if (value == _b_.None || value == _b_.Ellipsis){\n return true\n }\n if($B.$isinstance(value,\n [_b_.int, _b_.float, _b_.complex, _b_.bool, _b_.bytes, _b_.str])){\n return true\n }\n\n if($B.$isinstance(value, [_b_.tuple, _b_.frozenset])){\n var it = _b_.iter(value)\n while(true){\n try{\n var item = _b_.next(it)\n validate_constant(item)\n }catch(err){\n if($B.is_exc(err, [_b_.StopIteration])){\n return true\n }\n throw err\n }\n }\n }\n}\n\nfunction validate_stmts(seq){\n for(var stmt of seq) {\n if(stmt !== _b_.None){\n validate_stmt(stmt)\n }else{\n throw _b_.ValueError.$factory(\"None disallowed in statement list\");\n }\n }\n}\n\nfunction validate_stmt(stmt){\n switch (stmt.__class__) {\n case mod.FunctionDef:\n validate_body(stmt.body, \"FunctionDef\")\n validate_arguments(stmt.args)\n validate_exprs(stmt.decorator_list, Load, 0)\n if(stmt.returns){\n validate_expr(stmt.returns, Load)\n }\n break;\n case mod.ClassDef:\n validate_body(stmt.body, \"ClassDef\")\n validate_exprs(stmt.bases, Load, 0)\n validate_keywords(stmt.keywords)\n validate_exprs(stmtdecorator_list, Load, 0)\n break;\n case mod.Return:\n if(stmt.value){\n validate_expr(stmt.value, Load)\n }\n break;\n case mod.Delete:\n validate_assignlist(stmt.targets, Del);\n break;\n case mod.Assign:\n validate_assignlist(stmt.targets, Store)\n validate_expr(stmt.value, Load)\n break;\n case mod.AugAssign:\n validate_expr(stmt.target, Store) &&\n validate_expr(stmt.value, Load);\n break;\n case mod.AnnAssign:\n if(stmt.target.__class__ != mod.Name && stmt.simple){\n throw _b_.TypeError.$factory(\n \"AnnAssign with simple non-Name target\")\n }\n validate_expr(stmt.target, Store)\n if(stmt.value){\n validate_expr(stmt.value, Load)\n validate_expr(stmt.annotation, Load);\n }\n break;\n case mod.For:\n validate_expr(stmt.target, Store)\n validate_expr(stmt.iter, Load)\n validate_body(stmt.body, \"For\")\n validate_stmts(stmt.orelse)\n break;\n case mod.AsyncFor:\n validate_expr(stmt.target, Store)\n validate_expr(stmt.iter, Load)\n validate_body(stmt.body, \"AsyncFor\")\n validate_stmts(stmt.orelse)\n break;\n case mod.While:\n validate_expr(stmt.test, Load)\n validate_body(stmt.body, \"While\")\n validate_stmts(stmt.orelse)\n break;\n case mod.If:\n validate_expr(stmt.test, Load)\n validate_body(stmt.body, \"If\")\n validate_stmts(stmt.orelse)\n break;\n case mod.With:\n validate_nonempty_seq(stmt.items, \"items\", \"With\")\n for (var item of stmt.items){\n validate_expr(item.context_expr, Load) &&\n (! item.optional_vars || validate_expr(item.optional_vars, Store))\n }\n validate_body(stmt.body, \"With\");\n break;\n case mod.AsyncWith:\n validate_nonempty_seq(stmt.items, \"items\", \"AsyncWith\")\n for(var item of stmt.items){\n validate_expr(item.context_expr, Load)\n if(item.optional_vars){\n validate_expr(item.optional_vars, Store)\n }\n }\n validate_body(stmt.body, \"AsyncWith\");\n break;\n case mod.Match:\n validate_expr(stmt.subject, Load)\n validate_nonempty_seq(stmt.cases, \"cases\", \"Match\")\n for(var m of stmt.cases){\n validate_pattern(m.pattern, 0)\n if(m.guard){\n validate_expr(m.guard, Load)\n }\n validate_body(m.body, \"match_case\")\n }\n break;\n case mod.Raise:\n if(stmt.exc){\n validate_expr(stmt.exc, Load)\n if(stmt.cause){\n validate_expr(stmt.cause, Load)\n }\n break;\n }\n if(stmt.cause) {\n throw _b_.ValueError.$factory(\"Raise with cause but no exception\");\n }\n break;\n case mod.Try:\n validate_body(stmt.body, \"Try\")\n if(stmt.handlers.length == 0 + stmt.finalbody.length == 0){\n throw _b_.ValueError.$factor(\n \"Try has neither except handlers nor finalbody\");\n }\n if(stmt.handlers.length == 0 && stmt.orelse.length > 0){\n throw _b_.ValueError.$factory(\n \"Try has orelse but no except handlers\");\n }\n for(var handler of stmt.handlers){\n if(handler.type){\n validate_expr(handler.type, Load)\n validate_body(handler.body, \"ExceptHandler\")\n }\n }\n if(stmt.finalbody.length > 0){\n validate_stmts(stmt.finalbody)\n }\n if(stmt.orelse.length > 0){\n validate_stmts(stmt.orelse)\n }\n break;\n case mod.TryStar:\n validate_body(stmt.body, \"TryStar\")\n if(stmt.handlers.length + stmt.finalbody.length == 0){\n throw _b_.ValueError.$factory(\n \"TryStar has neither except handlers nor finalbody\");\n }\n if(stmt.handlers.length == 0 && stmt.orelse.length > 0){\n throw _b_.ValueError.$factory(\n \"TryStar has orelse but no except handlers\");\n }\n for(var handler of stm.handlers){\n if(handler.type){\n validate_expr(handler.type, Load)\n validate_body(handler.body, \"ExceptHandler\")\n }\n }\n if(stmt.finalbody.length > 0){\n validate_stmts(stmt.finalbody)\n }\n if(stmt.orelse.length > 0){\n validate_stmts(stmt.orelse)\n }\n break;\n case mod.Assert:\n validate_expr(stmt.test, Load)\n if(stmt.msg){\n validate_expr(stmt.msg, Load)\n }\n break;\n case mod.Import:\n validate_nonempty_seq(stmt.names, \"names\", \"Import\");\n break;\n case mod.ImportFrom:\n if(stmt.level < 0) {\n throw _b_.ValueError.$factory(\"Negative ImportFrom level\")\n }\n validate_nonempty_seq(stmt.names, \"names\", \"ImportFrom\");\n break;\n case mod.Global:\n validate_nonempty_seq(stmt.names, \"names\", \"Global\");\n break;\n case mod.Nonlocal:\n validate_nonempty_seq(stmt.names, \"names\", \"Nonlocal\");\n break;\n case mod.Expr:\n validate_expr(stmt.value, Load);\n break;\n case mod.AsyncFunctionDef:\n validate_body(stmt.body, \"AsyncFunctionDef\")\n validate_arguments(stmt.args)\n validate_exprs(stmt.decorator_list, Load, 0)\n if(stmt.returns){\n validate_expr(stmt.returns, Load)\n }\n break;\n case mod.Pass:\n case mod.Break:\n case mod.Continue:\n break;\n // No default case so compiler emits warning for unhandled cases\n }\n}\n\n\nmod._validate = function(ast_obj){\n switch (ast_obj.__class__) {\n case mod.Module:\n validate_stmts(ast_obj.body);\n break;\n case mod.Interactive:\n validate_stmts(ast_obj.body);\n break;\n case mod.Expression:\n validate_expr(ast_obj.body, Load);\n break;\n case mod.FunctionType:\n validate_exprs(ast_obj.argtypes, Load, 0) &&\n validate_expr(ast_obj.returns, Load);\n break;\n // No default case so compiler emits warning for unhandled cases\n }\n}\nreturn mod\n\n}\n)(__BRYTHON__)\n"], "_base64": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins,\n _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\n\nfunction make_alphabet(altchars){\n var alphabet = _keyStr\n if(altchars !== undefined && altchars !== _b_.None){\n // altchars is an instance of Python bytes\n var source = altchars.source\n alphabet = alphabet.substr(0,alphabet.length-3) +\n _b_.chr(source[0]) + _b_.chr(source[1]) + '='\n }\n return alphabet\n}\n\nvar Base64 = {\n error: function(){return 'binascii_error'},\n\n encode: function(bytes, altchars){\n\n var input = bytes.source,\n output = \"\",\n chr1, chr2, chr3, enc1, enc2, enc3, enc4\n var i = 0\n\n var alphabet = make_alphabet(altchars)\n\n while(i < input.length){\n\n chr1 = input[i++]\n chr2 = input[i++]\n chr3 = input[i++]\n\n enc1 = chr1 >> 2\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4)\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6)\n enc4 = chr3 & 63\n\n if(isNaN(chr2)){\n enc3 = enc4 = 64\n }else if(isNaN(chr3)){\n enc4 = 64\n }\n\n output = output + alphabet.charAt(enc1) +\n alphabet.charAt(enc2) +\n alphabet.charAt(enc3) +\n alphabet.charAt(enc4)\n\n }\n return _b_.bytes.$factory(output, 'utf-8', 'strict')\n },\n\n\n decode: function(bytes, altchars, validate){\n var output = [],\n chr1, chr2, chr3,\n enc1, enc2, enc3, enc4\n\n var alphabet = make_alphabet(altchars)\n\n var input = bytes.source\n\n // If validate is set, check that all characters in input\n // are in the alphabet\n var _input = ''\n var padding = 0\n for(var i = 0, len = input.length; i < len; i++){\n var car = String.fromCharCode(input[i])\n var char_num = alphabet.indexOf(car)\n if(char_num == -1){\n if(validate){throw Base64.error(\"Non-base64 digit found: \" +\n car)}\n }else if(char_num == 64 && i < input.length - 2){\n if(validate){throw Base64.error(\"Non-base64 digit found: \" +\n car)}\n }else if(char_num == 64 && i >= input.length - 2){\n padding++\n _input += car\n }else{\n _input += car\n }\n }\n input = _input\n if(_input.length == padding){return _b_.bytes.$factory([])}\n if( _input.length % 4 > 0){throw Base64.error(\"Incorrect padding\")}\n\n var i = 0\n while(i < input.length){\n\n enc1 = alphabet.indexOf(input.charAt(i++))\n enc2 = alphabet.indexOf(input.charAt(i++))\n enc3 = alphabet.indexOf(input.charAt(i++))\n enc4 = alphabet.indexOf(input.charAt(i++))\n\n chr1 = (enc1 << 2) | (enc2 >> 4)\n chr2 = ((enc2 & 15) << 4) | (enc3 >> 2)\n chr3 = ((enc3 & 3) << 6) | enc4\n\n output.push(chr1)\n\n if(enc3 != 64){output.push(chr2)}\n if(enc4 != 64){output.push(chr3)}\n\n }\n // return Python bytes\n return _b_.bytes.$factory(output, 'utf-8', 'strict')\n\n },\n\n _utf8_encode: function(string) {\n string = string.replace(/\\r\\n/g, \"\\n\")\n var utftext = \"\";\n\n for(var n = 0; n < string.length; n++){\n\n var c = string.charCodeAt(n)\n\n if(c < 128){\n utftext += String.fromCharCode(c)\n }else if((c > 127) && (c < 2048)){\n utftext += String.fromCharCode((c >> 6) | 192)\n utftext += String.fromCharCode((c & 63) | 128)\n }else{\n utftext += String.fromCharCode((c >> 12) | 224)\n utftext += String.fromCharCode(((c >> 6) & 63) | 128)\n utftext += String.fromCharCode((c & 63) | 128)\n }\n\n }\n\n return utftext\n },\n\n _utf8_decode: function(utftext) {\n var string = \"\",\n i = 0,\n c = c1 = c2 = 0\n\n while(i < utftext.length){\n\n c = utftext.charCodeAt(i)\n\n if(c < 128){\n string += String.fromCharCode(c)\n i++\n }else if((c > 191) && (c < 224)){\n c2 = utftext.charCodeAt(i + 1)\n string += String.fromCharCode(((c & 31) << 6) | (c2 & 63))\n i += 2\n }else{\n c2 = utftext.charCodeAt(i + 1)\n c3 = utftext.charCodeAt(i + 2)\n string += String.fromCharCode(\n ((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63))\n i += 3\n }\n\n }\n\n return string\n }\n\n}\n\nreturn {Base64:Base64}\n}\n\n)(__BRYTHON__)"], "_binascii": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins,\n _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\n\nvar error = $B.make_class(\"error\", _b_.Exception.$factory)\nerror.__bases__ = [_b_.Exception]\n$B.set_func_names(error, \"binascii\")\n\nfunction decode(bytes, altchars, validate){\n var output = [],\n chr1, chr2, chr3,\n enc1, enc2, enc3, enc4\n\n var alphabet = make_alphabet(altchars)\n\n var input = bytes.source\n\n // If validate is set, check that all characters in input\n // are in the alphabet\n var _input = ''\n var padding = 0\n for(var i = 0, len = input.length; i < len; i++){\n var car = String.fromCharCode(input[i])\n var char_num = alphabet.indexOf(car)\n if(char_num == -1){\n if(validate){throw error.$factory(\"Non-base64 digit found: \" +\n car)}\n }else if(char_num == 64 && i < input.length - 2){\n if(validate){throw error.$factory(\"Non-base64 digit found: \" +\n car)}\n }else if(char_num == 64 && i >= input.length - 2){\n padding++\n _input += car\n }else{\n _input += car\n }\n }\n input = _input\n if(_input.length == padding){return _b_.bytes.$factory([])}\n if( _input.length % 4 > 0){throw error.$factory(\"Incorrect padding\")}\n\n var i = 0\n while(i < input.length){\n\n enc1 = alphabet.indexOf(input.charAt(i++))\n enc2 = alphabet.indexOf(input.charAt(i++))\n enc3 = alphabet.indexOf(input.charAt(i++))\n enc4 = alphabet.indexOf(input.charAt(i++))\n\n chr1 = (enc1 << 2) | (enc2 >> 4)\n chr2 = ((enc2 & 15) << 4) | (enc3 >> 2)\n chr3 = ((enc3 & 3) << 6) | enc4\n\n output.push(chr1)\n\n if(enc3 != 64){output.push(chr2)}\n if(enc4 != 64){output.push(chr3)}\n\n }\n // return Python bytes\n return _b_.bytes.$factory(output)\n}\n\n\nvar hex2int = {},\n hex = '0123456789abcdef'\nfor(var i = 0; i < hex.length; i++){\n hex2int[hex[i]] = i\n hex2int[hex[i].toUpperCase()] = i\n}\n\nfunction make_alphabet(altchars){\n var alphabet = _keyStr\n if(altchars !== undefined && altchars !== _b_.None){\n // altchars is an instance of Python bytes\n var source = altchars.source\n alphabet = alphabet.substr(0,alphabet.length-3) +\n _b_.chr(source[0]) + _b_.chr(source[1]) + '='\n }\n return alphabet\n}\n\nvar module = {\n a2b_base64: function(){\n var $ = $B.args(\"a2b_base64\", 2, {s: null, strict_mode: null}, \n ['s', 'strict_mode'],\n arguments, {strict_mode: false}, null, null)\n var bytes\n if($B.$isinstance($.s, _b_.str)){\n bytes = _b_.str.encode($.s, 'ascii')\n }else if($B.$isinstance($.s, [_b_.bytes, _b_.bytearray])){\n bytes = $.s\n }else{\n throw _b_.TypeError.$factory('wrong type: ' + $B.class_name($.s))\n }\n return decode(bytes)\n },\n a2b_hex: function(){\n var $ = $B.args(\"a2b_hex\", 1, {s: null}, ['s'],\n arguments, {}, null, null),\n s = $.s\n if($B.$isinstance(s, _b_.bytes)){\n s = _b_.bytes.decode(s, 'ascii')\n }\n if(typeof s !== \"string\"){\n throw _b_.TypeError.$factory(\"argument should be bytes, \" +\n \"buffer or ASCII string, not '\" + $B.class_name(s) + \"'\")\n }\n\n var len = s.length\n if(len % 2 == 1){\n throw _b_.TypeError.$factory('Odd-length string')\n }\n\n var res = []\n for(var i = 0; i < len; i += 2){\n res.push((hex2int[s.charAt(i)] << 4) + hex2int[s.charAt(i + 1)])\n }\n return _b_.bytes.$factory(res)\n },\n b2a_base64: function(){\n var $ = $B.args(\"b2a_base64\", 1, {data: null}, ['data'],\n arguments, {}, null, \"kw\")\n var newline = false\n if($.kw && $.kw.$jsobj.hasOwnProperty('newline')){\n newline = $.kw.$jsobj.newline\n }\n\n var string = $B.to_bytes($.data),\n res = btoa(String.fromCharCode.apply(null, string))\n if(newline){res += \"\\n\"}\n return _b_.bytes.$factory(res, \"ascii\")\n },\n b2a_hex: function(obj){\n var string = $B.to_bytes(obj),\n res = []\n function conv(c){\n if(c > 9){\n c = c + 'a'.charCodeAt(0) - 10\n }else{\n c = c + '0'.charCodeAt(0)\n }\n return c\n }\n string.forEach(function(char){\n res.push(conv((char >> 4) & 0xf))\n res.push(conv(char & 0xf))\n })\n return _b_.bytes.$factory(res)\n },\n b2a_uu: function(obj){\n var string = _b_.bytes.decode(obj, 'ascii')\n var len = string.length,\n res = String.fromCharCode((0x20 + len) & 0x3F)\n while(string.length > 0){\n var s = string.slice(0, 3)\n while(s.length < 3){s.push(String.fromCharCode(0))}\n var A = s[0],\n B = s[1],\n C = s[2]\n var a = (A >> 2) & 0x3F,\n b = ((A << 4) | ((B >> 4) & 0xF)) & 0x3F,\n c = (((B << 2) | ((C >> 6) & 0x3)) & 0x3F),\n d = C & 0x3F\n res += String.fromCharCode(0x20 + a, 0x20 + b, 0x20 + c, 0x20 + d)\n string = string.slice(3)\n }\n return _b_.bytes.$factory(res + \"\\n\", \"ascii\")\n },\n error: error\n}\n\nmodule.hexlify = module.b2a_hex\nmodule.unhexlify = module.a2b_hex\n\nreturn module\n}\n)(__BRYTHON__)"], "_io_classes": [".js", "var _b_ = __BRYTHON__.builtins\n\nfunction get_self(name, args){\n return $B.args(name, 1, {self: null}, [\"self\"], args, {}, null, null).self\n}\n\nvar _IOBase = $B.make_class(\"_IOBase\")\n_IOBase.__mro__ = [_b_.object]\n\n_IOBase.close = function(){\n get_self(\"close\", arguments).__closed = true\n}\n\n_IOBase.flush = function(){\n get_self(\"flush\", arguments)\n return _b_.None\n}\n\n$B.set_func_names(_IOBase, '_io')\n\n// Base class for binary streams that support some kind of buffering.\nvar _BufferedIOBase = $B.make_class(\"_BufferedIOBase\")\n_BufferedIOBase.__mro__ = [_IOBase, _b_.object]\n\n_BufferedIOBase.__enter__ = function(self){\n return self\n}\n_BufferedIOBase.__exit__ = function(self, type, value, traceback){\n try{\n $B.$call($B.$getattr(self, 'close'))()\n self.__closed = true\n return true\n }catch(err){\n return false\n }\n}\n\n$B.set_func_names(_BufferedIOBase, '_io')\n\n// Base class for raw binary I/O.\nvar _RawIOBase = $B.make_class(\"_RawIOBase\")\n\n_RawIOBase.__mro__ = [_IOBase, _b_.object]\n\n_RawIOBase.read = function(){\n var $ = $B.args(\"read\", 2, {self: null, size: null}, [\"self\", \"size\"],\n arguments, {size: -1}, null, null),\n self = $.self,\n size = $.size,\n res\n self.$pos = self.$pos || 0\n if(size == -1){\n if(self.$pos == 0){\n res = self.$content\n }else{\n res = _b_.bytes.$factory(self.$content.source.slice(self.$pos))\n }\n self.$pos = self.$content.source.length - 1\n }else{\n res = _b_.bytes.$factory(self.$content.source.slice(self.$pos, size))\n self.$pos += size\n }\n return res\n}\n\n_RawIOBase.readall = function(){\n return _RawIOBase.read(get_self(\"readall\", arguments))\n}\n\n$B.set_func_names(_RawIOBase, '_io')\n\n// Base class for text streams.\n_TextIOBase = $B.make_class(\"_TextIOBase\")\n_TextIOBase.__mro__ = [_IOBase, _b_.object]\n\nvar StringIO = $B.make_class(\"StringIO\",\n function(){\n var $ = $B.args(\"StringIO\", 2, {value: null, newline: null},\n [\"value\", \"newline\"], arguments, {value: '', newline: \"\\n\"},\n null, null)\n return {\n __class__: StringIO,\n $counter: 0,\n $content: $.value\n }\n }\n)\n\nStringIO.__mro__ = [$B.Reader, _b_.object]\n\nStringIO.getvalue = function(){\n var $ = $B.args(\"getvalue\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n return $.self.$content.substr(0) // copy\n}\n\nStringIO.truncate = function(self, size){\n var $ = $B.args('truncate', 2, {self: null, size: null}, ['self', 'size'],\n arguments, {size: _b_.None}, null, null),\n self = $.self,\n size = $.size\n if(size === _b_.None){\n size = self.$counter\n }\n self.$content = self.$content.substr(0, size)\n self.$counter = self.$content.length\n return self.$counter\n}\n\nStringIO.write = function(){\n var $ = $B.args(\"write\", 2, {self: null, data: null},\n [\"self\", \"data\"], arguments, {}, null, null)\n if(! $B.$isinstance($.data, _b_.str)){\n throw _b_.TypeError.$factory('string argument expected, got ' +\n `'${$B.class_name($.data)}'`)\n }\n var text = $.self.$content,\n position = $.self.$counter\n text = text.substr(0, position) + $.data +\n text.substr(position + $.data.length)\n $.self.$content = text\n $.self.$counter = position + $.data.length\n return $.data.length\n}\n\n$B.set_func_names(StringIO, \"_io\")\n\nvar BytesIO = $B.make_class(\"BytesIO\",\n function(){\n var $ = $B.args(\"BytesIO\", 1, {value: null},\n [\"value\"], arguments, {value: _b_.bytes.$factory()},\n null, null)\n return {\n __class__: BytesIO,\n $binary: true,\n $content: $.value,\n $length: $.value.source.length,\n $counter: 0\n }\n }\n)\nBytesIO.__mro__ = [$B.Reader, _b_.object]\n\nBytesIO.getbuffer = function(){\n var self = get_self(\"getbuffer\", arguments)\n return self.$content\n}\n\nBytesIO.getvalue = function(){\n var self = get_self(\"getvalue\", arguments)\n return self.$content\n}\n\nBytesIO.write = function(){\n var $ = $B.args(\"write\", 2, {self: null, data: null},\n [\"self\", \"data\"], arguments, {}, null, null)\n $.self.$content.source = $.self.$content.source.concat(\n $.data.source)\n $.self.$counter += $.data.source.length\n return _b_.None\n}\n\n$B.set_func_names(BytesIO, \"_io\")\n\nvar BlockingIOError = $B.make_class('BlockingIOError')\nBlockingIOError.__bases__ = [_b_.OSError]\n\n$B.set_func_names(BlockingIOError, '_io')\n\nvar $module = (function($B){\n return {\n _BufferedIOBase,\n _IOBase,\n _RawIOBase,\n _TextIOBase: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n BlockingIOError,\n BytesIO: BytesIO,\n FileIO: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n StringIO: StringIO,\n BufferedReader: $B.BufferedReader,\n BufferedWriter: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n BufferedRWPair: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n BufferedRandom: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n IncrementalNewlineDecoder: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n TextIOWrapper: $B.TextIOWrapper\n }\n})(__BRYTHON__)\n$module._IOBase.__doc__ = \"_IOBase\""], "_json": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins\n\nfunction simple(obj){\n switch(typeof obj){\n case 'string':\n case 'number':\n case 'boolean':\n return true\n }\n if(obj instanceof Number ||\n Array.isArray(obj) ||\n $B.$isinstance(obj, [_b_.list, _b_.tuple, _b_.dict])){\n return true\n }\n return false\n}\n\nfunction to_json(obj, level){\n var $defaults = {skipkeys:_b_.False, ensure_ascii:_b_.True,\n check_circular:_b_.True, allow_nan:_b_.True, cls:_b_.None,\n indent:_b_.None, separators:_b_.None, \"default\":_b_.None,\n sort_keys:_b_.False},\n $ = $B.args(\"to_json\", 2, {obj: null, level: null}, ['obj', 'level'],\n arguments, {level: 1}, null, \"kw\")\n\n for(var key in $defaults){\n if(! $.kw.$jsobj.hasOwnProperty(key)){\n $.kw.$jsobj[key] = $defaults[key]\n }\n }\n\n // Transform Python dict into Javascript object\n var kw = $.kw.$jsobj\n\n var indent = kw.indent,\n ensure_ascii = kw.ensure_ascii,\n separators = kw.separators === _b_.None ?\n kw.indent === _b_.None ? [', ', ': '] : [',', ': '] :\n kw.separators,\n skipkeys = kw.skipkeys,\n _default = kw.default,\n sort_keys = kw.sort_keys,\n allow_nan = kw.allow_nan,\n check_circular = kw.check_circular\n var item_separator = separators[0],\n key_separator = separators[1]\n if(indent !== _b_.None){\n var indent_str\n if(typeof indent == \"string\"){\n indent_str = indent\n }else if(typeof indent == \"number\" && indent >= 1){\n indent_str = \" \".repeat(indent)\n }else{\n throw _b_.ValueError.$factory(\"invalid indent: \" +\n _b_.str.$factory(indent))\n }\n }\n var kwarg = {$kw: [{}]}\n for(var key in kw){\n kwarg.$kw[0][key] = kw[key]\n }\n\n switch(typeof obj){\n case 'string':\n var res = JSON.stringify(obj)\n if(ensure_ascii){\n var escaped = ''\n for(var i = 0, len = res.length; i < len; i++){\n var u = res.codePointAt(i)\n if(u > 127){\n u = u.toString(16)\n while(u.length < 4){\n u = \"0\" + u\n }\n escaped += '\\\\u' + u\n }else{\n escaped += res.charAt(i)\n }\n }\n return escaped\n }\n return res\n case 'boolean':\n return obj.toString()\n case 'number':\n if([Infinity, -Infinity].indexOf(obj) > -1 ||\n isNaN(obj)){\n if(! allow_nan){\n throw _b_.ValueError.$factory(\n 'Out of range float values are not JSON compliant')\n }\n }\n return obj.toString()\n }\n if(obj instanceof String){\n // string with surrogate pairs. cf. issue #1903.\n var res = ''\n if(obj.surrogates){\n var s_ix = 0,\n s_pos = obj.surrogates[s_ix]\n for(var i = 0, len = obj.length; i < len; i++){\n if(i == s_pos){\n var code = obj.codePointAt(i) - 0x10000\n res += '\\\\u' + (0xD800 | (code >> 10)).toString(16) +\n '\\\\u' + (0xDC00 | (code & 0x3FF)).toString(16)\n i++\n s_ix++\n s_pos = obj.surrogates[s_ix]\n }else{\n var code = obj.charCodeAt(i)\n if(code < 127){\n var x = _b_.repr(obj[i])\n res += x.substr(1, x.length - 2)\n }else{\n var x = code.toString(16)\n while(x.length < 4){\n x = '0' + x\n }\n res += '\\\\u' + x\n }\n }\n }\n }\n return '\"' + res.replace(new RegExp('\"', \"g\"), '\\\\\"') + '\"'\n }\n\n if($B.$isinstance(obj, _b_.list)){\n var res = []\n var sep = item_separator,\n first = '[',\n last = ']'\n if(indent !== _b_.None){\n sep += \"\\n\" + indent_str.repeat(level)\n first = '[' + '\\n' + indent_str.repeat(level)\n last = '\\n' + indent_str.repeat(level - 1) + ']'\n level++\n }\n for(var i = 0, len = obj.length; i < len; i++){\n res.push(to_json(obj[i], level, kwarg))\n }\n return first + res.join(sep) + last\n }else if($B.$isinstance(obj, _b_.float)){\n return obj.value\n }else if(obj.__class__ === $B.long_int){\n return obj.value.toString()\n }else if(obj === _b_.None){\n return \"null\"\n }else if($B.$isinstance(obj, _b_.dict)){\n var res = [],\n items = Array.from($B.make_js_iterator(_b_.dict.items(obj)))\n if(sort_keys){\n // Sort keys by alphabetical order\n items.sort()\n }\n var sep = item_separator,\n first = '{',\n last = '}'\n if(indent !== _b_.None){\n sep += \"\\n\" + indent_str.repeat(level)\n first = '{' + '\\n' + indent_str.repeat(level)\n last = '\\n' + indent_str.repeat(level - 1) + '}'\n level++\n }\n for(var i = 0, len = items.length; i < len; i++){\n var item = items[i]\n if(! simple(item[0])){\n if(! skipkeys){\n throw _b_.TypeError.$factory(\"keys must be str, int, \" +\n \"float, bool or None, not \" + $B.class_name(obj))\n }\n }else{\n // In the result, key must be a string\n var key = _b_.str.$factory(item[0])\n // Check circular reference\n if(check_circular && $B.repr.enter(item[1])){\n throw _b_.ValueError.$factory(\"Circular reference detected\")\n }\n res.push(\n [to_json(key, level, kwarg), to_json(item[1], level, kwarg)].\n join(key_separator))\n if(check_circular){\n $B.repr.leave(item[1])\n }\n }\n }\n return first + res.join(sep) + last\n }\n // For other types, use function default if provided\n if(_default == _b_.None){\n throw _b_.TypeError.$factory(\"Object of type \" + $B.class_name(obj) +\n \" is not JSON serializable\")\n }else{\n return to_json($B.$call(_default)(obj), level, kwarg)\n }\n}\n\nfunction loads(s){\n var args = []\n for(var i = 1, len = arguments.length; i < len; i++){\n args.push(arguments[i])\n }\n var decoder = JSONDecoder.$factory.apply(null, args)\n return JSONDecoder.decode(decoder, s)\n}\n\nfunction to_py(obj, kw){\n // Conversion to Python objects\n // kw are the keyword arguments to loads()\n var res\n if(obj instanceof List){\n return obj.items.map(x => to_py(x, kw))\n }else if(obj instanceof Dict){\n if(kw.object_pairs_hook !== _b_.None){\n var pairs = []\n for(var i = 0, len = obj.keys.length; i < len; i++){\n pairs.push($B.fast_tuple([obj.keys[i],\n to_py(obj.values[i], kw)]))\n }\n return $B.$call(kw.object_pairs_hook)(pairs)\n }else{\n var dict = $B.empty_dict()\n for(var i = 0, len = obj.keys.length; i < len; i++){\n _b_.dict.$setitem(dict, obj.keys[i], to_py(obj.values[i], kw))\n }\n return kw.object_hook === _b_.None ? dict :\n $B.$call(kw.object_hook)(dict)\n }\n }else if(obj.type == 'str'){\n return obj.value\n }else if(obj.type == 'num'){\n if(obj.value.search(/[.eE]/) > -1){\n // float\n if(kw.parse_float !== _b_.None){\n return $B.$call(kw.parse_float)(obj.value)\n }\n return $B.fast_float(obj.value)\n }else{\n // integer\n if(kw.parse_int !== _b_.None){\n return $B.$call(kw.parse_int)(obj.value)\n }\n var int = parseInt(obj.value)\n if(Math.abs(int) < $B.max_int){\n return int\n }else{\n return $B.fast_long_int(BigInt(obj.value))\n }\n }\n }else{\n if(obj instanceof Number && kw.parse_float !== _b_.None){\n return $B.$call(kw.parse_float)(obj)\n }else if(kw.parse_int !== _b_.None &&\n (typeof obj == 'number' || obj.__class__ === $B.long_int)){\n return $B.$call(kw.parse_int)(obj)\n }else if(kw.parse_constant !== _b_.None && ! isFinite(obj)){\n return kw.parse_constant(obj)\n }\n return obj\n }\n}\n\nvar escapes = {'n': '\\n',\n 't': '\\t',\n 'b': '\\b',\n 'r': '\\r',\n 'f': '\\f',\n '\\\\': '\\\\',\n '\"': '\\\"',\n \"'\": \"\\\\'\",\n '/': '/'\n }\n\nfunction string_at(s, i){\n var error = $B.$call($B.imported[\"json\"].JSONDecodeError)\n\n var j = i + 1,\n escaped = false,\n len = s.length,\n value = ''\n while(j < len){\n if(s[j] == '\"' && ! escaped){\n return [{type: 'str', value}, j + 1]\n }else if(! escaped && s[j] == '\\\\'){\n escaped = ! escaped\n j++\n }else if(escaped){\n var esc = escapes[s[j]]\n if(esc){\n value += esc\n j++\n escaped = false\n }else if(s[j] == 'u' &&\n s.substr(j + 1, 4).match(/[0-9a-fA-f]{4}/)){\n // unicode escape\n value += String.fromCharCode(parseInt(s.substr(j + 1, 4), 16))\n j += 5\n escaped = ! escaped\n }else{\n throw error('invalid escape \"' + s[j] + '\"', s, j)\n }\n }else{\n value += s[j]\n j++\n }\n }\n}\n\nfunction to_num(num_string, nb_dots, exp){\n // convert to correct Brython type\n if(exp || nb_dots){\n return new Number(num_string)\n }else{\n var int = parseInt(num_string)\n if(Math.abs(int) < $B.max_int){\n return int\n }else{\n if(num_string.startsWith('-')){\n return $B.fast_long_int(num_string.substr(1), false)\n }else{\n return $B.fast_long_int(num_string, true)\n }\n }\n }\n}\n\nfunction num_at(s, i){\n var res = s[i],\n j = i + 1,\n nb_dots = 0,\n exp = false,\n len = s.length\n while(j < len){\n if(s[j].match(/\\d/)){\n j++\n }else if(s[j] == '.' && nb_dots == 0){\n nb_dots++\n j++\n }else if('eE'.indexOf(s[j]) > -1 && ! exp){\n exp = ! exp\n j++\n }else{\n return [{type: 'num', value: s.substring(i, j)}, j]\n }\n }\n return [{type: 'num', value: s.substring(i, j)}, j]\n}\n\nfunction* tokenize(s){\n var i = 0,\n len = s.length,\n value,\n end\n while(i < len){\n if(s[i] == \" \" || s[i] == '\\r' || s[i] == '\\n' || s[i] == '\\t'){\n i++\n }else if('[]{}:,'.indexOf(s[i]) > -1){\n yield [s[i], i]\n i++\n }else if(s.substr(i, 4) == 'null'){\n yield [_b_.None , i]\n i += 4\n }else if(s.substr(i, 4) == 'true'){\n yield [true, i]\n i += 4\n }else if(s.substr(i, 5) == 'false'){\n yield [false, i]\n i += 5\n }else if(s.substr(i, 8) == 'Infinity'){\n yield [{type: 'num', value: 'Infinity'}, i]\n i += 8\n }else if(s.substr(i, 9) == '-Infinity'){\n yield [{type: 'num', value: '-Infinity'}, i]\n i += 9\n }else if(s.substr(i, 3) == 'NaN'){\n yield [{type: 'num', value: 'NaN'}, i]\n i += 3\n }else if(s[i] == '\"'){\n value = string_at(s, i)\n yield value\n i = value[1]\n }else if(s[i].match(/\\d/) || s[i] == '-'){\n value = num_at(s, i)\n yield value\n i = value[1]\n }else{\n throw Error('unexpected: ' + s[i] + s.charCodeAt(i))\n }\n }\n}\n\nfunction Node(parent){\n this.parent = parent\n if(parent instanceof List){\n this.list = parent.items\n }else if(parent instanceof Dict){\n this.list = parent.values\n }else if(parent === undefined){\n this.list = []\n }\n}\n\nNode.prototype.transition = function(token){\n if([true, false, _b_.None].indexOf(token) > -1 ||\n ['str', 'num'].indexOf(token.type) > -1){\n if(this.parent === undefined &&\n (this.list.length > 0 || this.content)){\n throw Error('Extra data')\n }\n this.list.push(token)\n return this.parent ? this.parent : this\n }else if(token == '{'){\n if(this.parent === undefined){\n this.content = new Dict(this)\n return this.content\n }\n return new Dict(this.parent)\n }else if(token == '['){\n if(this.parent === undefined){\n this.content = new List(this)\n return this.content\n }\n return new List(this.parent)\n }else{\n throw Error('unexpected item:' + token)\n }\n}\n\nfunction Dict(parent){\n this.parent = parent\n this.keys = []\n this.values = []\n this.expect = 'key'\n if(parent instanceof List){\n parent.items.push(this)\n }else if(parent instanceof Dict){\n parent.values.push(this)\n }\n}\n\nDict.prototype.transition = function(token){\n if(this.expect == 'key'){\n if(token.type == 'str'){\n this.keys.push(token.value)\n this.expect = ':'\n return this\n }else if(token == '}' && this.keys.length == 0){\n return this.parent\n }else{\n throw Error('expected str')\n }\n }else if(this.expect == ':'){\n if(token == ':'){\n this.expect = '}'\n return new Node(this)\n }else{\n throw Error('expected :')\n }\n }else if(this.expect == '}'){\n if(token == '}'){\n return this.parent\n }else if(token == ','){\n this.expect = 'key'\n return this\n }\n throw Error('expected }')\n }\n}\n\nfunction List(parent){\n if(parent instanceof List){\n parent.items.push(this)\n }\n this.parent = parent\n this.items = []\n this.expect = 'item'\n}\n\nList.prototype.transition = function(token){\n if(this.expect == 'item'){\n this.expect = ','\n if([true, false, _b_.None].indexOf(token) > -1){\n this.items.push(token)\n return this\n }else if(token.type == 'num' || token.type == 'str'){\n this.items.push(token)\n return this\n }else if(token == '{'){\n return new Dict(this)\n }else if(token == '['){\n return new List(this)\n }else if(token == ']'){\n if(this.items.length == 0){\n if(this.parent instanceof Dict){\n this.parent.values.push(this)\n }\n return this.parent\n }\n throw Error('unexpected ]')\n }else{\n console.log('token', token)\n throw Error('unexpected item:' + token)\n }\n\n }else if(this.expect == ','){\n this.expect = 'item'\n if(token == ','){\n return this\n }else if(token == ']'){\n if(this.parent instanceof Dict){\n this.parent.values.push(this)\n }\n return this.parent\n }else{\n throw Error('expected :')\n }\n }\n}\n\nfunction parse(s){\n var res,\n state,\n node = new Node(),\n root = node,\n token\n for(var item of tokenize(s)){\n token = item[0]\n try{\n node = node.transition(token)\n }catch(err){\n console.log('error, item', item)\n console.log(err, err.message)\n console.log('node', node)\n if(err.__class__){\n throw err\n }else{\n var error = $B.$call($B.imported[\"json\"].JSONDecodeError)\n throw error(err.message, s, item[1])\n }\n }\n }\n return root.content ? root.content : root.list[0]\n}\n\nvar JSONDecoder = $B.make_class(\"JSONDecoder\",\n function(){\n var $defaults = {cls: _b_.None, object_hook: _b_.None,\n parse_float: _b_.None, parse_int: _b_.None,\n parse_constant: _b_.None, object_pairs_hook: _b_.None},\n $ = $B.args(\"decode\", 0, {}, [], arguments, {}, null, \"kw\")\n var kw = $.kw.$jsobj\n for(var key in $defaults){\n if(kw[key] === undefined){\n kw[key] = $defaults[key]\n }\n }\n return {\n __class__: JSONDecoder,\n object_hook: kw.object_hook,\n parse_float: kw.parse_float,\n parse_int: kw.parse_int,\n parse_constant: kw.parse_constant,\n object_pairs_hook: kw.object_pairs_hook,\n memo: $B.empty_dict()\n }\n }\n)\n\nJSONDecoder.decode = function(self, s){\n return to_py(parse(s), self)\n}\n\nreturn {\n dumps: function(){\n return _b_.str.$factory(to_json.apply(null, arguments))\n },\n loads,\n JSONDecoder\n}\n\n})(__BRYTHON__)"], "_jsre": [".js", "var $module = (function($B){\n\n var _b_ = $B.builtins\n\n var MatchObject = $B.make_class(\"Match\",\n function(jsmatch, string, pattern){\n return {\n __class__: MatchObject,\n jsmatch: jsmatch,\n string: string\n }\n }\n )\n MatchObject.item = function(self, rank){\n return self.jsmatch[rank]\n }\n MatchObject.group = function(self){\n var res = []\n for(var i = 0, _len_i = arguments.length; i < _len_i; i++){\n if(self.jsmatch[arguments[i]] === undefined){res.push(_b_.None)}\n else{res.push(self.jsmatch[arguments[i]])}\n }\n if(arguments.length == 1){return res[0]}\n return _b_.tuple.$factory(res)\n }\n MatchObject.groups = function(self, _default){\n if(_default === undefined){_default = _b_.None}\n var res = []\n for(var i = 1, _len_i = self.length; i < _len_i; i++){\n if(self.jsmatch[i] === undefined){res.push(_default)}\n else{res.push(self.jsmatch[i])}\n }\n return _b_.tuple.$factory(res)\n }\n MatchObject.start = function(self){\n return self.index\n }\n MatchObject.end = function(self){\n return self.length - self.index\n }\n\n $B.set_func_names(MatchObject, '_jsre')\n\n var obj = {__class__: $module,\n __str__: function(){return \"\"}\n }\n obj.A = obj.ASCII = 256\n obj.I = obj.IGNORECASE = 2 // 'i'\n obj.L = obj.LOCALE = 4\n obj.M = obj.MULTILINE = 8 // 'm'\n obj.S = obj.DOTALL = 16\n obj.U = obj.UNICODE = 32\n obj.X = obj.VERBOSE = 64\n obj._is_valid = function(pattern) {\n if ($B.$options.re == 'pyre'){return false} //force use of python's re module\n if ($B.$options.re == 'jsre'){return true} //force use of brythons re module\n // FIXME: Improve\n\n if(! $B.$isinstance(pattern, _b_.str)){\n // this is probably a SRE_PATTERN, so return false, and let\n // python's re module handle this.\n return false\n }\n var is_valid = false\n try{\n new RegExp(pattern)\n is_valid = true\n }\n catch(e){}\n if(! is_valid){return false} //if js won't parse the pattern return false\n\n // using reference http://www.regular-expressions.info/\n // to compare python re and javascript regex libraries\n\n // look for things javascript does not support\n // check for name capturing group\n var mylist = ['?P=', '?P<', '(?#', '(?<=', '(? -1) return false\n }\n\n var re_list=['\\{,\\d+\\}']\n for(var i=0, _len_i = re_list.length; i < _len_i; i++) {\n var _re = new RegExp(re_list[i])\n if (_re.test(pattern)){return false}\n }\n\n // it looks like the pattern has passed all our tests so lets assume\n // javascript can handle this pattern.\n return true\n }\n var $SRE_PatternDict = {\n __class__:_b_.type,\n $infos:{\n __name__:'SRE_Pattern'\n }\n }\n $SRE_PatternDict.__mro__ = [_b_.object]\n $SRE_PatternDict.findall = function(self, string){\n return obj.findall(self.pattern, string, self.flags)\n }\n $SRE_PatternDict.finditer = function(self, string){\n return obj.finditer(self.pattern, string, self.flags)\n }\n $SRE_PatternDict.match = function(self, string){\n return obj.match(self.pattern, string, self.flags)\n }\n $SRE_PatternDict.search = function(self, string){\n return obj.search(self.pattern, string, self.flags)\n }\n $SRE_PatternDict.sub = function(self,repl,string){\n return obj.sub(self.pattern,repl,string,self.flags)\n }\n $B.set_func_names($SRE_PatternDict, \"_jsre\")\n // TODO: groups\n // TODO: groupindex\n function normflags(flags){\n return ((flags & obj.I)? 'i' : '') + ((flags & obj.M)? 'm' : '');\n }\n // TODO: fullmatch()\n // TODO: split()\n // TODO: subn()\n obj.compile = function(pattern, flags){\n return {\n __class__: $SRE_PatternDict,\n pattern: pattern,\n flags: normflags(flags)\n }\n }\n obj.escape = function(string){\n // Escape all the characters in pattern except ASCII letters, numbers\n // and '_'. This is useful if you want to match an arbitrary literal\n // string that may have regular expression metacharacters in it.\n var res = ''\n var ok = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'\n for(var i = 0, _len_i = string.length; i < _len_i; i++){\n if(ok.search(string.charAt(i))>-1){res += string.charAt(i)}\n }\n return res\n }\n obj.findall = function(pattern, string, flags){\n var $ns=$B.args('re.findall', 2,\n {pattern:null, string:null}, ['pattern', 'string'],\n arguments,{}, 'args', 'kw') ,\n args = $ns['args'] ,\n _flags = 0;\n if(args.length>0){var flags = args[0]}\n else{var _flags = $B.$getattr($ns['kw'], 'get')('flags', 0)}\n\n var flags = normflags()\n flags += 'gm'\n var jsp = new RegExp(pattern,flags),\n jsmatch = string.match(jsp)\n if(jsmatch === null){return []}\n return jsmatch\n }\n obj.finditer = function(pattern, string, flags){\n var $ns=$B.args('re.finditer', 2,\n {pattern:null, string:null}, ['pattern', 'string'],\n arguments,{},'args','kw'),\n args = $ns['args'],\n _flags = 0;\n if(args.length>0){var flags=args[0]}\n else{var _flags = $B.$getattr($ns['kw'], 'get')('flags', 0)}\n\n var flags = normflags()\n flags += 'gm'\n var jsp = new RegExp(pattern, flags),\n jsmatch = string.match(jsp);\n if(jsmatch === null){return []}\n\n var _list = []\n for(var j = 0, _len_j = jsmatch.length; j < _len_j; j++) {\n var mo = {}\n mo._match=jsmatch[j]\n mo.group = function(){\n var res = []\n for(var i=0, _len_i = arguments.length; i < _len_i;i++){\n if(jsmatch[arguments[i]] === undefined){res.push(_b_.None)}\n else{res.push(jsmatch[arguments[i]])}\n }\n if(arguments.length == 1){return res[0]}\n return _b_.tuple.$factory(res)\n }\n mo.groups = function(_default){\n if(_default === undefined){_default = _b_.None}\n var res = []\n for(var i = 1, _len_i = jsmatch.length; i < _len_i; i++){\n if(jsmatch[i] === undefined){res.push(_default)}\n else{res.push(jsmatch[i])}\n }\n return _b_.tuple.$factory(res)\n }\n mo.start = function(){return mo._match.index}\n mo.end = function(){return mo._match.length - mo._match.index}\n mo.string = string\n _list.push(mo)\n }\n return _list\n }\n obj.search = function(pattern, string){\n var $ns = $B.args('re.search', 2,\n {pattern:null, string:null},['pattern', 'string'],\n arguments, {}, 'args', 'kw')\n var args = $ns['args']\n if(args.length>0){var flags = args[0]}\n else{var flags = $B.$getattr($ns['kw'], 'get')('flags', '')}\n flags = normflags(flags)\n var jsp = new RegExp(pattern, flags)\n var jsmatch = string.match(jsp)\n if(jsmatch === null){return _b_.None}\n return MatchObject.$factory(jsmatch, string, pattern)\n }\n obj.sub = function(pattern, repl, string){\n var $ns=$B.args('re.search', 3,\n {pattern: null, repl: null, string: null},\n ['pattern', 'repl', 'string'],\n arguments,{}, 'args', 'kw')\n for($var in $ns){eval(\"var \" + $var + \"=$ns[$var]\")}\n var args = $ns['args']\n var count = _b_.dict.get($ns['kw'], 'count', 0)\n var flags = _b_.dict.get($ns['kw'], 'flags', '')\n if(args.length > 0){var count = args[0]}\n if(args.length > 1){var flags = args[1]}\n flags = normflags(flags)\n if(typeof repl == \"string\"){\n // backreferences are \\1, \\2... in Python but $1,$2... in Javascript\n repl = repl.replace(/\\\\(\\d+)/g, '$$$1')\n }else if(typeof repl == \"function\"){\n // the argument passed to the Python function is the match object\n // the arguments passed to the Javascript function are :\n // - the matched substring\n // - the matched groups\n // - the offset of the matched substring inside the string\n // - the string being examined\n var $repl1 = function(){\n var mo = Object()\n mo.string = arguments[arguments.length - 1]\n var matched = arguments[0];\n var start = arguments[arguments.length - 2]\n var end = start + matched.length\n mo.start = function(){return start}\n mo.end = function(){return end}\n groups = []\n for(var i = 1, _len_i = arguments.length-2; i < _len_i; i++){\n groups.push(arguments[i])\n }\n mo.groups = function(_default){\n if(_default === undefined){_default = _b_.None}\n var res = []\n for(var i = 0, _len_i = groups.length; i < _len_i; i++){\n if(groups[i] === undefined){res.push(_default)}\n else{res.push(groups[i])}\n }\n return res\n }\n mo.group = function(i){\n if(i==0){return matched}\n return groups[i-1]\n }\n return repl(mo)\n }\n }\n if(count == 0){flags += 'g'}\n var jsp = new RegExp(pattern, flags)\n if(typeof repl == 'function'){return string.replace(jsp, $repl1)}\n else{return string.replace(jsp, repl)}\n }\n obj.match = (function(search_func){\n return function(){\n // match is like search but pattern must start with ^\n var pattern = arguments[0]\n if(pattern.charAt(0) != '^'){pattern = '^'+pattern}\n var args = [pattern]\n for(var i = 1, _len_i = arguments.length; i < _len_i; i++){\n args.push(arguments[i])\n }\n return search_func.apply(null, args)\n }\n })(obj.search)\n\n return obj\n}\n)(__BRYTHON__)\n"], "_locale": [".js", "var am = {\n \"C\": \"AM\",\n \"aa\": \"saaku\",\n \"ab\": \"AM\",\n \"ae\": \"AM\",\n \"af\": \"vm.\",\n \"ak\": \"AN\",\n \"am\": \"\\u1325\\u12cb\\u1275\",\n \"an\": \"AM\",\n \"ar\": \"\\u0635\",\n \"as\": \"\\u09f0\\u09be\\u09a4\\u09bf\\u09aa\\u09c1\",\n \"av\": \"AM\",\n \"ay\": \"AM\",\n \"az\": \"AM\",\n \"ba\": \"\",\n \"be\": \"\",\n \"bg\": \"\",\n \"bh\": \"AM\",\n \"bi\": \"AM\",\n \"bm\": \"AM\",\n \"bn\": \"AM\",\n \"bo\": \"\\u0f66\\u0f94\\u0f0b\\u0f51\\u0fb2\\u0f7c\",\n \"br\": \"A.M.\",\n \"bs\": \"prijepodne\",\n \"ca\": \"a. m.\",\n \"ce\": \"AM\",\n \"ch\": \"AM\",\n \"co\": \"\",\n \"cr\": \"AM\",\n \"cs\": \"dop.\",\n \"cu\": \"\\u0414\\u041f\",\n \"cv\": \"AM\",\n \"cy\": \"yb\",\n \"da\": \"\",\n \"de\": \"\",\n \"dv\": \"\\u0789\\u0786\",\n \"dz\": \"\\u0f66\\u0f94\\u0f0b\\u0f46\\u0f0b\",\n \"ee\": \"\\u014bdi\",\n \"el\": \"\\u03c0\\u03bc\",\n \"en\": \"AM\",\n \"eo\": \"atm\",\n \"es\": \"\",\n \"et\": \"AM\",\n \"eu\": \"AM\",\n \"fa\": \"\\u0642.\\u0638\",\n \"ff\": \"\",\n \"fi\": \"ap.\",\n \"fj\": \"AM\",\n \"fo\": \"um fyr.\",\n \"fr\": \"\",\n \"fy\": \"AM\",\n \"ga\": \"r.n.\",\n \"gd\": \"m\",\n \"gl\": \"a.m.\",\n \"gn\": \"a.m.\",\n \"gu\": \"\\u0aaa\\u0ac2\\u0ab0\\u0acd\\u0ab5\\u00a0\\u0aae\\u0aa7\\u0acd\\u0aaf\\u0abe\\u0ab9\\u0acd\\u0aa8\",\n \"gv\": \"a.m.\",\n \"ha\": \"AM\",\n \"he\": \"AM\",\n \"hi\": \"\\u092a\\u0942\\u0930\\u094d\\u0935\\u093e\\u0939\\u094d\\u0928\",\n \"ho\": \"AM\",\n \"hr\": \"\",\n \"ht\": \"AM\",\n \"hu\": \"de.\",\n \"hy\": \"\",\n \"hz\": \"AM\",\n \"ia\": \"a.m.\",\n \"id\": \"AM\",\n \"ie\": \"AM\",\n \"ig\": \"A.M.\",\n \"ii\": \"\\ua0b5\\ua1aa\\ua20c\\ua210\",\n \"ik\": \"AM\",\n \"io\": \"AM\",\n \"is\": \"f.h.\",\n \"it\": \"\",\n \"iu\": \"AM\",\n \"ja\": \"\\u5348\\u524d\",\n \"jv\": \"\",\n \"ka\": \"AM\",\n \"kg\": \"AM\",\n \"ki\": \"Kiroko\",\n \"kj\": \"AM\",\n \"kk\": \"AM\",\n \"kl\": \"\",\n \"km\": \"\\u1796\\u17d2\\u179a\\u17b9\\u1780\",\n \"kn\": \"\\u0caa\\u0cc2\\u0cb0\\u0ccd\\u0cb5\\u0cbe\\u0cb9\\u0ccd\\u0ca8\",\n \"ko\": \"\\uc624\\uc804\",\n \"kr\": \"AM\",\n \"ks\": \"AM\",\n \"ku\": \"\\u067e.\\u0646\",\n \"kv\": \"AM\",\n \"kw\": \"a.m.\",\n \"ky\": \"\",\n \"la\": \"\",\n \"lb\": \"\",\n \"lg\": \"AM\",\n \"li\": \"AM\",\n \"ln\": \"nt\\u0254\\u0301ng\\u0254\\u0301\",\n \"lo\": \"\\u0e81\\u0ec8\\u0ead\\u0e99\\u0e97\\u0ec8\\u0ebd\\u0e87\",\n \"lt\": \"prie\\u0161piet\",\n \"lu\": \"Dinda\",\n \"lv\": \"priek\\u0161p.\",\n \"mg\": \"AM\",\n \"mh\": \"AM\",\n \"mi\": \"a.m.\",\n \"mk\": \"\\u043f\\u0440\\u0435\\u0442\\u043f\\u043b.\",\n \"ml\": \"AM\",\n \"mn\": \"??\",\n \"mo\": \"AM\",\n \"mr\": \"\\u092e.\\u092a\\u0942.\",\n \"ms\": \"PG\",\n \"mt\": \"AM\",\n \"my\": \"\\u1014\\u1036\\u1014\\u1000\\u103a\",\n \"na\": \"AM\",\n \"nb\": \"a.m.\",\n \"nd\": \"AM\",\n \"ne\": \"\\u092a\\u0942\\u0930\\u094d\\u0935\\u093e\\u0939\\u094d\\u0928\",\n \"ng\": \"AM\",\n \"nl\": \"\",\n \"nn\": \"f.m.\",\n \"no\": \"a.m.\",\n \"nr\": \"AM\",\n \"nv\": \"AM\",\n \"ny\": \"AM\",\n \"oc\": \"AM\",\n \"oj\": \"AM\",\n \"om\": \"WD\",\n \"or\": \"AM\",\n \"os\": \"AM\",\n \"pa\": \"\\u0a38\\u0a35\\u0a47\\u0a30\",\n \"pi\": \"AM\",\n \"pl\": \"AM\",\n \"ps\": \"\\u063a.\\u0645.\",\n \"pt\": \"\",\n \"qu\": \"a.m.\",\n \"rc\": \"AM\",\n \"rm\": \"AM\",\n \"rn\": \"Z.MU.\",\n \"ro\": \"a.m.\",\n \"ru\": \"\",\n \"rw\": \"AM\",\n \"sa\": \"\\u092e\\u0927\\u094d\\u092f\\u093e\\u0928\\u092a\\u0942\\u0930\\u094d\\u0935\",\n \"sc\": \"AM\",\n \"sd\": \"AM\",\n \"se\": \"i.b.\",\n \"sg\": \"ND\",\n \"sh\": \"AM\",\n \"si\": \"\\u0db4\\u0dd9.\\u0dc0.\",\n \"sk\": \"AM\",\n \"sl\": \"dop.\",\n \"sm\": \"AM\",\n \"sn\": \"AM\",\n \"so\": \"sn.\",\n \"sq\": \"e paradites\",\n \"sr\": \"pre podne\",\n \"ss\": \"AM\",\n \"st\": \"AM\",\n \"su\": \"AM\",\n \"sv\": \"\",\n \"sw\": \"AM\",\n \"ta\": \"\\u0b95\\u0bbe\\u0bb2\\u0bc8\",\n \"te\": \"\\u0c2a\\u0c42\\u0c30\\u0c4d\\u0c35\\u0c3e\\u0c39\\u0c4d\\u0c28\",\n \"tg\": \"\",\n \"th\": \"AM\",\n \"ti\": \"\\u1295\\u1309\\u1206 \\u1230\\u12d3\\u1270\",\n \"tk\": \"\",\n \"tl\": \"AM\",\n \"tn\": \"AM\",\n \"to\": \"AM\",\n \"tr\": \"\\u00d6\\u00d6\",\n \"ts\": \"AM\",\n \"tt\": \"\",\n \"tw\": \"AM\",\n \"ty\": \"AM\",\n \"ug\": \"\\u0686?\\u0634\\u062a\\u0649\\u0646 \\u0628?\\u0631?\\u0646\",\n \"uk\": \"AM\",\n \"ur\": \"AM\",\n \"uz\": \"TO\",\n \"ve\": \"AM\",\n \"vi\": \"SA\",\n \"vo\": \"AM\",\n \"wa\": \"AM\",\n \"wo\": \"\",\n \"xh\": \"AM\",\n \"yi\": \"\\ua0b5\\ua1aa\\ua20c\\ua210\",\n \"yo\": \"\\u00c0\\u00e1r?`\",\n \"za\": \"AM\",\n \"zh\": \"\\u4e0a\\u5348\",\n \"zu\": \"AM\"\n}\nvar pm = {\n \"C\": \"PM\",\n \"aa\": \"carra\",\n \"ab\": \"PM\",\n \"ae\": \"PM\",\n \"af\": \"nm.\",\n \"ak\": \"EW\",\n \"am\": \"\\u12a8\\u1230\\u12d3\\u1275\",\n \"an\": \"PM\",\n \"ar\": \"\\u0645\",\n \"as\": \"\\u0986\\u09ac\\u09c7\\u09b2\\u09bf\",\n \"av\": \"PM\",\n \"ay\": \"PM\",\n \"az\": \"PM\",\n \"ba\": \"\",\n \"be\": \"\",\n \"bg\": \"\",\n \"bh\": \"PM\",\n \"bi\": \"PM\",\n \"bm\": \"PM\",\n \"bn\": \"PM\",\n \"bo\": \"\\u0f55\\u0fb1\\u0f72\\u0f0b\\u0f51\\u0fb2\\u0f7c\",\n \"br\": \"G.M.\",\n \"bs\": \"popodne\",\n \"ca\": \"p. m.\",\n \"ce\": \"PM\",\n \"ch\": \"PM\",\n \"co\": \"\",\n \"cr\": \"PM\",\n \"cs\": \"odp.\",\n \"cu\": \"\\u041f\\u041f\",\n \"cv\": \"PM\",\n \"cy\": \"yh\",\n \"da\": \"\",\n \"de\": \"\",\n \"dv\": \"\\u0789\\u078a\",\n \"dz\": \"\\u0f55\\u0fb1\\u0f72\\u0f0b\\u0f46\\u0f0b\",\n \"ee\": \"\\u0263etr\\u0254\",\n \"el\": \"\\u03bc\\u03bc\",\n \"en\": \"PM\",\n \"eo\": \"ptm\",\n \"es\": \"\",\n \"et\": \"PM\",\n \"eu\": \"PM\",\n \"fa\": \"\\u0628.\\u0638\",\n \"ff\": \"\",\n \"fi\": \"ip.\",\n \"fj\": \"PM\",\n \"fo\": \"um sein.\",\n \"fr\": \"\",\n \"fy\": \"PM\",\n \"ga\": \"i.n.\",\n \"gd\": \"f\",\n \"gl\": \"p.m.\",\n \"gn\": \"p.m.\",\n \"gu\": \"\\u0a89\\u0aa4\\u0acd\\u0aa4\\u0ab0\\u00a0\\u0aae\\u0aa7\\u0acd\\u0aaf\\u0abe\\u0ab9\\u0acd\\u0aa8\",\n \"gv\": \"p.m.\",\n \"ha\": \"PM\",\n \"he\": \"PM\",\n \"hi\": \"\\u0905\\u092a\\u0930\\u093e\\u0939\\u094d\\u0928\",\n \"ho\": \"PM\",\n \"hr\": \"\",\n \"ht\": \"PM\",\n \"hu\": \"du.\",\n \"hy\": \"\",\n \"hz\": \"PM\",\n \"ia\": \"p.m.\",\n \"id\": \"PM\",\n \"ie\": \"PM\",\n \"ig\": \"P.M.\",\n \"ii\": \"\\ua0b5\\ua1aa\\ua20c\\ua248\",\n \"ik\": \"PM\",\n \"io\": \"PM\",\n \"is\": \"e.h.\",\n \"it\": \"\",\n \"iu\": \"PM\",\n \"ja\": \"\\u5348\\u5f8c\",\n \"jv\": \"\",\n \"ka\": \"PM\",\n \"kg\": \"PM\",\n \"ki\": \"Hwa\\u0129-in\\u0129\",\n \"kj\": \"PM\",\n \"kk\": \"PM\",\n \"kl\": \"\",\n \"km\": \"\\u179b\\u17d2\\u1784\\u17b6\\u1785\",\n \"kn\": \"\\u0c85\\u0caa\\u0cb0\\u0cbe\\u0cb9\\u0ccd\\u0ca8\",\n \"ko\": \"\\uc624\\ud6c4\",\n \"kr\": \"PM\",\n \"ks\": \"PM\",\n \"ku\": \"\\u062f.\\u0646\",\n \"kv\": \"PM\",\n \"kw\": \"p.m.\",\n \"ky\": \"\",\n \"la\": \"\",\n \"lb\": \"\",\n \"lg\": \"PM\",\n \"li\": \"PM\",\n \"ln\": \"mp\\u00f3kwa\",\n \"lo\": \"\\u0eab\\u0ebc\\u0eb1\\u0e87\\u0e97\\u0ec8\\u0ebd\\u0e87\",\n \"lt\": \"popiet\",\n \"lu\": \"Dilolo\",\n \"lv\": \"p\\u0113cp.\",\n \"mg\": \"PM\",\n \"mh\": \"PM\",\n \"mi\": \"p.m.\",\n \"mk\": \"\\u043f\\u043e\\u043f\\u043b.\",\n \"ml\": \"PM\",\n \"mn\": \"?\\u0425\",\n \"mo\": \"PM\",\n \"mr\": \"\\u092e.\\u0928\\u0902.\",\n \"ms\": \"PTG\",\n \"mt\": \"PM\",\n \"my\": \"\\u100a\\u1014\\u1031\",\n \"na\": \"PM\",\n \"nb\": \"p.m.\",\n \"nd\": \"PM\",\n \"ne\": \"\\u0905\\u092a\\u0930\\u093e\\u0939\\u094d\\u0928\",\n \"ng\": \"PM\",\n \"nl\": \"\",\n \"nn\": \"e.m.\",\n \"no\": \"p.m.\",\n \"nr\": \"PM\",\n \"nv\": \"PM\",\n \"ny\": \"PM\",\n \"oc\": \"PM\",\n \"oj\": \"PM\",\n \"om\": \"WB\",\n \"or\": \"PM\",\n \"os\": \"PM\",\n \"pa\": \"\\u0a36\\u0a3e\\u0a2e\",\n \"pi\": \"PM\",\n \"pl\": \"PM\",\n \"ps\": \"\\u063a.\\u0648.\",\n \"pt\": \"\",\n \"qu\": \"p.m.\",\n \"rc\": \"PM\",\n \"rm\": \"PM\",\n \"rn\": \"Z.MW.\",\n \"ro\": \"p.m.\",\n \"ru\": \"\",\n \"rw\": \"PM\",\n \"sa\": \"\\u092e\\u0927\\u094d\\u092f\\u093e\\u0928\\u092a\\u091a\\u094d\\u092f\\u093e\\u0924\",\n \"sc\": \"PM\",\n \"sd\": \"PM\",\n \"se\": \"e.b.\",\n \"sg\": \"LK\",\n \"sh\": \"PM\",\n \"si\": \"\\u0db4.\\u0dc0.\",\n \"sk\": \"PM\",\n \"sl\": \"pop.\",\n \"sm\": \"PM\",\n \"sn\": \"PM\",\n \"so\": \"gn.\",\n \"sq\": \"e pasdites\",\n \"sr\": \"po podne\",\n \"ss\": \"PM\",\n \"st\": \"PM\",\n \"su\": \"PM\",\n \"sv\": \"\",\n \"sw\": \"PM\",\n \"ta\": \"\\u0bae\\u0bbe\\u0bb2\\u0bc8\",\n \"te\": \"\\u0c05\\u0c2a\\u0c30\\u0c3e\\u0c39\\u0c4d\\u0c28\",\n \"tg\": \"\",\n \"th\": \"PM\",\n \"ti\": \"\\u12f5\\u1215\\u122d \\u1230\\u12d3\\u1275\",\n \"tk\": \"\",\n \"tl\": \"PM\",\n \"tn\": \"PM\",\n \"to\": \"PM\",\n \"tr\": \"\\u00d6S\",\n \"ts\": \"PM\",\n \"tt\": \"\",\n \"tw\": \"PM\",\n \"ty\": \"PM\",\n \"ug\": \"\\u0686?\\u0634\\u062a\\u0649\\u0646 \\u0643?\\u064a\\u0649\\u0646\",\n \"uk\": \"PM\",\n \"ur\": \"PM\",\n \"uz\": \"TK\",\n \"ve\": \"PM\",\n \"vi\": \"CH\",\n \"vo\": \"PM\",\n \"wa\": \"PM\",\n \"wo\": \"\",\n \"xh\": \"PM\",\n \"yi\": \"\\ua0b5\\ua1aa\\ua20c\\ua248\",\n \"yo\": \"?`s\\u00e1n\",\n \"za\": \"PM\",\n \"zh\": \"\\u4e0b\\u5348\",\n \"zu\": \"PM\"\n}\n\nvar X_format = {\n \"%H:%M:%S\": [\n \"C\",\n \"ab\",\n \"ae\",\n \"af\",\n \"an\",\n \"av\",\n \"ay\",\n \"az\",\n \"ba\",\n \"be\",\n \"bg\",\n \"bh\",\n \"bi\",\n \"bm\",\n \"bo\",\n \"br\",\n \"bs\",\n \"ca\",\n \"ce\",\n \"ch\",\n \"co\",\n \"cr\",\n \"cs\",\n \"cu\",\n \"cv\",\n \"cy\",\n \"da\",\n \"de\",\n \"dv\",\n \"eo\",\n \"es\",\n \"et\",\n \"eu\",\n \"ff\",\n \"fj\",\n \"fo\",\n \"fr\",\n \"fy\",\n \"ga\",\n \"gd\",\n \"gl\",\n \"gn\",\n \"gu\",\n \"gv\",\n \"ha\",\n \"he\",\n \"hi\",\n \"ho\",\n \"hr\",\n \"ht\",\n \"hu\",\n \"hy\",\n \"hz\",\n \"ia\",\n \"ie\",\n \"ig\",\n \"ik\",\n \"io\",\n \"is\",\n \"it\",\n \"ja\",\n \"ka\",\n \"kg\",\n \"ki\",\n \"kj\",\n \"kk\",\n \"kl\",\n \"km\",\n \"kn\",\n \"kv\",\n \"kw\",\n \"ky\",\n \"la\",\n \"lb\",\n \"lg\",\n \"li\",\n \"ln\",\n \"lo\",\n \"lt\",\n \"lu\",\n \"lv\",\n \"mg\",\n \"mh\",\n \"mk\",\n \"mn\",\n \"mo\",\n \"mr\",\n \"mt\",\n \"my\",\n \"na\",\n \"nb\",\n \"nd\",\n \"ng\",\n \"nl\",\n \"nn\",\n \"no\",\n \"nr\",\n \"nv\",\n \"ny\",\n \"oj\",\n \"or\",\n \"os\",\n \"pi\",\n \"pl\",\n \"ps\",\n \"pt\",\n \"rc\",\n \"rm\",\n \"rn\",\n \"ro\",\n \"ru\",\n \"rw\",\n \"sa\",\n \"sc\",\n \"se\",\n \"sg\",\n \"sh\",\n \"sk\",\n \"sl\",\n \"sm\",\n \"sn\",\n \"sr\",\n \"ss\",\n \"st\",\n \"su\",\n \"sv\",\n \"sw\",\n \"ta\",\n \"te\",\n \"tg\",\n \"th\",\n \"tk\",\n \"tl\",\n \"tn\",\n \"tr\",\n \"ts\",\n \"tt\",\n \"tw\",\n \"ty\",\n \"ug\",\n \"uk\",\n \"uz\",\n \"ve\",\n \"vo\",\n \"wa\",\n \"wo\",\n \"xh\",\n \"yo\",\n \"za\",\n \"zh\",\n \"zu\"\n ],\n \"%i:%M:%S %p\": [\n \"aa\",\n \"ak\",\n \"am\",\n \"bn\",\n \"el\",\n \"en\",\n \"iu\",\n \"kr\",\n \"ks\",\n \"mi\",\n \"ml\",\n \"ms\",\n \"ne\",\n \"om\",\n \"sd\",\n \"so\",\n \"sq\",\n \"ti\",\n \"to\",\n \"ur\",\n \"vi\"\n ],\n \"%I:%M:%S %p\": [\n \"ar\",\n \"fa\",\n \"ku\",\n \"qu\"\n ],\n \"%p %i:%M:%S\": [\n \"as\",\n \"ii\",\n \"ko\",\n \"yi\"\n ],\n \"\\u0f46\\u0f74\\u0f0b\\u0f5a\\u0f7c\\u0f51\\u0f0b%i:%M:%S %p\": [\n \"dz\"\n ],\n \"%p ga %i:%M:%S\": [\n \"ee\"\n ],\n \"%H.%M.%S\": [\n \"fi\",\n \"id\",\n \"jv\",\n \"oc\",\n \"si\"\n ],\n \"%p %I:%M:%S\": [\n \"pa\"\n ]\n}\nvar x_format = {\n \"%m/%d/%y\": [\n \"C\"\n ],\n \"%d/%m/%Y\": [\n \"aa\",\n \"am\",\n \"bm\",\n \"bn\",\n \"ca\",\n \"co\",\n \"cy\",\n \"el\",\n \"es\",\n \"ff\",\n \"fr\",\n \"ga\",\n \"gd\",\n \"gl\",\n \"gn\",\n \"gv\",\n \"ha\",\n \"he\",\n \"id\",\n \"ig\",\n \"it\",\n \"iu\",\n \"jv\",\n \"ki\",\n \"kr\",\n \"kw\",\n \"la\",\n \"lg\",\n \"ln\",\n \"lo\",\n \"lu\",\n \"mi\",\n \"ml\",\n \"ms\",\n \"mt\",\n \"nd\",\n \"oc\",\n \"om\",\n \"pt\",\n \"qu\",\n \"rn\",\n \"sd\",\n \"sg\",\n \"so\",\n \"sw\",\n \"ti\",\n \"to\",\n \"uk\",\n \"ur\",\n \"uz\",\n \"vi\",\n \"wo\",\n \"yo\"\n ],\n \"%m/%d/%Y\": [\n \"ab\",\n \"ae\",\n \"an\",\n \"av\",\n \"ay\",\n \"bh\",\n \"bi\",\n \"ch\",\n \"cr\",\n \"cv\",\n \"ee\",\n \"en\",\n \"fj\",\n \"ho\",\n \"ht\",\n \"hz\",\n \"ie\",\n \"ik\",\n \"io\",\n \"kg\",\n \"kj\",\n \"ks\",\n \"kv\",\n \"li\",\n \"mh\",\n \"mo\",\n \"na\",\n \"ne\",\n \"ng\",\n \"nv\",\n \"ny\",\n \"oj\",\n \"pi\",\n \"rc\",\n \"sc\",\n \"sh\",\n \"sm\",\n \"su\",\n \"tl\",\n \"tw\",\n \"ty\",\n \"wa\",\n \"za\",\n \"zu\"\n ],\n \"%Y-%m-%d\": [\n \"af\",\n \"br\",\n \"ce\",\n \"dz\",\n \"eo\",\n \"ko\",\n \"lt\",\n \"mg\",\n \"nr\",\n \"rw\",\n \"se\",\n \"si\",\n \"sn\",\n \"ss\",\n \"st\",\n \"sv\",\n \"tn\",\n \"ts\",\n \"ug\",\n \"ve\",\n \"vo\",\n \"xh\"\n ],\n \"%Y/%m/%d\": [\n \"ak\",\n \"bo\",\n \"eu\",\n \"ia\",\n \"ii\",\n \"ja\",\n \"ku\",\n \"yi\",\n \"zh\"\n ],\n \"null\": [\n \"ar\",\n \"fa\",\n \"ps\",\n \"th\"\n ],\n \"%d-%m-%Y\": [\n \"as\",\n \"da\",\n \"fy\",\n \"hi\",\n \"kl\",\n \"mr\",\n \"my\",\n \"nl\",\n \"rm\",\n \"sa\",\n \"ta\"\n ],\n \"%d.%m.%Y\": [\n \"az\",\n \"cs\",\n \"de\",\n \"et\",\n \"fi\",\n \"fo\",\n \"hy\",\n \"is\",\n \"ka\",\n \"kk\",\n \"lv\",\n \"mk\",\n \"nb\",\n \"nn\",\n \"no\",\n \"os\",\n \"pl\",\n \"ro\",\n \"ru\",\n \"sq\",\n \"tg\",\n \"tr\",\n \"tt\"\n ],\n \"%d.%m.%y\": [\n \"ba\",\n \"be\",\n \"lb\"\n ],\n \"%d.%m.%Y \\u0433.\": [\n \"bg\"\n ],\n \"%d.%m.%Y.\": [\n \"bs\",\n \"hr\",\n \"sr\"\n ],\n \"%Y.%m.%d\": [\n \"cu\",\n \"mn\"\n ],\n \"%d/%m/%y\": [\n \"dv\",\n \"km\"\n ],\n \"%d-%m-%y\": [\n \"gu\",\n \"kn\",\n \"or\",\n \"pa\",\n \"te\"\n ],\n \"%Y. %m. %d.\": [\n \"hu\"\n ],\n \"%d-%b %y\": [\n \"ky\"\n ],\n \"%d. %m. %Y\": [\n \"sk\",\n \"sl\"\n ],\n \"%d.%m.%y \\u00fd.\": [\n \"tk\"\n ]\n}\n\n\nvar $module=(function($B){\n var _b_ = $B.builtins\n return {\n CHAR_MAX: 127,\n LC_ALL: 6,\n LC_COLLATE: 3,\n LC_CTYPE: 0,\n LC_MESSAGES: 5,\n LC_MONETARY: 4,\n LC_NUMERIC: 1,\n LC_TIME: 2,\n Error: _b_.ValueError,\n\n _date_format: function(spec, hour){\n var t,\n locale = __BRYTHON__.locale.substr(0, 2)\n\n if(spec == \"p\"){\n var res = hours < 12 ? am[locale] : pm[locale]\n if(res === undefined){\n throw _b_.ValueError.$factory(\"no format \" + spec + \" for locale \" +\n locale)\n }\n return res\n }\n else if(spec == \"x\"){\n t = x_format\n }else if(spec == \"X\"){\n t = X_format\n }else{\n throw _b_.ValueError.$factory(\"invalid format\", spec)\n }\n for(var key in t){\n if(t[key].indexOf(locale) > -1){\n return key\n }\n }\n throw _b_.ValueError.$factory(\"no format \" + spec + \" for locale \" +\n locale)\n },\n\n localeconv: function(){\n var conv = {'grouping': [127],\n 'currency_symbol': '',\n 'n_sign_posn': 127,\n 'p_cs_precedes': 127,\n 'n_cs_precedes': 127,\n 'mon_grouping': [],\n 'n_sep_by_space': 127,\n 'decimal_point': '.',\n 'negative_sign': '',\n 'positive_sign': '',\n 'p_sep_by_space': 127,\n 'int_curr_symbol': '',\n 'p_sign_posn': 127,\n 'thousands_sep': '',\n 'mon_thousands_sep': '',\n 'frac_digits': 127,\n 'mon_decimal_point': '',\n 'int_frac_digits': 127\n }\n var res = $B.empty_dict()\n for(var key in conv){\n _b_.dict.$setitem(res, key, conv[key])\n }\n \n return res\n },\n\n setlocale : function(){\n var $ = $B.args(\"setlocale\", 2, {category: null, locale: null},\n [\"category\", \"locale\"], arguments, {locale: _b_.None},\n null, null)\n /// XXX category is currently ignored\n if($.locale == \"\"){\n // use browser language setting, if it is set\n var LANG = ($B.language || \"\").substr(0, 2)\n if(am.hasOwnProperty(LANG)){\n $B.locale = LANG\n return LANG\n }else{\n console.log(\"Unknown locale: \" + LANG)\n }\n }else if($.locale === _b_.None){\n // return current locale\n return $B.locale\n }else{\n // Only use 2 first characters\n try{$.locale.substr(0, 2)}\n catch(err){\n throw $module.Error.$factory(\"Invalid locale: \" + $.locale)\n }\n if(am.hasOwnProperty($.locale.substr(0, 2))){\n $B.locale = $.locale\n return $.locale\n }else{\n throw $module.Error.$factory(\"Unknown locale: \" + $.locale)\n }\n }\n }\n }\n})(__BRYTHON__)\n"], "_multiprocessing": [".js", "// multiprocessing\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\n\nvar Process = $B.make_class('Process')\n\nvar $convert_args=function(args) {\n var _list=[]\n for(var i=0, _len_i = args.length; i < _len_i; i++) {\n var _a=args[i]\n if($B.$isinstance(_a, _b_.str)){_list.push(\"'\"+_a+\"'\")} else {_list.push(_a)}\n }\n\n return _list.join(',')\n}\n\nProcess.is_alive = function(self){return self.$alive}\n\nProcess.join = function(self, timeout){\n // need to block until process is complete\n // could probably use a addEventListener to execute all existing code\n // after this join statement\n\n self.$worker.addEventListener('message', function (e) {\n var data=e.data\n if (data.stdout != '') { // output stdout from process\n $B.stdout.write(data.stdout)\n }\n }, false);\n}\n\nProcess.run = function(self){\n //fix me\n}\n\nProcess.start = function(self){\n self.$worker.postMessage({target: self.$target,\n args: $convert_args(self.$args),\n // kwargs: self.$kwargs\n })\n self.$worker.addEventListener('error', function(e) { throw e})\n self.$alive=true\n}\n\nProcess.terminate = function(self){\n self.$worker.terminate()\n self.$alive=false\n}\n\n// variables\n//name\n//daemon\n//pid\n//exitcode\n\nProcess. $factory = function(){\n //arguments group=None, target=None, name=None, args=(), kwargs=()\n\n var $ns=$B.args('Process',0,{},[],arguments,{},null,'kw')\n var kw=$ns['kw']\n\n var target=_b_.dict.get($ns['kw'],'target', _b_.None)\n var args=_b_.dict.get($ns['kw'],'args', _b_.tuple.$factory())\n\n var worker = new Worker('/src/web_workers/multiprocessing.js')\n\n var res = {\n __class__:Process,\n $worker: worker,\n name: $ns['name'] || _b_.None,\n $target: target+'',\n $args: args,\n //$kwargs: $ns['kw'],\n $alive: false\n }\n return res\n}\n\n$B.set_func_names(Process, \"multiprocessing\")\n\nvar Pool = $B.make_class(\"Pool\")\n\nPool.__enter__ = function(self){}\nPool.__exit__ = function(self){}\n\nPool.__str__ = Pool.toString = Pool.__repr__=function(self){\n return ''\n}\n\nPool.map = function(){\n\n var $ns=$B.args('Pool.map', 3,\n {self:null, func:null, fargs:null}, ['self', 'func', 'fargs'],\n arguments,{},'args','kw')\n var func = $ns['func']\n var fargs = $ns['fargs']\n\n var _results = []\n\n fargs = _b_.iter(fargs)\n\n var _pos = 0\n console.log(self.$processes)\n _workers =[]\n for(var i=0; i < self.$processes; i++) {\n _workers[i] = new Worker('/src/web_workers/multiprocessing.js')\n var arg\n\n try{arg = $B.$getattr(fargs, '__next__')()}\n catch(err) {\n if (err.__class__ !== _b_.StopIteration) throw err\n }\n console.log(arg)\n _workers[i].finished=false\n _workers[i].postMessage({target: func+'', pos: _pos,\n args: $convert_args([arg])})\n _pos++\n\n _workers[i].addEventListener('message', function(e) {\n _results[e.data.pos]=e.data.result\n if (_results.length == args.length) return _results\n\n try {\n arg = $B.$getattr(fargs, '__next__')()\n e.currentTarget.postMessage({target: func+'', pos: _pos,\n args: $convert_args([arg])})\n _pos++\n } catch(err) {\n if (err.__class__ !== _b_.StopIteration) throw err\n this.finished=true\n }\n }, false);\n }\n}\n\nPool.apply_async = function(){\n\n var $ns=$B.$MakeArgs('apply_async', 3,\n {self:null, func:null, fargs:null}, ['self', 'func', 'fargs'],\n arguments,{},'args','kw')\n var func = $ns['func']\n var fargs = $ns['fargs']\n\n fargs = _b_.iter(fargs)\n\n async_result = {}\n async_result.get = function(timeout){\n console.log(results)\n console.log(fargs)\n return this.results}\n async_result.results=[]\n\n var _pos=0\n\n _workers=[]\n for(var i=0; i < self.$processes; i++) {\n _workers[i] = new Worker('/src/web_workers/multiprocessing.js')\n var arg\n\n try{arg = $B.$getattr(fargs, '__next__')()}\n catch(err) {\n if (err.__class__ !== _b_.StopIteration) throw err\n }\n //console.log(arg)\n //_workers[i].finished=false\n _workers[i].postMessage({target: func+'', pos: _pos,\n args: $convert_args([arg])})\n _pos++\n\n _workers[i].addEventListener('message', function(e) {\n async_result.results[e.data.pos]=e.data.result\n //if (_results.length == args.length) return _results\n\n try {\n arg = $B.$getattr(fargs, '__next__')()\n e.currentTarget.postMessage({target: func+'', pos: _pos,\n args: $convert_args([arg])})\n _pos++\n } catch(err) {\n if (err.__class__ !== _b_.StopIteration) throw err\n this.finished=true\n }\n }, false);\n }\n\n console.log(\"return\", async_result)\n return async_result\n}\n\nPool.$factory = function(){\n console.log(\"pool\")\n console.log(arguments)\n var $ns=$B.args('Pool',1,\n {processes:null},['processes'],arguments,{},'args','kw')\n\n var processes = $ns['processes']\n\n if (processes === _b_.None) {\n // look to see if we have stored cpu_count in local storage\n // maybe we should create a brython config file with settings,etc..??\n\n // if not there use a tool such as Core Estimator to calculate number of cpu's\n // http://eligrey.com/blog/post/cpu-core-estimation-with-javascript\n }\n\n console.log(processes)\n var res = {\n __class__:Pool,\n $processes:processes\n }\n return res\n}\n\n$B.set_func_names(Pool, \"multiprocessing\")\n\nreturn {Process:Process, Pool:Pool}\n\n})(__BRYTHON__)\n"], "_posixsubprocess": [".js", "var $module=(function($B){\n\n return {\n cloexec_pipe: function() {}, // fixme\n fork_exec: function(){}\n }\n})(__BRYTHON__)\n"], "_profile": [".js", "// Private interface to the profiling instrumentation implemented in py_utils.js.\n// Uses local a copy of the eval function from py_builtin_functions.js\n\nvar $module=(function($B) {\n eval($B.InjectBuiltins());\n return {\n brython:$B,\n data:$B.$profile_data,\n start:$B.$profile.start,\n stop:$B.$profile.stop,\n pause:$B.$profile.pause,\n status:$B.$profile.status,\n clear:$B.$profile.clear,\n elapsed:$B.$profile.elapsed,\n run:function(src,_globals,_locals,nruns) {\n var current_frame = $B.frames_stack[$B.frames_stack.length-1]\n if(current_frame!==undefined){\n var current_locals_id = current_frame[0].replace(/\\./,'_'),\n current_globals_id = current_frame[2].replace(/\\./,'_')\n }\n\n var is_exec = true,\n leave = false\n\n // code will be run in a specific block\n var globals_id = '$profile_'+$B.UUID(),\n locals_id\n\n if(_locals===_globals){\n locals_id = globals_id\n }else{\n locals_id = '$profile_'+$B.UUID()\n }\n // Initialise the object for block namespaces\n eval('var $locals_'+globals_id+' = {}\\nvar $locals_'+locals_id+' = {}')\n\n // Initialise block globals\n\n // A _globals dictionary is provided, set or reuse its attribute\n // globals_id\n _globals.globals_id = _globals.globals_id || globals_id\n globals_id = _globals.globals_id\n\n if(_locals === _globals || _locals === undefined){\n locals_id = globals_id\n parent_scope = $B.builtins_scope\n }else{\n // The parent block of locals must be set to globals\n parent_scope = {\n id: globals_id,\n parent_block: $B.builtins_scope,\n binding: {}\n }\n for(var attr of _b_.dict.$keys_string(_globals)){\n parent_scope.binding[attr] = true\n }\n }\n\n // Initialise block globals\n if(_globals.$jsobj){\n var items = _globals.$jsobj\n }else{\n var items = {}\n for(var key of _b_.dict.$keys_string(_globals)){\n items[key] = _b_.dict.$getitem_string(_globals, key)\n }\n }\n for(var item in items){\n item1 = to_alias(item)\n try{\n eval('$locals_' + globals_id + '[\"' + item1 +\n '\"] = items[item]')\n }catch(err){\n console.log(err)\n console.log('error setting', item)\n break\n }\n }\n\n // Initialise block locals\n var items = _b_.dict.items(_locals), item\n if(_locals.$jsobj){\n var items = _locals.$jsobj\n }else{\n var items = {}\n for(var key of _b_.dict.$keys_string(_locals)){\n items[key] = _b_.dict.$getitem_string(_locals, key)\n } }\n for(var item in items){\n item1 = to_alias(item)\n try{\n eval('$locals_' + locals_id + '[\"' + item[0] + '\"] = item[1]')\n }catch(err){\n console.log(err)\n console.log('error setting', item)\n break\n }\n }\n //var nb_modules = Object.keys(__BRYTHON__.modules).length\n //console.log('before exec', nb_modules)\n\n console.log(\"call py2js\", src, globals_id, locals_id, parent_scope)\n var root = $B.py2js(src, globals_id, locals_id, parent_scope),\n js, gns, lns\n\n try{\n\n var js = root.to_js()\n\n var i,res,gns;\n for(i=0;i>> i) & 0x1){\n sum = addition32(sum, unsigned32(n2 << i))\n }\n }\n return sum\n }\n\n /* initializes mt[N] with a seed */\n //c//void init_genrand(unsigned long s)\n function init_genrand(s) {\n //c//mt[0]= s & 0xffffffff;\n mt[0] = unsigned32(s & 0xffffffff)\n for(mti = 1; mti < N; mti++){\n mt[mti] =\n //c//(1812433253 * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);\n addition32(multiplication32(1812433253,\n unsigned32(mt[mti - 1] ^ (mt[mti - 1] >>> 30))), mti)\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n //c//mt[mti] &= 0xffffffff;\n mt[mti] = unsigned32(mt[mti] & 0xffffffff);\n /* for >32 bit machines */\n }\n }\n\n /* initialize by an array with array-length */\n /* init_key is the array for initializing keys */\n /* key_length is its length */\n /* slight change for C++, 2004/2/26 */\n //c//void init_by_array(unsigned long init_key[], int key_length)\n function init_by_array(init_key, key_length) {\n //c//int i, j, k;\n var i, j, k\n init_genrand(19650218)\n i = 1\n j = 0\n k = (N > key_length ? N : key_length)\n for(; k; k--){\n //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525))\n //c// + init_key[j] + j; /* non linear */\n mt[i] = addition32(\n addition32(unsigned32(mt[i] ^\n multiplication32(unsigned32(mt[i - 1] ^ (mt[i - 1] >>> 30)),\n 1664525)),\n init_key[j]), j)\n mt[i] =\n //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */\n unsigned32(mt[i] & 0xffffffff)\n i++\n j++\n if(i >= N){mt[0] = mt[N - 1]; i = 1}\n if(j >= key_length){j = 0}\n }\n for(k = N - 1; k; k--){\n //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941))\n //c//- i; /* non linear */\n mt[i] = subtraction32(\n unsigned32(\n (mt[i]) ^\n multiplication32(\n unsigned32(mt[i - 1] ^ (mt[i - 1] >>> 30)),\n 1566083941)),\n i\n )\n //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */\n mt[i] = unsigned32(mt[i] & 0xffffffff)\n i++\n if(i >= N){mt[0] = mt[N - 1]; i = 1}\n }\n mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */\n }\n\n /* generates a random number on [0,0xffffffff]-interval */\n //c//unsigned long genrand_int32(void)\n function genrand_int32() {\n //c//unsigned long y;\n //c//static unsigned long mag01[2]={0x0UL, MATRIX_A};\n var y;\n var mag01 = [0x0, MATRIX_A];\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if(mti >= N){ /* generate N words at one time */\n //c//int kk;\n var kk\n\n if(mti == N + 1){ /* if init_genrand() has not been called, */\n init_genrand(Date.now()) /* a default initial seed is used */\n }\n\n for(kk = 0; kk < N - M; kk++){\n //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);\n //c//mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32((mt[kk]&UPPER_MASK) | (mt[kk + 1]&LOWER_MASK))\n mt[kk] = unsigned32(mt[kk + M] ^ (y >>> 1) ^ mag01[y & 0x1])\n }\n for(;kk < N - 1; kk++){\n //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);\n //c//mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32((mt[kk]&UPPER_MASK) | (mt[kk + 1]&LOWER_MASK))\n mt[kk] = unsigned32(mt[kk + (M - N)] ^ (y >>> 1) ^ mag01[y & 0x1])\n }\n //c//y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);\n //c//mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32((mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK))\n mt[N - 1] = unsigned32(mt[M - 1] ^ (y >>> 1) ^ mag01[y & 0x1])\n mti = 0\n }\n\n y = mt[mti++]\n\n /* Tempering */\n //c//y ^= (y >> 11);\n //c//y ^= (y << 7) & 0x9d2c5680;\n //c//y ^= (y << 15) & 0xefc60000;\n //c//y ^= (y >> 18);\n y = unsigned32(y ^ (y >>> 11))\n y = unsigned32(y ^ ((y << 7) & 0x9d2c5680))\n y = unsigned32(y ^ ((y << 15) & 0xefc60000))\n y = unsigned32(y ^ (y >>> 18))\n\n return y\n }\n\n /* generates a random number on [0,0x7fffffff]-interval */\n //c//long genrand_int31(void)\n function genrand_int31(){\n //c//return (genrand_int32()>>1);\n return (genrand_int32()>>>1)\n }\n\n /* generates a random number on [0,1]-real-interval */\n //c//double genrand_real1(void)\n function genrand_real1(){\n return genrand_int32()*(1.0/4294967295.0)\n /* divided by 2^32-1 */\n }\n\n /* generates a random number on [0,1)-real-interval */\n //c//double genrand_real2(void)\n function genrand_real2(){\n return genrand_int32() * (1.0 / 4294967296.0)\n /* divided by 2^32 */\n }\n\n /* generates a random number on (0,1)-real-interval */\n //c//double genrand_real3(void)\n function genrand_real3() {\n return ((genrand_int32()) + 0.5) * (1.0 / 4294967296.0)\n /* divided by 2^32 */\n }\n\n /* generates a random number on [0,1) with 53-bit resolution*/\n //c//double genrand_res53(void)\n function genrand_res53() {\n //c//unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;\n var a = genrand_int32() >>> 5,\n b = genrand_int32() >>> 6\n return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0)\n }\n /* These real versions are due to Isaku Wada, 2002/01/09 added */\n\n var random = genrand_res53\n\n random.seed = function(seed){\n if(seed === undefined || $B.is_none(seed)){\n const entries = new Uint32Array(N)\n crypto.getRandomValues(entries)\n init_by_array(Array.from(entries), N)\n return\n }\n\n if(!$B.$isinstance(seed, _b_.int)){\n seed = _b_.hash(seed)\n }\n\n // Transform to long integer\n if(typeof seed == \"number\"){\n seed = BigInt(seed)\n }else if(seed.__class__ === $B.long_int){\n seed = seed.value\n }else{\n return random.seed(seed.$brython_value)\n }\n\n // Take abs(seed)\n seed = seed > 0 ? seed : -seed\n\n var keys = []\n var int32_1 = 2n ** 32n - 1n\n\n // decomposition in factors of 2 ** 32\n while(seed >= int32_1){\n var quot = seed / int32_1,\n rest = seed % int32_1\n // Rest is a JS number (< 2 ** 32)\n keys.push(Number(rest))\n // Quotient is either a JS number or a instance of long_int\n // but seed must be long_int\n seed = quot\n }\n keys.push(Number(seed))\n\n init_by_array(keys, keys.length)\n }\n\n random.seed(seed)\n\n random.int31 = genrand_int31\n random.int32 = genrand_int32\n random.real1 = genrand_real1\n random.real2 = genrand_real2\n random.real3 = genrand_real3\n random.res53 = genrand_res53\n\n // Added for compatibility with Python\n random.getstate = function(){\n return $B.fast_tuple(mt.concat([mti]))\n }\n\n random.setstate = function(state){\n mt = state.slice(0, state.length - 1)\n mti = state[state.length - 1]\n }\n\n return random\n\n}\n\nvar Random = $B.make_class(\"Random\",\n function(){\n return {\n __class__: Random,\n _random: RandomStream(Date.now())\n }\n }\n)\n\nRandom.getrandbits = function(){\n var $ = $B.args(\"getrandbits\", 2, {self: null, k:null}, [\"self\", \"k\"],\n arguments, {}, null, null),\n self = $.self,\n k = $B.$GetInt($.k)\n\n if(k < 0)\n throw _b_.ValueError.$factory('number of bits must be non-negative')\n\n if(k === 0)\n return 0\n\n const words = Math.floor((k - 1) / 32) + 1\n const wordarray = new ArrayBuffer(words * 4)\n const wordarray_view = new DataView(wordarray)\n\n /* Fill-out bits of long integer, by 32-bit words, from least significant\n to most significant. */\n for(i = 0; i < words; i++, k -= 32){\n r = self._random.int32()\n if (k < 32)\n r >>>= (32 - k) /* Drop least significant bits */\n wordarray_view.setUint32(i * 4, r, true)\n }\n\n return _b_.int.from_bytes(_b_.bytes.$factory(Array.from(new Uint8Array(wordarray))), \"little\")\n}\n\nRandom.getstate = function(){\n var $ = $B.args('getstate', 1, {self: null},\n [\"self\"], arguments, {}, null, null),\n self = $.self\n return self._random.getstate()\n}\n\nRandom.random = function(){\n var $ = $B.args('random', 1, {self: null}, [\"self\"],\n arguments, {}, null, null),\n self = $.self\n return $B.fast_float(self._random())\n}\n\nRandom.seed = function(){\n var $ = $B.args('seed', 2, {self: null, n: null}, ['self', 'n'],\n arguments, {}, null, null),\n self = $.self,\n n = $.n\n\n if (self._random === undefined)\n self._random = RandomStream(n)\n else\n self._random.seed(n)\n}\n\nRandom.setstate = function(){\n var $ = $B.args('setstate', 2, {self: null, state:null}, ['self', 'state'],\n arguments, {}, null, null),\n self = $.self,\n state = $.state\n return self._random.setstate(state)\n}\n\n$B.set_func_names(Random, \"_random\")\n\nreturn { Random }\n\n})(__BRYTHON__)\n"], "_sre": [".py", "\n''\n\n\n\n\n\n\n\nMAXREPEAT=2147483648\nMAXGROUPS=2147483647\n\nimport array\nimport operator,sys\nfrom sre_constants import ATCODES,OPCODES,CHCODES\nfrom sre_constants import SRE_INFO_PREFIX,SRE_INFO_LITERAL\nfrom sre_constants import SRE_FLAG_UNICODE,SRE_FLAG_LOCALE\n\n\nfrom _sre_utils import (unicode_iscased,ascii_iscased,unicode_tolower,\nascii_tolower)\n\nimport sys\n\n\n\nMAGIC=20171005\n\n\n\n\n\n\n\n\n\n\n\n\n\nCODESIZE=4\n\ncopyright=\"_sre.py 2.4c Copyright 2005 by Nik Haldimann\"\n\n\ndef getcodesize():\n return CODESIZE\n \ndef compile(pattern,flags,code,groups=0,groupindex={},indexgroup=[None ]):\n ''\n \n return SRE_Pattern(pattern,flags,code,groups,groupindex,indexgroup)\n \ndef getlower(char_ord,flags):\n if (char_ord <128)or (flags&SRE_FLAG_UNICODE)\\\n or (flags&SRE_FLAG_LOCALE and char_ord <256):\n \n return ord(chr(char_ord).lower())\n else :\n return char_ord\n \n \nclass SRE_Pattern:\n\n def __init__(self,pattern,flags,code,groups=0,groupindex={},indexgroup=[None ]):\n self.pattern=pattern\n self.flags=flags\n self.groups=groups\n self.groupindex=groupindex\n self._indexgroup=indexgroup\n self._code=code\n \n def match(self,string,pos=0,endpos=sys.maxsize):\n ''\n\n \n state=_State(string,pos,endpos,self.flags)\n if state.match(self._code):\n return SRE_Match(self,state)\n return None\n \n def fullmatch(self,string,pos=0,endpos=sys.maxsize):\n ''\n\n \n end=\"$\"if isinstance(string,str)else b\"$\"\n if not string.endswith(end):\n string +=end\n state=_State(string,pos,endpos,self.flags)\n if state.match(self._code):\n return SRE_Match(self,state)\n return None\n \n def search(self,string,pos=0,endpos=sys.maxsize):\n ''\n\n\n \n state=_State(string,pos,endpos,self.flags)\n if state.search(self._code):\n return SRE_Match(self,state)\n else :\n return None\n \n def findall(self,string,pos=0,endpos=sys.maxsize):\n ''\n matchlist=[]\n state=_State(string,pos,endpos,self.flags)\n while state.start <=state.end:\n state.reset()\n state.string_position=state.start\n if not state.search(self._code):\n break\n match=SRE_Match(self,state)\n if self.groups ==0 or self.groups ==1:\n item=match.group(self.groups)\n else :\n item=match.groups(\"\")\n matchlist.append(item)\n if state.string_position ==state.start:\n state.start +=1\n else :\n state.start=state.string_position\n return matchlist\n \n def _subx(self,template,string,count=0,subn=False ):\n filter=template\n if not callable(template)and \"\\\\\"in template:\n \n \n \n \n import re as sre\n filter=sre._subx(self,template)\n state=_State(string,0,sys.maxsize,self.flags)\n sublist=[]\n \n n=last_pos=0\n while not count or n 0):\n \n if callable(filter):\n sublist.append(filter(SRE_Match(self,state)))\n else :\n sublist.append(filter)\n last_pos=state.string_position\n n +=1\n if state.string_position ==state.start:\n state.start +=1\n else :\n state.start=state.string_position\n \n if last_pos =0 and group <=self.re.groups:\n return group\n else :\n if group in self.re.groupindex:\n return self.re.groupindex[group]\n raise IndexError(\"no such group\")\n \n def _get_slice(self,group,default):\n group_indices=self.regs[group]\n if group_indices[0]>=0:\n return self.string[group_indices[0]:group_indices[1]]\n else :\n return default\n \n def start(self,group=0):\n ''\n\n \n return self.regs[self._get_index(group)][0]\n \n def end(self,group=0):\n ''\n\n \n return self.regs[self._get_index(group)][1]\n \n def span(self,group=0):\n ''\n return self.start(group),self.end(group)\n \n def expand(self,template):\n ''\n \n import sre\n return sre._expand(self.re,self,template)\n \n def groups(self,default=None ):\n ''\n\n \n groups=[]\n for indices in self.regs[1:]:\n if indices[0]>=0:\n groups.append(self.string[indices[0]:indices[1]])\n else :\n groups.append(default)\n return tuple(groups)\n \n def groupdict(self,default=None ):\n ''\n\n \n groupdict={}\n for key,value in self.re.groupindex.items():\n groupdict[key]=self._get_slice(value,default)\n return groupdict\n \n def group(self,*args):\n ''\n \n if len(args)==0:\n args=(0,)\n grouplist=[]\n for group in args:\n grouplist.append(self._get_slice(self._get_index(group),None ))\n if len(grouplist)==1:\n return grouplist[0]\n else :\n return tuple(grouplist)\n \n def __copy__():\n raise TypeError(\"cannot copy this pattern object\")\n \n def __deepcopy__():\n raise TypeError(\"cannot copy this pattern object\")\n \n def __str__(self):\n start,end=self.start(0),self.end(0)\n return (f\"\")\n \nclass _State:\n\n def __init__(self,string,start,end,flags):\n if isinstance(string,bytearray):\n string=str(bytes(string),\"latin1\")\n if isinstance(string,bytes):\n string=str(string,\"latin1\")\n self.string=string\n if start <0:\n start=0\n if end >len(string):\n end=len(string)\n self.start=start\n self.string_position=self.start\n self.end=end\n self.pos=start\n self.flags=flags\n self.reset()\n \n def reset(self):\n self.marks=[]\n self.lastindex=-1\n self.marks_stack=[]\n self.context_stack=[]\n self.repeat=None\n \n def match(self,pattern_codes):\n \n \n \n \n \n \n \n \n dispatcher=_OpcodeDispatcher()\n self.context_stack.append(_MatchContext(self,pattern_codes))\n has_matched=None\n while len(self.context_stack)>0:\n context=self.context_stack[-1]\n has_matched=dispatcher.match(context)\n if has_matched is not None :\n self.context_stack.pop()\n return has_matched\n \n def search(self,pattern_codes):\n flags=0\n if OPCODES[pattern_codes[0]].name ==\"info\":\n \n \n if pattern_codes[2]&SRE_INFO_PREFIX and pattern_codes[5]>1:\n return self.fast_search(pattern_codes)\n flags=pattern_codes[2]\n pattern_codes=pattern_codes[pattern_codes[1]+1:]\n \n string_position=self.start\n if OPCODES[pattern_codes[0]].name ==\"literal\":\n \n \n character=pattern_codes[1]\n while True :\n while string_position =self.end:\n return False\n self.start=string_position\n string_position +=1\n self.string_position=string_position\n if flags&SRE_INFO_LITERAL:\n return True\n if self.match(pattern_codes[2:]):\n return True\n return False\n \n \n while string_position <=self.end:\n self.reset()\n self.start=self.string_position=string_position\n if self.match(pattern_codes):\n return True\n string_position +=1\n return False\n \n def fast_search(self,pattern_codes):\n ''\n \n \n \n flags=pattern_codes[2]\n prefix_len=pattern_codes[5]\n prefix_skip=pattern_codes[6]\n prefix=pattern_codes[7:7+prefix_len]\n overlap=pattern_codes[7+prefix_len -1:pattern_codes[1]+1]\n pattern_codes=pattern_codes[pattern_codes[1]+1:]\n i=0\n string_position=self.string_position\n while string_position =len(self.marks):\n self.marks.extend([None ]*(mark_nr -len(self.marks)+1))\n self.marks[mark_nr]=position\n \n def get_marks(self,group_index):\n marks_index=2 *group_index\n if len(self.marks)>marks_index+1:\n return self.marks[marks_index],self.marks[marks_index+1]\n else :\n return None ,None\n \n def marks_push(self):\n self.marks_stack.append((self.marks[:],self.lastindex))\n \n def marks_pop(self):\n self.marks,self.lastindex=self.marks_stack.pop()\n \n def marks_pop_keep(self):\n self.marks,self.lastindex=self.marks_stack[-1]\n \n def marks_pop_discard(self):\n self.marks_stack.pop()\n \n def lower(self,char_ord):\n return getlower(char_ord,self.flags)\n \n \nclass _MatchContext:\n\n def __init__(self,state,pattern_codes):\n self.state=state\n self.pattern_codes=pattern_codes\n self.string_position=state.string_position\n self.code_position=0\n self.has_matched=None\n \n def push_new_context(self,pattern_offset):\n ''\n\n \n child_context=_MatchContext(self.state,\n self.pattern_codes[self.code_position+pattern_offset:])\n \n \n \n \n self.state.context_stack.append(child_context)\n return child_context\n \n def peek_char(self,peek=0):\n return self.state.string[self.string_position+peek]\n \n def skip_char(self,skip_count):\n self.string_position +=skip_count\n \n def remaining_chars(self):\n return self.state.end -self.string_position\n \n def peek_code(self,peek=0):\n return self.pattern_codes[self.code_position+peek]\n \n def skip_code(self,skip_count):\n self.code_position +=skip_count\n \n def remaining_codes(self):\n return len(self.pattern_codes)-self.code_position\n \n def at_beginning(self):\n return self.string_position ==0\n \n def at_end(self):\n return self.string_position ==self.state.end\n \n def at_linebreak(self):\n return not self.at_end()and _is_linebreak(self.peek_char())\n \n def at_boundary(self,word_checker):\n if self.at_beginning()and self.at_end():\n return False\n that=not self.at_beginning()and word_checker(self.peek_char(-1))\n this=not self.at_end()and word_checker(self.peek_char())\n return this !=that\n \n \nclass _RepeatContext(_MatchContext):\n\n def __init__(self,context):\n _MatchContext.__init__(self,context.state,\n context.pattern_codes[context.code_position:])\n self.count=-1\n \n self.previous=context.state.repeat\n self.last_position=None\n \n \nclass _Dispatcher:\n\n DISPATCH_TABLE=None\n \n def dispatch(self,code,context):\n method=self.DISPATCH_TABLE.get(code,self.__class__.unknown)\n return method(self,context)\n \n def unknown(self,code,ctx):\n raise NotImplementedError()\n \n def build_dispatch_table(cls,items,method_prefix):\n if cls.DISPATCH_TABLE is not None :\n return\n table={}\n for item in items:\n key,value=item.name.lower(),int(item)\n if hasattr(cls,\"%s%s\"%(method_prefix,key)):\n table[value]=getattr(cls,\"%s%s\"%(method_prefix,key))\n cls.DISPATCH_TABLE=table\n \n build_dispatch_table=classmethod(build_dispatch_table)\n \n \nclass _OpcodeDispatcher(_Dispatcher):\n\n def __init__(self):\n self.executing_contexts={}\n self.at_dispatcher=_AtcodeDispatcher()\n self.ch_dispatcher=_ChcodeDispatcher()\n self.set_dispatcher=_CharsetDispatcher()\n \n def match(self,context):\n ''\n\n \n while context.remaining_codes()>0 and context.has_matched is None :\n opcode=context.peek_code()\n if not self.dispatch(opcode,context):\n return None\n if context.has_matched is None :\n context.has_matched=False\n return context.has_matched\n \n def dispatch(self,opcode,context):\n ''\n \n \n if id(context)in self.executing_contexts:\n generator=self.executing_contexts[id(context)]\n del self.executing_contexts[id(context)]\n has_finished=next(generator)\n else :\n method=self.DISPATCH_TABLE.get(opcode,_OpcodeDispatcher.unknown)\n has_finished=method(self,context)\n if hasattr(has_finished,\"__next__\"):\n generator=has_finished\n has_finished=next(generator)\n if not has_finished:\n self.executing_contexts[id(context)]=generator\n return has_finished\n \n def op_success(self,ctx):\n \n \n ctx.state.string_position=ctx.string_position\n ctx.has_matched=True\n return True\n \n def op_failure(self,ctx):\n \n \n ctx.has_matched=False\n return True\n \n def general_op_literal(self,ctx,compare,decorate=lambda x:x):\n if ctx.at_end()or not compare(decorate(ord(ctx.peek_char())),\n decorate(ctx.peek_code(1))):\n ctx.has_matched=False\n ctx.skip_code(2)\n ctx.skip_char(1)\n \n def op_literal(self,ctx):\n \n \n \n self.general_op_literal(ctx,operator.eq)\n return True\n \n def op_not_literal(self,ctx):\n \n \n \n self.general_op_literal(ctx,operator.ne)\n return True\n \n def op_literal_ignore(self,ctx):\n \n \n \n self.general_op_literal(ctx,operator.eq,ctx.state.lower)\n return True\n \n def op_literal_uni_ignore(self,ctx):\n self.general_op_literal(ctx,operator.eq,ctx.state.lower)\n return True\n \n def op_not_literal_ignore(self,ctx):\n \n \n \n self.general_op_literal(ctx,operator.ne,ctx.state.lower)\n return True\n \n def op_at(self,ctx):\n \n \n \n if not self.at_dispatcher.dispatch(ctx.peek_code(1),ctx):\n ctx.has_matched=False\n \n return True\n ctx.skip_code(2)\n return True\n \n def op_category(self,ctx):\n \n \n \n if ctx.at_end()or not self.ch_dispatcher.dispatch(ctx.peek_code(1),ctx):\n ctx.has_matched=False\n \n return True\n ctx.skip_code(2)\n ctx.skip_char(1)\n return True\n \n def op_any(self,ctx):\n \n \n \n if ctx.at_end()or ctx.at_linebreak():\n ctx.has_matched=False\n \n return True\n ctx.skip_code(1)\n ctx.skip_char(1)\n return True\n \n def op_any_all(self,ctx):\n \n \n \n if ctx.at_end():\n ctx.has_matched=False\n \n return True\n ctx.skip_code(1)\n ctx.skip_char(1)\n return True\n \n def general_op_in(self,ctx,decorate=lambda x:x):\n \n \n if ctx.at_end():\n ctx.has_matched=False\n \n return\n skip=ctx.peek_code(1)\n ctx.skip_code(2)\n \n \n if not self.check_charset(ctx,decorate(ord(ctx.peek_char()))):\n \n ctx.has_matched=False\n return\n ctx.skip_code(skip -1)\n ctx.skip_char(1)\n \n \n def op_in(self,ctx):\n \n \n \n self.general_op_in(ctx)\n return True\n \n def op_in_ignore(self,ctx):\n \n \n \n self.general_op_in(ctx,ctx.state.lower)\n return True\n \n def op_in_uni_ignore(self,ctx):\n self.general_op_in(ctx,ctx.state.lower)\n return True\n \n def op_jump(self,ctx):\n \n \n \n ctx.skip_code(ctx.peek_code(1)+1)\n return True\n \n \n \n op_info=op_jump\n \n def op_mark(self,ctx):\n \n \n \n ctx.state.set_mark(ctx.peek_code(1),ctx.string_position)\n ctx.skip_code(2)\n return True\n \n def op_branch(self,ctx):\n \n \n \n ctx.state.marks_push()\n ctx.skip_code(1)\n current_branch_length=ctx.peek_code(0)\n while current_branch_length:\n \n \n if not (OPCODES[ctx.peek_code(1)].name ==\"literal\"and\\\n (ctx.at_end()or ctx.peek_code(2)!=ord(ctx.peek_char()))):\n ctx.state.string_position=ctx.string_position\n child_context=ctx.push_new_context(1)\n \n yield False\n if child_context.has_matched:\n ctx.has_matched=True\n yield True\n ctx.state.marks_pop_keep()\n ctx.skip_code(current_branch_length)\n current_branch_length=ctx.peek_code(0)\n ctx.state.marks_pop_discard()\n ctx.has_matched=False\n \n yield True\n \n def op_repeat_one(self,ctx):\n \n \n \n \n mincount=ctx.peek_code(2)\n maxcount=ctx.peek_code(3)\n \n \n \n if ctx.remaining_chars()=mincount and\\\n (ctx.at_end()or ord(ctx.peek_char())!=char):\n ctx.skip_char(-1)\n count -=1\n if count =mincount:\n ctx.state.string_position=ctx.string_position\n child_context=ctx.push_new_context(ctx.peek_code(1)+1)\n yield False\n if child_context.has_matched:\n ctx.has_matched=True\n yield True\n ctx.skip_char(-1)\n count -=1\n ctx.state.marks_pop_keep()\n \n ctx.state.marks_pop_discard()\n ctx.has_matched=False\n \n yield True\n \n def op_min_repeat_one(self,ctx):\n \n \n mincount=ctx.peek_code(2)\n maxcount=ctx.peek_code(3)\n \n \n if ctx.remaining_chars()=maxcount and maxcount !=MAXREPEAT:\n ctx.has_matched=False\n \n yield True\n repeat.count=count\n child_context=repeat.push_new_context(4)\n yield False\n ctx.has_matched=child_context.has_matched\n if not ctx.has_matched:\n repeat.count=count -1\n ctx.state.string_position=ctx.string_position\n yield True\n \n def general_op_groupref(self,ctx,decorate=lambda x:x):\n group_start,group_end=ctx.state.get_marks(ctx.peek_code(1))\n if group_start is None or group_end is None or group_end =0:\n child_context=ctx.push_new_context(3)\n yield False\n if child_context.has_matched:\n ctx.has_matched=False\n yield True\n ctx.skip_code(ctx.peek_code(1)+1)\n yield True\n \n def unknown(self,ctx):\n \n raise RuntimeError(\"Internal re error. Unknown opcode: %s\"%ctx.peek_code())\n \n def check_charset(self,ctx,char):\n ''\n \n self.set_dispatcher.reset(char)\n save_position=ctx.code_position\n result=None\n while result is None :\n result=self.set_dispatcher.dispatch(ctx.peek_code(),ctx)\n ctx.code_position=save_position\n \n return result\n \n def count_repetitions(self,ctx,maxcount):\n ''\n\n \n count=0\n real_maxcount=ctx.state.end -ctx.string_position\n if maxcount >4)\\\n &(1 <<(char_code&15)):\n return self.ok\n ctx.skip_code(16)\n else :\n if char_code <256 and ctx.peek_code(char_code >>5)\\\n &(1 <<(char_code&31)):\n return self.ok\n ctx.skip_code(8)\n def set_range(self,ctx):\n \n if ctx.peek_code(1)<=self.char <=ctx.peek_code(2):\n return self.ok\n ctx.skip_code(3)\n def set_negate(self,ctx):\n self.ok=not self.ok\n ctx.skip_code(1)\n \n def set_bigcharset(self,ctx):\n \n char_code=self.char\n count=ctx.peek_code(1)\n ctx.skip_code(2)\n if char_code <65536:\n block_index=char_code >>8\n \n a=array.array(\"B\")\n a.fromstring(array.array(CODESIZE ==2 and \"H\"or \"I\",\n [ctx.peek_code(block_index //CODESIZE)]).tostring())\n block=a[block_index %CODESIZE]\n ctx.skip_code(256 //CODESIZE)\n block_value=ctx.peek_code(block *(32 //CODESIZE)\n +((char_code&255)>>(CODESIZE ==2 and 4 or 5)))\n if block_value&(1 <<(char_code&((8 *CODESIZE)-1))):\n return self.ok\n else :\n ctx.skip_code(256 //CODESIZE)\n ctx.skip_code(count *(32 //CODESIZE))\n \n def unknown(self,ctx):\n return False\n \n_CharsetDispatcher.build_dispatch_table(OPCODES,\"set_\")\n\n\nclass _AtcodeDispatcher(_Dispatcher):\n\n def at_beginning(self,ctx):\n return ctx.at_beginning()\n at_beginning_string=at_beginning\n def at_beginning_line(self,ctx):\n return ctx.at_beginning()or _is_linebreak(ctx.peek_char(-1))\n def at_end(self,ctx):\n return (ctx.remaining_chars()==1 and ctx.at_linebreak())or ctx.at_end()\n def at_end_line(self,ctx):\n return ctx.at_linebreak()or ctx.at_end()\n def at_end_string(self,ctx):\n return ctx.at_end()\n def at_boundary(self,ctx):\n return ctx.at_boundary(_is_word)\n def at_non_boundary(self,ctx):\n return not ctx.at_boundary(_is_word)\n def at_loc_boundary(self,ctx):\n return ctx.at_boundary(_is_loc_word)\n def at_loc_non_boundary(self,ctx):\n return not ctx.at_boundary(_is_loc_word)\n def at_uni_boundary(self,ctx):\n return ctx.at_boundary(_is_uni_word)\n def at_uni_non_boundary(self,ctx):\n return not ctx.at_boundary(_is_uni_word)\n def unknown(self,ctx):\n return False\n \n_AtcodeDispatcher.build_dispatch_table(ATCODES,\"\")\n\n\nclass _ChcodeDispatcher(_Dispatcher):\n\n def category_digit(self,ctx):\n return _is_digit(ctx.peek_char())\n def category_not_digit(self,ctx):\n return not _is_digit(ctx.peek_char())\n def category_space(self,ctx):\n return _is_space(ctx.peek_char())\n def category_not_space(self,ctx):\n return not _is_space(ctx.peek_char())\n def category_word(self,ctx):\n return _is_word(ctx.peek_char())\n def category_not_word(self,ctx):\n return not _is_word(ctx.peek_char())\n def category_linebreak(self,ctx):\n return _is_linebreak(ctx.peek_char())\n def category_not_linebreak(self,ctx):\n return not _is_linebreak(ctx.peek_char())\n def category_loc_word(self,ctx):\n return _is_loc_word(ctx.peek_char())\n def category_loc_not_word(self,ctx):\n return not _is_loc_word(ctx.peek_char())\n def category_uni_digit(self,ctx):\n return ctx.peek_char().isdigit()\n def category_uni_not_digit(self,ctx):\n return not ctx.peek_char().isdigit()\n def category_uni_space(self,ctx):\n return ctx.peek_char().isspace()\n def category_uni_not_space(self,ctx):\n return not ctx.peek_char().isspace()\n def category_uni_word(self,ctx):\n return _is_uni_word(ctx.peek_char())\n def category_uni_not_word(self,ctx):\n return not _is_uni_word(ctx.peek_char())\n def category_uni_linebreak(self,ctx):\n return ord(ctx.peek_char())in _uni_linebreaks\n def category_uni_not_linebreak(self,ctx):\n return ord(ctx.peek_char())not in _uni_linebreaks\n def unknown(self,ctx):\n return False\n \n_ChcodeDispatcher.build_dispatch_table(CHCODES,\"\")\n\n\n_ascii_char_info=[0,0,0,0,0,0,0,0,0,2,6,2,\n2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,\n0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25,25,25,25,25,\n25,25,0,0,0,0,0,0,0,24,24,24,24,24,24,24,24,24,24,\n24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,0,0,\n0,0,16,0,24,24,24,24,24,24,24,24,24,24,24,24,24,24,\n24,24,24,24,24,24,24,24,24,24,24,24,0,0,0,0,0]\n\ndef _is_digit(char):\n code=ord(char)\n return code <128 and _ascii_char_info[code]&1\n \ndef _is_space(char):\n code=ord(char)\n return code <128 and _ascii_char_info[code]&2\n \ndef _is_word(char):\n\n code=ord(char)\n return code <128 and _ascii_char_info[code]&16\n \ndef _is_loc_word(char):\n return (not (ord(char)&~255)and char.isalnum())or char =='_'\n \ndef _is_uni_word(char):\n\n\n return chr(ord(char)).isalnum()or char =='_'\n \ndef _is_linebreak(char):\n return char ==\"\\n\"\n \n \n_uni_linebreaks=[10,13,28,29,30,133,8232,8233]\n\ndef _log(message):\n if 0:\n print(message)\n", ["_sre_utils", "array", "operator", "re", "sre", "sre_constants", "sys"]], "_sre_utils": [".js", "var $module=(function($B){\n\n function unicode_iscased(cp){\n // cp : Unicode code point\n var letter = String.fromCodePoint(cp)\n return (letter != letter.toLowerCase() ||\n letter != letter.toUpperCase())\n }\n\n function ascii_iscased(cp){\n if(cp > 255){return false}\n return unicode_iscased(cp)\n }\n\n function unicode_tolower(cp){\n var letter = String.fromCodePoint(cp),\n lower = letter.toLowerCase()\n return lower.charCodeAt(0)\n }\n\n function ascii_tolower(cp){\n return unicode_tolower(cp)\n }\n\nreturn {\n unicode_iscased: unicode_iscased,\n ascii_iscased: ascii_iscased,\n unicode_tolower: unicode_tolower,\n ascii_tolower: ascii_tolower\n}\n\n}\n\n)(__BRYTHON__)"], "_string": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins\n\nfunction parts(format_string){\n var result = [],\n _parts = $B.split_format(format_string) // defined in py_string.js\n for(var i = 0; i < _parts.length; i+= 2){\n result.push({pre: _parts[i], fmt: _parts[i + 1]})\n }\n return result\n}\n\nfunction Tuple(){\n var args = []\n for(var i=0, len=arguments.length; i < len; i++){\n args.push(arguments[i])\n }\n return _b_.tuple.$factory(args)\n}\n\nreturn{\n\n formatter_field_name_split: function(fieldname){\n // Split the argument as a field name\n var parsed = $B.parse_format(fieldname),\n first = parsed.name,\n rest = []\n if(first.match(/\\d+/)){first = parseInt(first)}\n parsed.name_ext.forEach(function(ext){\n if(ext.startsWith(\"[\")){\n var item = ext.substr(1, ext.length - 2)\n if(item.match(/\\d+/)){\n rest.push(Tuple(false, parseInt(item)))\n }else{\n rest.push(Tuple(false, item))\n }\n }else{\n rest.push(Tuple(true, ext.substr(1)))\n }\n })\n return Tuple(first, _b_.iter(rest))\n },\n formatter_parser: function(format_string){\n // Parse the argument as a format string\n\n if(! _b_.isinstance(format_string, _b_.str)){\n throw _b_.ValueError.$factory(\"Invalid format string type: \" +\n $B.class_name(format_string))\n }\n\n var result = []\n parts(format_string).forEach(function(item){\n var pre = item.pre === undefined ? \"\" : item.pre,\n fmt = item.fmt\n if(fmt === undefined){\n result.push(Tuple(pre, _b_.None, _b_.None, _b_.None))\n }else if(fmt.string == ''){\n result.push(Tuple(pre, '', '', _b_.None))\n }else{\n result.push(Tuple(pre,\n fmt.raw_name + fmt.name_ext.join(\"\"),\n fmt.raw_spec,\n fmt.conv || _b_.None))\n }\n })\n return result\n }\n}\n})(__BRYTHON__)"], "_strptime": [".js", "var _b_ = __BRYTHON__.builtins\n\nvar $module = (function($B){\n return {\n _strptime_datetime: function(cls, s, fmt){\n var pos_s = 0,\n pos_fmt = 0,\n dt = {}\n function error(time_data, format){\n throw _b_.ValueError.$factory(\n `time data '${time_data}' does not match format '${format}'`)\n }\n\n var locale = __BRYTHON__.locale,\n shortdays = [],\n longdays = [],\n conv_func = locale == \"C\" ?\n function(d, options){\n return d.toLocaleDateString('en-EN', options)\n } :\n function(d, options){\n return d.toLocaleDateString(locale, options)\n }\n\n for(var day = 16; day < 23; day++){\n var d = new Date(Date.UTC(2012, 11, day, 3, 0, 0))\n shortdays.push(conv_func(d, {weekday: 'short'}))\n longdays.push(conv_func(d, {weekday: 'long'}))\n }\n\n var shortmonths = [],\n longmonths = []\n\n for(var month = 0; month < 12; month++){\n var d = new Date(Date.UTC(2012, month, 11, 3, 0, 0))\n shortmonths.push(conv_func(d, {month: 'short'}))\n longmonths.push(conv_func(d, {month: 'long'}))\n }\n\n var shortdays_re = new RegExp(shortdays.join(\"|\").replace(\".\", \"\\\\.\")),\n longdays_re = new RegExp(longdays.join(\"|\")),\n shortmonths_re = new RegExp(shortmonths.join(\"|\").replace(\".\", \"\\\\.\")),\n longmonths_re = new RegExp(longmonths.join(\"|\"))\n\n var regexps = {\n d: [\"day\", new RegExp(\"^[123][0-9]|0?[1-9]\")],\n f: [\"microsecond\", new RegExp(\"^\\\\d{1,6}\")],\n H: [\"hour\", new RegExp(\"^[01][0-9]|2[0-3]|\\\\d\")],\n I: [\"hour\", new RegExp(\"^1[0-2]|0?[0-9]\")],\n m: [\"month\", new RegExp(\"^1[012]|0?[1-9]\")],\n M: [\"minute\", new RegExp(\"^[1-5][0-9]|0?[0-9]\")],\n S: [\"second\", new RegExp(\"^[1-5]\\\\d|0?\\\\d\")],\n y: [\"year\", new RegExp(\"^0{0,2}\\\\d{2}\")],\n Y: [\"year\", new RegExp(\"^\\\\d{4}\")],\n z: [\"tzinfo\", new RegExp(\"Z\")]\n }\n\n for(var key in regexps){\n var re = new RegExp('%' + key, \"g\"),\n mo = fmt.match(re)\n if(mo && mo.length > 1){\n throw _b_.ValueError.$factory('strptime directive %' +\n key + ' defined more than once')\n }\n }\n\n while(pos_fmt < fmt.length){\n var car = fmt.charAt(pos_fmt)\n if(car == \"%\"){\n var spec = fmt.charAt(pos_fmt + 1),\n regexp = regexps[spec]\n if(regexp !== undefined){\n var re = regexp[1],\n attr = regexp[0],\n res = re.exec(s.substr(pos_s))\n if(res === null){\n error(s, fmt)\n }else{\n dt[attr] = parseInt(res[0])\n if(attr == \"microsecond\"){\n while(dt[attr] < 100000){\n dt[attr] *= 10\n }\n }else if(attr == \"tzinfo\"){\n // Only value supported for the moment : Z\n // (UTC)\n var dt_module = $B.imported[cls.__module__]\n dt.tzinfo = dt_module.timezone.utc\n }\n pos_fmt += 2\n pos_s += res[0].length\n }\n }else if(spec == \"a\" || spec == \"A\"){\n // Locale's abbreviated (a) or full (A) weekday name\n var attr = \"weekday\",\n re = spec == \"a\" ? shortdays_re : longdays_re,\n t = spec == \"a\" ? shortdays : longdays\n res = re.exec(s.substr(pos_s))\n if(res === null){\n console.log('error', re, 'string', s.substr(pos_s), 'fmt', fmt)\n error(s, fmt)\n }else{\n var match = res[0],\n ix = t.indexOf(match)\n }\n dt.weekday = ix\n pos_fmt += 2\n pos_s += match.length\n }else if(spec == \"b\" || spec == \"B\"){\n // Locales's abbreviated (b) or full (B) month\n var attr = \"month\",\n re = spec == \"b\" ? shortmonths_re : longmonths_re,\n t = spec == \"b\" ? shortmonths : longmonths,\n res = re.exec(s.substr(pos_s))\n if(res === null){\n error(s, fmt)\n }else{\n var match = res[0],\n ix = t.indexOf(match)\n }\n dt.month = ix + 1\n pos_fmt += 2\n pos_s += match.length\n }else if(spec == \"c\"){\n // Locale's appropriate date and time representation\n var fmt1 = fmt.substr(0, pos_fmt - 1) + _locale_c_format() +\n fmt.substr(pos_fmt + 2)\n fmt = fmt1\n }else if(spec == \"%\"){\n if(s.charAt(pos_s) == \"%\"){\n pos_fmt++\n pos_s++\n }else{\n error(s, fmt)\n }\n }else{\n pos_fmt++\n }\n }else{\n if(car == s.charAt(pos_s)){\n pos_fmt++\n pos_s++\n }else{\n error(s, fmt)\n }\n }\n }\n\n if(pos_s < s.length){\n throw _b_.ValueError.$factory('unconverted data remains: ' +\n s.substr(pos_s))\n }\n\n return $B.$call(cls)(dt.year, dt.month, dt.day,\n dt.hour || 0, dt.minute || 0, dt.second || 0,\n dt.microsecond || 0, dt.tzinfo || _b_.None)\n }\n }\n})(__BRYTHON__)\n"], "_svg": [".js", "// creation of an HTML element\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\nvar TagSum = $B.TagSum // defined in py_dom.js\n\nvar $svgNS = \"http://www.w3.org/2000/svg\"\nvar $xlinkNS = \"http://www.w3.org/1999/xlink\"\n\nfunction makeTagDict(tagName){\n // return the dictionary for the class associated with tagName\n var dict = $B.make_class(tagName)\n\n dict.__init__ = function(){\n var $ns = $B.args('__init__', 1, {self: null}, ['self'],\n arguments, {}, 'args', 'kw'),\n self = $ns['self'],\n args = $ns['args']\n if(args.length == 1){\n var first = args[0]\n if($B.$isinstance(first, [_b_.str, _b_.int, _b_.float])){\n self.appendChild(document.createTextNode(_b_.str.$factory(first)))\n }else if(first.__class__ === TagSum){\n for(var i = 0, len = first.children.length; i < len; i++){\n self.appendChild(first.children[i].elt)\n }\n }else{ // argument is another DOMNode instance\n try{self.appendChild(first.elt)}\n catch(err){throw _b_.ValueError.$factory('wrong element ' + first)}\n }\n }\n\n // attributes\n var items = _b_.list.$factory(_b_.dict.items($ns['kw']))\n for(var arg in $ns.kw.$jsobj){\n // keyword arguments\n var value = $B.py_immutable_to_js($ns.kw.$jsobj[arg])\n if(arg.toLowerCase().substr(0,2) == \"on\"){\n // Event binding passed as argument \"onclick\", \"onfocus\"...\n // Better use method bind of DOMNode objects\n $B.DOMNode.bind(self,\n arg.toLowerCase().substr(2),\n value)\n }else if(arg.toLowerCase() == \"style\"){\n $B.DOMNode.set_style(self, value)\n }else if(arg.toLowerCase().indexOf(\"href\") !== -1){ // xlink:href\n self.setAttributeNS( \"http://www.w3.org/1999/xlink\",\n \"href\",value)\n }else{\n if(value !== false){\n // option.selected=false sets it to true :-)\n try{\n arg = arg.replace('_', '-')\n self.setAttributeNS(null, arg, value)\n }catch(err){\n throw _b_.ValueError.$factory(\"can't set attribute \" + arg)\n }\n }\n }\n }\n }\n\n dict.__mro__ = [$B.DOMNode, $B.builtins.object]\n\n dict.__new__ = function(cls){\n var res = $B.DOMNode.$factory(document.createElementNS($svgNS, tagName))\n res.__class__ = cls\n return res\n }\n\n dict.$factory = function(){\n var res = $B.DOMNode.$factory(\n document.createElementNS($svgNS, tagName))\n res.__class__ = dict\n // apply __init__\n dict.__init__(res, ...arguments)\n return res\n }\n\n $B.set_func_names(dict, \"browser.svg\")\n\n return dict\n}\n\n\n// SVG\nvar $svg_tags = ['a',\n'altGlyph',\n'altGlyphDef',\n'altGlyphItem',\n'animate',\n'animateColor',\n'animateMotion',\n'animateTransform',\n'circle',\n'clipPath',\n'color_profile', // instead of color-profile\n'cursor',\n'defs',\n'desc',\n'ellipse',\n'feBlend',\n'foreignObject', //patch to enable foreign objects\n'g',\n'image',\n'line',\n'linearGradient',\n'marker',\n'mask',\n'path',\n'pattern',\n'polygon',\n'polyline',\n'radialGradient',\n'rect',\n'set',\n'stop',\n'svg',\n'text',\n'tref',\n'tspan',\n'use']\n\n// create classes\nvar obj = new Object()\nvar dicts = {}\nfor(var i = 0, len = $svg_tags.length; i < len; i++){\n var tag = $svg_tags[i]\n obj[tag] = makeTagDict(tag)\n}\n\nreturn obj\n})(__BRYTHON__)\n"], "_symtable": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\nreturn {\n CELL: 5,\n DEF_ANNOT: 256,\n DEF_BOUND: 134,\n DEF_FREE: 32,\n DEF_FREE_CLASS: 64,\n DEF_GLOBAL: 1,\n DEF_IMPORT: 128,\n DEF_LOCAL: 2,\n DEF_NONLOCAL: 8,\n DEF_PARAM: 4,\n FREE: 4,\n GLOBAL_EXPLICIT: 2,\n GLOBAL_IMPLICIT: 3,\n LOCAL: 1,\n SCOPE_MASK: 15,\n SCOPE_OFF: 11,\n TYPE_CLASS: 1,\n TYPE_FUNCTION: 0,\n TYPE_MODULE: 2,\n USE: 16,\n symtable: function(){\n var $ = $B.args('symtable', 3,\n {code: null, filename: null, compile_type: null},\n ['code', 'filename', 'compile_type'], arguments,\n {}, null, null)\n var ast = _b_.compile($.code, $.filename, $.compile_type,\n $B.PyCF_ONLY_AST)\n // ast is an instance of Python class\n // _Py_Symtable_Build in symtable.js uses the underlying JS object\n return $B._PySymtable_Build(ast.$js_ast, $.filename)\n }\n}\n\n})(__BRYTHON__)"], "_tokenize": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\n$B.$import('token')\n\n\nvar TokenizerIter = $B.make_class('TokenizerIter',\n function(it){\n return {\n __class__: TokenizerIter,\n it\n }\n }\n)\n\nTokenizerIter.__iter__ = function(self){\n var js_iter = function*(){\n var line_num = 0\n while(true){\n try{\n var bytes = self.it()\n }catch(err){\n if($B.is_exc(err, [_b_.StopIteration])){\n token = endmarker\n token.start[0]++\n token.end[0]++\n var type_code = $B.imported.token[token.type]\n yield $B.fast_tuple([type_code, token.string,\n $B.fast_tuple(token.start),\n $B.fast_tuple(token.end),\n token.line])\n }\n throw err\n }\n line_num++\n var line = _b_.bytes.decode(bytes, 'utf-8')\n for(var token of $B.tokenizer(line, 'test')){\n if(token.type == 'ENCODING'){ // skip encoding token\n continue\n }else if(token.type == 'ENDMARKER'){\n var endmarker = token\n continue\n }\n token.start[0] = line_num\n token.end[0] = line_num\n var type_code = $B.imported.token[token.type]\n yield $B.fast_tuple([type_code, token.string,\n $B.fast_tuple(token.start),\n $B.fast_tuple(token.end),\n token.line])\n }\n }\n\n }\n return $B.generator.$factory(js_iter)()\n}\n\nTokenizerIter.__next__ = function*(self){\n\n}\n\n$B.set_func_names(TokenizerIter, '_tokenize')\n\nreturn {TokenizerIter}\n\n})(__BRYTHON__)"], "_webcomponent": [".js", "// module for Web Components\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\n\nfunction define(tag_name, cls, options){\n var $ = $B.args(\"define\", 3, {tag_name: null, cls: null, options: null},\n [\"tag_name\", \"cls\", \"options\"], arguments, {options: _b_.None},\n null, null),\n tag_name = $.tag_name,\n cls = $.cls,\n options = $.options,\n _extends,\n extend_dom_name = 'HTMLElement'\n if(options !== _b_.None){\n if(! $B.$isinstance(options, _b_.dict)){\n throw _b_.TypeError.$factory('options can only be None or a ' +\n `dict, not '${$B.class_name(options)}'`)\n }\n try{\n _extends = _b_.dict.$getitem(options, 'extends')\n }catch(err){\n // ignore\n }\n }else{\n for(var base of cls.__bases__){\n if(base.__module__ == 'browser.html'){\n _extends = base.__name__.toLowerCase()\n break\n }\n }\n }\n\n if(_extends){\n if(typeof _extends != 'string'){\n throw _b_.TypeError.$factory('value for extends must be a ' +\n `string, not '${$B.class_name(_extends)}'`)\n }\n var elt = document.createElement(_extends)\n if(elt instanceof HTMLUnknownElement){\n throw _b_.ValueError.$factory(`'${_extends}' is not a valid ` +\n 'tag name')\n }\n var extend_tag = _extends.toLowerCase()\n extend_dom_name = Object.getPrototypeOf(elt).constructor.name\n }\n if(typeof tag_name != \"string\"){\n throw _b_.TypeError.$factory(\"first argument of define() \" +\n \"must be a string, not '\" + $B.class_name(tag_name) + \"'\")\n }else if(tag_name.indexOf(\"-\") == -1){\n throw _b_.ValueError.$factory(\"custom tag name must \" +\n \"contain a hyphen (-)\")\n }\n if(!$B.$isinstance(cls, _b_.type)){\n throw _b_.TypeError.$factory(\"second argument of define() \" +\n \"must be a class, not '\" + $B.class_name(tag_name) + \"'\")\n }\n cls.$webcomponent = true\n\n // Create the Javascript class used for the component. It must have\n // the same name as the Python class\n var src = String.raw`var WebComponent = class extends HTMLElement {\n constructor(){\n // Always call super first in constructor\n super()\n var html = $B.imported['browser.html']\n // Create tag in module html\n if(html['tag_name'] === undefined){\n html.maketag('tag_name', WebComponent)\n }\n var init = $B.$getattr(cls, \"__init__\", _b_.None)\n if(init !== _b_.None){\n try{\n var _self = $B.DOMNode.$factory(this),\n attrs_before_init = []\n for(var i = 0, len = _self.attributes.length; i < len; i++){\n attrs_before_init.push(_self.attributes.item(i))\n }\n _self.__class__ = cls\n $B.$call(init)(_self)\n if(WebComponent.initialized){\n // Check that init() did not introduce new attributes,\n // which is illegal\n // cf. https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-conformance\n for(var i = 0, len = _self.attributes.length; i < len; i++){\n var item = _self.attributes.item(i)\n if(attrs_before_init.indexOf(item) == -1){\n throw _b_.TypeError.$factory(\"Custom element \" +\n \"must not create attributes, found: \" +\n item.name + '=\"' + item.value + '\"')\n }\n }\n }\n }catch(err){\n $B.handle_error(err)\n }\n }\n }\n static get observedAttributes(){\n var obs_attr = $B.$getattr(cls, \"observedAttributes\", null)\n if(obs_attr === null){\n return []\n }else if(typeof obs_attr == \"function\"){\n var warning = _b_.DeprecationWarning.$factory(\n \"Setting observedAttributes as a method \" +\n \"is deprecated. Set it as a class attribute.\")\n // module _warning is in builtin_modules.js\n $B.imported._warnings.warn(warning)\n return $B.$call(obs_attr)(this)\n }else if(Array.isArray(obs_attr)){\n return obs_attr\n }else{\n throw _b_.TypeError.$factory(\n \"wrong type for observedAttributes: \" +\n $B.class_name(obs_attr))\n }\n }\n }\n `\n var name = cls.__name__,\n code = src.replace(/WebComponent/g, name).\n replace(/tag_name/g, tag_name).\n replace(/HTMLElement/, extend_dom_name)\n var src = eval(code)\n var webcomp = eval(name) // JS class for component\n webcomp.$cls = cls\n\n // Override __getattribute__ to handle DOMNode attributes such as\n // attachShadow\n cls.__getattribute__ = function(self, attr){\n try{\n return $B.DOMNode.__getattribute__(self, attr)\n }catch(err){\n if($B.DOMNode[attr]){\n if(typeof $B.DOMNode[attr] == 'function'){\n return function(){\n var args = [self]\n for(var i = 0, len = arguments.length; i < len; i++){\n args.push(arguments[i])\n }\n return $B.DOMNode[attr].apply(null, args)\n }\n }else{\n return $B.DOMNode[attr]\n }\n }\n throw err\n }\n }\n\n var mro = [cls].concat(cls.__mro__).reverse()\n for(var i = 0, len = mro.length; i < len; i++){\n var pcls = mro[i]\n for(var key in pcls){\n if((! webcomp.hasOwnProperty(key)) &&\n typeof pcls[key] == \"function\" &&\n // don't set $factory (would make it a class)\n key !== '$factory'\n ){\n webcomp.prototype[key] = (function(attr, klass){\n return function(){\n try{\n return $B.$call(klass[attr])($B.DOMNode.$factory(this), ...arguments)\n }catch(err){\n $B.show_error(err)\n }\n }\n })(key, pcls)\n }\n }\n }\n\n // define WebComp as the class to use for the specified tag name\n if(_extends){\n customElements.define(tag_name, webcomp, {extends: extend_tag})\n }else{\n customElements.define(tag_name, webcomp)\n }\n webcomp.initialized = true\n}\n\nfunction get(name){\n var ce = customElements.get(name)\n if(ce && ce.$cls){return ce.$cls}\n return _b_.None\n}\n\nreturn {\n define: define,\n get: get\n}\n\n})(__BRYTHON__)"], "_webworker": [".js", "// Web Worker implementation\n\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\n\nvar VFS = $B.brython_modules ? 'brython_modules' :\n $B.use_VFS ? 'brython_stdlib' : null\n\nfunction scripts_to_load(debug_level){\n if(debug_level > 2){\n var brython_scripts = [\n 'brython_builtins',\n\n 'py_ast_classes',\n 'unicode_data',\n 'stdlib_paths',\n 'version_info',\n\n 'python_tokenizer',\n 'py_ast',\n 'py2js',\n 'loaders',\n 'py_utils',\n 'py_object',\n 'py_type',\n 'py_builtin_functions',\n 'py_sort',\n 'py_exceptions',\n 'py_range_slice',\n 'py_bytes',\n 'py_set',\n 'js_objects',\n 'py_import',\n 'py_string',\n 'py_int',\n 'py_long_int',\n 'py_float',\n 'py_complex',\n 'py_dict',\n 'py_list',\n 'py_generator',\n 'py_dom',\n 'py_pattern_matching',\n 'async',\n 'py_flags',\n 'builtin_modules',\n 'ast_to_js',\n 'symtable',\n 'builtins_docstrings'\n ]\n }else{\n var brython_scripts = ['brython']\n }\n\n if(VFS !== null){\n brython_scripts.push(VFS)\n }\n return brython_scripts\n}\n\nvar wclass = $B.make_class(\"Worker\",\n function(worker){\n var res = worker\n res.send = function(){\n var args = []\n for(var arg of arguments){\n args.push($B.pyobj2structuredclone(arg))\n }\n return res.postMessage.apply(this, args)\n }\n return res\n }\n)\n\nwclass.__mro__ = [$B.JSObj, _b_.object]\n\n$B.set_func_names(wclass, \"browser.worker\")\n\n\nvar _Worker = $B.make_class(\"Worker\", function(id, onmessage, onerror){\n $B.warn(_b_.DeprecationWarning,\n \"worker.Worker is deprecated in version 3.12. \" +\n \"Use worker.create_worker instead\")\n var $ = $B.args(\"__init__\", 3, {id: null, onmessage: null, onerror: null},\n ['id', 'onmessage', 'onerror'], arguments,\n {onmessage: _b_.None, onerror: _b_.None}, null, null),\n id = $.id,\n worker_script = $B.webworkers[id]\n\n if(worker_script === undefined){\n throw _b_.KeyError.$factory(id)\n }\n var filename = worker_script.src ? worker_script.src : $B.script_path + \"#\" + id,\n src = $B.file_cache[filename]\n var indexedDB = worker_script.attributes &&\n worker_script.attributes.getNamedItem('indexedDB')\n var script_id = \"worker\" + $B.UUID(),\n filename = $B.script_path + \"#\" + id\n $B.url2name[filename] = script_id\n\n var js = $B.py2js({src, filename}, script_id).to_js(),\n header = '';\n var brython_scripts = scripts_to_load(\n $B.get_option_from_filename('debug', filename))\n brython_scripts.forEach(function(script){\n if(script != VFS || VFS == \"brython_stdlib\"){\n var url = $B.brython_path + script + \".js\"\n }else{\n // attribute $B.brython_modules is set to the path of\n // brython_modules.js by the script itself\n var url = $B.brython_modules\n }\n if(! $B.get_option('cache')){ // cf. issue 1954\n url += '?' + (new Date()).getTime()\n }\n header += 'importScripts(\"' + url + '\")\\n'\n })\n // set __BRYTHON__.imported[script_id]\n header += `\n var $B = __BRYTHON__,\n _b_ = $B.builtins\n var module = $B.module.$factory(\"${script_id}\")\n module.__file__ = \"${filename}\"\n module.__doc__ = _b_.None\n $B.imported[\"${script_id}\"] = module\\n`\n // restore brython_path\n header += `$B.brython_path = \"${$B.brython_path}\"\\n`\n // restore path for imports (cf. issue #1305)\n header += `$B.make_import_paths(\"${filename}\")\\n`\n // Call brython() to initialize internal Brython values\n header += `brython(${JSON.stringify($B.$options)})\\n`\n js = header + js\n js = `try{${js}}catch(err){$B.handle_error(err)}`\n var blob = new Blob([js], {type: \"application/js\"}),\n url = URL.createObjectURL(blob),\n w = new Worker(url),\n res = wclass.$factory(w)\n return res\n})\n\nfunction create_worker(){\n var $ = $B.args(\"__init__\", 4,\n {id: null, onready: null, onmessage: null, onerror: null},\n ['id', 'onready', 'onmessage', 'onerror'], arguments,\n {onready: _b_.None, onmessage: _b_.None, onerror: _b_.None},\n null, null),\n id = $.id,\n worker_script = $B.webworkers[id],\n onready = $.onready === _b_.None ? _b_.None : $B.$call($.onready),\n onmessage = $.onmessage === _b_.None ? _b_.None : $B.$call($.onmessage),\n onerror = $.onerror === _b_.None ? _b_.None : $B.$call($.onerror)\n\n if(worker_script === undefined){\n throw _b_.RuntimeError.$factory(`No webworker with id '${id}'`)\n }\n var script_id = \"worker\" + $B.UUID(),\n filename = worker_script.src ? worker_script.src : $B.script_path + \"#\" + id,\n src = $B.file_cache[filename]\n $B.url2name[filename] = script_id\n\n var brython_scripts = scripts_to_load(\n $B.get_option_from_filename('debug', filename))\n\n var js = $B.py2js({src, filename}, script_id).to_js(),\n header = '';\n for(var script of brython_scripts){\n if(script != VFS || VFS == \"brython_stdlib\"){\n var url = $B.brython_path + script + \".js\"\n }else{\n // attribute $B.brython_modules is set to the path of\n // brython_modules.js by the script itself\n var url = $B.brython_modules\n }\n if(! $B.get_option('cache')){ // cf. issue 1954\n url += '?' + (new Date()).getTime()\n }\n header += 'importScripts(\"' + url + '\")\\n'\n }\n // set __BRYTHON__.imported[script_id]\n header += `\n var $B = __BRYTHON__,\n _b_ = $B.builtins\n var module = $B.module.$factory(\"${script_id}\")\n module.__file__ = \"${filename}\"\n module.__doc__ = _b_.None\n $B.imported[\"${script_id}\"] = module\\n`\n\n header += '$B.file_cache[module.__file__] = `' + src + '`\\n'\n // restore brython_path\n header += `$B.brython_path = \"${$B.brython_path}\"\\n`\n // restore path for imports (cf. issue #1305)\n header += `$B.make_import_paths(\"${filename}\")\\n`\n\n // Call brython() to initialize internal Brython values\n var save_option = JSON.stringify($B.save_options)\n header += `brython(${save_option})\\n`\n\n // send dummy message to trigger resolution of Promise\n var ok_token = Math.random().toString(36).substr(2, 8),\n error_token = Math.random().toString(36).substr(2, 8)\n\n // open indexedDB cache before running worker code\n js = `$B.idb_open_promise().then(function(){\\n` +\n `try{\\n` +\n `${js}\\n` +\n `self.postMessage('${ok_token}')\\n` +\n `}catch(err){\\n` +\n `self.postMessage(\"${error_token}Error in worker ${id}\\\\n\" + $B.error_trace(err))\\n` +\n `}\\n})`\n js = header + js\n\n var p = new Promise(function(resolve, reject){\n try{\n var blob = new Blob([js], {type: \"application/js\"}),\n url = URL.createObjectURL(blob),\n w = new Worker(url),\n res = wclass.$factory(w)\n }catch(err){\n reject(err)\n }\n\n w.onmessage = function(ev){\n if(ev.data == ok_token){\n resolve(res)\n }else if(typeof ev.data == 'string' &&\n ev.data.startsWith(error_token)){\n reject(ev.data.substr(error_token.length))\n }else{\n if(onmessage !== _b_.None){\n onmessage(ev)\n }\n resolve(res)\n }\n }\n\n return res\n })\n\n var error_func = onerror === _b_.None ? console.debug : onerror\n\n if(onready !== _b_.None){\n p.then(onready).catch(error_func)\n }else{\n p.catch(error_func)\n }\n return _b_.None\n}\n\nreturn {\n Worker: _Worker,\n create_worker\n}\n\n})(__BRYTHON__)\n"], "_zlib_utils": [".js", "\nfunction rfind(buf, seq){\n var buflen = buf.length,\n len = seq.length\n for(var i = buflen - len; i >= 0; i--){\n var chunk = buf.slice(i, i + len),\n found = true\n for(var j = 0; j < len; j++){\n if(chunk[j] != seq[j]){\n found = false\n break\n }\n }\n if(found){return i}\n }\n return -1\n}\n\n\nvar c;\nvar crcTable = [];\nfor(var n =0; n < 256; n++){\n c = n;\n for(var k =0; k < 8; k++){\n c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n crcTable[n] = c;\n}\n\nvar $module = (function($B){\n\n return {\n crc32: function(bytes, crc) {\n var crc = crc ^ (-1);\n\n for (var byte of bytes.source) {\n crc = (crc >>> 8) ^ crcTable[(crc ^ byte) & 0xFF];\n }\n\n return (crc ^ (-1)) >>> 0;\n },\n\n lz_generator: function(text, size, min_len){\n /*\n Returns a list of items based on the LZ algorithm, using the\n specified window size and a minimum match length.\n The items are a tuple (length, distance) if a match has been\n found, and a byte otherwise.\n */\n // 'text' is an instance of Python 'bytes' class, the actual\n // bytes are in text.source\n text = text.source\n if(min_len === undefined){\n min_len = 3\n }\n var pos = 0, // position in text\n items = [] // returned items\n while(pos < text.length){\n sequence = text.slice(pos, pos + min_len)\n if(sequence.length < 3){\n for(var i = pos; i < text.length; i++){\n items.push(text[i])\n }\n break\n }\n // Search the sequence in the 'size' previous bytes\n buf = text.slice(pos - size, pos)\n buf_pos = rfind(buf, sequence)\n if(buf_pos > -1){\n // Match of length 3 found; search a longer one\n var len = 1\n while(len < 259 &&\n buf_pos + len < buf.length &&\n pos + len < text.length &&\n text[pos + len] == buf[buf_pos + len]){\n len += 1\n }\n match = text.slice(pos, pos + len)\n // \"Lazy matching\": search longer match starting at next\n // position\n longer_match = false\n if(pos + len < text.length - 2){\n match2 = text.slice(pos + 1, pos + len + 2)\n longer_buf_pos = rfind(buf, match2)\n if(longer_buf_pos > -1){\n // found longer match : emit current byte as\n // literal and move 1 byte forward\n longer_match = true\n char = text[pos]\n items.push(char)\n pos += 1\n }\n }\n if(! longer_match){\n distance = buf.length - buf_pos\n items.push($B.fast_tuple([len, distance]))\n if(pos + len == text.length){\n break\n }else{\n pos += len\n items.push(text[pos])\n pos += 1\n }\n }\n }else{\n char = text[pos]\n items.push(char)\n pos += 1\n }\n }\n return items\n }\n }\n})(__BRYTHON__)"], "crypto_js": [".py", "", [], 1], "crypto_js.rollups": [".py", "", [], 1], "crypto_js.rollups.md5": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(s,p){var m={},l=m.lib={},n=function(){},r=l.Base={extend:function(b){n.prototype=this;var h=new n;b&&h.mixIn(b);h.hasOwnProperty(\"init\")||(h.init=function(){h.$super.init.apply(this,arguments)});h.init.prototype=h;h.$super=this;return h},create:function(){var b=this.extend();b.init.apply(b,arguments);return b},init:function(){},mixIn:function(b){for(var h in b)b.hasOwnProperty(h)&&(this[h]=b[h]);b.hasOwnProperty(\"toString\")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}},\nq=l.WordArray=r.extend({init:function(b,h){b=this.words=b||[];this.sigBytes=h!=p?h:4*b.length},toString:function(b){return(b||t).stringify(this)},concat:function(b){var h=this.words,a=b.words,j=this.sigBytes;b=b.sigBytes;this.clamp();if(j%4)for(var g=0;g>>2]|=(a[g>>>2]>>>24-8*(g%4)&255)<<24-8*((j+g)%4);else if(65535>>2]=a[g>>>2];else h.push.apply(h,a);this.sigBytes+=b;return this},clamp:function(){var b=this.words,h=this.sigBytes;b[h>>>2]&=4294967295<<\n32-8*(h%4);b.length=s.ceil(h/4)},clone:function(){var b=r.clone.call(this);b.words=this.words.slice(0);return b},random:function(b){for(var h=[],a=0;a>>2]>>>24-8*(j%4)&255;g.push((k>>>4).toString(16));g.push((k&15).toString(16))}return g.join(\"\")},parse:function(b){for(var a=b.length,g=[],j=0;j>>3]|=parseInt(b.substr(j,\n2),16)<<24-4*(j%8);return new q.init(g,a/2)}},a=v.Latin1={stringify:function(b){var a=b.words;b=b.sigBytes;for(var g=[],j=0;j>>2]>>>24-8*(j%4)&255));return g.join(\"\")},parse:function(b){for(var a=b.length,g=[],j=0;j>>2]|=(b.charCodeAt(j)&255)<<24-8*(j%4);return new q.init(g,a)}},u=v.Utf8={stringify:function(b){try{return decodeURIComponent(escape(a.stringify(b)))}catch(g){throw Error(\"Malformed UTF-8 data\");}},parse:function(b){return a.parse(unescape(encodeURIComponent(b)))}},\ng=l.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(b){\"string\"==typeof b&&(b=u.parse(b));this._data.concat(b);this._nDataBytes+=b.sigBytes},_process:function(b){var a=this._data,g=a.words,j=a.sigBytes,k=this.blockSize,m=j/(4*k),m=b?s.ceil(m):s.max((m|0)-this._minBufferSize,0);b=m*k;j=s.min(4*b,j);if(b){for(var l=0;l>>32-j)+k}function m(a,k,b,h,l,j,m){a=a+(k&h|b&~h)+l+m;return(a<>>32-j)+k}function l(a,k,b,h,l,j,m){a=a+(k^b^h)+l+m;return(a<>>32-j)+k}function n(a,k,b,h,l,j,m){a=a+(b^(k|~h))+l+m;return(a<>>32-j)+k}for(var r=CryptoJS,q=r.lib,v=q.WordArray,t=q.Hasher,q=r.algo,a=[],u=0;64>u;u++)a[u]=4294967296*s.abs(s.sin(u+1))|0;q=q.MD5=t.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878])},\n_doProcessBlock:function(g,k){for(var b=0;16>b;b++){var h=k+b,w=g[h];g[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var b=this._hash.words,h=g[k+0],w=g[k+1],j=g[k+2],q=g[k+3],r=g[k+4],s=g[k+5],t=g[k+6],u=g[k+7],v=g[k+8],x=g[k+9],y=g[k+10],z=g[k+11],A=g[k+12],B=g[k+13],C=g[k+14],D=g[k+15],c=b[0],d=b[1],e=b[2],f=b[3],c=p(c,d,e,f,h,7,a[0]),f=p(f,c,d,e,w,12,a[1]),e=p(e,f,c,d,j,17,a[2]),d=p(d,e,f,c,q,22,a[3]),c=p(c,d,e,f,r,7,a[4]),f=p(f,c,d,e,s,12,a[5]),e=p(e,f,c,d,t,17,a[6]),d=p(d,e,f,c,u,22,a[7]),\nc=p(c,d,e,f,v,7,a[8]),f=p(f,c,d,e,x,12,a[9]),e=p(e,f,c,d,y,17,a[10]),d=p(d,e,f,c,z,22,a[11]),c=p(c,d,e,f,A,7,a[12]),f=p(f,c,d,e,B,12,a[13]),e=p(e,f,c,d,C,17,a[14]),d=p(d,e,f,c,D,22,a[15]),c=m(c,d,e,f,w,5,a[16]),f=m(f,c,d,e,t,9,a[17]),e=m(e,f,c,d,z,14,a[18]),d=m(d,e,f,c,h,20,a[19]),c=m(c,d,e,f,s,5,a[20]),f=m(f,c,d,e,y,9,a[21]),e=m(e,f,c,d,D,14,a[22]),d=m(d,e,f,c,r,20,a[23]),c=m(c,d,e,f,x,5,a[24]),f=m(f,c,d,e,C,9,a[25]),e=m(e,f,c,d,q,14,a[26]),d=m(d,e,f,c,v,20,a[27]),c=m(c,d,e,f,B,5,a[28]),f=m(f,c,\nd,e,j,9,a[29]),e=m(e,f,c,d,u,14,a[30]),d=m(d,e,f,c,A,20,a[31]),c=l(c,d,e,f,s,4,a[32]),f=l(f,c,d,e,v,11,a[33]),e=l(e,f,c,d,z,16,a[34]),d=l(d,e,f,c,C,23,a[35]),c=l(c,d,e,f,w,4,a[36]),f=l(f,c,d,e,r,11,a[37]),e=l(e,f,c,d,u,16,a[38]),d=l(d,e,f,c,y,23,a[39]),c=l(c,d,e,f,B,4,a[40]),f=l(f,c,d,e,h,11,a[41]),e=l(e,f,c,d,q,16,a[42]),d=l(d,e,f,c,t,23,a[43]),c=l(c,d,e,f,x,4,a[44]),f=l(f,c,d,e,A,11,a[45]),e=l(e,f,c,d,D,16,a[46]),d=l(d,e,f,c,j,23,a[47]),c=n(c,d,e,f,h,6,a[48]),f=n(f,c,d,e,u,10,a[49]),e=n(e,f,c,d,\nC,15,a[50]),d=n(d,e,f,c,s,21,a[51]),c=n(c,d,e,f,A,6,a[52]),f=n(f,c,d,e,q,10,a[53]),e=n(e,f,c,d,y,15,a[54]),d=n(d,e,f,c,w,21,a[55]),c=n(c,d,e,f,v,6,a[56]),f=n(f,c,d,e,D,10,a[57]),e=n(e,f,c,d,t,15,a[58]),d=n(d,e,f,c,B,21,a[59]),c=n(c,d,e,f,r,6,a[60]),f=n(f,c,d,e,z,10,a[61]),e=n(e,f,c,d,j,15,a[62]),d=n(d,e,f,c,x,21,a[63]);b[0]=b[0]+c|0;b[1]=b[1]+d|0;b[2]=b[2]+e|0;b[3]=b[3]+f|0},_doFinalize:function(){var a=this._data,k=a.words,b=8*this._nDataBytes,h=8*a.sigBytes;k[h>>>5]|=128<<24-h%32;var l=s.floor(b/\n4294967296);k[(h+64>>>9<<4)+15]=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360;k[(h+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;a.sigBytes=4*(k.length+1);this._process();a=this._hash;k=a.words;for(b=0;4>b;b++)h=k[b],k[b]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return a},clone:function(){var a=t.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=t._createHelper(q);r.HmacMD5=t._createHmacHelper(q)})(Math);\n"], "crypto_js.rollups.sha1": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(e,m){var p={},j=p.lib={},l=function(){},f=j.Base={extend:function(a){l.prototype=this;var c=new l;a&&c.mixIn(a);c.hasOwnProperty(\"init\")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\nn=j.WordArray=f.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=m?c:4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var c=this.words,q=a.words,d=this.sigBytes;a=a.sigBytes;this.clamp();if(d%4)for(var b=0;b>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((d+b)%4);else if(65535>>2]=q[b>>>2];else c.push.apply(c,q);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<\n32-8*(c%4);a.length=e.ceil(c/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b>>2]>>>24-8*(d%4)&255;b.push((f>>>4).toString(16));b.push((f&15).toString(16))}return b.join(\"\")},parse:function(a){for(var c=a.length,b=[],d=0;d>>3]|=parseInt(a.substr(d,\n2),16)<<24-4*(d%8);return new n.init(b,c/2)}},g=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],d=0;d>>2]>>>24-8*(d%4)&255));return b.join(\"\")},parse:function(a){for(var c=a.length,b=[],d=0;d>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return new n.init(b,c)}},r=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(g.stringify(a)))}catch(c){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return g.parse(unescape(encodeURIComponent(a)))}},\nk=j.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new n.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=r.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,b=c.words,d=c.sigBytes,f=this.blockSize,h=d/(4*f),h=a?e.ceil(h):e.max((h|0)-this._minBufferSize,0);a=h*f;d=e.min(4*a,d);if(a){for(var g=0;ga;a++){if(16>a)l[a]=f[n+a]|0;else{var c=l[a-3]^l[a-8]^l[a-14]^l[a-16];l[a]=c<<1|c>>>31}c=(h<<5|h>>>27)+j+l[a];c=20>a?c+((g&e|~g&k)+1518500249):40>a?c+((g^e^k)+1859775393):60>a?c+((g&e|g&k|e&k)-1894007588):c+((g^e^\nk)-899497514);j=k;k=e;e=g<<30|g>>>2;g=h;h=c}b[0]=b[0]+h|0;b[1]=b[1]+g|0;b[2]=b[2]+e|0;b[3]=b[3]+k|0;b[4]=b[4]+j|0},_doFinalize:function(){var f=this._data,e=f.words,b=8*this._nDataBytes,h=8*f.sigBytes;e[h>>>5]|=128<<24-h%32;e[(h+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(h+64>>>9<<4)+15]=b;f.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=j.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA1=j._createHelper(m);e.HmacSHA1=j._createHmacHelper(m)})();\n"], "crypto_js.rollups.sha224": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(g,l){var f={},k=f.lib={},h=function(){},m=k.Base={extend:function(a){h.prototype=this;var c=new h;a&&c.mixIn(a);c.hasOwnProperty(\"init\")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\nq=k.WordArray=m.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=l?c:4*a.length},toString:function(a){return(a||s).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<\n32-8*(c%4);a.length=g.ceil(c/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join(\"\")},parse:function(a){for(var c=a.length,d=[],b=0;b>>3]|=parseInt(a.substr(b,\n2),16)<<24-4*(b%8);return new q.init(d,c/2)}},n=t.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b>>2]>>>24-8*(b%4)&255));return d.join(\"\")},parse:function(a){for(var c=a.length,d=[],b=0;b>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new q.init(d,c)}},j=t.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(c){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}},\nw=k.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=j.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?g.ceil(f):g.max((f|0)-this._minBufferSize,0);a=f*e;b=g.min(4*a,b);if(a){for(var u=0;un;){var j;a:{j=s;for(var w=g.sqrt(j),v=2;v<=w;v++)if(!(j%v)){j=!1;break a}j=!0}j&&(8>n&&(m[n]=t(g.pow(s,0.5))),q[n]=t(g.pow(s,1/3)),n++);s++}var a=[],f=f.SHA256=h.extend({_doReset:function(){this._hash=new k.init(m.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],g=b[2],k=b[3],h=b[4],l=b[5],m=b[6],n=b[7],p=0;64>p;p++){if(16>p)a[p]=\nc[d+p]|0;else{var j=a[p-15],r=a[p-2];a[p]=((j<<25|j>>>7)^(j<<14|j>>>18)^j>>>3)+a[p-7]+((r<<15|r>>>17)^(r<<13|r>>>19)^r>>>10)+a[p-16]}j=n+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&l^~h&m)+q[p]+a[p];r=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&g^f&g);n=m;m=l;l=h;h=k+j|0;k=g;g=f;f=e;e=j+r|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+g|0;b[3]=b[3]+k|0;b[4]=b[4]+h|0;b[5]=b[5]+l|0;b[6]=b[6]+m|0;b[7]=b[7]+n|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;\nd[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=g.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=h.clone.call(this);a._hash=this._hash.clone();return a}});l.SHA256=h._createHelper(f);l.HmacSHA256=h._createHmacHelper(f)})(Math);\n(function(){var g=CryptoJS,l=g.lib.WordArray,f=g.algo,k=f.SHA256,f=f.SHA224=k.extend({_doReset:function(){this._hash=new l.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var f=k._doFinalize.call(this);f.sigBytes-=4;return f}});g.SHA224=k._createHelper(f);g.HmacSHA224=k._createHmacHelper(f)})();\n"], "crypto_js.rollups.sha256": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(h,s){var f={},t=f.lib={},g=function(){},j=t.Base={extend:function(a){g.prototype=this;var c=new g;a&&c.mixIn(a);c.hasOwnProperty(\"init\")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\nq=t.WordArray=j.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length},toString:function(a){return(a||u).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<\n32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=j.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join(\"\")},parse:function(a){for(var c=a.length,d=[],b=0;b>>3]|=parseInt(a.substr(b,\n2),16)<<24-4*(b%8);return new q.init(d,c/2)}},k=v.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b>>2]>>>24-8*(b%4)&255));return d.join(\"\")},parse:function(a){for(var c=a.length,d=[],b=0;b>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new q.init(d,c)}},l=v.Utf8={stringify:function(a){try{return decodeURIComponent(escape(k.stringify(a)))}catch(c){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return k.parse(unescape(encodeURIComponent(a)))}},\nx=t.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=l.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var m=0;mk;){var l;a:{l=u;for(var x=h.sqrt(l),w=2;w<=x;w++)if(!(l%w)){l=!1;break a}l=!0}l&&(8>k&&(j[k]=v(h.pow(u,0.5))),q[k]=v(h.pow(u,1/3)),k++);u++}var a=[],f=f.SHA256=g.extend({_doReset:function(){this._hash=new t.init(j.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],m=b[2],h=b[3],p=b[4],j=b[5],k=b[6],l=b[7],n=0;64>n;n++){if(16>n)a[n]=\nc[d+n]|0;else{var r=a[n-15],g=a[n-2];a[n]=((r<<25|r>>>7)^(r<<14|r>>>18)^r>>>3)+a[n-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+a[n-16]}r=l+((p<<26|p>>>6)^(p<<21|p>>>11)^(p<<7|p>>>25))+(p&j^~p&k)+q[n]+a[n];g=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&m^f&m);l=k;k=j;j=p;p=h+r|0;h=m;m=f;f=e;e=r+g|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+m|0;b[3]=b[3]+h|0;b[4]=b[4]+p|0;b[5]=b[5]+j|0;b[6]=b[6]+k|0;b[7]=b[7]+l|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;\nd[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=g.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=g._createHelper(f);s.HmacSHA256=g._createHmacHelper(f)})(Math);\n"], "crypto_js.rollups.sha3": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(v,p){var d={},u=d.lib={},r=function(){},f=u.Base={extend:function(a){r.prototype=this;var b=new r;a&&b.mixIn(a);b.hasOwnProperty(\"init\")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\ns=u.WordArray=f.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=p?b:4*a.length},toString:function(a){return(a||y).stringify(this)},concat:function(a){var b=this.words,c=a.words,j=this.sigBytes;a=a.sigBytes;this.clamp();if(j%4)for(var n=0;n>>2]|=(c[n>>>2]>>>24-8*(n%4)&255)<<24-8*((j+n)%4);else if(65535>>2]=c[n>>>2];else b.push.apply(b,c);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<\n32-8*(b%4);a.length=v.ceil(b/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],c=0;c>>2]>>>24-8*(j%4)&255;c.push((n>>>4).toString(16));c.push((n&15).toString(16))}return c.join(\"\")},parse:function(a){for(var b=a.length,c=[],j=0;j>>3]|=parseInt(a.substr(j,\n2),16)<<24-4*(j%8);return new s.init(c,b/2)}},e=x.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],j=0;j>>2]>>>24-8*(j%4)&255));return c.join(\"\")},parse:function(a){for(var b=a.length,c=[],j=0;j>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new s.init(c,b)}},q=x.Utf8={stringify:function(a){try{return decodeURIComponent(escape(e.stringify(a)))}catch(b){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return e.parse(unescape(encodeURIComponent(a)))}},\nt=u.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new s.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=q.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,c=b.words,j=b.sigBytes,n=this.blockSize,e=j/(4*n),e=a?v.ceil(e):v.max((e|0)-this._minBufferSize,0);a=e*n;j=v.min(4*a,j);if(a){for(var f=0;ft;t++){s[e+5*q]=(t+1)*(t+2)/2%64;var w=(2*e+3*q)%5,e=q%5,q=w}for(e=0;5>e;e++)for(q=0;5>q;q++)x[e+5*q]=q+5*((2*e+3*q)%5);e=1;for(q=0;24>q;q++){for(var a=w=t=0;7>a;a++){if(e&1){var b=(1<b?w^=1<e;e++)c[e]=f.create();d=d.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var a=this._state=\n[],b=0;25>b;b++)a[b]=new f.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(a,b){for(var e=this._state,f=this.blockSize/2,h=0;h>>24)&16711935|(l<<24|l>>>8)&4278255360,m=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360,g=e[h];g.high^=m;g.low^=l}for(f=0;24>f;f++){for(h=0;5>h;h++){for(var d=l=0,k=0;5>k;k++)g=e[h+5*k],l^=g.high,d^=g.low;g=c[h];g.high=l;g.low=d}for(h=0;5>h;h++){g=c[(h+4)%5];l=c[(h+1)%5];m=l.high;k=l.low;l=g.high^\n(m<<1|k>>>31);d=g.low^(k<<1|m>>>31);for(k=0;5>k;k++)g=e[h+5*k],g.high^=l,g.low^=d}for(m=1;25>m;m++)g=e[m],h=g.high,g=g.low,k=s[m],32>k?(l=h<>>32-k,d=g<>>32-k):(l=g<>>64-k,d=h<>>64-k),g=c[x[m]],g.high=l,g.low=d;g=c[0];h=e[0];g.high=h.high;g.low=h.low;for(h=0;5>h;h++)for(k=0;5>k;k++)m=h+5*k,g=e[m],l=c[m],m=c[(h+1)%5+5*k],d=c[(h+2)%5+5*k],g.high=l.high^~m.high&d.high,g.low=l.low^~m.low&d.low;g=e[0];h=y[f];g.high^=h.high;g.low^=h.low}},_doFinalize:function(){var a=this._data,\nb=a.words,c=8*a.sigBytes,e=32*this.blockSize;b[c>>>5]|=1<<24-c%32;b[(v.ceil((c+1)/e)*e>>>5)-1]|=128;a.sigBytes=4*b.length;this._process();for(var a=this._state,b=this.cfg.outputLength/8,c=b/8,e=[],h=0;h>>24)&16711935|(f<<24|f>>>8)&4278255360,d=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;e.push(d);e.push(f)}return new u.init(e,b)},clone:function(){for(var a=r.clone.call(this),b=a._state=this._state.slice(0),c=0;25>c;c++)b[c]=b[c].clone();return a}});\np.SHA3=r._createHelper(d);p.HmacSHA3=r._createHmacHelper(d)})(Math);\n"], "crypto_js.rollups.sha384": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(a,c){var d={},j=d.lib={},f=function(){},m=j.Base={extend:function(a){f.prototype=this;var b=new f;a&&b.mixIn(a);b.hasOwnProperty(\"init\")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\nB=j.WordArray=m.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=c?b:4*a.length},toString:function(a){return(a||y).stringify(this)},concat:function(a){var b=this.words,g=a.words,e=this.sigBytes;a=a.sigBytes;this.clamp();if(e%4)for(var k=0;k>>2]|=(g[k>>>2]>>>24-8*(k%4)&255)<<24-8*((e+k)%4);else if(65535>>2]=g[k>>>2];else b.push.apply(b,g);this.sigBytes+=a;return this},clamp:function(){var n=this.words,b=this.sigBytes;n[b>>>2]&=4294967295<<\n32-8*(b%4);n.length=a.ceil(b/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(n){for(var b=[],g=0;g>>2]>>>24-8*(e%4)&255;g.push((k>>>4).toString(16));g.push((k&15).toString(16))}return g.join(\"\")},parse:function(a){for(var b=a.length,g=[],e=0;e>>3]|=parseInt(a.substr(e,\n2),16)<<24-4*(e%8);return new B.init(g,b/2)}},F=v.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var g=[],e=0;e>>2]>>>24-8*(e%4)&255));return g.join(\"\")},parse:function(a){for(var b=a.length,g=[],e=0;e>>2]|=(a.charCodeAt(e)&255)<<24-8*(e%4);return new B.init(g,b)}},ha=v.Utf8={stringify:function(a){try{return decodeURIComponent(escape(F.stringify(a)))}catch(b){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return F.parse(unescape(encodeURIComponent(a)))}},\nZ=j.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new B.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=ha.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(n){var b=this._data,g=b.words,e=b.sigBytes,k=this.blockSize,m=e/(4*k),m=n?a.ceil(m):a.max((m|0)-this._minBufferSize,0);n=m*k;e=a.min(4*n,e);if(n){for(var c=0;cy;y++)v[y]=a();j=j.SHA512=d.extend({_doReset:function(){this._hash=new m.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(a,c){for(var d=this._hash.words,\nf=d[0],j=d[1],b=d[2],g=d[3],e=d[4],k=d[5],m=d[6],d=d[7],y=f.high,M=f.low,$=j.high,N=j.low,aa=b.high,O=b.low,ba=g.high,P=g.low,ca=e.high,Q=e.low,da=k.high,R=k.low,ea=m.high,S=m.low,fa=d.high,T=d.low,s=y,p=M,G=$,D=N,H=aa,E=O,W=ba,I=P,t=ca,q=Q,U=da,J=R,V=ea,K=S,X=fa,L=T,u=0;80>u;u++){var z=v[u];if(16>u)var r=z.high=a[c+2*u]|0,h=z.low=a[c+2*u+1]|0;else{var r=v[u-15],h=r.high,w=r.low,r=(h>>>1|w<<31)^(h>>>8|w<<24)^h>>>7,w=(w>>>1|h<<31)^(w>>>8|h<<24)^(w>>>7|h<<25),C=v[u-2],h=C.high,l=C.low,C=(h>>>19|l<<\n13)^(h<<3|l>>>29)^h>>>6,l=(l>>>19|h<<13)^(l<<3|h>>>29)^(l>>>6|h<<26),h=v[u-7],Y=h.high,A=v[u-16],x=A.high,A=A.low,h=w+h.low,r=r+Y+(h>>>0>>0?1:0),h=h+l,r=r+C+(h>>>0>>0?1:0),h=h+A,r=r+x+(h>>>0>>0?1:0);z.high=r;z.low=h}var Y=t&U^~t&V,A=q&J^~q&K,z=s&G^s&H^G&H,ja=p&D^p&E^D&E,w=(s>>>28|p<<4)^(s<<30|p>>>2)^(s<<25|p>>>7),C=(p>>>28|s<<4)^(p<<30|s>>>2)^(p<<25|s>>>7),l=B[u],ka=l.high,ga=l.low,l=L+((q>>>14|t<<18)^(q>>>18|t<<14)^(q<<23|t>>>9)),x=X+((t>>>14|q<<18)^(t>>>18|q<<14)^(t<<23|q>>>9))+(l>>>0<\nL>>>0?1:0),l=l+A,x=x+Y+(l>>>0>>0?1:0),l=l+ga,x=x+ka+(l>>>0>>0?1:0),l=l+h,x=x+r+(l>>>0>>0?1:0),h=C+ja,z=w+z+(h>>>0>>0?1:0),X=V,L=K,V=U,K=J,U=t,J=q,q=I+l|0,t=W+x+(q>>>0>>0?1:0)|0,W=H,I=E,H=G,E=D,G=s,D=p,p=l+h|0,s=x+z+(p>>>0>>0?1:0)|0}M=f.low=M+p;f.high=y+s+(M>>>0

>>0?1:0);N=j.low=N+D;j.high=$+G+(N>>>0>>0?1:0);O=b.low=O+E;b.high=aa+H+(O>>>0>>0?1:0);P=g.low=P+I;g.high=ba+W+(P>>>0>>0?1:0);Q=e.low=Q+q;e.high=ca+t+(Q>>>0>>0?1:0);R=k.low=R+J;k.high=da+U+(R>>>0>>0?1:0);\nS=m.low=S+K;m.high=ea+V+(S>>>0>>0?1:0);T=d.low=T+L;d.high=fa+X+(T>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,c=a.words,d=8*this._nDataBytes,f=8*a.sigBytes;c[f>>>5]|=128<<24-f%32;c[(f+128>>>10<<5)+30]=Math.floor(d/4294967296);c[(f+128>>>10<<5)+31]=d;a.sigBytes=4*c.length;this._process();return this._hash.toX32()},clone:function(){var a=d.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});c.SHA512=d._createHelper(j);c.HmacSHA512=d._createHmacHelper(j)})();\n(function(){var a=CryptoJS,c=a.x64,d=c.Word,j=c.WordArray,c=a.algo,f=c.SHA512,c=c.SHA384=f.extend({_doReset:function(){this._hash=new j.init([new d.init(3418070365,3238371032),new d.init(1654270250,914150663),new d.init(2438529370,812702999),new d.init(355462360,4144912697),new d.init(1731405415,4290775857),new d.init(2394180231,1750603025),new d.init(3675008525,1694076839),new d.init(1203062813,3204075428)])},_doFinalize:function(){var a=f._doFinalize.call(this);a.sigBytes-=16;return a}});a.SHA384=\nf._createHelper(c);a.HmacSHA384=f._createHmacHelper(c)})();\n"], "crypto_js.rollups.sha512": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(a,m){var r={},f=r.lib={},g=function(){},l=f.Base={extend:function(a){g.prototype=this;var b=new g;a&&b.mixIn(a);b.hasOwnProperty(\"init\")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\np=f.WordArray=l.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=m?b:4*a.length},toString:function(a){return(a||q).stringify(this)},concat:function(a){var b=this.words,d=a.words,c=this.sigBytes;a=a.sigBytes;this.clamp();if(c%4)for(var j=0;j>>2]|=(d[j>>>2]>>>24-8*(j%4)&255)<<24-8*((c+j)%4);else if(65535>>2]=d[j>>>2];else b.push.apply(b,d);this.sigBytes+=a;return this},clamp:function(){var n=this.words,b=this.sigBytes;n[b>>>2]&=4294967295<<\n32-8*(b%4);n.length=a.ceil(b/4)},clone:function(){var a=l.clone.call(this);a.words=this.words.slice(0);return a},random:function(n){for(var b=[],d=0;d>>2]>>>24-8*(c%4)&255;d.push((j>>>4).toString(16));d.push((j&15).toString(16))}return d.join(\"\")},parse:function(a){for(var b=a.length,d=[],c=0;c>>3]|=parseInt(a.substr(c,\n2),16)<<24-4*(c%8);return new p.init(d,b/2)}},G=y.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c>>2]>>>24-8*(c%4)&255));return d.join(\"\")},parse:function(a){for(var b=a.length,d=[],c=0;c>>2]|=(a.charCodeAt(c)&255)<<24-8*(c%4);return new p.init(d,b)}},fa=y.Utf8={stringify:function(a){try{return decodeURIComponent(escape(G.stringify(a)))}catch(b){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return G.parse(unescape(encodeURIComponent(a)))}},\nh=f.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new p.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=fa.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(n){var b=this._data,d=b.words,c=b.sigBytes,j=this.blockSize,l=c/(4*j),l=n?a.ceil(l):a.max((l|0)-this._minBufferSize,0);n=l*j;c=a.min(4*n,c);if(n){for(var h=0;hq;q++)y[q]=a();f=f.SHA512=r.extend({_doReset:function(){this._hash=new l.init([new g.init(1779033703,4089235720),new g.init(3144134277,2227873595),new g.init(1013904242,4271175723),new g.init(2773480762,1595750129),new g.init(1359893119,2917565137),new g.init(2600822924,725511199),new g.init(528734635,4215389547),new g.init(1541459225,327033209)])},_doProcessBlock:function(a,f){for(var h=this._hash.words,\ng=h[0],n=h[1],b=h[2],d=h[3],c=h[4],j=h[5],l=h[6],h=h[7],q=g.high,m=g.low,r=n.high,N=n.low,Z=b.high,O=b.low,$=d.high,P=d.low,aa=c.high,Q=c.low,ba=j.high,R=j.low,ca=l.high,S=l.low,da=h.high,T=h.low,v=q,s=m,H=r,E=N,I=Z,F=O,W=$,J=P,w=aa,t=Q,U=ba,K=R,V=ca,L=S,X=da,M=T,x=0;80>x;x++){var B=y[x];if(16>x)var u=B.high=a[f+2*x]|0,e=B.low=a[f+2*x+1]|0;else{var u=y[x-15],e=u.high,z=u.low,u=(e>>>1|z<<31)^(e>>>8|z<<24)^e>>>7,z=(z>>>1|e<<31)^(z>>>8|e<<24)^(z>>>7|e<<25),D=y[x-2],e=D.high,k=D.low,D=(e>>>19|k<<13)^\n(e<<3|k>>>29)^e>>>6,k=(k>>>19|e<<13)^(k<<3|e>>>29)^(k>>>6|e<<26),e=y[x-7],Y=e.high,C=y[x-16],A=C.high,C=C.low,e=z+e.low,u=u+Y+(e>>>0>>0?1:0),e=e+k,u=u+D+(e>>>0>>0?1:0),e=e+C,u=u+A+(e>>>0>>0?1:0);B.high=u;B.low=e}var Y=w&U^~w&V,C=t&K^~t&L,B=v&H^v&I^H&I,ha=s&E^s&F^E&F,z=(v>>>28|s<<4)^(v<<30|s>>>2)^(v<<25|s>>>7),D=(s>>>28|v<<4)^(s<<30|v>>>2)^(s<<25|v>>>7),k=p[x],ia=k.high,ea=k.low,k=M+((t>>>14|w<<18)^(t>>>18|w<<14)^(t<<23|w>>>9)),A=X+((w>>>14|t<<18)^(w>>>18|t<<14)^(w<<23|t>>>9))+(k>>>0>>\n0?1:0),k=k+C,A=A+Y+(k>>>0>>0?1:0),k=k+ea,A=A+ia+(k>>>0>>0?1:0),k=k+e,A=A+u+(k>>>0>>0?1:0),e=D+ha,B=z+B+(e>>>0>>0?1:0),X=V,M=L,V=U,L=K,U=w,K=t,t=J+k|0,w=W+A+(t>>>0>>0?1:0)|0,W=I,J=F,I=H,F=E,H=v,E=s,s=k+e|0,v=A+B+(s>>>0>>0?1:0)|0}m=g.low=m+s;g.high=q+v+(m>>>0>>0?1:0);N=n.low=N+E;n.high=r+H+(N>>>0>>0?1:0);O=b.low=O+F;b.high=Z+I+(O>>>0>>0?1:0);P=d.low=P+J;d.high=$+W+(P>>>0>>0?1:0);Q=c.low=Q+t;c.high=aa+w+(Q>>>0>>0?1:0);R=j.low=R+K;j.high=ba+U+(R>>>0>>0?1:0);S=l.low=\nS+L;l.high=ca+V+(S>>>0>>0?1:0);T=h.low=T+M;h.high=da+X+(T>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,f=a.words,h=8*this._nDataBytes,g=8*a.sigBytes;f[g>>>5]|=128<<24-g%32;f[(g+128>>>10<<5)+30]=Math.floor(h/4294967296);f[(g+128>>>10<<5)+31]=h;a.sigBytes=4*f.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});m.SHA512=r._createHelper(f);m.HmacSHA512=r._createHmacHelper(f)})();\n"], "abc": [".py", "\n\n\n\"\"\"Abstract Base Classes (ABCs) according to PEP 3119.\"\"\"\n\n\ndef abstractmethod(funcobj):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n funcobj.__isabstractmethod__=True\n return funcobj\n \n \nclass abstractclassmethod(classmethod):\n ''\n\n\n\n\n\n\n\n\n\n \n \n __isabstractmethod__=True\n \n def __init__(self,callable):\n callable.__isabstractmethod__=True\n super().__init__(callable)\n \n \nclass abstractstaticmethod(staticmethod):\n ''\n\n\n\n\n\n\n\n\n\n \n \n __isabstractmethod__=True\n \n def __init__(self,callable):\n callable.__isabstractmethod__=True\n super().__init__(callable)\n \n \nclass abstractproperty(property):\n ''\n\n\n\n\n\n\n\n\n\n \n \n __isabstractmethod__=True\n \n \ntry:\n from _abc import(get_cache_token,_abc_init,_abc_register,\n _abc_instancecheck,_abc_subclasscheck,_get_dump,\n _reset_registry,_reset_caches)\nexcept ImportError:\n from _py_abc import ABCMeta,get_cache_token\n ABCMeta.__module__='abc'\nelse:\n class ABCMeta(type):\n ''\n\n\n\n\n\n\n\n\n\n\n \n def __new__(mcls,name,bases,namespace,/,**kwargs):\n cls=super().__new__(mcls,name,bases,namespace,**kwargs)\n _abc_init(cls)\n return cls\n \n def register(cls,subclass):\n ''\n\n\n \n return _abc_register(cls,subclass)\n \n def __instancecheck__(cls,instance):\n ''\n return _abc_instancecheck(cls,instance)\n \n def __subclasscheck__(cls,subclass):\n ''\n return _abc_subclasscheck(cls,subclass)\n \n def _dump_registry(cls,file=None):\n ''\n print(f\"Class: {cls.__module__}.{cls.__qualname__}\",file=file)\n print(f\"Inv. counter: {get_cache_token()}\",file=file)\n (_abc_registry,_abc_cache,_abc_negative_cache,\n _abc_negative_cache_version)=_get_dump(cls)\n print(f\"_abc_registry: {_abc_registry !r}\",file=file)\n print(f\"_abc_cache: {_abc_cache !r}\",file=file)\n print(f\"_abc_negative_cache: {_abc_negative_cache !r}\",file=file)\n print(f\"_abc_negative_cache_version: {_abc_negative_cache_version !r}\",\n file=file)\n \n def _abc_registry_clear(cls):\n ''\n _reset_registry(cls)\n \n def _abc_caches_clear(cls):\n ''\n _reset_caches(cls)\n \n \ndef update_abstractmethods(cls):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not hasattr(cls,'__abstractmethods__'):\n \n \n \n return cls\n \n abstracts=set()\n \n \n for scls in cls.__bases__:\n for name in getattr(scls,'__abstractmethods__',()):\n value=getattr(cls,name,None)\n if getattr(value,\"__isabstractmethod__\",False):\n abstracts.add(name)\n \n for name,value in cls.__dict__.items():\n if getattr(value,\"__isabstractmethod__\",False):\n abstracts.add(name)\n cls.__abstractmethods__=frozenset(abstracts)\n return cls\n \n \nclass ABC(metaclass=ABCMeta):\n ''\n\n \n __slots__=()\n", ["_abc", "_py_abc"]], "antigravity": [".py", "\nimport webbrowser\nimport hashlib\n\nwebbrowser.open(\"https://xkcd.com/353/\")\n\ndef geohash(latitude,longitude,datedow):\n ''\n\n\n\n\n \n \n h=hashlib.md5(datedow,usedforsecurity=False ).hexdigest()\n p,q=[('%f'%float.fromhex('0.'+x))for x in (h[:16],h[16:32])]\n print('%d%s %d%s'%(latitude,p[1:],longitude,q[1:]))\n", ["hashlib", "webbrowser"]], "argparse": [".py", "\n\n\n\"\"\"Command-line parsing library\n\nThis module is an optparse-inspired command-line parsing library that:\n\n - handles both optional and positional arguments\n - produces highly informative usage messages\n - supports parsers that dispatch to sub-parsers\n\nThe following is a simple usage example that sums integers from the\ncommand-line and writes the result to a file::\n\n parser = argparse.ArgumentParser(\n description='sum the integers at the command line')\n parser.add_argument(\n 'integers', metavar='int', nargs='+', type=int,\n help='an integer to be summed')\n parser.add_argument(\n '--log', default=sys.stdout, type=argparse.FileType('w'),\n help='the file where the sum should be written')\n args = parser.parse_args()\n args.log.write('%s' % sum(args.integers))\n args.log.close()\n\nThe module contains the following public classes:\n\n - ArgumentParser -- The main entry point for command-line parsing. As the\n example above shows, the add_argument() method is used to populate\n the parser with actions for optional and positional arguments. Then\n the parse_args() method is invoked to convert the args at the\n command-line into an object with attributes.\n\n - ArgumentError -- The exception raised by ArgumentParser objects when\n there are errors with the parser's actions. Errors raised while\n parsing the command-line are caught by ArgumentParser and emitted\n as command-line messages.\n\n - FileType -- A factory for defining types of files to be created. As the\n example above shows, instances of FileType are typically passed as\n the type= argument of add_argument() calls.\n\n - Action -- The base class for parser actions. Typically actions are\n selected by passing strings like 'store_true' or 'append_const' to\n the action= argument of add_argument(). However, for greater\n customization of ArgumentParser actions, subclasses of Action may\n be defined and passed as the action= argument.\n\n - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,\n ArgumentDefaultsHelpFormatter -- Formatter classes which\n may be passed as the formatter_class= argument to the\n ArgumentParser constructor. HelpFormatter is the default,\n RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser\n not to change the formatting for help text, and\n ArgumentDefaultsHelpFormatter adds information about argument defaults\n to the help.\n\nAll other classes in this module are considered implementation details.\n(Also note that HelpFormatter and RawDescriptionHelpFormatter are only\nconsidered public as object names -- the API of the formatter objects is\nstill considered an implementation detail.)\n\"\"\"\n\n__version__='1.1'\n__all__=[\n'ArgumentParser',\n'ArgumentError',\n'ArgumentTypeError',\n'BooleanOptionalAction',\n'FileType',\n'HelpFormatter',\n'ArgumentDefaultsHelpFormatter',\n'RawDescriptionHelpFormatter',\n'RawTextHelpFormatter',\n'MetavarTypeHelpFormatter',\n'Namespace',\n'Action',\n'ONE_OR_MORE',\n'OPTIONAL',\n'PARSER',\n'REMAINDER',\n'SUPPRESS',\n'ZERO_OR_MORE',\n]\n\n\nimport os as _os\nimport re as _re\nimport sys as _sys\n\nimport warnings\n\nfrom gettext import gettext as _,ngettext\n\nSUPPRESS='==SUPPRESS=='\n\nOPTIONAL='?'\nZERO_OR_MORE='*'\nONE_OR_MORE='+'\nPARSER='A...'\nREMAINDER='...'\n_UNRECOGNIZED_ARGS_ATTR='_unrecognized_args'\n\n\n\n\n\nclass _AttributeHolder(object):\n ''\n\n\n\n\n\n \n \n def __repr__(self):\n type_name=type(self).__name__\n arg_strings=[]\n star_args={}\n for arg in self._get_args():\n arg_strings.append(repr(arg))\n for name,value in self._get_kwargs():\n if name.isidentifier():\n arg_strings.append('%s=%r'%(name,value))\n else:\n star_args[name]=value\n if star_args:\n arg_strings.append('**%s'%repr(star_args))\n return '%s(%s)'%(type_name,', '.join(arg_strings))\n \n def _get_kwargs(self):\n return list(self.__dict__.items())\n \n def _get_args(self):\n return[]\n \n \ndef _copy_items(items):\n if items is None:\n return[]\n \n \n \n if type(items)is list:\n return items[:]\n import copy\n return copy.copy(items)\n \n \n \n \n \n \n \nclass HelpFormatter(object):\n ''\n\n\n\n \n \n def __init__(self,\n prog,\n indent_increment=2,\n max_help_position=24,\n width=None):\n \n \n if width is None:\n import shutil\n width=shutil.get_terminal_size().columns\n width -=2\n \n self._prog=prog\n self._indent_increment=indent_increment\n self._max_help_position=min(max_help_position,\n max(width -20,indent_increment *2))\n self._width=width\n \n self._current_indent=0\n self._level=0\n self._action_max_length=0\n \n self._root_section=self._Section(self,None)\n self._current_section=self._root_section\n \n self._whitespace_matcher=_re.compile(r'\\s+',_re.ASCII)\n self._long_break_matcher=_re.compile(r'\\n\\n\\n+')\n \n \n \n \n def _indent(self):\n self._current_indent +=self._indent_increment\n self._level +=1\n \n def _dedent(self):\n self._current_indent -=self._indent_increment\n assert self._current_indent >=0,'Indent decreased below 0.'\n self._level -=1\n \n class _Section(object):\n \n def __init__(self,formatter,parent,heading=None):\n self.formatter=formatter\n self.parent=parent\n self.heading=heading\n self.items=[]\n \n def format_help(self):\n \n if self.parent is not None:\n self.formatter._indent()\n join=self.formatter._join_parts\n item_help=join([func(*args)for func,args in self.items])\n if self.parent is not None:\n self.formatter._dedent()\n \n \n if not item_help:\n return ''\n \n \n if self.heading is not SUPPRESS and self.heading is not None:\n current_indent=self.formatter._current_indent\n heading='%*s%s:\\n'%(current_indent,'',self.heading)\n else:\n heading=''\n \n \n return join(['\\n',heading,item_help,'\\n'])\n \n def _add_item(self,func,args):\n self._current_section.items.append((func,args))\n \n \n \n \n def start_section(self,heading):\n self._indent()\n section=self._Section(self,self._current_section,heading)\n self._add_item(section.format_help,[])\n self._current_section=section\n \n def end_section(self):\n self._current_section=self._current_section.parent\n self._dedent()\n \n def add_text(self,text):\n if text is not SUPPRESS and text is not None:\n self._add_item(self._format_text,[text])\n \n def add_usage(self,usage,actions,groups,prefix=None):\n if usage is not SUPPRESS:\n args=usage,actions,groups,prefix\n self._add_item(self._format_usage,args)\n \n def add_argument(self,action):\n if action.help is not SUPPRESS:\n \n \n get_invocation=self._format_action_invocation\n invocations=[get_invocation(action)]\n for subaction in self._iter_indented_subactions(action):\n invocations.append(get_invocation(subaction))\n \n \n invocation_length=max(map(len,invocations))\n action_length=invocation_length+self._current_indent\n self._action_max_length=max(self._action_max_length,\n action_length)\n \n \n self._add_item(self._format_action,[action])\n \n def add_arguments(self,actions):\n for action in actions:\n self.add_argument(action)\n \n \n \n \n def format_help(self):\n help=self._root_section.format_help()\n if help:\n help=self._long_break_matcher.sub('\\n\\n',help)\n help=help.strip('\\n')+'\\n'\n return help\n \n def _join_parts(self,part_strings):\n return ''.join([part\n for part in part_strings\n if part and part is not SUPPRESS])\n \n def _format_usage(self,usage,actions,groups,prefix):\n if prefix is None:\n prefix=_('usage: ')\n \n \n if usage is not None:\n usage=usage %dict(prog=self._prog)\n \n \n elif usage is None and not actions:\n usage='%(prog)s'%dict(prog=self._prog)\n \n \n elif usage is None:\n prog='%(prog)s'%dict(prog=self._prog)\n \n \n optionals=[]\n positionals=[]\n for action in actions:\n if action.option_strings:\n optionals.append(action)\n else:\n positionals.append(action)\n \n \n format=self._format_actions_usage\n action_usage=format(optionals+positionals,groups)\n usage=' '.join([s for s in[prog,action_usage]if s])\n \n \n text_width=self._width -self._current_indent\n if len(prefix)+len(usage)>text_width:\n \n \n part_regexp=(\n r'\\(.*?\\)+(?=\\s|$)|'\n r'\\[.*?\\]+(?=\\s|$)|'\n r'\\S+'\n )\n opt_usage=format(optionals,groups)\n pos_usage=format(positionals,groups)\n opt_parts=_re.findall(part_regexp,opt_usage)\n pos_parts=_re.findall(part_regexp,pos_usage)\n assert ' '.join(opt_parts)==opt_usage\n assert ' '.join(pos_parts)==pos_usage\n \n \n def get_lines(parts,indent,prefix=None):\n lines=[]\n line=[]\n indent_length=len(indent)\n if prefix is not None:\n line_len=len(prefix)-1\n else:\n line_len=indent_length -1\n for part in parts:\n if line_len+1+len(part)>text_width and line:\n lines.append(indent+' '.join(line))\n line=[]\n line_len=indent_length -1\n line.append(part)\n line_len +=len(part)+1\n if line:\n lines.append(indent+' '.join(line))\n if prefix is not None:\n lines[0]=lines[0][indent_length:]\n return lines\n \n \n if len(prefix)+len(prog)<=0.75 *text_width:\n indent=' '*(len(prefix)+len(prog)+1)\n if opt_parts:\n lines=get_lines([prog]+opt_parts,indent,prefix)\n lines.extend(get_lines(pos_parts,indent))\n elif pos_parts:\n lines=get_lines([prog]+pos_parts,indent,prefix)\n else:\n lines=[prog]\n \n \n else:\n indent=' '*len(prefix)\n parts=opt_parts+pos_parts\n lines=get_lines(parts,indent)\n if len(lines)>1:\n lines=[]\n lines.extend(get_lines(opt_parts,indent))\n lines.extend(get_lines(pos_parts,indent))\n lines=[prog]+lines\n \n \n usage='\\n'.join(lines)\n \n \n return '%s%s\\n\\n'%(prefix,usage)\n \n def _format_actions_usage(self,actions,groups):\n \n group_actions=set()\n inserts={}\n for group in groups:\n if not group._group_actions:\n raise ValueError(f'empty group {group}')\n \n try:\n start=actions.index(group._group_actions[0])\n except ValueError:\n continue\n else:\n group_action_count=len(group._group_actions)\n end=start+group_action_count\n if actions[start:end]==group._group_actions:\n \n suppressed_actions_count=0\n for action in group._group_actions:\n group_actions.add(action)\n if action.help is SUPPRESS:\n suppressed_actions_count +=1\n \n exposed_actions_count=group_action_count -suppressed_actions_count\n \n if not group.required:\n if start in inserts:\n inserts[start]+=' ['\n else:\n inserts[start]='['\n if end in inserts:\n inserts[end]+=']'\n else:\n inserts[end]=']'\n elif exposed_actions_count >1:\n if start in inserts:\n inserts[start]+=' ('\n else:\n inserts[start]='('\n if end in inserts:\n inserts[end]+=')'\n else:\n inserts[end]=')'\n for i in range(start+1,end):\n inserts[i]='|'\n \n \n parts=[]\n for i,action in enumerate(actions):\n \n \n \n if action.help is SUPPRESS:\n parts.append(None)\n if inserts.get(i)=='|':\n inserts.pop(i)\n elif inserts.get(i+1)=='|':\n inserts.pop(i+1)\n \n \n elif not action.option_strings:\n default=self._get_default_metavar_for_positional(action)\n part=self._format_args(action,default)\n \n \n if action in group_actions:\n if part[0]=='['and part[-1]==']':\n part=part[1:-1]\n \n \n parts.append(part)\n \n \n else:\n option_string=action.option_strings[0]\n \n \n \n if action.nargs ==0:\n part=action.format_usage()\n \n \n \n else:\n default=self._get_default_metavar_for_optional(action)\n args_string=self._format_args(action,default)\n part='%s %s'%(option_string,args_string)\n \n \n if not action.required and action not in group_actions:\n part='[%s]'%part\n \n \n parts.append(part)\n \n \n for i in sorted(inserts,reverse=True):\n parts[i:i]=[inserts[i]]\n \n \n text=' '.join([item for item in parts if item is not None])\n \n \n open=r'[\\[(]'\n close=r'[\\])]'\n text=_re.sub(r'(%s) '%open,r'\\1',text)\n text=_re.sub(r' (%s)'%close,r'\\1',text)\n text=_re.sub(r'%s *%s'%(open,close),r'',text)\n text=text.strip()\n \n \n return text\n \n def _format_text(self,text):\n if '%(prog)'in text:\n text=text %dict(prog=self._prog)\n text_width=max(self._width -self._current_indent,11)\n indent=' '*self._current_indent\n return self._fill_text(text,text_width,indent)+'\\n\\n'\n \n def _format_action(self,action):\n \n help_position=min(self._action_max_length+2,\n self._max_help_position)\n help_width=max(self._width -help_position,11)\n action_width=help_position -self._current_indent -2\n action_header=self._format_action_invocation(action)\n \n \n if not action.help:\n tup=self._current_indent,'',action_header\n action_header='%*s%s\\n'%tup\n \n \n elif len(action_header)<=action_width:\n tup=self._current_indent,'',action_width,action_header\n action_header='%*s%-*s '%tup\n indent_first=0\n \n \n else:\n tup=self._current_indent,'',action_header\n action_header='%*s%s\\n'%tup\n indent_first=help_position\n \n \n parts=[action_header]\n \n \n if action.help and action.help.strip():\n help_text=self._expand_help(action)\n if help_text:\n help_lines=self._split_lines(help_text,help_width)\n parts.append('%*s%s\\n'%(indent_first,'',help_lines[0]))\n for line in help_lines[1:]:\n parts.append('%*s%s\\n'%(help_position,'',line))\n \n \n elif not action_header.endswith('\\n'):\n parts.append('\\n')\n \n \n for subaction in self._iter_indented_subactions(action):\n parts.append(self._format_action(subaction))\n \n \n return self._join_parts(parts)\n \n def _format_action_invocation(self,action):\n if not action.option_strings:\n default=self._get_default_metavar_for_positional(action)\n metavar,=self._metavar_formatter(action,default)(1)\n return metavar\n \n else:\n parts=[]\n \n \n \n if action.nargs ==0:\n parts.extend(action.option_strings)\n \n \n \n else:\n default=self._get_default_metavar_for_optional(action)\n args_string=self._format_args(action,default)\n for option_string in action.option_strings:\n parts.append('%s %s'%(option_string,args_string))\n \n return ', '.join(parts)\n \n def _metavar_formatter(self,action,default_metavar):\n if action.metavar is not None:\n result=action.metavar\n elif action.choices is not None:\n choice_strs=[str(choice)for choice in action.choices]\n result='{%s}'%','.join(choice_strs)\n else:\n result=default_metavar\n \n def format(tuple_size):\n if isinstance(result,tuple):\n return result\n else:\n return(result,)*tuple_size\n return format\n \n def _format_args(self,action,default_metavar):\n get_metavar=self._metavar_formatter(action,default_metavar)\n if action.nargs is None:\n result='%s'%get_metavar(1)\n elif action.nargs ==OPTIONAL:\n result='[%s]'%get_metavar(1)\n elif action.nargs ==ZERO_OR_MORE:\n metavar=get_metavar(1)\n if len(metavar)==2:\n result='[%s [%s ...]]'%metavar\n else:\n result='[%s ...]'%metavar\n elif action.nargs ==ONE_OR_MORE:\n result='%s [%s ...]'%get_metavar(2)\n elif action.nargs ==REMAINDER:\n result='...'\n elif action.nargs ==PARSER:\n result='%s ...'%get_metavar(1)\n elif action.nargs ==SUPPRESS:\n result=''\n else:\n try:\n formats=['%s'for _ in range(action.nargs)]\n except TypeError:\n raise ValueError(\"invalid nargs value\")from None\n result=' '.join(formats)%get_metavar(action.nargs)\n return result\n \n def _expand_help(self,action):\n params=dict(vars(action),prog=self._prog)\n for name in list(params):\n if params[name]is SUPPRESS:\n del params[name]\n for name in list(params):\n if hasattr(params[name],'__name__'):\n params[name]=params[name].__name__\n if params.get('choices')is not None:\n choices_str=', '.join([str(c)for c in params['choices']])\n params['choices']=choices_str\n return self._get_help_string(action)%params\n \n def _iter_indented_subactions(self,action):\n try:\n get_subactions=action._get_subactions\n except AttributeError:\n pass\n else:\n self._indent()\n yield from get_subactions()\n self._dedent()\n \n def _split_lines(self,text,width):\n text=self._whitespace_matcher.sub(' ',text).strip()\n \n \n import textwrap\n return textwrap.wrap(text,width)\n \n def _fill_text(self,text,width,indent):\n text=self._whitespace_matcher.sub(' ',text).strip()\n import textwrap\n return textwrap.fill(text,width,\n initial_indent=indent,\n subsequent_indent=indent)\n \n def _get_help_string(self,action):\n return action.help\n \n def _get_default_metavar_for_optional(self,action):\n return action.dest.upper()\n \n def _get_default_metavar_for_positional(self,action):\n return action.dest\n \n \nclass RawDescriptionHelpFormatter(HelpFormatter):\n ''\n\n\n\n \n \n def _fill_text(self,text,width,indent):\n return ''.join(indent+line for line in text.splitlines(keepends=True))\n \n \nclass RawTextHelpFormatter(RawDescriptionHelpFormatter):\n ''\n\n\n\n \n \n def _split_lines(self,text,width):\n return text.splitlines()\n \n \nclass ArgumentDefaultsHelpFormatter(HelpFormatter):\n ''\n\n\n\n \n \n def _get_help_string(self,action):\n ''\n\n\n\n\n\n\n \n help=action.help\n if help is None:\n help=''\n \n if '%(default)'not in help:\n if action.default is not SUPPRESS:\n defaulting_nargs=[OPTIONAL,ZERO_OR_MORE]\n if action.option_strings or action.nargs in defaulting_nargs:\n help +=' (default: %(default)s)'\n return help\n \n \n \nclass MetavarTypeHelpFormatter(HelpFormatter):\n ''\n\n\n\n\n \n \n def _get_default_metavar_for_optional(self,action):\n return action.type.__name__\n \n def _get_default_metavar_for_positional(self,action):\n return action.type.__name__\n \n \n \n \n \n \ndef _get_action_name(argument):\n if argument is None:\n return None\n elif argument.option_strings:\n return '/'.join(argument.option_strings)\n elif argument.metavar not in(None,SUPPRESS):\n return argument.metavar\n elif argument.dest not in(None,SUPPRESS):\n return argument.dest\n elif argument.choices:\n return '{'+','.join(argument.choices)+'}'\n else:\n return None\n \n \nclass ArgumentError(Exception):\n ''\n\n\n\n \n \n def __init__(self,argument,message):\n self.argument_name=_get_action_name(argument)\n self.message=message\n \n def __str__(self):\n if self.argument_name is None:\n format='%(message)s'\n else:\n format=_('argument %(argument_name)s: %(message)s')\n return format %dict(message=self.message,\n argument_name=self.argument_name)\n \n \nclass ArgumentTypeError(Exception):\n ''\n pass\n \n \n \n \n \n \nclass Action(_AttributeHolder):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,\n option_strings,\n dest,\n nargs=None,\n const=None,\n default=None,\n type=None,\n choices=None,\n required=False,\n help=None,\n metavar=None):\n self.option_strings=option_strings\n self.dest=dest\n self.nargs=nargs\n self.const=const\n self.default=default\n self.type=type\n self.choices=choices\n self.required=required\n self.help=help\n self.metavar=metavar\n \n def _get_kwargs(self):\n names=[\n 'option_strings',\n 'dest',\n 'nargs',\n 'const',\n 'default',\n 'type',\n 'choices',\n 'required',\n 'help',\n 'metavar',\n ]\n return[(name,getattr(self,name))for name in names]\n \n def format_usage(self):\n return self.option_strings[0]\n \n def __call__(self,parser,namespace,values,option_string=None):\n raise NotImplementedError(_('.__call__() not defined'))\n \n \n \n_deprecated_default=object()\n\nclass BooleanOptionalAction(Action):\n def __init__(self,\n option_strings,\n dest,\n default=None,\n type=_deprecated_default,\n choices=_deprecated_default,\n required=False,\n help=None,\n metavar=_deprecated_default):\n \n _option_strings=[]\n for option_string in option_strings:\n _option_strings.append(option_string)\n \n if option_string.startswith('--'):\n option_string='--no-'+option_string[2:]\n _option_strings.append(option_string)\n \n \n \n \n for field_name in('type','choices','metavar'):\n if locals()[field_name]is not _deprecated_default:\n warnings._deprecated(\n field_name,\n \"{name!r} is deprecated as of Python 3.12 and will be \"\n \"removed in Python {remove}.\",\n remove=(3,14))\n \n if type is _deprecated_default:\n type=None\n if choices is _deprecated_default:\n choices=None\n if metavar is _deprecated_default:\n metavar=None\n \n super().__init__(\n option_strings=_option_strings,\n dest=dest,\n nargs=0,\n default=default,\n type=type,\n choices=choices,\n required=required,\n help=help,\n metavar=metavar)\n \n \n def __call__(self,parser,namespace,values,option_string=None):\n if option_string in self.option_strings:\n setattr(namespace,self.dest,not option_string.startswith('--no-'))\n \n def format_usage(self):\n return ' | '.join(self.option_strings)\n \n \nclass _StoreAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n nargs=None,\n const=None,\n default=None,\n type=None,\n choices=None,\n required=False,\n help=None,\n metavar=None):\n if nargs ==0:\n raise ValueError('nargs for store actions must be != 0; if you '\n 'have nothing to store, actions such as store '\n 'true or store const may be more appropriate')\n if const is not None and nargs !=OPTIONAL:\n raise ValueError('nargs must be %r to supply const'%OPTIONAL)\n super(_StoreAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=nargs,\n const=const,\n default=default,\n type=type,\n choices=choices,\n required=required,\n help=help,\n metavar=metavar)\n \n def __call__(self,parser,namespace,values,option_string=None):\n setattr(namespace,self.dest,values)\n \n \nclass _StoreConstAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n const=None,\n default=None,\n required=False,\n help=None,\n metavar=None):\n super(_StoreConstAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=0,\n const=const,\n default=default,\n required=required,\n help=help)\n \n def __call__(self,parser,namespace,values,option_string=None):\n setattr(namespace,self.dest,self.const)\n \n \nclass _StoreTrueAction(_StoreConstAction):\n\n def __init__(self,\n option_strings,\n dest,\n default=False,\n required=False,\n help=None):\n super(_StoreTrueAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n const=True,\n default=default,\n required=required,\n help=help)\n \n \nclass _StoreFalseAction(_StoreConstAction):\n\n def __init__(self,\n option_strings,\n dest,\n default=True,\n required=False,\n help=None):\n super(_StoreFalseAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n const=False,\n default=default,\n required=required,\n help=help)\n \n \nclass _AppendAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n nargs=None,\n const=None,\n default=None,\n type=None,\n choices=None,\n required=False,\n help=None,\n metavar=None):\n if nargs ==0:\n raise ValueError('nargs for append actions must be != 0; if arg '\n 'strings are not supplying the value to append, '\n 'the append const action may be more appropriate')\n if const is not None and nargs !=OPTIONAL:\n raise ValueError('nargs must be %r to supply const'%OPTIONAL)\n super(_AppendAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=nargs,\n const=const,\n default=default,\n type=type,\n choices=choices,\n required=required,\n help=help,\n metavar=metavar)\n \n def __call__(self,parser,namespace,values,option_string=None):\n items=getattr(namespace,self.dest,None)\n items=_copy_items(items)\n items.append(values)\n setattr(namespace,self.dest,items)\n \n \nclass _AppendConstAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n const=None,\n default=None,\n required=False,\n help=None,\n metavar=None):\n super(_AppendConstAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=0,\n const=const,\n default=default,\n required=required,\n help=help,\n metavar=metavar)\n \n def __call__(self,parser,namespace,values,option_string=None):\n items=getattr(namespace,self.dest,None)\n items=_copy_items(items)\n items.append(self.const)\n setattr(namespace,self.dest,items)\n \n \nclass _CountAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n default=None,\n required=False,\n help=None):\n super(_CountAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=0,\n default=default,\n required=required,\n help=help)\n \n def __call__(self,parser,namespace,values,option_string=None):\n count=getattr(namespace,self.dest,None)\n if count is None:\n count=0\n setattr(namespace,self.dest,count+1)\n \n \nclass _HelpAction(Action):\n\n def __init__(self,\n option_strings,\n dest=SUPPRESS,\n default=SUPPRESS,\n help=None):\n super(_HelpAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n default=default,\n nargs=0,\n help=help)\n \n def __call__(self,parser,namespace,values,option_string=None):\n parser.print_help()\n parser.exit()\n \n \nclass _VersionAction(Action):\n\n def __init__(self,\n option_strings,\n version=None,\n dest=SUPPRESS,\n default=SUPPRESS,\n help=\"show program's version number and exit\"):\n super(_VersionAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n default=default,\n nargs=0,\n help=help)\n self.version=version\n \n def __call__(self,parser,namespace,values,option_string=None):\n version=self.version\n if version is None:\n version=parser.version\n formatter=parser._get_formatter()\n formatter.add_text(version)\n parser._print_message(formatter.format_help(),_sys.stdout)\n parser.exit()\n \n \nclass _SubParsersAction(Action):\n\n class _ChoicesPseudoAction(Action):\n \n def __init__(self,name,aliases,help):\n metavar=dest=name\n if aliases:\n metavar +=' (%s)'%', '.join(aliases)\n sup=super(_SubParsersAction._ChoicesPseudoAction,self)\n sup.__init__(option_strings=[],dest=dest,help=help,\n metavar=metavar)\n \n def __init__(self,\n option_strings,\n prog,\n parser_class,\n dest=SUPPRESS,\n required=False,\n help=None,\n metavar=None):\n \n self._prog_prefix=prog\n self._parser_class=parser_class\n self._name_parser_map={}\n self._choices_actions=[]\n \n super(_SubParsersAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=PARSER,\n choices=self._name_parser_map,\n required=required,\n help=help,\n metavar=metavar)\n \n def add_parser(self,name,**kwargs):\n \n if kwargs.get('prog')is None:\n kwargs['prog']='%s %s'%(self._prog_prefix,name)\n \n aliases=kwargs.pop('aliases',())\n \n if name in self._name_parser_map:\n raise ArgumentError(self,_('conflicting subparser: %s')%name)\n for alias in aliases:\n if alias in self._name_parser_map:\n raise ArgumentError(\n self,_('conflicting subparser alias: %s')%alias)\n \n \n if 'help'in kwargs:\n help=kwargs.pop('help')\n choice_action=self._ChoicesPseudoAction(name,aliases,help)\n self._choices_actions.append(choice_action)\n \n \n parser=self._parser_class(**kwargs)\n self._name_parser_map[name]=parser\n \n \n for alias in aliases:\n self._name_parser_map[alias]=parser\n \n return parser\n \n def _get_subactions(self):\n return self._choices_actions\n \n def __call__(self,parser,namespace,values,option_string=None):\n parser_name=values[0]\n arg_strings=values[1:]\n \n \n if self.dest is not SUPPRESS:\n setattr(namespace,self.dest,parser_name)\n \n \n try:\n parser=self._name_parser_map[parser_name]\n except KeyError:\n args={'parser_name':parser_name,\n 'choices':', '.join(self._name_parser_map)}\n msg=_('unknown parser %(parser_name)r (choices: %(choices)s)')%args\n raise ArgumentError(self,msg)\n \n \n \n \n \n \n \n \n subnamespace,arg_strings=parser.parse_known_args(arg_strings,None)\n for key,value in vars(subnamespace).items():\n setattr(namespace,key,value)\n \n if arg_strings:\n vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR,[])\n getattr(namespace,_UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)\n \nclass _ExtendAction(_AppendAction):\n def __call__(self,parser,namespace,values,option_string=None):\n items=getattr(namespace,self.dest,None)\n items=_copy_items(items)\n items.extend(values)\n setattr(namespace,self.dest,items)\n \n \n \n \n \nclass FileType(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,mode='r',bufsize=-1,encoding=None,errors=None):\n self._mode=mode\n self._bufsize=bufsize\n self._encoding=encoding\n self._errors=errors\n \n def __call__(self,string):\n \n if string =='-':\n if 'r'in self._mode:\n return _sys.stdin.buffer if 'b'in self._mode else _sys.stdin\n elif any(c in self._mode for c in 'wax'):\n return _sys.stdout.buffer if 'b'in self._mode else _sys.stdout\n else:\n msg=_('argument \"-\" with mode %r')%self._mode\n raise ValueError(msg)\n \n \n try:\n return open(string,self._mode,self._bufsize,self._encoding,\n self._errors)\n except OSError as e:\n args={'filename':string,'error':e}\n message=_(\"can't open '%(filename)s': %(error)s\")\n raise ArgumentTypeError(message %args)\n \n def __repr__(self):\n args=self._mode,self._bufsize\n kwargs=[('encoding',self._encoding),('errors',self._errors)]\n args_str=', '.join([repr(arg)for arg in args if arg !=-1]+\n ['%s=%r'%(kw,arg)for kw,arg in kwargs\n if arg is not None])\n return '%s(%s)'%(type(self).__name__,args_str)\n \n \n \n \n \nclass Namespace(_AttributeHolder):\n ''\n\n\n\n \n \n def __init__(self,**kwargs):\n for name in kwargs:\n setattr(self,name,kwargs[name])\n \n def __eq__(self,other):\n if not isinstance(other,Namespace):\n return NotImplemented\n return vars(self)==vars(other)\n \n def __contains__(self,key):\n return key in self.__dict__\n \n \nclass _ActionsContainer(object):\n\n def __init__(self,\n description,\n prefix_chars,\n argument_default,\n conflict_handler):\n super(_ActionsContainer,self).__init__()\n \n self.description=description\n self.argument_default=argument_default\n self.prefix_chars=prefix_chars\n self.conflict_handler=conflict_handler\n \n \n self._registries={}\n \n \n self.register('action',None,_StoreAction)\n self.register('action','store',_StoreAction)\n self.register('action','store_const',_StoreConstAction)\n self.register('action','store_true',_StoreTrueAction)\n self.register('action','store_false',_StoreFalseAction)\n self.register('action','append',_AppendAction)\n self.register('action','append_const',_AppendConstAction)\n self.register('action','count',_CountAction)\n self.register('action','help',_HelpAction)\n self.register('action','version',_VersionAction)\n self.register('action','parsers',_SubParsersAction)\n self.register('action','extend',_ExtendAction)\n \n \n self._get_handler()\n \n \n self._actions=[]\n self._option_string_actions={}\n \n \n self._action_groups=[]\n self._mutually_exclusive_groups=[]\n \n \n self._defaults={}\n \n \n self._negative_number_matcher=_re.compile(r'^-\\d+$|^-\\d*\\.\\d+$')\n \n \n \n self._has_negative_number_optionals=[]\n \n \n \n \n def register(self,registry_name,value,object):\n registry=self._registries.setdefault(registry_name,{})\n registry[value]=object\n \n def _registry_get(self,registry_name,value,default=None):\n return self._registries[registry_name].get(value,default)\n \n \n \n \n def set_defaults(self,**kwargs):\n self._defaults.update(kwargs)\n \n \n \n for action in self._actions:\n if action.dest in kwargs:\n action.default=kwargs[action.dest]\n \n def get_default(self,dest):\n for action in self._actions:\n if action.dest ==dest and action.default is not None:\n return action.default\n return self._defaults.get(dest,None)\n \n \n \n \n \n def add_argument(self,*args,**kwargs):\n ''\n\n\n \n \n \n \n \n chars=self.prefix_chars\n if not args or len(args)==1 and args[0][0]not in chars:\n if args and 'dest'in kwargs:\n raise ValueError('dest supplied twice for positional argument')\n kwargs=self._get_positional_kwargs(*args,**kwargs)\n \n \n else:\n kwargs=self._get_optional_kwargs(*args,**kwargs)\n \n \n if 'default'not in kwargs:\n dest=kwargs['dest']\n if dest in self._defaults:\n kwargs['default']=self._defaults[dest]\n elif self.argument_default is not None:\n kwargs['default']=self.argument_default\n \n \n action_class=self._pop_action_class(kwargs)\n if not callable(action_class):\n raise ValueError('unknown action \"%s\"'%(action_class,))\n action=action_class(**kwargs)\n \n \n type_func=self._registry_get('type',action.type,action.type)\n if not callable(type_func):\n raise ValueError('%r is not callable'%(type_func,))\n \n if type_func is FileType:\n raise ValueError('%r is a FileType class object, instance of it'\n ' must be passed'%(type_func,))\n \n \n if hasattr(self,\"_get_formatter\"):\n try:\n self._get_formatter()._format_args(action,None)\n except TypeError:\n raise ValueError(\"length of metavar tuple does not match nargs\")\n \n return self._add_action(action)\n \n def add_argument_group(self,*args,**kwargs):\n group=_ArgumentGroup(self,*args,**kwargs)\n self._action_groups.append(group)\n return group\n \n def add_mutually_exclusive_group(self,**kwargs):\n group=_MutuallyExclusiveGroup(self,**kwargs)\n self._mutually_exclusive_groups.append(group)\n return group\n \n def _add_action(self,action):\n \n self._check_conflict(action)\n \n \n self._actions.append(action)\n action.container=self\n \n \n for option_string in action.option_strings:\n self._option_string_actions[option_string]=action\n \n \n for option_string in action.option_strings:\n if self._negative_number_matcher.match(option_string):\n if not self._has_negative_number_optionals:\n self._has_negative_number_optionals.append(True)\n \n \n return action\n \n def _remove_action(self,action):\n self._actions.remove(action)\n \n def _add_container_actions(self,container):\n \n title_group_map={}\n for group in self._action_groups:\n if group.title in title_group_map:\n msg=_('cannot merge actions - two groups are named %r')\n raise ValueError(msg %(group.title))\n title_group_map[group.title]=group\n \n \n group_map={}\n for group in container._action_groups:\n \n \n \n if group.title not in title_group_map:\n title_group_map[group.title]=self.add_argument_group(\n title=group.title,\n description=group.description,\n conflict_handler=group.conflict_handler)\n \n \n for action in group._group_actions:\n group_map[action]=title_group_map[group.title]\n \n \n \n \n for group in container._mutually_exclusive_groups:\n mutex_group=self.add_mutually_exclusive_group(\n required=group.required)\n \n \n for action in group._group_actions:\n group_map[action]=mutex_group\n \n \n for action in container._actions:\n group_map.get(action,self)._add_action(action)\n \n def _get_positional_kwargs(self,dest,**kwargs):\n \n if 'required'in kwargs:\n msg=_(\"'required' is an invalid argument for positionals\")\n raise TypeError(msg)\n \n \n \n if kwargs.get('nargs')not in[OPTIONAL,ZERO_OR_MORE]:\n kwargs['required']=True\n if kwargs.get('nargs')==ZERO_OR_MORE and 'default'not in kwargs:\n kwargs['required']=True\n \n \n return dict(kwargs,dest=dest,option_strings=[])\n \n def _get_optional_kwargs(self,*args,**kwargs):\n \n option_strings=[]\n long_option_strings=[]\n for option_string in args:\n \n if not option_string[0]in self.prefix_chars:\n args={'option':option_string,\n 'prefix_chars':self.prefix_chars}\n msg=_('invalid option string %(option)r: '\n 'must start with a character %(prefix_chars)r')\n raise ValueError(msg %args)\n \n \n option_strings.append(option_string)\n if len(option_string)>1 and option_string[1]in self.prefix_chars:\n long_option_strings.append(option_string)\n \n \n dest=kwargs.pop('dest',None)\n if dest is None:\n if long_option_strings:\n dest_option_string=long_option_strings[0]\n else:\n dest_option_string=option_strings[0]\n dest=dest_option_string.lstrip(self.prefix_chars)\n if not dest:\n msg=_('dest= is required for options like %r')\n raise ValueError(msg %option_string)\n dest=dest.replace('-','_')\n \n \n return dict(kwargs,dest=dest,option_strings=option_strings)\n \n def _pop_action_class(self,kwargs,default=None):\n action=kwargs.pop('action',default)\n return self._registry_get('action',action,action)\n \n def _get_handler(self):\n \n handler_func_name='_handle_conflict_%s'%self.conflict_handler\n try:\n return getattr(self,handler_func_name)\n except AttributeError:\n msg=_('invalid conflict_resolution value: %r')\n raise ValueError(msg %self.conflict_handler)\n \n def _check_conflict(self,action):\n \n \n confl_optionals=[]\n for option_string in action.option_strings:\n if option_string in self._option_string_actions:\n confl_optional=self._option_string_actions[option_string]\n confl_optionals.append((option_string,confl_optional))\n \n \n if confl_optionals:\n conflict_handler=self._get_handler()\n conflict_handler(action,confl_optionals)\n \n def _handle_conflict_error(self,action,conflicting_actions):\n message=ngettext('conflicting option string: %s',\n 'conflicting option strings: %s',\n len(conflicting_actions))\n conflict_string=', '.join([option_string\n for option_string,action\n in conflicting_actions])\n raise ArgumentError(action,message %conflict_string)\n \n def _handle_conflict_resolve(self,action,conflicting_actions):\n \n \n for option_string,action in conflicting_actions:\n \n \n action.option_strings.remove(option_string)\n self._option_string_actions.pop(option_string,None)\n \n \n \n if not action.option_strings:\n action.container._remove_action(action)\n \n \nclass _ArgumentGroup(_ActionsContainer):\n\n def __init__(self,container,title=None,description=None,**kwargs):\n \n update=kwargs.setdefault\n update('conflict_handler',container.conflict_handler)\n update('prefix_chars',container.prefix_chars)\n update('argument_default',container.argument_default)\n super_init=super(_ArgumentGroup,self).__init__\n super_init(description=description,**kwargs)\n \n \n self.title=title\n self._group_actions=[]\n \n \n self._registries=container._registries\n self._actions=container._actions\n self._option_string_actions=container._option_string_actions\n self._defaults=container._defaults\n self._has_negative_number_optionals=\\\n container._has_negative_number_optionals\n self._mutually_exclusive_groups=container._mutually_exclusive_groups\n \n def _add_action(self,action):\n action=super(_ArgumentGroup,self)._add_action(action)\n self._group_actions.append(action)\n return action\n \n def _remove_action(self,action):\n super(_ArgumentGroup,self)._remove_action(action)\n self._group_actions.remove(action)\n \n def add_argument_group(self,*args,**kwargs):\n warnings.warn(\n \"Nesting argument groups is deprecated.\",\n category=DeprecationWarning,\n stacklevel=2\n )\n return super().add_argument_group(*args,**kwargs)\n \n \nclass _MutuallyExclusiveGroup(_ArgumentGroup):\n\n def __init__(self,container,required=False):\n super(_MutuallyExclusiveGroup,self).__init__(container)\n self.required=required\n self._container=container\n \n def _add_action(self,action):\n if action.required:\n msg=_('mutually exclusive arguments must be optional')\n raise ValueError(msg)\n action=self._container._add_action(action)\n self._group_actions.append(action)\n return action\n \n def _remove_action(self,action):\n self._container._remove_action(action)\n self._group_actions.remove(action)\n \n def add_mutually_exclusive_group(self,*args,**kwargs):\n warnings.warn(\n \"Nesting mutually exclusive groups is deprecated.\",\n category=DeprecationWarning,\n stacklevel=2\n )\n return super().add_mutually_exclusive_group(*args,**kwargs)\n \n \nclass ArgumentParser(_AttributeHolder,_ActionsContainer):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,\n prog=None,\n usage=None,\n description=None,\n epilog=None,\n parents=[],\n formatter_class=HelpFormatter,\n prefix_chars='-',\n fromfile_prefix_chars=None,\n argument_default=None,\n conflict_handler='error',\n add_help=True,\n allow_abbrev=True,\n exit_on_error=True):\n \n superinit=super(ArgumentParser,self).__init__\n superinit(description=description,\n prefix_chars=prefix_chars,\n argument_default=argument_default,\n conflict_handler=conflict_handler)\n \n \n if prog is None:\n prog=_os.path.basename(_sys.argv[0])\n \n self.prog=prog\n self.usage=usage\n self.epilog=epilog\n self.formatter_class=formatter_class\n self.fromfile_prefix_chars=fromfile_prefix_chars\n self.add_help=add_help\n self.allow_abbrev=allow_abbrev\n self.exit_on_error=exit_on_error\n \n add_group=self.add_argument_group\n self._positionals=add_group(_('positional arguments'))\n self._optionals=add_group(_('options'))\n self._subparsers=None\n \n \n def identity(string):\n return string\n self.register('type',None,identity)\n \n \n \n default_prefix='-'if '-'in prefix_chars else prefix_chars[0]\n if self.add_help:\n self.add_argument(\n default_prefix+'h',default_prefix *2+'help',\n action='help',default=SUPPRESS,\n help=_('show this help message and exit'))\n \n \n for parent in parents:\n self._add_container_actions(parent)\n try:\n defaults=parent._defaults\n except AttributeError:\n pass\n else:\n self._defaults.update(defaults)\n \n \n \n \n def _get_kwargs(self):\n names=[\n 'prog',\n 'usage',\n 'description',\n 'formatter_class',\n 'conflict_handler',\n 'add_help',\n ]\n return[(name,getattr(self,name))for name in names]\n \n \n \n \n def add_subparsers(self,**kwargs):\n if self._subparsers is not None:\n self.error(_('cannot have multiple subparser arguments'))\n \n \n kwargs.setdefault('parser_class',type(self))\n \n if 'title'in kwargs or 'description'in kwargs:\n title=_(kwargs.pop('title','subcommands'))\n description=_(kwargs.pop('description',None))\n self._subparsers=self.add_argument_group(title,description)\n else:\n self._subparsers=self._positionals\n \n \n \n if kwargs.get('prog')is None:\n formatter=self._get_formatter()\n positionals=self._get_positional_actions()\n groups=self._mutually_exclusive_groups\n formatter.add_usage(self.usage,positionals,groups,'')\n kwargs['prog']=formatter.format_help().strip()\n \n \n parsers_class=self._pop_action_class(kwargs,'parsers')\n action=parsers_class(option_strings=[],**kwargs)\n self._subparsers._add_action(action)\n \n \n return action\n \n def _add_action(self,action):\n if action.option_strings:\n self._optionals._add_action(action)\n else:\n self._positionals._add_action(action)\n return action\n \n def _get_optional_actions(self):\n return[action\n for action in self._actions\n if action.option_strings]\n \n def _get_positional_actions(self):\n return[action\n for action in self._actions\n if not action.option_strings]\n \n \n \n \n def parse_args(self,args=None,namespace=None):\n args,argv=self.parse_known_args(args,namespace)\n if argv:\n msg=_('unrecognized arguments: %s')\n self.error(msg %' '.join(argv))\n return args\n \n def parse_known_args(self,args=None,namespace=None):\n if args is None:\n \n args=_sys.argv[1:]\n else:\n \n args=list(args)\n \n \n if namespace is None:\n namespace=Namespace()\n \n \n for action in self._actions:\n if action.dest is not SUPPRESS:\n if not hasattr(namespace,action.dest):\n if action.default is not SUPPRESS:\n setattr(namespace,action.dest,action.default)\n \n \n for dest in self._defaults:\n if not hasattr(namespace,dest):\n setattr(namespace,dest,self._defaults[dest])\n \n \n if self.exit_on_error:\n try:\n namespace,args=self._parse_known_args(args,namespace)\n except ArgumentError as err:\n self.error(str(err))\n else:\n namespace,args=self._parse_known_args(args,namespace)\n \n if hasattr(namespace,_UNRECOGNIZED_ARGS_ATTR):\n args.extend(getattr(namespace,_UNRECOGNIZED_ARGS_ATTR))\n delattr(namespace,_UNRECOGNIZED_ARGS_ATTR)\n return namespace,args\n \n def _parse_known_args(self,arg_strings,namespace):\n \n if self.fromfile_prefix_chars is not None:\n arg_strings=self._read_args_from_files(arg_strings)\n \n \n \n action_conflicts={}\n for mutex_group in self._mutually_exclusive_groups:\n group_actions=mutex_group._group_actions\n for i,mutex_action in enumerate(mutex_group._group_actions):\n conflicts=action_conflicts.setdefault(mutex_action,[])\n conflicts.extend(group_actions[:i])\n conflicts.extend(group_actions[i+1:])\n \n \n \n \n option_string_indices={}\n arg_string_pattern_parts=[]\n arg_strings_iter=iter(arg_strings)\n for i,arg_string in enumerate(arg_strings_iter):\n \n \n if arg_string =='--':\n arg_string_pattern_parts.append('-')\n for arg_string in arg_strings_iter:\n arg_string_pattern_parts.append('A')\n \n \n \n else:\n option_tuple=self._parse_optional(arg_string)\n if option_tuple is None:\n pattern='A'\n else:\n option_string_indices[i]=option_tuple\n pattern='O'\n arg_string_pattern_parts.append(pattern)\n \n \n arg_strings_pattern=''.join(arg_string_pattern_parts)\n \n \n seen_actions=set()\n seen_non_default_actions=set()\n \n def take_action(action,argument_strings,option_string=None):\n seen_actions.add(action)\n argument_values=self._get_values(action,argument_strings)\n \n \n \n \n if argument_values is not action.default:\n seen_non_default_actions.add(action)\n for conflict_action in action_conflicts.get(action,[]):\n if conflict_action in seen_non_default_actions:\n msg=_('not allowed with argument %s')\n action_name=_get_action_name(conflict_action)\n raise ArgumentError(action,msg %action_name)\n \n \n \n if argument_values is not SUPPRESS:\n action(self,namespace,argument_values,option_string)\n \n \n def consume_optional(start_index):\n \n \n option_tuple=option_string_indices[start_index]\n action,option_string,explicit_arg=option_tuple\n \n \n \n match_argument=self._match_argument\n action_tuples=[]\n while True:\n \n \n if action is None:\n extras.append(arg_strings[start_index])\n return start_index+1\n \n \n \n if explicit_arg is not None:\n arg_count=match_argument(action,'A')\n \n \n \n \n chars=self.prefix_chars\n if(\n arg_count ==0\n and option_string[1]not in chars\n and explicit_arg !=''\n ):\n action_tuples.append((action,[],option_string))\n char=option_string[0]\n option_string=char+explicit_arg[0]\n new_explicit_arg=explicit_arg[1:]or None\n optionals_map=self._option_string_actions\n if option_string in optionals_map:\n action=optionals_map[option_string]\n explicit_arg=new_explicit_arg\n else:\n msg=_('ignored explicit argument %r')\n raise ArgumentError(action,msg %explicit_arg)\n \n \n \n elif arg_count ==1:\n stop=start_index+1\n args=[explicit_arg]\n action_tuples.append((action,args,option_string))\n break\n \n \n \n else:\n msg=_('ignored explicit argument %r')\n raise ArgumentError(action,msg %explicit_arg)\n \n \n \n \n else:\n start=start_index+1\n selected_patterns=arg_strings_pattern[start:]\n arg_count=match_argument(action,selected_patterns)\n stop=start+arg_count\n args=arg_strings[start:stop]\n action_tuples.append((action,args,option_string))\n break\n \n \n \n assert action_tuples\n for action,args,option_string in action_tuples:\n take_action(action,args,option_string)\n return stop\n \n \n \n positionals=self._get_positional_actions()\n \n \n def consume_positionals(start_index):\n \n match_partial=self._match_arguments_partial\n selected_pattern=arg_strings_pattern[start_index:]\n arg_counts=match_partial(positionals,selected_pattern)\n \n \n \n for action,arg_count in zip(positionals,arg_counts):\n args=arg_strings[start_index:start_index+arg_count]\n start_index +=arg_count\n take_action(action,args)\n \n \n \n positionals[:]=positionals[len(arg_counts):]\n return start_index\n \n \n \n extras=[]\n start_index=0\n if option_string_indices:\n max_option_string_index=max(option_string_indices)\n else:\n max_option_string_index=-1\n while start_index <=max_option_string_index:\n \n \n next_option_string_index=min([\n index\n for index in option_string_indices\n if index >=start_index])\n if start_index !=next_option_string_index:\n positionals_end_index=consume_positionals(start_index)\n \n \n \n if positionals_end_index >start_index:\n start_index=positionals_end_index\n continue\n else:\n start_index=positionals_end_index\n \n \n \n if start_index not in option_string_indices:\n strings=arg_strings[start_index:next_option_string_index]\n extras.extend(strings)\n start_index=next_option_string_index\n \n \n start_index=consume_optional(start_index)\n \n \n stop_index=consume_positionals(start_index)\n \n \n extras.extend(arg_strings[stop_index:])\n \n \n \n required_actions=[]\n for action in self._actions:\n if action not in seen_actions:\n if action.required:\n required_actions.append(_get_action_name(action))\n else:\n \n \n \n \n if(action.default is not None and\n isinstance(action.default,str)and\n hasattr(namespace,action.dest)and\n action.default is getattr(namespace,action.dest)):\n setattr(namespace,action.dest,\n self._get_value(action,action.default))\n \n if required_actions:\n self.error(_('the following arguments are required: %s')%\n ', '.join(required_actions))\n \n \n for group in self._mutually_exclusive_groups:\n if group.required:\n for action in group._group_actions:\n if action in seen_non_default_actions:\n break\n \n \n else:\n names=[_get_action_name(action)\n for action in group._group_actions\n if action.help is not SUPPRESS]\n msg=_('one of the arguments %s is required')\n self.error(msg %' '.join(names))\n \n \n return namespace,extras\n \n def _read_args_from_files(self,arg_strings):\n \n new_arg_strings=[]\n for arg_string in arg_strings:\n \n \n if not arg_string or arg_string[0]not in self.fromfile_prefix_chars:\n new_arg_strings.append(arg_string)\n \n \n else:\n try:\n with open(arg_string[1:],\n encoding=_sys.getfilesystemencoding(),\n errors=_sys.getfilesystemencodeerrors())as args_file:\n arg_strings=[]\n for arg_line in args_file.read().splitlines():\n for arg in self.convert_arg_line_to_args(arg_line):\n arg_strings.append(arg)\n arg_strings=self._read_args_from_files(arg_strings)\n new_arg_strings.extend(arg_strings)\n except OSError as err:\n self.error(str(err))\n \n \n return new_arg_strings\n \n def convert_arg_line_to_args(self,arg_line):\n return[arg_line]\n \n def _match_argument(self,action,arg_strings_pattern):\n \n nargs_pattern=self._get_nargs_pattern(action)\n match=_re.match(nargs_pattern,arg_strings_pattern)\n \n \n if match is None:\n nargs_errors={\n None:_('expected one argument'),\n OPTIONAL:_('expected at most one argument'),\n ONE_OR_MORE:_('expected at least one argument'),\n }\n msg=nargs_errors.get(action.nargs)\n if msg is None:\n msg=ngettext('expected %s argument',\n 'expected %s arguments',\n action.nargs)%action.nargs\n raise ArgumentError(action,msg)\n \n \n return len(match.group(1))\n \n def _match_arguments_partial(self,actions,arg_strings_pattern):\n \n \n result=[]\n for i in range(len(actions),0,-1):\n actions_slice=actions[:i]\n pattern=''.join([self._get_nargs_pattern(action)\n for action in actions_slice])\n match=_re.match(pattern,arg_strings_pattern)\n if match is not None:\n result.extend([len(string)for string in match.groups()])\n break\n \n \n return result\n \n def _parse_optional(self,arg_string):\n \n if not arg_string:\n return None\n \n \n if not arg_string[0]in self.prefix_chars:\n return None\n \n \n if arg_string in self._option_string_actions:\n action=self._option_string_actions[arg_string]\n return action,arg_string,None\n \n \n if len(arg_string)==1:\n return None\n \n \n if '='in arg_string:\n option_string,explicit_arg=arg_string.split('=',1)\n if option_string in self._option_string_actions:\n action=self._option_string_actions[option_string]\n return action,option_string,explicit_arg\n \n \n \n option_tuples=self._get_option_tuples(arg_string)\n \n \n if len(option_tuples)>1:\n options=', '.join([option_string\n for action,option_string,explicit_arg in option_tuples])\n args={'option':arg_string,'matches':options}\n msg=_('ambiguous option: %(option)s could match %(matches)s')\n self.error(msg %args)\n \n \n \n elif len(option_tuples)==1:\n option_tuple,=option_tuples\n return option_tuple\n \n \n \n \n if self._negative_number_matcher.match(arg_string):\n if not self._has_negative_number_optionals:\n return None\n \n \n if ' 'in arg_string:\n return None\n \n \n \n return None,arg_string,None\n \n def _get_option_tuples(self,option_string):\n result=[]\n \n \n \n chars=self.prefix_chars\n if option_string[0]in chars and option_string[1]in chars:\n if self.allow_abbrev:\n if '='in option_string:\n option_prefix,explicit_arg=option_string.split('=',1)\n else:\n option_prefix=option_string\n explicit_arg=None\n for option_string in self._option_string_actions:\n if option_string.startswith(option_prefix):\n action=self._option_string_actions[option_string]\n tup=action,option_string,explicit_arg\n result.append(tup)\n \n \n \n \n elif option_string[0]in chars and option_string[1]not in chars:\n option_prefix=option_string\n explicit_arg=None\n short_option_prefix=option_string[:2]\n short_explicit_arg=option_string[2:]\n \n for option_string in self._option_string_actions:\n if option_string ==short_option_prefix:\n action=self._option_string_actions[option_string]\n tup=action,option_string,short_explicit_arg\n result.append(tup)\n elif option_string.startswith(option_prefix):\n action=self._option_string_actions[option_string]\n tup=action,option_string,explicit_arg\n result.append(tup)\n \n \n else:\n self.error(_('unexpected option string: %s')%option_string)\n \n \n return result\n \n def _get_nargs_pattern(self,action):\n \n \n nargs=action.nargs\n \n \n if nargs is None:\n nargs_pattern='(-*A-*)'\n \n \n elif nargs ==OPTIONAL:\n nargs_pattern='(-*A?-*)'\n \n \n elif nargs ==ZERO_OR_MORE:\n nargs_pattern='(-*[A-]*)'\n \n \n elif nargs ==ONE_OR_MORE:\n nargs_pattern='(-*A[A-]*)'\n \n \n elif nargs ==REMAINDER:\n nargs_pattern='([-AO]*)'\n \n \n elif nargs ==PARSER:\n nargs_pattern='(-*A[-AO]*)'\n \n \n elif nargs ==SUPPRESS:\n nargs_pattern='(-*-*)'\n \n \n else:\n nargs_pattern='(-*%s-*)'%'-*'.join('A'*nargs)\n \n \n if action.option_strings:\n nargs_pattern=nargs_pattern.replace('-*','')\n nargs_pattern=nargs_pattern.replace('-','')\n \n \n return nargs_pattern\n \n \n \n \n \n def parse_intermixed_args(self,args=None,namespace=None):\n args,argv=self.parse_known_intermixed_args(args,namespace)\n if argv:\n msg=_('unrecognized arguments: %s')\n self.error(msg %' '.join(argv))\n return args\n \n def parse_known_intermixed_args(self,args=None,namespace=None):\n \n \n \n \n \n \n \n \n \n \n \n \n positionals=self._get_positional_actions()\n a=[action for action in positionals\n if action.nargs in[PARSER,REMAINDER]]\n if a:\n raise TypeError('parse_intermixed_args: positional arg'\n ' with nargs=%s'%a[0].nargs)\n \n if[action.dest for group in self._mutually_exclusive_groups\n for action in group._group_actions if action in positionals]:\n raise TypeError('parse_intermixed_args: positional in'\n ' mutuallyExclusiveGroup')\n \n try:\n save_usage=self.usage\n try:\n if self.usage is None:\n \n self.usage=self.format_usage()[7:]\n for action in positionals:\n \n action.save_nargs=action.nargs\n \n action.nargs=SUPPRESS\n action.save_default=action.default\n action.default=SUPPRESS\n namespace,remaining_args=self.parse_known_args(args,\n namespace)\n for action in positionals:\n \n if(hasattr(namespace,action.dest)\n and getattr(namespace,action.dest)==[]):\n from warnings import warn\n warn('Do not expect %s in %s'%(action.dest,namespace))\n delattr(namespace,action.dest)\n finally:\n \n for action in positionals:\n action.nargs=action.save_nargs\n action.default=action.save_default\n optionals=self._get_optional_actions()\n try:\n \n \n for action in optionals:\n action.save_required=action.required\n action.required=False\n for group in self._mutually_exclusive_groups:\n group.save_required=group.required\n group.required=False\n namespace,extras=self.parse_known_args(remaining_args,\n namespace)\n finally:\n \n for action in optionals:\n action.required=action.save_required\n for group in self._mutually_exclusive_groups:\n group.required=group.save_required\n finally:\n self.usage=save_usage\n return namespace,extras\n \n \n \n \n def _get_values(self,action,arg_strings):\n \n if action.nargs not in[PARSER,REMAINDER]:\n try:\n arg_strings.remove('--')\n except ValueError:\n pass\n \n \n if not arg_strings and action.nargs ==OPTIONAL:\n if action.option_strings:\n value=action.const\n else:\n value=action.default\n if isinstance(value,str):\n value=self._get_value(action,value)\n self._check_value(action,value)\n \n \n \n elif(not arg_strings and action.nargs ==ZERO_OR_MORE and\n not action.option_strings):\n if action.default is not None:\n value=action.default\n self._check_value(action,value)\n else:\n \n \n value=arg_strings\n \n \n elif len(arg_strings)==1 and action.nargs in[None,OPTIONAL]:\n arg_string,=arg_strings\n value=self._get_value(action,arg_string)\n self._check_value(action,value)\n \n \n elif action.nargs ==REMAINDER:\n value=[self._get_value(action,v)for v in arg_strings]\n \n \n elif action.nargs ==PARSER:\n value=[self._get_value(action,v)for v in arg_strings]\n self._check_value(action,value[0])\n \n \n elif action.nargs ==SUPPRESS:\n value=SUPPRESS\n \n \n else:\n value=[self._get_value(action,v)for v in arg_strings]\n for v in value:\n self._check_value(action,v)\n \n \n return value\n \n def _get_value(self,action,arg_string):\n type_func=self._registry_get('type',action.type,action.type)\n if not callable(type_func):\n msg=_('%r is not callable')\n raise ArgumentError(action,msg %type_func)\n \n \n try:\n result=type_func(arg_string)\n \n \n except ArgumentTypeError as err:\n msg=str(err)\n raise ArgumentError(action,msg)\n \n \n except(TypeError,ValueError):\n name=getattr(action.type,'__name__',repr(action.type))\n args={'type':name,'value':arg_string}\n msg=_('invalid %(type)s value: %(value)r')\n raise ArgumentError(action,msg %args)\n \n \n return result\n \n def _check_value(self,action,value):\n \n if action.choices is not None and value not in action.choices:\n args={'value':value,\n 'choices':', '.join(map(repr,action.choices))}\n msg=_('invalid choice: %(value)r (choose from %(choices)s)')\n raise ArgumentError(action,msg %args)\n \n \n \n \n def format_usage(self):\n formatter=self._get_formatter()\n formatter.add_usage(self.usage,self._actions,\n self._mutually_exclusive_groups)\n return formatter.format_help()\n \n def format_help(self):\n formatter=self._get_formatter()\n \n \n formatter.add_usage(self.usage,self._actions,\n self._mutually_exclusive_groups)\n \n \n formatter.add_text(self.description)\n \n \n for action_group in self._action_groups:\n formatter.start_section(action_group.title)\n formatter.add_text(action_group.description)\n formatter.add_arguments(action_group._group_actions)\n formatter.end_section()\n \n \n formatter.add_text(self.epilog)\n \n \n return formatter.format_help()\n \n def _get_formatter(self):\n return self.formatter_class(prog=self.prog)\n \n \n \n \n def print_usage(self,file=None):\n if file is None:\n file=_sys.stdout\n self._print_message(self.format_usage(),file)\n \n def print_help(self,file=None):\n if file is None:\n file=_sys.stdout\n self._print_message(self.format_help(),file)\n \n def _print_message(self,message,file=None):\n if message:\n file=file or _sys.stderr\n try:\n file.write(message)\n except(AttributeError,OSError):\n pass\n \n \n \n \n def exit(self,status=0,message=None):\n if message:\n self._print_message(message,_sys.stderr)\n _sys.exit(status)\n \n def error(self,message):\n ''\n\n\n\n\n\n\n \n self.print_usage(_sys.stderr)\n args={'prog':self.prog,'message':message}\n self.exit(2,_('%(prog)s: error: %(message)s\\n')%args)\n", ["copy", "gettext", "os", "re", "shutil", "sys", "textwrap", "warnings"]], "ast": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport sys\nimport re\nfrom _ast import *\nfrom contextlib import contextmanager,nullcontext\nfrom enum import IntEnum,auto,_simple_enum\n\n\ndef parse(source,filename='',mode='exec',*,\ntype_comments=False,feature_version=None):\n ''\n\n\n\n \n flags=PyCF_ONLY_AST\n if type_comments:\n flags |=PyCF_TYPE_COMMENTS\n if feature_version is None:\n feature_version=-1\n elif isinstance(feature_version,tuple):\n major,minor=feature_version\n if major !=3:\n raise ValueError(f\"Unsupported major version: {major}\")\n feature_version=minor\n \n return compile(source,filename,mode,flags,\n _feature_version=feature_version)\n \n \ndef literal_eval(node_or_string):\n ''\n\n\n\n\n\n\n \n if isinstance(node_or_string,str):\n node_or_string=parse(node_or_string.lstrip(\" \\t\"),mode='eval')\n if isinstance(node_or_string,Expression):\n node_or_string=node_or_string.body\n def _raise_malformed_node(node):\n msg=\"malformed node or string\"\n if lno :=getattr(node,'lineno',None):\n msg +=f' on line {lno}'\n raise ValueError(msg+f': {node !r}')\n def _convert_num(node):\n if not isinstance(node,Constant)or type(node.value)not in(int,float,complex):\n _raise_malformed_node(node)\n return node.value\n def _convert_signed_num(node):\n if isinstance(node,UnaryOp)and isinstance(node.op,(UAdd,USub)):\n operand=_convert_num(node.operand)\n if isinstance(node.op,UAdd):\n return+operand\n else:\n return -operand\n return _convert_num(node)\n def _convert(node):\n if isinstance(node,Constant):\n return node.value\n elif isinstance(node,Tuple):\n return tuple(map(_convert,node.elts))\n elif isinstance(node,List):\n return list(map(_convert,node.elts))\n elif isinstance(node,Set):\n return set(map(_convert,node.elts))\n elif(isinstance(node,Call)and isinstance(node.func,Name)and\n node.func.id =='set'and node.args ==node.keywords ==[]):\n return set()\n elif isinstance(node,Dict):\n if len(node.keys)!=len(node.values):\n _raise_malformed_node(node)\n return dict(zip(map(_convert,node.keys),\n map(_convert,node.values)))\n elif isinstance(node,BinOp)and isinstance(node.op,(Add,Sub)):\n left=_convert_signed_num(node.left)\n right=_convert_num(node.right)\n if isinstance(left,(int,float))and isinstance(right,complex):\n if isinstance(node.op,Add):\n return left+right\n else:\n return left -right\n return _convert_signed_num(node)\n return _convert(node_or_string)\n \n \ndef dump(node,annotate_fields=True,include_attributes=False,*,indent=None):\n ''\n\n\n\n\n\n\n\n\n\n \n def _format(node,level=0):\n if indent is not None:\n level +=1\n prefix='\\n'+indent *level\n sep=',\\n'+indent *level\n else:\n prefix=''\n sep=', '\n if isinstance(node,AST):\n cls=type(node)\n args=[]\n allsimple=True\n keywords=annotate_fields\n for name in node._fields:\n try:\n value=getattr(node,name)\n except AttributeError:\n keywords=True\n continue\n if value is None and getattr(cls,name,...)is None:\n keywords=True\n continue\n value,simple=_format(value,level)\n allsimple=allsimple and simple\n if keywords:\n args.append('%s=%s'%(name,value))\n else:\n args.append(value)\n if include_attributes and node._attributes:\n for name in node._attributes:\n try:\n value=getattr(node,name)\n except AttributeError:\n continue\n if value is None and getattr(cls,name,...)is None:\n continue\n value,simple=_format(value,level)\n allsimple=allsimple and simple\n args.append('%s=%s'%(name,value))\n if allsimple and len(args)<=3:\n return '%s(%s)'%(node.__class__.__name__,', '.join(args)),not args\n return '%s(%s%s)'%(node.__class__.__name__,prefix,sep.join(args)),False\n elif isinstance(node,list):\n if not node:\n return '[]',True\n return '[%s%s]'%(prefix,sep.join(_format(x,level)[0]for x in node)),False\n return repr(node),True\n \n if not isinstance(node,AST):\n raise TypeError('expected AST, got %r'%node.__class__.__name__)\n if indent is not None and not isinstance(indent,str):\n indent=' '*indent\n return _format(node)[0]\n \n \ndef copy_location(new_node,old_node):\n ''\n\n\n \n for attr in 'lineno','col_offset','end_lineno','end_col_offset':\n if attr in old_node._attributes and attr in new_node._attributes:\n value=getattr(old_node,attr,None)\n \n \n if value is not None or(\n hasattr(old_node,attr)and attr.startswith(\"end_\")\n ):\n setattr(new_node,attr,value)\n return new_node\n \n \ndef fix_missing_locations(node):\n ''\n\n\n\n\n\n \n def _fix(node,lineno,col_offset,end_lineno,end_col_offset):\n if 'lineno'in node._attributes:\n if not hasattr(node,'lineno'):\n node.lineno=lineno\n else:\n lineno=node.lineno\n if 'end_lineno'in node._attributes:\n if getattr(node,'end_lineno',None)is None:\n node.end_lineno=end_lineno\n else:\n end_lineno=node.end_lineno\n if 'col_offset'in node._attributes:\n if not hasattr(node,'col_offset'):\n node.col_offset=col_offset\n else:\n col_offset=node.col_offset\n if 'end_col_offset'in node._attributes:\n if getattr(node,'end_col_offset',None)is None:\n node.end_col_offset=end_col_offset\n else:\n end_col_offset=node.end_col_offset\n for child in iter_child_nodes(node):\n _fix(child,lineno,col_offset,end_lineno,end_col_offset)\n _fix(node,1,0,1,0)\n return node\n \n \ndef increment_lineno(node,n=1):\n ''\n\n\n\n \n for child in walk(node):\n \n \n if isinstance(child,TypeIgnore):\n child.lineno=getattr(child,'lineno',0)+n\n continue\n \n if 'lineno'in child._attributes:\n child.lineno=getattr(child,'lineno',0)+n\n if(\n \"end_lineno\"in child._attributes\n and(end_lineno :=getattr(child,\"end_lineno\",0))is not None\n ):\n child.end_lineno=end_lineno+n\n return node\n \n \ndef iter_fields(node):\n ''\n\n\n \n for field in node._fields:\n try:\n yield field,getattr(node,field)\n except AttributeError:\n pass\n \n \ndef iter_child_nodes(node):\n ''\n\n\n \n for name,field in iter_fields(node):\n if isinstance(field,AST):\n yield field\n elif isinstance(field,list):\n for item in field:\n if isinstance(item,AST):\n yield item\n \n \ndef get_docstring(node,clean=True):\n ''\n\n\n\n\n\n\n \n if not isinstance(node,(AsyncFunctionDef,FunctionDef,ClassDef,Module)):\n raise TypeError(\"%r can't have docstrings\"%node.__class__.__name__)\n if not(node.body and isinstance(node.body[0],Expr)):\n return None\n node=node.body[0].value\n if isinstance(node,Constant)and isinstance(node.value,str):\n text=node.value\n else:\n return None\n if clean:\n import inspect\n text=inspect.cleandoc(text)\n return text\n \n \n_line_pattern=re.compile(r\"(.*?(?:\\r\\n|\\n|\\r|$))\")\ndef _splitlines_no_ff(source,maxlines=None):\n ''\n\n\n \n lines=[]\n for lineno,match in enumerate(_line_pattern.finditer(source),1):\n if maxlines is not None and lineno >maxlines:\n break\n lines.append(match[0])\n return lines\n \n \ndef _pad_whitespace(source):\n ''\n result=''\n for c in source:\n if c in '\\f\\t':\n result +=c\n else:\n result +=' '\n return result\n \n \ndef get_source_segment(source,node,*,padded=False):\n ''\n\n\n\n\n\n\n \n try:\n if node.end_lineno is None or node.end_col_offset is None:\n return None\n lineno=node.lineno -1\n end_lineno=node.end_lineno -1\n col_offset=node.col_offset\n end_col_offset=node.end_col_offset\n except AttributeError:\n return None\n \n lines=_splitlines_no_ff(source,maxlines=end_lineno+1)\n if end_lineno ==lineno:\n return lines[lineno].encode()[col_offset:end_col_offset].decode()\n \n if padded:\n padding=_pad_whitespace(lines[lineno].encode()[:col_offset].decode())\n else:\n padding=''\n \n first=padding+lines[lineno].encode()[col_offset:].decode()\n last=lines[end_lineno].encode()[:end_col_offset].decode()\n lines=lines[lineno+1:end_lineno]\n \n lines.insert(0,first)\n lines.append(last)\n return ''.join(lines)\n \n \ndef walk(node):\n ''\n\n\n\n \n from collections import deque\n todo=deque([node])\n while todo:\n node=todo.popleft()\n todo.extend(iter_child_nodes(node))\n yield node\n \n \nclass NodeVisitor(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def visit(self,node):\n ''\n method='visit_'+node.__class__.__name__\n visitor=getattr(self,method,self.generic_visit)\n return visitor(node)\n \n def generic_visit(self,node):\n ''\n for field,value in iter_fields(node):\n if isinstance(value,list):\n for item in value:\n if isinstance(item,AST):\n self.visit(item)\n elif isinstance(value,AST):\n self.visit(value)\n \n def visit_Constant(self,node):\n value=node.value\n type_name=_const_node_type_names.get(type(value))\n if type_name is None:\n for cls,name in _const_node_type_names.items():\n if isinstance(value,cls):\n type_name=name\n break\n if type_name is not None:\n method='visit_'+type_name\n try:\n visitor=getattr(self,method)\n except AttributeError:\n pass\n else:\n import warnings\n warnings.warn(f\"{method} is deprecated; add visit_Constant\",\n DeprecationWarning,2)\n return visitor(node)\n return self.generic_visit(node)\n \n \nclass NodeTransformer(NodeVisitor):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def generic_visit(self,node):\n for field,old_value in iter_fields(node):\n if isinstance(old_value,list):\n new_values=[]\n for value in old_value:\n if isinstance(value,AST):\n value=self.visit(value)\n if value is None:\n continue\n elif not isinstance(value,AST):\n new_values.extend(value)\n continue\n new_values.append(value)\n old_value[:]=new_values\n elif isinstance(old_value,AST):\n new_node=self.visit(old_value)\n if new_node is None:\n delattr(node,field)\n else:\n setattr(node,field,new_node)\n return node\n \n \n_DEPRECATED_VALUE_ALIAS_MESSAGE=(\n\"{name} is deprecated and will be removed in Python {remove}; use value instead\"\n)\n_DEPRECATED_CLASS_MESSAGE=(\n\"{name} is deprecated and will be removed in Python {remove}; \"\n\"use ast.Constant instead\"\n)\n\n\n\nif not hasattr(Constant,'n'):\n\n\n\n def _n_getter(self):\n ''\n import warnings\n warnings._deprecated(\n \"Attribute n\",message=_DEPRECATED_VALUE_ALIAS_MESSAGE,remove=(3,14)\n )\n return self.value\n \n def _n_setter(self,value):\n import warnings\n warnings._deprecated(\n \"Attribute n\",message=_DEPRECATED_VALUE_ALIAS_MESSAGE,remove=(3,14)\n )\n self.value=value\n \n def _s_getter(self):\n ''\n import warnings\n warnings._deprecated(\n \"Attribute s\",message=_DEPRECATED_VALUE_ALIAS_MESSAGE,remove=(3,14)\n )\n return self.value\n \n def _s_setter(self,value):\n import warnings\n warnings._deprecated(\n \"Attribute s\",message=_DEPRECATED_VALUE_ALIAS_MESSAGE,remove=(3,14)\n )\n self.value=value\n \n Constant.n=property(_n_getter,_n_setter)\n Constant.s=property(_s_getter,_s_setter)\n \nclass _ABC(type):\n\n def __init__(cls,*args):\n cls.__doc__=\"\"\"Deprecated AST node class. Use ast.Constant instead\"\"\"\n \n def __instancecheck__(cls,inst):\n if cls in _const_types:\n import warnings\n warnings._deprecated(\n f\"ast.{cls.__qualname__}\",\n message=_DEPRECATED_CLASS_MESSAGE,\n remove=(3,14)\n )\n if not isinstance(inst,Constant):\n return False\n if cls in _const_types:\n try:\n value=inst.value\n except AttributeError:\n return False\n else:\n return(\n isinstance(value,_const_types[cls])and\n not isinstance(value,_const_types_not.get(cls,()))\n )\n return type.__instancecheck__(cls,inst)\n \ndef _new(cls,*args,**kwargs):\n for key in kwargs:\n if key not in cls._fields:\n \n continue\n pos=cls._fields.index(key)\n if pos precedence)\n \n def get_precedence(self,node):\n return self._precedences.get(node,_Precedence.TEST)\n \n def set_precedence(self,precedence,*nodes):\n for node in nodes:\n self._precedences[node]=precedence\n \n def get_raw_docstring(self,node):\n ''\n\n\n \n if not isinstance(\n node,(AsyncFunctionDef,FunctionDef,ClassDef,Module)\n )or len(node.body)<1:\n return None\n node=node.body[0]\n if not isinstance(node,Expr):\n return None\n node=node.value\n if isinstance(node,Constant)and isinstance(node.value,str):\n return node\n \n def get_type_comment(self,node):\n comment=self._type_ignores.get(node.lineno)or node.type_comment\n if comment is not None:\n return f\" # type: {comment}\"\n \n def traverse(self,node):\n if isinstance(node,list):\n for item in node:\n self.traverse(item)\n else:\n super().visit(node)\n \n \n \n \n def visit(self,node):\n ''\n \n self._source=[]\n self.traverse(node)\n return \"\".join(self._source)\n \n def _write_docstring_and_traverse_body(self,node):\n if(docstring :=self.get_raw_docstring(node)):\n self._write_docstring(docstring)\n self.traverse(node.body[1:])\n else:\n self.traverse(node.body)\n \n def visit_Module(self,node):\n self._type_ignores={\n ignore.lineno:f\"ignore{ignore.tag}\"\n for ignore in node.type_ignores\n }\n self._write_docstring_and_traverse_body(node)\n self._type_ignores.clear()\n \n def visit_FunctionType(self,node):\n with self.delimit(\"(\",\")\"):\n self.interleave(\n lambda:self.write(\", \"),self.traverse,node.argtypes\n )\n \n self.write(\" -> \")\n self.traverse(node.returns)\n \n def visit_Expr(self,node):\n self.fill()\n self.set_precedence(_Precedence.YIELD,node.value)\n self.traverse(node.value)\n \n def visit_NamedExpr(self,node):\n with self.require_parens(_Precedence.NAMED_EXPR,node):\n self.set_precedence(_Precedence.ATOM,node.target,node.value)\n self.traverse(node.target)\n self.write(\" := \")\n self.traverse(node.value)\n \n def visit_Import(self,node):\n self.fill(\"import \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.names)\n \n def visit_ImportFrom(self,node):\n self.fill(\"from \")\n self.write(\".\"*(node.level or 0))\n if node.module:\n self.write(node.module)\n self.write(\" import \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.names)\n \n def visit_Assign(self,node):\n self.fill()\n for target in node.targets:\n self.set_precedence(_Precedence.TUPLE,target)\n self.traverse(target)\n self.write(\" = \")\n self.traverse(node.value)\n if type_comment :=self.get_type_comment(node):\n self.write(type_comment)\n \n def visit_AugAssign(self,node):\n self.fill()\n self.traverse(node.target)\n self.write(\" \"+self.binop[node.op.__class__.__name__]+\"= \")\n self.traverse(node.value)\n \n def visit_AnnAssign(self,node):\n self.fill()\n with self.delimit_if(\"(\",\")\",not node.simple and isinstance(node.target,Name)):\n self.traverse(node.target)\n self.write(\": \")\n self.traverse(node.annotation)\n if node.value:\n self.write(\" = \")\n self.traverse(node.value)\n \n def visit_Return(self,node):\n self.fill(\"return\")\n if node.value:\n self.write(\" \")\n self.traverse(node.value)\n \n def visit_Pass(self,node):\n self.fill(\"pass\")\n \n def visit_Break(self,node):\n self.fill(\"break\")\n \n def visit_Continue(self,node):\n self.fill(\"continue\")\n \n def visit_Delete(self,node):\n self.fill(\"del \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.targets)\n \n def visit_Assert(self,node):\n self.fill(\"assert \")\n self.traverse(node.test)\n if node.msg:\n self.write(\", \")\n self.traverse(node.msg)\n \n def visit_Global(self,node):\n self.fill(\"global \")\n self.interleave(lambda:self.write(\", \"),self.write,node.names)\n \n def visit_Nonlocal(self,node):\n self.fill(\"nonlocal \")\n self.interleave(lambda:self.write(\", \"),self.write,node.names)\n \n def visit_Await(self,node):\n with self.require_parens(_Precedence.AWAIT,node):\n self.write(\"await\")\n if node.value:\n self.write(\" \")\n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n \n def visit_Yield(self,node):\n with self.require_parens(_Precedence.YIELD,node):\n self.write(\"yield\")\n if node.value:\n self.write(\" \")\n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n \n def visit_YieldFrom(self,node):\n with self.require_parens(_Precedence.YIELD,node):\n self.write(\"yield from \")\n if not node.value:\n raise ValueError(\"Node can't be used without a value attribute.\")\n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n \n def visit_Raise(self,node):\n self.fill(\"raise\")\n if not node.exc:\n if node.cause:\n raise ValueError(f\"Node can't use cause without an exception.\")\n return\n self.write(\" \")\n self.traverse(node.exc)\n if node.cause:\n self.write(\" from \")\n self.traverse(node.cause)\n \n def do_visit_try(self,node):\n self.fill(\"try\")\n with self.block():\n self.traverse(node.body)\n for ex in node.handlers:\n self.traverse(ex)\n if node.orelse:\n self.fill(\"else\")\n with self.block():\n self.traverse(node.orelse)\n if node.finalbody:\n self.fill(\"finally\")\n with self.block():\n self.traverse(node.finalbody)\n \n def visit_Try(self,node):\n prev_in_try_star=self._in_try_star\n try:\n self._in_try_star=False\n self.do_visit_try(node)\n finally:\n self._in_try_star=prev_in_try_star\n \n def visit_TryStar(self,node):\n prev_in_try_star=self._in_try_star\n try:\n self._in_try_star=True\n self.do_visit_try(node)\n finally:\n self._in_try_star=prev_in_try_star\n \n def visit_ExceptHandler(self,node):\n self.fill(\"except*\"if self._in_try_star else \"except\")\n if node.type:\n self.write(\" \")\n self.traverse(node.type)\n if node.name:\n self.write(\" as \")\n self.write(node.name)\n with self.block():\n self.traverse(node.body)\n \n def visit_ClassDef(self,node):\n self.maybe_newline()\n for deco in node.decorator_list:\n self.fill(\"@\")\n self.traverse(deco)\n self.fill(\"class \"+node.name)\n self._type_params_helper(node.type_params)\n with self.delimit_if(\"(\",\")\",condition=node.bases or node.keywords):\n comma=False\n for e in node.bases:\n if comma:\n self.write(\", \")\n else:\n comma=True\n self.traverse(e)\n for e in node.keywords:\n if comma:\n self.write(\", \")\n else:\n comma=True\n self.traverse(e)\n \n with self.block():\n self._write_docstring_and_traverse_body(node)\n \n def visit_FunctionDef(self,node):\n self._function_helper(node,\"def\")\n \n def visit_AsyncFunctionDef(self,node):\n self._function_helper(node,\"async def\")\n \n def _function_helper(self,node,fill_suffix):\n self.maybe_newline()\n for deco in node.decorator_list:\n self.fill(\"@\")\n self.traverse(deco)\n def_str=fill_suffix+\" \"+node.name\n self.fill(def_str)\n self._type_params_helper(node.type_params)\n with self.delimit(\"(\",\")\"):\n self.traverse(node.args)\n if node.returns:\n self.write(\" -> \")\n self.traverse(node.returns)\n with self.block(extra=self.get_type_comment(node)):\n self._write_docstring_and_traverse_body(node)\n \n def _type_params_helper(self,type_params):\n if type_params is not None and len(type_params)>0:\n with self.delimit(\"[\",\"]\"):\n self.interleave(lambda:self.write(\", \"),self.traverse,type_params)\n \n def visit_TypeVar(self,node):\n self.write(node.name)\n if node.bound:\n self.write(\": \")\n self.traverse(node.bound)\n \n def visit_TypeVarTuple(self,node):\n self.write(\"*\"+node.name)\n \n def visit_ParamSpec(self,node):\n self.write(\"**\"+node.name)\n \n def visit_TypeAlias(self,node):\n self.fill(\"type \")\n self.traverse(node.name)\n self._type_params_helper(node.type_params)\n self.write(\" = \")\n self.traverse(node.value)\n \n def visit_For(self,node):\n self._for_helper(\"for \",node)\n \n def visit_AsyncFor(self,node):\n self._for_helper(\"async for \",node)\n \n def _for_helper(self,fill,node):\n self.fill(fill)\n self.set_precedence(_Precedence.TUPLE,node.target)\n self.traverse(node.target)\n self.write(\" in \")\n self.traverse(node.iter)\n with self.block(extra=self.get_type_comment(node)):\n self.traverse(node.body)\n if node.orelse:\n self.fill(\"else\")\n with self.block():\n self.traverse(node.orelse)\n \n def visit_If(self,node):\n self.fill(\"if \")\n self.traverse(node.test)\n with self.block():\n self.traverse(node.body)\n \n while node.orelse and len(node.orelse)==1 and isinstance(node.orelse[0],If):\n node=node.orelse[0]\n self.fill(\"elif \")\n self.traverse(node.test)\n with self.block():\n self.traverse(node.body)\n \n if node.orelse:\n self.fill(\"else\")\n with self.block():\n self.traverse(node.orelse)\n \n def visit_While(self,node):\n self.fill(\"while \")\n self.traverse(node.test)\n with self.block():\n self.traverse(node.body)\n if node.orelse:\n self.fill(\"else\")\n with self.block():\n self.traverse(node.orelse)\n \n def visit_With(self,node):\n self.fill(\"with \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.items)\n with self.block(extra=self.get_type_comment(node)):\n self.traverse(node.body)\n \n def visit_AsyncWith(self,node):\n self.fill(\"async with \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.items)\n with self.block(extra=self.get_type_comment(node)):\n self.traverse(node.body)\n \n def _str_literal_helper(\n self,string,*,quote_types=_ALL_QUOTES,escape_special_whitespace=False\n ):\n ''\n\n \n def escape_char(c):\n \n \n if not escape_special_whitespace and c in \"\\n\\t\":\n return c\n \n if c ==\"\\\\\"or not c.isprintable():\n return c.encode(\"unicode_escape\").decode(\"ascii\")\n return c\n \n escaped_string=\"\".join(map(escape_char,string))\n possible_quotes=quote_types\n if \"\\n\"in escaped_string:\n possible_quotes=[q for q in possible_quotes if q in _MULTI_QUOTES]\n possible_quotes=[q for q in possible_quotes if q not in escaped_string]\n if not possible_quotes:\n \n \n \n string=repr(string)\n quote=next((q for q in quote_types if string[0]in q),string[0])\n return string[1:-1],[quote]\n if escaped_string:\n \n possible_quotes.sort(key=lambda q:q[0]==escaped_string[-1])\n \n \n if possible_quotes[0][0]==escaped_string[-1]:\n assert len(possible_quotes[0])==3\n escaped_string=escaped_string[:-1]+\"\\\\\"+escaped_string[-1]\n return escaped_string,possible_quotes\n \n def _write_str_avoiding_backslashes(self,string,*,quote_types=_ALL_QUOTES):\n ''\n string,quote_types=self._str_literal_helper(string,quote_types=quote_types)\n quote_type=quote_types[0]\n self.write(f\"{quote_type}{string}{quote_type}\")\n \n def visit_JoinedStr(self,node):\n self.write(\"f\")\n if self._avoid_backslashes:\n with self.buffered()as buffer:\n self._write_fstring_inner(node)\n return self._write_str_avoiding_backslashes(\"\".join(buffer))\n \n \n \n \n \n \n \n fstring_parts=[]\n for value in node.values:\n with self.buffered()as buffer:\n self._write_fstring_inner(value)\n fstring_parts.append(\n (\"\".join(buffer),isinstance(value,Constant))\n )\n \n new_fstring_parts=[]\n quote_types=list(_ALL_QUOTES)\n for value,is_constant in fstring_parts:\n value,quote_types=self._str_literal_helper(\n value,\n quote_types=quote_types,\n escape_special_whitespace=is_constant,\n )\n new_fstring_parts.append(value)\n \n value=\"\".join(new_fstring_parts)\n quote_type=quote_types[0]\n self.write(f\"{quote_type}{value}{quote_type}\")\n \n def _write_fstring_inner(self,node):\n if isinstance(node,JoinedStr):\n \n for value in node.values:\n self._write_fstring_inner(value)\n elif isinstance(node,Constant)and isinstance(node.value,str):\n value=node.value.replace(\"{\",\"{{\").replace(\"}\",\"}}\")\n self.write(value)\n elif isinstance(node,FormattedValue):\n self.visit_FormattedValue(node)\n else:\n raise ValueError(f\"Unexpected node inside JoinedStr, {node !r}\")\n \n def visit_FormattedValue(self,node):\n def unparse_inner(inner):\n unparser=type(self)(_avoid_backslashes=True)\n unparser.set_precedence(_Precedence.TEST.next(),inner)\n return unparser.visit(inner)\n \n with self.delimit(\"{\",\"}\"):\n expr=unparse_inner(node.value)\n if \"\\\\\"in expr:\n raise ValueError(\n \"Unable to avoid backslash in f-string expression part\"\n )\n if expr.startswith(\"{\"):\n \n self.write(\" \")\n self.write(expr)\n if node.conversion !=-1:\n self.write(f\"!{chr(node.conversion)}\")\n if node.format_spec:\n self.write(\":\")\n self._write_fstring_inner(node.format_spec)\n \n def visit_Name(self,node):\n self.write(node.id)\n \n def _write_docstring(self,node):\n self.fill()\n if node.kind ==\"u\":\n self.write(\"u\")\n self._write_str_avoiding_backslashes(node.value,quote_types=_MULTI_QUOTES)\n \n def _write_constant(self,value):\n if isinstance(value,(float,complex)):\n \n \n self.write(\n repr(value)\n .replace(\"inf\",_INFSTR)\n .replace(\"nan\",f\"({_INFSTR}-{_INFSTR})\")\n )\n elif self._avoid_backslashes and isinstance(value,str):\n self._write_str_avoiding_backslashes(value)\n else:\n self.write(repr(value))\n \n def visit_Constant(self,node):\n value=node.value\n if isinstance(value,tuple):\n with self.delimit(\"(\",\")\"):\n self.items_view(self._write_constant,value)\n elif value is ...:\n self.write(\"...\")\n else:\n if node.kind ==\"u\":\n self.write(\"u\")\n self._write_constant(node.value)\n \n def visit_List(self,node):\n with self.delimit(\"[\",\"]\"):\n self.interleave(lambda:self.write(\", \"),self.traverse,node.elts)\n \n def visit_ListComp(self,node):\n with self.delimit(\"[\",\"]\"):\n self.traverse(node.elt)\n for gen in node.generators:\n self.traverse(gen)\n \n def visit_GeneratorExp(self,node):\n with self.delimit(\"(\",\")\"):\n self.traverse(node.elt)\n for gen in node.generators:\n self.traverse(gen)\n \n def visit_SetComp(self,node):\n with self.delimit(\"{\",\"}\"):\n self.traverse(node.elt)\n for gen in node.generators:\n self.traverse(gen)\n \n def visit_DictComp(self,node):\n with self.delimit(\"{\",\"}\"):\n self.traverse(node.key)\n self.write(\": \")\n self.traverse(node.value)\n for gen in node.generators:\n self.traverse(gen)\n \n def visit_comprehension(self,node):\n if node.is_async:\n self.write(\" async for \")\n else:\n self.write(\" for \")\n self.set_precedence(_Precedence.TUPLE,node.target)\n self.traverse(node.target)\n self.write(\" in \")\n self.set_precedence(_Precedence.TEST.next(),node.iter,*node.ifs)\n self.traverse(node.iter)\n for if_clause in node.ifs:\n self.write(\" if \")\n self.traverse(if_clause)\n \n def visit_IfExp(self,node):\n with self.require_parens(_Precedence.TEST,node):\n self.set_precedence(_Precedence.TEST.next(),node.body,node.test)\n self.traverse(node.body)\n self.write(\" if \")\n self.traverse(node.test)\n self.write(\" else \")\n self.set_precedence(_Precedence.TEST,node.orelse)\n self.traverse(node.orelse)\n \n def visit_Set(self,node):\n if node.elts:\n with self.delimit(\"{\",\"}\"):\n self.interleave(lambda:self.write(\", \"),self.traverse,node.elts)\n else:\n \n \n self.write('{*()}')\n \n def visit_Dict(self,node):\n def write_key_value_pair(k,v):\n self.traverse(k)\n self.write(\": \")\n self.traverse(v)\n \n def write_item(item):\n k,v=item\n if k is None:\n \n \n self.write(\"**\")\n self.set_precedence(_Precedence.EXPR,v)\n self.traverse(v)\n else:\n write_key_value_pair(k,v)\n \n with self.delimit(\"{\",\"}\"):\n self.interleave(\n lambda:self.write(\", \"),write_item,zip(node.keys,node.values)\n )\n \n def visit_Tuple(self,node):\n with self.delimit_if(\n \"(\",\n \")\",\n len(node.elts)==0 or self.get_precedence(node)>_Precedence.TUPLE\n ):\n self.items_view(self.traverse,node.elts)\n \n unop={\"Invert\":\"~\",\"Not\":\"not\",\"UAdd\":\"+\",\"USub\":\"-\"}\n unop_precedence={\n \"not\":_Precedence.NOT,\n \"~\":_Precedence.FACTOR,\n \"+\":_Precedence.FACTOR,\n \"-\":_Precedence.FACTOR,\n }\n \n def visit_UnaryOp(self,node):\n operator=self.unop[node.op.__class__.__name__]\n operator_precedence=self.unop_precedence[operator]\n with self.require_parens(operator_precedence,node):\n self.write(operator)\n \n \n if operator_precedence is not _Precedence.FACTOR:\n self.write(\" \")\n self.set_precedence(operator_precedence,node.operand)\n self.traverse(node.operand)\n \n binop={\n \"Add\":\"+\",\n \"Sub\":\"-\",\n \"Mult\":\"*\",\n \"MatMult\":\"@\",\n \"Div\":\"/\",\n \"Mod\":\"%\",\n \"LShift\":\"<<\",\n \"RShift\":\">>\",\n \"BitOr\":\"|\",\n \"BitXor\":\"^\",\n \"BitAnd\":\"&\",\n \"FloorDiv\":\"//\",\n \"Pow\":\"**\",\n }\n \n binop_precedence={\n \"+\":_Precedence.ARITH,\n \"-\":_Precedence.ARITH,\n \"*\":_Precedence.TERM,\n \"@\":_Precedence.TERM,\n \"/\":_Precedence.TERM,\n \"%\":_Precedence.TERM,\n \"<<\":_Precedence.SHIFT,\n \">>\":_Precedence.SHIFT,\n \"|\":_Precedence.BOR,\n \"^\":_Precedence.BXOR,\n \"&\":_Precedence.BAND,\n \"//\":_Precedence.TERM,\n \"**\":_Precedence.POWER,\n }\n \n binop_rassoc=frozenset((\"**\",))\n def visit_BinOp(self,node):\n operator=self.binop[node.op.__class__.__name__]\n operator_precedence=self.binop_precedence[operator]\n with self.require_parens(operator_precedence,node):\n if operator in self.binop_rassoc:\n left_precedence=operator_precedence.next()\n right_precedence=operator_precedence\n else:\n left_precedence=operator_precedence\n right_precedence=operator_precedence.next()\n \n self.set_precedence(left_precedence,node.left)\n self.traverse(node.left)\n self.write(f\" {operator} \")\n self.set_precedence(right_precedence,node.right)\n self.traverse(node.right)\n \n cmpops={\n \"Eq\":\"==\",\n \"NotEq\":\"!=\",\n \"Lt\":\"<\",\n \"LtE\":\"<=\",\n \"Gt\":\">\",\n \"GtE\":\">=\",\n \"Is\":\"is\",\n \"IsNot\":\"is not\",\n \"In\":\"in\",\n \"NotIn\":\"not in\",\n }\n \n def visit_Compare(self,node):\n with self.require_parens(_Precedence.CMP,node):\n self.set_precedence(_Precedence.CMP.next(),node.left,*node.comparators)\n self.traverse(node.left)\n for o,e in zip(node.ops,node.comparators):\n self.write(\" \"+self.cmpops[o.__class__.__name__]+\" \")\n self.traverse(e)\n \n boolops={\"And\":\"and\",\"Or\":\"or\"}\n boolop_precedence={\"and\":_Precedence.AND,\"or\":_Precedence.OR}\n \n def visit_BoolOp(self,node):\n operator=self.boolops[node.op.__class__.__name__]\n operator_precedence=self.boolop_precedence[operator]\n \n def increasing_level_traverse(node):\n nonlocal operator_precedence\n operator_precedence=operator_precedence.next()\n self.set_precedence(operator_precedence,node)\n self.traverse(node)\n \n with self.require_parens(operator_precedence,node):\n s=f\" {operator} \"\n self.interleave(lambda:self.write(s),increasing_level_traverse,node.values)\n \n def visit_Attribute(self,node):\n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n \n \n \n if isinstance(node.value,Constant)and isinstance(node.value.value,int):\n self.write(\" \")\n self.write(\".\")\n self.write(node.attr)\n \n def visit_Call(self,node):\n self.set_precedence(_Precedence.ATOM,node.func)\n self.traverse(node.func)\n with self.delimit(\"(\",\")\"):\n comma=False\n for e in node.args:\n if comma:\n self.write(\", \")\n else:\n comma=True\n self.traverse(e)\n for e in node.keywords:\n if comma:\n self.write(\", \")\n else:\n comma=True\n self.traverse(e)\n \n def visit_Subscript(self,node):\n def is_non_empty_tuple(slice_value):\n return(\n isinstance(slice_value,Tuple)\n and slice_value.elts\n )\n \n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n with self.delimit(\"[\",\"]\"):\n if is_non_empty_tuple(node.slice):\n \n self.items_view(self.traverse,node.slice.elts)\n else:\n self.traverse(node.slice)\n \n def visit_Starred(self,node):\n self.write(\"*\")\n self.set_precedence(_Precedence.EXPR,node.value)\n self.traverse(node.value)\n \n def visit_Ellipsis(self,node):\n self.write(\"...\")\n \n def visit_Slice(self,node):\n if node.lower:\n self.traverse(node.lower)\n self.write(\":\")\n if node.upper:\n self.traverse(node.upper)\n if node.step:\n self.write(\":\")\n self.traverse(node.step)\n \n def visit_Match(self,node):\n self.fill(\"match \")\n self.traverse(node.subject)\n with self.block():\n for case in node.cases:\n self.traverse(case)\n \n def visit_arg(self,node):\n self.write(node.arg)\n if node.annotation:\n self.write(\": \")\n self.traverse(node.annotation)\n \n def visit_arguments(self,node):\n first=True\n \n all_args=node.posonlyargs+node.args\n defaults=[None]*(len(all_args)-len(node.defaults))+node.defaults\n for index,elements in enumerate(zip(all_args,defaults),1):\n a,d=elements\n if first:\n first=False\n else:\n self.write(\", \")\n self.traverse(a)\n if d:\n self.write(\"=\")\n self.traverse(d)\n if index ==len(node.posonlyargs):\n self.write(\", /\")\n \n \n if node.vararg or node.kwonlyargs:\n if first:\n first=False\n else:\n self.write(\", \")\n self.write(\"*\")\n if node.vararg:\n self.write(node.vararg.arg)\n if node.vararg.annotation:\n self.write(\": \")\n self.traverse(node.vararg.annotation)\n \n \n if node.kwonlyargs:\n for a,d in zip(node.kwonlyargs,node.kw_defaults):\n self.write(\", \")\n self.traverse(a)\n if d:\n self.write(\"=\")\n self.traverse(d)\n \n \n if node.kwarg:\n if first:\n first=False\n else:\n self.write(\", \")\n self.write(\"**\"+node.kwarg.arg)\n if node.kwarg.annotation:\n self.write(\": \")\n self.traverse(node.kwarg.annotation)\n \n def visit_keyword(self,node):\n if node.arg is None:\n self.write(\"**\")\n else:\n self.write(node.arg)\n self.write(\"=\")\n self.traverse(node.value)\n \n def visit_Lambda(self,node):\n with self.require_parens(_Precedence.TEST,node):\n self.write(\"lambda\")\n with self.buffered()as buffer:\n self.traverse(node.args)\n if buffer:\n self.write(\" \",*buffer)\n self.write(\": \")\n self.set_precedence(_Precedence.TEST,node.body)\n self.traverse(node.body)\n \n def visit_alias(self,node):\n self.write(node.name)\n if node.asname:\n self.write(\" as \"+node.asname)\n \n def visit_withitem(self,node):\n self.traverse(node.context_expr)\n if node.optional_vars:\n self.write(\" as \")\n self.traverse(node.optional_vars)\n \n def visit_match_case(self,node):\n self.fill(\"case \")\n self.traverse(node.pattern)\n if node.guard:\n self.write(\" if \")\n self.traverse(node.guard)\n with self.block():\n self.traverse(node.body)\n \n def visit_MatchValue(self,node):\n self.traverse(node.value)\n \n def visit_MatchSingleton(self,node):\n self._write_constant(node.value)\n \n def visit_MatchSequence(self,node):\n with self.delimit(\"[\",\"]\"):\n self.interleave(\n lambda:self.write(\", \"),self.traverse,node.patterns\n )\n \n def visit_MatchStar(self,node):\n name=node.name\n if name is None:\n name=\"_\"\n self.write(f\"*{name}\")\n \n def visit_MatchMapping(self,node):\n def write_key_pattern_pair(pair):\n k,p=pair\n self.traverse(k)\n self.write(\": \")\n self.traverse(p)\n \n with self.delimit(\"{\",\"}\"):\n keys=node.keys\n self.interleave(\n lambda:self.write(\", \"),\n write_key_pattern_pair,\n zip(keys,node.patterns,strict=True),\n )\n rest=node.rest\n if rest is not None:\n if keys:\n self.write(\", \")\n self.write(f\"**{rest}\")\n \n def visit_MatchClass(self,node):\n self.set_precedence(_Precedence.ATOM,node.cls)\n self.traverse(node.cls)\n with self.delimit(\"(\",\")\"):\n patterns=node.patterns\n self.interleave(\n lambda:self.write(\", \"),self.traverse,patterns\n )\n attrs=node.kwd_attrs\n if attrs:\n def write_attr_pattern(pair):\n attr,pattern=pair\n self.write(f\"{attr}=\")\n self.traverse(pattern)\n \n if patterns:\n self.write(\", \")\n self.interleave(\n lambda:self.write(\", \"),\n write_attr_pattern,\n zip(attrs,node.kwd_patterns,strict=True),\n )\n \n def visit_MatchAs(self,node):\n name=node.name\n pattern=node.pattern\n if name is None:\n self.write(\"_\")\n elif pattern is None:\n self.write(node.name)\n else:\n with self.require_parens(_Precedence.TEST,node):\n self.set_precedence(_Precedence.BOR,node.pattern)\n self.traverse(node.pattern)\n self.write(f\" as {node.name}\")\n \n def visit_MatchOr(self,node):\n with self.require_parens(_Precedence.BOR,node):\n self.set_precedence(_Precedence.BOR.next(),*node.patterns)\n self.interleave(lambda:self.write(\" | \"),self.traverse,node.patterns)\n \ndef unparse(ast_obj):\n unparser=_Unparser()\n return unparser.visit(ast_obj)\n \n \n_deprecated_globals={\nname:globals().pop(name)\nfor name in('Num','Str','Bytes','NameConstant','Ellipsis')\n}\n\ndef __getattr__(name):\n if name in _deprecated_globals:\n globals()[name]=value=_deprecated_globals[name]\n import warnings\n warnings._deprecated(\n f\"ast.{name}\",message=_DEPRECATED_CLASS_MESSAGE,remove=(3,14)\n )\n return value\n raise AttributeError(f\"module 'ast' has no attribute '{name}'\")\n \n \ndef main():\n import argparse\n \n parser=argparse.ArgumentParser(prog='python -m ast')\n parser.add_argument('infile',type=argparse.FileType(mode='rb'),nargs='?',\n default='-',\n help='the file to parse; defaults to stdin')\n parser.add_argument('-m','--mode',default='exec',\n choices=('exec','single','eval','func_type'),\n help='specify what kind of code must be parsed')\n parser.add_argument('--no-type-comments',default=True,action='store_false',\n help=\"don't add information about type comments\")\n parser.add_argument('-a','--include-attributes',action='store_true',\n help='include attributes such as line numbers and '\n 'column offsets')\n parser.add_argument('-i','--indent',type=int,default=3,\n help='indentation of nodes (number of spaces)')\n args=parser.parse_args()\n \n with args.infile as infile:\n source=infile.read()\n tree=parse(source,args.infile.name,args.mode,type_comments=args.no_type_comments)\n print(dump(tree,include_attributes=args.include_attributes,indent=args.indent))\n \nif __name__ =='__main__':\n main()\n", ["_ast", "argparse", "collections", "contextlib", "enum", "inspect", "re", "sys", "warnings"]], "asyncio": [".py", "print('Brython implementation of asyncio is present to avoid ImportError '+\n'in some modules, but does not implement the asyncio features '+\n'because of browser limitations.\\nFor asynchronous programming, use '+\n'browser.aio instead')\n\nALL_COMPLETED=\"\"\"ALL_COMPLETED\"\"\"\n\n\nclass AbstractEventLoop:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n \nclass AbstractEventLoopPolicy:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n def get_child_watcher(*args,**kw):\n pass\n \n def get_event_loop(*args,**kw):\n pass\n \n def new_event_loop(*args,**kw):\n pass\n \n def set_child_watcher(*args,**kw):\n pass\n \n def set_event_loop(*args,**kw):\n pass\n \nclass AbstractServer:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n def close(*args,**kw):\n pass\n \n def get_loop(*args,**kw):\n pass\n \n def is_serving(*args,**kw):\n pass\n \n def serve_forever(*args,**kw):\n pass\n \n def start_serving(*args,**kw):\n pass\n \n def wait_closed(*args,**kw):\n pass\n \nclass Barrier:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _block(*args,**kw):\n pass\n \n def _exit(*args,**kw):\n pass\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def _release(*args,**kw):\n pass\n \n def _wait(*args,**kw):\n pass\n \n def abort(*args,**kw):\n pass\n \n broken=\"\"\n \n n_waiting=\"\"\n \n parties=\"\"\n \n def reset(*args,**kw):\n pass\n \n def wait(*args,**kw):\n pass\n \nclass BaseEventLoop:\n\n __module__=\"\"\"asyncio.base_events\"\"\"\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n \nclass BaseProtocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass BaseTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \nclass BoundedSemaphore:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def _wake_up_next(*args,**kw):\n pass\n \n def acquire(*args,**kw):\n pass\n \n def locked(*args,**kw):\n pass\n \n def release(*args,**kw):\n pass\n \nclass BrokenBarrierError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass BufferedProtocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def buffer_updated(*args,**kw):\n pass\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def eof_received(*args,**kw):\n pass\n \n def get_buffer(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass CancelledError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass Condition:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def notify(*args,**kw):\n pass\n \n def notify_all(*args,**kw):\n pass\n \n def wait(*args,**kw):\n pass\n \n def wait_for(*args,**kw):\n pass\n \nclass DatagramProtocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def datagram_received(*args,**kw):\n pass\n \n def error_received(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass DatagramTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def abort(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def sendto(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \nclass DefaultEventLoopPolicy:\n\n\n class _Local:\n \n __module__=\"\"\"asyncio.events\"\"\"\n \n _loop=None\n \n _set_called=False\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n \n class _loop_factory:\n \n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _loop_self_reading(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_duplex_pipe_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_accept_futures(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_pipe_connection(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_serving_pipe(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n def get_child_watcher(*args,**kw):\n pass\n \n def get_event_loop(*args,**kw):\n pass\n \n def new_event_loop(*args,**kw):\n pass\n \n def set_child_watcher(*args,**kw):\n pass\n \n def set_event_loop(*args,**kw):\n pass\n \nclass Event:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def clear(*args,**kw):\n pass\n \n def is_set(*args,**kw):\n pass\n \n def set(*args,**kw):\n pass\n \n def wait(*args,**kw):\n pass\nFIRST_COMPLETED=\"\"\"FIRST_COMPLETED\"\"\"\n\nFIRST_EXCEPTION=\"\"\"FIRST_EXCEPTION\"\"\"\n\n\nclass Future:\n\n _asyncio_future_blocking=\"\"\n \n _callbacks=\"\"\n \n _cancel_message=\"\"\n \n _exception=\"\"\n \n _log_traceback=\"\"\n \n _loop=\"\"\n \n _make_cancelled_error=\"\"\n \n _result=\"\"\n \n _source_traceback=\"\"\n \n _state=\"\"\n \n add_done_callback=\"\"\n \n cancel=\"\"\n \n cancelled=\"\"\n \n done=\"\"\n \n exception=\"\"\n \n get_loop=\"\"\n \n remove_done_callback=\"\"\n \n result=\"\"\n \n set_exception=\"\"\n \n set_result=\"\"\n \nclass Handle:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n _args=\"\"\n \n _callback=\"\"\n \n _cancelled=\"\"\n \n _context=\"\"\n \n _loop=\"\"\n \n _repr=\"\"\n \n def _repr_info(*args,**kw):\n pass\n \n def _run(*args,**kw):\n pass\n \n _source_traceback=\"\"\n \n def cancel(*args,**kw):\n pass\n \n def cancelled(*args,**kw):\n pass\n \nclass IncompleteReadError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass InvalidStateError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass IocpProactor:\n\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _check_closed(*args,**kw):\n pass\n \n def _get_accept_socket(*args,**kw):\n pass\n \n def _poll(*args,**kw):\n pass\n \n def _register(*args,**kw):\n pass\n \n def _register_with_iocp(*args,**kw):\n pass\n \n def _result(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _unregister(*args,**kw):\n pass\n \n def _wait_cancel(*args,**kw):\n pass\n \n def _wait_for_handle(*args,**kw):\n pass\n \n def accept(*args,**kw):\n pass\n \n def accept_pipe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect(*args,**kw):\n pass\n \n def connect_pipe(*args,**kw):\n pass\n \n def recv(*args,**kw):\n pass\n \n def recv_into(*args,**kw):\n pass\n \n def recvfrom(*args,**kw):\n pass\n \n def recvfrom_into(*args,**kw):\n pass\n \n def select(*args,**kw):\n pass\n \n def send(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def sendto(*args,**kw):\n pass\n \n def set_loop(*args,**kw):\n pass\n \n def wait_for_handle(*args,**kw):\n pass\n \nclass LifoQueue:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n def _format(*args,**kw):\n pass\n \n def _get(*args,**kw):\n pass\n \n def _get_loop(*args,**kw):\n pass\n \n def _init(*args,**kw):\n pass\n \n _loop=None\n \n def _put(*args,**kw):\n pass\n \n def _wakeup_next(*args,**kw):\n pass\n \n def empty(*args,**kw):\n pass\n \n def full(*args,**kw):\n pass\n \n def get(*args,**kw):\n pass\n \n def get_nowait(*args,**kw):\n pass\n \n def join(*args,**kw):\n pass\n \n maxsize=\"\"\n \n def put(*args,**kw):\n pass\n \n def put_nowait(*args,**kw):\n pass\n \n def qsize(*args,**kw):\n pass\n \n def task_done(*args,**kw):\n pass\n \nclass LimitOverrunError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass Lock:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def _wake_up_first(*args,**kw):\n pass\n \n def acquire(*args,**kw):\n pass\n \n def locked(*args,**kw):\n pass\n \n def release(*args,**kw):\n pass\n \nclass PriorityQueue:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n def _format(*args,**kw):\n pass\n \n def _get(*args,**kw):\n pass\n \n def _get_loop(*args,**kw):\n pass\n \n def _init(*args,**kw):\n pass\n \n _loop=None\n \n def _put(*args,**kw):\n pass\n \n def _wakeup_next(*args,**kw):\n pass\n \n def empty(*args,**kw):\n pass\n \n def full(*args,**kw):\n pass\n \n def get(*args,**kw):\n pass\n \n def get_nowait(*args,**kw):\n pass\n \n def join(*args,**kw):\n pass\n \n maxsize=\"\"\n \n def put(*args,**kw):\n pass\n \n def put_nowait(*args,**kw):\n pass\n \n def qsize(*args,**kw):\n pass\n \n def task_done(*args,**kw):\n pass\n \nclass ProactorEventLoop:\n\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _loop_self_reading(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_duplex_pipe_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_accept_futures(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_pipe_connection(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_serving_pipe(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n \nclass Protocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def data_received(*args,**kw):\n pass\n \n def eof_received(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass Queue:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n def _format(*args,**kw):\n pass\n \n def _get(*args,**kw):\n pass\n \n def _get_loop(*args,**kw):\n pass\n \n def _init(*args,**kw):\n pass\n \n _loop=None\n \n def _put(*args,**kw):\n pass\n \n def _wakeup_next(*args,**kw):\n pass\n \n def empty(*args,**kw):\n pass\n \n def full(*args,**kw):\n pass\n \n def get(*args,**kw):\n pass\n \n def get_nowait(*args,**kw):\n pass\n \n def join(*args,**kw):\n pass\n \n maxsize=\"\"\n \n def put(*args,**kw):\n pass\n \n def put_nowait(*args,**kw):\n pass\n \n def qsize(*args,**kw):\n pass\n \n def task_done(*args,**kw):\n pass\n \nclass QueueEmpty:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass QueueFull:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass ReadTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def is_reading(*args,**kw):\n pass\n \n def pause_reading(*args,**kw):\n pass\n \n def resume_reading(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \nclass Runner:\n\n __module__=\"\"\"asyncio.runners\"\"\"\n \n def _lazy_init(*args,**kw):\n pass\n \n def _on_sigint(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_loop(*args,**kw):\n pass\n \n def run(*args,**kw):\n pass\n \nclass SelectorEventLoop:\n\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _accept_connection(*args,**kw):\n pass\n \n def _accept_connection2(*args,**kw):\n pass\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _add_reader(*args,**kw):\n pass\n \n def _add_writer(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_fd_no_transport(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _process_self_data(*args,**kw):\n pass\n \n def _read_from_self(*args,**kw):\n pass\n \n def _remove_reader(*args,**kw):\n pass\n \n def _remove_writer(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_accept(*args,**kw):\n pass\n \n def _sock_connect(*args,**kw):\n pass\n \n def _sock_connect_cb(*args,**kw):\n pass\n \n def _sock_read_done(*args,**kw):\n pass\n \n def _sock_recv(*args,**kw):\n pass\n \n def _sock_recv_into(*args,**kw):\n pass\n \n def _sock_recvfrom(*args,**kw):\n pass\n \n def _sock_recvfrom_into(*args,**kw):\n pass\n \n def _sock_sendall(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _sock_sendto(*args,**kw):\n pass\n \n def _sock_write_done(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n \nclass Semaphore:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def _wake_up_next(*args,**kw):\n pass\n \n def acquire(*args,**kw):\n pass\n \n def locked(*args,**kw):\n pass\n \n def release(*args,**kw):\n pass\n \nclass SendfileNotAvailableError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass Server:\n\n __module__=\"\"\"asyncio.base_events\"\"\"\n \n def _attach(*args,**kw):\n pass\n \n def _detach(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _wakeup(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_loop(*args,**kw):\n pass\n \n def is_serving(*args,**kw):\n pass\n \n def serve_forever(*args,**kw):\n pass\n \n sockets=\"\"\n \n def start_serving(*args,**kw):\n pass\n \n def wait_closed(*args,**kw):\n pass\n \nclass StreamReader:\n\n __module__=\"\"\"asyncio.streams\"\"\"\n \n def _maybe_resume_transport(*args,**kw):\n pass\n \n _source_traceback=None\n \n def _wait_for_data(*args,**kw):\n pass\n \n def _wakeup_waiter(*args,**kw):\n pass\n \n def at_eof(*args,**kw):\n pass\n \n def exception(*args,**kw):\n pass\n \n def feed_data(*args,**kw):\n pass\n \n def feed_eof(*args,**kw):\n pass\n \n def read(*args,**kw):\n pass\n \n def readexactly(*args,**kw):\n pass\n \n def readline(*args,**kw):\n pass\n \n def readuntil(*args,**kw):\n pass\n \n def set_exception(*args,**kw):\n pass\n \n def set_transport(*args,**kw):\n pass\n \nclass StreamReaderProtocol:\n\n __module__=\"\"\"asyncio.streams\"\"\"\n \n def _drain_helper(*args,**kw):\n pass\n \n def _get_close_waiter(*args,**kw):\n pass\n \n def _replace_writer(*args,**kw):\n pass\n \n _source_traceback=None\n \n _stream_reader=\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def data_received(*args,**kw):\n pass\n \n def eof_received(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass StreamWriter:\n\n __module__=\"\"\"asyncio.streams\"\"\"\n \n def can_write_eof(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def drain(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n transport=\"\"\n \n def wait_closed(*args,**kw):\n pass\n \n def write(*args,**kw):\n pass\n \n def write_eof(*args,**kw):\n pass\n \n def writelines(*args,**kw):\n pass\n \nclass SubprocessProtocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def pipe_connection_lost(*args,**kw):\n pass\n \n def pipe_data_received(*args,**kw):\n pass\n \n def process_exited(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass SubprocessTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_pid(*args,**kw):\n pass\n \n def get_pipe_transport(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def get_returncode(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def kill(*args,**kw):\n pass\n \n def send_signal(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \n def terminate(*args,**kw):\n pass\n \nclass Task:\n\n _asyncio_future_blocking=\"\"\n \n _callbacks=\"\"\n \n _cancel_message=\"\"\n \n _check_future=\"\"\n \n _coro=\"\"\n \n _exception=\"\"\n \n _fut_waiter=\"\"\n \n _log_destroy_pending=\"\"\n \n _log_traceback=\"\"\n \n _loop=\"\"\n \n _make_cancelled_error=\"\"\n \n _must_cancel=\"\"\n \n _result=\"\"\n \n _source_traceback=\"\"\n \n _state=\"\"\n \n add_done_callback=\"\"\n \n cancel=\"\"\n \n cancelled=\"\"\n \n cancelling=\"\"\n \n done=\"\"\n \n exception=\"\"\n \n get_coro=\"\"\n \n get_loop=\"\"\n \n get_name=\"\"\n \n get_stack=\"\"\n \n print_stack=\"\"\n \n remove_done_callback=\"\"\n \n result=\"\"\n \n set_exception=\"\"\n \n set_name=\"\"\n \n set_result=\"\"\n \n uncancel=\"\"\n \nclass TaskGroup:\n\n __module__=\"\"\"asyncio.taskgroups\"\"\"\n \n def _abort(*args,**kw):\n pass\n \n def _is_base_error(*args,**kw):\n pass\n \n def _on_task_done(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \nclass Timeout:\n\n __module__=\"\"\"asyncio.timeouts\"\"\"\n \n def _on_timeout(*args,**kw):\n pass\n \n def expired(*args,**kw):\n pass\n \n def reschedule(*args,**kw):\n pass\n \n def when(*args,**kw):\n pass\n \nclass TimeoutError:\n\n add_note=\"\"\n \n args=\"\"\n \n characters_written=\"\"\n \n errno=\"\"\n \n filename=\"\"\n \n filename2=\"\"\n \n strerror=\"\"\n \n winerror=\"\"\n \n with_traceback=\"\"\n \nclass TimerHandle:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n _args=\"\"\n \n _callback=\"\"\n \n _cancelled=\"\"\n \n _context=\"\"\n \n _loop=\"\"\n \n _repr=\"\"\n \n def _repr_info(*args,**kw):\n pass\n \n def _run(*args,**kw):\n pass\n \n _scheduled=\"\"\n \n _source_traceback=\"\"\n \n _when=\"\"\n \n def cancel(*args,**kw):\n pass\n \n def cancelled(*args,**kw):\n pass\n \n def when(*args,**kw):\n pass\n \nclass Transport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def abort(*args,**kw):\n pass\n \n def can_write_eof(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def get_write_buffer_limits(*args,**kw):\n pass\n \n def get_write_buffer_size(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def is_reading(*args,**kw):\n pass\n \n def pause_reading(*args,**kw):\n pass\n \n def resume_reading(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \n def set_write_buffer_limits(*args,**kw):\n pass\n \n def write(*args,**kw):\n pass\n \n def write_eof(*args,**kw):\n pass\n \n def writelines(*args,**kw):\n pass\n \nclass WindowsProactorEventLoopPolicy:\n\n\n class _Local:\n \n __module__=\"\"\"asyncio.events\"\"\"\n \n _loop=None\n \n _set_called=False\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n \n class _loop_factory:\n \n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _loop_self_reading(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_duplex_pipe_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_accept_futures(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_pipe_connection(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_serving_pipe(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n def get_child_watcher(*args,**kw):\n pass\n \n def get_event_loop(*args,**kw):\n pass\n \n def new_event_loop(*args,**kw):\n pass\n \n def set_child_watcher(*args,**kw):\n pass\n \n def set_event_loop(*args,**kw):\n pass\n \nclass WindowsSelectorEventLoopPolicy:\n\n\n class _Local:\n \n __module__=\"\"\"asyncio.events\"\"\"\n \n _loop=None\n \n _set_called=False\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n \n class _loop_factory:\n \n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _accept_connection(*args,**kw):\n pass\n \n def _accept_connection2(*args,**kw):\n pass\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _add_reader(*args,**kw):\n pass\n \n def _add_writer(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_fd_no_transport(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _process_self_data(*args,**kw):\n pass\n \n def _read_from_self(*args,**kw):\n pass\n \n def _remove_reader(*args,**kw):\n pass\n \n def _remove_writer(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_accept(*args,**kw):\n pass\n \n def _sock_connect(*args,**kw):\n pass\n \n def _sock_connect_cb(*args,**kw):\n pass\n \n def _sock_read_done(*args,**kw):\n pass\n \n def _sock_recv(*args,**kw):\n pass\n \n def _sock_recv_into(*args,**kw):\n pass\n \n def _sock_recvfrom(*args,**kw):\n pass\n \n def _sock_recvfrom_into(*args,**kw):\n pass\n \n def _sock_sendall(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _sock_sendto(*args,**kw):\n pass\n \n def _sock_write_done(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n def get_child_watcher(*args,**kw):\n pass\n \n def get_event_loop(*args,**kw):\n pass\n \n def new_event_loop(*args,**kw):\n pass\n \n def set_child_watcher(*args,**kw):\n pass\n \n def set_event_loop(*args,**kw):\n pass\n \nclass WriteTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def abort(*args,**kw):\n pass\n \n def can_write_eof(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def get_write_buffer_limits(*args,**kw):\n pass\n \n def get_write_buffer_size(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \n def set_write_buffer_limits(*args,**kw):\n pass\n \n def write(*args,**kw):\n pass\n \n def write_eof(*args,**kw):\n pass\n \n def writelines(*args,**kw):\n pass\ndef _enter_task(*args,**kw):\n pass\n \ndef _get_running_loop(*args,**kw):\n pass\n \ndef _leave_task(*args,**kw):\n pass\n \ndef _register_task(*args,**kw):\n pass\n \ndef _set_running_loop(*args,**kw):\n pass\n \ndef _unregister_task(*args,**kw):\n pass\n \ndef all_tasks(*args,**kw):\n pass\n \ndef as_completed(*args,**kw):\n pass\n \nbase_events=\"\"\n\nbase_futures=\"\"\n\nbase_subprocess=\"\"\n\nbase_tasks=\"\"\n\nconstants=\"\"\n\ncoroutines=\"\"\n\ndef create_subprocess_exec(*args,**kw):\n pass\n \ndef create_subprocess_shell(*args,**kw):\n pass\n \ndef create_task(*args,**kw):\n pass\n \ndef current_task(*args,**kw):\n pass\n \ndef ensure_future(*args,**kw):\n pass\n \nevents=\"\"\n\nexceptions=\"\"\n\nformat_helpers=\"\"\n\nfutures=\"\"\n\ndef gather(*args,**kw):\n pass\n \ndef get_child_watcher(*args,**kw):\n pass\n \ndef get_event_loop(*args,**kw):\n pass\n \ndef get_event_loop_policy(*args,**kw):\n pass\n \ndef get_running_loop(*args,**kw):\n pass\n \ndef iscoroutine(*args,**kw):\n pass\n \ndef iscoroutinefunction(*args,**kw):\n pass\n \ndef isfuture(*args,**kw):\n pass\n \nlocks=\"\"\n\nlog=\"\"\n\nmixins=\"\"\n\ndef new_event_loop(*args,**kw):\n pass\n \ndef open_connection(*args,**kw):\n pass\n \nproactor_events=\"\"\n\nprotocols=\"\"\n\nqueues=\"\"\n\ndef run(*args,**kw):\n pass\n \ndef run_coroutine_threadsafe(*args,**kw):\n pass\n \nrunners=\"\"\n\nselector_events=\"\"\n\ndef set_child_watcher(*args,**kw):\n pass\n \ndef set_event_loop(*args,**kw):\n pass\n \ndef set_event_loop_policy(*args,**kw):\n pass\n \ndef shield(*args,**kw):\n pass\n \ndef sleep(*args,**kw):\n pass\n \nsslproto=\"\"\n\nstaggered=\"\"\n\ndef start_server(*args,**kw):\n pass\n \nstreams=\"\"\n\nsubprocess=\"\"\n\nsys=\"\"\n\ntaskgroups=\"\"\n\ntasks=\"\"\n\nthreads=\"\"\n\ndef timeout(*args,**kw):\n pass\n \ndef timeout_at(*args,**kw):\n pass\n \ntimeouts=\"\"\n\ndef to_thread(*args,**kw):\n pass\n \ntransports=\"\"\n\ntrsock=\"\"\n\ndef wait(*args,**kw):\n pass\n \ndef wait_for(*args,**kw):\n pass\n \nwindows_events=\"\"\n\nwindows_utils=\"\"\n\ndef wrap_future(*args,**kw):\n pass\n \n", []], "atexit": [".py", "''\n\n\n\n\n\nclass __loader__(object):\n pass\n \ndef _clear(*args,**kw):\n ''\n \n pass\n \ndef _run_exitfuncs(*args,**kw):\n ''\n \n pass\n \ndef register(*args,**kw):\n ''\n\n\n\n\n\n\n \n pass\n \ndef unregister(*args,**kw):\n ''\n\n\n\n \n pass\n", []], "base64": [".py", "#! /usr/bin/env python3\n\n\"\"\"Base16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings\"\"\"\n\n\n\n\n\nimport re\nimport struct\nimport binascii\n\n\n__all__=[\n\n'encode','decode','encodebytes','decodebytes',\n\n'b64encode','b64decode','b32encode','b32decode',\n'b32hexencode','b32hexdecode','b16encode','b16decode',\n\n'b85encode','b85decode','a85encode','a85decode',\n\n'standard_b64encode','standard_b64decode',\n\n\n\n\n'urlsafe_b64encode','urlsafe_b64decode',\n]\n\n\nbytes_types=(bytes,bytearray)\n\ndef _bytes_from_decode_data(s):\n if isinstance(s,str):\n try:\n return s.encode('ascii')\n except UnicodeEncodeError:\n raise ValueError('string argument should contain only ASCII characters')\n if isinstance(s,bytes_types):\n return s\n try:\n return memoryview(s).tobytes()\n except TypeError:\n raise TypeError(\"argument should be a bytes-like object or ASCII \"\n \"string, not %r\"%s.__class__.__name__)from None\n \n \n \n \ndef b64encode(s,altchars=None):\n ''\n\n\n\n\n \n encoded=binascii.b2a_base64(s,newline=False)\n if altchars is not None:\n assert len(altchars)==2,repr(altchars)\n return encoded.translate(bytes.maketrans(b'+/',altchars))\n return encoded\n \n \ndef b64decode(s,altchars=None,validate=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n s=_bytes_from_decode_data(s)\n if altchars is not None:\n altchars=_bytes_from_decode_data(altchars)\n assert len(altchars)==2,repr(altchars)\n s=s.translate(bytes.maketrans(altchars,b'+/'))\n return binascii.a2b_base64(s,strict_mode=validate)\n \n \ndef standard_b64encode(s):\n ''\n\n\n \n return b64encode(s)\n \ndef standard_b64decode(s):\n ''\n\n\n\n\n\n \n return b64decode(s)\n \n \n_urlsafe_encode_translation=bytes.maketrans(b'+/',b'-_')\n_urlsafe_decode_translation=bytes.maketrans(b'-_',b'+/')\n\ndef urlsafe_b64encode(s):\n ''\n\n\n\n\n \n return b64encode(s).translate(_urlsafe_encode_translation)\n \ndef urlsafe_b64decode(s):\n ''\n\n\n\n\n\n\n\n\n \n s=_bytes_from_decode_data(s)\n s=s.translate(_urlsafe_decode_translation)\n return b64decode(s)\n \n \n \n \n_B32_ENCODE_DOCSTRING='''\nEncode the bytes-like objects using {encoding} and return a bytes object.\n'''\n_B32_DECODE_DOCSTRING='''\nDecode the {encoding} encoded bytes-like object or ASCII string s.\n\nOptional casefold is a flag specifying whether a lowercase alphabet is\nacceptable as input. For security purposes, the default is False.\n{extra_args}\nThe result is returned as a bytes object. A binascii.Error is raised if\nthe input is incorrectly padded or if there are non-alphabet\ncharacters present in the input.\n'''\n_B32_DECODE_MAP01_DOCSTRING='''\nRFC 3548 allows for optional mapping of the digit 0 (zero) to the\nletter O (oh), and for optional mapping of the digit 1 (one) to\neither the letter I (eye) or letter L (el). The optional argument\nmap01 when not None, specifies which letter the digit 1 should be\nmapped to (when map01 is not None, the digit 0 is always mapped to\nthe letter O). For security purposes the default is None, so that\n0 and 1 are not allowed in the input.\n'''\n_b32alphabet=b'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'\n_b32hexalphabet=b'0123456789ABCDEFGHIJKLMNOPQRSTUV'\n_b32tab2={}\n_b32rev={}\n\ndef _b32encode(alphabet,s):\n global _b32tab2\n \n \n if alphabet not in _b32tab2:\n b32tab=[bytes((i,))for i in alphabet]\n _b32tab2[alphabet]=[a+b for a in b32tab for b in b32tab]\n b32tab=None\n \n if not isinstance(s,bytes_types):\n s=memoryview(s).tobytes()\n leftover=len(s)%5\n \n if leftover:\n s=s+b'\\0'*(5 -leftover)\n encoded=bytearray()\n from_bytes=int.from_bytes\n b32tab2=_b32tab2[alphabet]\n for i in range(0,len(s),5):\n c=from_bytes(s[i:i+5])\n encoded +=(b32tab2[c >>30]+\n b32tab2[(c >>20)&0x3ff]+\n b32tab2[(c >>10)&0x3ff]+\n b32tab2[c&0x3ff]\n )\n \n if leftover ==1:\n encoded[-6:]=b'======'\n elif leftover ==2:\n encoded[-4:]=b'===='\n elif leftover ==3:\n encoded[-3:]=b'==='\n elif leftover ==4:\n encoded[-1:]=b'='\n return bytes(encoded)\n \ndef _b32decode(alphabet,s,casefold=False,map01=None):\n global _b32rev\n \n \n if alphabet not in _b32rev:\n _b32rev[alphabet]={v:k for k,v in enumerate(alphabet)}\n s=_bytes_from_decode_data(s)\n if len(s)%8:\n raise binascii.Error('Incorrect padding')\n \n \n \n if map01 is not None:\n map01=_bytes_from_decode_data(map01)\n assert len(map01)==1,repr(map01)\n s=s.translate(bytes.maketrans(b'01',b'O'+map01))\n if casefold:\n s=s.upper()\n \n \n \n l=len(s)\n s=s.rstrip(b'=')\n padchars=l -len(s)\n \n decoded=bytearray()\n b32rev=_b32rev[alphabet]\n for i in range(0,len(s),8):\n quanta=s[i:i+8]\n acc=0\n try:\n for c in quanta:\n acc=(acc <<5)+b32rev[c]\n except KeyError:\n raise binascii.Error('Non-base32 digit found')from None\n decoded +=acc.to_bytes(5)\n \n if l %8 or padchars not in{0,1,3,4,6}:\n raise binascii.Error('Incorrect padding')\n if padchars and decoded:\n acc <<=5 *padchars\n last=acc.to_bytes(5)\n leftover=(43 -5 *padchars)//8\n decoded[-5:]=last[:leftover]\n return bytes(decoded)\n \n \ndef b32encode(s):\n return _b32encode(_b32alphabet,s)\nb32encode.__doc__=_B32_ENCODE_DOCSTRING.format(encoding='base32')\n\ndef b32decode(s,casefold=False,map01=None):\n return _b32decode(_b32alphabet,s,casefold,map01)\nb32decode.__doc__=_B32_DECODE_DOCSTRING.format(encoding='base32',\nextra_args=_B32_DECODE_MAP01_DOCSTRING)\n\ndef b32hexencode(s):\n return _b32encode(_b32hexalphabet,s)\nb32hexencode.__doc__=_B32_ENCODE_DOCSTRING.format(encoding='base32hex')\n\ndef b32hexdecode(s,casefold=False):\n\n return _b32decode(_b32hexalphabet,s,casefold)\nb32hexdecode.__doc__=_B32_DECODE_DOCSTRING.format(encoding='base32hex',\nextra_args='')\n\n\n\n\n\ndef b16encode(s):\n ''\n \n return binascii.hexlify(s).upper()\n \n \ndef b16decode(s,casefold=False):\n ''\n\n\n\n\n\n\n\n \n s=_bytes_from_decode_data(s)\n if casefold:\n s=s.upper()\n if re.search(b'[^0-9A-F]',s):\n raise binascii.Error('Non-base16 digit found')\n return binascii.unhexlify(s)\n \n \n \n \n \n_a85chars=None\n_a85chars2=None\n_A85START=b\"<~\"\n_A85END=b\"~>\"\n\ndef _85encode(b,chars,chars2,pad=False,foldnuls=False,foldspaces=False):\n\n if not isinstance(b,bytes_types):\n b=memoryview(b).tobytes()\n \n padding=(-len(b))%4\n if padding:\n b=b+b'\\0'*padding\n words=struct.Struct('!%dI'%(len(b)//4)).unpack(b)\n \n chunks=[b'z'if foldnuls and not word else\n b'y'if foldspaces and word ==0x20202020 else\n (chars2[word //614125]+\n chars2[word //85 %7225]+\n chars[word %85])\n for word in words]\n \n if padding and not pad:\n if chunks[-1]==b'z':\n chunks[-1]=chars[0]*5\n chunks[-1]=chunks[-1][:-padding]\n \n return b''.join(chunks)\n \ndef a85encode(b,*,foldspaces=False,wrapcol=0,pad=False,adobe=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global _a85chars,_a85chars2\n \n \n if _a85chars2 is None:\n _a85chars=[bytes((i,))for i in range(33,118)]\n _a85chars2=[(a+b)for a in _a85chars for b in _a85chars]\n \n result=_85encode(b,_a85chars,_a85chars2,pad,True,foldspaces)\n \n if adobe:\n result=_A85START+result\n if wrapcol:\n wrapcol=max(2 if adobe else 1,wrapcol)\n chunks=[result[i:i+wrapcol]\n for i in range(0,len(result),wrapcol)]\n if adobe:\n if len(chunks[-1])+2 >wrapcol:\n chunks.append(b'')\n result=b'\\n'.join(chunks)\n if adobe:\n result +=_A85END\n \n return result\n \ndef a85decode(b,*,foldspaces=False,adobe=False,ignorechars=b' \\t\\n\\r\\v'):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n b=_bytes_from_decode_data(b)\n if adobe:\n if not b.endswith(_A85END):\n raise ValueError(\n \"Ascii85 encoded byte sequences must end \"\n \"with {!r}\".format(_A85END)\n )\n if b.startswith(_A85START):\n b=b[2:-2]\n else:\n b=b[:-2]\n \n \n \n \n packI=struct.Struct('!I').pack\n decoded=[]\n decoded_append=decoded.append\n curr=[]\n curr_append=curr.append\n curr_clear=curr.clear\n for x in b+b'u'*4:\n if b'!'[0]<=x <=b'u'[0]:\n curr_append(x)\n if len(curr)==5:\n acc=0\n for x in curr:\n acc=85 *acc+(x -33)\n try:\n decoded_append(packI(acc))\n except struct.error:\n raise ValueError('Ascii85 overflow')from None\n curr_clear()\n elif x ==b'z'[0]:\n if curr:\n raise ValueError('z inside Ascii85 5-tuple')\n decoded_append(b'\\0\\0\\0\\0')\n elif foldspaces and x ==b'y'[0]:\n if curr:\n raise ValueError('y inside Ascii85 5-tuple')\n decoded_append(b'\\x20\\x20\\x20\\x20')\n elif x in ignorechars:\n \n continue\n else:\n raise ValueError('Non-Ascii85 digit found: %c'%x)\n \n result=b''.join(decoded)\n padding=4 -len(curr)\n if padding:\n \n result=result[:-padding]\n return result\n \n \n \n_b85alphabet=(b\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\nb\"abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~\")\n_b85chars=None\n_b85chars2=None\n_b85dec=None\n\ndef b85encode(b,pad=False):\n ''\n\n\n\n \n global _b85chars,_b85chars2\n \n \n if _b85chars2 is None:\n _b85chars=[bytes((i,))for i in _b85alphabet]\n _b85chars2=[(a+b)for a in _b85chars for b in _b85chars]\n return _85encode(b,_b85chars,_b85chars2,pad)\n \ndef b85decode(b):\n ''\n\n\n \n global _b85dec\n \n \n if _b85dec is None:\n _b85dec=[None]*256\n for i,c in enumerate(_b85alphabet):\n _b85dec[c]=i\n \n b=_bytes_from_decode_data(b)\n padding=(-len(b))%5\n b=b+b'~'*padding\n out=[]\n packI=struct.Struct('!I').pack\n for i in range(0,len(b),5):\n chunk=b[i:i+5]\n acc=0\n try:\n for c in chunk:\n acc=acc *85+_b85dec[c]\n except TypeError:\n for j,c in enumerate(chunk):\n if _b85dec[c]is None:\n raise ValueError('bad base85 character at position %d'\n %(i+j))from None\n raise\n try:\n out.append(packI(acc))\n except struct.error:\n raise ValueError('base85 overflow in hunk starting at byte %d'\n %i)from None\n \n result=b''.join(out)\n if padding:\n result=result[:-padding]\n return result\n \n \n \n \n \nMAXLINESIZE=76\nMAXBINSIZE=(MAXLINESIZE //4)*3\n\ndef encode(input,output):\n ''\n while s :=input.read(MAXBINSIZE):\n while len(s)\":\n return filename\n canonic=self.fncache.get(filename)\n if not canonic:\n canonic=os.path.abspath(filename)\n canonic=os.path.normcase(canonic)\n self.fncache[filename]=canonic\n return canonic\n \n def reset(self):\n ''\n import linecache\n linecache.checkcache()\n self.botframe=None\n self._set_stopinfo(None,None)\n \n def trace_dispatch(self,frame,event,arg):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self.quitting:\n return\n if event =='line':\n return self.dispatch_line(frame)\n if event =='call':\n return self.dispatch_call(frame,arg)\n if event =='return':\n return self.dispatch_return(frame,arg)\n if event =='exception':\n return self.dispatch_exception(frame,arg)\n if event =='c_call':\n return self.trace_dispatch\n if event =='c_exception':\n return self.trace_dispatch\n if event =='c_return':\n return self.trace_dispatch\n print('bdb.Bdb.dispatch: unknown debugging event:',repr(event))\n return self.trace_dispatch\n \n def dispatch_line(self,frame):\n ''\n\n\n\n\n \n if self.stop_here(frame)or self.break_here(frame):\n self.user_line(frame)\n if self.quitting:raise BdbQuit\n return self.trace_dispatch\n \n def dispatch_call(self,frame,arg):\n ''\n\n\n\n\n \n \n if self.botframe is None:\n \n self.botframe=frame.f_back\n return self.trace_dispatch\n if not(self.stop_here(frame)or self.break_anywhere(frame)):\n \n return\n \n if self.stopframe and frame.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS:\n return self.trace_dispatch\n self.user_call(frame,arg)\n if self.quitting:raise BdbQuit\n return self.trace_dispatch\n \n def dispatch_return(self,frame,arg):\n ''\n\n\n\n\n \n if self.stop_here(frame)or frame ==self.returnframe:\n \n if self.stopframe and frame.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS:\n return self.trace_dispatch\n try:\n self.frame_returning=frame\n self.user_return(frame,arg)\n finally:\n self.frame_returning=None\n if self.quitting:raise BdbQuit\n \n if self.stopframe is frame and self.stoplineno !=-1:\n self._set_stopinfo(None,None)\n return self.trace_dispatch\n \n def dispatch_exception(self,frame,arg):\n ''\n\n\n\n\n \n if self.stop_here(frame):\n \n \n \n if not(frame.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS\n and arg[0]is StopIteration and arg[2]is None):\n self.user_exception(frame,arg)\n if self.quitting:raise BdbQuit\n \n \n \n \n elif(self.stopframe and frame is not self.stopframe\n and self.stopframe.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS\n and arg[0]in(StopIteration,GeneratorExit)):\n self.user_exception(frame,arg)\n if self.quitting:raise BdbQuit\n \n return self.trace_dispatch\n \n \n \n \n \n def is_skipped_module(self,module_name):\n ''\n if module_name is None:\n return False\n for pattern in self.skip:\n if fnmatch.fnmatch(module_name,pattern):\n return True\n return False\n \n def stop_here(self,frame):\n ''\n \n \n if self.skip and\\\n self.is_skipped_module(frame.f_globals.get('__name__')):\n return False\n if frame is self.stopframe:\n if self.stoplineno ==-1:\n return False\n return frame.f_lineno >=self.stoplineno\n if not self.stopframe:\n return True\n return False\n \n def break_here(self,frame):\n ''\n\n\n\n \n filename=self.canonic(frame.f_code.co_filename)\n if filename not in self.breaks:\n return False\n lineno=frame.f_lineno\n if lineno not in self.breaks[filename]:\n \n \n lineno=frame.f_code.co_firstlineno\n if lineno not in self.breaks[filename]:\n return False\n \n \n (bp,flag)=effective(filename,lineno,frame)\n if bp:\n self.currentbp=bp.number\n if(flag and bp.temporary):\n self.do_clear(str(bp.number))\n return True\n else:\n return False\n \n def do_clear(self,arg):\n ''\n\n\n \n raise NotImplementedError(\"subclass of bdb must implement do_clear()\")\n \n def break_anywhere(self,frame):\n ''\n \n return self.canonic(frame.f_code.co_filename)in self.breaks\n \n \n \n \n def user_call(self,frame,argument_list):\n ''\n pass\n \n def user_line(self,frame):\n ''\n pass\n \n def user_return(self,frame,return_value):\n ''\n pass\n \n def user_exception(self,frame,exc_info):\n ''\n pass\n \n def _set_stopinfo(self,stopframe,returnframe,stoplineno=0):\n ''\n\n\n\n\n \n self.stopframe=stopframe\n self.returnframe=returnframe\n self.quitting=False\n \n \n self.stoplineno=stoplineno\n \n \n \n \n def set_until(self,frame,lineno=None):\n ''\n \n \n if lineno is None:\n lineno=frame.f_lineno+1\n self._set_stopinfo(frame,frame,lineno)\n \n def set_step(self):\n ''\n \n \n \n \n if self.frame_returning:\n caller_frame=self.frame_returning.f_back\n if caller_frame and not caller_frame.f_trace:\n caller_frame.f_trace=self.trace_dispatch\n self._set_stopinfo(None,None)\n \n def set_next(self,frame):\n ''\n self._set_stopinfo(frame,None)\n \n def set_return(self,frame):\n ''\n if frame.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS:\n self._set_stopinfo(frame,None,-1)\n else:\n self._set_stopinfo(frame.f_back,frame)\n \n def set_trace(self,frame=None):\n ''\n\n\n \n if frame is None:\n frame=sys._getframe().f_back\n self.reset()\n while frame:\n frame.f_trace=self.trace_dispatch\n self.botframe=frame\n frame=frame.f_back\n self.set_step()\n sys.settrace(self.trace_dispatch)\n \n def set_continue(self):\n ''\n\n\n \n \n self._set_stopinfo(self.botframe,None,-1)\n if not self.breaks:\n \n sys.settrace(None)\n frame=sys._getframe().f_back\n while frame and frame is not self.botframe:\n del frame.f_trace\n frame=frame.f_back\n \n def set_quit(self):\n ''\n\n\n \n self.stopframe=self.botframe\n self.returnframe=None\n self.quitting=True\n sys.settrace(None)\n \n \n \n \n \n \n \n \n def _add_to_breaks(self,filename,lineno):\n ''\n bp_linenos=self.breaks.setdefault(filename,[])\n if lineno not in bp_linenos:\n bp_linenos.append(lineno)\n \n def set_break(self,filename,lineno,temporary=False,cond=None,\n funcname=None):\n ''\n\n\n\n \n filename=self.canonic(filename)\n import linecache\n line=linecache.getline(filename,lineno)\n if not line:\n return 'Line %s:%d does not exist'%(filename,lineno)\n self._add_to_breaks(filename,lineno)\n bp=Breakpoint(filename,lineno,temporary,cond,funcname)\n return None\n \n def _load_breaks(self):\n ''\n\n\n\n\n\n \n for(filename,lineno)in Breakpoint.bplist.keys():\n self._add_to_breaks(filename,lineno)\n \n def _prune_breaks(self,filename,lineno):\n ''\n\n\n\n\n\n \n if(filename,lineno)not in Breakpoint.bplist:\n self.breaks[filename].remove(lineno)\n if not self.breaks[filename]:\n del self.breaks[filename]\n \n def clear_break(self,filename,lineno):\n ''\n\n\n \n filename=self.canonic(filename)\n if filename not in self.breaks:\n return 'There are no breakpoints in %s'%filename\n if lineno not in self.breaks[filename]:\n return 'There is no breakpoint at %s:%d'%(filename,lineno)\n \n \n for bp in Breakpoint.bplist[filename,lineno][:]:\n bp.deleteMe()\n self._prune_breaks(filename,lineno)\n return None\n \n def clear_bpbynumber(self,arg):\n ''\n\n\n \n try:\n bp=self.get_bpbynumber(arg)\n except ValueError as err:\n return str(err)\n bp.deleteMe()\n self._prune_breaks(bp.file,bp.line)\n return None\n \n def clear_all_file_breaks(self,filename):\n ''\n\n\n \n filename=self.canonic(filename)\n if filename not in self.breaks:\n return 'There are no breakpoints in %s'%filename\n for line in self.breaks[filename]:\n blist=Breakpoint.bplist[filename,line]\n for bp in blist:\n bp.deleteMe()\n del self.breaks[filename]\n return None\n \n def clear_all_breaks(self):\n ''\n\n\n \n if not self.breaks:\n return 'There are no breakpoints'\n for bp in Breakpoint.bpbynumber:\n if bp:\n bp.deleteMe()\n self.breaks={}\n return None\n \n def get_bpbynumber(self,arg):\n ''\n\n\n\n \n if not arg:\n raise ValueError('Breakpoint number expected')\n try:\n number=int(arg)\n except ValueError:\n raise ValueError('Non-numeric breakpoint number %s'%arg)from None\n try:\n bp=Breakpoint.bpbynumber[number]\n except IndexError:\n raise ValueError('Breakpoint number %d out of range'%number)from None\n if bp is None:\n raise ValueError('Breakpoint %d already deleted'%number)\n return bp\n \n def get_break(self,filename,lineno):\n ''\n filename=self.canonic(filename)\n return filename in self.breaks and\\\n lineno in self.breaks[filename]\n \n def get_breaks(self,filename,lineno):\n ''\n\n\n \n filename=self.canonic(filename)\n return filename in self.breaks and\\\n lineno in self.breaks[filename]and\\\n Breakpoint.bplist[filename,lineno]or[]\n \n def get_file_breaks(self,filename):\n ''\n\n\n \n filename=self.canonic(filename)\n if filename in self.breaks:\n return self.breaks[filename]\n else:\n return[]\n \n def get_all_breaks(self):\n ''\n return self.breaks\n \n \n \n \n def get_stack(self,f,t):\n ''\n\n\n\n \n stack=[]\n if t and t.tb_frame is f:\n t=t.tb_next\n while f is not None:\n stack.append((f,f.f_lineno))\n if f is self.botframe:\n break\n f=f.f_back\n stack.reverse()\n i=max(0,len(stack)-1)\n while t is not None:\n stack.append((t.tb_frame,t.tb_lineno))\n t=t.tb_next\n if f is None:\n i=max(0,len(stack)-1)\n return stack,i\n \n def format_stack_entry(self,frame_lineno,lprefix=': '):\n ''\n\n\n\n\n\n\n \n import linecache,reprlib\n frame,lineno=frame_lineno\n filename=self.canonic(frame.f_code.co_filename)\n s='%s(%r)'%(filename,lineno)\n if frame.f_code.co_name:\n s +=frame.f_code.co_name\n else:\n s +=\"\"\n s +='()'\n if '__return__'in frame.f_locals:\n rv=frame.f_locals['__return__']\n s +='->'\n s +=reprlib.repr(rv)\n if lineno is not None:\n line=linecache.getline(filename,lineno,frame.f_globals)\n if line:\n s +=lprefix+line.strip()\n else:\n s +=f'{lprefix}Warning: lineno is None'\n return s\n \n \n \n \n \n def run(self,cmd,globals=None,locals=None):\n ''\n\n\n \n if globals is None:\n import __main__\n globals=__main__.__dict__\n if locals is None:\n locals=globals\n self.reset()\n if isinstance(cmd,str):\n cmd=compile(cmd,\"\",\"exec\")\n sys.settrace(self.trace_dispatch)\n try:\n exec(cmd,globals,locals)\n except BdbQuit:\n pass\n finally:\n self.quitting=True\n sys.settrace(None)\n \n def runeval(self,expr,globals=None,locals=None):\n ''\n\n\n \n if globals is None:\n import __main__\n globals=__main__.__dict__\n if locals is None:\n locals=globals\n self.reset()\n sys.settrace(self.trace_dispatch)\n try:\n return eval(expr,globals,locals)\n except BdbQuit:\n pass\n finally:\n self.quitting=True\n sys.settrace(None)\n \n def runctx(self,cmd,globals,locals):\n ''\n \n self.run(cmd,globals,locals)\n \n \n \n def runcall(self,func,/,*args,**kwds):\n ''\n\n\n \n self.reset()\n sys.settrace(self.trace_dispatch)\n res=None\n try:\n res=func(*args,**kwds)\n except BdbQuit:\n pass\n finally:\n self.quitting=True\n sys.settrace(None)\n return res\n \n \ndef set_trace():\n ''\n Bdb().set_trace()\n \n \nclass Breakpoint:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n next=1\n bplist={}\n bpbynumber=[None]\n \n \n \n def __init__(self,file,line,temporary=False,cond=None,funcname=None):\n self.funcname=funcname\n \n self.func_first_executable_line=None\n self.file=file\n self.line=line\n self.temporary=temporary\n self.cond=cond\n self.enabled=True\n self.ignore=0\n self.hits=0\n self.number=Breakpoint.next\n Breakpoint.next +=1\n \n self.bpbynumber.append(self)\n if(file,line)in self.bplist:\n self.bplist[file,line].append(self)\n else:\n self.bplist[file,line]=[self]\n \n @staticmethod\n def clearBreakpoints():\n Breakpoint.next=1\n Breakpoint.bplist={}\n Breakpoint.bpbynumber=[None]\n \n def deleteMe(self):\n ''\n\n\n\n \n \n index=(self.file,self.line)\n self.bpbynumber[self.number]=None\n self.bplist[index].remove(self)\n if not self.bplist[index]:\n \n del self.bplist[index]\n \n def enable(self):\n ''\n self.enabled=True\n \n def disable(self):\n ''\n self.enabled=False\n \n def bpprint(self,out=None):\n ''\n\n\n\n \n if out is None:\n out=sys.stdout\n print(self.bpformat(),file=out)\n \n def bpformat(self):\n ''\n\n\n\n\n\n \n if self.temporary:\n disp='del '\n else:\n disp='keep '\n if self.enabled:\n disp=disp+'yes '\n else:\n disp=disp+'no '\n ret='%-4dbreakpoint %s at %s:%d'%(self.number,disp,\n self.file,self.line)\n if self.cond:\n ret +='\\n\\tstop only if %s'%(self.cond,)\n if self.ignore:\n ret +='\\n\\tignore next %d hits'%(self.ignore,)\n if self.hits:\n if self.hits >1:\n ss='s'\n else:\n ss=''\n ret +='\\n\\tbreakpoint already hit %d time%s'%(self.hits,ss)\n return ret\n \n def __str__(self):\n ''\n return 'breakpoint %s at %s:%s'%(self.number,self.file,self.line)\n \n \n \n \ndef checkfuncname(b,frame):\n ''\n\n\n\n\n\n \n if not b.funcname:\n \n if b.line !=frame.f_lineno:\n \n \n return False\n return True\n \n \n if frame.f_code.co_name !=b.funcname:\n \n return False\n \n \n if not b.func_first_executable_line:\n \n b.func_first_executable_line=frame.f_lineno\n \n if b.func_first_executable_line !=frame.f_lineno:\n \n return False\n return True\n \n \ndef effective(file,line,frame):\n ''\n\n\n\n\n\n\n\n\n\n\n \n possibles=Breakpoint.bplist[file,line]\n for b in possibles:\n if not b.enabled:\n continue\n if not checkfuncname(b,frame):\n continue\n \n b.hits +=1\n if not b.cond:\n \n if b.ignore >0:\n b.ignore -=1\n continue\n else:\n \n return(b,True)\n else:\n \n \n \n try:\n val=eval(b.cond,frame.f_globals,frame.f_locals)\n if val:\n if b.ignore >0:\n b.ignore -=1\n \n else:\n return(b,True)\n \n \n except:\n \n \n \n return(b,False)\n return(None,None)\n \n \n \n \nclass Tdb(Bdb):\n def user_call(self,frame,args):\n name=frame.f_code.co_name\n if not name:name='???'\n print('+++ call',name,args)\n def user_line(self,frame):\n import linecache\n name=frame.f_code.co_name\n if not name:name='???'\n fn=self.canonic(frame.f_code.co_filename)\n line=linecache.getline(fn,frame.f_lineno,frame.f_globals)\n print('+++',fn,frame.f_lineno,name,':',line.strip())\n def user_return(self,frame,retval):\n print('+++ return',retval)\n def user_exception(self,frame,exc_stuff):\n print('+++ exception',exc_stuff)\n self.set_continue()\n \ndef foo(n):\n print('foo(',n,')')\n x=bar(n *10)\n print('bar returned',x)\n \ndef bar(a):\n print('bar(',a,')')\n return a /2\n \ndef test():\n t=Tdb()\n t.run('import bdb; bdb.foo(10)')\n", ["__main__", "fnmatch", "inspect", "linecache", "os", "reprlib", "sys"]], "binascii": [".py", "''\n\n\n\n\n\n\n\nimport _base64\n\nfrom _binascii import *\n\nclass Error(ValueError):\n def __init__(self,msg=''):\n self._msg=msg\n \n def __str__(self):\n return \" binascii.Error: \"+self._msg\n \n \nclass Done(Exception):\n pass\n \nclass Incomplete(Error):\n pass\n \ndef a2b_uu(s):\n if not s:\n return ''\n \n length=(ord(s[0])-0x20)%64\n \n def quadruplets_gen(s):\n while s:\n try :\n yield ord(s[0]),ord(s[1]),ord(s[2]),ord(s[3])\n except IndexError:\n s +=' '\n yield ord(s[0]),ord(s[1]),ord(s[2]),ord(s[3])\n return\n s=s[4:]\n \n try :\n result=[''.join(\n [chr((A -0x20)<<2 |(((B -0x20)>>4)&0x3)),\n chr(((B -0x20)&0xf)<<4 |(((C -0x20)>>2)&0xf)),\n chr(((C -0x20)&0x3)<<6 |((D -0x20)&0x3f))\n ])for A,B,C,D in quadruplets_gen(s[1:].rstrip())]\n except ValueError:\n raise Error('Illegal char')\n result=''.join(result)\n trailingdata=result[length:]\n if trailingdata.strip('\\x00'):\n raise Error('Trailing garbage')\n result=result[:length]\n if len(result)>2)&0x3F],\n table_b2a_base64[((A <<4)|((B >>4)&0xF))&0x3F],\n table_b2a_base64[((B <<2)|((C >>6)&0x3))&0x3F],\n table_b2a_base64[(C)&0x3F]])\n for A,B,C in a]\n \n final=s[length -final_length:]\n if final_length ==0:\n snippet=''\n elif final_length ==1:\n a=final[0]\n snippet=table_b2a_base64[(a >>2)&0x3F]+\\\n table_b2a_base64[(a <<4)&0x3F]+'=='\n else :\n a=final[0]\n b=final[1]\n snippet=table_b2a_base64[(a >>2)&0x3F]+\\\n table_b2a_base64[((a <<4)|(b >>4)&0xF)&0x3F]+\\\n table_b2a_base64[(b <<2)&0x3F]+'='\n \n result=''.join(result)+snippet\n if newline:\n result +='\\n'\n return bytes(result,__BRYTHON__.charset)\n \ndef a2b_qp(s,header=False ):\n inp=0\n odata=[]\n while inp =len(s):\n break\n \n if (s[inp]=='\\n')or (s[inp]=='\\r'):\n if s[inp]!='\\n':\n while inp 0 and data[lf -1]=='\\r'\n \n inp=0\n linelen=0\n odata=[]\n while inp '~'or\n c =='='or\n (header and c =='_')or\n (c =='.'and linelen ==0 and (inp+1 ==len(data)or\n data[inp+1]=='\\n'or\n data[inp+1]=='\\r'))or\n (not istext and (c =='\\r'or c =='\\n'))or\n ((c =='\\t'or c ==' ')and (inp+1 ==len(data)))or\n (c <=' 'and c !='\\r'and c !='\\n'and\n (quotetabs or (not quotetabs and (c !='\\t'and c !=' '))))):\n linelen +=3\n if linelen >=MAXLINESIZE:\n odata.append('=')\n if crlf:odata.append('\\r')\n odata.append('\\n')\n linelen=3\n odata.append('='+two_hex_digits(ord(c)))\n inp +=1\n else :\n if (istext and\n (c =='\\n'or (inp+1 0 and\n (odata[-1]==' 'or odata[-1]=='\\t')):\n ch=ord(odata[-1])\n odata[-1]='='\n odata.append(two_hex_digits(ch))\n \n if crlf:odata.append('\\r')\n odata.append('\\n')\n if c =='\\r':\n inp +=2\n else :\n inp +=1\n else :\n if (inp+1 =MAXLINESIZE):\n odata.append('=')\n if crlf:odata.append('\\r')\n odata.append('\\n')\n linelen=0\n \n linelen +=1\n if header and c ==' ':\n c='_'\n odata.append(c)\n inp +=1\n return ''.join(odata)\n \nhex_numbers='0123456789ABCDEF'\ndef hex(n):\n if n ==0:\n return '0'\n \n if n <0:\n n=-n\n sign='-'\n else :\n sign=''\n arr=[]\n \n def hex_gen(n):\n ''\n while n:\n yield n %0x10\n n=n /0x10\n \n for nibble in hex_gen(n):\n arr=[hex_numbers[nibble]]+arr\n return sign+''.join(arr)\n \ndef two_hex_digits(n):\n return hex_numbers[n /0x10]+hex_numbers[n %0x10]\n \n \ndef strhex_to_int(s):\n i=0\n for c in s:\n i=i *0x10+hex_numbers.index(c)\n return i\n \nhqx_encoding='!\"#$%&\\'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr'\n\nDONE=0x7f\nSKIP=0x7e\nFAIL=0x7d\n\ntable_a2b_hqx=[\n\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\n\nFAIL,FAIL,SKIP,FAIL,FAIL,SKIP,FAIL,FAIL,\n\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\n\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\n\nFAIL,0x00,0x01,0x02,0x03,0x04,0x05,0x06,\n\n0x07,0x08,0x09,0x0A,0x0B,0x0C,FAIL,FAIL,\n\n0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,FAIL,\n\n0x14,0x15,DONE,FAIL,FAIL,FAIL,FAIL,FAIL,\n\n0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,\n\n0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,FAIL,\n\n0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,FAIL,\n\n0x2C,0x2D,0x2E,0x2F,FAIL,FAIL,FAIL,FAIL,\n\n0x30,0x31,0x32,0x33,0x34,0x35,0x36,FAIL,\n\n0x37,0x38,0x39,0x3A,0x3B,0x3C,FAIL,FAIL,\n\n0x3D,0x3E,0x3F,FAIL,FAIL,FAIL,FAIL,FAIL,\n\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\n]\n\ndef a2b_hqx(s):\n result=[]\n \n def quadruples_gen(s):\n t=[]\n for c in s:\n res=table_a2b_hqx[ord(c)]\n if res ==SKIP:\n continue\n elif res ==FAIL:\n raise Error('Illegal character')\n elif res ==DONE:\n yield t\n raise Done\n else :\n t.append(res)\n if len(t)==4:\n yield t\n t=[]\n yield t\n \n done=0\n try :\n for snippet in quadruples_gen(s):\n length=len(snippet)\n if length ==4:\n result.append(chr(((snippet[0]&0x3f)<<2)|(snippet[1]>>4)))\n result.append(chr(((snippet[1]&0x0f)<<4)|(snippet[2]>>2)))\n result.append(chr(((snippet[2]&0x03)<<6)|(snippet[3])))\n elif length ==3:\n result.append(chr(((snippet[0]&0x3f)<<2)|(snippet[1]>>4)))\n result.append(chr(((snippet[1]&0x0f)<<4)|(snippet[2]>>2)))\n elif length ==2:\n result.append(chr(((snippet[0]&0x3f)<<2)|(snippet[1]>>4)))\n except Done:\n done=1\n except Error:\n raise\n return (''.join(result),done)\n \n \n \ndef b2a_hqx(s):\n result=[]\n \n def triples_gen(s):\n while s:\n try :\n yield ord(s[0]),ord(s[1]),ord(s[2])\n except IndexError:\n yield tuple([ord(c)for c in s])\n s=s[3:]\n \n for snippet in triples_gen(s):\n length=len(snippet)\n if length ==3:\n result.append(\n hqx_encoding[(snippet[0]&0xfc)>>2])\n result.append(hqx_encoding[\n ((snippet[0]&0x03)<<4)|((snippet[1]&0xf0)>>4)])\n result.append(hqx_encoding[\n (snippet[1]&0x0f)<<2 |((snippet[2]&0xc0)>>6)])\n result.append(hqx_encoding[snippet[2]&0x3f])\n elif length ==2:\n result.append(\n hqx_encoding[(snippet[0]&0xfc)>>2])\n result.append(hqx_encoding[\n ((snippet[0]&0x03)<<4)|((snippet[1]&0xf0)>>4)])\n result.append(hqx_encoding[\n (snippet[1]&0x0f)<<2])\n elif length ==1:\n result.append(\n hqx_encoding[(snippet[0]&0xfc)>>2])\n result.append(hqx_encoding[\n ((snippet[0]&0x03)<<4)])\n return ''.join(result)\n \ncrctab_hqx=[\n0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,\n0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef,\n0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,0x72f7,0x62d6,\n0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de,\n0x2462,0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485,\n0xa56a,0xb54b,0x8528,0x9509,0xe5ee,0xf5cf,0xc5ac,0xd58d,\n0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,0x5695,0x46b4,\n0xb75b,0xa77a,0x9719,0x8738,0xf7df,0xe7fe,0xd79d,0xc7bc,\n0x48c4,0x58e5,0x6886,0x78a7,0x0840,0x1861,0x2802,0x3823,\n0xc9cc,0xd9ed,0xe98e,0xf9af,0x8948,0x9969,0xa90a,0xb92b,\n0x5af5,0x4ad4,0x7ab7,0x6a96,0x1a71,0x0a50,0x3a33,0x2a12,\n0xdbfd,0xcbdc,0xfbbf,0xeb9e,0x9b79,0x8b58,0xbb3b,0xab1a,\n0x6ca6,0x7c87,0x4ce4,0x5cc5,0x2c22,0x3c03,0x0c60,0x1c41,\n0xedae,0xfd8f,0xcdec,0xddcd,0xad2a,0xbd0b,0x8d68,0x9d49,\n0x7e97,0x6eb6,0x5ed5,0x4ef4,0x3e13,0x2e32,0x1e51,0x0e70,\n0xff9f,0xefbe,0xdfdd,0xcffc,0xbf1b,0xaf3a,0x9f59,0x8f78,\n0x9188,0x81a9,0xb1ca,0xa1eb,0xd10c,0xc12d,0xf14e,0xe16f,\n0x1080,0x00a1,0x30c2,0x20e3,0x5004,0x4025,0x7046,0x6067,\n0x83b9,0x9398,0xa3fb,0xb3da,0xc33d,0xd31c,0xe37f,0xf35e,\n0x02b1,0x1290,0x22f3,0x32d2,0x4235,0x5214,0x6277,0x7256,\n0xb5ea,0xa5cb,0x95a8,0x8589,0xf56e,0xe54f,0xd52c,0xc50d,\n0x34e2,0x24c3,0x14a0,0x0481,0x7466,0x6447,0x5424,0x4405,\n0xa7db,0xb7fa,0x8799,0x97b8,0xe75f,0xf77e,0xc71d,0xd73c,\n0x26d3,0x36f2,0x0691,0x16b0,0x6657,0x7676,0x4615,0x5634,\n0xd94c,0xc96d,0xf90e,0xe92f,0x99c8,0x89e9,0xb98a,0xa9ab,\n0x5844,0x4865,0x7806,0x6827,0x18c0,0x08e1,0x3882,0x28a3,\n0xcb7d,0xdb5c,0xeb3f,0xfb1e,0x8bf9,0x9bd8,0xabbb,0xbb9a,\n0x4a75,0x5a54,0x6a37,0x7a16,0x0af1,0x1ad0,0x2ab3,0x3a92,\n0xfd2e,0xed0f,0xdd6c,0xcd4d,0xbdaa,0xad8b,0x9de8,0x8dc9,\n0x7c26,0x6c07,0x5c64,0x4c45,0x3ca2,0x2c83,0x1ce0,0x0cc1,\n0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8,\n0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0,\n]\n\ndef crc_hqx(s,crc):\n for c in s:\n crc=((crc <<8)&0xff00)^crctab_hqx[((crc >>8)&0xff)^ord(c)]\n \n return crc\n \ndef rlecode_hqx(s):\n ''\n\n\n\n \n if not s:\n return ''\n result=[]\n prev=s[0]\n count=1\n \n \n \n \n if s[-1]=='!':\n s=s[1:]+'?'\n else :\n s=s[1:]+'!'\n \n for c in s:\n if c ==prev and count <255:\n count +=1\n else :\n if count ==1:\n if prev !='\\x90':\n result.append(prev)\n else :\n result.extend(['\\x90','\\x00'])\n elif count <4:\n if prev !='\\x90':\n result.extend([prev]*count)\n else :\n result.extend(['\\x90','\\x00']*count)\n else :\n if prev !='\\x90':\n result.extend([prev,'\\x90',chr(count)])\n else :\n result.extend(['\\x90','\\x00','\\x90',chr(count)])\n count=1\n prev=c\n \n return ''.join(result)\n \ndef rledecode_hqx(s):\n s=s.split('\\x90')\n result=[s[0]]\n prev=s[0]\n for snippet in s[1:]:\n count=ord(snippet[0])\n if count >0:\n result.append(prev[-1]*(count -1))\n prev=snippet\n else :\n result.append('\\x90')\n prev='\\x90'\n result.append(snippet[1:])\n \n return ''.join(result)\n \ncrc_32_tab=[\n0x00000000,0x77073096,0xee0e612c,0x990951ba,0x076dc419,\n0x706af48f,0xe963a535,0x9e6495a3,0x0edb8832,0x79dcb8a4,\n0xe0d5e91e,0x97d2d988,0x09b64c2b,0x7eb17cbd,0xe7b82d07,\n0x90bf1d91,0x1db71064,0x6ab020f2,0xf3b97148,0x84be41de,\n0x1adad47d,0x6ddde4eb,0xf4d4b551,0x83d385c7,0x136c9856,\n0x646ba8c0,0xfd62f97a,0x8a65c9ec,0x14015c4f,0x63066cd9,\n0xfa0f3d63,0x8d080df5,0x3b6e20c8,0x4c69105e,0xd56041e4,\n0xa2677172,0x3c03e4d1,0x4b04d447,0xd20d85fd,0xa50ab56b,\n0x35b5a8fa,0x42b2986c,0xdbbbc9d6,0xacbcf940,0x32d86ce3,\n0x45df5c75,0xdcd60dcf,0xabd13d59,0x26d930ac,0x51de003a,\n0xc8d75180,0xbfd06116,0x21b4f4b5,0x56b3c423,0xcfba9599,\n0xb8bda50f,0x2802b89e,0x5f058808,0xc60cd9b2,0xb10be924,\n0x2f6f7c87,0x58684c11,0xc1611dab,0xb6662d3d,0x76dc4190,\n0x01db7106,0x98d220bc,0xefd5102a,0x71b18589,0x06b6b51f,\n0x9fbfe4a5,0xe8b8d433,0x7807c9a2,0x0f00f934,0x9609a88e,\n0xe10e9818,0x7f6a0dbb,0x086d3d2d,0x91646c97,0xe6635c01,\n0x6b6b51f4,0x1c6c6162,0x856530d8,0xf262004e,0x6c0695ed,\n0x1b01a57b,0x8208f4c1,0xf50fc457,0x65b0d9c6,0x12b7e950,\n0x8bbeb8ea,0xfcb9887c,0x62dd1ddf,0x15da2d49,0x8cd37cf3,\n0xfbd44c65,0x4db26158,0x3ab551ce,0xa3bc0074,0xd4bb30e2,\n0x4adfa541,0x3dd895d7,0xa4d1c46d,0xd3d6f4fb,0x4369e96a,\n0x346ed9fc,0xad678846,0xda60b8d0,0x44042d73,0x33031de5,\n0xaa0a4c5f,0xdd0d7cc9,0x5005713c,0x270241aa,0xbe0b1010,\n0xc90c2086,0x5768b525,0x206f85b3,0xb966d409,0xce61e49f,\n0x5edef90e,0x29d9c998,0xb0d09822,0xc7d7a8b4,0x59b33d17,\n0x2eb40d81,0xb7bd5c3b,0xc0ba6cad,0xedb88320,0x9abfb3b6,\n0x03b6e20c,0x74b1d29a,0xead54739,0x9dd277af,0x04db2615,\n0x73dc1683,0xe3630b12,0x94643b84,0x0d6d6a3e,0x7a6a5aa8,\n0xe40ecf0b,0x9309ff9d,0x0a00ae27,0x7d079eb1,0xf00f9344,\n0x8708a3d2,0x1e01f268,0x6906c2fe,0xf762575d,0x806567cb,\n0x196c3671,0x6e6b06e7,0xfed41b76,0x89d32be0,0x10da7a5a,\n0x67dd4acc,0xf9b9df6f,0x8ebeeff9,0x17b7be43,0x60b08ed5,\n0xd6d6a3e8,0xa1d1937e,0x38d8c2c4,0x4fdff252,0xd1bb67f1,\n0xa6bc5767,0x3fb506dd,0x48b2364b,0xd80d2bda,0xaf0a1b4c,\n0x36034af6,0x41047a60,0xdf60efc3,0xa867df55,0x316e8eef,\n0x4669be79,0xcb61b38c,0xbc66831a,0x256fd2a0,0x5268e236,\n0xcc0c7795,0xbb0b4703,0x220216b9,0x5505262f,0xc5ba3bbe,\n0xb2bd0b28,0x2bb45a92,0x5cb36a04,0xc2d7ffa7,0xb5d0cf31,\n0x2cd99e8b,0x5bdeae1d,0x9b64c2b0,0xec63f226,0x756aa39c,\n0x026d930a,0x9c0906a9,0xeb0e363f,0x72076785,0x05005713,\n0x95bf4a82,0xe2b87a14,0x7bb12bae,0x0cb61b38,0x92d28e9b,\n0xe5d5be0d,0x7cdcefb7,0x0bdbdf21,0x86d3d2d4,0xf1d4e242,\n0x68ddb3f8,0x1fda836e,0x81be16cd,0xf6b9265b,0x6fb077e1,\n0x18b74777,0x88085ae6,0xff0f6a70,0x66063bca,0x11010b5c,\n0x8f659eff,0xf862ae69,0x616bffd3,0x166ccf45,0xa00ae278,\n0xd70dd2ee,0x4e048354,0x3903b3c2,0xa7672661,0xd06016f7,\n0x4969474d,0x3e6e77db,0xaed16a4a,0xd9d65adc,0x40df0b66,\n0x37d83bf0,0xa9bcae53,0xdebb9ec5,0x47b2cf7f,0x30b5ffe9,\n0xbdbdf21c,0xcabac28a,0x53b39330,0x24b4a3a6,0xbad03605,\n0xcdd70693,0x54de5729,0x23d967bf,0xb3667a2e,0xc4614ab8,\n0x5d681b02,0x2a6f2b94,0xb40bbe37,0xc30c8ea1,0x5a05df1b,\n0x2d02ef8d\n]\n\ndef crc32(s,crc=0):\n result=0\n crc=~int(crc)&0xffffffff\n \n for c in s:\n crc=crc_32_tab[(crc ^int(ord(c)))&0xff]^(crc >>8)\n \n \n \n result=crc ^0xffffffff\n \n if result >2 **31:\n result=((result+2 **31)%2 **32)-2 **31\n \n return result\n", ["_base64", "_binascii"]], "bisect": [".py", "''\n\n\ndef insort_right(a,x,lo=0,hi=None,*,key=None):\n ''\n\n\n\n\n\n\n\n \n if key is None:\n lo=bisect_right(a,x,lo,hi)\n else:\n lo=bisect_right(a,key(x),lo,hi,key=key)\n a.insert(lo,x)\n \n \ndef bisect_right(a,x,lo=0,hi=None,*,key=None):\n ''\n\n\n\n\n\n\n\n\n\n \n \n if lo <0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi=len(a)\n \n \n if key is None:\n while lo =9:\n names=day_name\n else:\n names=day_abbr\n return names[day][:width].center(width)\n \n def formatweekheader(self,width):\n ''\n\n \n return ' '.join(self.formatweekday(i,width)for i in self.iterweekdays())\n \n def formatmonthname(self,theyear,themonth,width,withyear=True):\n ''\n\n \n s=month_name[themonth]\n if withyear:\n s=\"%s %r\"%(s,theyear)\n return s.center(width)\n \n def prmonth(self,theyear,themonth,w=0,l=0):\n ''\n\n \n print(self.formatmonth(theyear,themonth,w,l),end='')\n \n def formatmonth(self,theyear,themonth,w=0,l=0):\n ''\n\n \n w=max(2,w)\n l=max(1,l)\n s=self.formatmonthname(theyear,themonth,7 *(w+1)-1)\n s=s.rstrip()\n s +='\\n'*l\n s +=self.formatweekheader(w).rstrip()\n s +='\\n'*l\n for week in self.monthdays2calendar(theyear,themonth):\n s +=self.formatweek(week,w).rstrip()\n s +='\\n'*l\n return s\n \n def formatyear(self,theyear,w=2,l=1,c=6,m=3):\n ''\n\n \n w=max(2,w)\n l=max(1,l)\n c=max(2,c)\n colwidth=(w+1)*7 -1\n v=[]\n a=v.append\n a(repr(theyear).center(colwidth *m+c *(m -1)).rstrip())\n a('\\n'*l)\n header=self.formatweekheader(w)\n for(i,row)in enumerate(self.yeardays2calendar(theyear,m)):\n \n months=range(m *i+1,min(m *(i+1)+1,13))\n a('\\n'*l)\n names=(self.formatmonthname(theyear,k,colwidth,False)\n for k in months)\n a(formatstring(names,colwidth,c).rstrip())\n a('\\n'*l)\n headers=(header for k in months)\n a(formatstring(headers,colwidth,c).rstrip())\n a('\\n'*l)\n \n height=max(len(cal)for cal in row)\n for j in range(height):\n weeks=[]\n for cal in row:\n if j >=len(cal):\n weeks.append('')\n else:\n weeks.append(self.formatweek(cal[j],w))\n a(formatstring(weeks,colwidth,c).rstrip())\n a('\\n'*l)\n return ''.join(v)\n \n def pryear(self,theyear,w=0,l=0,c=6,m=3):\n ''\n print(self.formatyear(theyear,w,l,c,m),end='')\n \n \nclass HTMLCalendar(Calendar):\n ''\n\n \n \n \n cssclasses=[\"mon\",\"tue\",\"wed\",\"thu\",\"fri\",\"sat\",\"sun\"]\n \n \n cssclasses_weekday_head=cssclasses\n \n \n cssclass_noday=\"noday\"\n \n \n cssclass_month_head=\"month\"\n \n \n cssclass_month=\"month\"\n \n \n cssclass_year_head=\"year\"\n \n \n cssclass_year=\"year\"\n \n def formatday(self,day,weekday):\n ''\n\n \n if day ==0:\n \n return ' '%self.cssclass_noday\n else:\n return '%d'%(self.cssclasses[weekday],day)\n \n def formatweek(self,theweek):\n ''\n\n \n s=''.join(self.formatday(d,wd)for(d,wd)in theweek)\n return '%s'%s\n \n def formatweekday(self,day):\n ''\n\n \n return '%s'%(\n self.cssclasses_weekday_head[day],day_abbr[day])\n \n def formatweekheader(self):\n ''\n\n \n s=''.join(self.formatweekday(i)for i in self.iterweekdays())\n return '%s'%s\n \n def formatmonthname(self,theyear,themonth,withyear=True):\n ''\n\n \n if withyear:\n s='%s %s'%(month_name[themonth],theyear)\n else:\n s='%s'%month_name[themonth]\n return '%s'%(\n self.cssclass_month_head,s)\n \n def formatmonth(self,theyear,themonth,withyear=True):\n ''\n\n \n v=[]\n a=v.append\n a(''%(\n self.cssclass_month))\n a('\\n')\n a(self.formatmonthname(theyear,themonth,withyear=withyear))\n a('\\n')\n a(self.formatweekheader())\n a('\\n')\n for week in self.monthdays2calendar(theyear,themonth):\n a(self.formatweek(week))\n a('\\n')\n a('
')\n a('\\n')\n return ''.join(v)\n \n def formatyear(self,theyear,width=3):\n ''\n\n \n v=[]\n a=v.append\n width=max(width,1)\n a(''%\n self.cssclass_year)\n a('\\n')\n a(''%(\n width,self.cssclass_year_head,theyear))\n for i in range(JANUARY,JANUARY+12,width):\n \n months=range(i,min(i+width,13))\n a('')\n for m in months:\n a('')\n a('')\n a('
%s
')\n a(self.formatmonth(theyear,m,withyear=False))\n a('
')\n return ''.join(v)\n \n def formatyearpage(self,theyear,width=3,css='calendar.css',encoding=None):\n ''\n\n \n if encoding is None:\n encoding=sys.getdefaultencoding()\n v=[]\n a=v.append\n a('\\n'%encoding)\n a('\\n')\n a('\\n')\n a('\\n')\n a('\\n'%encoding)\n if css is not None:\n a('\\n'%css)\n a('Calendar for %d\\n'%theyear)\n a('\\n')\n a('\\n')\n a(self.formatyear(theyear,width))\n a('\\n')\n a('\\n')\n return ''.join(v).encode(encoding,\"xmlcharrefreplace\")\n \n \nclass different_locale:\n def __init__(self,locale):\n self.locale=locale\n self.oldlocale=None\n \n def __enter__(self):\n self.oldlocale=_locale.setlocale(_locale.LC_TIME,None)\n _locale.setlocale(_locale.LC_TIME,self.locale)\n \n def __exit__(self,*args):\n if self.oldlocale is None:\n return\n _locale.setlocale(_locale.LC_TIME,self.oldlocale)\n \n \ndef _get_default_locale():\n locale=_locale.setlocale(_locale.LC_TIME,None)\n if locale ==\"C\":\n with different_locale(\"\"):\n \n \n locale=_locale.setlocale(_locale.LC_TIME,None)\n return locale\n \n \nclass LocaleTextCalendar(TextCalendar):\n ''\n\n\n \n \n def __init__(self,firstweekday=0,locale=None):\n TextCalendar.__init__(self,firstweekday)\n if locale is None:\n locale=_get_default_locale()\n self.locale=locale\n \n def formatweekday(self,day,width):\n with different_locale(self.locale):\n return super().formatweekday(day,width)\n \n def formatmonthname(self,theyear,themonth,width,withyear=True):\n with different_locale(self.locale):\n return super().formatmonthname(theyear,themonth,width,withyear)\n \n \nclass LocaleHTMLCalendar(HTMLCalendar):\n ''\n\n\n \n def __init__(self,firstweekday=0,locale=None):\n HTMLCalendar.__init__(self,firstweekday)\n if locale is None:\n locale=_get_default_locale()\n self.locale=locale\n \n def formatweekday(self,day):\n with different_locale(self.locale):\n return super().formatweekday(day)\n \n def formatmonthname(self,theyear,themonth,withyear=True):\n with different_locale(self.locale):\n return super().formatmonthname(theyear,themonth,withyear)\n \n \nc=TextCalendar()\n\nfirstweekday=c.getfirstweekday\n\ndef setfirstweekday(firstweekday):\n if not MONDAY <=firstweekday <=SUNDAY:\n raise IllegalWeekdayError(firstweekday)\n c.firstweekday=firstweekday\n \nmonthcalendar=c.monthdayscalendar\nprweek=c.prweek\nweek=c.formatweek\nweekheader=c.formatweekheader\nprmonth=c.prmonth\nmonth=c.formatmonth\ncalendar=c.formatyear\nprcal=c.pryear\n\n\n\n_colwidth=7 *3 -1\n_spacing=6\n\n\ndef format(cols,colwidth=_colwidth,spacing=_spacing):\n ''\n print(formatstring(cols,colwidth,spacing))\n \n \ndef formatstring(cols,colwidth=_colwidth,spacing=_spacing):\n ''\n spacing *=' '\n return spacing.join(c.center(colwidth)for c in cols)\n \n \nEPOCH=1970\n_EPOCH_ORD=datetime.date(EPOCH,1,1).toordinal()\n\n\ndef timegm(tuple):\n ''\n year,month,day,hour,minute,second=tuple[:6]\n days=datetime.date(year,month,1).toordinal()-_EPOCH_ORD+day -1\n hours=days *24+hour\n minutes=hours *60+minute\n seconds=minutes *60+second\n return seconds\n \n \ndef main(args):\n import argparse\n parser=argparse.ArgumentParser()\n textgroup=parser.add_argument_group('text only arguments')\n htmlgroup=parser.add_argument_group('html only arguments')\n textgroup.add_argument(\n \"-w\",\"--width\",\n type=int,default=2,\n help=\"width of date column (default 2)\"\n )\n textgroup.add_argument(\n \"-l\",\"--lines\",\n type=int,default=1,\n help=\"number of lines for each week (default 1)\"\n )\n textgroup.add_argument(\n \"-s\",\"--spacing\",\n type=int,default=6,\n help=\"spacing between months (default 6)\"\n )\n textgroup.add_argument(\n \"-m\",\"--months\",\n type=int,default=3,\n help=\"months per row (default 3)\"\n )\n htmlgroup.add_argument(\n \"-c\",\"--css\",\n default=\"calendar.css\",\n help=\"CSS to use for page\"\n )\n parser.add_argument(\n \"-L\",\"--locale\",\n default=None,\n help=\"locale to be used from month and weekday names\"\n )\n parser.add_argument(\n \"-e\",\"--encoding\",\n default=None,\n help=\"encoding to use for output\"\n )\n parser.add_argument(\n \"-t\",\"--type\",\n default=\"text\",\n choices=(\"text\",\"html\"),\n help=\"output type (text or html)\"\n )\n parser.add_argument(\n \"year\",\n nargs='?',type=int,\n help=\"year number (1-9999)\"\n )\n parser.add_argument(\n \"month\",\n nargs='?',type=int,\n help=\"month number (1-12, text only)\"\n )\n \n options=parser.parse_args(args[1:])\n \n if options.locale and not options.encoding:\n parser.error(\"if --locale is specified --encoding is required\")\n sys.exit(1)\n \n locale=options.locale,options.encoding\n \n if options.type ==\"html\":\n if options.locale:\n cal=LocaleHTMLCalendar(locale=locale)\n else:\n cal=HTMLCalendar()\n encoding=options.encoding\n if encoding is None:\n encoding=sys.getdefaultencoding()\n optdict=dict(encoding=encoding,css=options.css)\n write=sys.stdout.buffer.write\n if options.year is None:\n write(cal.formatyearpage(datetime.date.today().year,**optdict))\n elif options.month is None:\n write(cal.formatyearpage(options.year,**optdict))\n else:\n parser.error(\"incorrect number of arguments\")\n sys.exit(1)\n else:\n if options.locale:\n cal=LocaleTextCalendar(locale=locale)\n else:\n cal=TextCalendar()\n optdict=dict(w=options.width,l=options.lines)\n if options.month is None:\n optdict[\"c\"]=options.spacing\n optdict[\"m\"]=options.months\n if options.year is None:\n result=cal.formatyear(datetime.date.today().year,**optdict)\n elif options.month is None:\n result=cal.formatyear(options.year,**optdict)\n else:\n result=cal.formatmonth(options.year,options.month,**optdict)\n write=sys.stdout.write\n if options.encoding:\n result=result.encode(options.encoding)\n write=sys.stdout.buffer.write\n write(result)\n \n \nif __name__ ==\"__main__\":\n main(sys.argv)\n", ["argparse", "datetime", "enum", "itertools", "locale", "sys", "warnings"]], "cmath": [".py", "\n\n\n\n\n\n\n\n\n\nimport math\nimport sys\n\ndef _takes_complex(func):\n def decorated(x):\n if isinstance(x,complex):\n return func(x)\n elif type(x)in [int,float]:\n return func(complex(x))\n elif hasattr(x,'__complex__'):\n c=x.__complex__()\n if not isinstance(c,complex):\n raise TypeError(\"A complex number is required\")\n else :\n return func(c)\n elif hasattr(x,'__float__'):\n try :\n c=complex(x.__float__(),0)\n except :\n raise TypeError(\"A complex number is required\")\n return func(c)\n elif hasattr(x,'__index__'):\n try :\n c=complex(x.__index__(),0)\n except :\n raise TypeError(\"A complex number is required\")\n return func(c)\n else :\n raise TypeError(\"A complex number is required\")\n if hasattr(func,'__doc__'):\n decorated.__doc__=func.__doc__\n if hasattr(func,'__name__'):\n decorated.__name__=func.__name__\n return decorated\n \n@_takes_complex\ndef isfinite(x):\n return math.isfinite(x.imag)and math.isfinite(x.real)\n \n@_takes_complex\ndef phase(x):\n ''\n return math.atan2(x.imag,x.real)\n \n@_takes_complex\ndef polar(x):\n ''\n\n\n\n\n \n phi=math.atan2(x.imag,x.real)\n if math.isnan(x.imag):\n if math.isinf(x.real):\n return abs(x.real),nan\n return nan,nan\n elif math.isinf(x.imag):\n r=inf\n elif math.isinf(x.real):\n r=inf\n else :\n r=math.sqrt(x.real **2+x.imag **2)\n if math.isinf(r):\n raise OverflowError(\"math range error\")\n return r,phi\n \ndef rect(r,phi):\n ''\n\n \n if math.isnan(r):\n if not math.isnan(phi)and not phi:\n return complex(nan,0)\n return complex(nan,nan)\n elif math.isnan(phi):\n if not r:\n return complex(0,0)\n elif math.isinf(r):\n return complex(inf,nan)\n return complex(nan,nan)\n if math.isinf(r)or math.isinf(phi):\n \n \n if math.isinf(phi)and r !=.0 and not math.isnan(r):\n raise ValueError(\"math domain error\")\n \n \n \n \n if -inf 0:\n _real=math.copysign(inf,math.cos(phi))\n _imag=math.copysign(inf,math.sin(phi))\n else :\n _real=-math.copysign(inf,math.cos(phi));\n _imag=-math.copysign(inf,math.sin(phi));\n return complex(_real,_imag)\n return _SPECIAL_VALUE(complex(r,phi),_rect_special_values)\n \n else :\n if phi ==.0:\n \n \n \n return complex(r,phi *r)\n else :\n return complex(r *math.cos(phi),r *math.sin(phi))\n \n@_takes_complex\ndef sqrt(x):\n ''\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n s,d,ax,ay=.0,.0,math.fabs(x.real),math.fabs(x.imag)\n \n ret=_SPECIAL_VALUE(x,_sqrt_special_values)\n if ret is not None :\n return ret\n \n if math.isinf(x.imag):\n return complex(inf,x.imag)\n \n if x.real ==.0 and x.imag ==.0:\n _real=.0\n _imag=x.imag\n return complex(_real,_imag)\n \n if ay ==0:\n s=math.sqrt(ax)\n d=0\n elif ax 0. or ay >0.):\n \n AX=math.ldexp(ax,_CM_SCALE_UP)\n AY=math.ldexp(ay,_CM_SCALE_UP)\n S=math.sqrt((AX+math.hypot(AX,AY))/2.0)\n D=AY /(2 *S)\n s=math.ldexp(S,_CM_SCALE_DOWN)\n d=math.ldexp(D,_CM_SCALE_DOWN)\n else :\n ax /=8.0 ;\n s=2.0 *math.sqrt(ax+math.hypot(ax,ay /8.0));\n d=ay /(2.0 *s)\n \n if x.real >=.0:\n _real=s ;\n _imag=math.copysign(d,x.imag)\n else :\n _real=d ;\n _imag=math.copysign(s,x.imag)\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef acos(x):\n ''\n\n\n\n\n \n \n ret=_SPECIAL_VALUE(x,_acos_special_values)\n if ret is not None :\n if isinstance(ret,Exception):\n raise ret\n return ret\n \n if math.fabs(x.real)>_CM_LARGE_DOUBLE or math.fabs(x.imag)>_CM_LARGE_DOUBLE:\n \n _real=math.atan2(math.fabs(x.imag),x.real)\n \n \n \n if x.real <0:\n _imag=-math.copysign(math.log(math.hypot(x.real /2.,x.imag /2.))+_M_LN2 *2.,x.imag);\n else :\n _imag=math.copysign(math.log(math.hypot(x.real /2.,x.imag /2.))+_M_LN2 *2.,-x.imag);\n elif math.isnan(x.real):\n return complex(nan,nan)\n elif math.isnan(x.imag):\n if x.real ==0:\n return complex(pi /2,nan)\n return complex(nan,nan)\n else :\n s1=complex(float(1 -x.real),-x.imag)\n s1=sqrt(s1)\n s2=complex(1.0+x.real,x.imag)\n s2=sqrt(s2)\n _real=2.0 *math.atan2(s1.real,s2.real)\n _imag=math.asinh(s2.real *s1.imag -s2.imag *s1.real)\n if not x.imag:\n if x.real >1:\n _real=0\n elif x.real <-1:\n _real=math.pi\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef acosh(x):\n ''\n\n\n\n \n ret=_SPECIAL_VALUE(x,_acosh_special_values)\n if ret is not None :\n return ret\n \n if math.fabs(x.real)>_CM_LARGE_DOUBLE or math.fabs(x.imag)>_CM_LARGE_DOUBLE:\n \n _real=math.log(math.hypot(x.real /2.0,x.imag /2.0))+_M_LN2 *2.0\n _imag=math.atan2(x.imag,x.real);\n else :\n s1=sqrt(complex(x.real -1.0,x.imag))\n s2=sqrt(complex(x.real+1.0,x.imag))\n _real=math.asinh(s1.real *s2.real+s1.imag *s2.imag)\n _imag=2. *math.atan2(s1.imag,s2.real)\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef asin(x):\n ''\n\n\n\n \n \n s=complex(-x.imag,x.real)\n s=asinh(s)\n return complex(s.imag,-s.real)\n \n@_takes_complex\ndef asinh(x):\n ''\n\n\n\n\n \n ret=_SPECIAL_VALUE(x,_asinh_special_values)\n if ret is not None :\n return ret\n \n if math.fabs(x.real)>_CM_LARGE_DOUBLE or math.fabs(x.imag)>_CM_LARGE_DOUBLE:\n if x.imag >=.0:\n _real=math.copysign(math.log(math.hypot(x.real /2.,x.imag /2.))+_M_LN2 *2.,x.real)\n else :\n _real=-math.copysign(math.log(math.hypot(x.real /2.,x.imag /2.))+_M_LN2 *2.,-x.real)\n _imag=math.atan2(x.imag,math.fabs(x.real))\n else :\n s1=sqrt(complex(1.0+x.imag,-x.real))\n s2=sqrt(complex(1.0 -x.imag,x.real))\n _real=math.asinh(s1.real *s2.imag -s2.real *s1.imag)\n _imag=math.atan2(x.imag,s1.real *s2.real -s1.imag *s2.imag)\n return complex(_real,_imag)\n \n@_takes_complex\ndef atan(x):\n ''\n\n\n\n\n \n ret=_SPECIAL_VALUE(x,_atan_special_values)\n if ret is not None :\n return ret\n \n if isinf(x):\n return complex(math.copysign(1,x.real)*pi /2,\n math.copysign(0,x.imag))\n s=atanh(complex(-x.imag,x.real))\n return complex(s.imag,-s.real)\n \n@_takes_complex\ndef atanh(x):\n ''\n\n\n\n\n \n \n ret=_SPECIAL_VALUE(x,_atanh_special_values)\n if ret is not None :\n return ret\n \n if isinf(x):\n return complex(math.copysign(0,x.real),\n math.copysign(1,x.imag)*pi /2)\n \n \n if x.real <.0:\n return -(atanh(-x))\n \n ay=math.fabs(x.imag)\n \n if x.real >_CM_SQRT_LARGE_DOUBLE or ay >_CM_SQRT_LARGE_DOUBLE:\n \n \n \n \n \n h=math.hypot(x.real /2.,x.imag /2.)\n _real=x.real /4. /h /h\n \n \n \n \n \n \n _imag=-math.copysign(math.pi /2.,-x.imag)\n \n elif x.real ==1.0 and ay <_CM_SQRT_DBL_MIN:\n \n \n if (ay ==.0):\n raise ValueError(\"math domain error\")\n else :\n _real=-math.log(math.sqrt(ay)/math.sqrt(math.hypot(ay,2.)))\n _imag=math.copysign(math.atan2(2.0,-ay)/2,x.imag)\n \n else :\n \n _real=math.log1p(4. *x.real /((1 -x.real)*(1 -x.real)+ay *ay))/4.\n _imag=-math.atan2(-2. *x.imag,(1 -x.real)*(1+x.real)-ay *ay)/2.\n errno=0\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef cos(x):\n ''\n return cosh(complex(-x.imag,x.real))\n \n@_takes_complex\ndef cosh(x):\n ''\n \n ret=_SPECIAL_VALUE(x,_cosh_special_values)\n if ret is not None :\n if isinstance(ret,Exception):\n raise ret\n return ret\n \n if not math.isinf(x.real)and math.fabs(x.real)>_CM_LOG_LARGE_DOUBLE:\n \n \n x_minus_one=x.real -math.copysign(1.0,x.real)\n _real=cos(x.imag)*math.cosh(x_minus_one)*math.e\n _imag=sin(x.imag)*math.sinh(x_minus_one)*math.e\n elif math.isinf(x.real)and x.imag ==0:\n if x.real >0:\n return x\n else :\n return complex(inf,-x.imag)\n elif math.isinf(x.imag):\n raise ValueError(\"math domain error\")\n else :\n _real=math.cos(x.imag)*math.cosh(x.real)\n _imag=math.sin(x.imag)*math.sinh(x.real)\n \n ret=complex(_real,_imag)\n return ret\n \n@_takes_complex\ndef exp(x):\n ''\n if math.isinf(x.real)or math.isinf(x.imag):\n \n if math.isinf(x.imag)and (-inf 0):\n raise ValueError(\"math domain error\")\n \n if math.isinf(x.real)and -inf 0:\n _real=math.copysign(inf,math.cos(x.imag))\n _imag=math.copysign(inf,math.sin(x.imag))\n else :\n _real=math.copysign(.0,math.cos(x.imag))\n _imag=math.copysign(.0,math.sin(x.imag))\n return complex(_real,_imag)\n \n return _SPECIAL_VALUE(x,_exp_special_values)\n \n if math.isnan(x.real)and x.imag ==0:\n return x\n \n if x.real >_CM_LOG_LARGE_DOUBLE:\n l=math.exp(x.real -1.);\n _real=l *math.cos(x.imag)*math.e\n _imag=l *math.sin(x.imag)*math.e\n else :\n l=math.exp(x.real);\n _real=l *math.cos(x.imag)\n _imag=l *math.sin(x.imag)\n \n if math.isinf(_real)or math.isinf(_imag):\n raise OverflowError()\n \n return complex(_real,_imag)\n \ndef isclose(x,y,*,rel_tol=1e-09,abs_tol=0.0):\n try :\n complex(x)\n except ValueError:\n raise TypeError(f\"must be a number, not {x.__class__.__name__}\")\n try :\n complex(y)\n except ValueError:\n raise TypeError(f\"must be a number, not {y.__class__.__name__}\")\n rel_tol=float(rel_tol)\n abs_tol=float(abs_tol)\n if rel_tol <0.0 or abs_tol <0.0:\n raise ValueError('tolerances must be non-negative')\n if x is inf or x is _NINF or y is inf or y is _NINF:\n return y is x\n if x is nan or y is nan:\n return False\n return abs(x -y)<=max(rel_tol *float(max(abs(x),abs(y))),abs_tol)\n \n@_takes_complex\ndef isinf(x):\n ''\n return math.isinf(x.real)or math.isinf(x.imag)\n \n@_takes_complex\ndef isnan(x):\n ''\n return math.isnan(x.real)or math.isnan(x.imag)\n \n \n@_takes_complex\ndef _to_complex(x):\n return x\n \ndef log(x,base=None ):\n ''\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n x=_to_complex(x)\n \n \n \n \n \n \n denom=1 if base is None else log(base)\n ''\n\n\n\n \n \n ret=_SPECIAL_VALUE(x,_log_special_values)\n if ret is not None :\n return ret\n \n if math.isnan(x.real):\n return complex(inf if math.isinf(x.imag)else nan,nan)\n elif math.isnan(x.imag):\n return complex(inf if math.isinf(x.real)else nan,nan)\n \n ax=math.fabs(x.real)\n ay=math.fabs(x.imag)\n \n if ax >_CM_LARGE_DOUBLE or ay >_CM_LARGE_DOUBLE:\n _real=math.log(math.hypot(ax /2.0,ay /2.0))+_M_LN2\n elif ax .0 or ay >.0:\n \n _real=math.log(math.hypot(math.ldexp(ax,sys.float_info.mant_dig),math.ldexp(ay,sys.float_info.mant_dig)))-sys.float_info.mant_dig *_M_LN2\n else :\n \n raise ValueError(\"math domain error\")\n _real=-inf\n _imag=math.atan2(x.imag,x.real)\n else :\n h=math.hypot(ax,ay)\n _real=math.log(h)/denom\n if not ay:\n if type(_real)==complex:\n return _real\n if x.real <0:\n return complex(_real,math.copysign(math.pi,x.imag))\n return complex(_real,x.imag)\n _imag=math.atan2(x.imag,x.real)\n return complex(_real,_imag)\n \n@_takes_complex\ndef log10(x):\n ''\n\n\n\n \n ret=log(x)\n _real=ret.real /_M_LN10\n _imag=ret.imag /_M_LN10\n return complex(_real,_imag)\n \n@_takes_complex\ndef sin(x):\n ''\n \n s=complex(-x.imag,x.real)\n s=sinh(s)\n return complex(s.imag,-s.real)\n \n@_takes_complex\ndef sinh(x):\n ''\n \n ret=_SPECIAL_VALUE(x,_sinh_special_values)\n if ret is not None :\n if isinstance(ret,Exception):\n raise ret\n return ret\n \n if math.isinf(x.real)or math.isinf(x.imag):\n \n \n if math.isinf(x.imag)and not math.isnan(x.real):\n raise ValueError(\"math domain error\")\n \n if math.isinf(x.real)and -inf 0:\n _real=math.copysign(inf,math.cos(x.imag))\n _imag=math.copysign(inf,math.sin(x.imag))\n else :\n _real=-math.copysign(inf,math.cos(x.imag))\n _imag=math.copysign(inf,math.sin(x.imag))\n return complex(_real,_imag)\n \n return _SPECIAL_VALUE(x,_sinh_special_values)\n \n if math.fabs(x.real)>_CM_LOG_LARGE_DOUBLE:\n x_minus_one=x.real -math.copysign(1.0,x.real)\n z=complex(x_minus_one,x.imag)\n _real=math.cos(z.imag)*math.sinh(z.real)*math.e\n _imag=math.sin(z.imag)*math.cosh(z.real)*math.e\n else :\n _real=math.cos(x.imag)*math.sinh(x.real)\n _imag=math.sin(x.imag)*math.cosh(x.real)\n \n if math.isinf(_real)or math.isinf(_imag):\n raise OverflowError()\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef tan(x):\n ''\n if math.isnan(x.real):\n if math.isinf(x.imag):\n return complex(0,math.copysign(1,x.imag))\n return complex(nan,nan)\n elif math.isnan(x.imag):\n if not x.real:\n return complex(math.copysign(0,x.real),nan)\n return complex(nan,nan)\n s=tanh(complex(-x.imag,x.real))\n return complex(s.imag,-s.real)\n \n@_takes_complex\ndef tanh(x):\n ''\n ''\n\n\n \n \n \n \n \n \n \n \n \n \n if math.isnan(x.real):\n if x.imag ==0:\n return complex(nan,math.copysign(0,x.imag))\n return complex(nan,nan)\n elif math.isnan(x.imag):\n if math.isinf(x.real):\n return complex(math.copysign(1,x.real),0)\n return complex(nan,nan)\n \n if isinf(x):\n if math.isinf(x.imag)and -inf 0:\n _real=1.0\n _imag=math.copysign(.0,2.0 *math.sin(x.imag)*math.cos(x.imag))\n else :\n _real=-1.0\n _imag=math.copysign(.0,2. *math.sin(x.imag)*math.cos(x.imag))\n return complex(_real,_imag)\n return _SPECIAL_VALUE(x,_tanh_special_values)\n \n \n if math.fabs(x.real)>_CM_LOG_LARGE_DOUBLE:\n _real=math.copysign(1.,x.real)\n _imag=4. *math.sin(x.imag)*math.cos(x.imag)*math.exp(-2. *math.fabs(x.real))\n else :\n tx=math.tanh(x.real)\n ty=math.tan(x.imag)\n cx=1.0 /math.cosh(x.real)\n txty=tx *ty\n denom=1.+txty *txty\n _real=tx *(1.+ty *ty)/denom\n _imag=((ty /denom)*cx)*cx\n return complex(_real,_imag)\n \n \nFunctionType=type(_takes_complex)\nlocs=locals()\nkeys=list(locs.keys())\nfor f in keys:\n if type(locs[f])is FunctionType and not f.startswith(\"_\"):\n locals()[f]=type(abs)(locals()[f])\n \npi=math.pi\ne=math.e\ntau=math.tau\n\n_CM_LARGE_DOUBLE=sys.float_info.max /4\n_CM_SQRT_LARGE_DOUBLE=math.sqrt(_CM_LARGE_DOUBLE)\n_CM_LOG_LARGE_DOUBLE=math.log(_CM_LARGE_DOUBLE)\n_CM_SQRT_DBL_MIN=math.sqrt(sys.float_info.min)\n_M_LN2=0.6931471805599453094\n_M_LN10=2.302585092994045684\n\nif sys.float_info.radix ==2:\n _CM_SCALE_UP=int((2 *(sys.float_info.mant_dig /2)+1))\nelif sys.float_info.radix ==16:\n _CM_SCALE_UP=int((4 *sys.float_info.mant_dig+1))\nelse :\n raise (\"cmath implementation expects the float base to be either 2 or 16, got \"+str(sys.float_info.radix)+\" instead.\")\n_CM_SCALE_DOWN=int((-(_CM_SCALE_UP+1)/2))\n\ninf=float('inf')\ninfj=complex(0.0,inf)\n_NINF=float('-inf')\nnan=float('nan')\nnanj=complex(0.0,float('nan'))\n\n_P14=0.25 *pi\n_P12=0.5 *pi\n_P34=0.75 *pi\n_U=-9.5426319407711027e33\n\n\n_ST_NINF=0\n_ST_NEG=1\n_ST_NZERO=2\n_ST_PZERO=3\n_ST_POS=4\n_ST_PINF=5\n_ST_NAN=6\n\n\ndef _SPECIAL_VALUE(z,table):\n if not math.isfinite(z.real)or not math.isfinite(z.imag):\n return table[_special_type(z.real)][_special_type(z.imag)]\n else :\n return None\n \ndef _special_type(x):\n if -inf ):\"\n misc_header=\"Miscellaneous help topics:\"\n undoc_header=\"Undocumented commands:\"\n nohelp=\"*** No help on %s\"\n use_rawinput=1\n \n def __init__(self,completekey='tab',stdin=None ,stdout=None ):\n ''\n\n\n\n\n\n\n\n\n \n if stdin is not None :\n self.stdin=stdin\n else :\n self.stdin=sys.stdin\n if stdout is not None :\n self.stdout=stdout\n else :\n self.stdout=sys.stdout\n self.cmdqueue=[]\n self.completekey=completekey\n \n def cmdloop(self,intro=None ):\n ''\n\n\n\n \n \n self.preloop()\n if self.use_rawinput and self.completekey:\n try :\n import readline\n self.old_completer=readline.get_completer()\n readline.set_completer(self.complete)\n readline.parse_and_bind(self.completekey+\": complete\")\n except ImportError:\n pass\n try :\n if intro is not None :\n self.intro=intro\n if self.intro:\n self.stdout.write(str(self.intro)+\"\\n\")\n stop=None\n while not stop:\n if self.cmdqueue:\n line=self.cmdqueue.pop(0)\n else :\n if self.use_rawinput:\n try :\n line=input(self.prompt)\n except EOFError:\n line='EOF'\n else :\n self.stdout.write(self.prompt)\n self.stdout.flush()\n line=self.stdin.readline()\n if not len(line):\n line='EOF'\n else :\n line=line.rstrip('\\r\\n')\n line=self.precmd(line)\n stop=self.onecmd(line)\n stop=self.postcmd(stop,line)\n self.postloop()\n finally :\n if self.use_rawinput and self.completekey:\n try :\n import readline\n readline.set_completer(self.old_completer)\n except ImportError:\n pass\n \n \n def precmd(self,line):\n ''\n\n\n \n return line\n \n def postcmd(self,stop,line):\n ''\n return stop\n \n def preloop(self):\n ''\n pass\n \n def postloop(self):\n ''\n\n\n \n pass\n \n def parseline(self,line):\n ''\n\n\n \n line=line.strip()\n if not line:\n return None ,None ,line\n elif line[0]=='?':\n line='help '+line[1:]\n elif line[0]=='!':\n if hasattr(self,'do_shell'):\n line='shell '+line[1:]\n else :\n return None ,None ,line\n i,n=0,len(line)\n while i 0:\n cmd,args,foo=self.parseline(line)\n if cmd =='':\n compfunc=self.completedefault\n else :\n try :\n compfunc=getattr(self,'complete_'+cmd)\n except AttributeError:\n compfunc=self.completedefault\n else :\n compfunc=self.completenames\n self.completion_matches=compfunc(text,line,begidx,endidx)\n try :\n return self.completion_matches[state]\n except IndexError:\n return None\n \n def get_names(self):\n \n \n return dir(self.__class__)\n \n def complete_help(self,*args):\n commands=set(self.completenames(*args))\n topics=set(a[5:]for a in self.get_names()\n if a.startswith('help_'+args[0]))\n return list(commands |topics)\n \n def do_help(self,arg):\n ''\n if arg:\n \n try :\n func=getattr(self,'help_'+arg)\n except AttributeError:\n try :\n doc=getattr(self,'do_'+arg).__doc__\n if doc:\n self.stdout.write(\"%s\\n\"%str(doc))\n return\n except AttributeError:\n pass\n self.stdout.write(\"%s\\n\"%str(self.nohelp %(arg,)))\n return\n func()\n else :\n names=self.get_names()\n cmds_doc=[]\n cmds_undoc=[]\n topics=set()\n for name in names:\n if name[:5]=='help_':\n topics.add(name[5:])\n names.sort()\n \n prevname=''\n for name in names:\n if name[:3]=='do_':\n if name ==prevname:\n continue\n prevname=name\n cmd=name[3:]\n if cmd in topics:\n cmds_doc.append(cmd)\n topics.remove(cmd)\n elif getattr(self,name).__doc__:\n cmds_doc.append(cmd)\n else :\n cmds_undoc.append(cmd)\n self.stdout.write(\"%s\\n\"%str(self.doc_leader))\n self.print_topics(self.doc_header,cmds_doc,15,80)\n self.print_topics(self.misc_header,sorted(topics),15,80)\n self.print_topics(self.undoc_header,cmds_undoc,15,80)\n \n def print_topics(self,header,cmds,cmdlen,maxcol):\n if cmds:\n self.stdout.write(\"%s\\n\"%str(header))\n if self.ruler:\n self.stdout.write(\"%s\\n\"%str(self.ruler *len(header)))\n self.columnize(cmds,maxcol -1)\n self.stdout.write(\"\\n\")\n \n def columnize(self,list,displaywidth=80):\n ''\n\n\n\n \n if not list:\n self.stdout.write(\"\\n\")\n return\n \n nonstrings=[i for i in range(len(list))\n if not isinstance(list[i],str)]\n if nonstrings:\n raise TypeError(\"list[i] not a string for i in %s\"\n %\", \".join(map(str,nonstrings)))\n size=len(list)\n if size ==1:\n self.stdout.write('%s\\n'%str(list[0]))\n return\n \n for nrows in range(1,len(list)):\n ncols=(size+nrows -1)//nrows\n colwidths=[]\n totwidth=-2\n for col in range(ncols):\n colwidth=0\n for row in range(nrows):\n i=row+nrows *col\n if i >=size:\n break\n x=list[i]\n colwidth=max(colwidth,len(x))\n colwidths.append(colwidth)\n totwidth +=colwidth+2\n if totwidth >displaywidth:\n break\n if totwidth <=displaywidth:\n break\n else :\n nrows=len(list)\n ncols=1\n colwidths=[0]\n for row in range(nrows):\n texts=[]\n for col in range(ncols):\n i=row+nrows *col\n if i >=size:\n x=\"\"\n else :\n x=list[i]\n texts.append(x)\n while texts and not texts[-1]:\n del texts[-1]\n for col in range(len(texts)):\n texts[col]=texts[col].ljust(colwidths[col])\n self.stdout.write(\"%s\\n\"%str(\" \".join(texts)))\n", ["readline", "string", "sys"]], "code": [".py", "''\n\n\n\n\n\n\nimport sys\nimport traceback\nfrom codeop import CommandCompiler,compile_command\n\n__all__=[\"InteractiveInterpreter\",\"InteractiveConsole\",\"interact\",\n\"compile_command\"]\n\nclass InteractiveInterpreter:\n ''\n\n\n\n\n\n \n \n def __init__(self,locals=None):\n ''\n\n\n\n\n\n\n \n if locals is None:\n locals={\"__name__\":\"__console__\",\"__doc__\":None}\n self.locals=locals\n self.compile=CommandCompiler()\n \n def runsource(self,source,filename=\"\",symbol=\"single\"):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n code=self.compile(source,filename,symbol)\n except(OverflowError,SyntaxError,ValueError):\n \n self.showsyntaxerror(filename)\n return False\n \n if code is None:\n \n return True\n \n \n self.runcode(code)\n return False\n \n def runcode(self,code):\n ''\n\n\n\n\n\n\n\n\n\n \n try:\n exec(code,self.locals)\n except SystemExit:\n raise\n except:\n self.showtraceback()\n \n def showsyntaxerror(self,filename=None):\n ''\n\n\n\n\n\n\n\n\n\n \n type,value,tb=sys.exc_info()\n sys.last_exc=value\n sys.last_type=type\n sys.last_value=value\n sys.last_traceback=tb\n if filename and type is SyntaxError:\n \n try:\n msg,(dummy_filename,lineno,offset,line)=value.args\n except ValueError:\n \n pass\n else:\n \n value=SyntaxError(msg,(filename,lineno,offset,line))\n sys.last_exc=sys.last_value=value\n if sys.excepthook is sys.__excepthook__:\n lines=traceback.format_exception_only(type,value)\n self.write(''.join(lines))\n else:\n \n \n sys.excepthook(type,value,tb)\n \n def showtraceback(self):\n ''\n\n\n\n\n\n \n sys.last_type,sys.last_value,last_tb=ei=sys.exc_info()\n sys.last_traceback=last_tb\n sys.last_exc=ei[1]\n try:\n lines=traceback.format_exception(ei[0],ei[1],last_tb.tb_next)\n if sys.excepthook is sys.__excepthook__:\n self.write(''.join(lines))\n else:\n \n \n sys.excepthook(ei[0],ei[1],last_tb)\n finally:\n last_tb=ei=None\n \n def write(self,data):\n ''\n\n\n\n\n \n sys.stderr.write(data)\n \n \nclass InteractiveConsole(InteractiveInterpreter):\n ''\n\n\n\n\n \n \n def __init__(self,locals=None,filename=\"\"):\n ''\n\n\n\n\n\n\n\n \n InteractiveInterpreter.__init__(self,locals)\n self.filename=filename\n self.resetbuffer()\n \n def resetbuffer(self):\n ''\n self.buffer=[]\n \n def interact(self,banner=None,exitmsg=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n sys.ps1\n except AttributeError:\n sys.ps1=\">>> \"\n try:\n sys.ps2\n except AttributeError:\n sys.ps2=\"... \"\n cprt='Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.'\n if banner is None:\n self.write(\"Python %s on %s\\n%s\\n(%s)\\n\"%\n (sys.version,sys.platform,cprt,\n self.__class__.__name__))\n elif banner:\n self.write(\"%s\\n\"%str(banner))\n more=0\n while 1:\n try:\n if more:\n prompt=sys.ps2\n else:\n prompt=sys.ps1\n try:\n line=self.raw_input(prompt)\n except EOFError:\n self.write(\"\\n\")\n break\n else:\n more=self.push(line)\n except KeyboardInterrupt:\n self.write(\"\\nKeyboardInterrupt\\n\")\n self.resetbuffer()\n more=0\n if exitmsg is None:\n self.write('now exiting %s...\\n'%self.__class__.__name__)\n elif exitmsg !='':\n self.write('%s\\n'%exitmsg)\n \n def push(self,line):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n self.buffer.append(line)\n source=\"\\n\".join(self.buffer)\n more=self.runsource(source,self.filename)\n if not more:\n self.resetbuffer()\n return more\n \n def raw_input(self,prompt=\"\"):\n ''\n\n\n\n\n\n\n\n\n \n return input(prompt)\n \n \n \ndef interact(banner=None,readfunc=None,local=None,exitmsg=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n console=InteractiveConsole(local)\n if readfunc is not None:\n console.raw_input=readfunc\n else:\n try:\n import readline\n except ImportError:\n pass\n console.interact(banner,exitmsg)\n \n \nif __name__ ==\"__main__\":\n import argparse\n \n parser=argparse.ArgumentParser()\n parser.add_argument('-q',action='store_true',\n help=\"don't print version and copyright messages\")\n args=parser.parse_args()\n if args.q or sys.flags.quiet:\n banner=''\n else:\n banner=None\n interact(banner)\n", ["argparse", "codeop", "readline", "sys", "traceback"]], "codecs": [".py", "''\n\n\n\n\n\n\n\n\nimport builtins\nimport sys\n\n\n\ntry:\n from _codecs import *\nexcept ImportError as why:\n raise SystemError('Failed to load the builtin codecs: %s'%why)\n \n__all__=[\"register\",\"lookup\",\"open\",\"EncodedFile\",\"BOM\",\"BOM_BE\",\n\"BOM_LE\",\"BOM32_BE\",\"BOM32_LE\",\"BOM64_BE\",\"BOM64_LE\",\n\"BOM_UTF8\",\"BOM_UTF16\",\"BOM_UTF16_LE\",\"BOM_UTF16_BE\",\n\"BOM_UTF32\",\"BOM_UTF32_LE\",\"BOM_UTF32_BE\",\n\"CodecInfo\",\"Codec\",\"IncrementalEncoder\",\"IncrementalDecoder\",\n\"StreamReader\",\"StreamWriter\",\n\"StreamReaderWriter\",\"StreamRecoder\",\n\"getencoder\",\"getdecoder\",\"getincrementalencoder\",\n\"getincrementaldecoder\",\"getreader\",\"getwriter\",\n\"encode\",\"decode\",\"iterencode\",\"iterdecode\",\n\"strict_errors\",\"ignore_errors\",\"replace_errors\",\n\"xmlcharrefreplace_errors\",\n\"backslashreplace_errors\",\"namereplace_errors\",\n\"register_error\",\"lookup_error\"]\n\n\n\n\n\n\n\n\n\n\nBOM_UTF8=b'\\xef\\xbb\\xbf'\n\n\nBOM_LE=BOM_UTF16_LE=b'\\xff\\xfe'\n\n\nBOM_BE=BOM_UTF16_BE=b'\\xfe\\xff'\n\n\nBOM_UTF32_LE=b'\\xff\\xfe\\x00\\x00'\n\n\nBOM_UTF32_BE=b'\\x00\\x00\\xfe\\xff'\n\nif sys.byteorder =='little':\n\n\n BOM=BOM_UTF16=BOM_UTF16_LE\n \n \n BOM_UTF32=BOM_UTF32_LE\n \nelse:\n\n\n BOM=BOM_UTF16=BOM_UTF16_BE\n \n \n BOM_UTF32=BOM_UTF32_BE\n \n \nBOM32_LE=BOM_UTF16_LE\nBOM32_BE=BOM_UTF16_BE\nBOM64_LE=BOM_UTF32_LE\nBOM64_BE=BOM_UTF32_BE\n\n\n\n\nclass CodecInfo(tuple):\n ''\n \n \n \n \n \n \n \n _is_text_encoding=True\n \n def __new__(cls,encode,decode,streamreader=None,streamwriter=None,\n incrementalencoder=None,incrementaldecoder=None,name=None,\n *,_is_text_encoding=None):\n self=tuple.__new__(cls,(encode,decode,streamreader,streamwriter))\n self.name=name\n self.encode=encode\n self.decode=decode\n self.incrementalencoder=incrementalencoder\n self.incrementaldecoder=incrementaldecoder\n self.streamwriter=streamwriter\n self.streamreader=streamreader\n if _is_text_encoding is not None:\n self._is_text_encoding=_is_text_encoding\n return self\n \n def __repr__(self):\n return \"<%s.%s object for encoding %s at %#x>\"%\\\n (self.__class__.__module__,self.__class__.__qualname__,\n self.name,id(self))\n \nclass Codec:\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def encode(self,input,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n def decode(self,input,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \nclass IncrementalEncoder(object):\n ''\n\n\n\n \n def __init__(self,errors='strict'):\n ''\n\n\n\n\n\n \n self.errors=errors\n self.buffer=\"\"\n \n def encode(self,input,final=False):\n ''\n\n \n raise NotImplementedError\n \n def reset(self):\n ''\n\n \n \n def getstate(self):\n ''\n\n \n return 0\n \n def setstate(self,state):\n ''\n\n\n \n \nclass BufferedIncrementalEncoder(IncrementalEncoder):\n ''\n\n\n\n \n def __init__(self,errors='strict'):\n IncrementalEncoder.__init__(self,errors)\n \n self.buffer=\"\"\n \n def _buffer_encode(self,input,errors,final):\n \n \n raise NotImplementedError\n \n def encode(self,input,final=False):\n \n data=self.buffer+input\n (result,consumed)=self._buffer_encode(data,self.errors,final)\n \n self.buffer=data[consumed:]\n return result\n \n def reset(self):\n IncrementalEncoder.reset(self)\n self.buffer=\"\"\n \n def getstate(self):\n return self.buffer or 0\n \n def setstate(self,state):\n self.buffer=state or \"\"\n \nclass IncrementalDecoder(object):\n ''\n\n\n\n \n def __init__(self,errors='strict'):\n ''\n\n\n\n\n\n \n self.errors=errors\n \n def decode(self,input,final=False):\n ''\n\n \n raise NotImplementedError\n \n def reset(self):\n ''\n\n \n \n def getstate(self):\n ''\n\n\n\n\n\n\n\n\n\n \n return(b\"\",0)\n \n def setstate(self,state):\n ''\n\n\n\n\n \n \nclass BufferedIncrementalDecoder(IncrementalDecoder):\n ''\n\n\n\n \n def __init__(self,errors='strict'):\n IncrementalDecoder.__init__(self,errors)\n \n self.buffer=b\"\"\n \n def _buffer_decode(self,input,errors,final):\n \n \n raise NotImplementedError\n \n def decode(self,input,final=False):\n \n data=self.buffer+input\n (result,consumed)=self._buffer_decode(data,self.errors,final)\n \n self.buffer=data[consumed:]\n return result\n \n def reset(self):\n IncrementalDecoder.reset(self)\n self.buffer=b\"\"\n \n def getstate(self):\n \n return(self.buffer,0)\n \n def setstate(self,state):\n \n self.buffer=state[0]\n \n \n \n \n \n \n \n \nclass StreamWriter(Codec):\n\n def __init__(self,stream,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.stream=stream\n self.errors=errors\n \n def write(self,object):\n \n ''\n \n data,consumed=self.encode(object,self.errors)\n self.stream.write(data)\n \n def writelines(self,list):\n \n ''\n\n \n self.write(''.join(list))\n \n def reset(self):\n \n ''\n\n\n\n\n\n\n \n pass\n \n def seek(self,offset,whence=0):\n self.stream.seek(offset,whence)\n if whence ==0 and offset ==0:\n self.reset()\n \n def __getattr__(self,name,\n getattr=getattr):\n \n ''\n \n return getattr(self.stream,name)\n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,tb):\n self.stream.close()\n \n \n \nclass StreamReader(Codec):\n\n charbuffertype=str\n \n def __init__(self,stream,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.stream=stream\n self.errors=errors\n self.bytebuffer=b\"\"\n self._empty_charbuffer=self.charbuffertype()\n self.charbuffer=self._empty_charbuffer\n self.linebuffer=None\n \n def decode(self,input,errors='strict'):\n raise NotImplementedError\n \n def read(self,size=-1,chars=-1,firstline=False):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if self.linebuffer:\n self.charbuffer=self._empty_charbuffer.join(self.linebuffer)\n self.linebuffer=None\n \n if chars <0:\n \n \n chars=size\n \n \n while True:\n \n if chars >=0:\n if len(self.charbuffer)>=chars:\n break\n \n if size <0:\n newdata=self.stream.read()\n else:\n newdata=self.stream.read(size)\n \n data=self.bytebuffer+newdata\n if not data:\n break\n try:\n newchars,decodedbytes=self.decode(data,self.errors)\n except UnicodeDecodeError as exc:\n if firstline:\n newchars,decodedbytes=\\\n self.decode(data[:exc.start],self.errors)\n lines=newchars.splitlines(keepends=True)\n if len(lines)<=1:\n raise\n else:\n raise\n \n self.bytebuffer=data[decodedbytes:]\n \n self.charbuffer +=newchars\n \n if not newdata:\n break\n if chars <0:\n \n result=self.charbuffer\n self.charbuffer=self._empty_charbuffer\n else:\n \n result=self.charbuffer[:chars]\n self.charbuffer=self.charbuffer[chars:]\n return result\n \n def readline(self,size=None,keepends=True):\n \n ''\n\n\n\n\n\n \n \n \n if self.linebuffer:\n line=self.linebuffer[0]\n del self.linebuffer[0]\n if len(self.linebuffer)==1:\n \n \n self.charbuffer=self.linebuffer[0]\n self.linebuffer=None\n if not keepends:\n line=line.splitlines(keepends=False)[0]\n return line\n \n readsize=size or 72\n line=self._empty_charbuffer\n \n while True:\n data=self.read(readsize,firstline=True)\n if data:\n \n \n \n if(isinstance(data,str)and data.endswith(\"\\r\"))or\\\n (isinstance(data,bytes)and data.endswith(b\"\\r\")):\n data +=self.read(size=1,chars=1)\n \n line +=data\n lines=line.splitlines(keepends=True)\n if lines:\n if len(lines)>1:\n \n \n line=lines[0]\n del lines[0]\n if len(lines)>1:\n \n lines[-1]+=self.charbuffer\n self.linebuffer=lines\n self.charbuffer=None\n else:\n \n self.charbuffer=lines[0]+self.charbuffer\n if not keepends:\n line=line.splitlines(keepends=False)[0]\n break\n line0withend=lines[0]\n line0withoutend=lines[0].splitlines(keepends=False)[0]\n if line0withend !=line0withoutend:\n \n self.charbuffer=self._empty_charbuffer.join(lines[1:])+\\\n self.charbuffer\n if keepends:\n line=line0withend\n else:\n line=line0withoutend\n break\n \n if not data or size is not None:\n if line and not keepends:\n line=line.splitlines(keepends=False)[0]\n break\n if readsize <8000:\n readsize *=2\n return line\n \n def readlines(self,sizehint=None,keepends=True):\n \n ''\n\n\n\n\n\n\n\n\n \n data=self.read()\n return data.splitlines(keepends)\n \n def reset(self):\n \n ''\n\n\n\n\n\n \n self.bytebuffer=b\"\"\n self.charbuffer=self._empty_charbuffer\n self.linebuffer=None\n \n def seek(self,offset,whence=0):\n ''\n\n\n \n self.stream.seek(offset,whence)\n self.reset()\n \n def __next__(self):\n \n ''\n line=self.readline()\n if line:\n return line\n raise StopIteration\n \n def __iter__(self):\n return self\n \n def __getattr__(self,name,\n getattr=getattr):\n \n ''\n \n return getattr(self.stream,name)\n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,tb):\n self.stream.close()\n \n \n \nclass StreamReaderWriter:\n\n ''\n\n\n\n\n\n\n \n \n encoding='unknown'\n \n def __init__(self,stream,Reader,Writer,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n \n self.stream=stream\n self.reader=Reader(stream,errors)\n self.writer=Writer(stream,errors)\n self.errors=errors\n \n def read(self,size=-1):\n \n return self.reader.read(size)\n \n def readline(self,size=None):\n \n return self.reader.readline(size)\n \n def readlines(self,sizehint=None):\n \n return self.reader.readlines(sizehint)\n \n def __next__(self):\n \n ''\n return next(self.reader)\n \n def __iter__(self):\n return self\n \n def write(self,data):\n \n return self.writer.write(data)\n \n def writelines(self,list):\n \n return self.writer.writelines(list)\n \n def reset(self):\n \n self.reader.reset()\n self.writer.reset()\n \n def seek(self,offset,whence=0):\n self.stream.seek(offset,whence)\n self.reader.reset()\n if whence ==0 and offset ==0:\n self.writer.reset()\n \n def __getattr__(self,name,\n getattr=getattr):\n \n ''\n \n return getattr(self.stream,name)\n \n \n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,tb):\n self.stream.close()\n \n \n \nclass StreamRecoder:\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n data_encoding='unknown'\n file_encoding='unknown'\n \n def __init__(self,stream,encode,decode,Reader,Writer,\n errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.stream=stream\n self.encode=encode\n self.decode=decode\n self.reader=Reader(stream,errors)\n self.writer=Writer(stream,errors)\n self.errors=errors\n \n def read(self,size=-1):\n \n data=self.reader.read(size)\n data,bytesencoded=self.encode(data,self.errors)\n return data\n \n def readline(self,size=None):\n \n if size is None:\n data=self.reader.readline()\n else:\n data=self.reader.readline(size)\n data,bytesencoded=self.encode(data,self.errors)\n return data\n \n def readlines(self,sizehint=None):\n \n data=self.reader.read()\n data,bytesencoded=self.encode(data,self.errors)\n return data.splitlines(keepends=True)\n \n def __next__(self):\n \n ''\n data=next(self.reader)\n data,bytesencoded=self.encode(data,self.errors)\n return data\n \n def __iter__(self):\n return self\n \n def write(self,data):\n \n data,bytesdecoded=self.decode(data,self.errors)\n return self.writer.write(data)\n \n def writelines(self,list):\n \n data=b''.join(list)\n data,bytesdecoded=self.decode(data,self.errors)\n return self.writer.write(data)\n \n def reset(self):\n \n self.reader.reset()\n self.writer.reset()\n \n def seek(self,offset,whence=0):\n \n \n self.reader.seek(offset,whence)\n self.writer.seek(offset,whence)\n \n def __getattr__(self,name,\n getattr=getattr):\n \n ''\n \n return getattr(self.stream,name)\n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,tb):\n self.stream.close()\n \n \n \ndef open(filename,mode='r',encoding=None,errors='strict',buffering=-1):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if encoding is not None and\\\n 'b'not in mode:\n \n mode=mode+'b'\n file=builtins.open(filename,mode,buffering)\n if encoding is None:\n return file\n \n try:\n info=lookup(encoding)\n srw=StreamReaderWriter(file,info.streamreader,info.streamwriter,errors)\n \n srw.encoding=encoding\n return srw\n except:\n file.close()\n raise\n \ndef EncodedFile(file,data_encoding,file_encoding=None,errors='strict'):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if file_encoding is None:\n file_encoding=data_encoding\n data_info=lookup(data_encoding)\n file_info=lookup(file_encoding)\n sr=StreamRecoder(file,data_info.encode,data_info.decode,\n file_info.streamreader,file_info.streamwriter,errors)\n \n sr.data_encoding=data_encoding\n sr.file_encoding=file_encoding\n return sr\n \n \n \ndef getencoder(encoding):\n\n ''\n\n\n\n\n \n return lookup(encoding).encode\n \ndef getdecoder(encoding):\n\n ''\n\n\n\n\n \n return lookup(encoding).decode\n \ndef getincrementalencoder(encoding):\n\n ''\n\n\n\n\n\n \n encoder=lookup(encoding).incrementalencoder\n if encoder is None:\n raise LookupError(encoding)\n return encoder\n \ndef getincrementaldecoder(encoding):\n\n ''\n\n\n\n\n\n \n decoder=lookup(encoding).incrementaldecoder\n if decoder is None:\n raise LookupError(encoding)\n return decoder\n \ndef getreader(encoding):\n\n ''\n\n\n\n\n \n return lookup(encoding).streamreader\n \ndef getwriter(encoding):\n\n ''\n\n\n\n\n \n return lookup(encoding).streamwriter\n \ndef iterencode(iterator,encoding,errors='strict',**kwargs):\n ''\n\n\n\n\n\n\n \n encoder=getincrementalencoder(encoding)(errors,**kwargs)\n for input in iterator:\n output=encoder.encode(input)\n if output:\n yield output\n output=encoder.encode(\"\",True)\n if output:\n yield output\n \ndef iterdecode(iterator,encoding,errors='strict',**kwargs):\n ''\n\n\n\n\n\n\n \n decoder=getincrementaldecoder(encoding)(errors,**kwargs)\n for input in iterator:\n output=decoder.decode(input)\n if output:\n yield output\n output=decoder.decode(b\"\",True)\n if output:\n yield output\n \n \n \ndef make_identity_dict(rng):\n\n ''\n\n\n\n\n \n return{i:i for i in rng}\n \ndef make_encoding_map(decoding_map):\n\n ''\n\n\n\n\n\n\n\n\n\n \n m={}\n for k,v in decoding_map.items():\n if not v in m:\n m[v]=k\n else:\n m[v]=None\n return m\n \n \n \ntry:\n strict_errors=lookup_error(\"strict\")\n ignore_errors=lookup_error(\"ignore\")\n replace_errors=lookup_error(\"replace\")\n xmlcharrefreplace_errors=lookup_error(\"xmlcharrefreplace\")\n backslashreplace_errors=lookup_error(\"backslashreplace\")\n namereplace_errors=lookup_error(\"namereplace\")\nexcept LookupError:\n\n strict_errors=None\n ignore_errors=None\n replace_errors=None\n xmlcharrefreplace_errors=None\n backslashreplace_errors=None\n namereplace_errors=None\n \n \n \n_false=0\nif _false:\n import encodings\n", ["_codecs", "builtins", "encodings", "sys"]], "codeop": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport __future__\nimport warnings\n\n_features=[getattr(__future__,fname)\nfor fname in __future__.all_feature_names]\n\n__all__=[\"compile_command\",\"Compile\",\"CommandCompiler\"]\n\n\n\n\nPyCF_DONT_IMPLY_DEDENT=0x200\nPyCF_ALLOW_INCOMPLETE_INPUT=0x4000\n\ndef _maybe_compile(compiler,source,filename,symbol):\n\n for line in source.split(\"\\n\"):\n line=line.strip()\n if line and line[0]!='#':\n break\n else :\n if symbol !=\"eval\":\n source=\"pass\"\n \n \n with warnings.catch_warnings():\n warnings.simplefilter(\"ignore\",(SyntaxWarning,DeprecationWarning))\n try :\n compiler(source,filename,symbol)\n except SyntaxError:\n try :\n compiler(source+\"\\n\",filename,symbol)\n return None\n except SyntaxError as e:\n if \"incomplete input\"in str(e):\n return None\n \n \n return compiler(source,filename,symbol)\n \n \ndef _is_syntax_error(err1,err2):\n rep1=repr(err1)\n rep2=repr(err2)\n if \"was never closed\"in rep1 and \"was never closed\"in rep2:\n return False\n if rep1 ==rep2:\n return True\n return False\n \ndef _compile(source,filename,symbol):\n return compile(source,filename,symbol,PyCF_DONT_IMPLY_DEDENT |PyCF_ALLOW_INCOMPLETE_INPUT)\n \ndef compile_command(source,filename=\"\",symbol=\"single\"):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return _maybe_compile(_compile,source,filename,symbol)\n \nclass Compile:\n ''\n\n\n \n def __init__(self):\n self.flags=PyCF_DONT_IMPLY_DEDENT |PyCF_ALLOW_INCOMPLETE_INPUT\n \n def __call__(self,source,filename,symbol):\n codeob=compile(source,filename,symbol,self.flags,True )\n for feature in _features:\n if codeob.co_flags&feature.compiler_flag:\n self.flags |=feature.compiler_flag\n return codeob\n \nclass CommandCompiler:\n ''\n\n\n\n \n \n def __init__(self,):\n self.compiler=Compile()\n \n def __call__(self,source,filename=\"\",symbol=\"single\"):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return _maybe_compile(self.compiler,source,filename,symbol)\n", ["__future__", "warnings"]], "colorsys": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\"rgb_to_yiq\",\"yiq_to_rgb\",\"rgb_to_hls\",\"hls_to_rgb\",\n\"rgb_to_hsv\",\"hsv_to_rgb\"]\n\n\n\nONE_THIRD=1.0 /3.0\nONE_SIXTH=1.0 /6.0\nTWO_THIRD=2.0 /3.0\n\n\n\n\n\n\n\n\ndef rgb_to_yiq(r,g,b):\n y=0.30 *r+0.59 *g+0.11 *b\n i=0.74 *(r -y)-0.27 *(b -y)\n q=0.48 *(r -y)+0.41 *(b -y)\n return (y,i,q)\n \ndef yiq_to_rgb(y,i,q):\n\n\n\n\n r=y+0.9468822170900693 *i+0.6235565819861433 *q\n g=y -0.27478764629897834 *i -0.6356910791873801 *q\n b=y -1.1085450346420322 *i+1.7090069284064666 *q\n \n if r <0.0:\n r=0.0\n if g <0.0:\n g=0.0\n if b <0.0:\n b=0.0\n if r >1.0:\n r=1.0\n if g >1.0:\n g=1.0\n if b >1.0:\n b=1.0\n return (r,g,b)\n \n \n \n \n \n \n \ndef rgb_to_hls(r,g,b):\n maxc=max(r,g,b)\n minc=min(r,g,b)\n sumc=(maxc+minc)\n rangec=(maxc -minc)\n l=sumc /2.0\n if minc ==maxc:\n return 0.0,l,0.0\n if l <=0.5:\n s=rangec /sumc\n else :\n s=rangec /(2.0 -sumc)\n rc=(maxc -r)/rangec\n gc=(maxc -g)/rangec\n bc=(maxc -b)/rangec\n if r ==maxc:\n h=bc -gc\n elif g ==maxc:\n h=2.0+rc -bc\n else :\n h=4.0+gc -rc\n h=(h /6.0)%1.0\n return h,l,s\n \ndef hls_to_rgb(h,l,s):\n if s ==0.0:\n return l,l,l\n if l <=0.5:\n m2=l *(1.0+s)\n else :\n m2=l+s -(l *s)\n m1=2.0 *l -m2\n return (_v(m1,m2,h+ONE_THIRD),_v(m1,m2,h),_v(m1,m2,h -ONE_THIRD))\n \ndef _v(m1,m2,hue):\n hue=hue %1.0\n if hue MAX_INTERPOLATION_DEPTH:\n raise InterpolationDepthError(option,section,rawval)\n while rest:\n p=rest.find(\"%\")\n if p <0:\n accum.append(rest)\n return\n if p >0:\n accum.append(rest[:p])\n rest=rest[p:]\n \n c=rest[1:2]\n if c ==\"%\":\n accum.append(\"%\")\n rest=rest[2:]\n elif c ==\"(\":\n m=self._KEYCRE.match(rest)\n if m is None:\n raise InterpolationSyntaxError(option,section,\n \"bad interpolation variable reference %r\"%rest)\n var=parser.optionxform(m.group(1))\n rest=rest[m.end():]\n try:\n v=map[var]\n except KeyError:\n raise InterpolationMissingOptionError(\n option,section,rawval,var)from None\n if \"%\"in v:\n self._interpolate_some(parser,option,accum,v,\n section,map,depth+1)\n else:\n accum.append(v)\n else:\n raise InterpolationSyntaxError(\n option,section,\n \"'%%' must be followed by '%%' or '(', \"\n \"found: %r\"%(rest,))\n \n \nclass ExtendedInterpolation(Interpolation):\n ''\n \n \n _KEYCRE=re.compile(r\"\\$\\{([^}]+)\\}\")\n \n def before_get(self,parser,section,option,value,defaults):\n L=[]\n self._interpolate_some(parser,option,L,value,section,defaults,1)\n return ''.join(L)\n \n def before_set(self,parser,section,option,value):\n tmp_value=value.replace('$$','')\n tmp_value=self._KEYCRE.sub('',tmp_value)\n if '$'in tmp_value:\n raise ValueError(\"invalid interpolation syntax in %r at \"\n \"position %d\"%(value,tmp_value.find('$')))\n return value\n \n def _interpolate_some(self,parser,option,accum,rest,section,map,\n depth):\n rawval=parser.get(section,option,raw=True,fallback=rest)\n if depth >MAX_INTERPOLATION_DEPTH:\n raise InterpolationDepthError(option,section,rawval)\n while rest:\n p=rest.find(\"$\")\n if p <0:\n accum.append(rest)\n return\n if p >0:\n accum.append(rest[:p])\n rest=rest[p:]\n \n c=rest[1:2]\n if c ==\"$\":\n accum.append(\"$\")\n rest=rest[2:]\n elif c ==\"{\":\n m=self._KEYCRE.match(rest)\n if m is None:\n raise InterpolationSyntaxError(option,section,\n \"bad interpolation variable reference %r\"%rest)\n path=m.group(1).split(':')\n rest=rest[m.end():]\n sect=section\n opt=option\n try:\n if len(path)==1:\n opt=parser.optionxform(path[0])\n v=map[opt]\n elif len(path)==2:\n sect=path[0]\n opt=parser.optionxform(path[1])\n v=parser.get(sect,opt,raw=True)\n else:\n raise InterpolationSyntaxError(\n option,section,\n \"More than one ':' found: %r\"%(rest,))\n except(KeyError,NoSectionError,NoOptionError):\n raise InterpolationMissingOptionError(\n option,section,rawval,\":\".join(path))from None\n if \"$\"in v:\n self._interpolate_some(parser,opt,accum,v,sect,\n dict(parser.items(sect,raw=True)),\n depth+1)\n else:\n accum.append(v)\n else:\n raise InterpolationSyntaxError(\n option,section,\n \"'$' must be followed by '$' or '{', \"\n \"found: %r\"%(rest,))\n \n \nclass LegacyInterpolation(Interpolation):\n ''\n \n \n _KEYCRE=re.compile(r\"%\\(([^)]*)\\)s|.\")\n \n def __init__(self,*args,**kwargs):\n super().__init__(*args,**kwargs)\n warnings.warn(\n \"LegacyInterpolation has been deprecated since Python 3.2 \"\n \"and will be removed from the configparser module in Python 3.13. \"\n \"Use BasicInterpolation or ExtendedInterpolation instead.\",\n DeprecationWarning,stacklevel=2\n )\n \n def before_get(self,parser,section,option,value,vars):\n rawval=value\n depth=MAX_INTERPOLATION_DEPTH\n while depth:\n depth -=1\n if value and \"%(\"in value:\n replace=functools.partial(self._interpolation_replace,\n parser=parser)\n value=self._KEYCRE.sub(replace,value)\n try:\n value=value %vars\n except KeyError as e:\n raise InterpolationMissingOptionError(\n option,section,rawval,e.args[0])from None\n else:\n break\n if value and \"%(\"in value:\n raise InterpolationDepthError(option,section,rawval)\n return value\n \n def before_set(self,parser,section,option,value):\n return value\n \n @staticmethod\n def _interpolation_replace(match,parser):\n s=match.group(1)\n if s is None:\n return match.group()\n else:\n return \"%%(%s)s\"%parser.optionxform(s)\n \n \nclass RawConfigParser(MutableMapping):\n ''\n \n \n _SECT_TMPL=r\"\"\"\n \\[ # [\n (?P

.+) # very permissive!\n \\] # ]\n \"\"\"\n _OPT_TMPL=r\"\"\"\n (?Pn'%(\n toprefix,num_chg)\n else :\n in_change=False\n \n if not flaglist:\n flaglist=[False ]\n next_id=['']\n next_href=['']\n last=0\n if context:\n fromlist=[' No Differences Found ']\n tolist=fromlist\n else :\n fromlist=tolist=[' Empty File ']\n \n if not flaglist[0]:\n next_href[0]='f'%toprefix\n \n next_href[last]='t'%(toprefix)\n \n return fromlist,tolist,flaglist,next_href,next_id\n \n def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False ,\n numlines=5):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n self._make_prefix()\n \n \n \n fromlines,tolines=self._tab_newline_replace(fromlines,tolines)\n \n \n if context:\n context_lines=numlines\n else :\n context_lines=None\n diffs=_mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,\n charjunk=self._charjunk)\n \n \n if self._wrapcolumn:\n diffs=self._line_wrapper(diffs)\n \n \n fromlist,tolist,flaglist=self._collect_lines(diffs)\n \n \n fromlist,tolist,flaglist,next_href,next_id=self._convert_flags(\n fromlist,tolist,flaglist,context,numlines)\n \n s=[]\n fmt=' %s%s'+\\\n '%s%s\\n'\n for i in range(len(flaglist)):\n if flaglist[i]is None :\n \n \n if i >0:\n s.append(' \\n \\n')\n else :\n s.append(fmt %(next_id[i],next_href[i],fromlist[i],\n next_href[i],tolist[i]))\n if fromdesc or todesc:\n header_row='%s%s%s%s'%(\n '
',\n '%s'%fromdesc,\n '
',\n '%s'%todesc)\n else :\n header_row=''\n \n table=self._table_template %dict(\n data_rows=''.join(s),\n header_row=header_row,\n prefix=self._prefix[1])\n \n return table.replace('\\0+','').\\\n replace('\\0-','').\\\n replace('\\0^','').\\\n replace('\\1','').\\\n replace('\\t',' ')\n \ndel re\n\ndef restore(delta,which):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n tag={1:\"- \",2:\"+ \"}[int(which)]\n except KeyError:\n raise ValueError('unknown delta choice (must be 1 or 2): %r'\n %which)from None\n prefixes=(\" \",tag)\n for line in delta:\n if line[:2]in prefixes:\n yield line[2:]\n \ndef _test():\n import doctest,difflib\n return doctest.testmod(difflib)\n \nif __name__ ==\"__main__\":\n _test()\n", ["collections", "difflib", "doctest", "heapq", "re", "types"]], "doctest": [".py", "\n\n\n\n\n\n\n\nr\"\"\"Module doctest -- a framework for running examples in docstrings.\n\nIn simplest use, end each module M to be tested with:\n\ndef _test():\n import doctest\n doctest.testmod()\n\nif __name__ == \"__main__\":\n _test()\n\nThen running the module as a script will cause the examples in the\ndocstrings to get executed and verified:\n\npython M.py\n\nThis won't display anything unless an example fails, in which case the\nfailing example(s) and the cause(s) of the failure(s) are printed to stdout\n(why not stderr? because stderr is a lame hack <0.2 wink>), and the final\nline of output is \"Test failed.\".\n\nRun it with the -v switch instead:\n\npython M.py -v\n\nand a detailed report of all examples tried is printed to stdout, along\nwith assorted summaries at the end.\n\nYou can force verbose mode by passing \"verbose=True\" to testmod, or prohibit\nit by passing \"verbose=False\". In either of those cases, sys.argv is not\nexamined by testmod.\n\nThere are a variety of other ways to run doctests, including integration\nwith the unittest framework, and support for running non-Python text\nfiles containing doctests. There are also many ways to override parts\nof doctest's default behaviors. See the Library Reference Manual for\ndetails.\n\"\"\"\n\n__docformat__='reStructuredText en'\n\n__all__=[\n\n'register_optionflag',\n'DONT_ACCEPT_TRUE_FOR_1',\n'DONT_ACCEPT_BLANKLINE',\n'NORMALIZE_WHITESPACE',\n'ELLIPSIS',\n'SKIP',\n'IGNORE_EXCEPTION_DETAIL',\n'COMPARISON_FLAGS',\n'REPORT_UDIFF',\n'REPORT_CDIFF',\n'REPORT_NDIFF',\n'REPORT_ONLY_FIRST_FAILURE',\n'REPORTING_FLAGS',\n'FAIL_FAST',\n\n\n'Example',\n'DocTest',\n\n'DocTestParser',\n\n'DocTestFinder',\n\n'DocTestRunner',\n'OutputChecker',\n'DocTestFailure',\n'UnexpectedException',\n'DebugRunner',\n\n'testmod',\n'testfile',\n'run_docstring_examples',\n\n'DocTestSuite',\n'DocFileSuite',\n'set_unittest_reportflags',\n\n'script_from_examples',\n'testsource',\n'debug_src',\n'debug',\n]\n\nimport __future__\nimport difflib\nimport inspect\nimport linecache\nimport os\nimport pdb\nimport re\nimport sys\nimport traceback\nimport unittest\nfrom io import StringIO,IncrementalNewlineDecoder\nfrom collections import namedtuple\n\nTestResults=namedtuple('TestResults','failed attempted')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nOPTIONFLAGS_BY_NAME={}\ndef register_optionflag(name):\n\n return OPTIONFLAGS_BY_NAME.setdefault(name,1 <=2\n \n \n startpos,endpos=0,len(got)\n w=ws[0]\n if w:\n if got.startswith(w):\n startpos=len(w)\n del ws[0]\n else:\n return False\n w=ws[-1]\n if w:\n if got.endswith(w):\n endpos -=len(w)\n del ws[-1]\n else:\n return False\n \n if startpos >endpos:\n \n \n return False\n \n \n \n \n for w in ws:\n \n \n \n startpos=got.find(w,startpos,endpos)\n if startpos <0:\n return False\n startpos +=len(w)\n \n return True\n \ndef _comment_line(line):\n ''\n line=line.rstrip()\n if line:\n return '# '+line\n else:\n return '#'\n \ndef _strip_exception_details(msg):\n\n\n\n\n\n\n\n\n\n\n start,end=0,len(msg)\n \n i=msg.find(\"\\n\")\n if i >=0:\n end=i\n \n i=msg.find(':',0,end)\n if i >=0:\n end=i\n \n i=msg.rfind('.',0,end)\n if i >=0:\n start=i+1\n return msg[start:end]\n \nclass _OutputRedirectingPdb(pdb.Pdb):\n ''\n\n\n\n \n def __init__(self,out):\n self.__out=out\n self.__debugger_used=False\n \n pdb.Pdb.__init__(self,stdout=out,nosigint=True)\n \n self.use_rawinput=1\n \n def set_trace(self,frame=None):\n self.__debugger_used=True\n if frame is None:\n frame=sys._getframe().f_back\n pdb.Pdb.set_trace(self,frame)\n \n def set_continue(self):\n \n \n if self.__debugger_used:\n pdb.Pdb.set_continue(self)\n \n def trace_dispatch(self,*args):\n \n save_stdout=sys.stdout\n sys.stdout=self.__out\n \n try:\n return pdb.Pdb.trace_dispatch(self,*args)\n finally:\n sys.stdout=save_stdout\n \n \ndef _module_relative_path(module,test_path):\n if not inspect.ismodule(module):\n raise TypeError('Expected a module: %r'%module)\n if test_path.startswith('/'):\n raise ValueError('Module-relative files may not have absolute paths')\n \n \n test_path=os.path.join(*(test_path.split('/')))\n \n \n if hasattr(module,'__file__'):\n \n basedir=os.path.split(module.__file__)[0]\n elif module.__name__ =='__main__':\n \n if len(sys.argv)>0 and sys.argv[0]!='':\n basedir=os.path.split(sys.argv[0])[0]\n else:\n basedir=os.curdir\n else:\n if hasattr(module,'__path__'):\n for directory in module.__path__:\n fullpath=os.path.join(directory,test_path)\n if os.path.exists(fullpath):\n return fullpath\n \n \n raise ValueError(\"Can't resolve paths relative to the module \"\n \"%r (it has no __file__)\"\n %module.__name__)\n \n \n return os.path.join(basedir,test_path)\n \n \n \n \n \n \n \n \n \n \n \n \n \nclass Example:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,source,want,exc_msg=None,lineno=0,indent=0,\n options=None):\n \n if not source.endswith('\\n'):\n source +='\\n'\n if want and not want.endswith('\\n'):\n want +='\\n'\n if exc_msg is not None and not exc_msg.endswith('\\n'):\n exc_msg +='\\n'\n \n self.source=source\n self.want=want\n self.lineno=lineno\n self.indent=indent\n if options is None:options={}\n self.options=options\n self.exc_msg=exc_msg\n \n def __eq__(self,other):\n if type(self)is not type(other):\n return NotImplemented\n \n return self.source ==other.source and\\\n self.want ==other.want and\\\n self.lineno ==other.lineno and\\\n self.indent ==other.indent and\\\n self.options ==other.options and\\\n self.exc_msg ==other.exc_msg\n \n def __hash__(self):\n return hash((self.source,self.want,self.lineno,self.indent,\n self.exc_msg))\n \nclass DocTest:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,examples,globs,name,filename,lineno,docstring):\n ''\n\n\n \n assert not isinstance(examples,str),\\\n \"DocTest no longer accepts str; use DocTestParser instead\"\n self.examples=examples\n self.docstring=docstring\n self.globs=globs.copy()\n self.name=name\n self.filename=filename\n self.lineno=lineno\n \n def __repr__(self):\n if len(self.examples)==0:\n examples='no examples'\n elif len(self.examples)==1:\n examples='1 example'\n else:\n examples='%d examples'%len(self.examples)\n return('<%s %s from %s:%s (%s)>'%\n (self.__class__.__name__,\n self.name,self.filename,self.lineno,examples))\n \n def __eq__(self,other):\n if type(self)is not type(other):\n return NotImplemented\n \n return self.examples ==other.examples and\\\n self.docstring ==other.docstring and\\\n self.globs ==other.globs and\\\n self.name ==other.name and\\\n self.filename ==other.filename and\\\n self.lineno ==other.lineno\n \n def __hash__(self):\n return hash((self.docstring,self.name,self.filename,self.lineno))\n \n \n def __lt__(self,other):\n if not isinstance(other,DocTest):\n return NotImplemented\n return((self.name,self.filename,self.lineno,id(self))\n <\n (other.name,other.filename,other.lineno,id(other)))\n \n \n \n \n \nclass DocTestParser:\n ''\n\n \n \n \n \n \n \n _EXAMPLE_RE=re.compile(r'''\n # Source consists of a PS1 line followed by zero or more PS2 lines.\n (?P\n (?:^(?P [ ]*) >>> .*) # PS1 line\n (?:\\n [ ]* \\.\\.\\. .*)*) # PS2 lines\n \\n?\n # Want consists of any non-blank lines that do not start with PS1.\n (?P (?:(?![ ]*$) # Not a blank line\n (?![ ]*>>>) # Not a line starting with PS1\n .+$\\n? # But any other line\n )*)\n ''',re.MULTILINE |re.VERBOSE)\n \n \n \n \n \n \n \n \n \n \n _EXCEPTION_RE=re.compile(r\"\"\"\n # Grab the traceback header. Different versions of Python have\n # said different things on the first traceback line.\n ^(?P Traceback\\ \\(\n (?: most\\ recent\\ call\\ last\n | innermost\\ last\n ) \\) :\n )\n \\s* $ # toss trailing whitespace on the header.\n (?P .*?) # don't blink: absorb stuff until...\n ^ (?P \\w+ .*) # a line *starts* with alphanum.\n \"\"\",re.VERBOSE |re.MULTILINE |re.DOTALL)\n \n \n \n _IS_BLANK_OR_COMMENT=re.compile(r'^[ ]*(#.*)?$').match\n \n def parse(self,string,name=''):\n ''\n\n\n\n\n\n \n string=string.expandtabs()\n \n min_indent=self._min_indent(string)\n if min_indent >0:\n string='\\n'.join([l[min_indent:]for l in string.split('\\n')])\n \n output=[]\n charno,lineno=0,0\n \n for m in self._EXAMPLE_RE.finditer(string):\n \n output.append(string[charno:m.start()])\n \n lineno +=string.count('\\n',charno,m.start())\n \n (source,options,want,exc_msg)=\\\n self._parse_example(m,name,lineno)\n \n if not self._IS_BLANK_OR_COMMENT(source):\n output.append(Example(source,want,exc_msg,\n lineno=lineno,\n indent=min_indent+len(m.group('indent')),\n options=options))\n \n lineno +=string.count('\\n',m.start(),m.end())\n \n charno=m.end()\n \n output.append(string[charno:])\n return output\n \n def get_doctest(self,string,globs,name,filename,lineno):\n ''\n\n\n\n\n\n\n \n return DocTest(self.get_examples(string,name),globs,\n name,filename,lineno,string)\n \n def get_examples(self,string,name=''):\n ''\n\n\n\n\n\n\n\n\n \n return[x for x in self.parse(string,name)\n if isinstance(x,Example)]\n \n def _parse_example(self,m,name,lineno):\n ''\n\n\n\n\n\n\n\n\n \n \n indent=len(m.group('indent'))\n \n \n \n source_lines=m.group('source').split('\\n')\n self._check_prompt_blank(source_lines,indent,name,lineno)\n self._check_prefix(source_lines[1:],' '*indent+'.',name,lineno)\n source='\\n'.join([sl[indent+4:]for sl in source_lines])\n \n \n \n \n want=m.group('want')\n want_lines=want.split('\\n')\n if len(want_lines)>1 and re.match(r' *$',want_lines[-1]):\n del want_lines[-1]\n self._check_prefix(want_lines,' '*indent,name,\n lineno+len(source_lines))\n want='\\n'.join([wl[indent:]for wl in want_lines])\n \n \n m=self._EXCEPTION_RE.match(want)\n if m:\n exc_msg=m.group('msg')\n else:\n exc_msg=None\n \n \n options=self._find_options(source,name,lineno)\n \n return source,options,want,exc_msg\n \n \n \n \n \n \n \n \n _OPTION_DIRECTIVE_RE=re.compile(r'#\\s*doctest:\\s*([^\\n\\'\"]*)$',\n re.MULTILINE)\n \n def _find_options(self,source,name,lineno):\n ''\n\n\n\n\n\n \n options={}\n \n for m in self._OPTION_DIRECTIVE_RE.finditer(source):\n option_strings=m.group(1).replace(',',' ').split()\n for option in option_strings:\n if(option[0]not in '+-'or\n option[1:]not in OPTIONFLAGS_BY_NAME):\n raise ValueError('line %r of the doctest for %s '\n 'has an invalid option: %r'%\n (lineno+1,name,option))\n flag=OPTIONFLAGS_BY_NAME[option[1:]]\n options[flag]=(option[0]=='+')\n if options and self._IS_BLANK_OR_COMMENT(source):\n raise ValueError('line %r of the doctest for %s has an option '\n 'directive on a line with no example: %r'%\n (lineno,name,source))\n return options\n \n \n \n _INDENT_RE=re.compile(r'^([ ]*)(?=\\S)',re.MULTILINE)\n \n def _min_indent(self,s):\n ''\n indents=[len(indent)for indent in self._INDENT_RE.findall(s)]\n if len(indents)>0:\n return min(indents)\n else:\n return 0\n \n def _check_prompt_blank(self,lines,indent,name,lineno):\n ''\n\n\n\n\n \n for i,line in enumerate(lines):\n if len(line)>=indent+4 and line[indent+3]!=' ':\n raise ValueError('line %r of the docstring for %s '\n 'lacks blank after %s: %r'%\n (lineno+i+1,name,\n line[indent:indent+3],line))\n \n def _check_prefix(self,lines,prefix,name,lineno):\n ''\n\n\n \n for i,line in enumerate(lines):\n if line and not line.startswith(prefix):\n raise ValueError('line %r of the docstring for %s has '\n 'inconsistent leading whitespace: %r'%\n (lineno+i+1,name,line))\n \n \n \n \n \n \nclass DocTestFinder:\n ''\n\n\n\n\n\n \n \n def __init__(self,verbose=False,parser=DocTestParser(),\n recurse=True,exclude_empty=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self._parser=parser\n self._verbose=verbose\n self._recurse=recurse\n self._exclude_empty=exclude_empty\n \n def find(self,obj,name=None,module=None,globs=None,extraglobs=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if name is None:\n name=getattr(obj,'__name__',None)\n if name is None:\n raise ValueError(\"DocTestFinder.find: name must be given \"\n \"when obj.__name__ doesn't exist: %r\"%\n (type(obj),))\n \n \n \n \n if module is False:\n module=None\n elif module is None:\n module=inspect.getmodule(obj)\n \n \n \n \n try:\n file=inspect.getsourcefile(obj)\n except TypeError:\n source_lines=None\n else:\n if not file:\n \n \n file=inspect.getfile(obj)\n if not file[0]+file[-2:]=='<]>':file=None\n if file is None:\n source_lines=None\n else:\n if module is not None:\n \n \n \n source_lines=linecache.getlines(file,module.__dict__)\n else:\n \n \n source_lines=linecache.getlines(file)\n if not source_lines:\n source_lines=None\n \n \n if globs is None:\n if module is None:\n globs={}\n else:\n globs=module.__dict__.copy()\n else:\n globs=globs.copy()\n if extraglobs is not None:\n globs.update(extraglobs)\n if '__name__'not in globs:\n globs['__name__']='__main__'\n \n \n tests=[]\n self._find(tests,obj,name,module,source_lines,globs,{})\n \n \n \n \n tests.sort()\n return tests\n \n def _from_module(self,module,object):\n ''\n\n\n \n if module is None:\n return True\n elif inspect.getmodule(object)is not None:\n return module is inspect.getmodule(object)\n elif inspect.isfunction(object):\n return module.__dict__ is object.__globals__\n elif(inspect.ismethoddescriptor(object)or\n inspect.ismethodwrapper(object)):\n if hasattr(object,'__objclass__'):\n obj_mod=object.__objclass__.__module__\n elif hasattr(object,'__module__'):\n obj_mod=object.__module__\n else:\n return True\n return module.__name__ ==obj_mod\n elif inspect.isclass(object):\n return module.__name__ ==object.__module__\n elif hasattr(object,'__module__'):\n return module.__name__ ==object.__module__\n elif isinstance(object,property):\n return True\n else:\n raise ValueError(\"object must be a class or function\")\n \n def _is_routine(self,obj):\n ''\n\n \n maybe_routine=obj\n try:\n maybe_routine=inspect.unwrap(maybe_routine)\n except ValueError:\n pass\n return inspect.isroutine(maybe_routine)\n \n def _find(self,tests,obj,name,module,source_lines,globs,seen):\n ''\n\n\n \n if self._verbose:\n print('Finding tests in %s'%name)\n \n \n if id(obj)in seen:\n return\n seen[id(obj)]=1\n \n \n test=self._get_test(obj,name,module,globs,source_lines)\n if test is not None:\n tests.append(test)\n \n \n if inspect.ismodule(obj)and self._recurse:\n for valname,val in obj.__dict__.items():\n valname='%s.%s'%(name,valname)\n \n \n if((self._is_routine(val)or inspect.isclass(val))and\n self._from_module(module,val)):\n self._find(tests,val,valname,module,source_lines,\n globs,seen)\n \n \n if inspect.ismodule(obj)and self._recurse:\n for valname,val in getattr(obj,'__test__',{}).items():\n if not isinstance(valname,str):\n raise ValueError(\"DocTestFinder.find: __test__ keys \"\n \"must be strings: %r\"%\n (type(valname),))\n if not(inspect.isroutine(val)or inspect.isclass(val)or\n inspect.ismodule(val)or isinstance(val,str)):\n raise ValueError(\"DocTestFinder.find: __test__ values \"\n \"must be strings, functions, methods, \"\n \"classes, or modules: %r\"%\n (type(val),))\n valname='%s.__test__.%s'%(name,valname)\n self._find(tests,val,valname,module,source_lines,\n globs,seen)\n \n \n if inspect.isclass(obj)and self._recurse:\n for valname,val in obj.__dict__.items():\n \n if isinstance(val,(staticmethod,classmethod)):\n val=val.__func__\n \n \n if((inspect.isroutine(val)or inspect.isclass(val)or\n isinstance(val,property))and\n self._from_module(module,val)):\n valname='%s.%s'%(name,valname)\n self._find(tests,val,valname,module,source_lines,\n globs,seen)\n \n def _get_test(self,obj,name,module,globs,source_lines):\n ''\n\n\n \n \n \n if isinstance(obj,str):\n docstring=obj\n else:\n try:\n if obj.__doc__ is None:\n docstring=''\n else:\n docstring=obj.__doc__\n if not isinstance(docstring,str):\n docstring=str(docstring)\n except(TypeError,AttributeError):\n docstring=''\n \n \n lineno=self._find_lineno(obj,source_lines)\n \n \n if self._exclude_empty and not docstring:\n return None\n \n \n if module is None:\n filename=None\n else:\n \n filename=getattr(module,'__file__',None)or module.__name__\n if filename[-4:]==\".pyc\":\n filename=filename[:-1]\n return self._parser.get_doctest(docstring,globs,name,\n filename,lineno)\n \n def _find_lineno(self,obj,source_lines):\n ''\n\n\n\n \n lineno=None\n docstring=getattr(obj,'__doc__',None)\n \n \n if inspect.ismodule(obj)and docstring is not None:\n lineno=0\n \n \n \n \n if inspect.isclass(obj)and docstring is not None:\n if source_lines is None:\n return None\n pat=re.compile(r'^\\s*class\\s*%s\\b'%\n getattr(obj,'__name__','-'))\n for i,line in enumerate(source_lines):\n if pat.match(line):\n lineno=i\n break\n \n \n if inspect.ismethod(obj):obj=obj.__func__\n if inspect.isfunction(obj)and getattr(obj,'__doc__',None):\n \n obj=obj.__code__\n if inspect.istraceback(obj):obj=obj.tb_frame\n if inspect.isframe(obj):obj=obj.f_code\n if inspect.iscode(obj):\n lineno=obj.co_firstlineno -1\n \n \n \n \n \n \n if lineno is not None:\n if source_lines is None:\n return lineno+1\n pat=re.compile(r'(^|.*:)\\s*\\w*(\"|\\')')\n for lineno in range(lineno,len(source_lines)):\n if pat.match(source_lines[lineno]):\n return lineno\n \n \n return None\n \n \n \n \n \nclass DocTestRunner:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n DIVIDER=\"*\"*70\n \n def __init__(self,checker=None,verbose=None,optionflags=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self._checker=checker or OutputChecker()\n if verbose is None:\n verbose='-v'in sys.argv\n self._verbose=verbose\n self.optionflags=optionflags\n self.original_optionflags=optionflags\n \n \n self.tries=0\n self.failures=0\n self._name2ft={}\n \n \n self._fakeout=_SpoofOut()\n \n \n \n \n \n def report_start(self,out,test,example):\n ''\n\n\n \n if self._verbose:\n if example.want:\n out('Trying:\\n'+_indent(example.source)+\n 'Expecting:\\n'+_indent(example.want))\n else:\n out('Trying:\\n'+_indent(example.source)+\n 'Expecting nothing\\n')\n \n def report_success(self,out,test,example,got):\n ''\n\n\n \n if self._verbose:\n out(\"ok\\n\")\n \n def report_failure(self,out,test,example,got):\n ''\n\n \n out(self._failure_header(test,example)+\n self._checker.output_difference(example,got,self.optionflags))\n \n def report_unexpected_exception(self,out,test,example,exc_info):\n ''\n\n \n out(self._failure_header(test,example)+\n 'Exception raised:\\n'+_indent(_exception_traceback(exc_info)))\n \n def _failure_header(self,test,example):\n out=[self.DIVIDER]\n if test.filename:\n if test.lineno is not None and example.lineno is not None:\n lineno=test.lineno+example.lineno+1\n else:\n lineno='?'\n out.append('File \"%s\", line %s, in %s'%\n (test.filename,lineno,test.name))\n else:\n out.append('Line %s, in %s'%(example.lineno+1,test.name))\n out.append('Failed example:')\n source=example.source\n out.append(_indent(source))\n return '\\n'.join(out)\n \n \n \n \n \n def __run(self,test,compileflags,out):\n ''\n\n\n\n\n\n\n\n \n \n failures=tries=0\n \n \n \n original_optionflags=self.optionflags\n \n SUCCESS,FAILURE,BOOM=range(3)\n \n check=self._checker.check_output\n \n \n for examplenum,example in enumerate(test.examples):\n \n \n \n quiet=(self.optionflags&REPORT_ONLY_FIRST_FAILURE and\n failures >0)\n \n \n self.optionflags=original_optionflags\n if example.options:\n for(optionflag,val)in example.options.items():\n if val:\n self.optionflags |=optionflag\n else:\n self.optionflags &=~optionflag\n \n \n if self.optionflags&SKIP:\n continue\n \n \n tries +=1\n if not quiet:\n self.report_start(out,test,example)\n \n \n \n \n filename=''%(test.name,examplenum)\n \n \n \n \n try:\n \n exec(compile(example.source,filename,\"single\",\n compileflags,True),test.globs)\n self.debugger.set_continue()\n exception=None\n except KeyboardInterrupt:\n raise\n except:\n exception=sys.exc_info()\n self.debugger.set_continue()\n \n got=self._fakeout.getvalue()\n self._fakeout.truncate(0)\n outcome=FAILURE\n \n \n \n if exception is None:\n if check(example.want,got,self.optionflags):\n outcome=SUCCESS\n \n \n else:\n exc_msg=traceback.format_exception_only(*exception[:2])[-1]\n if not quiet:\n got +=_exception_traceback(exception)\n \n \n \n if example.exc_msg is None:\n outcome=BOOM\n \n \n elif check(example.exc_msg,exc_msg,self.optionflags):\n outcome=SUCCESS\n \n \n elif self.optionflags&IGNORE_EXCEPTION_DETAIL:\n if check(_strip_exception_details(example.exc_msg),\n _strip_exception_details(exc_msg),\n self.optionflags):\n outcome=SUCCESS\n \n \n if outcome is SUCCESS:\n if not quiet:\n self.report_success(out,test,example,got)\n elif outcome is FAILURE:\n if not quiet:\n self.report_failure(out,test,example,got)\n failures +=1\n elif outcome is BOOM:\n if not quiet:\n self.report_unexpected_exception(out,test,example,\n exception)\n failures +=1\n else:\n assert False,(\"unknown outcome\",outcome)\n \n if failures and self.optionflags&FAIL_FAST:\n break\n \n \n self.optionflags=original_optionflags\n \n \n self.__record_outcome(test,failures,tries)\n return TestResults(failures,tries)\n \n def __record_outcome(self,test,f,t):\n ''\n\n\n \n f2,t2=self._name2ft.get(test.name,(0,0))\n self._name2ft[test.name]=(f+f2,t+t2)\n self.failures +=f\n self.tries +=t\n \n __LINECACHE_FILENAME_RE=re.compile(r'.+)'\n r'\\[(?P\\d+)\\]>$')\n def __patched_linecache_getlines(self,filename,module_globals=None):\n m=self.__LINECACHE_FILENAME_RE.match(filename)\n if m and m.group('name')==self.test.name:\n example=self.test.examples[int(m.group('examplenum'))]\n return example.source.splitlines(keepends=True)\n else:\n return self.save_linecache_getlines(filename,module_globals)\n \n def run(self,test,compileflags=None,out=None,clear_globs=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.test=test\n \n if compileflags is None:\n compileflags=_extract_future_flags(test.globs)\n \n save_stdout=sys.stdout\n if out is None:\n encoding=save_stdout.encoding\n if encoding is None or encoding.lower()=='utf-8':\n out=save_stdout.write\n else:\n \n def out(s):\n s=str(s.encode(encoding,'backslashreplace'),encoding)\n save_stdout.write(s)\n sys.stdout=self._fakeout\n \n \n \n \n \n \n save_trace=sys.gettrace()\n save_set_trace=pdb.set_trace\n self.debugger=_OutputRedirectingPdb(save_stdout)\n self.debugger.reset()\n pdb.set_trace=self.debugger.set_trace\n \n \n \n self.save_linecache_getlines=linecache.getlines\n linecache.getlines=self.__patched_linecache_getlines\n \n \n save_displayhook=sys.displayhook\n sys.displayhook=sys.__displayhook__\n \n try:\n return self.__run(test,compileflags,out)\n finally:\n sys.stdout=save_stdout\n pdb.set_trace=save_set_trace\n sys.settrace(save_trace)\n linecache.getlines=self.save_linecache_getlines\n sys.displayhook=save_displayhook\n if clear_globs:\n test.globs.clear()\n import builtins\n builtins._=None\n \n \n \n \n def summarize(self,verbose=None):\n ''\n\n\n\n\n\n\n\n\n \n if verbose is None:\n verbose=self._verbose\n notests=[]\n passed=[]\n failed=[]\n totalt=totalf=0\n for x in self._name2ft.items():\n name,(f,t)=x\n assert f <=t\n totalt +=t\n totalf +=f\n if t ==0:\n notests.append(name)\n elif f ==0:\n passed.append((name,t))\n else:\n failed.append(x)\n if verbose:\n if notests:\n print(len(notests),\"items had no tests:\")\n notests.sort()\n for thing in notests:\n print(\" \",thing)\n if passed:\n print(len(passed),\"items passed all tests:\")\n passed.sort()\n for thing,count in passed:\n print(\" %3d tests in %s\"%(count,thing))\n if failed:\n print(self.DIVIDER)\n print(len(failed),\"items had failures:\")\n failed.sort()\n for thing,(f,t)in failed:\n print(\" %3d of %3d in %s\"%(f,t,thing))\n if verbose:\n print(totalt,\"tests in\",len(self._name2ft),\"items.\")\n print(totalt -totalf,\"passed and\",totalf,\"failed.\")\n if totalf:\n print(\"***Test Failed***\",totalf,\"failures.\")\n elif verbose:\n print(\"Test passed.\")\n return TestResults(totalf,totalt)\n \n \n \n \n def merge(self,other):\n d=self._name2ft\n for name,(f,t)in other._name2ft.items():\n if name in d:\n \n \n \n \n f2,t2=d[name]\n f=f+f2\n t=t+t2\n d[name]=f,t\n \nclass OutputChecker:\n ''\n\n\n\n\n\n \n def _toAscii(self,s):\n ''\n\n \n return str(s.encode('ASCII','backslashreplace'),\"ASCII\")\n \n def check_output(self,want,got,optionflags):\n ''\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n got=self._toAscii(got)\n want=self._toAscii(want)\n \n \n \n if got ==want:\n return True\n \n \n \n if not(optionflags&DONT_ACCEPT_TRUE_FOR_1):\n if(got,want)==(\"True\\n\",\"1\\n\"):\n return True\n if(got,want)==(\"False\\n\",\"0\\n\"):\n return True\n \n \n \n if not(optionflags&DONT_ACCEPT_BLANKLINE):\n \n want=re.sub(r'(?m)^%s\\s*?$'%re.escape(BLANKLINE_MARKER),\n '',want)\n \n \n got=re.sub(r'(?m)^[^\\S\\n]+$','',got)\n if got ==want:\n return True\n \n \n \n \n if optionflags&NORMALIZE_WHITESPACE:\n got=' '.join(got.split())\n want=' '.join(want.split())\n if got ==want:\n return True\n \n \n \n if optionflags&ELLIPSIS:\n if _ellipsis_match(want,got):\n return True\n \n \n return False\n \n \n def _do_a_fancy_diff(self,want,got,optionflags):\n \n if not optionflags&(REPORT_UDIFF |\n REPORT_CDIFF |\n REPORT_NDIFF):\n return False\n \n \n \n \n \n \n \n \n \n \n \n if optionflags&REPORT_NDIFF:\n return True\n \n \n return want.count('\\n')>2 and got.count('\\n')>2\n \n def output_difference(self,example,got,optionflags):\n ''\n\n\n\n\n \n want=example.want\n \n \n if not(optionflags&DONT_ACCEPT_BLANKLINE):\n got=re.sub('(?m)^[ ]*(?=\\n)',BLANKLINE_MARKER,got)\n \n \n if self._do_a_fancy_diff(want,got,optionflags):\n \n want_lines=want.splitlines(keepends=True)\n got_lines=got.splitlines(keepends=True)\n \n if optionflags&REPORT_UDIFF:\n diff=difflib.unified_diff(want_lines,got_lines,n=2)\n diff=list(diff)[2:]\n kind='unified diff with -expected +actual'\n elif optionflags&REPORT_CDIFF:\n diff=difflib.context_diff(want_lines,got_lines,n=2)\n diff=list(diff)[2:]\n kind='context diff with expected followed by actual'\n elif optionflags&REPORT_NDIFF:\n engine=difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK)\n diff=list(engine.compare(want_lines,got_lines))\n kind='ndiff with -expected +actual'\n else:\n assert 0,'Bad diff option'\n return 'Differences (%s):\\n'%kind+_indent(''.join(diff))\n \n \n \n if want and got:\n return 'Expected:\\n%sGot:\\n%s'%(_indent(want),_indent(got))\n elif want:\n return 'Expected:\\n%sGot nothing\\n'%_indent(want)\n elif got:\n return 'Expected nothing\\nGot:\\n%s'%_indent(got)\n else:\n return 'Expected nothing\\nGot nothing\\n'\n \nclass DocTestFailure(Exception):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,test,example,got):\n self.test=test\n self.example=example\n self.got=got\n \n def __str__(self):\n return str(self.test)\n \nclass UnexpectedException(Exception):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,test,example,exc_info):\n self.test=test\n self.example=example\n self.exc_info=exc_info\n \n def __str__(self):\n return str(self.test)\n \nclass DebugRunner(DocTestRunner):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def run(self,test,compileflags=None,out=None,clear_globs=True):\n r=DocTestRunner.run(self,test,compileflags,out,False)\n if clear_globs:\n test.globs.clear()\n return r\n \n def report_unexpected_exception(self,out,test,example,exc_info):\n raise UnexpectedException(test,example,exc_info)\n \n def report_failure(self,out,test,example,got):\n raise DocTestFailure(test,example,got)\n \n \n \n \n \n \n \n \nmaster=None\n\ndef testmod(m=None,name=None,globs=None,verbose=None,\nreport=True,optionflags=0,extraglobs=None,\nraise_on_error=False,exclude_empty=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global master\n \n \n if m is None:\n \n \n \n m=sys.modules.get('__main__')\n \n \n if not inspect.ismodule(m):\n raise TypeError(\"testmod: module required; %r\"%(m,))\n \n \n if name is None:\n name=m.__name__\n \n \n finder=DocTestFinder(exclude_empty=exclude_empty)\n \n if raise_on_error:\n runner=DebugRunner(verbose=verbose,optionflags=optionflags)\n else:\n runner=DocTestRunner(verbose=verbose,optionflags=optionflags)\n \n for test in finder.find(m,name,globs=globs,extraglobs=extraglobs):\n runner.run(test)\n \n if report:\n runner.summarize()\n \n if master is None:\n master=runner\n else:\n master.merge(runner)\n \n return TestResults(runner.failures,runner.tries)\n \ndef testfile(filename,module_relative=True,name=None,package=None,\nglobs=None,verbose=None,report=True,optionflags=0,\nextraglobs=None,raise_on_error=False,parser=DocTestParser(),\nencoding=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global master\n \n if package and not module_relative:\n raise ValueError(\"Package may only be specified for module-\"\n \"relative paths.\")\n \n \n text,filename=_load_testfile(filename,package,module_relative,\n encoding or \"utf-8\")\n \n \n if name is None:\n name=os.path.basename(filename)\n \n \n if globs is None:\n globs={}\n else:\n globs=globs.copy()\n if extraglobs is not None:\n globs.update(extraglobs)\n if '__name__'not in globs:\n globs['__name__']='__main__'\n \n if raise_on_error:\n runner=DebugRunner(verbose=verbose,optionflags=optionflags)\n else:\n runner=DocTestRunner(verbose=verbose,optionflags=optionflags)\n \n \n test=parser.get_doctest(text,globs,name,filename,0)\n runner.run(test)\n \n if report:\n runner.summarize()\n \n if master is None:\n master=runner\n else:\n master.merge(runner)\n \n return TestResults(runner.failures,runner.tries)\n \ndef run_docstring_examples(f,globs,verbose=False,name=\"NoName\",\ncompileflags=None,optionflags=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n finder=DocTestFinder(verbose=verbose,recurse=False)\n runner=DocTestRunner(verbose=verbose,optionflags=optionflags)\n for test in finder.find(f,name,globs=globs):\n runner.run(test,compileflags=compileflags)\n \n \n \n \n \n_unittest_reportflags=0\n\ndef set_unittest_reportflags(flags):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global _unittest_reportflags\n \n if(flags&REPORTING_FLAGS)!=flags:\n raise ValueError(\"Only reporting flags allowed\",flags)\n old=_unittest_reportflags\n _unittest_reportflags=flags\n return old\n \n \nclass DocTestCase(unittest.TestCase):\n\n def __init__(self,test,optionflags=0,setUp=None,tearDown=None,\n checker=None):\n \n unittest.TestCase.__init__(self)\n self._dt_optionflags=optionflags\n self._dt_checker=checker\n self._dt_globs=test.globs.copy()\n self._dt_test=test\n self._dt_setUp=setUp\n self._dt_tearDown=tearDown\n \n def setUp(self):\n test=self._dt_test\n \n if self._dt_setUp is not None:\n self._dt_setUp(test)\n \n def tearDown(self):\n test=self._dt_test\n \n if self._dt_tearDown is not None:\n self._dt_tearDown(test)\n \n \n test.globs.clear()\n test.globs.update(self._dt_globs)\n \n def runTest(self):\n test=self._dt_test\n old=sys.stdout\n new=StringIO()\n optionflags=self._dt_optionflags\n \n if not(optionflags&REPORTING_FLAGS):\n \n \n optionflags |=_unittest_reportflags\n \n runner=DocTestRunner(optionflags=optionflags,\n checker=self._dt_checker,verbose=False)\n \n try:\n runner.DIVIDER=\"-\"*70\n failures,tries=runner.run(\n test,out=new.write,clear_globs=False)\n finally:\n sys.stdout=old\n \n if failures:\n raise self.failureException(self.format_failure(new.getvalue()))\n \n def format_failure(self,err):\n test=self._dt_test\n if test.lineno is None:\n lineno='unknown line number'\n else:\n lineno='%s'%test.lineno\n lname='.'.join(test.name.split('.')[-1:])\n return('Failed doctest test for %s\\n'\n ' File \"%s\", line %s, in %s\\n\\n%s'\n %(test.name,test.filename,lineno,lname,err)\n )\n \n def debug(self):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n self.setUp()\n runner=DebugRunner(optionflags=self._dt_optionflags,\n checker=self._dt_checker,verbose=False)\n runner.run(self._dt_test,clear_globs=False)\n self.tearDown()\n \n def id(self):\n return self._dt_test.name\n \n def __eq__(self,other):\n if type(self)is not type(other):\n return NotImplemented\n \n return self._dt_test ==other._dt_test and\\\n self._dt_optionflags ==other._dt_optionflags and\\\n self._dt_setUp ==other._dt_setUp and\\\n self._dt_tearDown ==other._dt_tearDown and\\\n self._dt_checker ==other._dt_checker\n \n def __hash__(self):\n return hash((self._dt_optionflags,self._dt_setUp,self._dt_tearDown,\n self._dt_checker))\n \n def __repr__(self):\n name=self._dt_test.name.split('.')\n return \"%s (%s)\"%(name[-1],'.'.join(name[:-1]))\n \n __str__=object.__str__\n \n def shortDescription(self):\n return \"Doctest: \"+self._dt_test.name\n \nclass SkipDocTestCase(DocTestCase):\n def __init__(self,module):\n self.module=module\n DocTestCase.__init__(self,None)\n \n def setUp(self):\n self.skipTest(\"DocTestSuite will not work with -O2 and above\")\n \n def test_skip(self):\n pass\n \n def shortDescription(self):\n return \"Skipping tests from %s\"%self.module.__name__\n \n __str__=shortDescription\n \n \nclass _DocTestSuite(unittest.TestSuite):\n\n def _removeTestAtIndex(self,index):\n pass\n \n \ndef DocTestSuite(module=None,globs=None,extraglobs=None,test_finder=None,\n**options):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if test_finder is None:\n test_finder=DocTestFinder()\n \n module=_normalize_module(module)\n tests=test_finder.find(module,globs=globs,extraglobs=extraglobs)\n \n if not tests and sys.flags.optimize >=2:\n \n suite=_DocTestSuite()\n suite.addTest(SkipDocTestCase(module))\n return suite\n \n tests.sort()\n suite=_DocTestSuite()\n \n for test in tests:\n if len(test.examples)==0:\n continue\n if not test.filename:\n filename=module.__file__\n if filename[-4:]==\".pyc\":\n filename=filename[:-1]\n test.filename=filename\n suite.addTest(DocTestCase(test,**options))\n \n return suite\n \nclass DocFileCase(DocTestCase):\n\n def id(self):\n return '_'.join(self._dt_test.name.split('.'))\n \n def __repr__(self):\n return self._dt_test.filename\n \n def format_failure(self,err):\n return('Failed doctest test for %s\\n File \"%s\", line 0\\n\\n%s'\n %(self._dt_test.name,self._dt_test.filename,err)\n )\n \ndef DocFileTest(path,module_relative=True,package=None,\nglobs=None,parser=DocTestParser(),\nencoding=None,**options):\n if globs is None:\n globs={}\n else:\n globs=globs.copy()\n \n if package and not module_relative:\n raise ValueError(\"Package may only be specified for module-\"\n \"relative paths.\")\n \n \n doc,path=_load_testfile(path,package,module_relative,\n encoding or \"utf-8\")\n \n if \"__file__\"not in globs:\n globs[\"__file__\"]=path\n \n \n name=os.path.basename(path)\n \n \n test=parser.get_doctest(doc,globs,name,path,0)\n return DocFileCase(test,**options)\n \ndef DocFileSuite(*paths,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n suite=_DocTestSuite()\n \n \n \n \n if kw.get('module_relative',True):\n kw['package']=_normalize_module(kw.get('package'))\n \n for path in paths:\n suite.addTest(DocFileTest(path,**kw))\n \n return suite\n \n \n \n \n \ndef script_from_examples(s):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n output=[]\n for piece in DocTestParser().parse(s):\n if isinstance(piece,Example):\n \n output.append(piece.source[:-1])\n \n want=piece.want\n if want:\n output.append('# Expected:')\n output +=['## '+l for l in want.split('\\n')[:-1]]\n else:\n \n output +=[_comment_line(l)\n for l in piece.split('\\n')[:-1]]\n \n \n while output and output[-1]=='#':\n output.pop()\n while output and output[0]=='#':\n output.pop(0)\n \n \n return '\\n'.join(output)+'\\n'\n \ndef testsource(module,name):\n ''\n\n\n\n\n \n module=_normalize_module(module)\n tests=DocTestFinder().find(module)\n test=[t for t in tests if t.name ==name]\n if not test:\n raise ValueError(name,\"not found in tests\")\n test=test[0]\n testsrc=script_from_examples(test.docstring)\n return testsrc\n \ndef debug_src(src,pm=False,globs=None):\n ''\n testsrc=script_from_examples(src)\n debug_script(testsrc,pm,globs)\n \ndef debug_script(src,pm=False,globs=None):\n ''\n import pdb\n \n if globs:\n globs=globs.copy()\n else:\n globs={}\n \n if pm:\n try:\n exec(src,globs,globs)\n except:\n print(sys.exc_info()[1])\n p=pdb.Pdb(nosigint=True)\n p.reset()\n p.interaction(None,sys.exc_info()[2])\n else:\n pdb.Pdb(nosigint=True).run(\"exec(%r)\"%src,globs,globs)\n \ndef debug(module,name,pm=False):\n ''\n\n\n\n\n \n module=_normalize_module(module)\n testsrc=testsource(module,name)\n debug_script(testsrc,pm,module.__dict__)\n \n \n \n \nclass _TestClass:\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,val):\n ''\n\n\n\n\n \n \n self.val=val\n \n def square(self):\n ''\n\n\n\n \n \n self.val=self.val **2\n return self\n \n def get(self):\n ''\n\n\n\n\n \n \n return self.val\n \n__test__={\"_TestClass\":_TestClass,\n\"string\":r\"\"\"\n Example of a string object, searched as-is.\n >>> x = 1; y = 2\n >>> x + y, x * y\n (3, 2)\n \"\"\",\n\n\"bool-int equivalence\":r\"\"\"\n In 2.2, boolean expressions displayed\n 0 or 1. By default, we still accept\n them. This can be disabled by passing\n DONT_ACCEPT_TRUE_FOR_1 to the new\n optionflags argument.\n >>> 4 == 4\n 1\n >>> 4 == 4\n True\n >>> 4 > 4\n 0\n >>> 4 > 4\n False\n \"\"\",\n\n\"blank lines\":r\"\"\"\n Blank lines can be marked with :\n >>> print('foo\\n\\nbar\\n')\n foo\n \n bar\n \n \"\"\",\n\n\"ellipsis\":r\"\"\"\n If the ellipsis flag is used, then '...' can be used to\n elide substrings in the desired output:\n >>> print(list(range(1000))) #doctest: +ELLIPSIS\n [0, 1, 2, ..., 999]\n \"\"\",\n\n\"whitespace normalization\":r\"\"\"\n If the whitespace normalization flag is used, then\n differences in whitespace are ignored.\n >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\n 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\n 27, 28, 29]\n \"\"\",\n}\n\n\ndef _test():\n import argparse\n \n parser=argparse.ArgumentParser(description=\"doctest runner\")\n parser.add_argument('-v','--verbose',action='store_true',default=False,\n help='print very verbose output for all tests')\n parser.add_argument('-o','--option',action='append',\n choices=OPTIONFLAGS_BY_NAME.keys(),default=[],\n help=('specify a doctest option flag to apply'\n ' to the test run; may be specified more'\n ' than once to apply multiple options'))\n parser.add_argument('-f','--fail-fast',action='store_true',\n help=('stop running tests after first failure (this'\n ' is a shorthand for -o FAIL_FAST, and is'\n ' in addition to any other -o options)'))\n parser.add_argument('file',nargs='+',\n help='file containing the tests to run')\n args=parser.parse_args()\n testfiles=args.file\n \n \n verbose=args.verbose\n options=0\n for option in args.option:\n options |=OPTIONFLAGS_BY_NAME[option]\n if args.fail_fast:\n options |=FAIL_FAST\n for filename in testfiles:\n if filename.endswith(\".py\"):\n \n \n \n dirname,filename=os.path.split(filename)\n sys.path.insert(0,dirname)\n m=__import__(filename[:-3])\n del sys.path[0]\n failures,_=testmod(m,verbose=verbose,optionflags=options)\n else:\n failures,_=testfile(filename,module_relative=False,\n verbose=verbose,optionflags=options)\n if failures:\n return 1\n return 0\n \n \nif __name__ ==\"__main__\":\n sys.exit(_test())\n", ["__future__", "argparse", "builtins", "collections", "difflib", "inspect", "io", "linecache", "os", "pdb", "re", "sys", "traceback", "unittest"]], "enum": [".py", "import sys\nimport builtins as bltns\nfrom types import MappingProxyType,DynamicClassAttribute\nfrom operator import or_ as _or_\nfrom functools import reduce\n\n\n__all__=[\n'EnumType','EnumMeta',\n'Enum','IntEnum','StrEnum','Flag','IntFlag','ReprEnum',\n'auto','unique','property','verify','member','nonmember',\n'FlagBoundary','STRICT','CONFORM','EJECT','KEEP',\n'global_flag_repr','global_enum_repr','global_str','global_enum',\n'EnumCheck','CONTINUOUS','NAMED_FLAGS','UNIQUE',\n]\n\n\n\n\n\nEnum=Flag=EJECT=_stdlib_enums=ReprEnum=None\n\nclass nonmember(object):\n ''\n\n \n def __init__(self,value):\n self.value=value\n \nclass member(object):\n ''\n\n \n def __init__(self,value):\n self.value=value\n \ndef _is_descriptor(obj):\n ''\n\n \n return(\n hasattr(obj,'__get__')or\n hasattr(obj,'__set__')or\n hasattr(obj,'__delete__')\n )\n \ndef _is_dunder(name):\n ''\n\n \n return(\n len(name)>4 and\n name[:2]==name[-2:]=='__'and\n name[2]!='_'and\n name[-3]!='_'\n )\n \ndef _is_sunder(name):\n ''\n\n \n return(\n len(name)>2 and\n name[0]==name[-1]=='_'and\n name[1:2]!='_'and\n name[-2:-1]!='_'\n )\n \ndef _is_internal_class(cls_name,obj):\n\n if not isinstance(obj,type):\n return False\n qualname=getattr(obj,'__qualname__','')\n s_pattern=cls_name+'.'+getattr(obj,'__name__','')\n e_pattern='.'+s_pattern\n return qualname ==s_pattern or qualname.endswith(e_pattern)\n \ndef _is_private(cls_name,name):\n\n pattern='_%s__'%(cls_name,)\n pat_len=len(pattern)\n if(\n len(name)>pat_len\n and name.startswith(pattern)\n and name[pat_len:pat_len+1]!=['_']\n and(name[-1]!='_'or name[-2]!='_')\n ):\n return True\n else:\n return False\n \ndef _is_single_bit(num):\n ''\n\n \n if num ==0:\n return False\n num &=num -1\n return num ==0\n \ndef _make_class_unpicklable(obj):\n ''\n\n\n\n \n def _break_on_call_reduce(self,proto):\n raise TypeError('%r cannot be pickled'%self)\n if isinstance(obj,dict):\n obj['__reduce_ex__']=_break_on_call_reduce\n obj['__module__']=''\n else:\n setattr(obj,'__reduce_ex__',_break_on_call_reduce)\n setattr(obj,'__module__','')\n \ndef _iter_bits_lsb(num):\n\n original=num\n if isinstance(num,Enum):\n num=num.value\n if num <0:\n raise ValueError('%r is not a positive integer'%original)\n while num:\n b=num&(~num+1)\n yield b\n num ^=b\n \ndef show_flag_values(value):\n return list(_iter_bits_lsb(value))\n \ndef bin(num,max_bits=None):\n ''\n\n\n\n\n\n\n\n\n \n \n ceiling=2 **(num).bit_length()\n if num >=0:\n s=bltns.bin(num+ceiling).replace('1','0',1)\n else:\n s=bltns.bin(~num ^(ceiling -1)+ceiling)\n sign=s[:3]\n digits=s[3:]\n if max_bits is not None:\n if len(digits) cannot set attribute %r\"%(self.clsname,self.name)\n )\n \n def __delete__(self,instance):\n if self.fdel is not None:\n return self.fdel(instance)\n raise AttributeError(\n \" cannot delete attribute %r\"%(self.clsname,self.name)\n )\n \n def __set_name__(self,ownerclass,name):\n self.name=name\n self.clsname=ownerclass.__name__\n \n \nclass _proto_member:\n ''\n\n \n \n def __init__(self,value):\n self.value=value\n \n def __set_name__(self,enum_class,member_name):\n ''\n\n \n \n delattr(enum_class,member_name)\n \n value=self.value\n if not isinstance(value,tuple):\n args=(value,)\n else:\n args=value\n if enum_class._member_type_ is tuple:\n args=(args,)\n if not enum_class._use_args_:\n enum_member=enum_class._new_member_(enum_class)\n else:\n enum_member=enum_class._new_member_(enum_class,*args)\n if not hasattr(enum_member,'_value_'):\n if enum_class._member_type_ is object:\n enum_member._value_=value\n else:\n try:\n enum_member._value_=enum_class._member_type_(*args)\n except Exception as exc:\n new_exc=TypeError(\n '_value_ not set in __new__, unable to create it'\n )\n new_exc.__cause__=exc\n raise new_exc\n value=enum_member._value_\n enum_member._name_=member_name\n enum_member.__objclass__=enum_class\n enum_member.__init__(*args)\n enum_member._sort_order_=len(enum_class._member_names_)\n \n if Flag is not None and issubclass(enum_class,Flag):\n enum_class._flag_mask_ |=value\n if _is_single_bit(value):\n enum_class._singles_mask_ |=value\n enum_class._all_bits_=2 **((enum_class._flag_mask_).bit_length())-1\n \n \n \n try:\n try:\n \n enum_member=enum_class._value2member_map_[value]\n except TypeError:\n for name,canonical_member in enum_class._member_map_.items():\n if canonical_member._value_ ==value:\n enum_member=canonical_member\n break\n else:\n raise KeyError\n except KeyError:\n \n \n if(\n Flag is None\n or not issubclass(enum_class,Flag)\n ):\n \n enum_class._member_names_.append(member_name)\n elif(\n Flag is not None\n and issubclass(enum_class,Flag)\n and _is_single_bit(value)\n ):\n \n enum_class._member_names_.append(member_name)\n \n found_descriptor=None\n descriptor_type=None\n class_type=None\n for base in enum_class.__mro__[1:]:\n attr=base.__dict__.get(member_name)\n if attr is not None:\n if isinstance(attr,(property,DynamicClassAttribute)):\n found_descriptor=attr\n class_type=base\n descriptor_type='enum'\n break\n elif _is_descriptor(attr):\n found_descriptor=attr\n descriptor_type=descriptor_type or 'desc'\n class_type=class_type or base\n continue\n else:\n descriptor_type='attr'\n class_type=base\n if found_descriptor:\n redirect=property()\n redirect.member=enum_member\n redirect.__set_name__(enum_class,member_name)\n if descriptor_type in('enum','desc'):\n \n redirect.fget=getattr(found_descriptor,'fget',None)\n redirect._get=getattr(found_descriptor,'__get__',None)\n redirect.fset=getattr(found_descriptor,'fset',None)\n redirect._set=getattr(found_descriptor,'__set__',None)\n redirect.fdel=getattr(found_descriptor,'fdel',None)\n redirect._del=getattr(found_descriptor,'__delete__',None)\n redirect._attr_type=descriptor_type\n redirect._cls_type=class_type\n setattr(enum_class,member_name,redirect)\n else:\n setattr(enum_class,member_name,enum_member)\n \n enum_class._member_map_[member_name]=enum_member\n try:\n \n \n \n enum_class._value2member_map_.setdefault(value,enum_member)\n except TypeError:\n \n enum_class._unhashable_values_.append(value)\n \n \nclass _EnumDict(dict):\n ''\n\n\n\n\n \n def __init__(self):\n super().__init__()\n self._member_names={}\n self._last_values=[]\n self._ignore=[]\n self._auto_called=False\n \n def __setitem__(self,key,value):\n ''\n\n\n\n\n\n\n \n if _is_internal_class(self._cls_name,value):\n import warnings\n warnings.warn(\n \"In 3.13 classes created inside an enum will not become a member. \"\n \"Use the `member` decorator to keep the current behavior.\",\n DeprecationWarning,\n stacklevel=2,\n )\n if _is_private(self._cls_name,key):\n \n pass\n elif _is_sunder(key):\n if key not in(\n '_order_',\n '_generate_next_value_','_numeric_repr_','_missing_','_ignore_',\n '_iter_member_','_iter_member_by_value_','_iter_member_by_def_',\n ):\n raise ValueError(\n '_sunder_ names, such as %r, are reserved for future Enum use'\n %(key,)\n )\n if key =='_generate_next_value_':\n \n if self._auto_called:\n raise TypeError(\"_generate_next_value_ must be defined before members\")\n _gnv=value.__func__ if isinstance(value,staticmethod)else value\n setattr(self,'_generate_next_value',_gnv)\n elif key =='_ignore_':\n if isinstance(value,str):\n value=value.replace(',',' ').split()\n else:\n value=list(value)\n self._ignore=value\n already=set(value)&set(self._member_names)\n if already:\n raise ValueError(\n '_ignore_ cannot specify already set names: %r'\n %(already,)\n )\n elif _is_dunder(key):\n if key =='__order__':\n key='_order_'\n elif key in self._member_names:\n \n raise TypeError('%r already defined as %r'%(key,self[key]))\n elif key in self._ignore:\n pass\n elif isinstance(value,nonmember):\n \n value=value.value\n elif _is_descriptor(value):\n pass\n \n \n \n \n else:\n if key in self:\n \n raise TypeError('%r already defined as %r'%(key,self[key]))\n elif isinstance(value,member):\n \n value=value.value\n non_auto_store=True\n single=False\n if isinstance(value,auto):\n single=True\n value=(value,)\n if type(value)is tuple and any(isinstance(v,auto)for v in value):\n \n \n auto_valued=[]\n for v in value:\n if isinstance(v,auto):\n non_auto_store=False\n if v.value ==_auto_null:\n v.value=self._generate_next_value(\n key,1,len(self._member_names),self._last_values[:],\n )\n self._auto_called=True\n v=v.value\n self._last_values.append(v)\n auto_valued.append(v)\n if single:\n value=auto_valued[0]\n else:\n value=tuple(auto_valued)\n self._member_names[key]=None\n if non_auto_store:\n self._last_values.append(value)\n super().__setitem__(key,value)\n \n def update(self,members,**more_members):\n try:\n for name in members.keys():\n self[name]=members[name]\n except AttributeError:\n for name,value in members:\n self[name]=value\n for name,value in more_members.items():\n self[name]=value\n \n \nclass EnumType(type):\n ''\n\n \n \n @classmethod\n def __prepare__(metacls,cls,bases,**kwds):\n \n metacls._check_for_existing_members_(cls,bases)\n \n enum_dict=_EnumDict()\n enum_dict._cls_name=cls\n \n member_type,first_enum=metacls._get_mixins_(cls,bases)\n if first_enum is not None:\n enum_dict['_generate_next_value_']=getattr(\n first_enum,'_generate_next_value_',None,\n )\n return enum_dict\n \n def __new__(metacls,cls,bases,classdict,*,boundary=None,_simple=False,**kwds):\n \n \n \n \n \n if _simple:\n return super().__new__(metacls,cls,bases,classdict,**kwds)\n \n \n classdict.setdefault('_ignore_',[]).append('_ignore_')\n ignore=classdict['_ignore_']\n for key in ignore:\n classdict.pop(key,None)\n \n \n member_names=classdict._member_names\n \n \n invalid_names=set(member_names)&{'mro',''}\n if invalid_names:\n raise ValueError('invalid enum member name(s) %s'%(\n ','.join(repr(n)for n in invalid_names)\n ))\n \n \n _order_=classdict.pop('_order_',None)\n _gnv=classdict.get('_generate_next_value_')\n if _gnv is not None and type(_gnv)is not staticmethod:\n _gnv=staticmethod(_gnv)\n \n classdict=dict(classdict.items())\n if _gnv is not None:\n classdict['_generate_next_value_']=_gnv\n \n \n member_type,first_enum=metacls._get_mixins_(cls,bases)\n __new__,save_new,use_args=metacls._find_new_(\n classdict,member_type,first_enum,\n )\n classdict['_new_member_']=__new__\n classdict['_use_args_']=use_args\n \n \n for name in member_names:\n value=classdict[name]\n classdict[name]=_proto_member(value)\n \n \n classdict['_member_names_']=[]\n classdict['_member_map_']={}\n classdict['_value2member_map_']={}\n classdict['_unhashable_values_']=[]\n classdict['_member_type_']=member_type\n \n classdict['_value_repr_']=metacls._find_data_repr_(cls,bases)\n \n \n classdict['_boundary_']=(\n boundary\n or getattr(first_enum,'_boundary_',None)\n )\n classdict['_flag_mask_']=0\n classdict['_singles_mask_']=0\n classdict['_all_bits_']=0\n classdict['_inverted_']=None\n try:\n exc=None\n enum_class=super().__new__(metacls,cls,bases,classdict,**kwds)\n except RuntimeError as e:\n \n \n exc=e.__cause__ or e\n if exc is not None:\n raise exc\n \n \n classdict.update(enum_class.__dict__)\n \n \n \n \n \n \n \n if ReprEnum is not None and ReprEnum in bases:\n if member_type is object:\n raise TypeError(\n 'ReprEnum subclasses must be mixed with a data type (i.e.'\n ' int, str, float, etc.)'\n )\n if '__format__'not in classdict:\n enum_class.__format__=member_type.__format__\n classdict['__format__']=enum_class.__format__\n if '__str__'not in classdict:\n method=member_type.__str__\n if method is object.__str__:\n \n \n method=member_type.__repr__\n enum_class.__str__=method\n classdict['__str__']=enum_class.__str__\n for name in('__repr__','__str__','__format__','__reduce_ex__'):\n if name not in classdict:\n \n enum_method=getattr(first_enum,name)\n found_method=getattr(enum_class,name)\n object_method=getattr(object,name)\n data_type_method=getattr(member_type,name)\n if found_method in(data_type_method,object_method):\n setattr(enum_class,name,enum_method)\n \n \n if Flag is not None and issubclass(enum_class,Flag):\n for name in(\n '__or__','__and__','__xor__',\n '__ror__','__rand__','__rxor__',\n '__invert__'\n ):\n if name not in classdict:\n enum_method=getattr(Flag,name)\n setattr(enum_class,name,enum_method)\n classdict[name]=enum_method\n \n \n \n if Enum is not None:\n \n \n if save_new:\n enum_class.__new_member__=__new__\n enum_class.__new__=Enum.__new__\n \n \n \n \n \n \n \n \n \n \n if _order_ is not None:\n if isinstance(_order_,str):\n _order_=_order_.replace(',',' ').split()\n \n \n if(\n Flag is None and cls !='Flag'\n or Flag is not None and not issubclass(enum_class,Flag)\n ):\n delattr(enum_class,'_boundary_')\n delattr(enum_class,'_flag_mask_')\n delattr(enum_class,'_singles_mask_')\n delattr(enum_class,'_all_bits_')\n delattr(enum_class,'_inverted_')\n elif Flag is not None and issubclass(enum_class,Flag):\n \n member_list=[m._value_ for m in enum_class]\n if member_list !=sorted(member_list):\n enum_class._iter_member_=enum_class._iter_member_by_def_\n if _order_:\n \n _order_=[\n o\n for o in _order_\n if o not in enum_class._member_map_ or _is_single_bit(enum_class[o]._value_)\n ]\n \n if _order_:\n \n _order_=[\n o\n for o in _order_\n if(\n o not in enum_class._member_map_\n or\n (o in enum_class._member_map_ and o in enum_class._member_names_)\n )]\n \n if _order_ !=enum_class._member_names_:\n raise TypeError(\n 'member order does not match _order_:\\n %r\\n %r'\n %(enum_class._member_names_,_order_)\n )\n \n return enum_class\n \n def __bool__(cls):\n ''\n\n \n return True\n \n def __call__(cls,value,names=None,*values,module=None,qualname=None,type=None,start=1,boundary=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if cls._member_map_:\n \n if names:\n value=(value,names)+values\n return cls.__new__(cls,value)\n \n return cls._create_(\n class_name=value,\n names=names,\n module=module,\n qualname=qualname,\n type=type,\n start=start,\n boundary=boundary,\n )\n \n def __contains__(cls,value):\n ''\n\n\n\n\n \n if isinstance(value,cls):\n return True\n return value in cls._value2member_map_ or value in cls._unhashable_values_\n \n def __delattr__(cls,attr):\n \n \n if attr in cls._member_map_:\n raise AttributeError(\"%r cannot delete member %r.\"%(cls.__name__,attr))\n super().__delattr__(attr)\n \n def __dir__(cls):\n interesting=set([\n '__class__','__contains__','__doc__','__getitem__',\n '__iter__','__len__','__members__','__module__',\n '__name__','__qualname__',\n ]\n +cls._member_names_\n )\n if cls._new_member_ is not object.__new__:\n interesting.add('__new__')\n if cls.__init_subclass__ is not object.__init_subclass__:\n interesting.add('__init_subclass__')\n if cls._member_type_ is object:\n return sorted(interesting)\n else:\n \n return sorted(set(dir(cls._member_type_))|interesting)\n \n def __getitem__(cls,name):\n ''\n\n \n return cls._member_map_[name]\n \n def __iter__(cls):\n ''\n\n \n return(cls._member_map_[name]for name in cls._member_names_)\n \n def __len__(cls):\n ''\n\n \n return len(cls._member_names_)\n \n @bltns.property\n def __members__(cls):\n ''\n\n\n\n\n \n return MappingProxyType(cls._member_map_)\n \n def __repr__(cls):\n if Flag is not None and issubclass(cls,Flag):\n return \"\"%cls.__name__\n else:\n return \"\"%cls.__name__\n \n def __reversed__(cls):\n ''\n\n \n return(cls._member_map_[name]for name in reversed(cls._member_names_))\n \n def __setattr__(cls,name,value):\n ''\n\n\n\n\n\n \n member_map=cls.__dict__.get('_member_map_',{})\n if name in member_map:\n raise AttributeError('cannot reassign member %r'%(name,))\n super().__setattr__(name,value)\n \n def _create_(cls,class_name,names,*,module=None,qualname=None,type=None,start=1,boundary=None):\n ''\n\n\n\n\n\n\n\n\n\n \n metacls=cls.__class__\n bases=(cls,)if type is None else(type,cls)\n _,first_enum=cls._get_mixins_(class_name,bases)\n classdict=metacls.__prepare__(class_name,bases)\n \n \n if isinstance(names,str):\n names=names.replace(',',' ').split()\n if isinstance(names,(tuple,list))and names and isinstance(names[0],str):\n original_names,names=names,[]\n last_values=[]\n for count,name in enumerate(original_names):\n value=first_enum._generate_next_value_(name,start,count,last_values[:])\n last_values.append(value)\n names.append((name,value))\n \n \n for item in names:\n if isinstance(item,str):\n member_name,member_value=item,names[item]\n else:\n member_name,member_value=item\n classdict[member_name]=member_value\n \n if module is None:\n try:\n module=sys._getframemodulename(2)\n except AttributeError:\n \n try:\n module=sys._getframe(2).f_globals['__name__']\n except(AttributeError,ValueError,KeyError):\n pass\n if module is None:\n _make_class_unpicklable(classdict)\n else:\n classdict['__module__']=module\n if qualname is not None:\n classdict['__qualname__']=qualname\n \n return metacls.__new__(metacls,class_name,bases,classdict,boundary=boundary)\n \n def _convert_(cls,name,module,filter,source=None,*,boundary=None,as_global=False):\n ''\n\n \n \n \n \n \n \n module_globals=sys.modules[module].__dict__\n if source:\n source=source.__dict__\n else:\n source=module_globals\n \n \n \n members=[\n (name,value)\n for name,value in source.items()\n if filter(name)]\n try:\n \n members.sort(key=lambda t:(t[1],t[0]))\n except TypeError:\n \n members.sort(key=lambda t:t[0])\n body={t[0]:t[1]for t in members}\n body['__module__']=module\n tmp_cls=type(name,(object,),body)\n cls=_simple_enum(etype=cls,boundary=boundary or KEEP)(tmp_cls)\n cls.__reduce_ex__=_reduce_ex_by_global_name\n if as_global:\n global_enum(cls)\n else:\n sys.modules[cls.__module__].__dict__.update(cls.__members__)\n module_globals[name]=cls\n return cls\n \n @classmethod\n def _check_for_existing_members_(mcls,class_name,bases):\n for chain in bases:\n for base in chain.__mro__:\n if isinstance(base,EnumType)and base._member_names_:\n raise TypeError(\n \" cannot extend %r\"\n %(class_name,base)\n )\n \n @classmethod\n def _get_mixins_(mcls,class_name,bases):\n ''\n\n\n\n\n \n if not bases:\n return object,Enum\n \n \n first_enum=bases[-1]\n if not isinstance(first_enum,EnumType):\n raise TypeError(\"new enumerations should be created as \"\n \"`EnumName([mixin_type, ...] [data_type,] enum_type)`\")\n member_type=mcls._find_data_type_(class_name,bases)or object\n return member_type,first_enum\n \n @classmethod\n def _find_data_repr_(mcls,class_name,bases):\n for chain in bases:\n for base in chain.__mro__:\n if base is object:\n continue\n elif isinstance(base,EnumType):\n \n return base._value_repr_\n elif '__repr__'in base.__dict__:\n \n \n if(\n '__dataclass_fields__'in base.__dict__\n and '__dataclass_params__'in base.__dict__\n and base.__dict__['__dataclass_params__'].repr\n ):\n return _dataclass_repr\n else:\n return base.__dict__['__repr__']\n return None\n \n @classmethod\n def _find_data_type_(mcls,class_name,bases):\n \n data_types=set()\n base_chain=set()\n for chain in bases:\n candidate=None\n for base in chain.__mro__:\n base_chain.add(base)\n if base is object:\n continue\n elif isinstance(base,EnumType):\n if base._member_type_ is not object:\n data_types.add(base._member_type_)\n break\n elif '__new__'in base.__dict__ or '__dataclass_fields__'in base.__dict__:\n data_types.add(candidate or base)\n break\n else:\n candidate=candidate or base\n if len(data_types)>1:\n raise TypeError('too many data types for %r: %r'%(class_name,data_types))\n elif data_types:\n return data_types.pop()\n else:\n return None\n \n @classmethod\n def _find_new_(mcls,classdict,member_type,first_enum):\n ''\n\n\n\n\n\n \n \n \n \n __new__=classdict.get('__new__',None)\n \n \n save_new=first_enum is not None and __new__ is not None\n \n if __new__ is None:\n \n \n for method in('__new_member__','__new__'):\n for possible in(member_type,first_enum):\n target=getattr(possible,method,None)\n if target not in{\n None,\n None.__new__,\n object.__new__,\n Enum.__new__,\n }:\n __new__=target\n break\n if __new__ is not None:\n break\n else:\n __new__=object.__new__\n \n \n \n \n if first_enum is None or __new__ in(Enum.__new__,object.__new__):\n use_args=False\n else:\n use_args=True\n return __new__,save_new,use_args\nEnumMeta=EnumType\n\n\nclass Enum(metaclass=EnumType):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n @classmethod\n def __signature__(cls):\n if cls._member_names_:\n return '(*values)'\n else:\n return '(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)'\n \n def __new__(cls,value):\n \n \n \n if type(value)is cls:\n \n return value\n \n \n try:\n return cls._value2member_map_[value]\n except KeyError:\n \n pass\n except TypeError:\n \n for member in cls._member_map_.values():\n if member._value_ ==value:\n return member\n \n try:\n exc=None\n result=cls._missing_(value)\n except Exception as e:\n exc=e\n result=None\n try:\n if isinstance(result,cls):\n return result\n elif(\n Flag is not None and issubclass(cls,Flag)\n and cls._boundary_ is EJECT and isinstance(result,int)\n ):\n return result\n else:\n ve_exc=ValueError(\"%r is not a valid %s\"%(value,cls.__qualname__))\n if result is None and exc is None:\n raise ve_exc\n elif exc is None:\n exc=TypeError(\n 'error in %s._missing_: returned %r instead of None or a valid member'\n %(cls.__name__,result)\n )\n if not isinstance(exc,ValueError):\n exc.__context__=ve_exc\n raise exc\n finally:\n \n exc=None\n ve_exc=None\n \n def __init__(self,*args,**kwds):\n pass\n \n @staticmethod\n def _generate_next_value_(name,start,count,last_values):\n ''\n\n\n\n\n\n\n \n if not last_values:\n return start\n try:\n last=last_values[-1]\n last_values.sort()\n if last ==last_values[-1]:\n \n return last+1\n else:\n \n raise TypeError\n except TypeError:\n import warnings\n warnings.warn(\n \"In 3.13 the default `auto()`/`_generate_next_value_` will require all values to be sortable and support adding +1\\n\"\n \"and the value returned will be the largest value in the enum incremented by 1\",\n DeprecationWarning,\n stacklevel=3,\n )\n for v in reversed(last_values):\n try:\n return v+1\n except TypeError:\n pass\n return start\n \n @classmethod\n def _missing_(cls,value):\n return None\n \n def __repr__(self):\n v_repr=self.__class__._value_repr_ or repr\n return \"<%s.%s: %s>\"%(self.__class__.__name__,self._name_,v_repr(self._value_))\n \n def __str__(self):\n return \"%s.%s\"%(self.__class__.__name__,self._name_,)\n \n def __dir__(self):\n ''\n\n \n if self.__class__._member_type_ is object:\n interesting=set(['__class__','__doc__','__eq__','__hash__','__module__','name','value'])\n else:\n interesting=set(object.__dir__(self))\n for name in getattr(self,'__dict__',[]):\n if name[0]!='_':\n interesting.add(name)\n for cls in self.__class__.mro():\n for name,obj in cls.__dict__.items():\n if name[0]=='_':\n continue\n if isinstance(obj,property):\n \n if obj.fget is not None or name not in self._member_map_:\n interesting.add(name)\n else:\n \n interesting.discard(name)\n else:\n interesting.add(name)\n names=sorted(\n set(['__class__','__doc__','__eq__','__hash__','__module__'])\n |interesting\n )\n return names\n \n def __format__(self,format_spec):\n return str.__format__(str(self),format_spec)\n \n def __hash__(self):\n return hash(self._name_)\n \n def __reduce_ex__(self,proto):\n return getattr,(self.__class__,self._name_)\n \n \n \n \n \n \n \n \n \n @property\n def name(self):\n ''\n return self._name_\n \n @property\n def value(self):\n ''\n return self._value_\n \n \nclass ReprEnum(Enum):\n ''\n\n \n \n \nclass IntEnum(int,ReprEnum):\n ''\n\n \n \n \nclass StrEnum(str,ReprEnum):\n ''\n\n \n \n def __new__(cls,*values):\n ''\n if len(values)>3:\n raise TypeError('too many arguments for str(): %r'%(values,))\n if len(values)==1:\n \n if not isinstance(values[0],str):\n raise TypeError('%r is not a string'%(values[0],))\n if len(values)>=2:\n \n if not isinstance(values[1],str):\n raise TypeError('encoding must be a string, not %r'%(values[1],))\n if len(values)==3:\n \n if not isinstance(values[2],str):\n raise TypeError('errors must be a string, not %r'%(values[2]))\n value=str(*values)\n member=str.__new__(cls,value)\n member._value_=value\n return member\n \n @staticmethod\n def _generate_next_value_(name,start,count,last_values):\n ''\n\n \n return name.lower()\n \n \ndef _reduce_ex_by_global_name(self,proto):\n return self.name\n \nclass FlagBoundary(StrEnum):\n ''\n\n\n\n\n\n \n STRICT=auto()\n CONFORM=auto()\n EJECT=auto()\n KEEP=auto()\nSTRICT,CONFORM,EJECT,KEEP=FlagBoundary\n\n\nclass Flag(Enum,boundary=STRICT):\n ''\n\n \n \n def __reduce_ex__(self,proto):\n cls=self.__class__\n unknown=self._value_&~cls._flag_mask_\n member_value=self._value_&cls._flag_mask_\n if unknown and member_value:\n return _or_,(cls(member_value),unknown)\n for val in _iter_bits_lsb(member_value):\n rest=member_value&~val\n if rest:\n return _or_,(cls(rest),cls._value2member_map_.get(val))\n else:\n break\n if self._name_ is None:\n return cls,(self._value_,)\n else:\n return getattr,(cls,self._name_)\n \n _numeric_repr_=repr\n \n @staticmethod\n def _generate_next_value_(name,start,count,last_values):\n ''\n\n\n\n\n\n\n \n if not count:\n return start if start is not None else 1\n last_value=max(last_values)\n try:\n high_bit=_high_bit(last_value)\n except Exception:\n raise TypeError('invalid flag value %r'%last_value)from None\n return 2 **(high_bit+1)\n \n @classmethod\n def _iter_member_by_value_(cls,value):\n ''\n\n \n for val in _iter_bits_lsb(value&cls._flag_mask_):\n yield cls._value2member_map_.get(val)\n \n _iter_member_=_iter_member_by_value_\n \n @classmethod\n def _iter_member_by_def_(cls,value):\n ''\n\n \n yield from sorted(\n cls._iter_member_by_value_(value),\n key=lambda m:m._sort_order_,\n )\n \n @classmethod\n def _missing_(cls,value):\n ''\n\n\n\n \n if not isinstance(value,int):\n raise ValueError(\n \"%r is not a valid %s\"%(value,cls.__qualname__)\n )\n \n \n \n \n flag_mask=cls._flag_mask_\n singles_mask=cls._singles_mask_\n all_bits=cls._all_bits_\n neg_value=None\n if(\n not ~all_bits <=value <=all_bits\n or value&(all_bits ^flag_mask)\n ):\n if cls._boundary_ is STRICT:\n max_bits=max(value.bit_length(),flag_mask.bit_length())\n raise ValueError(\n \"%r invalid value %r\\n given %s\\n allowed %s\"%(\n cls,value,bin(value,max_bits),bin(flag_mask,max_bits),\n ))\n elif cls._boundary_ is CONFORM:\n value=value&flag_mask\n elif cls._boundary_ is EJECT:\n return value\n elif cls._boundary_ is KEEP:\n if value <0:\n value=(\n max(all_bits+1,2 **(value.bit_length()))\n +value\n )\n else:\n raise ValueError(\n '%r unknown flag boundary %r'%(cls,cls._boundary_,)\n )\n if value <0:\n neg_value=value\n value=all_bits+1+value\n \n unknown=value&~flag_mask\n aliases=value&~singles_mask\n member_value=value&singles_mask\n if unknown and cls._boundary_ is not KEEP:\n raise ValueError(\n '%s(%r) --> unknown values %r [%s]'\n %(cls.__name__,value,unknown,bin(unknown))\n )\n \n if cls._member_type_ is object:\n \n pseudo_member=object.__new__(cls)\n else:\n pseudo_member=cls._member_type_.__new__(cls,value)\n if not hasattr(pseudo_member,'_value_'):\n pseudo_member._value_=value\n if member_value or aliases:\n members=[]\n combined_value=0\n for m in cls._iter_member_(member_value):\n members.append(m)\n combined_value |=m._value_\n if aliases:\n value=member_value |aliases\n for n,pm in cls._member_map_.items():\n if pm not in members and pm._value_ and pm._value_&value ==pm._value_:\n members.append(pm)\n combined_value |=pm._value_\n unknown=value ^combined_value\n pseudo_member._name_='|'.join([m._name_ for m in members])\n if not combined_value:\n pseudo_member._name_=None\n elif unknown and cls._boundary_ is STRICT:\n raise ValueError('%r: no members with value %r'%(cls,unknown))\n elif unknown:\n pseudo_member._name_ +='|%s'%cls._numeric_repr_(unknown)\n else:\n pseudo_member._name_=None\n \n \n \n if not unknown:\n pseudo_member=cls._value2member_map_.setdefault(value,pseudo_member)\n if neg_value is not None:\n cls._value2member_map_[neg_value]=pseudo_member\n return pseudo_member\n \n def __contains__(self,other):\n ''\n\n \n if not isinstance(other,self.__class__):\n raise TypeError(\n \"unsupported operand type(s) for 'in': %r and %r\"%(\n type(other).__qualname__,self.__class__.__qualname__))\n return other._value_&self._value_ ==other._value_\n \n def __iter__(self):\n ''\n\n \n yield from self._iter_member_(self._value_)\n \n def __len__(self):\n return self._value_.bit_count()\n \n def __repr__(self):\n cls_name=self.__class__.__name__\n v_repr=self.__class__._value_repr_ or repr\n if self._name_ is None:\n return \"<%s: %s>\"%(cls_name,v_repr(self._value_))\n else:\n return \"<%s.%s: %s>\"%(cls_name,self._name_,v_repr(self._value_))\n \n def __str__(self):\n cls_name=self.__class__.__name__\n if self._name_ is None:\n return '%s(%r)'%(cls_name,self._value_)\n else:\n return \"%s.%s\"%(cls_name,self._name_)\n \n def __bool__(self):\n return bool(self._value_)\n \n def __or__(self,other):\n if isinstance(other,self.__class__):\n other=other._value_\n elif self._member_type_ is not object and isinstance(other,self._member_type_):\n other=other\n else:\n return NotImplemented\n value=self._value_\n return self.__class__(value |other)\n \n def __and__(self,other):\n if isinstance(other,self.__class__):\n other=other._value_\n elif self._member_type_ is not object and isinstance(other,self._member_type_):\n other=other\n else:\n return NotImplemented\n value=self._value_\n return self.__class__(value&other)\n \n def __xor__(self,other):\n if isinstance(other,self.__class__):\n other=other._value_\n elif self._member_type_ is not object and isinstance(other,self._member_type_):\n other=other\n else:\n return NotImplemented\n value=self._value_\n return self.__class__(value ^other)\n \n def __invert__(self):\n if self._inverted_ is None:\n if self._boundary_ is KEEP:\n \n self._inverted_=self.__class__(~self._value_)\n else:\n \n self._inverted_=self.__class__(self._flag_mask_ ^self._value_)\n if isinstance(self._inverted_,self.__class__):\n self._inverted_._inverted_=self\n return self._inverted_\n \n __rand__=__and__\n __ror__=__or__\n __rxor__=__xor__\n \n \nclass IntFlag(int,ReprEnum,Flag,boundary=KEEP):\n ''\n\n \n \n \ndef _high_bit(value):\n ''\n\n \n return value.bit_length()-1\n \ndef unique(enumeration):\n ''\n\n \n duplicates=[]\n for name,member in enumeration.__members__.items():\n if name !=member.name:\n duplicates.append((name,member.name))\n if duplicates:\n alias_details=', '.join(\n [\"%s -> %s\"%(alias,name)for(alias,name)in duplicates])\n raise ValueError('duplicate values found in %r: %s'%\n (enumeration,alias_details))\n return enumeration\n \ndef _dataclass_repr(self):\n dcf=self.__dataclass_fields__\n return ', '.join(\n '%s=%r'%(k,getattr(self,k))\n for k in dcf.keys()\n if dcf[k].repr\n )\n \ndef global_enum_repr(self):\n ''\n\n\n\n \n module=self.__class__.__module__.split('.')[-1]\n return '%s.%s'%(module,self._name_)\n \ndef global_flag_repr(self):\n ''\n\n\n\n \n module=self.__class__.__module__.split('.')[-1]\n cls_name=self.__class__.__name__\n if self._name_ is None:\n return \"%s.%s(%r)\"%(module,cls_name,self._value_)\n if _is_single_bit(self):\n return '%s.%s'%(module,self._name_)\n if self._boundary_ is not FlagBoundary.KEEP:\n return '|'.join(['%s.%s'%(module,name)for name in self.name.split('|')])\n else:\n name=[]\n for n in self._name_.split('|'):\n if n[0].isdigit():\n name.append(n)\n else:\n name.append('%s.%s'%(module,n))\n return '|'.join(name)\n \ndef global_str(self):\n ''\n\n \n if self._name_ is None:\n cls_name=self.__class__.__name__\n return \"%s(%r)\"%(cls_name,self._value_)\n else:\n return self._name_\n \ndef global_enum(cls,update_str=False):\n ''\n\n\n\n \n if issubclass(cls,Flag):\n cls.__repr__=global_flag_repr\n else:\n cls.__repr__=global_enum_repr\n if not issubclass(cls,ReprEnum)or update_str:\n cls.__str__=global_str\n sys.modules[cls.__module__].__dict__.update(cls.__members__)\n return cls\n \ndef _simple_enum(etype=Enum,*,boundary=None,use_args=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def convert_class(cls):\n nonlocal use_args\n cls_name=cls.__name__\n if use_args is None:\n use_args=etype._use_args_\n __new__=cls.__dict__.get('__new__')\n if __new__ is not None:\n new_member=__new__.__func__\n else:\n new_member=etype._member_type_.__new__\n attrs={}\n body={}\n if __new__ is not None:\n body['__new_member__']=new_member\n body['_new_member_']=new_member\n body['_use_args_']=use_args\n body['_generate_next_value_']=gnv=etype._generate_next_value_\n body['_member_names_']=member_names=[]\n body['_member_map_']=member_map={}\n body['_value2member_map_']=value2member_map={}\n body['_unhashable_values_']=[]\n body['_member_type_']=member_type=etype._member_type_\n body['_value_repr_']=etype._value_repr_\n if issubclass(etype,Flag):\n body['_boundary_']=boundary or etype._boundary_\n body['_flag_mask_']=None\n body['_all_bits_']=None\n body['_singles_mask_']=None\n body['_inverted_']=None\n body['__or__']=Flag.__or__\n body['__xor__']=Flag.__xor__\n body['__and__']=Flag.__and__\n body['__ror__']=Flag.__ror__\n body['__rxor__']=Flag.__rxor__\n body['__rand__']=Flag.__rand__\n body['__invert__']=Flag.__invert__\n for name,obj in cls.__dict__.items():\n if name in('__dict__','__weakref__'):\n continue\n if _is_dunder(name)or _is_private(cls_name,name)or _is_sunder(name)or _is_descriptor(obj):\n body[name]=obj\n else:\n attrs[name]=obj\n if cls.__dict__.get('__doc__')is None:\n body['__doc__']='An enumeration.'\n \n \n \n \n \n enum_class=type(cls_name,(etype,),body,boundary=boundary,_simple=True)\n for name in('__repr__','__str__','__format__','__reduce_ex__'):\n if name not in body:\n \n enum_method=getattr(etype,name)\n found_method=getattr(enum_class,name)\n object_method=getattr(object,name)\n data_type_method=getattr(member_type,name)\n if found_method in(data_type_method,object_method):\n setattr(enum_class,name,enum_method)\n gnv_last_values=[]\n if issubclass(enum_class,Flag):\n \n single_bits=multi_bits=0\n for name,value in attrs.items():\n if isinstance(value,auto)and auto.value is _auto_null:\n value=gnv(name,1,len(member_names),gnv_last_values)\n if value in value2member_map:\n \n member=value2member_map[value]\n redirect=property()\n redirect.member=member\n redirect.__set_name__(enum_class,name)\n setattr(enum_class,name,redirect)\n member_map[name]=member\n else:\n \n if use_args:\n if not isinstance(value,tuple):\n value=(value,)\n member=new_member(enum_class,*value)\n value=value[0]\n else:\n member=new_member(enum_class)\n if __new__ is None:\n member._value_=value\n member._name_=name\n member.__objclass__=enum_class\n member.__init__(value)\n redirect=property()\n redirect.member=member\n redirect.__set_name__(enum_class,name)\n setattr(enum_class,name,redirect)\n member_map[name]=member\n member._sort_order_=len(member_names)\n value2member_map[value]=member\n if _is_single_bit(value):\n \n member_names.append(name)\n single_bits |=value\n else:\n multi_bits |=value\n gnv_last_values.append(value)\n enum_class._flag_mask_=single_bits |multi_bits\n enum_class._singles_mask_=single_bits\n enum_class._all_bits_=2 **((single_bits |multi_bits).bit_length())-1\n \n member_list=[m._value_ for m in enum_class]\n if member_list !=sorted(member_list):\n enum_class._iter_member_=enum_class._iter_member_by_def_\n else:\n \n for name,value in attrs.items():\n if isinstance(value,auto):\n if value.value is _auto_null:\n value.value=gnv(name,1,len(member_names),gnv_last_values)\n value=value.value\n if value in value2member_map:\n \n member=value2member_map[value]\n redirect=property()\n redirect.member=member\n redirect.__set_name__(enum_class,name)\n setattr(enum_class,name,redirect)\n member_map[name]=member\n else:\n \n if use_args:\n if not isinstance(value,tuple):\n value=(value,)\n member=new_member(enum_class,*value)\n value=value[0]\n else:\n member=new_member(enum_class)\n if __new__ is None:\n member._value_=value\n member._name_=name\n member.__objclass__=enum_class\n member.__init__(value)\n member._sort_order_=len(member_names)\n redirect=property()\n redirect.member=member\n redirect.__set_name__(enum_class,name)\n setattr(enum_class,name,redirect)\n member_map[name]=member\n value2member_map[value]=member\n member_names.append(name)\n gnv_last_values.append(value)\n if '__new__'in body:\n enum_class.__new_member__=enum_class.__new__\n enum_class.__new__=Enum.__new__\n return enum_class\n return convert_class\n \n@_simple_enum(StrEnum)\nclass EnumCheck:\n ''\n\n \n CONTINUOUS=\"no skipped integer values\"\n NAMED_FLAGS=\"multi-flag aliases may not contain unnamed flags\"\n UNIQUE=\"one name per value\"\nCONTINUOUS,NAMED_FLAGS,UNIQUE=EnumCheck\n\n\nclass verify:\n ''\n\n \n def __init__(self,*checks):\n self.checks=checks\n def __call__(self,enumeration):\n checks=self.checks\n cls_name=enumeration.__name__\n if Flag is not None and issubclass(enumeration,Flag):\n enum_type='flag'\n elif issubclass(enumeration,Enum):\n enum_type='enum'\n else:\n raise TypeError(\"the 'verify' decorator only works with Enum and Flag\")\n for check in checks:\n if check is UNIQUE:\n \n duplicates=[]\n for name,member in enumeration.__members__.items():\n if name !=member.name:\n duplicates.append((name,member.name))\n if duplicates:\n alias_details=', '.join(\n [\"%s -> %s\"%(alias,name)for(alias,name)in duplicates])\n raise ValueError('aliases found in %r: %s'%\n (enumeration,alias_details))\n elif check is CONTINUOUS:\n values=set(e.value for e in enumeration)\n if len(values)<2:\n continue\n low,high=min(values),max(values)\n missing=[]\n if enum_type =='flag':\n \n for i in range(_high_bit(low)+1,_high_bit(high)):\n if 2 **i not in values:\n missing.append(2 **i)\n elif enum_type =='enum':\n \n for i in range(low+1,high):\n if i not in values:\n missing.append(i)\n else:\n raise Exception('verify: unknown type %r'%enum_type)\n if missing:\n raise ValueError(('invalid %s %r: missing values %s'%(\n enum_type,cls_name,', '.join((str(m)for m in missing)))\n )[:256])\n \n elif check is NAMED_FLAGS:\n \n member_names=enumeration._member_names_\n member_values=[m.value for m in enumeration]\n missing_names=[]\n missing_value=0\n for name,alias in enumeration._member_map_.items():\n if name in member_names:\n \n continue\n if alias.value <0:\n \n continue\n values=list(_iter_bits_lsb(alias.value))\n missed=[v for v in values if v not in member_values]\n if missed:\n missing_names.append(name)\n missing_value |=reduce(_or_,missed)\n if missing_names:\n if len(missing_names)==1:\n alias='alias %s is missing'%missing_names[0]\n else:\n alias='aliases %s and %s are missing'%(\n ', '.join(missing_names[:-1]),missing_names[-1]\n )\n if _is_single_bit(missing_value):\n value='value 0x%x'%missing_value\n else:\n value='combined values of 0x%x'%missing_value\n raise ValueError(\n 'invalid Flag %r: %s %s [use enum.show_flag_values(value) for details]'\n %(cls_name,alias,value)\n )\n return enumeration\n \ndef _test_simple_enum(checked_enum,simple_enum):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n failed=[]\n if checked_enum.__dict__ !=simple_enum.__dict__:\n checked_dict=checked_enum.__dict__\n checked_keys=list(checked_dict.keys())\n simple_dict=simple_enum.__dict__\n simple_keys=list(simple_dict.keys())\n member_names=set(\n list(checked_enum._member_map_.keys())\n +list(simple_enum._member_map_.keys())\n )\n for key in set(checked_keys+simple_keys):\n if key in('__module__','_member_map_','_value2member_map_','__doc__'):\n \n continue\n elif key in member_names:\n \n continue\n elif key not in simple_keys:\n failed.append(\"missing key: %r\"%(key,))\n elif key not in checked_keys:\n failed.append(\"extra key: %r\"%(key,))\n else:\n checked_value=checked_dict[key]\n simple_value=simple_dict[key]\n if callable(checked_value)or isinstance(checked_value,bltns.property):\n continue\n if key =='__doc__':\n \n compressed_checked_value=checked_value.replace(' ','').replace('\\t','')\n compressed_simple_value=simple_value.replace(' ','').replace('\\t','')\n if compressed_checked_value !=compressed_simple_value:\n failed.append(\"%r:\\n %s\\n %s\"%(\n key,\n \"checked -> %r\"%(checked_value,),\n \"simple -> %r\"%(simple_value,),\n ))\n elif checked_value !=simple_value:\n failed.append(\"%r:\\n %s\\n %s\"%(\n key,\n \"checked -> %r\"%(checked_value,),\n \"simple -> %r\"%(simple_value,),\n ))\n failed.sort()\n for name in member_names:\n failed_member=[]\n if name not in simple_keys:\n failed.append('missing member from simple enum: %r'%name)\n elif name not in checked_keys:\n failed.append('extra member in simple enum: %r'%name)\n else:\n checked_member_dict=checked_enum[name].__dict__\n checked_member_keys=list(checked_member_dict.keys())\n simple_member_dict=simple_enum[name].__dict__\n simple_member_keys=list(simple_member_dict.keys())\n for key in set(checked_member_keys+simple_member_keys):\n if key in('__module__','__objclass__','_inverted_'):\n \n continue\n elif key not in simple_member_keys:\n failed_member.append(\"missing key %r not in the simple enum member %r\"%(key,name))\n elif key not in checked_member_keys:\n failed_member.append(\"extra key %r in simple enum member %r\"%(key,name))\n else:\n checked_value=checked_member_dict[key]\n simple_value=simple_member_dict[key]\n if checked_value !=simple_value:\n failed_member.append(\"%r:\\n %s\\n %s\"%(\n key,\n \"checked member -> %r\"%(checked_value,),\n \"simple member -> %r\"%(simple_value,),\n ))\n if failed_member:\n failed.append('%r member mismatch:\\n %s'%(\n name,'\\n '.join(failed_member),\n ))\n for method in(\n '__str__','__repr__','__reduce_ex__','__format__',\n '__getnewargs_ex__','__getnewargs__','__reduce_ex__','__reduce__'\n ):\n if method in simple_keys and method in checked_keys:\n \n continue\n elif method not in simple_keys and method not in checked_keys:\n \n checked_method=getattr(checked_enum,method,None)\n simple_method=getattr(simple_enum,method,None)\n if hasattr(checked_method,'__func__'):\n checked_method=checked_method.__func__\n simple_method=simple_method.__func__\n if checked_method !=simple_method:\n failed.append(\"%r: %-30s %s\"%(\n method,\n \"checked -> %r\"%(checked_method,),\n \"simple -> %r\"%(simple_method,),\n ))\n else:\n \n \n pass\n if failed:\n raise TypeError('enum mismatch:\\n %s'%'\\n '.join(failed))\n \ndef _old_convert_(etype,name,module,filter,source=None,*,boundary=None):\n ''\n\n \n \n \n \n \n \n module_globals=sys.modules[module].__dict__\n if source:\n source=source.__dict__\n else:\n source=module_globals\n \n \n \n members=[\n (name,value)\n for name,value in source.items()\n if filter(name)]\n try:\n \n members.sort(key=lambda t:(t[1],t[0]))\n except TypeError:\n \n members.sort(key=lambda t:t[0])\n cls=etype(name,members,module=module,boundary=boundary or KEEP)\n cls.__reduce_ex__=_reduce_ex_by_global_name\n return cls\n \n_stdlib_enums=IntEnum,StrEnum,IntFlag\n", ["builtins", "functools", "operator", "sys", "types", "warnings"]], "errno": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\nE2BIG=7\n\nEACCES=13\n\nEADDRINUSE=10048\n\nEADDRNOTAVAIL=10049\n\nEAFNOSUPPORT=10047\n\nEAGAIN=11\n\nEALREADY=10037\n\nEBADF=9\n\nEBADMSG=104\n\nEBUSY=16\n\nECANCELED=105\n\nECHILD=10\n\nECONNABORTED=10053\n\nECONNREFUSED=10061\n\nECONNRESET=10054\n\nEDEADLK=36\n\nEDEADLOCK=36\n\nEDESTADDRREQ=10039\n\nEDOM=33\n\nEDQUOT=10069\n\nEEXIST=17\n\nEFAULT=14\n\nEFBIG=27\n\nEHOSTDOWN=10064\n\nEHOSTUNREACH=10065\n\nEIDRM=111\n\nEILSEQ=42\n\nEINPROGRESS=10036\n\nEINTR=4\n\nEINVAL=22\n\nEIO=5\n\nEISCONN=10056\n\nEISDIR=21\n\nELOOP=10062\n\nEMFILE=24\n\nEMLINK=31\n\nEMSGSIZE=10040\n\nENAMETOOLONG=38\n\nENETDOWN=10050\n\nENETRESET=10052\n\nENETUNREACH=10051\n\nENFILE=23\n\nENOBUFS=10055\n\nENODATA=120\n\nENODEV=19\n\nENOENT=2\n\nENOEXEC=8\n\nENOLCK=39\n\nENOLINK=121\n\nENOMEM=12\n\nENOMSG=122\n\nENOPROTOOPT=10042\n\nENOSPC=28\n\nENOSR=124\n\nENOSTR=125\n\nENOSYS=40\n\nENOTCONN=10057\n\nENOTDIR=20\n\nENOTEMPTY=41\n\nENOTRECOVERABLE=127\n\nENOTSOCK=10038\n\nENOTSUP=129\n\nENOTTY=25\n\nENXIO=6\n\nEOPNOTSUPP=10045\n\nEOVERFLOW=132\n\nEOWNERDEAD=133\n\nEPERM=1\n\nEPFNOSUPPORT=10046\n\nEPIPE=32\n\nEPROTO=134\n\nEPROTONOSUPPORT=10043\n\nEPROTOTYPE=10041\n\nERANGE=34\n\nEREMOTE=10071\n\nEROFS=30\n\nESHUTDOWN=10058\n\nESOCKTNOSUPPORT=10044\n\nESPIPE=29\n\nESRCH=3\n\nESTALE=10070\n\nETIME=137\n\nETIMEDOUT=10060\n\nETOOMANYREFS=10059\n\nETXTBSY=139\n\nEUSERS=10068\n\nEWOULDBLOCK=10035\n\nEXDEV=18\n\nWSABASEERR=10000\n\nWSAEACCES=10013\n\nWSAEADDRINUSE=10048\n\nWSAEADDRNOTAVAIL=10049\n\nWSAEAFNOSUPPORT=10047\n\nWSAEALREADY=10037\n\nWSAEBADF=10009\n\nWSAECONNABORTED=10053\n\nWSAECONNREFUSED=10061\n\nWSAECONNRESET=10054\n\nWSAEDESTADDRREQ=10039\n\nWSAEDISCON=10101\n\nWSAEDQUOT=10069\n\nWSAEFAULT=10014\n\nWSAEHOSTDOWN=10064\n\nWSAEHOSTUNREACH=10065\n\nWSAEINPROGRESS=10036\n\nWSAEINTR=10004\n\nWSAEINVAL=10022\n\nWSAEISCONN=10056\n\nWSAELOOP=10062\n\nWSAEMFILE=10024\n\nWSAEMSGSIZE=10040\n\nWSAENAMETOOLONG=10063\n\nWSAENETDOWN=10050\n\nWSAENETRESET=10052\n\nWSAENETUNREACH=10051\n\nWSAENOBUFS=10055\n\nWSAENOPROTOOPT=10042\n\nWSAENOTCONN=10057\n\nWSAENOTEMPTY=10066\n\nWSAENOTSOCK=10038\n\nWSAEOPNOTSUPP=10045\n\nWSAEPFNOSUPPORT=10046\n\nWSAEPROCLIM=10067\n\nWSAEPROTONOSUPPORT=10043\n\nWSAEPROTOTYPE=10041\n\nWSAEREMOTE=10071\n\nWSAESHUTDOWN=10058\n\nWSAESOCKTNOSUPPORT=10044\n\nWSAESTALE=10070\n\nWSAETIMEDOUT=10060\n\nWSAETOOMANYREFS=10059\n\nWSAEUSERS=10068\n\nWSAEWOULDBLOCK=10035\n\nWSANOTINITIALISED=10093\n\nWSASYSNOTREADY=10091\n\nWSAVERNOTSUPPORTED=10092\n\nerrorcode={v:k for (k,v)in globals().items()if k ==k.upper()}\n", []], "external_import": [".py", "import os\nimport sys\nfrom browser import doc\nimport urllib.request\n\n\n\n\n\nclass ModuleFinder:\n def __init__(self,path_entry):\n print(\"external_import here..\")\n \n self._module=None\n if path_entry.startswith('http://'):\n self.path_entry=path_entry\n else :\n raise ImportError()\n \n def __str__(self):\n return '<%s for \"%s\">'%(self.__class__.__name__,self.path_entry)\n \n def find_module(self,fullname,path=None ):\n path=path or self.path_entry\n \n for _ext in ['js','pyj','py']:\n _fp,_url,_headers=urllib.request.urlopen(path+'/'+'%s.%s'%(fullname,_ext))\n self._module=_fp.read()\n _fp.close()\n if self._module is not None :\n print(\"module found at %s:%s\"%(path,fullname))\n return ModuleLoader(path,fullname,self._module)\n \n print('module %s not found'%fullname)\n raise ImportError()\n return None\n \nclass ModuleLoader:\n ''\n \n def __init__(self,filepath,name,module_source):\n self._filepath=filepath\n self._name=name\n self._module_source=module_source\n \n def get_source(self):\n return self._module_source\n \n def is_package(self):\n return '.'in self._name\n \n def load_module(self):\n if self._name in sys.modules:\n \n mod=sys.modules[self._name]\n return mod\n \n _src=self.get_source()\n if self._filepath.endswith('.js'):\n mod=JSObject(import_js_module(_src,self._filepath,self._name))\n elif self._filepath.endswith('.py'):\n mod=JSObject(import_py_module(_src,self._filepath,self._name))\n elif self._filepath.endswith('.pyj'):\n mod=JSObject(import_pyj_module(_src,self._filepath,self._name))\n else :\n raise ImportError('Invalid Module: %s'%self._filepath)\n \n \n mod.__file__=self._filepath\n mod.__name__=self._name\n mod.__path__=os.path.abspath(self._filepath)\n mod.__loader__=self\n mod.__package__='.'.join(self._name.split('.')[:-1])\n \n if self.is_package():\n print('adding path for package')\n \n \n mod.__path__=[self._filepath]\n else :\n print('imported as regular module')\n \n print('creating a new module object for \"%s\"'%self._name)\n sys.modules.setdefault(self._name,mod)\n JSObject(__BRYTHON__.imported)[self._name]=mod\n \n return mod\n", ["browser", "os", "sys", "urllib.request"]], "faulthandler": [".py", "''\n\n\n_EXCEPTION_ACCESS_VIOLATION=-1073741819\n\n_EXCEPTION_INT_DIVIDE_BY_ZERO=-1073741676\n\n_EXCEPTION_NONCONTINUABLE=1\n\n_EXCEPTION_NONCONTINUABLE_EXCEPTION=-1073741787\n\n_EXCEPTION_STACK_OVERFLOW=-1073741571\n\nclass __loader__(object):\n ''\n\n\n\n\n \n \n \n __delattr__=\"\"\n \n __dict__=\"{'__module__': '_frozen_importlib', '__doc__': 'Meta path import for built-in modules.\\n\\n All methods are either class or static methods to avoid the need to\\n instantiate the class.\\n\\n ', 'module_repr': , 'find_spec': , 'find_module': , 'create_module': , 'exec_module': , 'get_code': , 'get_source': , 'is_package': , 'load_module': , '__dict__': , '__weakref__': }\"\n \n __dir__=\"\"\n \n __eq__=\"\"\n \n __format__=\"\"\n \n __ge__=\"\"\n \n __getattribute__=\"\"\n \n __gt__=\"\"\n \n __hash__=\"\"\n \n __init__=\"\"\n \n def __init_subclass__(*args,**kw):\n ''\n\n\n \n pass\n \n __le__=\"\"\n \n __lt__=\"\"\n \n __module__=\"\"\"_frozen_importlib\"\"\"\n \n __ne__=\"\"\n \n def __new__(*args,**kw):\n ''\n pass\n \n __reduce__=\"\"\n \n __reduce_ex__=\"\"\n \n __repr__=\"\"\n \n __setattr__=\"\"\n \n __sizeof__=\"\"\n \n __str__=\"\"\n \n def __subclasshook__(*args,**kw):\n ''\n\n\n\n\n \n pass\n \n __weakref__=\"\"\n \n create_module=\">\"\n \n exec_module=\">\"\n \n find_module=\">\"\n \n find_spec=\">\"\n \n get_code=\">\"\n \n get_source=\">\"\n \n is_package=\">\"\n \n load_module=\">\"\n \n def module_repr(*args,**kw):\n ''\n\n\n \n pass\n__spec__=\"ModuleSpec(name='faulthandler', loader=, origin='built-in')\"\n\ndef _fatal_error(*args,**kw):\n ''\n pass\n \ndef _fatal_error_c_thread(*args,**kw):\n ''\n pass\n \ndef _raise_exception(*args,**kw):\n ''\n pass\n \ndef _read_null(*args,**kw):\n ''\n pass\n \ndef _sigabrt(*args,**kw):\n ''\n pass\n \ndef _sigfpe(*args,**kw):\n ''\n pass\n \ndef _sigsegv(*args,**kw):\n ''\n pass\n \ndef cancel_dump_traceback_later(*args,**kw):\n ''\n pass\n \ndef disable(*args,**kw):\n ''\n pass\n \ndef dump_traceback(*args,**kw):\n ''\n pass\n \ndef dump_traceback_later(*args,**kw):\n ''\n \n pass\n \ndef enable(*args,**kw):\n ''\n pass\n \ndef is_enabled(*args,**kw):\n ''\n pass\n", []], "fnmatch": [".py", "''\n\n\n\n\n\n\n\n\n\n\nimport os\nimport posixpath\nimport re\nimport functools\n\n__all__=[\"filter\",\"fnmatch\",\"fnmatchcase\",\"translate\"]\n\ndef fnmatch(name,pat):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n name=os.path.normcase(name)\n pat=os.path.normcase(pat)\n return fnmatchcase(name,pat)\n \n@functools.lru_cache(maxsize=32768,typed=True )\ndef _compile_pattern(pat):\n if isinstance(pat,bytes):\n pat_str=str(pat,'ISO-8859-1')\n res_str=translate(pat_str)\n res=bytes(res_str,'ISO-8859-1')\n else :\n res=translate(pat)\n return re.compile(res).match\n \ndef filter(names,pat):\n ''\n result=[]\n pat=os.path.normcase(pat)\n match=_compile_pattern(pat)\n if os.path is posixpath:\n \n for name in names:\n if match(name):\n result.append(name)\n else :\n for name in names:\n if match(os.path.normcase(name)):\n result.append(name)\n return result\n \ndef fnmatchcase(name,pat):\n ''\n\n\n\n \n match=_compile_pattern(pat)\n return match(name)is not None\n \n \ndef translate(pat):\n ''\n\n\n \n \n STAR=object()\n res=[]\n add=res.append\n i,n=0,len(pat)\n while i =n:\n add('\\\\[')\n else :\n stuff=pat[i:j]\n if '-'not in stuff:\n stuff=stuff.replace('\\\\',r'\\\\')\n else :\n chunks=[]\n k=i+2 if pat[i]=='!'else i+1\n while True :\n k=pat.find('-',k,j)\n if k <0:\n break\n chunks.append(pat[i:k])\n i=k+1\n k=k+3\n chunk=pat[i:j]\n if chunk:\n chunks.append(chunk)\n else :\n chunks[-1]+='-'\n \n for k in range(len(chunks)-1,0,-1):\n if chunks[k -1][-1]>chunks[k][0]:\n chunks[k -1]=chunks[k -1][:-1]+chunks[k][1:]\n del chunks[k]\n \n \n stuff='-'.join(s.replace('\\\\',r'\\\\').replace('-',r'\\-')\n for s in chunks)\n \n stuff=re.sub(r'([&~|])',r'\\\\\\1',stuff)\n i=j+1\n if not stuff:\n \n add('(?!)')\n elif stuff =='!':\n \n add('.')\n else :\n if stuff[0]=='!':\n stuff='^'+stuff[1:]\n elif stuff[0]in ('^','['):\n stuff='\\\\'+stuff\n add(f'[{stuff}]')\n else :\n add(re.escape(c))\n assert i ==n\n \n \n inp=res\n res=[]\n add=res.append\n i,n=0,len(inp)\n \n while i .*?{fixed})\")\n assert i ==n\n res=\"\".join(res)\n return fr'(?s:{res})\\Z'\n", ["functools", "os", "posixpath", "re"]], "formatter": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport sys\nimport warnings\nwarnings.warn('the formatter module is deprecated',DeprecationWarning,\nstacklevel=2)\n\n\nAS_IS=None\n\n\nclass NullFormatter:\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,writer=None ):\n if writer is None :\n writer=NullWriter()\n self.writer=writer\n def end_paragraph(self,blankline):pass\n def add_line_break(self):pass\n def add_hor_rule(self,*args,**kw):pass\n def add_label_data(self,format,counter,blankline=None ):pass\n def add_flowing_data(self,data):pass\n def add_literal_data(self,data):pass\n def flush_softspace(self):pass\n def push_alignment(self,align):pass\n def pop_alignment(self):pass\n def push_font(self,x):pass\n def pop_font(self):pass\n def push_margin(self,margin):pass\n def pop_margin(self):pass\n def set_spacing(self,spacing):pass\n def push_style(self,*styles):pass\n def pop_style(self,n=1):pass\n def assert_line_data(self,flag=1):pass\n \n \nclass AbstractFormatter:\n ''\n\n\n\n\n\n \n \n \n \n \n \n \n def __init__(self,writer):\n self.writer=writer\n self.align=None\n self.align_stack=[]\n self.font_stack=[]\n self.margin_stack=[]\n self.spacing=None\n self.style_stack=[]\n self.nospace=1\n self.softspace=0\n self.para_end=1\n self.parskip=0\n self.hard_break=1\n self.have_label=0\n \n def end_paragraph(self,blankline):\n if not self.hard_break:\n self.writer.send_line_break()\n self.have_label=0\n if self.parskip 0:\n label=label+self.format_letter(c,counter)\n elif c in 'iI':\n if counter >0:\n label=label+self.format_roman(c,counter)\n else :\n label=label+c\n return label\n \n def format_letter(self,case,counter):\n label=''\n while counter >0:\n counter,x=divmod(counter -1,26)\n \n \n \n s=chr(ord(case)+x)\n label=s+label\n return label\n \n def format_roman(self,case,counter):\n ones=['i','x','c','m']\n fives=['v','l','d']\n label,index='',0\n \n while counter >0:\n counter,x=divmod(counter,10)\n if x ==9:\n label=ones[index]+ones[index+1]+label\n elif x ==4:\n label=ones[index]+fives[index]+label\n else :\n if x >=5:\n s=fives[index]\n x=x -5\n else :\n s=''\n s=s+ones[index]*x\n label=s+label\n index=index+1\n if case =='I':\n return label.upper()\n return label\n \n def add_flowing_data(self,data):\n if not data:return\n prespace=data[:1].isspace()\n postspace=data[-1:].isspace()\n data=\" \".join(data.split())\n if self.nospace and not data:\n return\n elif prespace or self.softspace:\n if not data:\n if not self.nospace:\n self.softspace=1\n self.parskip=0\n return\n if not self.nospace:\n data=' '+data\n self.hard_break=self.nospace=self.para_end=\\\n self.parskip=self.have_label=0\n self.softspace=postspace\n self.writer.send_flowing_data(data)\n \n def add_literal_data(self,data):\n if not data:return\n if self.softspace:\n self.writer.send_flowing_data(\" \")\n self.hard_break=data[-1:]=='\\n'\n self.nospace=self.para_end=self.softspace=\\\n self.parskip=self.have_label=0\n self.writer.send_literal_data(data)\n \n def flush_softspace(self):\n if self.softspace:\n self.hard_break=self.para_end=self.parskip=\\\n self.have_label=self.softspace=0\n self.nospace=1\n self.writer.send_flowing_data(' ')\n \n def push_alignment(self,align):\n if align and align !=self.align:\n self.writer.new_alignment(align)\n self.align=align\n self.align_stack.append(align)\n else :\n self.align_stack.append(self.align)\n \n def pop_alignment(self):\n if self.align_stack:\n del self.align_stack[-1]\n if self.align_stack:\n self.align=align=self.align_stack[-1]\n self.writer.new_alignment(align)\n else :\n self.align=None\n self.writer.new_alignment(None )\n \n def push_font(self,font):\n size,i,b,tt=font\n if self.softspace:\n self.hard_break=self.para_end=self.softspace=0\n self.nospace=1\n self.writer.send_flowing_data(' ')\n if self.font_stack:\n csize,ci,cb,ctt=self.font_stack[-1]\n if size is AS_IS:size=csize\n if i is AS_IS:i=ci\n if b is AS_IS:b=cb\n if tt is AS_IS:tt=ctt\n font=(size,i,b,tt)\n self.font_stack.append(font)\n self.writer.new_font(font)\n \n def pop_font(self):\n if self.font_stack:\n del self.font_stack[-1]\n if self.font_stack:\n font=self.font_stack[-1]\n else :\n font=None\n self.writer.new_font(font)\n \n def push_margin(self,margin):\n self.margin_stack.append(margin)\n fstack=[m for m in self.margin_stack if m]\n if not margin and fstack:\n margin=fstack[-1]\n self.writer.new_margin(margin,len(fstack))\n \n def pop_margin(self):\n if self.margin_stack:\n del self.margin_stack[-1]\n fstack=[m for m in self.margin_stack if m]\n if fstack:\n margin=fstack[-1]\n else :\n margin=None\n self.writer.new_margin(margin,len(fstack))\n \n def set_spacing(self,spacing):\n self.spacing=spacing\n self.writer.new_spacing(spacing)\n \n def push_style(self,*styles):\n if self.softspace:\n self.hard_break=self.para_end=self.softspace=0\n self.nospace=1\n self.writer.send_flowing_data(' ')\n for style in styles:\n self.style_stack.append(style)\n self.writer.new_styles(tuple(self.style_stack))\n \n def pop_style(self,n=1):\n del self.style_stack[-n:]\n self.writer.new_styles(tuple(self.style_stack))\n \n def assert_line_data(self,flag=1):\n self.nospace=self.hard_break=not flag\n self.para_end=self.parskip=self.have_label=0\n \n \nclass NullWriter:\n ''\n\n\n\n\n\n \n def __init__(self):pass\n def flush(self):pass\n def new_alignment(self,align):pass\n def new_font(self,font):pass\n def new_margin(self,margin,level):pass\n def new_spacing(self,spacing):pass\n def new_styles(self,styles):pass\n def send_paragraph(self,blankline):pass\n def send_line_break(self):pass\n def send_hor_rule(self,*args,**kw):pass\n def send_label_data(self,data):pass\n def send_flowing_data(self,data):pass\n def send_literal_data(self,data):pass\n \n \nclass AbstractWriter(NullWriter):\n ''\n\n\n\n\n \n \n def new_alignment(self,align):\n print(\"new_alignment(%r)\"%(align,))\n \n def new_font(self,font):\n print(\"new_font(%r)\"%(font,))\n \n def new_margin(self,margin,level):\n print(\"new_margin(%r, %d)\"%(margin,level))\n \n def new_spacing(self,spacing):\n print(\"new_spacing(%r)\"%(spacing,))\n \n def new_styles(self,styles):\n print(\"new_styles(%r)\"%(styles,))\n \n def send_paragraph(self,blankline):\n print(\"send_paragraph(%r)\"%(blankline,))\n \n def send_line_break(self):\n print(\"send_line_break()\")\n \n def send_hor_rule(self,*args,**kw):\n print(\"send_hor_rule()\")\n \n def send_label_data(self,data):\n print(\"send_label_data(%r)\"%(data,))\n \n def send_flowing_data(self,data):\n print(\"send_flowing_data(%r)\"%(data,))\n \n def send_literal_data(self,data):\n print(\"send_literal_data(%r)\"%(data,))\n \n \nclass DumbWriter(NullWriter):\n ''\n\n\n\n\n\n \n \n def __init__(self,file=None ,maxcol=72):\n self.file=file or sys.stdout\n self.maxcol=maxcol\n NullWriter.__init__(self)\n self.reset()\n \n def reset(self):\n self.col=0\n self.atbreak=0\n \n def send_paragraph(self,blankline):\n self.file.write('\\n'*blankline)\n self.col=0\n self.atbreak=0\n \n def send_line_break(self):\n self.file.write('\\n')\n self.col=0\n self.atbreak=0\n \n def send_hor_rule(self,*args,**kw):\n self.file.write('\\n')\n self.file.write('-'*self.maxcol)\n self.file.write('\\n')\n self.col=0\n self.atbreak=0\n \n def send_literal_data(self,data):\n self.file.write(data)\n i=data.rfind('\\n')\n if i >=0:\n self.col=0\n data=data[i+1:]\n data=data.expandtabs()\n self.col=self.col+len(data)\n self.atbreak=0\n \n def send_flowing_data(self,data):\n if not data:return\n atbreak=self.atbreak or data[0].isspace()\n col=self.col\n maxcol=self.maxcol\n write=self.file.write\n for word in data.split():\n if atbreak:\n if col+len(word)>=maxcol:\n write('\\n')\n col=0\n else :\n write(' ')\n col=col+1\n write(word)\n col=col+len(word)\n atbreak=1\n self.col=col\n self.atbreak=data[-1].isspace()\n \n \ndef test(file=None ):\n w=DumbWriter()\n f=AbstractFormatter(w)\n if file is not None :\n fp=open(file)\n elif sys.argv[1:]:\n fp=open(sys.argv[1])\n else :\n fp=sys.stdin\n try :\n for line in fp:\n if line =='\\n':\n f.end_paragraph(1)\n else :\n f.add_flowing_data(line)\n finally :\n if fp is not sys.stdin:\n fp.close()\n f.end_paragraph(0)\n \n \nif __name__ =='__main__':\n test()\n", ["sys", "warnings"]], "fractions": [".py", "\n\n\n\"\"\"Fraction, infinite-precision, rational numbers.\"\"\"\n\nfrom decimal import Decimal\nimport functools\nimport math\nimport numbers\nimport operator\nimport re\nimport sys\n\n__all__=['Fraction']\n\n\n\n\n_PyHASH_MODULUS=sys.hash_info.modulus\n\n\n_PyHASH_INF=sys.hash_info.inf\n\n@functools.lru_cache(maxsize=1 <<14)\ndef _hash_algorithm(numerator,denominator):\n\n\n\n\n\n\n try:\n dinv=pow(denominator,-1,_PyHASH_MODULUS)\n except ValueError:\n \n hash_=_PyHASH_INF\n else:\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n hash_=hash(hash(abs(numerator))*dinv)\n result=hash_ if numerator >=0 else -hash_\n return -2 if result ==-1 else result\n \n_RATIONAL_FORMAT=re.compile(r\"\"\"\n \\A\\s* # optional whitespace at the start,\n (?P[-+]?) # an optional sign, then\n (?=\\d|\\.\\d) # lookahead for digit or .digit\n (?P\\d*|\\d+(_\\d+)*) # numerator (possibly empty)\n (?: # followed by\n (?:\\s*/\\s*(?P\\d+(_\\d+)*))? # an optional denominator\n | # or\n (?:\\.(?Pd*|\\d+(_\\d+)*))? # an optional fractional part\n (?:E(?P[-+]?\\d+(_\\d+)*))? # and optional exponent\n )\n \\s*\\Z # and optional whitespace to finish\n\"\"\",re.VERBOSE |re.IGNORECASE)\n\n\n\n\ndef _round_to_exponent(n,d,exponent,no_neg_zero=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if exponent >=0:\n d *=10 **exponent\n else:\n n *=10 **-exponent\n \n \n \n q,r=divmod(n+(d >>1),d)\n if r ==0 and d&1 ==0:\n q &=-2\n \n sign=q <0 if no_neg_zero else n <0\n return sign,abs(q)\n \n \ndef _round_to_figures(n,d,figures):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if n ==0:\n return False,0,1 -figures\n \n \n \n str_n,str_d=str(abs(n)),str(d)\n m=len(str_n)-len(str_d)+(str_d <=str_n)\n \n \n \n exponent=m -figures\n sign,significand=_round_to_exponent(n,d,exponent)\n \n \n \n if len(str(significand))==figures+1:\n significand //=10\n exponent +=1\n \n return sign,significand,exponent\n \n \n \n \n_FLOAT_FORMAT_SPECIFICATION_MATCHER=re.compile(r\"\"\"\n (?:\n (?P.)?\n (?P[<>=^])\n )?\n (?P[-+ ]?)\n (?Pz)?\n (?P\\#)?\n # A '0' that's *not* followed by another digit is parsed as a minimum width\n # rather than a zeropad flag.\n (?P0(?=[0-9]))?\n (?P0|[1-9][0-9]*)?\n (?P[,_])?\n (?:\\.(?P0|[1-9][0-9]*))?\n (?P[eEfFgG%])\n\"\"\",re.DOTALL |re.VERBOSE).fullmatch\n\n\nclass Fraction(numbers.Rational):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('_numerator','_denominator')\n \n \n def __new__(cls,numerator=0,denominator=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self=super(Fraction,cls).__new__(cls)\n \n if denominator is None:\n if type(numerator)is int:\n self._numerator=numerator\n self._denominator=1\n return self\n \n elif isinstance(numerator,numbers.Rational):\n self._numerator=numerator.numerator\n self._denominator=numerator.denominator\n return self\n \n elif isinstance(numerator,(float,Decimal)):\n \n self._numerator,self._denominator=numerator.as_integer_ratio()\n return self\n \n elif isinstance(numerator,str):\n \n m=_RATIONAL_FORMAT.match(numerator)\n if m is None:\n raise ValueError('Invalid literal for Fraction: %r'%\n numerator)\n numerator=int(m.group('num')or '0')\n denom=m.group('denom')\n if denom:\n denominator=int(denom)\n else:\n denominator=1\n decimal=m.group('decimal')\n if decimal:\n decimal=decimal.replace('_','')\n scale=10 **len(decimal)\n numerator=numerator *scale+int(decimal)\n denominator *=scale\n exp=m.group('exp')\n if exp:\n exp=int(exp)\n if exp >=0:\n numerator *=10 **exp\n else:\n denominator *=10 **-exp\n if m.group('sign')=='-':\n numerator=-numerator\n \n else:\n raise TypeError(\"argument should be a string \"\n \"or a Rational instance\")\n \n elif type(numerator)is int is type(denominator):\n pass\n \n elif(isinstance(numerator,numbers.Rational)and\n isinstance(denominator,numbers.Rational)):\n numerator,denominator=(\n numerator.numerator *denominator.denominator,\n denominator.numerator *numerator.denominator\n )\n else:\n raise TypeError(\"both arguments should be \"\n \"Rational instances\")\n \n if denominator ==0:\n raise ZeroDivisionError('Fraction(%s, 0)'%numerator)\n g=math.gcd(numerator,denominator)\n if denominator <0:\n g=-g\n numerator //=g\n denominator //=g\n self._numerator=numerator\n self._denominator=denominator\n return self\n \n @classmethod\n def from_float(cls,f):\n ''\n\n\n\n \n if isinstance(f,numbers.Integral):\n return cls(f)\n elif not isinstance(f,float):\n raise TypeError(\"%s.from_float() only takes floats, not %r (%s)\"%\n (cls.__name__,f,type(f).__name__))\n return cls._from_coprime_ints(*f.as_integer_ratio())\n \n @classmethod\n def from_decimal(cls,dec):\n ''\n from decimal import Decimal\n if isinstance(dec,numbers.Integral):\n dec=Decimal(int(dec))\n elif not isinstance(dec,Decimal):\n raise TypeError(\n \"%s.from_decimal() only takes Decimals, not %r (%s)\"%\n (cls.__name__,dec,type(dec).__name__))\n return cls._from_coprime_ints(*dec.as_integer_ratio())\n \n @classmethod\n def _from_coprime_ints(cls,numerator,denominator,/):\n ''\n\n\n\n \n obj=super(Fraction,cls).__new__(cls)\n obj._numerator=numerator\n obj._denominator=denominator\n return obj\n \n def is_integer(self):\n ''\n return self._denominator ==1\n \n def as_integer_ratio(self):\n ''\n\n\n \n return(self._numerator,self._denominator)\n \n def limit_denominator(self,max_denominator=1000000):\n ''\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if max_denominator <1:\n raise ValueError(\"max_denominator should be at least 1\")\n if self._denominator <=max_denominator:\n return Fraction(self)\n \n p0,q0,p1,q1=0,1,1,0\n n,d=self._numerator,self._denominator\n while True:\n a=n //d\n q2=q0+a *q1\n if q2 >max_denominator:\n break\n p0,q0,p1,q1=p1,q1,p0+a *p1,q2\n n,d=d,n -a *d\n k=(max_denominator -q0)//q1\n \n \n \n \n \n if 2 *d *(q0+k *q1)<=self._denominator:\n return Fraction._from_coprime_ints(p1,q1)\n else:\n return Fraction._from_coprime_ints(p0+k *p1,q0+k *q1)\n \n @property\n def numerator(a):\n return a._numerator\n \n @property\n def denominator(a):\n return a._denominator\n \n def __repr__(self):\n ''\n return '%s(%s, %s)'%(self.__class__.__name__,\n self._numerator,self._denominator)\n \n def __str__(self):\n ''\n if self._denominator ==1:\n return str(self._numerator)\n else:\n return '%s/%s'%(self._numerator,self._denominator)\n \n def __format__(self,format_spec,/):\n ''\n \n \n if not format_spec:\n return str(self)\n \n \n match=_FLOAT_FORMAT_SPECIFICATION_MATCHER(format_spec)\n if match is None:\n raise ValueError(\n f\"Invalid format specifier {format_spec !r} \"\n f\"for object of type {type(self).__name__ !r}\"\n )\n elif match[\"align\"]is not None and match[\"zeropad\"]is not None:\n \n raise ValueError(\n f\"Invalid format specifier {format_spec !r} \"\n f\"for object of type {type(self).__name__ !r}; \"\n \"can't use explicit alignment when zero-padding\"\n )\n fill=match[\"fill\"]or \" \"\n align=match[\"align\"]or \">\"\n pos_sign=\"\"if match[\"sign\"]==\"-\"else match[\"sign\"]\n no_neg_zero=bool(match[\"no_neg_zero\"])\n alternate_form=bool(match[\"alt\"])\n zeropad=bool(match[\"zeropad\"])\n minimumwidth=int(match[\"minimumwidth\"]or \"0\")\n thousands_sep=match[\"thousands_sep\"]\n precision=int(match[\"precision\"]or \"6\")\n presentation_type=match[\"presentation_type\"]\n trim_zeros=presentation_type in \"gG\"and not alternate_form\n trim_point=not alternate_form\n exponent_indicator=\"E\"if presentation_type in \"EFG\"else \"e\"\n \n \n \n \n \n if presentation_type in \"fF%\":\n exponent=-precision\n if presentation_type ==\"%\":\n exponent -=2\n negative,significand=_round_to_exponent(\n self._numerator,self._denominator,exponent,no_neg_zero)\n scientific=False\n point_pos=precision\n else:\n figures=(\n max(precision,1)\n if presentation_type in \"gG\"\n else precision+1\n )\n negative,significand,exponent=_round_to_figures(\n self._numerator,self._denominator,figures)\n scientific=(\n presentation_type in \"eE\"\n or exponent >0\n or exponent+figures <=-4\n )\n point_pos=figures -1 if scientific else -exponent\n \n \n if presentation_type ==\"%\":\n suffix=\"%\"\n elif scientific:\n suffix=f\"{exponent_indicator}{exponent+point_pos:+03d}\"\n else:\n suffix=\"\"\n \n \n \n digits=f\"{significand:0{point_pos+1}d}\"\n \n \n \n \n sign=\"-\"if negative else pos_sign\n leading=digits[:len(digits)-point_pos]\n frac_part=digits[len(digits)-point_pos:]\n if trim_zeros:\n frac_part=frac_part.rstrip(\"0\")\n separator=\"\"if trim_point and not frac_part else \".\"\n trailing=separator+frac_part+suffix\n \n \n if zeropad:\n min_leading=minimumwidth -len(sign)-len(trailing)\n \n \n leading=leading.zfill(\n 3 *min_leading //4+1 if thousands_sep else min_leading\n )\n \n \n if thousands_sep:\n first_pos=1+(len(leading)-1)%3\n leading=leading[:first_pos]+\"\".join(\n thousands_sep+leading[pos:pos+3]\n for pos in range(first_pos,len(leading),3)\n )\n \n \n \n body=leading+trailing\n padding=fill *(minimumwidth -len(sign)-len(body))\n if align ==\">\":\n return padding+sign+body\n elif align ==\"<\":\n return sign+body+padding\n elif align ==\"^\":\n half=len(padding)//2\n return padding[:half]+sign+body+padding[half:]\n else:\n return sign+padding+body\n \n def _operator_fallbacks(monomorphic_operator,fallback_operator):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def forward(a,b):\n if isinstance(b,Fraction):\n return monomorphic_operator(a,b)\n elif isinstance(b,int):\n return monomorphic_operator(a,Fraction(b))\n elif isinstance(b,float):\n return fallback_operator(float(a),b)\n elif isinstance(b,complex):\n return fallback_operator(complex(a),b)\n else:\n return NotImplemented\n forward.__name__='__'+fallback_operator.__name__+'__'\n forward.__doc__=monomorphic_operator.__doc__\n \n def reverse(b,a):\n if isinstance(a,numbers.Rational):\n \n return monomorphic_operator(Fraction(a),b)\n elif isinstance(a,numbers.Real):\n return fallback_operator(float(a),float(b))\n elif isinstance(a,numbers.Complex):\n return fallback_operator(complex(a),complex(b))\n else:\n return NotImplemented\n reverse.__name__='__r'+fallback_operator.__name__+'__'\n reverse.__doc__=monomorphic_operator.__doc__\n \n return forward,reverse\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def _add(a,b):\n ''\n na,da=a._numerator,a._denominator\n nb,db=b._numerator,b._denominator\n g=math.gcd(da,db)\n if g ==1:\n return Fraction._from_coprime_ints(na *db+da *nb,da *db)\n s=da //g\n t=na *(db //g)+nb *s\n g2=math.gcd(t,g)\n if g2 ==1:\n return Fraction._from_coprime_ints(t,s *db)\n return Fraction._from_coprime_ints(t //g2,s *(db //g2))\n \n __add__,__radd__=_operator_fallbacks(_add,operator.add)\n \n def _sub(a,b):\n ''\n na,da=a._numerator,a._denominator\n nb,db=b._numerator,b._denominator\n g=math.gcd(da,db)\n if g ==1:\n return Fraction._from_coprime_ints(na *db -da *nb,da *db)\n s=da //g\n t=na *(db //g)-nb *s\n g2=math.gcd(t,g)\n if g2 ==1:\n return Fraction._from_coprime_ints(t,s *db)\n return Fraction._from_coprime_ints(t //g2,s *(db //g2))\n \n __sub__,__rsub__=_operator_fallbacks(_sub,operator.sub)\n \n def _mul(a,b):\n ''\n na,da=a._numerator,a._denominator\n nb,db=b._numerator,b._denominator\n g1=math.gcd(na,db)\n if g1 >1:\n na //=g1\n db //=g1\n g2=math.gcd(nb,da)\n if g2 >1:\n nb //=g2\n da //=g2\n return Fraction._from_coprime_ints(na *nb,db *da)\n \n __mul__,__rmul__=_operator_fallbacks(_mul,operator.mul)\n \n def _div(a,b):\n ''\n \n nb,db=b._numerator,b._denominator\n if nb ==0:\n raise ZeroDivisionError('Fraction(%s, 0)'%db)\n na,da=a._numerator,a._denominator\n g1=math.gcd(na,nb)\n if g1 >1:\n na //=g1\n nb //=g1\n g2=math.gcd(db,da)\n if g2 >1:\n da //=g2\n db //=g2\n n,d=na *db,nb *da\n if d <0:\n n,d=-n,-d\n return Fraction._from_coprime_ints(n,d)\n \n __truediv__,__rtruediv__=_operator_fallbacks(_div,operator.truediv)\n \n def _floordiv(a,b):\n ''\n return(a.numerator *b.denominator)//(a.denominator *b.numerator)\n \n __floordiv__,__rfloordiv__=_operator_fallbacks(_floordiv,operator.floordiv)\n \n def _divmod(a,b):\n ''\n da,db=a.denominator,b.denominator\n div,n_mod=divmod(a.numerator *db,da *b.numerator)\n return div,Fraction(n_mod,da *db)\n \n __divmod__,__rdivmod__=_operator_fallbacks(_divmod,divmod)\n \n def _mod(a,b):\n ''\n da,db=a.denominator,b.denominator\n return Fraction((a.numerator *db)%(b.numerator *da),da *db)\n \n __mod__,__rmod__=_operator_fallbacks(_mod,operator.mod)\n \n def __pow__(a,b):\n ''\n\n\n\n\n\n \n if isinstance(b,numbers.Rational):\n if b.denominator ==1:\n power=b.numerator\n if power >=0:\n return Fraction._from_coprime_ints(a._numerator **power,\n a._denominator **power)\n elif a._numerator >0:\n return Fraction._from_coprime_ints(a._denominator **-power,\n a._numerator **-power)\n elif a._numerator ==0:\n raise ZeroDivisionError('Fraction(%s, 0)'%\n a._denominator **-power)\n else:\n return Fraction._from_coprime_ints((-a._denominator)**-power,\n (-a._numerator)**-power)\n else:\n \n \n return float(a)**float(b)\n else:\n return float(a)**b\n \n def __rpow__(b,a):\n ''\n if b._denominator ==1 and b._numerator >=0:\n \n return a **b._numerator\n \n if isinstance(a,numbers.Rational):\n return Fraction(a.numerator,a.denominator)**b\n \n if b._denominator ==1:\n return a **b._numerator\n \n return a **float(b)\n \n def __pos__(a):\n ''\n return Fraction._from_coprime_ints(a._numerator,a._denominator)\n \n def __neg__(a):\n ''\n return Fraction._from_coprime_ints(-a._numerator,a._denominator)\n \n def __abs__(a):\n ''\n return Fraction._from_coprime_ints(abs(a._numerator),a._denominator)\n \n def __int__(a,_index=operator.index):\n ''\n if a._numerator <0:\n return _index(-(-a._numerator //a._denominator))\n else:\n return _index(a._numerator //a._denominator)\n \n def __trunc__(a):\n ''\n if a._numerator <0:\n return -(-a._numerator //a._denominator)\n else:\n return a._numerator //a._denominator\n \n def __floor__(a):\n ''\n return a._numerator //a._denominator\n \n def __ceil__(a):\n ''\n \n return -(-a._numerator //a._denominator)\n \n def __round__(self,ndigits=None):\n ''\n\n\n \n if ndigits is None:\n d=self._denominator\n floor,remainder=divmod(self._numerator,d)\n if remainder *2 d:\n return floor+1\n \n elif floor %2 ==0:\n return floor\n else:\n return floor+1\n shift=10 **abs(ndigits)\n \n \n \n if ndigits >0:\n return Fraction(round(self *shift),shift)\n else:\n return Fraction(round(self /shift)*shift)\n \n def __hash__(self):\n ''\n return _hash_algorithm(self._numerator,self._denominator)\n \n def __eq__(a,b):\n ''\n if type(b)is int:\n return a._numerator ==b and a._denominator ==1\n if isinstance(b,numbers.Rational):\n return(a._numerator ==b.numerator and\n a._denominator ==b.denominator)\n if isinstance(b,numbers.Complex)and b.imag ==0:\n b=b.real\n if isinstance(b,float):\n if math.isnan(b)or math.isinf(b):\n \n \n return 0.0 ==b\n else:\n return a ==a.from_float(b)\n else:\n \n \n return NotImplemented\n \n def _richcmp(self,other,op):\n ''\n\n\n\n\n\n\n\n \n \n if isinstance(other,numbers.Rational):\n return op(self._numerator *other.denominator,\n self._denominator *other.numerator)\n if isinstance(other,float):\n if math.isnan(other)or math.isinf(other):\n return op(0.0,other)\n else:\n return op(self,self.from_float(other))\n else:\n return NotImplemented\n \n def __lt__(a,b):\n ''\n return a._richcmp(b,operator.lt)\n \n def __gt__(a,b):\n ''\n return a._richcmp(b,operator.gt)\n \n def __le__(a,b):\n ''\n return a._richcmp(b,operator.le)\n \n def __ge__(a,b):\n ''\n return a._richcmp(b,operator.ge)\n \n def __bool__(a):\n ''\n \n \n return bool(a._numerator)\n \n \n \n def __reduce__(self):\n return(self.__class__,(self._numerator,self._denominator))\n \n def __copy__(self):\n if type(self)==Fraction:\n return self\n return self.__class__(self._numerator,self._denominator)\n \n def __deepcopy__(self,memo):\n if type(self)==Fraction:\n return self\n return self.__class__(self._numerator,self._denominator)\n", ["decimal", "functools", "math", "numbers", "operator", "re", "sys"]], "functools": [".py", "''\n\n\n\n\n\n\n\n\n\n\n__all__=['update_wrapper','wraps','WRAPPER_ASSIGNMENTS','WRAPPER_UPDATES',\n'total_ordering','cache','cmp_to_key','lru_cache','reduce',\n'partial','partialmethod','singledispatch','singledispatchmethod',\n'cached_property']\n\nfrom abc import get_cache_token\nfrom collections import namedtuple\n\nfrom reprlib import recursive_repr\nfrom _thread import RLock\nfrom types import GenericAlias\n\n\n\n\n\n\n\n\n\nWRAPPER_ASSIGNMENTS=('__module__','__name__','__qualname__','__doc__',\n'__annotations__','__type_params__')\nWRAPPER_UPDATES=('__dict__',)\ndef update_wrapper(wrapper,\nwrapped,\nassigned=WRAPPER_ASSIGNMENTS,\nupdated=WRAPPER_UPDATES):\n ''\n\n\n\n\n\n\n\n\n\n \n for attr in assigned:\n try:\n value=getattr(wrapped,attr)\n except AttributeError:\n pass\n else:\n setattr(wrapper,attr,value)\n for attr in updated:\n getattr(wrapper,attr).update(getattr(wrapped,attr,{}))\n \n \n wrapper.__wrapped__=wrapped\n \n return wrapper\n \ndef wraps(wrapped,\nassigned=WRAPPER_ASSIGNMENTS,\nupdated=WRAPPER_UPDATES):\n ''\n\n\n\n\n\n\n \n return partial(update_wrapper,wrapped=wrapped,\n assigned=assigned,updated=updated)\n \n \n \n \n \n \n \n \n \n \n \ndef _gt_from_lt(self,other):\n ''\n op_result=type(self).__lt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result and self !=other\n \ndef _le_from_lt(self,other):\n ''\n op_result=type(self).__lt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return op_result or self ==other\n \ndef _ge_from_lt(self,other):\n ''\n op_result=type(self).__lt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result\n \ndef _ge_from_le(self,other):\n ''\n op_result=type(self).__le__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result or self ==other\n \ndef _lt_from_le(self,other):\n ''\n op_result=type(self).__le__(self,other)\n if op_result is NotImplemented:\n return op_result\n return op_result and self !=other\n \ndef _gt_from_le(self,other):\n ''\n op_result=type(self).__le__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result\n \ndef _lt_from_gt(self,other):\n ''\n op_result=type(self).__gt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result and self !=other\n \ndef _ge_from_gt(self,other):\n ''\n op_result=type(self).__gt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return op_result or self ==other\n \ndef _le_from_gt(self,other):\n ''\n op_result=type(self).__gt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result\n \ndef _le_from_ge(self,other):\n ''\n op_result=type(self).__ge__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result or self ==other\n \ndef _gt_from_ge(self,other):\n ''\n op_result=type(self).__ge__(self,other)\n if op_result is NotImplemented:\n return op_result\n return op_result and self !=other\n \ndef _lt_from_ge(self,other):\n ''\n op_result=type(self).__ge__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result\n \n_convert={\n'__lt__':[('__gt__',_gt_from_lt),\n('__le__',_le_from_lt),\n('__ge__',_ge_from_lt)],\n'__le__':[('__ge__',_ge_from_le),\n('__lt__',_lt_from_le),\n('__gt__',_gt_from_le)],\n'__gt__':[('__lt__',_lt_from_gt),\n('__ge__',_ge_from_gt),\n('__le__',_le_from_gt)],\n'__ge__':[('__le__',_le_from_ge),\n('__gt__',_gt_from_ge),\n('__lt__',_lt_from_ge)]\n}\n\ndef total_ordering(cls):\n ''\n \n roots={op for op in _convert if getattr(cls,op,None)is not getattr(object,op,None)}\n if not roots:\n raise ValueError('must define at least one ordering operation: < > <= >=')\n root=max(roots)\n for opname,opfunc in _convert[root]:\n if opname not in roots:\n opfunc.__name__=opname\n setattr(cls,opname,opfunc)\n return cls\n \n \n \n \n \n \ndef cmp_to_key(mycmp):\n ''\n class K(object):\n __slots__=['obj']\n def __init__(self,obj):\n self.obj=obj\n def __lt__(self,other):\n return mycmp(self.obj,other.obj)<0\n def __gt__(self,other):\n return mycmp(self.obj,other.obj)>0\n def __eq__(self,other):\n return mycmp(self.obj,other.obj)==0\n def __le__(self,other):\n return mycmp(self.obj,other.obj)<=0\n def __ge__(self,other):\n return mycmp(self.obj,other.obj)>=0\n __hash__=None\n return K\n \ntry:\n from _functools import cmp_to_key\nexcept ImportError:\n pass\n \n \n \n \n \n \n_initial_missing=object()\n\ndef reduce(function,sequence,initial=_initial_missing):\n ''\n\n\n\n\n\n\n\n\n \n \n it=iter(sequence)\n \n if initial is _initial_missing:\n try:\n value=next(it)\n except StopIteration:\n raise TypeError(\n \"reduce() of empty iterable with no initial value\")from None\n else:\n value=initial\n \n for element in it:\n value=function(value,element)\n \n return value\n \ntry:\n from _functools import reduce\nexcept ImportError:\n pass\n \n \n \n \n \n \n \nclass partial:\n ''\n\n \n \n __slots__=\"func\",\"args\",\"keywords\",\"__dict__\",\"__weakref__\"\n \n def __new__(cls,func,/,*args,**keywords):\n if not callable(func):\n raise TypeError(\"the first argument must be callable\")\n \n if hasattr(func,\"func\"):\n args=func.args+args\n keywords={**func.keywords,**keywords}\n func=func.func\n \n self=super(partial,cls).__new__(cls)\n \n self.func=func\n self.args=args\n self.keywords=keywords\n return self\n \n def __call__(self,/,*args,**keywords):\n keywords={**self.keywords,**keywords}\n return self.func(*self.args,*args,**keywords)\n \n @recursive_repr()\n def __repr__(self):\n qualname=type(self).__qualname__\n args=[repr(self.func)]\n args.extend(repr(x)for x in self.args)\n args.extend(f\"{k}={v !r}\"for(k,v)in self.keywords.items())\n if type(self).__module__ ==\"functools\":\n return f\"functools.{qualname}({', '.join(args)})\"\n return f\"{qualname}({', '.join(args)})\"\n \n def __reduce__(self):\n return type(self),(self.func,),(self.func,self.args,\n self.keywords or None,self.__dict__ or None)\n \n def __setstate__(self,state):\n if not isinstance(state,tuple):\n raise TypeError(\"argument to __setstate__ must be a tuple\")\n if len(state)!=4:\n raise TypeError(f\"expected 4 items in state, got {len(state)}\")\n func,args,kwds,namespace=state\n if(not callable(func)or not isinstance(args,tuple)or\n (kwds is not None and not isinstance(kwds,dict))or\n (namespace is not None and not isinstance(namespace,dict))):\n raise TypeError(\"invalid partial state\")\n \n args=tuple(args)\n if kwds is None:\n kwds={}\n elif type(kwds)is not dict:\n kwds=dict(kwds)\n if namespace is None:\n namespace={}\n \n self.__dict__=namespace\n self.func=func\n self.args=args\n self.keywords=kwds\n \ntry:\n from _functools import partial\nexcept ImportError:\n pass\n \n \nclass partialmethod(object):\n ''\n\n\n\n\n \n \n def __init__(self,func,/,*args,**keywords):\n if not callable(func)and not hasattr(func,\"__get__\"):\n raise TypeError(\"{!r} is not callable or a descriptor\"\n .format(func))\n \n \n \n if isinstance(func,partialmethod):\n \n \n \n self.func=func.func\n self.args=func.args+args\n self.keywords={**func.keywords,**keywords}\n else:\n self.func=func\n self.args=args\n self.keywords=keywords\n \n def __repr__(self):\n args=\", \".join(map(repr,self.args))\n keywords=\", \".join(\"{}={!r}\".format(k,v)\n for k,v in self.keywords.items())\n format_string=\"{module}.{cls}({func}, {args}, {keywords})\"\n return format_string.format(module=self.__class__.__module__,\n cls=self.__class__.__qualname__,\n func=self.func,\n args=args,\n keywords=keywords)\n \n def _make_unbound_method(self):\n def _method(cls_or_self,/,*args,**keywords):\n keywords={**self.keywords,**keywords}\n return self.func(cls_or_self,*self.args,*args,**keywords)\n _method.__isabstractmethod__=self.__isabstractmethod__\n _method._partialmethod=self\n return _method\n \n def __get__(self,obj,cls=None):\n get=getattr(self.func,\"__get__\",None)\n result=None\n if get is not None:\n new_func=get(obj,cls)\n if new_func is not self.func:\n \n \n result=partial(new_func,*self.args,**self.keywords)\n try:\n result.__self__=new_func.__self__\n except AttributeError:\n pass\n if result is None:\n \n \n result=self._make_unbound_method().__get__(obj,cls)\n return result\n \n @property\n def __isabstractmethod__(self):\n return getattr(self.func,\"__isabstractmethod__\",False)\n \n __class_getitem__=classmethod(GenericAlias)\n \n \n \n \ndef _unwrap_partial(func):\n while isinstance(func,partial):\n func=func.func\n return func\n \n \n \n \n \n_CacheInfo=namedtuple(\"CacheInfo\",[\"hits\",\"misses\",\"maxsize\",\"currsize\"])\n\nclass _HashedSeq(list):\n ''\n\n\n\n \n \n __slots__='hashvalue'\n \n def __init__(self,tup,hash=hash):\n self[:]=tup\n self.hashvalue=hash(tup)\n \n def __hash__(self):\n return self.hashvalue\n \ndef _make_key(args,kwds,typed,\nkwd_mark=(object(),),\nfasttypes={int,str},\ntuple=tuple,type=type,len=len):\n ''\n\n\n\n\n\n\n\n\n \n \n \n \n \n key=args\n if kwds:\n key +=kwd_mark\n for item in kwds.items():\n key +=item\n if typed:\n key +=tuple(type(v)for v in args)\n if kwds:\n key +=tuple(type(v)for v in kwds.values())\n elif len(key)==1 and type(key[0])in fasttypes:\n return key[0]\n return _HashedSeq(key)\n \ndef lru_cache(maxsize=128,typed=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n if isinstance(maxsize,int):\n \n if maxsize <0:\n maxsize=0\n elif callable(maxsize)and isinstance(typed,bool):\n \n user_function,maxsize=maxsize,128\n wrapper=_lru_cache_wrapper(user_function,maxsize,typed,_CacheInfo)\n wrapper.cache_parameters=lambda:{'maxsize':maxsize,'typed':typed}\n return update_wrapper(wrapper,user_function)\n elif maxsize is not None:\n raise TypeError(\n 'Expected first argument to be an integer, a callable, or None')\n \n def decorating_function(user_function):\n wrapper=_lru_cache_wrapper(user_function,maxsize,typed,_CacheInfo)\n wrapper.cache_parameters=lambda:{'maxsize':maxsize,'typed':typed}\n return update_wrapper(wrapper,user_function)\n \n return decorating_function\n \ndef _lru_cache_wrapper(user_function,maxsize,typed,_CacheInfo):\n\n sentinel=object()\n make_key=_make_key\n PREV,NEXT,KEY,RESULT=0,1,2,3\n \n cache={}\n hits=misses=0\n full=False\n cache_get=cache.get\n cache_len=cache.__len__\n lock=RLock()\n root=[]\n root[:]=[root,root,None,None]\n \n if maxsize ==0:\n \n def wrapper(*args,**kwds):\n \n nonlocal misses\n misses +=1\n result=user_function(*args,**kwds)\n return result\n \n elif maxsize is None:\n \n def wrapper(*args,**kwds):\n \n nonlocal hits,misses\n key=make_key(args,kwds,typed)\n result=cache_get(key,sentinel)\n if result is not sentinel:\n hits +=1\n return result\n misses +=1\n result=user_function(*args,**kwds)\n cache[key]=result\n return result\n \n else:\n \n def wrapper(*args,**kwds):\n \n nonlocal root,hits,misses,full\n key=make_key(args,kwds,typed)\n with lock:\n link=cache_get(key)\n if link is not None:\n \n link_prev,link_next,_key,result=link\n link_prev[NEXT]=link_next\n link_next[PREV]=link_prev\n last=root[PREV]\n last[NEXT]=root[PREV]=link\n link[PREV]=last\n link[NEXT]=root\n hits +=1\n return result\n misses +=1\n result=user_function(*args,**kwds)\n with lock:\n if key in cache:\n \n \n \n \n pass\n elif full:\n \n oldroot=root\n oldroot[KEY]=key\n oldroot[RESULT]=result\n \n \n \n \n \n \n root=oldroot[NEXT]\n oldkey=root[KEY]\n oldresult=root[RESULT]\n root[KEY]=root[RESULT]=None\n \n del cache[oldkey]\n \n \n \n cache[key]=oldroot\n else:\n \n last=root[PREV]\n link=[last,root,key,result]\n last[NEXT]=root[PREV]=cache[key]=link\n \n \n full=(cache_len()>=maxsize)\n return result\n \n def cache_info():\n ''\n with lock:\n return _CacheInfo(hits,misses,maxsize,cache_len())\n \n def cache_clear():\n ''\n nonlocal hits,misses,full\n with lock:\n cache.clear()\n root[:]=[root,root,None,None]\n hits=misses=0\n full=False\n \n wrapper.cache_info=cache_info\n wrapper.cache_clear=cache_clear\n return wrapper\n \ntry:\n from _functools import _lru_cache_wrapper\nexcept ImportError:\n pass\n \n \n \n \n \n \ndef cache(user_function,/):\n ''\n return lru_cache(maxsize=None)(user_function)\n \n \n \n \n \n \ndef _c3_merge(sequences):\n ''\n\n\n\n \n result=[]\n while True:\n sequences=[s for s in sequences if s]\n if not sequences:\n return result\n for s1 in sequences:\n candidate=s1[0]\n for s2 in sequences:\n if candidate in s2[1:]:\n candidate=None\n break\n else:\n break\n if candidate is None:\n raise RuntimeError(\"Inconsistent hierarchy\")\n result.append(candidate)\n \n for seq in sequences:\n if seq[0]==candidate:\n del seq[0]\n \ndef _c3_mro(cls,abcs=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n for i,base in enumerate(reversed(cls.__bases__)):\n if hasattr(base,'__abstractmethods__'):\n boundary=len(cls.__bases__)-i\n break\n else:\n boundary=0\n abcs=list(abcs)if abcs else[]\n explicit_bases=list(cls.__bases__[:boundary])\n abstract_bases=[]\n other_bases=list(cls.__bases__[boundary:])\n for base in abcs:\n if issubclass(cls,base)and not any(\n issubclass(b,base)for b in cls.__bases__\n ):\n \n \n abstract_bases.append(base)\n for base in abstract_bases:\n abcs.remove(base)\n explicit_c3_mros=[_c3_mro(base,abcs=abcs)for base in explicit_bases]\n abstract_c3_mros=[_c3_mro(base,abcs=abcs)for base in abstract_bases]\n other_c3_mros=[_c3_mro(base,abcs=abcs)for base in other_bases]\n return _c3_merge(\n [[cls]]+\n explicit_c3_mros+abstract_c3_mros+other_c3_mros+\n [explicit_bases]+[abstract_bases]+[other_bases]\n )\n \ndef _compose_mro(cls,types):\n ''\n\n\n\n\n \n bases=set(cls.__mro__)\n \n def is_related(typ):\n return(typ not in bases and hasattr(typ,'__mro__')\n and not isinstance(typ,GenericAlias)\n and issubclass(cls,typ))\n types=[n for n in types if is_related(n)]\n \n \n def is_strict_base(typ):\n for other in types:\n if typ !=other and typ in other.__mro__:\n return True\n return False\n types=[n for n in types if not is_strict_base(n)]\n \n \n type_set=set(types)\n mro=[]\n for typ in types:\n found=[]\n for sub in typ.__subclasses__():\n if sub not in bases and issubclass(cls,sub):\n found.append([s for s in sub.__mro__ if s in type_set])\n if not found:\n mro.append(typ)\n continue\n \n found.sort(key=len,reverse=True)\n for sub in found:\n for subcls in sub:\n if subcls not in mro:\n mro.append(subcls)\n return _c3_mro(cls,abcs=mro)\n \ndef _find_impl(cls,registry):\n ''\n\n\n\n\n\n\n\n \n mro=_compose_mro(cls,registry.keys())\n match=None\n for t in mro:\n if match is not None:\n \n \n if(t in registry and t not in cls.__mro__\n and match not in cls.__mro__\n and not issubclass(match,t)):\n raise RuntimeError(\"Ambiguous dispatch: {} or {}\".format(\n match,t))\n break\n if t in registry:\n match=t\n return registry.get(match)\n \ndef singledispatch(func):\n ''\n\n\n\n\n\n\n \n \n \n \n import types,weakref\n \n registry={}\n dispatch_cache=weakref.WeakKeyDictionary()\n cache_token=None\n \n def dispatch(cls):\n ''\n\n\n\n\n \n nonlocal cache_token\n if cache_token is not None:\n current_token=get_cache_token()\n if cache_token !=current_token:\n dispatch_cache.clear()\n cache_token=current_token\n try:\n impl=dispatch_cache[cls]\n except KeyError:\n try:\n impl=registry[cls]\n except KeyError:\n impl=_find_impl(cls,registry)\n dispatch_cache[cls]=impl\n return impl\n \n def _is_union_type(cls):\n from typing import get_origin,Union\n return get_origin(cls)in{Union,types.UnionType}\n \n def _is_valid_dispatch_type(cls):\n if isinstance(cls,type):\n return True\n from typing import get_args\n return(_is_union_type(cls)and\n all(isinstance(arg,type)for arg in get_args(cls)))\n \n def register(cls,func=None):\n ''\n\n\n\n \n nonlocal cache_token\n if _is_valid_dispatch_type(cls):\n if func is None:\n return lambda f:register(cls,f)\n else:\n if func is not None:\n raise TypeError(\n f\"Invalid first argument to `register()`. \"\n f\"{cls !r} is not a class or union type.\"\n )\n ann=getattr(cls,'__annotations__',{})\n if not ann:\n raise TypeError(\n f\"Invalid first argument to `register()`: {cls !r}. \"\n f\"Use either `@register(some_class)` or plain `@register` \"\n f\"on an annotated function.\"\n )\n func=cls\n \n \n from typing import get_type_hints\n argname,cls=next(iter(get_type_hints(func).items()))\n if not _is_valid_dispatch_type(cls):\n if _is_union_type(cls):\n raise TypeError(\n f\"Invalid annotation for {argname !r}. \"\n f\"{cls !r} not all arguments are classes.\"\n )\n else:\n raise TypeError(\n f\"Invalid annotation for {argname !r}. \"\n f\"{cls !r} is not a class.\"\n )\n \n if _is_union_type(cls):\n from typing import get_args\n \n for arg in get_args(cls):\n registry[arg]=func\n else:\n registry[cls]=func\n if cache_token is None and hasattr(cls,'__abstractmethods__'):\n cache_token=get_cache_token()\n dispatch_cache.clear()\n return func\n \n def wrapper(*args,**kw):\n if not args:\n raise TypeError(f'{funcname} requires at least '\n '1 positional argument')\n \n return dispatch(args[0].__class__)(*args,**kw)\n \n funcname=getattr(func,'__name__','singledispatch function')\n registry[object]=func\n wrapper.register=register\n wrapper.dispatch=dispatch\n wrapper.registry=types.MappingProxyType(registry)\n wrapper._clear_cache=dispatch_cache.clear\n update_wrapper(wrapper,func)\n return wrapper\n \n \n \nclass singledispatchmethod:\n ''\n\n\n\n \n \n def __init__(self,func):\n if not callable(func)and not hasattr(func,\"__get__\"):\n raise TypeError(f\"{func !r} is not callable or a descriptor\")\n \n self.dispatcher=singledispatch(func)\n self.func=func\n \n def register(self,cls,method=None):\n ''\n\n\n \n return self.dispatcher.register(cls,func=method)\n \n def __get__(self,obj,cls=None):\n def _method(*args,**kwargs):\n method=self.dispatcher.dispatch(args[0].__class__)\n return method.__get__(obj,cls)(*args,**kwargs)\n \n _method.__isabstractmethod__=self.__isabstractmethod__\n _method.register=self.register\n update_wrapper(_method,self.func)\n return _method\n \n @property\n def __isabstractmethod__(self):\n return getattr(self.func,'__isabstractmethod__',False)\n \n \n \n \n \n \n \nclass cached_property:\n def __init__(self,func):\n self.func=func\n self.attrname=None\n self.__doc__=func.__doc__\n \n def __set_name__(self,owner,name):\n if self.attrname is None:\n self.attrname=name\n elif name !=self.attrname:\n raise TypeError(\n \"Cannot assign the same cached_property to two different names \"\n f\"({self.attrname !r} and {name !r}).\"\n )\n \n def __get__(self,instance,owner=None):\n if instance is None:\n return self\n if self.attrname is None:\n raise TypeError(\n \"Cannot use cached_property instance without calling __set_name__ on it.\")\n try:\n cache=instance.__dict__\n except AttributeError:\n msg=(\n f\"No '__dict__' attribute on {type(instance).__name__ !r} \"\n f\"instance to cache {self.attrname !r} property.\"\n )\n raise TypeError(msg)from None\n val=self.func(instance)\n try:\n cache[self.attrname]=val\n except TypeError:\n msg=(\n f\"The '__dict__' attribute on {type(instance).__name__ !r} instance \"\n f\"does not support item assignment for caching {self.attrname !r} property.\"\n )\n raise TypeError(msg)from None\n return val\n \n __class_getitem__=classmethod(GenericAlias)\n", ["_functools", "_thread", "abc", "collections", "reprlib", "types", "typing", "weakref"]], "gc": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nDEBUG_COLLECTABLE=2\n\nDEBUG_LEAK=38\n\nDEBUG_SAVEALL=32\n\nDEBUG_STATS=1\n\nDEBUG_UNCOLLECTABLE=4\n\nclass __loader__:\n pass\n \ncallbacks=[]\n\ndef collect(*args,**kw):\n ''\n\n\n\n\n\n \n pass\n \ndef disable(*args,**kw):\n ''\n\n \n pass\n \ndef enable(*args,**kw):\n ''\n\n \n pass\n \ngarbage=[]\n\ndef get_count(*args,**kw):\n ''\n\n \n pass\n \ndef get_debug(*args,**kw):\n ''\n\n \n pass\n \ndef get_objects(*args,**kw):\n ''\n\n\n \n pass\n \ndef get_referents(*args,**kw):\n ''\n pass\n \ndef get_referrers(*args,**kw):\n ''\n pass\n \ndef get_threshold(*args,**kw):\n ''\n\n \n pass\n \ndef is_tracked(*args,**kw):\n ''\n\n\n \n pass\n \ndef isenabled(*args,**kw):\n ''\n\n \n pass\n \ndef set_debug(*args,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n \n pass\n \ndef set_threshold(*args,**kw):\n ''\n\n\n \n pass\n", []], "genericpath": [".py", "''\n\n\n\n\nimport os\nimport stat\n\n__all__=['commonprefix','exists','getatime','getctime','getmtime',\n'getsize','isdir','isfile','islink','samefile','sameopenfile',\n'samestat']\n\n\n\n\ndef exists(path):\n ''\n try:\n os.stat(path)\n except(OSError,ValueError):\n return False\n return True\n \n \n \n \ndef isfile(path):\n ''\n try:\n st=os.stat(path)\n except(OSError,ValueError):\n return False\n return stat.S_ISREG(st.st_mode)\n \n \n \n \n \ndef isdir(s):\n ''\n try:\n st=os.stat(s)\n except(OSError,ValueError):\n return False\n return stat.S_ISDIR(st.st_mode)\n \n \n \n \n \ndef islink(path):\n ''\n try:\n st=os.lstat(path)\n except(OSError,ValueError,AttributeError):\n return False\n return stat.S_ISLNK(st.st_mode)\n \n \ndef getsize(filename):\n ''\n return os.stat(filename).st_size\n \n \ndef getmtime(filename):\n ''\n return os.stat(filename).st_mtime\n \n \ndef getatime(filename):\n ''\n return os.stat(filename).st_atime\n \n \ndef getctime(filename):\n ''\n return os.stat(filename).st_ctime\n \n \n \ndef commonprefix(m):\n ''\n if not m:return ''\n \n \n \n \n if not isinstance(m[0],(list,tuple)):\n m=tuple(map(os.fspath,m))\n s1=min(m)\n s2=max(m)\n for i,c in enumerate(s1):\n if c !=s2[i]:\n return s1[:i]\n return s1\n \n \n \ndef samestat(s1,s2):\n ''\n return(s1.st_ino ==s2.st_ino and\n s1.st_dev ==s2.st_dev)\n \n \n \ndef samefile(f1,f2):\n ''\n\n\n\n \n s1=os.stat(f1)\n s2=os.stat(f2)\n return samestat(s1,s2)\n \n \n \n \ndef sameopenfile(fp1,fp2):\n ''\n s1=os.fstat(fp1)\n s2=os.fstat(fp2)\n return samestat(s1,s2)\n \n \n \n \n \n \n \n \n \ndef _splitext(p,sep,altsep,extsep):\n ''\n\n\n \n \n \n sepIndex=p.rfind(sep)\n if altsep:\n altsepIndex=p.rfind(altsep)\n sepIndex=max(sepIndex,altsepIndex)\n \n dotIndex=p.rfind(extsep)\n if dotIndex >sepIndex:\n \n filenameIndex=sepIndex+1\n while filenameIndex [ \\t]+) | # spaces and horizontal tabs\n (?P[0-9]+\\b) | # decimal integer\n (?Pn\\b) | # only n is allowed\n (?P[()]) |\n (?P[-*/%+?:]|[>,\n # <=, >=, ==, !=, &&, ||,\n # ? :\n # unary and bitwise ops\n # not allowed\n (?P\\w+|.) # invalid token\n \"\"\",re.VERBOSE |re.DOTALL)\n\n\ndef _tokenize(plural):\n for mo in re.finditer(_token_pattern,plural):\n kind=mo.lastgroup\n if kind =='WHITESPACES':\n continue\n value=mo.group(kind)\n if kind =='INVALID':\n raise ValueError('invalid token in plural form: %s'%value)\n yield value\n yield ''\n \n \ndef _error(value):\n if value:\n return ValueError('unexpected token in plural form: %s'%value)\n else :\n return ValueError('unexpected end of plural form')\n \n \n_binary_ops=(\n('||',),\n('&&',),\n('==','!='),\n('<','>','<=','>='),\n('+','-'),\n('*','/','%'),\n)\n_binary_ops={op:i for i,ops in enumerate(_binary_ops,1)for op in ops}\n_c2py_ops={'||':'or','&&':'and','/':'//'}\n\n\ndef _parse(tokens,priority=-1):\n result=''\n nexttok=next(tokens)\n while nexttok =='!':\n result +='not '\n nexttok=next(tokens)\n \n if nexttok =='(':\n sub,nexttok=_parse(tokens)\n result='%s(%s)'%(result,sub)\n if nexttok !=')':\n raise ValueError('unbalanced parenthesis in plural form')\n elif nexttok =='n':\n result='%s%s'%(result,nexttok)\n else :\n try :\n value=int(nexttok,10)\n except ValueError:\n raise _error(nexttok)from None\n result='%s%d'%(result,value)\n nexttok=next(tokens)\n \n j=100\n while nexttok in _binary_ops:\n i=_binary_ops[nexttok]\n if i 1000:\n raise ValueError('plural form expression is too long')\n try :\n result,nexttok=_parse(_tokenize(plural))\n if nexttok:\n raise _error(nexttok)\n \n depth=0\n for c in result:\n if c =='(':\n depth +=1\n if depth >20:\n \n \n raise ValueError('plural form expression is too complex')\n elif c ==')':\n depth -=1\n \n ns={'_as_int':_as_int}\n exec('''if True:\n def func(n):\n if not isinstance(n, int):\n n = _as_int(n)\n return int(%s)\n '''%result,ns)\n return ns['func']\n except RecursionError:\n \n raise ValueError('plural form expression is too complex')\n \n \ndef _expand_lang(loc):\n import locale\n loc=locale.normalize(loc)\n COMPONENT_CODESET=1 <<0\n COMPONENT_TERRITORY=1 <<1\n COMPONENT_MODIFIER=1 <<2\n \n mask=0\n pos=loc.find('@')\n if pos >=0:\n modifier=loc[pos:]\n loc=loc[:pos]\n mask |=COMPONENT_MODIFIER\n else :\n modifier=''\n pos=loc.find('.')\n if pos >=0:\n codeset=loc[pos:]\n loc=loc[:pos]\n mask |=COMPONENT_CODESET\n else :\n codeset=''\n pos=loc.find('_')\n if pos >=0:\n territory=loc[pos:]\n loc=loc[:pos]\n mask |=COMPONENT_TERRITORY\n else :\n territory=''\n language=loc\n ret=[]\n for i in range(mask+1):\n if not (i&~mask):\n val=language\n if i&COMPONENT_TERRITORY:val +=territory\n if i&COMPONENT_CODESET:val +=codeset\n if i&COMPONENT_MODIFIER:val +=modifier\n ret.append(val)\n ret.reverse()\n return ret\n \n \nclass NullTranslations:\n def __init__(self,fp=None ):\n self._info={}\n self._charset=None\n self._fallback=None\n if fp is not None :\n self._parse(fp)\n \n def _parse(self,fp):\n pass\n \n def add_fallback(self,fallback):\n if self._fallback:\n self._fallback.add_fallback(fallback)\n else :\n self._fallback=fallback\n \n def gettext(self,message):\n if self._fallback:\n return self._fallback.gettext(message)\n return message\n \n def ngettext(self,msgid1,msgid2,n):\n if self._fallback:\n return self._fallback.ngettext(msgid1,msgid2,n)\n if n ==1:\n return msgid1\n else :\n return msgid2\n \n def pgettext(self,context,message):\n if self._fallback:\n return self._fallback.pgettext(context,message)\n return message\n \n def npgettext(self,context,msgid1,msgid2,n):\n if self._fallback:\n return self._fallback.npgettext(context,msgid1,msgid2,n)\n if n ==1:\n return msgid1\n else :\n return msgid2\n \n def info(self):\n return self._info\n \n def charset(self):\n return self._charset\n \n def install(self,names=None ):\n import builtins\n builtins.__dict__['_']=self.gettext\n if names is not None :\n allowed={'gettext','ngettext','npgettext','pgettext'}\n for name in allowed&set(names):\n builtins.__dict__[name]=getattr(self,name)\n \n \nclass GNUTranslations(NullTranslations):\n\n LE_MAGIC=0x950412de\n BE_MAGIC=0xde120495\n \n \n \n CONTEXT=\"%s\\x04%s\"\n \n \n VERSIONS=(0,1)\n \n def _get_versions(self,version):\n ''\n return (version >>16,version&0xffff)\n \n def _parse(self,fp):\n ''\n \n \n from struct import unpack\n filename=getattr(fp,'name','')\n \n \n self._catalog=catalog={}\n self.plural=lambda n:int(n !=1)\n buf=fp.read()\n buflen=len(buf)\n \n magic=unpack('4I',buf[4:20])\n ii='>II'\n else :\n raise OSError(0,'Bad magic number',filename)\n \n major_version,minor_version=self._get_versions(version)\n \n if major_version not in self.VERSIONS:\n raise OSError(0,'Bad version number '+str(major_version),filename)\n \n \n \n for i in range(0,msgcount):\n mlen,moff=unpack(ii,buf[masteridx:masteridx+8])\n mend=moff+mlen\n tlen,toff=unpack(ii,buf[transidx:transidx+8])\n tend=toff+tlen\n if mend '\n \n def _init_write(self,filename):\n self.name=filename\n self.crc=zlib.crc32(b\"\")\n self.size=0\n self.writebuf=[]\n self.bufsize=0\n self.offset=0\n \n def _write_gzip_header(self,compresslevel):\n self.fileobj.write(b'\\037\\213')\n self.fileobj.write(b'\\010')\n try :\n \n \n fname=os.path.basename(self.name)\n if not isinstance(fname,bytes):\n fname=fname.encode('latin-1')\n if fname.endswith(b'.gz'):\n fname=fname[:-3]\n except UnicodeEncodeError:\n fname=b''\n flags=0\n if fname:\n flags=FNAME\n self.fileobj.write(chr(flags).encode('latin-1'))\n mtime=self._write_mtime\n if mtime is None :\n mtime=time.time()\n write32u(self.fileobj,int(mtime))\n if compresslevel ==_COMPRESS_LEVEL_BEST:\n xfl=b'\\002'\n elif compresslevel ==_COMPRESS_LEVEL_FAST:\n xfl=b'\\004'\n else :\n xfl=b'\\000'\n self.fileobj.write(xfl)\n self.fileobj.write(b'\\377')\n if fname:\n self.fileobj.write(fname+b'\\000')\n \n def write(self,data):\n self._check_not_closed()\n if self.mode !=WRITE:\n import errno\n raise OSError(errno.EBADF,\"write() on read-only GzipFile object\")\n \n if self.fileobj is None :\n raise ValueError(\"write() on closed GzipFile object\")\n \n if isinstance(data,(bytes,bytearray)):\n length=len(data)\n else :\n \n data=memoryview(data)\n length=data.nbytes\n \n if length >0:\n self.fileobj.write(self.compress.compress(data))\n self.size +=length\n self.crc=zlib.crc32(data,self.crc)\n self.offset +=length\n \n return length\n \n def read(self,size=-1):\n self._check_not_closed()\n if self.mode !=READ:\n import errno\n raise OSError(errno.EBADF,\"read() on write-only GzipFile object\")\n return self._buffer.read(size)\n \n def read1(self,size=-1):\n ''\n\n \n self._check_not_closed()\n if self.mode !=READ:\n import errno\n raise OSError(errno.EBADF,\"read1() on write-only GzipFile object\")\n \n if size <0:\n size=io.DEFAULT_BUFFER_SIZE\n return self._buffer.read1(size)\n \n def peek(self,n):\n self._check_not_closed()\n if self.mode !=READ:\n import errno\n raise OSError(errno.EBADF,\"peek() on write-only GzipFile object\")\n return self._buffer.peek(n)\n \n @property\n def closed(self):\n return self.fileobj is None\n \n def close(self):\n fileobj=self.fileobj\n if fileobj is None :\n return\n self.fileobj=None\n try :\n if self.mode ==WRITE:\n fileobj.write(self.compress.flush())\n write32u(fileobj,self.crc)\n \n write32u(fileobj,self.size&0xffffffff)\n elif self.mode ==READ:\n self._buffer.close()\n finally :\n myfileobj=self.myfileobj\n if myfileobj:\n self.myfileobj=None\n myfileobj.close()\n \n def flush(self,zlib_mode=zlib.Z_SYNC_FLUSH):\n self._check_not_closed()\n if self.mode ==WRITE:\n \n self.fileobj.write(self.compress.flush(zlib_mode))\n self.fileobj.flush()\n \n def fileno(self):\n ''\n\n\n\n \n return self.fileobj.fileno()\n \n def rewind(self):\n ''\n \n if self.mode !=READ:\n raise OSError(\"Can't rewind in write mode\")\n self._buffer.seek(0)\n \n def readable(self):\n return self.mode ==READ\n \n def writable(self):\n return self.mode ==WRITE\n \n def seekable(self):\n return True\n \n def seek(self,offset,whence=io.SEEK_SET):\n if self.mode ==WRITE:\n if whence !=io.SEEK_SET:\n if whence ==io.SEEK_CUR:\n offset=self.offset+offset\n else :\n raise ValueError('Seek from end not supported')\n if offset startpos:\n parentpos=(pos -1)>>1\n parent=heap[parentpos]\n if newitem startpos:\n parentpos=(pos -1)>>1\n parent=heap[parentpos]\n if parent 1:\n try :\n while True :\n value,order,next=s=h[0]\n yield value\n s[0]=next()\n _heapreplace(h,s)\n except StopIteration:\n _heappop(h)\n if h:\n \n value,order,next=h[0]\n yield value\n yield from next.__self__\n return\n \n for order,it in enumerate(map(iter,iterables)):\n try :\n next=it.__next__\n value=next()\n h_append([key(value),order *direction,value,next])\n except StopIteration:\n pass\n _heapify(h)\n while len(h)>1:\n try :\n while True :\n key_value,order,value,next=s=h[0]\n yield value\n value=next()\n s[0]=key(value)\n s[2]=value\n _heapreplace(h,s)\n except StopIteration:\n _heappop(h)\n if h:\n key_value,order,value,next=h[0]\n yield value\n yield from next.__self__\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \ndef nsmallest(n,iterable,key=None ):\n ''\n\n\n \n \n \n if n ==1:\n it=iter(iterable)\n sentinel=object()\n result=min(it,default=sentinel,key=key)\n return []if result is sentinel else [result]\n \n \n try :\n size=len(iterable)\n except (TypeError,AttributeError):\n pass\n else :\n if n >=size:\n return sorted(iterable,key=key)[:n]\n \n \n if key is None :\n it=iter(iterable)\n \n \n result=[(elem,i)for i,elem in zip(range(n),it)]\n if not result:\n return result\n _heapify_max(result)\n top=result[0][0]\n order=n\n _heapreplace=_heapreplace_max\n for elem in it:\n if elem =size:\n return sorted(iterable,key=key,reverse=True )[:n]\n \n \n if key is None :\n it=iter(iterable)\n result=[(elem,i)for i,elem in zip(range(0,-n,-1),it)]\n if not result:\n return result\n heapify(result)\n top=result[0][0]\n order=-n\n _heapreplace=heapreplace\n for elem in it:\n if top blocksize:\n key=digest_cons(key).digest()\n \n \n \n self.block_size=blocksize\n \n key=key.ljust(blocksize,b'\\0')\n self._outer.update(key.translate(trans_5C))\n self._inner.update(key.translate(trans_36))\n if msg is not None :\n self.update(msg)\n \n @property\n def name(self):\n if self._hmac:\n return self._hmac.name\n else :\n return f\"hmac-{self._inner.name}\"\n \n def update(self,msg):\n ''\n inst=self._hmac or self._inner\n inst.update(msg)\n \n def copy(self):\n ''\n\n\n \n \n other=self.__class__.__new__(self.__class__)\n other.digest_size=self.digest_size\n if self._hmac:\n other._hmac=self._hmac.copy()\n other._inner=other._outer=None\n else :\n other._hmac=None\n other._inner=self._inner.copy()\n other._outer=self._outer.copy()\n return other\n \n def _current(self):\n ''\n\n\n \n if self._hmac:\n return self._hmac\n else :\n h=self._outer.copy()\n h.update(self._inner.digest())\n return h\n \n def digest(self):\n ''\n\n\n\n\n \n h=self._current()\n return h.digest()\n \n def hexdigest(self):\n ''\n \n h=self._current()\n return h.hexdigest()\n \ndef new(key,msg=None ,digestmod=''):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return HMAC(key,msg,digestmod)\n \n \ndef digest(key,msg,digest):\n ''\n\n\n\n\n\n\n \n if _hashopenssl is not None and isinstance(digest,(str,_functype)):\n try :\n return _hashopenssl.hmac_digest(key,msg,digest)\n except _hashopenssl.UnsupportedDigestmodError:\n pass\n \n if callable(digest):\n digest_cons=digest\n elif isinstance(digest,str):\n digest_cons=lambda d=b'':_hashlib.new(digest,d)\n else :\n digest_cons=lambda d=b'':digest.new(d)\n \n inner=digest_cons()\n outer=digest_cons()\n blocksize=getattr(inner,'block_size',64)\n if len(key)>blocksize:\n key=digest_cons(key).digest()\n key=key+b'\\x00'*(blocksize -len(key))\n inner.update(key.translate(trans_36))\n outer.update(key.translate(trans_5C))\n inner.update(msg)\n outer.update(inner.digest())\n return outer.digest()\n", ["_hashlib", "_operator", "hashlib", "warnings"]], "imp": [".py", "''\n\n\n\n\n\n\n\nfrom _imp import (lock_held,acquire_lock,release_lock,\nget_frozen_object,is_frozen_package,\ninit_frozen,is_builtin,is_frozen,\n_fix_co_filename,_frozen_module_names)\ntry :\n from _imp import create_dynamic\nexcept ImportError:\n\n create_dynamic=None\n \nfrom importlib._bootstrap import _ERR_MSG,_exec,_load,_builtin_from_name\nfrom importlib._bootstrap_external import SourcelessFileLoader\n\nfrom importlib import machinery\nfrom importlib import util\nimport importlib\nimport os\nimport sys\nimport tokenize\nimport types\nimport warnings\n\nwarnings.warn(\"the imp module is deprecated in favour of importlib and slated \"\n\"for removal in Python 3.12; \"\n\"see the module's documentation for alternative uses\",\nDeprecationWarning,stacklevel=2)\n\n\nSEARCH_ERROR=0\nPY_SOURCE=1\nPY_COMPILED=2\nC_EXTENSION=3\nPY_RESOURCE=4\nPKG_DIRECTORY=5\nC_BUILTIN=6\nPY_FROZEN=7\nPY_CODERESOURCE=8\nIMP_HOOK=9\n\n\ndef new_module(name):\n ''\n\n\n\n\n\n \n return types.ModuleType(name)\n \n \ndef get_magic():\n ''\n\n\n \n return util.MAGIC_NUMBER\n \n \ndef get_tag():\n ''\n return sys.implementation.cache_tag\n \n \ndef cache_from_source(path,debug_override=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n with warnings.catch_warnings():\n warnings.simplefilter('ignore')\n return util.cache_from_source(path,debug_override)\n \n \ndef source_from_cache(path):\n ''\n\n\n\n\n\n\n\n\n \n return util.source_from_cache(path)\n \n \ndef get_suffixes():\n ''\n extensions=[(s,'rb',C_EXTENSION)for s in machinery.EXTENSION_SUFFIXES]\n source=[(s,'r',PY_SOURCE)for s in machinery.SOURCE_SUFFIXES]\n bytecode=[(s,'rb',PY_COMPILED)for s in machinery.BYTECODE_SUFFIXES]\n \n return extensions+source+bytecode\n \n \nclass NullImporter:\n\n ''\n\n\n\n \n \n def __init__(self,path):\n if path =='':\n raise ImportError('empty pathname',path='')\n elif os.path.isdir(path):\n raise ImportError('existing directory',path=path)\n \n def find_module(self,fullname):\n ''\n return None\n \n \nclass _HackedGetData:\n\n ''\n \n \n def __init__(self,fullname,path,file=None ):\n super().__init__(fullname,path)\n self.file=file\n \n def get_data(self,path):\n ''\n if self.file and path ==self.path:\n \n \n if not self.file.closed:\n file=self.file\n if 'b'not in file.mode:\n file.close()\n if self.file.closed:\n self.file=file=open(self.path,'rb')\n \n with file:\n return file.read()\n else :\n return super().get_data(path)\n \n \nclass _LoadSourceCompatibility(_HackedGetData,machinery.SourceFileLoader):\n\n ''\n \n \ndef load_source(name,pathname,file=None ):\n loader=_LoadSourceCompatibility(name,pathname,file)\n spec=util.spec_from_file_location(name,pathname,loader=loader)\n if name in sys.modules:\n module=_exec(spec,sys.modules[name])\n else :\n module=_load(spec)\n \n \n module.__loader__=machinery.SourceFileLoader(name,pathname)\n module.__spec__.loader=module.__loader__\n return module\n \n \nclass _LoadCompiledCompatibility(_HackedGetData,SourcelessFileLoader):\n\n ''\n \n \ndef load_compiled(name,pathname,file=None ):\n ''\n loader=_LoadCompiledCompatibility(name,pathname,file)\n spec=util.spec_from_file_location(name,pathname,loader=loader)\n if name in sys.modules:\n module=_exec(spec,sys.modules[name])\n else :\n module=_load(spec)\n \n \n module.__loader__=SourcelessFileLoader(name,pathname)\n module.__spec__.loader=module.__loader__\n return module\n \n \ndef load_package(name,path):\n ''\n if os.path.isdir(path):\n extensions=(machinery.SOURCE_SUFFIXES[:]+\n machinery.BYTECODE_SUFFIXES[:])\n for extension in extensions:\n init_path=os.path.join(path,'__init__'+extension)\n if os.path.exists(init_path):\n path=init_path\n break\n else :\n raise ValueError('{!r} is not a package'.format(path))\n spec=util.spec_from_file_location(name,path,\n submodule_search_locations=[])\n if name in sys.modules:\n return _exec(spec,sys.modules[name])\n else :\n return _load(spec)\n \n \ndef load_module(name,file,filename,details):\n ''\n\n\n\n\n\n \n suffix,mode,type_=details\n if mode and (not mode.startswith('r')or '+'in mode):\n raise ValueError('invalid file open mode {!r}'.format(mode))\n elif file is None and type_ in {PY_SOURCE,PY_COMPILED}:\n msg='file object required for import (type code {})'.format(type_)\n raise ValueError(msg)\n elif type_ ==PY_SOURCE:\n return load_source(name,filename,file)\n elif type_ ==PY_COMPILED:\n return load_compiled(name,filename,file)\n elif type_ ==C_EXTENSION and load_dynamic is not None :\n if file is None :\n with open(filename,'rb')as opened_file:\n return load_dynamic(name,filename,opened_file)\n else :\n return load_dynamic(name,filename,file)\n elif type_ ==PKG_DIRECTORY:\n return load_package(name,filename)\n elif type_ ==C_BUILTIN:\n return init_builtin(name)\n elif type_ ==PY_FROZEN:\n return init_frozen(name)\n else :\n msg=\"Don't know how to import {} (type code {})\".format(name,type_)\n raise ImportError(msg,name=name)\n \n \ndef find_module(name,path=None ):\n ''\n\n\n\n\n\n\n\n\n \n if not isinstance(name,str):\n raise TypeError(\"'name' must be a str, not {}\".format(type(name)))\n elif not isinstance(path,(type(None ),list)):\n \n raise RuntimeError(\"'path' must be None or a list, \"\n \"not {}\".format(type(path)))\n \n if path is None :\n if is_builtin(name):\n return None ,None ,('','',C_BUILTIN)\n elif is_frozen(name):\n return None ,None ,('','',PY_FROZEN)\n else :\n path=sys.path\n \n for entry in path:\n package_directory=os.path.join(entry,name)\n for suffix in ['.py',machinery.BYTECODE_SUFFIXES[0]]:\n package_file_name='__init__'+suffix\n file_path=os.path.join(package_directory,package_file_name)\n if os.path.isfile(file_path):\n return None ,package_directory,('','',PKG_DIRECTORY)\n for suffix,mode,type_ in get_suffixes():\n file_name=name+suffix\n file_path=os.path.join(entry,file_name)\n if os.path.isfile(file_path):\n break\n else :\n continue\n break\n else :\n raise ImportError(_ERR_MSG.format(name),name=name)\n \n encoding=None\n if 'b'not in mode:\n with open(file_path,'rb')as file:\n encoding=tokenize.detect_encoding(file.readline)[0]\n file=open(file_path,mode,encoding=encoding)\n return file,file_path,(suffix,mode,type_)\n \n \ndef reload(module):\n ''\n\n\n\n\n\n \n return importlib.reload(module)\n \n \ndef init_builtin(name):\n ''\n\n\n\n \n try :\n return _builtin_from_name(name)\n except ImportError:\n return None\n \n \nif create_dynamic:\n def load_dynamic(name,path,file=None ):\n ''\n\n\n \n import importlib.machinery\n loader=importlib.machinery.ExtensionFileLoader(name,path)\n \n \n \n spec=importlib.machinery.ModuleSpec(\n name=name,loader=loader,origin=path)\n return _load(spec)\n \nelse :\n load_dynamic=None\n", ["_imp", "importlib", "importlib._bootstrap", "importlib._bootstrap_external", "importlib.machinery", "importlib.util", "os", "sys", "tokenize", "types", "warnings"]], "inspect": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__author__=('Ka-Ping Yee ',\n'Yury Selivanov ')\n\n__all__=[\n\"ArgInfo\",\n\"Arguments\",\n\"Attribute\",\n\"BlockFinder\",\n\"BoundArguments\",\n\"CORO_CLOSED\",\n\"CORO_CREATED\",\n\"CORO_RUNNING\",\n\"CORO_SUSPENDED\",\n\"CO_ASYNC_GENERATOR\",\n\"CO_COROUTINE\",\n\"CO_GENERATOR\",\n\"CO_ITERABLE_COROUTINE\",\n\"CO_NESTED\",\n\"CO_NEWLOCALS\",\n\"CO_NOFREE\",\n\"CO_OPTIMIZED\",\n\"CO_VARARGS\",\n\"CO_VARKEYWORDS\",\n\"ClassFoundException\",\n\"ClosureVars\",\n\"EndOfBlock\",\n\"FrameInfo\",\n\"FullArgSpec\",\n\"GEN_CLOSED\",\n\"GEN_CREATED\",\n\"GEN_RUNNING\",\n\"GEN_SUSPENDED\",\n\"Parameter\",\n\"Signature\",\n\"TPFLAGS_IS_ABSTRACT\",\n\"Traceback\",\n\"classify_class_attrs\",\n\"cleandoc\",\n\"currentframe\",\n\"findsource\",\n\"formatannotation\",\n\"formatannotationrelativeto\",\n\"formatargvalues\",\n\"get_annotations\",\n\"getabsfile\",\n\"getargs\",\n\"getargvalues\",\n\"getattr_static\",\n\"getblock\",\n\"getcallargs\",\n\"getclasstree\",\n\"getclosurevars\",\n\"getcomments\",\n\"getcoroutinelocals\",\n\"getcoroutinestate\",\n\"getdoc\",\n\"getfile\",\n\"getframeinfo\",\n\"getfullargspec\",\n\"getgeneratorlocals\",\n\"getgeneratorstate\",\n\"getinnerframes\",\n\"getlineno\",\n\"getmembers\",\n\"getmembers_static\",\n\"getmodule\",\n\"getmodulename\",\n\"getmro\",\n\"getouterframes\",\n\"getsource\",\n\"getsourcefile\",\n\"getsourcelines\",\n\"indentsize\",\n\"isabstract\",\n\"isasyncgen\",\n\"isasyncgenfunction\",\n\"isawaitable\",\n\"isbuiltin\",\n\"isclass\",\n\"iscode\",\n\"iscoroutine\",\n\"iscoroutinefunction\",\n\"isdatadescriptor\",\n\"isframe\",\n\"isfunction\",\n\"isgenerator\",\n\"isgeneratorfunction\",\n\"isgetsetdescriptor\",\n\"ismemberdescriptor\",\n\"ismethod\",\n\"ismethoddescriptor\",\n\"ismethodwrapper\",\n\"ismodule\",\n\"isroutine\",\n\"istraceback\",\n\"signature\",\n\"stack\",\n\"trace\",\n\"unwrap\",\n\"walktree\",\n]\n\n\nimport abc\nimport ast\nimport dis\nimport collections.abc\nimport enum\nimport importlib.machinery\nimport itertools\nimport linecache\nimport os\nimport re\nimport sys\nimport tokenize\nimport token\nimport types\nimport functools\nimport builtins\nfrom keyword import iskeyword\nfrom operator import attrgetter\nfrom collections import namedtuple,OrderedDict\n\n\n\nmod_dict=globals()\nfor k,v in dis.COMPILER_FLAG_NAMES.items():\n mod_dict[\"CO_\"+v]=k\ndel k,v,mod_dict\n\n\nTPFLAGS_IS_ABSTRACT=1 <<20\n\n\ndef get_annotations(obj,*,globals=None ,locals=None ,eval_str=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(obj,type):\n \n obj_dict=getattr(obj,'__dict__',None )\n if obj_dict and hasattr(obj_dict,'get'):\n ann=obj_dict.get('__annotations__',None )\n if isinstance(ann,types.GetSetDescriptorType):\n ann=None\n else :\n ann=None\n \n obj_globals=None\n module_name=getattr(obj,'__module__',None )\n if module_name:\n module=sys.modules.get(module_name,None )\n if module:\n obj_globals=getattr(module,'__dict__',None )\n obj_locals=dict(vars(obj))\n unwrap=obj\n elif isinstance(obj,types.ModuleType):\n \n ann=getattr(obj,'__annotations__',None )\n obj_globals=getattr(obj,'__dict__')\n obj_locals=None\n unwrap=None\n elif callable(obj):\n \n \n \n ann=getattr(obj,'__annotations__',None )\n obj_globals=getattr(obj,'__globals__',None )\n obj_locals=None\n unwrap=obj\n else :\n raise TypeError(f\"{obj!r} is not a module, class, or callable.\")\n \n if ann is None :\n return {}\n \n if not isinstance(ann,dict):\n raise ValueError(f\"{obj!r}.__annotations__ is neither a dict nor None\")\n \n if not ann:\n return {}\n \n if not eval_str:\n return dict(ann)\n \n if unwrap is not None :\n while True :\n if hasattr(unwrap,'__wrapped__'):\n unwrap=unwrap.__wrapped__\n continue\n if isinstance(unwrap,functools.partial):\n unwrap=unwrap.func\n continue\n break\n if hasattr(unwrap,\"__globals__\"):\n obj_globals=unwrap.__globals__\n \n if globals is None :\n globals=obj_globals\n if locals is None :\n locals=obj_locals\n \n return_value={key:\n value if not isinstance(value,str)else eval(value,globals,locals)\n for key,value in ann.items()}\n return return_value\n \n \n \ndef ismodule(object):\n ''\n\n\n\n\n \n return isinstance(object,types.ModuleType)\n \ndef isclass(object):\n ''\n\n\n\n \n return isinstance(object,type)\n \ndef ismethod(object):\n ''\n\n\n\n\n\n \n return isinstance(object,types.MethodType)\n \ndef ismethoddescriptor(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if isclass(object)or ismethod(object)or isfunction(object):\n \n return False\n tp=type(object)\n return hasattr(tp,\"__get__\")and not hasattr(tp,\"__set__\")\n \ndef isdatadescriptor(object):\n ''\n\n\n\n\n\n \n if isclass(object)or ismethod(object)or isfunction(object):\n \n return False\n tp=type(object)\n return hasattr(tp,\"__set__\")or hasattr(tp,\"__delete__\")\n \nif hasattr(types,'MemberDescriptorType'):\n\n def ismemberdescriptor(object):\n ''\n\n\n \n return isinstance(object,types.MemberDescriptorType)\nelse :\n\n def ismemberdescriptor(object):\n ''\n\n\n \n return False\n \nif hasattr(types,'GetSetDescriptorType'):\n\n def isgetsetdescriptor(object):\n ''\n\n\n \n return isinstance(object,types.GetSetDescriptorType)\nelse :\n\n def isgetsetdescriptor(object):\n ''\n\n\n \n return False\n \ndef isfunction(object):\n ''\n\n\n\n\n\n\n\n\n \n return isinstance(object,types.FunctionType)\n \ndef _has_code_flag(f,flag):\n ''\n\n \n while ismethod(f):\n f=f.__func__\n f=functools._unwrap_partial(f)\n if not (isfunction(f)or _signature_is_functionlike(f)):\n return False\n return bool(f.__code__.co_flags&flag)\n \ndef isgeneratorfunction(obj):\n ''\n\n\n \n return _has_code_flag(obj,CO_GENERATOR)\n \ndef iscoroutinefunction(obj):\n ''\n\n\n \n return _has_code_flag(obj,CO_COROUTINE)\n \ndef isasyncgenfunction(obj):\n ''\n\n\n\n \n return _has_code_flag(obj,CO_ASYNC_GENERATOR)\n \ndef isasyncgen(object):\n ''\n return isinstance(object,types.AsyncGeneratorType)\n \ndef isgenerator(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n return isinstance(object,types.GeneratorType)\n \ndef iscoroutine(object):\n ''\n return isinstance(object,types.CoroutineType)\n \ndef isawaitable(object):\n ''\n return (isinstance(object,types.CoroutineType)or\n isinstance(object,types.GeneratorType)and\n bool(object.gi_code.co_flags&CO_ITERABLE_COROUTINE)or\n isinstance(object,collections.abc.Awaitable))\n \ndef istraceback(object):\n ''\n\n\n\n\n\n \n return isinstance(object,types.TracebackType)\n \ndef isframe(object):\n ''\n\n\n\n\n\n\n\n\n\n \n return isinstance(object,types.FrameType)\n \ndef iscode(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return isinstance(object,types.CodeType)\n \ndef isbuiltin(object):\n ''\n\n\n\n\n \n return isinstance(object,types.BuiltinFunctionType)\n \ndef ismethodwrapper(object):\n ''\n return isinstance(object,types.MethodWrapperType)\n \ndef isroutine(object):\n ''\n return (isbuiltin(object)\n or isfunction(object)\n or ismethod(object)\n or ismethoddescriptor(object)\n or ismethodwrapper(object))\n \ndef isabstract(object):\n ''\n if not isinstance(object,type):\n return False\n if object.__flags__&TPFLAGS_IS_ABSTRACT:\n return True\n if not issubclass(type(object),abc.ABCMeta):\n return False\n if hasattr(object,'__abstractmethods__'):\n \n \n return False\n \n \n for name,value in object.__dict__.items():\n if getattr(value,\"__isabstractmethod__\",False ):\n return True\n for base in object.__bases__:\n for name in getattr(base,\"__abstractmethods__\",()):\n value=getattr(object,name,None )\n if getattr(value,\"__isabstractmethod__\",False ):\n return True\n return False\n \ndef _getmembers(object,predicate,getter):\n results=[]\n processed=set()\n names=dir(object)\n if isclass(object):\n mro=(object,)+getmro(object)\n \n \n \n try :\n for base in object.__bases__:\n for k,v in base.__dict__.items():\n if isinstance(v,types.DynamicClassAttribute):\n names.append(k)\n except AttributeError:\n pass\n else :\n mro=()\n for key in names:\n \n \n \n try :\n value=getter(object,key)\n \n if key in processed:\n raise AttributeError\n except AttributeError:\n for base in mro:\n if key in base.__dict__:\n value=base.__dict__[key]\n break\n else :\n \n \n continue\n if not predicate or predicate(value):\n results.append((key,value))\n processed.add(key)\n results.sort(key=lambda pair:pair[0])\n return results\n \ndef getmembers(object,predicate=None ):\n ''\n \n return _getmembers(object,predicate,getattr)\n \ndef getmembers_static(object,predicate=None ):\n ''\n\n\n\n\n\n\n\n\n\n \n return _getmembers(object,predicate,getattr_static)\n \nAttribute=namedtuple('Attribute','name kind defining_class object')\n\ndef classify_class_attrs(cls):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n mro=getmro(cls)\n metamro=getmro(type(cls))\n metamro=tuple(cls for cls in metamro if cls not in (type,object))\n class_bases=(cls,)+mro\n all_bases=class_bases+metamro\n names=dir(cls)\n \n \n \n for base in mro:\n for k,v in base.__dict__.items():\n if isinstance(v,types.DynamicClassAttribute)and v.fget is not None :\n names.append(k)\n result=[]\n processed=set()\n \n for name in names:\n \n \n \n \n \n \n \n \n \n homecls=None\n get_obj=None\n dict_obj=None\n if name not in processed:\n try :\n if name =='__dict__':\n raise Exception(\"__dict__ is special, don't want the proxy\")\n get_obj=getattr(cls,name)\n except Exception as exc:\n pass\n else :\n homecls=getattr(get_obj,\"__objclass__\",homecls)\n if homecls not in class_bases:\n \n \n homecls=None\n last_cls=None\n \n for srch_cls in class_bases:\n srch_obj=getattr(srch_cls,name,None )\n if srch_obj is get_obj:\n last_cls=srch_cls\n \n for srch_cls in metamro:\n try :\n srch_obj=srch_cls.__getattr__(cls,name)\n except AttributeError:\n continue\n if srch_obj is get_obj:\n last_cls=srch_cls\n if last_cls is not None :\n homecls=last_cls\n for base in all_bases:\n if name in base.__dict__:\n dict_obj=base.__dict__[name]\n if homecls not in metamro:\n homecls=base\n break\n if homecls is None :\n \n \n continue\n obj=get_obj if get_obj is not None else dict_obj\n \n if isinstance(dict_obj,(staticmethod,types.BuiltinMethodType)):\n kind=\"static method\"\n obj=dict_obj\n elif isinstance(dict_obj,(classmethod,types.ClassMethodDescriptorType)):\n kind=\"class method\"\n obj=dict_obj\n elif isinstance(dict_obj,property):\n kind=\"property\"\n obj=dict_obj\n elif isroutine(obj):\n kind=\"method\"\n else :\n kind=\"data\"\n result.append(Attribute(name,kind,homecls,obj))\n processed.add(name)\n return result\n \n \n \ndef getmro(cls):\n ''\n return cls.__mro__\n \n \n \ndef unwrap(func,*,stop=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if stop is None :\n def _is_wrapper(f):\n return hasattr(f,'__wrapped__')\n else :\n def _is_wrapper(f):\n return hasattr(f,'__wrapped__')and not stop(f)\n f=func\n \n \n memo={id(f):f}\n recursion_limit=sys.getrecursionlimit()\n while _is_wrapper(func):\n func=func.__wrapped__\n id_func=id(func)\n if (id_func in memo)or (len(memo)>=recursion_limit):\n raise ValueError('wrapper loop when unwrapping {!r}'.format(f))\n memo[id_func]=func\n return func\n \n \ndef indentsize(line):\n ''\n expline=line.expandtabs()\n return len(expline)-len(expline.lstrip())\n \ndef _findclass(func):\n cls=sys.modules.get(func.__module__)\n if cls is None :\n return None\n for name in func.__qualname__.split('.')[:-1]:\n cls=getattr(cls,name)\n if not isclass(cls):\n return None\n return cls\n \ndef _finddoc(obj):\n if isclass(obj):\n for base in obj.__mro__:\n if base is not object:\n try :\n doc=base.__doc__\n except AttributeError:\n continue\n if doc is not None :\n return doc\n return None\n \n if ismethod(obj):\n name=obj.__func__.__name__\n self=obj.__self__\n if (isclass(self)and\n getattr(getattr(self,name,None ),'__func__')is obj.__func__):\n \n cls=self\n else :\n cls=self.__class__\n elif isfunction(obj):\n name=obj.__name__\n cls=_findclass(obj)\n if cls is None or getattr(cls,name)is not obj:\n return None\n elif isbuiltin(obj):\n name=obj.__name__\n self=obj.__self__\n if (isclass(self)and\n self.__qualname__+'.'+name ==obj.__qualname__):\n \n cls=self\n else :\n cls=self.__class__\n \n elif isinstance(obj,property):\n func=obj.fget\n name=func.__name__\n cls=_findclass(func)\n if cls is None or getattr(cls,name)is not obj:\n return None\n elif ismethoddescriptor(obj)or isdatadescriptor(obj):\n name=obj.__name__\n cls=obj.__objclass__\n if getattr(cls,name)is not obj:\n return None\n if ismemberdescriptor(obj):\n slots=getattr(cls,'__slots__',None )\n if isinstance(slots,dict)and name in slots:\n return slots[name]\n else :\n return None\n for base in cls.__mro__:\n try :\n doc=getattr(base,name).__doc__\n except AttributeError:\n continue\n if doc is not None :\n return doc\n return None\n \ndef getdoc(object):\n ''\n\n\n\n \n try :\n doc=object.__doc__\n except AttributeError:\n return None\n if doc is None :\n try :\n doc=_finddoc(object)\n except (AttributeError,TypeError):\n return None\n if not isinstance(doc,str):\n return None\n return cleandoc(doc)\n \ndef cleandoc(doc):\n ''\n\n\n \n try :\n lines=doc.expandtabs().split('\\n')\n except UnicodeError:\n return None\n else :\n \n margin=sys.maxsize\n for line in lines[1:]:\n content=len(line.lstrip())\n if content:\n indent=len(line)-content\n margin=min(margin,indent)\n \n if lines:\n lines[0]=lines[0].lstrip()\n if margin ')\n self.generic_visit(node)\n self.stack.pop()\n self.stack.pop()\n \n visit_AsyncFunctionDef=visit_FunctionDef\n \n def visit_ClassDef(self,node):\n self.stack.append(node.name)\n if self.qualname =='.'.join(self.stack):\n \n if node.decorator_list:\n line_number=node.decorator_list[0].lineno\n else :\n line_number=node.lineno\n \n \n line_number -=1\n raise ClassFoundException(line_number)\n self.generic_visit(node)\n self.stack.pop()\n \n \ndef findsource(object):\n ''\n\n\n\n\n \n \n file=getsourcefile(object)\n if file:\n \n linecache.checkcache(file)\n else :\n file=getfile(object)\n \n \n \n if not (file.startswith('<')and file.endswith('>')):\n raise OSError('source code not available')\n \n module=getmodule(object,file)\n if module:\n lines=linecache.getlines(file,module.__dict__)\n else :\n lines=linecache.getlines(file)\n if not lines:\n raise OSError('could not get source code')\n \n if ismodule(object):\n return lines,0\n \n if isclass(object):\n qualname=object.__qualname__\n source=''.join(lines)\n tree=ast.parse(source)\n class_finder=_ClassFinder(qualname)\n try :\n class_finder.visit(tree)\n except ClassFoundException as e:\n line_number=e.args[0]\n return lines,line_number\n else :\n raise OSError('could not find class definition')\n \n if ismethod(object):\n object=object.__func__\n if isfunction(object):\n object=object.__code__\n if istraceback(object):\n object=object.tb_frame\n if isframe(object):\n object=object.f_code\n if iscode(object):\n if not hasattr(object,'co_firstlineno'):\n raise OSError('could not find function definition')\n lnum=object.co_firstlineno -1\n pat=re.compile(r'^(\\s*def\\s)|(\\s*async\\s+def\\s)|(.*(?0:\n try :\n line=lines[lnum]\n except IndexError:\n raise OSError('lineno is out of bounds')\n if pat.match(line):\n break\n lnum=lnum -1\n return lines,lnum\n raise OSError('could not find code object')\n \ndef getcomments(object):\n ''\n\n\n \n try :\n lines,lnum=findsource(object)\n except (OSError,TypeError):\n return None\n \n if ismodule(object):\n \n start=0\n if lines and lines[0][:2]=='#!':start=1\n while start 0:\n indent=indentsize(lines[lnum])\n end=lnum -1\n if end >=0 and lines[end].lstrip()[:1]=='#'and\\\n indentsize(lines[end])==indent:\n comments=[lines[end].expandtabs().lstrip()]\n if end >0:\n end=end -1\n comment=lines[end].expandtabs().lstrip()\n while comment[:1]=='#'and indentsize(lines[end])==indent:\n comments[:0]=[comment]\n end=end -1\n if end <0:break\n comment=lines[end].expandtabs().lstrip()\n while comments and comments[0].strip()=='#':\n comments[:1]=[]\n while comments and comments[-1].strip()=='#':\n comments[-1:]=[]\n return ''.join(comments)\n \nclass EndOfBlock(Exception):pass\n\nclass BlockFinder:\n ''\n def __init__(self):\n self.indent=0\n self.islambda=False\n self.started=False\n self.passline=False\n self.indecorator=False\n self.decoratorhasargs=False\n self.last=1\n self.body_col0=None\n \n def tokeneater(self,type,token,srowcol,erowcol,line):\n if not self.started and not self.indecorator:\n \n if token ==\"@\":\n self.indecorator=True\n \n elif token in (\"def\",\"class\",\"lambda\"):\n if token ==\"lambda\":\n self.islambda=True\n self.started=True\n self.passline=True\n elif token ==\"(\":\n if self.indecorator:\n self.decoratorhasargs=True\n elif token ==\")\":\n if self.indecorator:\n self.indecorator=False\n self.decoratorhasargs=False\n elif type ==tokenize.NEWLINE:\n self.passline=False\n self.last=srowcol[0]\n if self.islambda:\n raise EndOfBlock\n \n \n if self.indecorator and not self.decoratorhasargs:\n self.indecorator=False\n elif self.passline:\n pass\n elif type ==tokenize.INDENT:\n if self.body_col0 is None and self.started:\n self.body_col0=erowcol[1]\n self.indent=self.indent+1\n self.passline=True\n elif type ==tokenize.DEDENT:\n self.indent=self.indent -1\n \n \n \n if self.indent <=0:\n raise EndOfBlock\n elif type ==tokenize.COMMENT:\n if self.body_col0 is not None and srowcol[1]>=self.body_col0:\n \n self.last=srowcol[0]\n elif self.indent ==0 and type not in (tokenize.COMMENT,tokenize.NL):\n \n \n raise EndOfBlock\n \ndef getblock(lines):\n ''\n blockfinder=BlockFinder()\n try :\n tokens=tokenize.generate_tokens(iter(lines).__next__)\n for _token in tokens:\n blockfinder.tokeneater(*_token)\n except (EndOfBlock,IndentationError):\n pass\n return lines[:blockfinder.last]\n \ndef getsourcelines(object):\n ''\n\n\n\n\n\n \n object=unwrap(object)\n lines,lnum=findsource(object)\n \n if istraceback(object):\n object=object.tb_frame\n \n \n if (ismodule(object)or\n (isframe(object)and object.f_code.co_name ==\"\")):\n return lines,0\n else :\n return getblock(lines[lnum:]),lnum+1\n \ndef getsource(object):\n ''\n\n\n\n \n lines,lnum=getsourcelines(object)\n return ''.join(lines)\n \n \ndef walktree(classes,children,parent):\n ''\n results=[]\n classes.sort(key=attrgetter('__module__','__name__'))\n for c in classes:\n results.append((c,c.__bases__))\n if c in children:\n results.append(walktree(children[c],children,c))\n return results\n \ndef getclasstree(classes,unique=False ):\n ''\n\n\n\n\n\n\n \n children={}\n roots=[]\n for c in classes:\n if c.__bases__:\n for parent in c.__bases__:\n if parent not in children:\n children[parent]=[]\n if c not in children[parent]:\n children[parent].append(c)\n if unique and parent in classes:break\n elif c not in roots:\n roots.append(c)\n for parent in children:\n if parent not in classes:\n roots.append(parent)\n return walktree(roots,children,None )\n \n \nArguments=namedtuple('Arguments','args, varargs, varkw')\n\ndef getargs(co):\n ''\n\n\n\n\n \n if not iscode(co):\n raise TypeError('{!r} is not a code object'.format(co))\n \n names=co.co_varnames\n nargs=co.co_argcount\n nkwargs=co.co_kwonlyargcount\n args=list(names[:nargs])\n kwonlyargs=list(names[nargs:nargs+nkwargs])\n step=0\n \n nargs +=nkwargs\n varargs=None\n if co.co_flags&CO_VARARGS:\n varargs=co.co_varnames[nargs]\n nargs=nargs+1\n varkw=None\n if co.co_flags&CO_VARKEYWORDS:\n varkw=co.co_varnames[nargs]\n return Arguments(args+kwonlyargs,varargs,varkw)\n \n \nFullArgSpec=namedtuple('FullArgSpec',\n'args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations')\n\ndef getfullargspec(func):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n sig=_signature_from_callable(func,\n follow_wrapper_chains=False ,\n skip_bound_arg=False ,\n sigcls=Signature,\n eval_str=False )\n except Exception as ex:\n \n \n \n \n raise TypeError('unsupported callable')from ex\n \n args=[]\n varargs=None\n varkw=None\n posonlyargs=[]\n kwonlyargs=[]\n annotations={}\n defaults=()\n kwdefaults={}\n \n if sig.return_annotation is not sig.empty:\n annotations['return']=sig.return_annotation\n \n for param in sig.parameters.values():\n kind=param.kind\n name=param.name\n \n if kind is _POSITIONAL_ONLY:\n posonlyargs.append(name)\n if param.default is not param.empty:\n defaults +=(param.default,)\n elif kind is _POSITIONAL_OR_KEYWORD:\n args.append(name)\n if param.default is not param.empty:\n defaults +=(param.default,)\n elif kind is _VAR_POSITIONAL:\n varargs=name\n elif kind is _KEYWORD_ONLY:\n kwonlyargs.append(name)\n if param.default is not param.empty:\n kwdefaults[name]=param.default\n elif kind is _VAR_KEYWORD:\n varkw=name\n \n if param.annotation is not param.empty:\n annotations[name]=param.annotation\n \n if not kwdefaults:\n \n kwdefaults=None\n \n if not defaults:\n \n defaults=None\n \n return FullArgSpec(posonlyargs+args,varargs,varkw,defaults,\n kwonlyargs,kwdefaults,annotations)\n \n \nArgInfo=namedtuple('ArgInfo','args varargs keywords locals')\n\ndef getargvalues(frame):\n ''\n\n\n\n\n \n args,varargs,varkw=getargs(frame.f_code)\n return ArgInfo(args,varargs,varkw,frame.f_locals)\n \ndef formatannotation(annotation,base_module=None ):\n if getattr(annotation,'__module__',None )=='typing':\n return repr(annotation).replace('typing.','')\n if isinstance(annotation,types.GenericAlias):\n return str(annotation)\n if isinstance(annotation,type):\n if annotation.__module__ in ('builtins',base_module):\n return annotation.__qualname__\n return annotation.__module__+'.'+annotation.__qualname__\n return repr(annotation)\n \ndef formatannotationrelativeto(object):\n module=getattr(object,'__module__',None )\n def _formatannotation(annotation):\n return formatannotation(annotation,module)\n return _formatannotation\n \n \ndef formatargvalues(args,varargs,varkw,locals,\nformatarg=str,\nformatvarargs=lambda name:'*'+name,\nformatvarkw=lambda name:'**'+name,\nformatvalue=lambda value:'='+repr(value)):\n ''\n\n\n\n\n \n def convert(name,locals=locals,\n formatarg=formatarg,formatvalue=formatvalue):\n return formatarg(name)+formatvalue(locals[name])\n specs=[]\n for i in range(len(args)):\n specs.append(convert(args[i]))\n if varargs:\n specs.append(formatvarargs(varargs)+formatvalue(locals[varargs]))\n if varkw:\n specs.append(formatvarkw(varkw)+formatvalue(locals[varkw]))\n return '('+', '.join(specs)+')'\n \ndef _missing_arguments(f_name,argnames,pos,values):\n names=[repr(name)for name in argnames if name not in values]\n missing=len(names)\n if missing ==1:\n s=names[0]\n elif missing ==2:\n s=\"{} and {}\".format(*names)\n else :\n tail=\", {} and {}\".format(*names[-2:])\n del names[-2:]\n s=\", \".join(names)+tail\n raise TypeError(\"%s() missing %i required %s argument%s: %s\"%\n (f_name,missing,\n \"positional\"if pos else \"keyword-only\",\n \"\"if missing ==1 else \"s\",s))\n \ndef _too_many(f_name,args,kwonly,varargs,defcount,given,values):\n atleast=len(args)-defcount\n kwonly_given=len([arg for arg in kwonly if arg in values])\n if varargs:\n plural=atleast !=1\n sig=\"at least %d\"%(atleast,)\n elif defcount:\n plural=True\n sig=\"from %d to %d\"%(atleast,len(args))\n else :\n plural=len(args)!=1\n sig=str(len(args))\n kwonly_sig=\"\"\n if kwonly_given:\n msg=\" positional argument%s (and %d keyword-only argument%s)\"\n kwonly_sig=(msg %(\"s\"if given !=1 else \"\",kwonly_given,\n \"s\"if kwonly_given !=1 else \"\"))\n raise TypeError(\"%s() takes %s positional argument%s but %d%s %s given\"%\n (f_name,sig,\"s\"if plural else \"\",given,kwonly_sig,\n \"was\"if given ==1 and not kwonly_given else \"were\"))\n \ndef getcallargs(func,/,*positional,**named):\n ''\n\n\n\n \n spec=getfullargspec(func)\n args,varargs,varkw,defaults,kwonlyargs,kwonlydefaults,ann=spec\n f_name=func.__name__\n arg2value={}\n \n \n if ismethod(func)and func.__self__ is not None :\n \n positional=(func.__self__,)+positional\n num_pos=len(positional)\n num_args=len(args)\n num_defaults=len(defaults)if defaults else 0\n \n n=min(num_pos,num_args)\n for i in range(n):\n arg2value[args[i]]=positional[i]\n if varargs:\n arg2value[varargs]=tuple(positional[n:])\n possible_kwargs=set(args+kwonlyargs)\n if varkw:\n arg2value[varkw]={}\n for kw,value in named.items():\n if kw not in possible_kwargs:\n if not varkw:\n raise TypeError(\"%s() got an unexpected keyword argument %r\"%\n (f_name,kw))\n arg2value[varkw][kw]=value\n continue\n if kw in arg2value:\n raise TypeError(\"%s() got multiple values for argument %r\"%\n (f_name,kw))\n arg2value[kw]=value\n if num_pos >num_args and not varargs:\n _too_many(f_name,args,kwonlyargs,varargs,num_defaults,\n num_pos,arg2value)\n if num_pos 0:\n start=lineno -1 -context //2\n try :\n lines,lnum=findsource(frame)\n except OSError:\n lines=index=None\n else :\n start=max(0,min(start,len(lines)-context))\n lines=lines[start:start+context]\n index=lineno -1 -start\n else :\n lines=index=None\n \n return Traceback(filename,lineno,frame.f_code.co_name,lines,\n index,positions=dis.Positions(*positions))\n \ndef getlineno(frame):\n ''\n \n return frame.f_lineno\n \n_FrameInfo=namedtuple('_FrameInfo',('frame',)+Traceback._fields)\nclass FrameInfo(_FrameInfo):\n def __new__(cls,frame,filename,lineno,function,code_context,index,*,positions=None ):\n instance=super().__new__(cls,frame,filename,lineno,function,code_context,index)\n instance.positions=positions\n return instance\n \n def __repr__(self):\n return ('FrameInfo(frame={!r}, filename={!r}, lineno={!r}, function={!r}, '\n 'code_context={!r}, index={!r}, positions={!r})'.format(\n self.frame,self.filename,self.lineno,self.function,\n self.code_context,self.index,self.positions))\n \ndef getouterframes(frame,context=1):\n ''\n\n\n \n framelist=[]\n while frame:\n traceback_info=getframeinfo(frame,context)\n frameinfo=(frame,)+traceback_info\n framelist.append(FrameInfo(*frameinfo,positions=traceback_info.positions))\n frame=frame.f_back\n return framelist\n \ndef getinnerframes(tb,context=1):\n ''\n\n\n \n framelist=[]\n while tb:\n traceback_info=getframeinfo(tb,context)\n frameinfo=(tb.tb_frame,)+traceback_info\n framelist.append(FrameInfo(*frameinfo,positions=traceback_info.positions))\n tb=tb.tb_next\n return framelist\n \ndef currentframe():\n ''\n return sys._getframe(1)if hasattr(sys,\"_getframe\")else None\n \ndef stack(context=1):\n ''\n return getouterframes(sys._getframe(1),context)\n \ndef trace(context=1):\n ''\n return getinnerframes(sys.exc_info()[2],context)\n \n \n \n \n_sentinel=object()\n\ndef _static_getmro(klass):\n return type.__dict__['__mro__'].__get__(klass)\n \ndef _check_instance(obj,attr):\n instance_dict={}\n try :\n instance_dict=object.__getattribute__(obj,\"__dict__\")\n except AttributeError:\n pass\n return dict.get(instance_dict,attr,_sentinel)\n \n \ndef _check_class(klass,attr):\n for entry in _static_getmro(klass):\n if _shadowed_dict(type(entry))is _sentinel:\n try :\n return entry.__dict__[attr]\n except KeyError:\n pass\n return _sentinel\n \ndef _is_type(obj):\n try :\n _static_getmro(obj)\n except TypeError:\n return False\n return True\n \ndef _shadowed_dict(klass):\n dict_attr=type.__dict__[\"__dict__\"]\n for entry in _static_getmro(klass):\n try :\n class_dict=dict_attr.__get__(entry)[\"__dict__\"]\n except KeyError:\n pass\n else :\n if not (type(class_dict)is types.GetSetDescriptorType and\n class_dict.__name__ ==\"__dict__\"and\n class_dict.__objclass__ is entry):\n return class_dict\n return _sentinel\n \ndef getattr_static(obj,attr,default=_sentinel):\n ''\n\n\n\n\n\n\n\n\n \n instance_result=_sentinel\n if not _is_type(obj):\n klass=type(obj)\n dict_attr=_shadowed_dict(klass)\n if (dict_attr is _sentinel or\n type(dict_attr)is types.MemberDescriptorType):\n instance_result=_check_instance(obj,attr)\n else :\n klass=obj\n \n klass_result=_check_class(klass,attr)\n \n if instance_result is not _sentinel and klass_result is not _sentinel:\n if (_check_class(type(klass_result),'__get__')is not _sentinel and\n _check_class(type(klass_result),'__set__')is not _sentinel):\n return klass_result\n \n if instance_result is not _sentinel:\n return instance_result\n if klass_result is not _sentinel:\n return klass_result\n \n if obj is klass:\n \n for entry in _static_getmro(type(klass)):\n if _shadowed_dict(type(entry))is _sentinel:\n try :\n return entry.__dict__[attr]\n except KeyError:\n pass\n if default is not _sentinel:\n return default\n raise AttributeError(attr)\n \n \n \n \nGEN_CREATED='GEN_CREATED'\nGEN_RUNNING='GEN_RUNNING'\nGEN_SUSPENDED='GEN_SUSPENDED'\nGEN_CLOSED='GEN_CLOSED'\n\ndef getgeneratorstate(generator):\n ''\n\n\n\n\n\n\n \n if generator.gi_running:\n return GEN_RUNNING\n if generator.gi_suspended:\n return GEN_SUSPENDED\n if generator.gi_frame is None :\n return GEN_CLOSED\n return GEN_CREATED\n \n \ndef getgeneratorlocals(generator):\n ''\n\n\n\n \n \n if not isgenerator(generator):\n raise TypeError(\"{!r} is not a Python generator\".format(generator))\n \n frame=getattr(generator,\"gi_frame\",None )\n if frame is not None :\n return generator.gi_frame.f_locals\n else :\n return {}\n \n \n \n \nCORO_CREATED='CORO_CREATED'\nCORO_RUNNING='CORO_RUNNING'\nCORO_SUSPENDED='CORO_SUSPENDED'\nCORO_CLOSED='CORO_CLOSED'\n\ndef getcoroutinestate(coroutine):\n ''\n\n\n\n\n\n\n \n if coroutine.cr_running:\n return CORO_RUNNING\n if coroutine.cr_suspended:\n return CORO_SUSPENDED\n if coroutine.cr_frame is None :\n return CORO_CLOSED\n return CORO_CREATED\n \n \ndef getcoroutinelocals(coroutine):\n ''\n\n\n\n \n frame=getattr(coroutine,\"cr_frame\",None )\n if frame is not None :\n return frame.f_locals\n else :\n return {}\n \n \n \n \n \n \n \n_NonUserDefinedCallables=(types.WrapperDescriptorType,\ntypes.MethodWrapperType,\ntypes.ClassMethodDescriptorType,\ntypes.BuiltinFunctionType)\n\n\ndef _signature_get_user_defined_method(cls,method_name):\n ''\n\n\n \n try :\n meth=getattr(cls,method_name)\n except AttributeError:\n return\n else :\n if not isinstance(meth,_NonUserDefinedCallables):\n \n \n return meth\n \n \ndef _signature_get_partial(wrapped_sig,partial,extra_args=()):\n ''\n\n\n \n \n old_params=wrapped_sig.parameters\n new_params=OrderedDict(old_params.items())\n \n partial_args=partial.args or ()\n partial_keywords=partial.keywords or {}\n \n if extra_args:\n partial_args=extra_args+partial_args\n \n try :\n ba=wrapped_sig.bind_partial(*partial_args,**partial_keywords)\n except TypeError as ex:\n msg='partial object {!r} has incorrect arguments'.format(partial)\n raise ValueError(msg)from ex\n \n \n transform_to_kwonly=False\n for param_name,param in old_params.items():\n try :\n arg_value=ba.arguments[param_name]\n except KeyError:\n pass\n else :\n if param.kind is _POSITIONAL_ONLY:\n \n \n new_params.pop(param_name)\n continue\n \n if param.kind is _POSITIONAL_OR_KEYWORD:\n if param_name in partial_keywords:\n \n \n \n \n \n \n \n \n \n \n \n \n transform_to_kwonly=True\n \n new_params[param_name]=param.replace(default=arg_value)\n else :\n \n new_params.pop(param.name)\n continue\n \n if param.kind is _KEYWORD_ONLY:\n \n new_params[param_name]=param.replace(default=arg_value)\n \n if transform_to_kwonly:\n assert param.kind is not _POSITIONAL_ONLY\n \n if param.kind is _POSITIONAL_OR_KEYWORD:\n new_param=new_params[param_name].replace(kind=_KEYWORD_ONLY)\n new_params[param_name]=new_param\n new_params.move_to_end(param_name)\n elif param.kind in (_KEYWORD_ONLY,_VAR_KEYWORD):\n new_params.move_to_end(param_name)\n elif param.kind is _VAR_POSITIONAL:\n new_params.pop(param.name)\n \n return wrapped_sig.replace(parameters=new_params.values())\n \n \ndef _signature_bound_method(sig):\n ''\n\n \n \n params=tuple(sig.parameters.values())\n \n if not params or params[0].kind in (_VAR_KEYWORD,_KEYWORD_ONLY):\n raise ValueError('invalid method signature')\n \n kind=params[0].kind\n if kind in (_POSITIONAL_OR_KEYWORD,_POSITIONAL_ONLY):\n \n \n params=params[1:]\n else :\n if kind is not _VAR_POSITIONAL:\n \n \n raise ValueError('invalid argument type')\n \n \n \n return sig.replace(parameters=params)\n \n \ndef _signature_is_builtin(obj):\n ''\n\n \n return (isbuiltin(obj)or\n ismethoddescriptor(obj)or\n isinstance(obj,_NonUserDefinedCallables)or\n \n \n obj in (type,object))\n \n \ndef _signature_is_functionlike(obj):\n ''\n\n\n\n \n \n if not callable(obj)or isclass(obj):\n \n \n return False\n \n name=getattr(obj,'__name__',None )\n code=getattr(obj,'__code__',None )\n defaults=getattr(obj,'__defaults__',_void)\n kwdefaults=getattr(obj,'__kwdefaults__',_void)\n annotations=getattr(obj,'__annotations__',None )\n \n return (isinstance(code,types.CodeType)and\n isinstance(name,str)and\n (defaults is None or isinstance(defaults,tuple))and\n (kwdefaults is None or isinstance(kwdefaults,dict))and\n (isinstance(annotations,(dict))or annotations is None ))\n \n \ndef _signature_strip_non_python_syntax(signature):\n ''\n\n\n\n\n\n\n\n\n\n \n \n if not signature:\n return signature,None ,None\n \n self_parameter=None\n last_positional_only=None\n \n lines=[l.encode('ascii')for l in signature.split('\\n')]\n generator=iter(lines).__next__\n token_stream=tokenize.tokenize(generator)\n \n delayed_comma=False\n skip_next_comma=False\n text=[]\n add=text.append\n \n current_parameter=0\n OP=token.OP\n ERRORTOKEN=token.ERRORTOKEN\n \n \n t=next(token_stream)\n assert t.type ==tokenize.ENCODING\n \n for t in token_stream:\n type,string=t.type,t.string\n \n if type ==OP:\n if string ==',':\n if skip_next_comma:\n skip_next_comma=False\n else :\n assert not delayed_comma\n delayed_comma=True\n current_parameter +=1\n continue\n \n if string =='/':\n assert not skip_next_comma\n assert last_positional_only is None\n skip_next_comma=True\n last_positional_only=current_parameter -1\n continue\n \n if (type ==ERRORTOKEN)and (string =='$'):\n assert self_parameter is None\n self_parameter=current_parameter\n continue\n \n if delayed_comma:\n delayed_comma=False\n if not ((type ==OP)and (string ==')')):\n add(', ')\n add(string)\n if (string ==','):\n add(' ')\n clean_signature=''.join(text)\n return clean_signature,self_parameter,last_positional_only\n \n \ndef _signature_fromstr(cls,obj,s,skip_bound_arg=True ):\n ''\n\n \n Parameter=cls._parameter_cls\n \n clean_signature,self_parameter,last_positional_only=\\\n _signature_strip_non_python_syntax(s)\n \n program=\"def foo\"+clean_signature+\": pass\"\n \n try :\n module=ast.parse(program)\n except SyntaxError:\n module=None\n \n if not isinstance(module,ast.Module):\n raise ValueError(\"{!r} builtin has invalid signature\".format(obj))\n \n f=module.body[0]\n \n parameters=[]\n empty=Parameter.empty\n invalid=object()\n \n module=None\n module_dict={}\n module_name=getattr(obj,'__module__',None )\n if module_name:\n module=sys.modules.get(module_name,None )\n if module:\n module_dict=module.__dict__\n sys_module_dict=sys.modules.copy()\n \n def parse_name(node):\n assert isinstance(node,ast.arg)\n if node.annotation is not None :\n raise ValueError(\"Annotations are not currently supported\")\n return node.arg\n \n def wrap_value(s):\n try :\n value=eval(s,module_dict)\n except NameError:\n try :\n value=eval(s,sys_module_dict)\n except NameError:\n raise RuntimeError()\n \n if isinstance(value,(str,int,float,bytes,bool,type(None ))):\n return ast.Constant(value)\n raise RuntimeError()\n \n class RewriteSymbolics(ast.NodeTransformer):\n def visit_Attribute(self,node):\n a=[]\n n=node\n while isinstance(n,ast.Attribute):\n a.append(n.attr)\n n=n.value\n if not isinstance(n,ast.Name):\n raise RuntimeError()\n a.append(n.id)\n value=\".\".join(reversed(a))\n return wrap_value(value)\n \n def visit_Name(self,node):\n if not isinstance(node.ctx,ast.Load):\n raise ValueError()\n return wrap_value(node.id)\n \n def p(name_node,default_node,default=empty):\n name=parse_name(name_node)\n if name is invalid:\n return None\n if default_node and default_node is not _empty:\n try :\n default_node=RewriteSymbolics().visit(default_node)\n o=ast.literal_eval(default_node)\n except ValueError:\n o=invalid\n if o is invalid:\n return None\n default=o if o is not invalid else default\n parameters.append(Parameter(name,kind,default=default,annotation=empty))\n \n \n args=reversed(f.args.args)\n defaults=reversed(f.args.defaults)\n iter=itertools.zip_longest(args,defaults,fillvalue=None )\n if last_positional_only is not None :\n kind=Parameter.POSITIONAL_ONLY\n else :\n kind=Parameter.POSITIONAL_OR_KEYWORD\n for i,(name,default)in enumerate(reversed(list(iter))):\n p(name,default)\n if i ==last_positional_only:\n kind=Parameter.POSITIONAL_OR_KEYWORD\n \n \n if f.args.vararg:\n kind=Parameter.VAR_POSITIONAL\n p(f.args.vararg,empty)\n \n \n kind=Parameter.KEYWORD_ONLY\n for name,default in zip(f.args.kwonlyargs,f.args.kw_defaults):\n p(name,default)\n \n \n if f.args.kwarg:\n kind=Parameter.VAR_KEYWORD\n p(f.args.kwarg,empty)\n \n if self_parameter is not None :\n \n \n \n \n \n assert parameters\n _self=getattr(obj,'__self__',None )\n self_isbound=_self is not None\n self_ismodule=ismodule(_self)\n if self_isbound and (self_ismodule or skip_bound_arg):\n parameters.pop(0)\n else :\n \n p=parameters[0].replace(kind=Parameter.POSITIONAL_ONLY)\n parameters[0]=p\n \n return cls(parameters,return_annotation=cls.empty)\n \n \ndef _signature_from_builtin(cls,func,skip_bound_arg=True ):\n ''\n\n \n \n if not _signature_is_builtin(func):\n raise TypeError(\"{!r} is not a Python builtin \"\n \"function\".format(func))\n \n s=getattr(func,\"__text_signature__\",None )\n if not s:\n raise ValueError(\"no signature found for builtin {!r}\".format(func))\n \n return _signature_fromstr(cls,func,s,skip_bound_arg)\n \n \ndef _signature_from_function(cls,func,skip_bound_arg=True ,\nglobals=None ,locals=None ,eval_str=False ):\n ''\n \n is_duck_function=False\n if not isfunction(func):\n if _signature_is_functionlike(func):\n is_duck_function=True\n else :\n \n \n raise TypeError('{!r} is not a Python function'.format(func))\n \n s=getattr(func,\"__text_signature__\",None )\n if s:\n return _signature_fromstr(cls,func,s,skip_bound_arg)\n \n Parameter=cls._parameter_cls\n \n \n func_code=func.__code__\n pos_count=func_code.co_argcount\n arg_names=func_code.co_varnames\n posonly_count=func_code.co_posonlyargcount\n positional=arg_names[:pos_count]\n keyword_only_count=func_code.co_kwonlyargcount\n keyword_only=arg_names[pos_count:pos_count+keyword_only_count]\n annotations=get_annotations(func,globals=globals,locals=locals,eval_str=eval_str)\n defaults=func.__defaults__\n kwdefaults=func.__kwdefaults__\n \n if defaults:\n pos_default_count=len(defaults)\n else :\n pos_default_count=0\n \n parameters=[]\n \n non_default_count=pos_count -pos_default_count\n posonly_left=posonly_count\n \n \n for name in positional[:non_default_count]:\n kind=_POSITIONAL_ONLY if posonly_left else _POSITIONAL_OR_KEYWORD\n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=kind))\n if posonly_left:\n posonly_left -=1\n \n \n for offset,name in enumerate(positional[non_default_count:]):\n kind=_POSITIONAL_ONLY if posonly_left else _POSITIONAL_OR_KEYWORD\n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=kind,\n default=defaults[offset]))\n if posonly_left:\n posonly_left -=1\n \n \n if func_code.co_flags&CO_VARARGS:\n name=arg_names[pos_count+keyword_only_count]\n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=_VAR_POSITIONAL))\n \n \n for name in keyword_only:\n default=_empty\n if kwdefaults is not None :\n default=kwdefaults.get(name,_empty)\n \n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=_KEYWORD_ONLY,\n default=default))\n \n if func_code.co_flags&CO_VARKEYWORDS:\n index=pos_count+keyword_only_count\n if func_code.co_flags&CO_VARARGS:\n index +=1\n \n name=arg_names[index]\n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=_VAR_KEYWORD))\n \n \n \n return cls(parameters,\n return_annotation=annotations.get('return',_empty),\n __validate_parameters__=is_duck_function)\n \n \ndef _signature_from_callable(obj,*,\nfollow_wrapper_chains=True ,\nskip_bound_arg=True ,\nglobals=None ,\nlocals=None ,\neval_str=False ,\nsigcls):\n\n ''\n\n \n \n _get_signature_of=functools.partial(_signature_from_callable,\n follow_wrapper_chains=follow_wrapper_chains,\n skip_bound_arg=skip_bound_arg,\n globals=globals,\n locals=locals,\n sigcls=sigcls,\n eval_str=eval_str)\n \n if not callable(obj):\n raise TypeError('{!r} is not a callable object'.format(obj))\n \n if isinstance(obj,types.MethodType):\n \n \n sig=_get_signature_of(obj.__func__)\n \n if skip_bound_arg:\n return _signature_bound_method(sig)\n else :\n return sig\n \n \n if follow_wrapper_chains:\n obj=unwrap(obj,stop=(lambda f:hasattr(f,\"__signature__\")))\n if isinstance(obj,types.MethodType):\n \n \n \n return _get_signature_of(obj)\n \n try :\n sig=obj.__signature__\n except AttributeError:\n pass\n else :\n if sig is not None :\n if not isinstance(sig,Signature):\n raise TypeError(\n 'unexpected object {!r} in __signature__ '\n 'attribute'.format(sig))\n return sig\n \n try :\n partialmethod=obj._partialmethod\n except AttributeError:\n pass\n else :\n if isinstance(partialmethod,functools.partialmethod):\n \n \n \n \n \n \n \n wrapped_sig=_get_signature_of(partialmethod.func)\n \n sig=_signature_get_partial(wrapped_sig,partialmethod,(None ,))\n first_wrapped_param=tuple(wrapped_sig.parameters.values())[0]\n if first_wrapped_param.kind is Parameter.VAR_POSITIONAL:\n \n \n return sig\n else :\n sig_params=tuple(sig.parameters.values())\n assert (not sig_params or\n first_wrapped_param is not sig_params[0])\n new_params=(first_wrapped_param,)+sig_params\n return sig.replace(parameters=new_params)\n \n if isfunction(obj)or _signature_is_functionlike(obj):\n \n \n return _signature_from_function(sigcls,obj,\n skip_bound_arg=skip_bound_arg,\n globals=globals,locals=locals,eval_str=eval_str)\n \n if _signature_is_builtin(obj):\n return _signature_from_builtin(sigcls,obj,\n skip_bound_arg=skip_bound_arg)\n \n if isinstance(obj,functools.partial):\n wrapped_sig=_get_signature_of(obj.func)\n return _signature_get_partial(wrapped_sig,obj)\n \n sig=None\n if isinstance(obj,type):\n \n \n \n \n call=_signature_get_user_defined_method(type(obj),'__call__')\n if call is not None :\n sig=_get_signature_of(call)\n else :\n factory_method=None\n new=_signature_get_user_defined_method(obj,'__new__')\n init=_signature_get_user_defined_method(obj,'__init__')\n \n if '__new__'in obj.__dict__:\n factory_method=new\n \n elif '__init__'in obj.__dict__:\n factory_method=init\n \n elif new is not None :\n factory_method=new\n elif init is not None :\n factory_method=init\n \n if factory_method is not None :\n sig=_get_signature_of(factory_method)\n \n if sig is None :\n \n \n \n for base in obj.__mro__[:-1]:\n \n \n \n \n \n \n \n try :\n text_sig=base.__text_signature__\n except AttributeError:\n pass\n else :\n if text_sig:\n \n \n return _signature_fromstr(sigcls,base,text_sig)\n \n \n \n \n if type not in obj.__mro__:\n \n \n if (obj.__init__ is object.__init__ and\n obj.__new__ is object.__new__):\n \n return sigcls.from_callable(object)\n else :\n raise ValueError(\n 'no signature found for builtin type {!r}'.format(obj))\n \n elif not isinstance(obj,_NonUserDefinedCallables):\n \n \n \n \n call=_signature_get_user_defined_method(type(obj),'__call__')\n if call is not None :\n try :\n sig=_get_signature_of(call)\n except ValueError as ex:\n msg='no signature found for {!r}'.format(obj)\n raise ValueError(msg)from ex\n \n if sig is not None :\n \n \n if skip_bound_arg:\n return _signature_bound_method(sig)\n else :\n return sig\n \n if isinstance(obj,types.BuiltinFunctionType):\n \n msg='no signature found for builtin function {!r}'.format(obj)\n raise ValueError(msg)\n \n raise ValueError('callable {!r} is not supported by signature'.format(obj))\n \n \nclass _void:\n ''\n \n \nclass _empty:\n ''\n \n \nclass _ParameterKind(enum.IntEnum):\n POSITIONAL_ONLY='positional-only'\n POSITIONAL_OR_KEYWORD='positional or keyword'\n VAR_POSITIONAL='variadic positional'\n KEYWORD_ONLY='keyword-only'\n VAR_KEYWORD='variadic keyword'\n \n def __new__(cls,description):\n value=len(cls.__members__)\n member=int.__new__(cls,value)\n member._value_=value\n member.description=description\n return member\n \n def __str__(self):\n return self.name\n \n_POSITIONAL_ONLY=_ParameterKind.POSITIONAL_ONLY\n_POSITIONAL_OR_KEYWORD=_ParameterKind.POSITIONAL_OR_KEYWORD\n_VAR_POSITIONAL=_ParameterKind.VAR_POSITIONAL\n_KEYWORD_ONLY=_ParameterKind.KEYWORD_ONLY\n_VAR_KEYWORD=_ParameterKind.VAR_KEYWORD\n\n\nclass Parameter:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('_name','_kind','_default','_annotation')\n \n POSITIONAL_ONLY=_POSITIONAL_ONLY\n POSITIONAL_OR_KEYWORD=_POSITIONAL_OR_KEYWORD\n VAR_POSITIONAL=_VAR_POSITIONAL\n KEYWORD_ONLY=_KEYWORD_ONLY\n VAR_KEYWORD=_VAR_KEYWORD\n \n empty=_empty\n \n def __init__(self,name,kind,*,default=_empty,annotation=_empty):\n try :\n self._kind=_ParameterKind(kind)\n except ValueError:\n raise ValueError(f'value {kind!r} is not a valid Parameter.kind')\n if default is not _empty:\n if self._kind in (_VAR_POSITIONAL,_VAR_KEYWORD):\n msg='{} parameters cannot have default values'\n msg=msg.format(self._kind.description)\n raise ValueError(msg)\n self._default=default\n self._annotation=annotation\n \n if name is _empty:\n raise ValueError('name is a required attribute for Parameter')\n \n if not isinstance(name,str):\n msg='name must be a str, not a {}'.format(type(name).__name__)\n raise TypeError(msg)\n \n if name[0]=='.'and name[1:].isdigit():\n \n \n \n \n if self._kind !=_POSITIONAL_OR_KEYWORD:\n msg=(\n 'implicit arguments must be passed as '\n 'positional or keyword arguments, not {}'\n )\n msg=msg.format(self._kind.description)\n raise ValueError(msg)\n self._kind=_POSITIONAL_ONLY\n name='implicit{}'.format(name[1:])\n \n \n \n is_keyword=iskeyword(name)and self._kind is not _POSITIONAL_ONLY\n if is_keyword or not name.isidentifier():\n raise ValueError('{!r} is not a valid parameter name'.format(name))\n \n self._name=name\n \n def __reduce__(self):\n return (type(self),\n (self._name,self._kind),\n {'_default':self._default,\n '_annotation':self._annotation})\n \n def __setstate__(self,state):\n self._default=state['_default']\n self._annotation=state['_annotation']\n \n @property\n def name(self):\n return self._name\n \n @property\n def default(self):\n return self._default\n \n @property\n def annotation(self):\n return self._annotation\n \n @property\n def kind(self):\n return self._kind\n \n def replace(self,*,name=_void,kind=_void,\n annotation=_void,default=_void):\n ''\n \n if name is _void:\n name=self._name\n \n if kind is _void:\n kind=self._kind\n \n if annotation is _void:\n annotation=self._annotation\n \n if default is _void:\n default=self._default\n \n return type(self)(name,kind,default=default,annotation=annotation)\n \n def __str__(self):\n kind=self.kind\n formatted=self._name\n \n \n if self._annotation is not _empty:\n formatted='{}: {}'.format(formatted,\n formatannotation(self._annotation))\n \n if self._default is not _empty:\n if self._annotation is not _empty:\n formatted='{} = {}'.format(formatted,repr(self._default))\n else :\n formatted='{}={}'.format(formatted,repr(self._default))\n \n if kind ==_VAR_POSITIONAL:\n formatted='*'+formatted\n elif kind ==_VAR_KEYWORD:\n formatted='**'+formatted\n \n return formatted\n \n def __repr__(self):\n return '<{} \"{}\">'.format(self.__class__.__name__,self)\n \n def __hash__(self):\n return hash((self.name,self.kind,self.annotation,self.default))\n \n def __eq__(self,other):\n if self is other:\n return True\n if not isinstance(other,Parameter):\n return NotImplemented\n return (self._name ==other._name and\n self._kind ==other._kind and\n self._default ==other._default and\n self._annotation ==other._annotation)\n \n \nclass BoundArguments:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('arguments','_signature','__weakref__')\n \n def __init__(self,signature,arguments):\n self.arguments=arguments\n self._signature=signature\n \n @property\n def signature(self):\n return self._signature\n \n @property\n def args(self):\n args=[]\n for param_name,param in self._signature.parameters.items():\n if param.kind in (_VAR_KEYWORD,_KEYWORD_ONLY):\n break\n \n try :\n arg=self.arguments[param_name]\n except KeyError:\n \n \n break\n else :\n if param.kind ==_VAR_POSITIONAL:\n \n args.extend(arg)\n else :\n \n args.append(arg)\n \n return tuple(args)\n \n @property\n def kwargs(self):\n kwargs={}\n kwargs_started=False\n for param_name,param in self._signature.parameters.items():\n if not kwargs_started:\n if param.kind in (_VAR_KEYWORD,_KEYWORD_ONLY):\n kwargs_started=True\n else :\n if param_name not in self.arguments:\n kwargs_started=True\n continue\n \n if not kwargs_started:\n continue\n \n try :\n arg=self.arguments[param_name]\n except KeyError:\n pass\n else :\n if param.kind ==_VAR_KEYWORD:\n \n kwargs.update(arg)\n else :\n \n kwargs[param_name]=arg\n \n return kwargs\n \n def apply_defaults(self):\n ''\n\n\n\n\n\n\n \n arguments=self.arguments\n new_arguments=[]\n for name,param in self._signature.parameters.items():\n try :\n new_arguments.append((name,arguments[name]))\n except KeyError:\n if param.default is not _empty:\n val=param.default\n elif param.kind is _VAR_POSITIONAL:\n val=()\n elif param.kind is _VAR_KEYWORD:\n val={}\n else :\n \n \n continue\n new_arguments.append((name,val))\n self.arguments=dict(new_arguments)\n \n def __eq__(self,other):\n if self is other:\n return True\n if not isinstance(other,BoundArguments):\n return NotImplemented\n return (self.signature ==other.signature and\n self.arguments ==other.arguments)\n \n def __setstate__(self,state):\n self._signature=state['_signature']\n self.arguments=state['arguments']\n \n def __getstate__(self):\n return {'_signature':self._signature,'arguments':self.arguments}\n \n def __repr__(self):\n args=[]\n for arg,value in self.arguments.items():\n args.append('{}={!r}'.format(arg,value))\n return '<{} ({})>'.format(self.__class__.__name__,', '.join(args))\n \n \nclass Signature:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('_return_annotation','_parameters')\n \n _parameter_cls=Parameter\n _bound_arguments_cls=BoundArguments\n \n empty=_empty\n \n def __init__(self,parameters=None ,*,return_annotation=_empty,\n __validate_parameters__=True ):\n ''\n\n \n \n if parameters is None :\n params=OrderedDict()\n else :\n if __validate_parameters__:\n params=OrderedDict()\n top_kind=_POSITIONAL_ONLY\n kind_defaults=False\n \n for param in parameters:\n kind=param.kind\n name=param.name\n \n if kind top_kind:\n kind_defaults=False\n top_kind=kind\n \n if kind in (_POSITIONAL_ONLY,_POSITIONAL_OR_KEYWORD):\n if param.default is _empty:\n if kind_defaults:\n \n \n \n msg='non-default argument follows default '\\\n 'argument'\n raise ValueError(msg)\n else :\n \n kind_defaults=True\n \n if name in params:\n msg='duplicate parameter name: {!r}'.format(name)\n raise ValueError(msg)\n \n params[name]=param\n else :\n params=OrderedDict((param.name,param)for param in parameters)\n \n self._parameters=types.MappingProxyType(params)\n self._return_annotation=return_annotation\n \n @classmethod\n def from_callable(cls,obj,*,\n follow_wrapped=True ,globals=None ,locals=None ,eval_str=False ):\n ''\n return _signature_from_callable(obj,sigcls=cls,\n follow_wrapper_chains=follow_wrapped,\n globals=globals,locals=locals,eval_str=eval_str)\n \n @property\n def parameters(self):\n return self._parameters\n \n @property\n def return_annotation(self):\n return self._return_annotation\n \n def replace(self,*,parameters=_void,return_annotation=_void):\n ''\n\n\n \n \n if parameters is _void:\n parameters=self.parameters.values()\n \n if return_annotation is _void:\n return_annotation=self._return_annotation\n \n return type(self)(parameters,\n return_annotation=return_annotation)\n \n def _hash_basis(self):\n params=tuple(param for param in self.parameters.values()\n if param.kind !=_KEYWORD_ONLY)\n \n kwo_params={param.name:param for param in self.parameters.values()\n if param.kind ==_KEYWORD_ONLY}\n \n return params,kwo_params,self.return_annotation\n \n def __hash__(self):\n params,kwo_params,return_annotation=self._hash_basis()\n kwo_params=frozenset(kwo_params.values())\n return hash((params,kwo_params,return_annotation))\n \n def __eq__(self,other):\n if self is other:\n return True\n if not isinstance(other,Signature):\n return NotImplemented\n return self._hash_basis()==other._hash_basis()\n \n def _bind(self,args,kwargs,*,partial=False ):\n ''\n \n arguments={}\n \n parameters=iter(self.parameters.values())\n parameters_ex=()\n arg_vals=iter(args)\n \n while True :\n \n \n try :\n arg_val=next(arg_vals)\n except StopIteration:\n \n try :\n param=next(parameters)\n except StopIteration:\n \n \n break\n else :\n if param.kind ==_VAR_POSITIONAL:\n \n \n break\n elif param.name in kwargs:\n if param.kind ==_POSITIONAL_ONLY:\n msg='{arg!r} parameter is positional only, '\\\n 'but was passed as a keyword'\n msg=msg.format(arg=param.name)\n raise TypeError(msg)from None\n parameters_ex=(param,)\n break\n elif (param.kind ==_VAR_KEYWORD or\n param.default is not _empty):\n \n \n \n parameters_ex=(param,)\n break\n else :\n \n \n if partial:\n parameters_ex=(param,)\n break\n else :\n msg='missing a required argument: {arg!r}'\n msg=msg.format(arg=param.name)\n raise TypeError(msg)from None\n else :\n \n try :\n param=next(parameters)\n except StopIteration:\n raise TypeError('too many positional arguments')from None\n else :\n if param.kind in (_VAR_KEYWORD,_KEYWORD_ONLY):\n \n \n raise TypeError(\n 'too many positional arguments')from None\n \n if param.kind ==_VAR_POSITIONAL:\n \n \n \n values=[arg_val]\n values.extend(arg_vals)\n arguments[param.name]=tuple(values)\n break\n \n if param.name in kwargs and param.kind !=_POSITIONAL_ONLY:\n raise TypeError(\n 'multiple values for argument {arg!r}'.format(\n arg=param.name))from None\n \n arguments[param.name]=arg_val\n \n \n \n kwargs_param=None\n for param in itertools.chain(parameters_ex,parameters):\n if param.kind ==_VAR_KEYWORD:\n \n kwargs_param=param\n continue\n \n if param.kind ==_VAR_POSITIONAL:\n \n \n \n continue\n \n param_name=param.name\n try :\n arg_val=kwargs.pop(param_name)\n except KeyError:\n \n \n \n \n if (not partial and param.kind !=_VAR_POSITIONAL and\n param.default is _empty):\n raise TypeError('missing a required argument: {arg!r}'.\\\n format(arg=param_name))from None\n \n else :\n if param.kind ==_POSITIONAL_ONLY:\n \n \n \n raise TypeError('{arg!r} parameter is positional only, '\n 'but was passed as a keyword'.\\\n format(arg=param.name))\n \n arguments[param_name]=arg_val\n \n if kwargs:\n if kwargs_param is not None :\n \n arguments[kwargs_param.name]=kwargs\n else :\n raise TypeError(\n 'got an unexpected keyword argument {arg!r}'.format(\n arg=next(iter(kwargs))))\n \n return self._bound_arguments_cls(self,arguments)\n \n def bind(self,/,*args,**kwargs):\n ''\n\n\n \n return self._bind(args,kwargs)\n \n def bind_partial(self,/,*args,**kwargs):\n ''\n\n\n \n return self._bind(args,kwargs,partial=True )\n \n def __reduce__(self):\n return (type(self),\n (tuple(self._parameters.values()),),\n {'_return_annotation':self._return_annotation})\n \n def __setstate__(self,state):\n self._return_annotation=state['_return_annotation']\n \n def __repr__(self):\n return '<{} {}>'.format(self.__class__.__name__,self)\n \n def __str__(self):\n result=[]\n render_pos_only_separator=False\n render_kw_only_separator=True\n for param in self.parameters.values():\n formatted=str(param)\n \n kind=param.kind\n \n if kind ==_POSITIONAL_ONLY:\n render_pos_only_separator=True\n elif render_pos_only_separator:\n \n \n result.append('/')\n render_pos_only_separator=False\n \n if kind ==_VAR_POSITIONAL:\n \n \n render_kw_only_separator=False\n elif kind ==_KEYWORD_ONLY and render_kw_only_separator:\n \n \n \n result.append('*')\n \n \n render_kw_only_separator=False\n \n result.append(formatted)\n \n if render_pos_only_separator:\n \n \n result.append('/')\n \n rendered='({})'.format(', '.join(result))\n \n if self.return_annotation is not _empty:\n anno=formatannotation(self.return_annotation)\n rendered +=' -> {}'.format(anno)\n \n return rendered\n \n \ndef signature(obj,*,follow_wrapped=True ,globals=None ,locals=None ,eval_str=False ):\n ''\n return Signature.from_callable(obj,follow_wrapped=follow_wrapped,\n globals=globals,locals=locals,eval_str=eval_str)\n \n \ndef _main():\n ''\n import argparse\n import importlib\n \n parser=argparse.ArgumentParser()\n parser.add_argument(\n 'object',\n help=\"The object to be analysed. \"\n \"It supports the 'module:qualname' syntax\")\n parser.add_argument(\n '-d','--details',action='store_true',\n help='Display info about the module rather than its source code')\n \n args=parser.parse_args()\n \n target=args.object\n mod_name,has_attrs,attrs=target.partition(\":\")\n try :\n obj=module=importlib.import_module(mod_name)\n except Exception as exc:\n msg=\"Failed to import {} ({}: {})\".format(mod_name,\n type(exc).__name__,\n exc)\n print(msg,file=sys.stderr)\n sys.exit(2)\n \n if has_attrs:\n parts=attrs.split(\".\")\n obj=module\n for part in parts:\n obj=getattr(obj,part)\n \n if module.__name__ in sys.builtin_module_names:\n print(\"Can't get info for builtin modules.\",file=sys.stderr)\n sys.exit(1)\n \n if args.details:\n print('Target: {}'.format(target))\n print('Origin: {}'.format(getsourcefile(module)))\n print('Cached: {}'.format(module.__cached__))\n if obj is module:\n print('Loader: {}'.format(repr(module.__loader__)))\n if hasattr(module,'__path__'):\n print('Submodule search path: {}'.format(module.__path__))\n else :\n try :\n __,lineno=findsource(obj)\n except Exception:\n pass\n else :\n print('Line: {}'.format(lineno))\n \n print('\\n')\n else :\n print(getsource(obj))\n \n \nif __name__ ==\"__main__\":\n _main()\n", ["abc", "argparse", "ast", "builtins", "collections", "collections.abc", "dis", "enum", "functools", "importlib", "importlib.machinery", "itertools", "keyword", "linecache", "operator", "os", "re", "sys", "token", "tokenize", "types"]], "interpreter": [".py", "import sys\nimport builtins\nimport re\n\nimport tb as traceback\n\nfrom browser import console,document,window,html,DOMNode\nfrom browser.widgets.dialog import Dialog\n\n_credits=\"\"\" Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands\n for supporting Python development. See www.python.org for more information.\"\"\"\n\n_copyright=\"\"\"Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com\nAll Rights Reserved.\n\nCopyright (c) 2001-2022 Python Software Foundation.\nAll Rights Reserved.\n\nCopyright (c) 2000 BeOpen.com.\nAll Rights Reserved.\n\nCopyright (c) 1995-2001 Corporation for National Research Initiatives.\nAll Rights Reserved.\n\nCopyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\nAll Rights Reserved.\"\"\"\n\n_help=\"Type help() for interactive help, or help(object) for help about object.\"\n\n_license=\"\"\"Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer. Redistributions in binary\nform must reproduce the above copyright notice, this list of conditions and\nthe following disclaimer in the documentation and/or other materials provided\nwith the distribution.\nNeither the name of the nor the names of its contributors may\nbe used to endorse or promote products derived from this software without\nspecific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\"\"\"\n\nclass Info:\n\n def __init__(self,msg):\n self.msg=msg\n \n def __repr__(self):\n return self.msg\n \n \n \neditor_ns={\n'credits':Info(_credits),\n'copyright':Info(_copyright),\n'license':Info(_license),\n'__annotations__':{},\n'__builtins__':builtins,\n'__doc__':None,\n'__file__':'',\n'__name__':'__main__'\n}\n\n\nstyle_sheet=\"\"\"\n.brython-interpreter {\n background-color: #000;\n color: #fff;\n font-family: consolas, courier;\n caret-color: #fff;\n overflow-y: auto;\n overflow-x: hidden;\n}\n\n@keyframes blinker {\n 50% {\n opacity: 0;\n }\n}\n\npre{\n display:inline;\n}\n\"\"\"\n\nactive=[]\n\nclass Output:\n\n def __init__(self,interpreter):\n self.interpreter=interpreter\n \n def write(self,*args,**kw):\n self.interpreter.write(*args,**kw)\n \n def __len__(self):\n return len(self.interpreter.buffer)\n \n \n \n \ncolor_character_pattern=re.compile(r'^\\033\\[([0-9;]*)m')\n\ndef swap_color_bgcolor(element):\n ''\n element.style.color,element.style.backgroundColor=\\\n element.style.backgroundColor,element.style.color\n \ncc_styles={\n0:[\"fontStyle\",\"normal\"],\n1:[\"fontWeight\",\"bold\"],\n2:[\"fontWeight\",\"lighter\"],\n3:[\"fontStyle\",\"italic\"],\n4:[\"textDecoration\",\"underline\"],\n5:[\"animation\",\"blinker 1s step-start infinite\"],\n6:[\"animation\",\"blinker 0.5s step-start infinite\"],\n7:swap_color_bgcolor\n}\n\ncc_colors={\n30:\"Black\",\n31:\"Red\",\n32:\"Green\",\n33:\"Yellow\",\n34:\"Blue\",\n35:\"Magenta\",\n36:\"Cyan\",\n37:\"White\"\n}\n\ncc_bgcolors={k+10:v for(k,v)in cc_colors.items()}\n\n\nclass Trace:\n\n def __init__(self,exc):\n self.buf=\"\"\n self.is_syntax_error=exc.__name__ in['SyntaxError',\n 'IndentationError']\n \n def write(self,data):\n self.buf +=str(data)\n \n def format(self):\n ''\n lines=self.buf.strip().split(\"\\n\")\n stripped=[lines[0]]if not self.is_syntax_error else['']\n for i in range(1,len(lines),2):\n if __file__ in lines[i]:\n continue\n stripped +=lines[i:i+2]\n return \"\\n\".join(stripped)\n \n \nclass Interpreter:\n ''\n \n def __init__(self,elt_id=None,title=\"Interactive Interpreter\",\n globals=None,locals=None,history=None,\n rows=30,cols=120,default_css=True,\n clear_zone=True,banner=True):\n ''\n\n\n\n\n\n \n if default_css:\n \n for stylesheet in document.styleSheets:\n if stylesheet.ownerNode.id ==\"brython-interpreter\":\n break\n else:\n document <=html.STYLE(style_sheet,id=\"brython-interpreter\")\n \n self.cc_style=None\n self.cc_color=None\n self.cc_bgcolor=None\n self.default_cc_color='#fff'\n self.default_cc_bgcolor='#000'\n \n if elt_id is None:\n self.dialog=Dialog(title=title,top=10,left=10,\n default_css=default_css)\n self.dialog.bind('blur',self.blur)\n self.dialog.bind('click',self.focus)\n self.dialog.close_button.bind('click',self.close)\n self.zone=html.DIV(Class=\"brython-interpreter\",\n contenteditable=True)\n self.zone.style.width=f'{cols}ch'\n self.zone.style.height=f'{rows}ch'\n self.dialog.panel <=self.zone\n else:\n if isinstance(elt_id,str):\n try:\n elt=document[elt_id]\n if elt.tagName !=\"DIV\":\n raise ValueError(\n f\"element {elt_id} is a {elt.tagName}, \"+\n \"not a DIV\")\n self.zone=elt\n except KeyError:\n raise KeyError(f\"no element with id '{elt_id}'\")\n elif isinstance(elt_id,DOMNode):\n if elt_id.tagName ==\"DIV\":\n self.zone=elt_id\n else:\n raise ValueError(\"element is not a DIV\")\n else:\n raise ValueError(\"element should be a string or \"+\n f\"a DIV, got '{elt_id.__class__.__name__}'\")\n if self.zone.contentEditable !='true':\n raise ValueError(\"DIV element must be contenteditable\")\n v=sys.implementation.version\n if clear_zone:\n self.clear()\n if banner:\n self.insert(\n f\"Brython {v[0]}.{v[1]}.{v[2]} on \"\n f\"{window.navigator.appName} {window.navigator.appVersion}\"\n \"\\n\"\n )\n self.insert('Type \"help\", \"copyright\", \"credits\" '\n 'or \"license\" for more information.'+'\\n')\n self.insert_prompt()\n \n self._status=\"main\"\n self.history=history or[]\n self.current=len(self.history)\n \n self.globals={}if globals is None else globals\n self.globals.update(editor_ns)\n self.locals=self.globals if locals is None else locals\n \n self.zone.bind('keypress',self.keypress)\n self.zone.bind('keydown',self.keydown)\n self.zone.bind('mouseup',self.mouseup)\n \n self.zone.bind('focus',self.focus)\n self.zone.bind('blur',self.blur)\n self.focus()\n \n self.cursor_to_end()\n \n active.append(self)\n \n def clear(self):\n self.zone.text=''\n \n def insert(self,text):\n \n pre=html.PRE(style=\"display:inline;white-space:pre-wrap;\")\n pre.text=text\n if self.cc_color is not None:\n pre.style.color=self.cc_color\n if self.cc_bgcolor is not None:\n pre.style.backgroundColor=self.cc_bgcolor\n if self.cc_style is not None:\n style=cc_styles[self.cc_style]\n if isinstance(style,list):\n attr,value=style\n setattr(pre.style,attr,value)\n else:\n style(pre)\n self.zone <=pre\n \n def insert_prompt(self):\n self.insert('>>> ')\n \n def insert_continuation(self):\n self.insert('\\n... ')\n \n def insert_cr(self):\n self.insert('\\n')\n \n def get_content(self):\n return self.zone.text\n \n def blur(self,ev):\n if hasattr(self,'dialog'):\n self.dialog.style.zIndex=0\n \n def close(self,ev):\n active.remove(self)\n \n def cursor_to_end(self,*args):\n \n sel=window.getSelection()\n \n last_child=self.zone.lastChild.firstChild\n if last_child is None:\n last_child=self.zone.lastChild\n pos=len(last_child.text)\n \n sel.setBaseAndExtent(last_child,pos,last_child,pos)\n \n self.zone.lastChild.scrollIntoView()\n \n def focus(self,*args):\n ''\n if hasattr(self,'dialog'):\n \n for w in active:\n if w is not self:\n w.dialog.style.zIndex=0\n self.dialog.style.zIndex=1\n sys.stdout=sys.stderr=Output(self)\n self.zone.focus()\n \n def keypress(self,event):\n if event.key ==\"Tab\":\n event.preventDefault()\n self.insert(\" \")\n elif event.key ==\"Enter\":\n event.preventDefault()\n selection=window.getSelection().toString()\n if selection:\n \n self.cursor_to_end()\n return\n self.handle_line(event)\n \n def feed(self,src):\n ''\n\n\n \n current_indent=0\n lines=src.strip().split('\\n')\n for line in lines:\n self.insert(line)\n self.handle_line()\n \n def handle_line(self,event=None):\n src=self.get_content().strip()\n if self._status ==\"main\":\n currentLine=src[src.rfind('\\n>>>')+5:]\n elif self._status ==\"3string\":\n currentLine=src[src.rfind('\\n>>>')+5:]\n currentLine=currentLine.replace('\\n... ','\\n')\n else:\n currentLine=src[src.rfind('\\n...')+5:]\n if self._status =='main'and not currentLine.strip():\n self.insert_cr()\n self.insert_prompt()\n self.cursor_to_end()\n if event is not None:\n event.preventDefault()\n return\n self.history.append(currentLine)\n self.current=len(self.history)\n if self._status in[\"main\",\"3string\"]:\n \n if currentLine ==\"help\":\n self.write(_help)\n self.insert_prompt()\n if event is not None:\n event.preventDefault()\n return\n try:\n code=compile(currentLine,'','eval')\n except IndentationError:\n self.insert_continuation()\n self._status=\"block\"\n except SyntaxError as msg:\n if str(msg).startswith('unterminated triple-quoted string literal'):\n self.insert_continuation()\n self._status=\"3string\"\n elif str(msg)=='decorator expects function':\n self.insert_continuation()\n self._status=\"block\"\n elif str(msg).endswith('was never closed'):\n self.insert_continuation()\n self._status=\"parenth_expr\"\n else:\n self.insert_cr()\n try:\n code=compile(currentLine,'','exec')\n exec(code,self.globals,self.locals)\n except Exception as exc:\n self.print_tb(msg)\n self.insert_prompt()\n self._status=\"main\"\n except Exception as exc:\n \n \n \n self.print_tb(exc)\n self.insert_prompt()\n self._status=\"main\"\n else:\n self.insert_cr()\n try:\n self.globals['_']=eval(code,\n self.globals,\n self.locals)\n if self.globals['_']is not None:\n self.write(repr(self.globals['_'])+'\\n')\n self.insert_prompt()\n self._status=\"main\"\n except Exception as exc:\n self.print_tb(exc)\n self.insert_prompt()\n self._status=\"main\"\n \n elif currentLine ==\"\":\n block=src[src.rfind('\\n>>>')+5:].splitlines()\n block=[block[0]]+[b[4:]for b in block[1:]]\n block_src='\\n'.join(block)\n self.insert_cr()\n mode=eval if self._status ==\"parenth_expr\"else exec\n \n self._status=\"main\"\n if mode is eval:\n try:\n self.globals['_']=eval(block_src,\n self.globals,\n self.locals)\n if self.globals['_']is not None:\n self.write(repr(self.globals['_'])+'\\n')\n self._status=\"main\"\n except Exception as exc:\n self.print_tb(exc)\n self._status=\"main\"\n else:\n try:\n mode(block_src,self.globals,self.locals)\n except Exception as exc:\n self.print_tb(exc)\n self.insert_prompt()\n \n else:\n self.insert_continuation()\n \n self.cursor_to_end()\n if event is not None:\n event.preventDefault()\n \n def keydown(self,event):\n sel=window.getSelection()\n if event.key in(\"ArrowLeft\",\"Backspace\"):\n \n if sel.anchorNode is not self.zone:\n caret_column=sel.anchorOffset\n if caret_column >=5:\n return\n event.preventDefault()\n event.stopPropagation()\n elif event.key ==\"Home\":\n anchor=sel.anchorNode\n sel.setBaseAndExtent(anchor,4,anchor,4)\n event.preventDefault()\n event.stopPropagation()\n elif event.key ==\"ArrowUp\":\n if self.current >0:\n last_child=self.zone.lastChild\n last_child.text=last_child.text[:4]+self.history[self.current -1]\n self.current -=1\n self.cursor_to_end()\n event.preventDefault()\n elif event.key ==\"ArrowDown\":\n if self.current \",\">\")\n frames_sel <=html.OPTION(name)\n frame=frame.f_back\n frames_sel.bind(\"change\",self.change_frame)\n frame_div=html.DIV(\"Frame \"+frames_sel)\n panel_style=window.getComputedStyle(self.dialog.panel)\n frame_div.style.paddingLeft=panel_style.paddingLeft\n frame_div.style.paddingTop=panel_style.paddingTop\n self.dialog.insertBefore(frame_div,self.dialog.panel)\n \n def change_frame(self,ev):\n self.globals,self.locals=self.frames[ev.target.selectedIndex]\n \n", ["browser", "browser.widgets.dialog", "builtins", "re", "sys", "tb"]], "io": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__author__=(\"Guido van Rossum , \"\n\"Mike Verdone , \"\n\"Mark Russell , \"\n\"Antoine Pitrou , \"\n\"Amaury Forgeot d'Arc , \"\n\"Benjamin Peterson \")\n\n__all__=[\"BlockingIOError\",\"open\",\"open_code\",\"IOBase\",\"RawIOBase\",\n\"FileIO\",\"BytesIO\",\"StringIO\",\"BufferedIOBase\",\n\"BufferedReader\",\"BufferedWriter\",\"BufferedRWPair\",\n\"BufferedRandom\",\"TextIOBase\",\"TextIOWrapper\",\n\"UnsupportedOperation\",\"SEEK_SET\",\"SEEK_CUR\",\"SEEK_END\"]\n\n\nimport _io\nimport abc\n\nfrom _io import(DEFAULT_BUFFER_SIZE,BlockingIOError,UnsupportedOperation,\nopen,open_code,FileIO,BytesIO,StringIO,BufferedReader,\nBufferedWriter,BufferedRWPair,BufferedRandom,\nIncrementalNewlineDecoder,text_encoding,TextIOWrapper)\n\n\n\nUnsupportedOperation.__module__=\"io\"\n\n\nSEEK_SET=0\nSEEK_CUR=1\nSEEK_END=2\n\n\n\n\nclass IOBase(_io._IOBase,metaclass=abc.ABCMeta):\n __doc__=_io._IOBase.__doc__\n \nclass RawIOBase(_io._RawIOBase,IOBase):\n __doc__=_io._RawIOBase.__doc__\n \nclass BufferedIOBase(_io._BufferedIOBase,IOBase):\n __doc__=_io._BufferedIOBase.__doc__\n \nclass TextIOBase(_io._TextIOBase,IOBase):\n __doc__=_io._TextIOBase.__doc__\n \nRawIOBase.register(FileIO)\n\nfor klass in(BytesIO,BufferedReader,BufferedWriter,BufferedRandom,\nBufferedRWPair):\n BufferedIOBase.register(klass)\n \nfor klass in(StringIO,TextIOWrapper):\n TextIOBase.register(klass)\ndel klass\n\ntry:\n from _io import _WindowsConsoleIO\nexcept ImportError:\n pass\nelse:\n RawIOBase.register(_WindowsConsoleIO)\n", ["_io", "abc"]], "ipaddress": [".py", "\n\n\n\"\"\"A fast, lightweight IPv4/IPv6 manipulation library in Python.\n\nThis library is used to create/poke/manipulate IPv4 and IPv6 addresses\nand networks.\n\n\"\"\"\n\n__version__='1.0'\n\n\nimport functools\n\nIPV4LENGTH=32\nIPV6LENGTH=128\n\n\nclass AddressValueError(ValueError):\n ''\n \n \nclass NetmaskValueError(ValueError):\n ''\n \n \ndef ip_address(address):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return IPv4Address(address)\n except (AddressValueError,NetmaskValueError):\n pass\n \n try :\n return IPv6Address(address)\n except (AddressValueError,NetmaskValueError):\n pass\n \n raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')\n \n \ndef ip_network(address,strict=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return IPv4Network(address,strict)\n except (AddressValueError,NetmaskValueError):\n pass\n \n try :\n return IPv6Network(address,strict)\n except (AddressValueError,NetmaskValueError):\n pass\n \n raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 network')\n \n \ndef ip_interface(address):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return IPv4Interface(address)\n except (AddressValueError,NetmaskValueError):\n pass\n \n try :\n return IPv6Interface(address)\n except (AddressValueError,NetmaskValueError):\n pass\n \n raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 interface')\n \n \ndef v4_int_to_packed(address):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return address.to_bytes(4)\n except OverflowError:\n raise ValueError(\"Address negative or too large for IPv4\")\n \n \ndef v6_int_to_packed(address):\n ''\n\n\n\n\n\n\n\n \n try :\n return address.to_bytes(16)\n except OverflowError:\n raise ValueError(\"Address negative or too large for IPv6\")\n \n \ndef _split_optional_netmask(address):\n ''\n addr=str(address).split('/')\n if len(addr)>2:\n raise AddressValueError(f\"Only one '/' permitted in {address!r}\")\n return addr\n \n \ndef _find_address_range(addresses):\n ''\n\n\n\n\n\n\n\n \n it=iter(addresses)\n first=last=next(it)\n for ip in it:\n if ip._ip !=last._ip+1:\n yield first,last\n first=ip\n last=ip\n yield first,last\n \n \ndef _count_righthand_zero_bits(number,bits):\n ''\n\n\n\n\n\n\n\n\n \n if number ==0:\n return bits\n return min(bits,(~number&(number -1)).bit_length())\n \n \ndef summarize_address_range(first,last):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if (not (isinstance(first,_BaseAddress)and\n isinstance(last,_BaseAddress))):\n raise TypeError('first and last must be IP addresses, not networks')\n if first.version !=last.version:\n raise TypeError(\"%s and %s are not of the same version\"%(\n first,last))\n if first >last:\n raise ValueError('last IP address must be greater than first')\n \n if first.version ==4:\n ip=IPv4Network\n elif first.version ==6:\n ip=IPv6Network\n else :\n raise ValueError('unknown IP version')\n \n ip_bits=first._max_prefixlen\n first_int=first._ip\n last_int=last._ip\n while first_int <=last_int:\n nbits=min(_count_righthand_zero_bits(first_int,ip_bits),\n (last_int -first_int+1).bit_length()-1)\n net=ip((first_int,ip_bits -nbits))\n yield net\n first_int +=1 <=net.broadcast_address:\n continue\n yield net\n last=net\n \n \ndef collapse_addresses(addresses):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n addrs=[]\n ips=[]\n nets=[]\n \n \n for ip in addresses:\n if isinstance(ip,_BaseAddress):\n if ips and ips[-1]._version !=ip._version:\n raise TypeError(\"%s and %s are not of the same version\"%(\n ip,ips[-1]))\n ips.append(ip)\n elif ip._prefixlen ==ip._max_prefixlen:\n if ips and ips[-1]._version !=ip._version:\n raise TypeError(\"%s and %s are not of the same version\"%(\n ip,ips[-1]))\n try :\n ips.append(ip.ip)\n except AttributeError:\n ips.append(ip.network_address)\n else :\n if nets and nets[-1]._version !=ip._version:\n raise TypeError(\"%s and %s are not of the same version\"%(\n ip,nets[-1]))\n nets.append(ip)\n \n \n ips=sorted(set(ips))\n \n \n if ips:\n for first,last in _find_address_range(ips):\n addrs.extend(summarize_address_range(first,last))\n \n return _collapse_addresses_internal(addrs+nets)\n \n \ndef get_mixed_type_key(obj):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(obj,_BaseNetwork):\n return obj._get_networks_key()\n elif isinstance(obj,_BaseAddress):\n return obj._get_address_key()\n return NotImplemented\n \n \nclass _IPAddressBase:\n\n ''\n \n __slots__=()\n \n @property\n def exploded(self):\n ''\n return self._explode_shorthand_ip_string()\n \n @property\n def compressed(self):\n ''\n return str(self)\n \n @property\n def reverse_pointer(self):\n ''\n\n\n\n\n\n \n return self._reverse_pointer()\n \n @property\n def version(self):\n msg='%200s has no version specified'%(type(self),)\n raise NotImplementedError(msg)\n \n def _check_int_address(self,address):\n if address <0:\n msg=\"%d (< 0) is not permitted as an IPv%d address\"\n raise AddressValueError(msg %(address,self._version))\n if address >self._ALL_ONES:\n msg=\"%d (>= 2**%d) is not permitted as an IPv%d address\"\n raise AddressValueError(msg %(address,self._max_prefixlen,\n self._version))\n \n def _check_packed_address(self,address,expected_len):\n address_len=len(address)\n if address_len !=expected_len:\n msg=\"%r (len %d != %d) is not permitted as an IPv%d address\"\n raise AddressValueError(msg %(address,address_len,\n expected_len,self._version))\n \n @classmethod\n def _ip_int_from_prefix(cls,prefixlen):\n ''\n\n\n\n\n\n\n\n \n return cls._ALL_ONES ^(cls._ALL_ONES >>prefixlen)\n \n @classmethod\n def _prefix_from_ip_int(cls,ip_int):\n ''\n\n\n\n\n\n\n\n\n\n \n trailing_zeroes=_count_righthand_zero_bits(ip_int,\n cls._max_prefixlen)\n prefixlen=cls._max_prefixlen -trailing_zeroes\n leading_ones=ip_int >>trailing_zeroes\n all_ones=(1 <1:\n return address\n return address[0],cls._max_prefixlen\n \n def __reduce__(self):\n return self.__class__,(str(self),)\n \n \n_address_fmt_re=None\n\n@functools.total_ordering\nclass _BaseAddress(_IPAddressBase):\n\n ''\n\n\n\n \n \n __slots__=()\n \n def __int__(self):\n return self._ip\n \n def __eq__(self,other):\n try :\n return (self._ip ==other._ip\n and self._version ==other._version)\n except AttributeError:\n return NotImplemented\n \n def __lt__(self,other):\n if not isinstance(other,_BaseAddress):\n return NotImplemented\n if self._version !=other._version:\n raise TypeError('%s and %s are not of the same version'%(\n self,other))\n if self._ip !=other._ip:\n return self._ip =0:\n if network+n >broadcast:\n raise IndexError('address out of range')\n return self._address_class(network+n)\n else :\n n +=1\n if broadcast+n other.network_address:\n return 1\n \n if self.netmask other.netmask:\n return 1\n return 0\n \n def _get_networks_key(self):\n ''\n\n\n\n\n\n \n return (self._version,self.network_address,self.netmask)\n \n def subnets(self,prefixlen_diff=1,new_prefix=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self._prefixlen ==self._max_prefixlen:\n yield self\n return\n \n if new_prefix is not None :\n if new_prefix 0')\n new_prefixlen=self._prefixlen+prefixlen_diff\n \n if new_prefixlen >self._max_prefixlen:\n raise ValueError(\n 'prefix length diff %d is invalid for netblock %s'%(\n new_prefixlen,self))\n \n start=int(self.network_address)\n end=int(self.broadcast_address)+1\n step=(int(self.hostmask)+1)>>prefixlen_diff\n for new_addr in range(start,end,step):\n current=self.__class__((new_addr,new_prefixlen))\n yield current\n \n def supernet(self,prefixlen_diff=1,new_prefix=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self._prefixlen ==0:\n return self\n \n if new_prefix is not None :\n if new_prefix >self._prefixlen:\n raise ValueError('new prefix must be shorter')\n if prefixlen_diff !=1:\n raise ValueError('cannot set prefixlen_diff and new_prefix')\n prefixlen_diff=self._prefixlen -new_prefix\n \n new_prefixlen=self.prefixlen -prefixlen_diff\n if new_prefixlen <0:\n raise ValueError(\n 'current prefixlen is %d, cannot have a prefixlen_diff of %d'%\n (self.prefixlen,prefixlen_diff))\n return self.__class__((\n int(self.network_address)&(int(self.netmask)<=a.broadcast_address)\n except AttributeError:\n raise TypeError(f\"Unable to test subnet containment \"\n f\"between {a} and {b}\")\n \n def subnet_of(self,other):\n ''\n return self._is_subnet_of(self,other)\n \n def supernet_of(self,other):\n ''\n return self._is_subnet_of(other,self)\n \n @property\n def is_reserved(self):\n ''\n\n\n\n\n\n \n return (self.network_address.is_reserved and\n self.broadcast_address.is_reserved)\n \n @property\n def is_link_local(self):\n ''\n\n\n\n\n \n return (self.network_address.is_link_local and\n self.broadcast_address.is_link_local)\n \n @property\n def is_private(self):\n ''\n\n\n\n\n\n \n return (self.network_address.is_private and\n self.broadcast_address.is_private)\n \n @property\n def is_global(self):\n ''\n\n\n\n\n\n \n return not self.is_private\n \n @property\n def is_unspecified(self):\n ''\n\n\n\n\n\n \n return (self.network_address.is_unspecified and\n self.broadcast_address.is_unspecified)\n \n @property\n def is_loopback(self):\n ''\n\n\n\n\n\n \n return (self.network_address.is_loopback and\n self.broadcast_address.is_loopback)\n \nclass _BaseV4:\n\n ''\n\n\n\n\n \n \n __slots__=()\n _version=4\n \n _ALL_ONES=(2 **IPV4LENGTH)-1\n \n _max_prefixlen=IPV4LENGTH\n \n \n _netmask_cache={}\n \n def _explode_shorthand_ip_string(self):\n return str(self)\n \n @classmethod\n def _make_netmask(cls,arg):\n ''\n\n\n\n\n\n \n if arg not in cls._netmask_cache:\n if isinstance(arg,int):\n prefixlen=arg\n if not (0 <=prefixlen <=cls._max_prefixlen):\n cls._report_invalid_netmask(prefixlen)\n else :\n try :\n \n prefixlen=cls._prefix_from_prefix_string(arg)\n except NetmaskValueError:\n \n \n prefixlen=cls._prefix_from_ip_string(arg)\n netmask=IPv4Address(cls._ip_int_from_prefix(prefixlen))\n cls._netmask_cache[arg]=netmask,prefixlen\n return cls._netmask_cache[arg]\n \n @classmethod\n def _ip_int_from_string(cls,ip_str):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if not ip_str:\n raise AddressValueError('Address cannot be empty')\n \n octets=ip_str.split('.')\n if len(octets)!=4:\n raise AddressValueError(\"Expected 4 octets in %r\"%ip_str)\n \n try :\n return int.from_bytes(map(cls._parse_octet,octets),'big')\n except ValueError as exc:\n raise AddressValueError(\"%s in %r\"%(exc,ip_str))from None\n \n @classmethod\n def _parse_octet(cls,octet_str):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if not octet_str:\n raise ValueError(\"Empty octet not permitted\")\n \n if not (octet_str.isascii()and octet_str.isdigit()):\n msg=\"Only decimal digits permitted in %r\"\n raise ValueError(msg %octet_str)\n \n \n if len(octet_str)>3:\n msg=\"At most 3 characters permitted in %r\"\n raise ValueError(msg %octet_str)\n \n \n if octet_str !='0'and octet_str[0]=='0':\n msg=\"Leading zeros are not permitted in %r\"\n raise ValueError(msg %octet_str)\n \n octet_int=int(octet_str,10)\n if octet_int >255:\n raise ValueError(\"Octet %d (> 255) not permitted\"%octet_int)\n return octet_int\n \n @classmethod\n def _string_from_ip_int(cls,ip_int):\n ''\n\n\n\n\n\n\n\n \n return '.'.join(map(str,ip_int.to_bytes(4,'big')))\n \n def _reverse_pointer(self):\n ''\n\n\n\n \n reverse_octets=str(self).split('.')[::-1]\n return '.'.join(reverse_octets)+'.in-addr.arpa'\n \n @property\n def max_prefixlen(self):\n return self._max_prefixlen\n \n @property\n def version(self):\n return self._version\n \n \nclass IPv4Address(_BaseV4,_BaseAddress):\n\n ''\n \n __slots__=('_ip','__weakref__')\n \n def __init__(self,address):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if isinstance(address,int):\n self._check_int_address(address)\n self._ip=address\n return\n \n \n if isinstance(address,bytes):\n self._check_packed_address(address,4)\n self._ip=int.from_bytes(address)\n return\n \n \n \n addr_str=str(address)\n if '/'in addr_str:\n raise AddressValueError(f\"Unexpected '/' in {address!r}\")\n self._ip=self._ip_int_from_string(addr_str)\n \n @property\n def packed(self):\n ''\n return v4_int_to_packed(self._ip)\n \n @property\n def is_reserved(self):\n ''\n\n\n\n\n\n \n return self in self._constants._reserved_network\n \n @property\n @functools.lru_cache()\n def is_private(self):\n ''\n\n\n\n\n\n \n return any(self in net for net in self._constants._private_networks)\n \n @property\n @functools.lru_cache()\n def is_global(self):\n return self not in self._constants._public_network and not self.is_private\n \n @property\n def is_multicast(self):\n ''\n\n\n\n\n\n \n return self in self._constants._multicast_network\n \n @property\n def is_unspecified(self):\n ''\n\n\n\n\n\n \n return self ==self._constants._unspecified_address\n \n @property\n def is_loopback(self):\n ''\n\n\n\n\n \n return self in self._constants._loopback_network\n \n @property\n def is_link_local(self):\n ''\n\n\n\n\n \n return self in self._constants._linklocal_network\n \n \nclass IPv4Interface(IPv4Address):\n\n def __init__(self,address):\n addr,mask=self._split_addr_prefix(address)\n \n IPv4Address.__init__(self,addr)\n self.network=IPv4Network((addr,mask),strict=False )\n self.netmask=self.network.netmask\n self._prefixlen=self.network._prefixlen\n \n @functools.cached_property\n def hostmask(self):\n return self.network.hostmask\n \n def __str__(self):\n return '%s/%d'%(self._string_from_ip_int(self._ip),\n self._prefixlen)\n \n def __eq__(self,other):\n address_equal=IPv4Address.__eq__(self,other)\n if address_equal is NotImplemented or not address_equal:\n return address_equal\n try :\n return self.network ==other.network\n except AttributeError:\n \n \n \n return False\n \n def __lt__(self,other):\n address_less=IPv4Address.__lt__(self,other)\n if address_less is NotImplemented:\n return NotImplemented\n try :\n return (self.network >16)&0xFFFF))\n parts.append('%x'%(ipv4_int&0xFFFF))\n \n \n \n \n _max_parts=cls._HEXTET_COUNT+1\n if len(parts)>_max_parts:\n msg=\"At most %d colons permitted in %r\"%(_max_parts -1,ip_str)\n raise AddressValueError(msg)\n \n \n \n skip_index=None\n for i in range(1,len(parts)-1):\n if not parts[i]:\n if skip_index is not None :\n \n msg=\"At most one '::' permitted in %r\"%ip_str\n raise AddressValueError(msg)\n skip_index=i\n \n \n \n if skip_index is not None :\n \n parts_hi=skip_index\n parts_lo=len(parts)-skip_index -1\n if not parts[0]:\n parts_hi -=1\n if parts_hi:\n msg=\"Leading ':' only permitted as part of '::' in %r\"\n raise AddressValueError(msg %ip_str)\n if not parts[-1]:\n parts_lo -=1\n if parts_lo:\n msg=\"Trailing ':' only permitted as part of '::' in %r\"\n raise AddressValueError(msg %ip_str)\n parts_skipped=cls._HEXTET_COUNT -(parts_hi+parts_lo)\n if parts_skipped <1:\n msg=\"Expected at most %d other parts with '::' in %r\"\n raise AddressValueError(msg %(cls._HEXTET_COUNT -1,ip_str))\n else :\n \n \n \n if len(parts)!=cls._HEXTET_COUNT:\n msg=\"Exactly %d parts expected without '::' in %r\"\n raise AddressValueError(msg %(cls._HEXTET_COUNT,ip_str))\n if not parts[0]:\n msg=\"Leading ':' only permitted as part of '::' in %r\"\n raise AddressValueError(msg %ip_str)\n if not parts[-1]:\n msg=\"Trailing ':' only permitted as part of '::' in %r\"\n raise AddressValueError(msg %ip_str)\n parts_hi=len(parts)\n parts_lo=0\n parts_skipped=0\n \n try :\n \n ip_int=0\n for i in range(parts_hi):\n ip_int <<=16\n ip_int |=cls._parse_hextet(parts[i])\n ip_int <<=16 *parts_skipped\n for i in range(-parts_lo,0):\n ip_int <<=16\n ip_int |=cls._parse_hextet(parts[i])\n return ip_int\n except ValueError as exc:\n raise AddressValueError(\"%s in %r\"%(exc,ip_str))from None\n \n @classmethod\n def _parse_hextet(cls,hextet_str):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n if not cls._HEX_DIGITS.issuperset(hextet_str):\n raise ValueError(\"Only hex digits permitted in %r\"%hextet_str)\n \n \n if len(hextet_str)>4:\n msg=\"At most 4 characters permitted in %r\"\n raise ValueError(msg %hextet_str)\n \n return int(hextet_str,16)\n \n @classmethod\n def _compress_hextets(cls,hextets):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n best_doublecolon_start=-1\n best_doublecolon_len=0\n doublecolon_start=-1\n doublecolon_len=0\n for index,hextet in enumerate(hextets):\n if hextet =='0':\n doublecolon_len +=1\n if doublecolon_start ==-1:\n \n doublecolon_start=index\n if doublecolon_len >best_doublecolon_len:\n \n best_doublecolon_len=doublecolon_len\n best_doublecolon_start=doublecolon_start\n else :\n doublecolon_len=0\n doublecolon_start=-1\n \n if best_doublecolon_len >1:\n best_doublecolon_end=(best_doublecolon_start+\n best_doublecolon_len)\n \n if best_doublecolon_end ==len(hextets):\n hextets +=['']\n hextets[best_doublecolon_start:best_doublecolon_end]=['']\n \n if best_doublecolon_start ==0:\n hextets=['']+hextets\n \n return hextets\n \n @classmethod\n def _string_from_ip_int(cls,ip_int=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if ip_int is None :\n ip_int=int(cls._ip)\n \n if ip_int >cls._ALL_ONES:\n raise ValueError('IPv6 address is too large')\n \n hex_str='%032x'%ip_int\n hextets=['%x'%int(hex_str[x:x+4],16)for x in range(0,32,4)]\n \n hextets=cls._compress_hextets(hextets)\n return ':'.join(hextets)\n \n def _explode_shorthand_ip_string(self):\n ''\n\n\n\n\n\n\n\n \n if isinstance(self,IPv6Network):\n ip_str=str(self.network_address)\n elif isinstance(self,IPv6Interface):\n ip_str=str(self.ip)\n else :\n ip_str=str(self)\n \n ip_int=self._ip_int_from_string(ip_str)\n hex_str='%032x'%ip_int\n parts=[hex_str[x:x+4]for x in range(0,32,4)]\n if isinstance(self,(_BaseNetwork,IPv6Interface)):\n return '%s/%d'%(':'.join(parts),self._prefixlen)\n return ':'.join(parts)\n \n def _reverse_pointer(self):\n ''\n\n\n\n \n reverse_chars=self.exploded[::-1].replace(':','')\n return '.'.join(reverse_chars)+'.ip6.arpa'\n \n @staticmethod\n def _split_scope_id(ip_str):\n ''\n\n\n\n\n\n\n\n\n\n \n addr,sep,scope_id=ip_str.partition('%')\n if not sep:\n scope_id=None\n elif not scope_id or '%'in scope_id:\n raise AddressValueError('Invalid IPv6 address: \"%r\"'%ip_str)\n return addr,scope_id\n \n @property\n def max_prefixlen(self):\n return self._max_prefixlen\n \n @property\n def version(self):\n return self._version\n \n \nclass IPv6Address(_BaseV6,_BaseAddress):\n\n ''\n \n __slots__=('_ip','_scope_id','__weakref__')\n \n def __init__(self,address):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if isinstance(address,int):\n self._check_int_address(address)\n self._ip=address\n self._scope_id=None\n return\n \n \n if isinstance(address,bytes):\n self._check_packed_address(address,16)\n self._ip=int.from_bytes(address,'big')\n self._scope_id=None\n return\n \n \n \n addr_str=str(address)\n if '/'in addr_str:\n raise AddressValueError(f\"Unexpected '/' in {address!r}\")\n addr_str,self._scope_id=self._split_scope_id(addr_str)\n \n self._ip=self._ip_int_from_string(addr_str)\n \n def __str__(self):\n ip_str=super().__str__()\n return ip_str+'%'+self._scope_id if self._scope_id else ip_str\n \n def __hash__(self):\n return hash((self._ip,self._scope_id))\n \n def __eq__(self,other):\n address_equal=super().__eq__(other)\n if address_equal is NotImplemented:\n return NotImplemented\n if not address_equal:\n return False\n return self._scope_id ==getattr(other,'_scope_id',None )\n \n @property\n def scope_id(self):\n ''\n\n\n\n\n\n\n \n return self._scope_id\n \n @property\n def packed(self):\n ''\n return v6_int_to_packed(self._ip)\n \n @property\n def is_multicast(self):\n ''\n\n\n\n\n\n \n return self in self._constants._multicast_network\n \n @property\n def is_reserved(self):\n ''\n\n\n\n\n\n \n return any(self in x for x in self._constants._reserved_networks)\n \n @property\n def is_link_local(self):\n ''\n\n\n\n\n \n return self in self._constants._linklocal_network\n \n @property\n def is_site_local(self):\n ''\n\n\n\n\n\n\n\n\n \n return self in self._constants._sitelocal_network\n \n @property\n @functools.lru_cache()\n def is_private(self):\n ''\n\n\n\n\n\n\n \n ipv4_mapped=self.ipv4_mapped\n if ipv4_mapped is not None :\n return ipv4_mapped.is_private\n return any(self in net for net in self._constants._private_networks)\n \n @property\n def is_global(self):\n ''\n\n\n\n\n\n \n return not self.is_private\n \n @property\n def is_unspecified(self):\n ''\n\n\n\n\n\n \n return self._ip ==0\n \n @property\n def is_loopback(self):\n ''\n\n\n\n\n\n \n return self._ip ==1\n \n @property\n def ipv4_mapped(self):\n ''\n\n\n\n\n\n \n if (self._ip >>32)!=0xFFFF:\n return None\n return IPv4Address(self._ip&0xFFFFFFFF)\n \n @property\n def teredo(self):\n ''\n\n\n\n\n\n\n \n if (self._ip >>96)!=0x20010000:\n return None\n return (IPv4Address((self._ip >>64)&0xFFFFFFFF),\n IPv4Address(~self._ip&0xFFFFFFFF))\n \n @property\n def sixtofour(self):\n ''\n\n\n\n\n\n \n if (self._ip >>112)!=0x2002:\n return None\n return IPv4Address((self._ip >>80)&0xFFFFFFFF)\n \n \nclass IPv6Interface(IPv6Address):\n\n def __init__(self,address):\n addr,mask=self._split_addr_prefix(address)\n \n IPv6Address.__init__(self,addr)\n self.network=IPv6Network((addr,mask),strict=False )\n self.netmask=self.network.netmask\n self._prefixlen=self.network._prefixlen\n \n @functools.cached_property\n def hostmask(self):\n return self.network.hostmask\n \n def __str__(self):\n return '%s/%d'%(super().__str__(),\n self._prefixlen)\n \n def __eq__(self,other):\n address_equal=IPv6Address.__eq__(self,other)\n if address_equal is NotImplemented or not address_equal:\n return address_equal\n try :\n return self.network ==other.network\n except AttributeError:\n \n \n \n return False\n \n def __lt__(self,other):\n address_less=IPv6Address.__lt__(self,other)\n if address_less is NotImplemented:\n return address_less\n try :\n return (self.network self.n:\n raise StopIteration\n if not self.zero:\n self.zero=True\n return tuple(self.pool[i]for i in self.indices)\n else :\n try :\n for i in reversed(range(self.r)):\n if self.indices[i]!=i+self.n -self.r:\n break\n self.indices[i]+=1\n for j in range(i+1,self.r):\n self.indices[j]=self.indices[j -1]+1\n return tuple(self.pool[i]for i in self.indices)\n except :\n raise StopIteration\n \nclass combinations_with_replacement:\n def __init__(self,iterable,r):\n self.pool=tuple(iterable)\n self.n=len(self.pool)\n self.r=r\n self.indices=[0]*self.r\n self.zero=False\n \n def __iter__(self):\n return self\n \n def __next__(self):\n if not self.n and self.r:\n raise StopIteration\n if not self.zero:\n self.zero=True\n return tuple(self.pool[i]for i in self.indices)\n else :\n try :\n for i in reversed(range(self.r)):\n if self.indices[i]!=self.n -1:\n break\n self.indices[i:]=[self.indices[i]+1]*(self.r -i)\n return tuple(self.pool[i]for i in self.indices)\n except :\n raise StopIteration\n \n \n \nclass compress:\n def __init__(self,data,selectors):\n self.data=iter(data)\n self.selectors=iter(selectors)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n while True :\n next_item=next(self.data)\n next_selector=next(self.selectors)\n if bool(next_selector):\n return next_item\n \n \n \n \nclass count:\n ''\n\n\n\n \n def __init__(self,start=0,step=1):\n if not isinstance(start,(int,float)):\n raise TypeError('a number is required')\n self.times=start -step\n self.step=step\n \n def __iter__(self):\n return self\n \n def __next__(self):\n self.times +=self.step\n return self.times\n \n def __repr__(self):\n return 'count(%d)'%(self.times+self.step)\n \n \n \nclass cycle:\n def __init__(self,iterable):\n self._cur_iter=iter(iterable)\n self._saved=[]\n self._must_save=True\n \n def __iter__(self):\n return self\n \n def __next__(self):\n try :\n next_elt=next(self._cur_iter)\n if self._must_save:\n self._saved.append(next_elt)\n except StopIteration:\n self._cur_iter=iter(self._saved)\n next_elt=next(self._cur_iter)\n self._must_save=False\n return next_elt\n \n \n \nclass dropwhile:\n def __init__(self,predicate,iterable):\n self._predicate=predicate\n self._iter=iter(iterable)\n self._dropped=False\n \n def __iter__(self):\n return self\n \n def __next__(self):\n value=next(self._iter)\n if self._dropped:\n return value\n while self._predicate(value):\n value=next(self._iter)\n self._dropped=True\n return value\n \n \n \nclass filterfalse:\n def __init__(self,predicate,iterable):\n \n self._iter=iter(iterable)\n if predicate is None :\n self._predicate=bool\n else :\n self._predicate=predicate\n \n def __iter__(self):\n return self\n def __next__(self):\n next_elt=next(self._iter)\n while True :\n if not self._predicate(next_elt):\n return next_elt\n next_elt=next(self._iter)\n \nclass groupby:\n\n\n def __init__(self,iterable,key=None ):\n if key is None :\n key=lambda x:x\n self.keyfunc=key\n self.it=iter(iterable)\n self.tgtkey=self.currkey=self.currvalue=object()\n def __iter__(self):\n return self\n def __next__(self):\n while self.currkey ==self.tgtkey:\n self.currvalue=next(self.it)\n self.currkey=self.keyfunc(self.currvalue)\n self.tgtkey=self.currkey\n return (self.currkey,self._grouper(self.tgtkey))\n def _grouper(self,tgtkey):\n while self.currkey ==tgtkey:\n yield self.currvalue\n self.currvalue=next(self.it)\n self.currkey=self.keyfunc(self.currvalue)\n \n \n \nclass islice:\n def __init__(self,iterable,*args):\n s=slice(*args)\n self.start,self.stop,self.step=s.start or 0,s.stop,s.step\n if not isinstance(self.start,int):\n raise ValueError(\"Start argument must be an integer\")\n if self.stop !=None and not isinstance(self.stop,int):\n raise ValueError(\"Stop argument must be an integer or None\")\n if self.step is None :\n self.step=1\n if self.start <0 or (self.stop !=None and self.stop <0\n )or self.step <=0:\n raise ValueError(\"indices for islice() must be positive\")\n self.it=iter(iterable)\n self.donext=None\n self.cnt=0\n \n def __iter__(self):\n return self\n \n def __next__(self):\n nextindex=self.start\n if self.stop !=None and nextindex >=self.stop:\n raise StopIteration\n while self.cnt <=nextindex:\n nextitem=next(self.it)\n self.cnt +=1\n self.start +=self.step\n return nextitem\n \nclass permutations:\n def __init__(self,iterable,r=None ):\n self.pool=tuple(iterable)\n self.n=len(self.pool)\n self.r=self.n if r is None else r\n self.indices=list(range(self.n))\n self.cycles=list(range(self.n,self.n -self.r,-1))\n self.zero=False\n self.stop=False\n \n def __iter__(self):\n return self\n \n def __next__(self):\n indices=self.indices\n if self.r >self.n:\n raise StopIteration\n if not self.zero:\n self.zero=True\n return tuple(self.pool[i]for i in indices[:self.r])\n \n i=self.r -1\n while i >=0:\n j=self.cycles[i]-1\n if j >0:\n self.cycles[i]=j\n indices[i],indices[-j]=indices[-j],indices[i]\n return tuple(self.pool[i]for i in indices[:self.r])\n self.cycles[i]=len(indices)-i\n n1=len(indices)-1\n assert n1 >=0\n num=indices[i]\n for k in range(i,n1):\n indices[k]=indices[k+1]\n indices[n1]=num\n i -=1\n raise StopIteration\n \n \ndef product(*args,repeat=1):\n\n\n pools=[tuple(pool)for pool in args]*repeat\n result=[[]]\n for pool in pools:\n result=[x+[y]for x in result for y in pool]\n for prod in result:\n yield tuple(prod)\n \n \n \n \n \n \n \n \nclass _product:\n def __init__(self,*args,**kw):\n if len(kw)>1:\n raise TypeError(\"product() takes at most 1 argument (%d given)\"%\n len(kw))\n self.repeat=kw.get('repeat',1)\n if not isinstance(self.repeat,int):\n raise TypeError(\"integer argument expected, got %s\"%\n type(self.repeat))\n self.gears=[x for x in args]*self.repeat\n self.num_gears=len(self.gears)\n \n self.indicies=[(0,len(self.gears[x]))\n for x in range(0,self.num_gears)]\n self.cont=True\n self.zero=False\n \n def roll_gears(self):\n \n \n \n should_carry=True\n for n in range(0,self.num_gears):\n nth_gear=self.num_gears -n -1\n if should_carry:\n count,lim=self.indicies[nth_gear]\n count +=1\n if count ==lim and nth_gear ==0:\n self.cont=False\n if count ==lim:\n should_carry=True\n count=0\n else :\n should_carry=False\n self.indicies[nth_gear]=(count,lim)\n else :\n break\n \n def __iter__(self):\n return self\n \n def __next__(self):\n if self.zero:\n raise StopIteration\n if self.repeat >0:\n if not self.cont:\n raise StopIteration\n l=[]\n for x in range(0,self.num_gears):\n index,limit=self.indicies[x]\n print('itertools 353',self.gears,x,index)\n l.append(self.gears[x][index])\n self.roll_gears()\n return tuple(l)\n elif self.repeat ==0:\n self.zero=True\n return ()\n else :\n raise ValueError(\"repeat argument cannot be negative\")\n \n \n \nclass repeat:\n def __init__(self,obj,times=None ):\n self._obj=obj\n if times is not None :\n range(times)\n if times <0:\n times=0\n self._times=times\n \n def __iter__(self):\n return self\n \n def __next__(self):\n \n if self._times is not None :\n if self._times <=0:\n raise StopIteration()\n self._times -=1\n return self._obj\n \n def __repr__(self):\n if self._times is not None :\n return 'repeat(%r, %r)'%(self._obj,self._times)\n else :\n return 'repeat(%r)'%(self._obj,)\n \n def __len__(self):\n if self._times ==-1 or self._times is None :\n raise TypeError(\"len() of uniszed object\")\n return self._times\n \n \n \nclass starmap(object):\n def __init__(self,function,iterable):\n self._func=function\n self._iter=iter(iterable)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n t=next(self._iter)\n return self._func(*t)\n \n \n \nclass takewhile(object):\n def __init__(self,predicate,iterable):\n self._predicate=predicate\n self._iter=iter(iterable)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n value=next(self._iter)\n if not self._predicate(value):\n raise StopIteration()\n return value\n \n \n \nclass TeeData(object):\n def __init__(self,iterator):\n self.data=[]\n self._iter=iterator\n \n def __getitem__(self,i):\n \n while i >=len(self.data):\n self.data.append(next(self._iter))\n return self.data[i]\n \n \nclass TeeObject(object):\n def __init__(self,iterable=None ,tee_data=None ):\n if tee_data:\n self.tee_data=tee_data\n self.pos=0\n \n elif isinstance(iterable,TeeObject):\n self.tee_data=iterable.tee_data\n self.pos=iterable.pos\n else :\n self.tee_data=TeeData(iter(iterable))\n self.pos=0\n \n def __next__(self):\n data=self.tee_data[self.pos]\n self.pos +=1\n return data\n \n def __iter__(self):\n return self\n \n \ndef tee(iterable,n=2):\n if isinstance(iterable,TeeObject):\n return tuple([iterable]+\n [TeeObject(tee_data=iterable.tee_data)for i in range(n -1)])\n tee_data=TeeData(iter(iterable))\n return tuple([TeeObject(tee_data=tee_data)for i in range(n)])\n \nclass zip_longest:\n def __init__(self,*args,fillvalue=None ):\n self.args=[iter(arg)for arg in args]\n self.fillvalue=fillvalue\n self.units=len(args)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n temp=[]\n nb=0\n for i in range(self.units):\n try :\n temp.append(next(self.args[i]))\n nb +=1\n except StopIteration:\n temp.append(self.fillvalue)\n if nb ==0:\n raise StopIteration\n return tuple(temp)\n", ["operator"]], "keyword": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\"iskeyword\",\"issoftkeyword\",\"kwlist\",\"softkwlist\"]\n\nkwlist=[\n'False',\n'None',\n'True',\n'and',\n'as',\n'assert',\n'async',\n'await',\n'break',\n'class',\n'continue',\n'def',\n'del',\n'elif',\n'else',\n'except',\n'finally',\n'for',\n'from',\n'global',\n'if',\n'import',\n'in',\n'is',\n'lambda',\n'nonlocal',\n'not',\n'or',\n'pass',\n'raise',\n'return',\n'try',\n'while',\n'with',\n'yield'\n]\n\nsoftkwlist=[\n'_',\n'case',\n'match',\n'type'\n]\n\niskeyword=frozenset(kwlist).__contains__\nissoftkeyword=frozenset(softkwlist).__contains__\n", []], "linecache": [".py", "''\n\n\n\n\n\n\nimport functools\nimport sys\nimport os\nimport tokenize\n\n__all__=[\"getline\",\"clearcache\",\"checkcache\",\"lazycache\"]\n\n\n\n\ncache={}\n\n\ndef clearcache():\n ''\n cache.clear()\n \n \ndef getline(filename,lineno,module_globals=None ):\n ''\n \n \n lines=getlines(filename,module_globals)\n if 1 <=lineno <=len(lines):\n return lines[lineno -1]\n return ''\n \n \ndef getlines(filename,module_globals=None ):\n ''\n \n \n if filename in cache:\n entry=cache[filename]\n if len(entry)!=1:\n return cache[filename][2]\n \n try :\n return updatecache(filename,module_globals)\n except MemoryError:\n clearcache()\n return []\n \n \ndef checkcache(filename=None ):\n ''\n \n \n if filename is None :\n filenames=list(cache.keys())\n elif filename in cache:\n filenames=[filename]\n else :\n return\n \n for filename in filenames:\n entry=cache[filename]\n if len(entry)==1:\n \n continue\n size,mtime,lines,fullname=entry\n if mtime is None :\n continue\n try :\n stat=os.stat(fullname)\n except OSError:\n cache.pop(filename,None )\n continue\n if size !=stat.st_size or mtime !=stat.st_mtime:\n cache.pop(filename,None )\n \n \ndef updatecache(filename,module_globals=None ):\n ''\n\n \n \n if filename in cache:\n if len(cache[filename])!=1:\n cache.pop(filename,None )\n if not filename or (filename.startswith('<')and filename.endswith('>')):\n return []\n \n fullname=filename\n try :\n stat=os.stat(fullname)\n except OSError:\n basename=filename\n \n \n \n if lazycache(filename,module_globals):\n try :\n data=cache[filename][0]()\n except (ImportError,OSError):\n pass\n else :\n if data is None :\n \n \n return []\n cache[filename]=(\n len(data),\n None ,\n [line+'\\n'for line in data.splitlines()],\n fullname\n )\n return cache[filename][2]\n \n \n \n if os.path.isabs(filename):\n return []\n \n for dirname in sys.path:\n try :\n fullname=os.path.join(dirname,basename)\n except (TypeError,AttributeError):\n \n continue\n try :\n stat=os.stat(fullname)\n break\n except OSError:\n pass\n else :\n return []\n try :\n with tokenize.open(fullname)as fp:\n lines=fp.readlines()\n except (OSError,UnicodeDecodeError,SyntaxError):\n return []\n if lines and not lines[-1].endswith('\\n'):\n lines[-1]+='\\n'\n size,mtime=stat.st_size,stat.st_mtime\n cache[filename]=size,mtime,lines,fullname\n return lines\n \n \ndef lazycache(filename,module_globals):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if filename in cache:\n if len(cache[filename])==1:\n return True\n else :\n return False\n if not filename or (filename.startswith('<')and filename.endswith('>')):\n return False\n \n if module_globals and '__name__'in module_globals:\n name=module_globals['__name__']\n if (loader :=module_globals.get('__loader__'))is None :\n if spec :=module_globals.get('__spec__'):\n try :\n loader=spec.loader\n except AttributeError:\n pass\n get_source=getattr(loader,'get_source',None )\n \n if name and get_source:\n get_lines=functools.partial(get_source,name)\n cache[filename]=(get_lines,)\n return True\n return False\n", ["functools", "os", "sys", "tokenize"]], "locale": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\nimport sys\nimport encodings\nimport encodings.aliases\nimport re\nimport _collections_abc\nfrom builtins import str as _builtin_str\nimport functools\n\n\n\n\n\n\n\n__all__=[\"getlocale\",\"getdefaultlocale\",\"getpreferredencoding\",\"Error\",\n\"setlocale\",\"resetlocale\",\"localeconv\",\"strcoll\",\"strxfrm\",\n\"str\",\"atof\",\"atoi\",\"format_string\",\"currency\",\n\"normalize\",\"LC_CTYPE\",\"LC_COLLATE\",\"LC_TIME\",\"LC_MONETARY\",\n\"LC_NUMERIC\",\"LC_ALL\",\"CHAR_MAX\",\"getencoding\"]\n\ndef _strcoll(a,b):\n ''\n\n \n return(a >b)-(a .*?)\\))?'\nr'(?P[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')\n\ndef _format(percent,value,grouping=False,monetary=False,*additional):\n if additional:\n formatted=percent %((value,)+additional)\n else:\n formatted=percent %value\n if percent[-1]in 'eEfFgGdiu':\n formatted=_localize(formatted,grouping,monetary)\n return formatted\n \n \ndef _localize(formatted,grouping=False,monetary=False):\n\n if '.'in formatted:\n seps=0\n parts=formatted.split('.')\n if grouping:\n parts[0],seps=_group(parts[0],monetary=monetary)\n decimal_point=localeconv()[monetary and 'mon_decimal_point'\n or 'decimal_point']\n formatted=decimal_point.join(parts)\n if seps:\n formatted=_strip_padding(formatted,seps)\n else:\n seps=0\n if grouping:\n formatted,seps=_group(formatted,monetary=monetary)\n if seps:\n formatted=_strip_padding(formatted,seps)\n return formatted\n \ndef format_string(f,val,grouping=False,monetary=False):\n ''\n\n\n\n\n \n percents=list(_percent_re.finditer(f))\n new_f=_percent_re.sub('%s',f)\n \n if isinstance(val,_collections_abc.Mapping):\n new_val=[]\n for perc in percents:\n if perc.group()[-1]=='%':\n new_val.append('%')\n else:\n new_val.append(_format(perc.group(),val,grouping,monetary))\n else:\n if not isinstance(val,tuple):\n val=(val,)\n new_val=[]\n i=0\n for perc in percents:\n if perc.group()[-1]=='%':\n new_val.append('%')\n else:\n starcount=perc.group('modifiers').count('*')\n new_val.append(_format(perc.group(),\n val[i],\n grouping,\n monetary,\n *val[i+1:i+1+starcount]))\n i +=(1+starcount)\n val=tuple(new_val)\n \n return new_f %val\n \ndef currency(val,symbol=True,grouping=False,international=False):\n ''\n \n conv=localeconv()\n \n \n digits=conv[international and 'int_frac_digits'or 'frac_digits']\n if digits ==127:\n raise ValueError(\"Currency formatting is not possible using \"\n \"the 'C' locale.\")\n \n s=_localize(f'{abs(val):.{digits}f}',grouping,monetary=True)\n \n s='<'+s+'>'\n \n if symbol:\n smb=conv[international and 'int_curr_symbol'or 'currency_symbol']\n precedes=conv[val <0 and 'n_cs_precedes'or 'p_cs_precedes']\n separated=conv[val <0 and 'n_sep_by_space'or 'p_sep_by_space']\n \n if precedes:\n s=smb+(separated and ' 'or '')+s\n else:\n if international and smb[-1]==' ':\n smb=smb[:-1]\n s=s+(separated and ' 'or '')+smb\n \n sign_pos=conv[val <0 and 'n_sign_posn'or 'p_sign_posn']\n sign=conv[val <0 and 'negative_sign'or 'positive_sign']\n \n if sign_pos ==0:\n s='('+s+')'\n elif sign_pos ==1:\n s=sign+s\n elif sign_pos ==2:\n s=s+sign\n elif sign_pos ==3:\n s=s.replace('<',sign)\n elif sign_pos ==4:\n s=s.replace('>',sign)\n else:\n \n \n s=sign+s\n \n return s.replace('<','').replace('>','')\n \ndef str(val):\n ''\n return _format(\"%.12g\",val)\n \ndef delocalize(string):\n ''\n \n conv=localeconv()\n \n \n ts=conv['thousands_sep']\n if ts:\n string=string.replace(ts,'')\n \n \n dd=conv['decimal_point']\n if dd:\n string=string.replace(dd,'.')\n return string\n \ndef localize(string,grouping=False,monetary=False):\n ''\n return _localize(string,grouping,monetary)\n \ndef atof(string,func=float):\n ''\n return func(delocalize(string))\n \ndef atoi(string):\n ''\n return int(delocalize(string))\n \ndef _test():\n setlocale(LC_ALL,\"\")\n \n s1=format_string(\"%d\",123456789,1)\n print(s1,\"is\",atoi(s1))\n \n s1=str(3.14)\n print(s1,\"is\",atof(s1))\n \n \n \n \n \n \n \n \n_setlocale=setlocale\n\ndef _replace_encoding(code,encoding):\n if '.'in code:\n langname=code[:code.index('.')]\n else:\n langname=code\n \n norm_encoding=encodings.normalize_encoding(encoding)\n \n norm_encoding=encodings.aliases.aliases.get(norm_encoding.lower(),\n norm_encoding)\n \n encoding=norm_encoding\n norm_encoding=norm_encoding.lower()\n if norm_encoding in locale_encoding_alias:\n encoding=locale_encoding_alias[norm_encoding]\n else:\n norm_encoding=norm_encoding.replace('_','')\n norm_encoding=norm_encoding.replace('-','')\n if norm_encoding in locale_encoding_alias:\n encoding=locale_encoding_alias[norm_encoding]\n \n return langname+'.'+encoding\n \ndef _append_modifier(code,modifier):\n if modifier =='euro':\n if '.'not in code:\n return code+'.ISO8859-15'\n _,_,encoding=code.partition('.')\n if encoding in('ISO8859-15','UTF-8'):\n return code\n if encoding =='ISO8859-1':\n return _replace_encoding(code,'ISO8859-15')\n return code+'@'+modifier\n \ndef normalize(localename):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n code=localename.lower()\n if ':'in code:\n \n code=code.replace(':','.')\n if '@'in code:\n code,modifier=code.split('@',1)\n else:\n modifier=''\n if '.'in code:\n langname,encoding=code.split('.')[:2]\n else:\n langname=code\n encoding=''\n \n \n lang_enc=langname\n if encoding:\n norm_encoding=encoding.replace('-','')\n norm_encoding=norm_encoding.replace('_','')\n lang_enc +='.'+norm_encoding\n lookup_name=lang_enc\n if modifier:\n lookup_name +='@'+modifier\n code=locale_alias.get(lookup_name,None)\n if code is not None:\n return code\n \n \n if modifier:\n \n code=locale_alias.get(lang_enc,None)\n if code is not None:\n \n if '@'not in code:\n return _append_modifier(code,modifier)\n if code.split('@',1)[1].lower()==modifier:\n return code\n \n \n if encoding:\n \n lookup_name=langname\n if modifier:\n lookup_name +='@'+modifier\n code=locale_alias.get(lookup_name,None)\n if code is not None:\n \n if '@'not in code:\n return _replace_encoding(code,encoding)\n code,modifier=code.split('@',1)\n return _replace_encoding(code,encoding)+'@'+modifier\n \n if modifier:\n \n code=locale_alias.get(langname,None)\n if code is not None:\n \n if '@'not in code:\n code=_replace_encoding(code,encoding)\n return _append_modifier(code,modifier)\n code,defmod=code.split('@',1)\n if defmod.lower()==modifier:\n return _replace_encoding(code,encoding)+'@'+defmod\n \n return localename\n \ndef _parse_localename(localename):\n\n ''\n\n\n\n\n\n\n\n\n\n\n \n code=normalize(localename)\n if '@'in code:\n \n code,modifier=code.split('@',1)\n if modifier =='euro'and '.'not in code:\n \n \n \n return code,'iso-8859-15'\n \n if '.'in code:\n return tuple(code.split('.')[:2])\n elif code =='C':\n return None,None\n elif code =='UTF-8':\n \n \n return None,'UTF-8'\n raise ValueError('unknown locale: %s'%localename)\n \ndef _build_localename(localetuple):\n\n ''\n\n\n\n\n \n try:\n language,encoding=localetuple\n \n if language is None:\n language='C'\n if encoding is None:\n return language\n else:\n return language+'.'+encoding\n except(TypeError,ValueError):\n raise TypeError('Locale must be None, a string, or an iterable of '\n 'two strings -- language code, encoding.')from None\n \ndef getdefaultlocale(envvars=('LC_ALL','LC_CTYPE','LANG','LANGUAGE')):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n import warnings\n warnings.warn(\n \"Use setlocale(), getencoding() and getlocale() instead\",\n DeprecationWarning,stacklevel=2\n )\n return _getdefaultlocale(envvars)\n \ndef _getdefaultlocale(envvars=('LC_ALL','LC_CTYPE','LANG','LANGUAGE')):\n try:\n \n import _locale\n code,encoding=_locale._getdefaultlocale()\n except(ImportError,AttributeError):\n pass\n else:\n \n if sys.platform ==\"win32\"and code and code[:2]==\"0x\":\n \n code=windows_locale.get(int(code,0))\n \n \n return code,encoding\n \n \n import os\n lookup=os.environ.get\n for variable in envvars:\n localename=lookup(variable,None)\n if localename:\n if variable =='LANGUAGE':\n localename=localename.split(':')[0]\n break\n else:\n localename='C'\n return _parse_localename(localename)\n \n \ndef getlocale(category=LC_CTYPE):\n\n ''\n\n\n\n\n\n\n\n\n\n \n localename=_setlocale(category)\n if category ==LC_ALL and ';'in localename:\n raise TypeError('category LC_ALL is not supported')\n return _parse_localename(localename)\n \ndef setlocale(category,locale=None):\n\n ''\n\n\n\n\n\n\n\n\n \n if locale and not isinstance(locale,_builtin_str):\n \n locale=normalize(_build_localename(locale))\n return _setlocale(category,locale)\n \ndef resetlocale(category=LC_ALL):\n\n ''\n\n\n\n\n \n import warnings\n warnings.warn(\n 'Use locale.setlocale(locale.LC_ALL, \"\") instead',\n DeprecationWarning,stacklevel=2\n )\n \n with warnings.catch_warnings():\n warnings.simplefilter('ignore',category=DeprecationWarning)\n loc=getdefaultlocale()\n \n _setlocale(category,_build_localename(loc))\n \n \ntry:\n from _locale import getencoding\nexcept ImportError:\n def getencoding():\n if hasattr(sys,'getandroidapilevel'):\n \n \n return 'utf-8'\n encoding=_getdefaultlocale()[1]\n if encoding is None:\n \n encoding='utf-8'\n return encoding\n \ntry:\n CODESET\nexcept NameError:\n def getpreferredencoding(do_setlocale=True):\n ''\n if sys.flags.warn_default_encoding:\n import warnings\n warnings.warn(\n \"UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.\",\n EncodingWarning,2)\n if sys.flags.utf8_mode:\n return 'utf-8'\n return getencoding()\nelse:\n\n def getpreferredencoding(do_setlocale=True):\n ''\n \n \n if sys.flags.warn_default_encoding:\n import warnings\n warnings.warn(\n \"UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.\",\n EncodingWarning,2)\n if sys.flags.utf8_mode:\n return 'utf-8'\n \n if not do_setlocale:\n return getencoding()\n \n old_loc=setlocale(LC_CTYPE)\n try:\n try:\n setlocale(LC_CTYPE,\"\")\n except Error:\n pass\n return getencoding()\n finally:\n setlocale(LC_CTYPE,old_loc)\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \nlocale_encoding_alias={\n\n\n'437':'C',\n'c':'C',\n'en':'ISO8859-1',\n'jis':'JIS7',\n'jis7':'JIS7',\n'ajec':'eucJP',\n'koi8c':'KOI8-C',\n'microsoftcp1251':'CP1251',\n'microsoftcp1255':'CP1255',\n'microsoftcp1256':'CP1256',\n'88591':'ISO8859-1',\n'88592':'ISO8859-2',\n'88595':'ISO8859-5',\n'885915':'ISO8859-15',\n\n\n'ascii':'ISO8859-1',\n'latin_1':'ISO8859-1',\n'iso8859_1':'ISO8859-1',\n'iso8859_10':'ISO8859-10',\n'iso8859_11':'ISO8859-11',\n'iso8859_13':'ISO8859-13',\n'iso8859_14':'ISO8859-14',\n'iso8859_15':'ISO8859-15',\n'iso8859_16':'ISO8859-16',\n'iso8859_2':'ISO8859-2',\n'iso8859_3':'ISO8859-3',\n'iso8859_4':'ISO8859-4',\n'iso8859_5':'ISO8859-5',\n'iso8859_6':'ISO8859-6',\n'iso8859_7':'ISO8859-7',\n'iso8859_8':'ISO8859-8',\n'iso8859_9':'ISO8859-9',\n'iso2022_jp':'JIS7',\n'shift_jis':'SJIS',\n'tactis':'TACTIS',\n'euc_jp':'eucJP',\n'euc_kr':'eucKR',\n'utf_8':'UTF-8',\n'koi8_r':'KOI8-R',\n'koi8_t':'KOI8-T',\n'koi8_u':'KOI8-U',\n'kz1048':'RK1048',\n'cp1251':'CP1251',\n'cp1255':'CP1255',\n'cp1256':'CP1256',\n\n\n\n}\n\nfor k,v in sorted(locale_encoding_alias.items()):\n k=k.replace('_','')\n locale_encoding_alias.setdefault(k,v)\ndel k,v\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nlocale_alias={\n'a3':'az_AZ.KOI8-C',\n'a3_az':'az_AZ.KOI8-C',\n'a3_az.koic':'az_AZ.KOI8-C',\n'aa_dj':'aa_DJ.ISO8859-1',\n'aa_er':'aa_ER.UTF-8',\n'aa_et':'aa_ET.UTF-8',\n'af':'af_ZA.ISO8859-1',\n'af_za':'af_ZA.ISO8859-1',\n'agr_pe':'agr_PE.UTF-8',\n'ak_gh':'ak_GH.UTF-8',\n'am':'am_ET.UTF-8',\n'am_et':'am_ET.UTF-8',\n'american':'en_US.ISO8859-1',\n'an_es':'an_ES.ISO8859-15',\n'anp_in':'anp_IN.UTF-8',\n'ar':'ar_AA.ISO8859-6',\n'ar_aa':'ar_AA.ISO8859-6',\n'ar_ae':'ar_AE.ISO8859-6',\n'ar_bh':'ar_BH.ISO8859-6',\n'ar_dz':'ar_DZ.ISO8859-6',\n'ar_eg':'ar_EG.ISO8859-6',\n'ar_in':'ar_IN.UTF-8',\n'ar_iq':'ar_IQ.ISO8859-6',\n'ar_jo':'ar_JO.ISO8859-6',\n'ar_kw':'ar_KW.ISO8859-6',\n'ar_lb':'ar_LB.ISO8859-6',\n'ar_ly':'ar_LY.ISO8859-6',\n'ar_ma':'ar_MA.ISO8859-6',\n'ar_om':'ar_OM.ISO8859-6',\n'ar_qa':'ar_QA.ISO8859-6',\n'ar_sa':'ar_SA.ISO8859-6',\n'ar_sd':'ar_SD.ISO8859-6',\n'ar_ss':'ar_SS.UTF-8',\n'ar_sy':'ar_SY.ISO8859-6',\n'ar_tn':'ar_TN.ISO8859-6',\n'ar_ye':'ar_YE.ISO8859-6',\n'arabic':'ar_AA.ISO8859-6',\n'as':'as_IN.UTF-8',\n'as_in':'as_IN.UTF-8',\n'ast_es':'ast_ES.ISO8859-15',\n'ayc_pe':'ayc_PE.UTF-8',\n'az':'az_AZ.ISO8859-9E',\n'az_az':'az_AZ.ISO8859-9E',\n'az_az.iso88599e':'az_AZ.ISO8859-9E',\n'az_ir':'az_IR.UTF-8',\n'be':'be_BY.CP1251',\n'be@latin':'be_BY.UTF-8@latin',\n'be_bg.utf8':'bg_BG.UTF-8',\n'be_by':'be_BY.CP1251',\n'be_by@latin':'be_BY.UTF-8@latin',\n'bem_zm':'bem_ZM.UTF-8',\n'ber_dz':'ber_DZ.UTF-8',\n'ber_ma':'ber_MA.UTF-8',\n'bg':'bg_BG.CP1251',\n'bg_bg':'bg_BG.CP1251',\n'bhb_in.utf8':'bhb_IN.UTF-8',\n'bho_in':'bho_IN.UTF-8',\n'bho_np':'bho_NP.UTF-8',\n'bi_vu':'bi_VU.UTF-8',\n'bn_bd':'bn_BD.UTF-8',\n'bn_in':'bn_IN.UTF-8',\n'bo_cn':'bo_CN.UTF-8',\n'bo_in':'bo_IN.UTF-8',\n'bokmal':'nb_NO.ISO8859-1',\n'bokm\\xe5l':'nb_NO.ISO8859-1',\n'br':'br_FR.ISO8859-1',\n'br_fr':'br_FR.ISO8859-1',\n'brx_in':'brx_IN.UTF-8',\n'bs':'bs_BA.ISO8859-2',\n'bs_ba':'bs_BA.ISO8859-2',\n'bulgarian':'bg_BG.CP1251',\n'byn_er':'byn_ER.UTF-8',\n'c':'C',\n'c-french':'fr_CA.ISO8859-1',\n'c.ascii':'C',\n'c.en':'C',\n'c.iso88591':'en_US.ISO8859-1',\n'c.utf8':'C.UTF-8',\n'c_c':'C',\n'c_c.c':'C',\n'ca':'ca_ES.ISO8859-1',\n'ca_ad':'ca_AD.ISO8859-1',\n'ca_es':'ca_ES.ISO8859-1',\n'ca_es@valencia':'ca_ES.UTF-8@valencia',\n'ca_fr':'ca_FR.ISO8859-1',\n'ca_it':'ca_IT.ISO8859-1',\n'catalan':'ca_ES.ISO8859-1',\n'ce_ru':'ce_RU.UTF-8',\n'cextend':'en_US.ISO8859-1',\n'chinese-s':'zh_CN.eucCN',\n'chinese-t':'zh_TW.eucTW',\n'chr_us':'chr_US.UTF-8',\n'ckb_iq':'ckb_IQ.UTF-8',\n'cmn_tw':'cmn_TW.UTF-8',\n'crh_ua':'crh_UA.UTF-8',\n'croatian':'hr_HR.ISO8859-2',\n'cs':'cs_CZ.ISO8859-2',\n'cs_cs':'cs_CZ.ISO8859-2',\n'cs_cz':'cs_CZ.ISO8859-2',\n'csb_pl':'csb_PL.UTF-8',\n'cv_ru':'cv_RU.UTF-8',\n'cy':'cy_GB.ISO8859-1',\n'cy_gb':'cy_GB.ISO8859-1',\n'cz':'cs_CZ.ISO8859-2',\n'cz_cz':'cs_CZ.ISO8859-2',\n'czech':'cs_CZ.ISO8859-2',\n'da':'da_DK.ISO8859-1',\n'da_dk':'da_DK.ISO8859-1',\n'danish':'da_DK.ISO8859-1',\n'dansk':'da_DK.ISO8859-1',\n'de':'de_DE.ISO8859-1',\n'de_at':'de_AT.ISO8859-1',\n'de_be':'de_BE.ISO8859-1',\n'de_ch':'de_CH.ISO8859-1',\n'de_de':'de_DE.ISO8859-1',\n'de_it':'de_IT.ISO8859-1',\n'de_li.utf8':'de_LI.UTF-8',\n'de_lu':'de_LU.ISO8859-1',\n'deutsch':'de_DE.ISO8859-1',\n'doi_in':'doi_IN.UTF-8',\n'dutch':'nl_NL.ISO8859-1',\n'dutch.iso88591':'nl_BE.ISO8859-1',\n'dv_mv':'dv_MV.UTF-8',\n'dz_bt':'dz_BT.UTF-8',\n'ee':'ee_EE.ISO8859-4',\n'ee_ee':'ee_EE.ISO8859-4',\n'eesti':'et_EE.ISO8859-1',\n'el':'el_GR.ISO8859-7',\n'el_cy':'el_CY.ISO8859-7',\n'el_gr':'el_GR.ISO8859-7',\n'el_gr@euro':'el_GR.ISO8859-15',\n'en':'en_US.ISO8859-1',\n'en_ag':'en_AG.UTF-8',\n'en_au':'en_AU.ISO8859-1',\n'en_be':'en_BE.ISO8859-1',\n'en_bw':'en_BW.ISO8859-1',\n'en_ca':'en_CA.ISO8859-1',\n'en_dk':'en_DK.ISO8859-1',\n'en_dl.utf8':'en_DL.UTF-8',\n'en_gb':'en_GB.ISO8859-1',\n'en_hk':'en_HK.ISO8859-1',\n'en_ie':'en_IE.ISO8859-1',\n'en_il':'en_IL.UTF-8',\n'en_in':'en_IN.ISO8859-1',\n'en_ng':'en_NG.UTF-8',\n'en_nz':'en_NZ.ISO8859-1',\n'en_ph':'en_PH.ISO8859-1',\n'en_sc.utf8':'en_SC.UTF-8',\n'en_sg':'en_SG.ISO8859-1',\n'en_uk':'en_GB.ISO8859-1',\n'en_us':'en_US.ISO8859-1',\n'en_us@euro@euro':'en_US.ISO8859-15',\n'en_za':'en_ZA.ISO8859-1',\n'en_zm':'en_ZM.UTF-8',\n'en_zw':'en_ZW.ISO8859-1',\n'en_zw.utf8':'en_ZS.UTF-8',\n'eng_gb':'en_GB.ISO8859-1',\n'english':'en_EN.ISO8859-1',\n'english.iso88591':'en_US.ISO8859-1',\n'english_uk':'en_GB.ISO8859-1',\n'english_united-states':'en_US.ISO8859-1',\n'english_united-states.437':'C',\n'english_us':'en_US.ISO8859-1',\n'eo':'eo_XX.ISO8859-3',\n'eo.utf8':'eo.UTF-8',\n'eo_eo':'eo_EO.ISO8859-3',\n'eo_us.utf8':'eo_US.UTF-8',\n'eo_xx':'eo_XX.ISO8859-3',\n'es':'es_ES.ISO8859-1',\n'es_ar':'es_AR.ISO8859-1',\n'es_bo':'es_BO.ISO8859-1',\n'es_cl':'es_CL.ISO8859-1',\n'es_co':'es_CO.ISO8859-1',\n'es_cr':'es_CR.ISO8859-1',\n'es_cu':'es_CU.UTF-8',\n'es_do':'es_DO.ISO8859-1',\n'es_ec':'es_EC.ISO8859-1',\n'es_es':'es_ES.ISO8859-1',\n'es_gt':'es_GT.ISO8859-1',\n'es_hn':'es_HN.ISO8859-1',\n'es_mx':'es_MX.ISO8859-1',\n'es_ni':'es_NI.ISO8859-1',\n'es_pa':'es_PA.ISO8859-1',\n'es_pe':'es_PE.ISO8859-1',\n'es_pr':'es_PR.ISO8859-1',\n'es_py':'es_PY.ISO8859-1',\n'es_sv':'es_SV.ISO8859-1',\n'es_us':'es_US.ISO8859-1',\n'es_uy':'es_UY.ISO8859-1',\n'es_ve':'es_VE.ISO8859-1',\n'estonian':'et_EE.ISO8859-1',\n'et':'et_EE.ISO8859-15',\n'et_ee':'et_EE.ISO8859-15',\n'eu':'eu_ES.ISO8859-1',\n'eu_es':'eu_ES.ISO8859-1',\n'eu_fr':'eu_FR.ISO8859-1',\n'fa':'fa_IR.UTF-8',\n'fa_ir':'fa_IR.UTF-8',\n'fa_ir.isiri3342':'fa_IR.ISIRI-3342',\n'ff_sn':'ff_SN.UTF-8',\n'fi':'fi_FI.ISO8859-15',\n'fi_fi':'fi_FI.ISO8859-15',\n'fil_ph':'fil_PH.UTF-8',\n'finnish':'fi_FI.ISO8859-1',\n'fo':'fo_FO.ISO8859-1',\n'fo_fo':'fo_FO.ISO8859-1',\n'fr':'fr_FR.ISO8859-1',\n'fr_be':'fr_BE.ISO8859-1',\n'fr_ca':'fr_CA.ISO8859-1',\n'fr_ch':'fr_CH.ISO8859-1',\n'fr_fr':'fr_FR.ISO8859-1',\n'fr_lu':'fr_LU.ISO8859-1',\n'fran\\xe7ais':'fr_FR.ISO8859-1',\n'fre_fr':'fr_FR.ISO8859-1',\n'french':'fr_FR.ISO8859-1',\n'french.iso88591':'fr_CH.ISO8859-1',\n'french_france':'fr_FR.ISO8859-1',\n'fur_it':'fur_IT.UTF-8',\n'fy_de':'fy_DE.UTF-8',\n'fy_nl':'fy_NL.UTF-8',\n'ga':'ga_IE.ISO8859-1',\n'ga_ie':'ga_IE.ISO8859-1',\n'galego':'gl_ES.ISO8859-1',\n'galician':'gl_ES.ISO8859-1',\n'gd':'gd_GB.ISO8859-1',\n'gd_gb':'gd_GB.ISO8859-1',\n'ger_de':'de_DE.ISO8859-1',\n'german':'de_DE.ISO8859-1',\n'german.iso88591':'de_CH.ISO8859-1',\n'german_germany':'de_DE.ISO8859-1',\n'gez_er':'gez_ER.UTF-8',\n'gez_et':'gez_ET.UTF-8',\n'gl':'gl_ES.ISO8859-1',\n'gl_es':'gl_ES.ISO8859-1',\n'greek':'el_GR.ISO8859-7',\n'gu_in':'gu_IN.UTF-8',\n'gv':'gv_GB.ISO8859-1',\n'gv_gb':'gv_GB.ISO8859-1',\n'ha_ng':'ha_NG.UTF-8',\n'hak_tw':'hak_TW.UTF-8',\n'he':'he_IL.ISO8859-8',\n'he_il':'he_IL.ISO8859-8',\n'hebrew':'he_IL.ISO8859-8',\n'hi':'hi_IN.ISCII-DEV',\n'hi_in':'hi_IN.ISCII-DEV',\n'hi_in.isciidev':'hi_IN.ISCII-DEV',\n'hif_fj':'hif_FJ.UTF-8',\n'hne':'hne_IN.UTF-8',\n'hne_in':'hne_IN.UTF-8',\n'hr':'hr_HR.ISO8859-2',\n'hr_hr':'hr_HR.ISO8859-2',\n'hrvatski':'hr_HR.ISO8859-2',\n'hsb_de':'hsb_DE.ISO8859-2',\n'ht_ht':'ht_HT.UTF-8',\n'hu':'hu_HU.ISO8859-2',\n'hu_hu':'hu_HU.ISO8859-2',\n'hungarian':'hu_HU.ISO8859-2',\n'hy_am':'hy_AM.UTF-8',\n'hy_am.armscii8':'hy_AM.ARMSCII_8',\n'ia':'ia.UTF-8',\n'ia_fr':'ia_FR.UTF-8',\n'icelandic':'is_IS.ISO8859-1',\n'id':'id_ID.ISO8859-1',\n'id_id':'id_ID.ISO8859-1',\n'ig_ng':'ig_NG.UTF-8',\n'ik_ca':'ik_CA.UTF-8',\n'in':'id_ID.ISO8859-1',\n'in_id':'id_ID.ISO8859-1',\n'is':'is_IS.ISO8859-1',\n'is_is':'is_IS.ISO8859-1',\n'iso-8859-1':'en_US.ISO8859-1',\n'iso-8859-15':'en_US.ISO8859-15',\n'iso8859-1':'en_US.ISO8859-1',\n'iso8859-15':'en_US.ISO8859-15',\n'iso_8859_1':'en_US.ISO8859-1',\n'iso_8859_15':'en_US.ISO8859-15',\n'it':'it_IT.ISO8859-1',\n'it_ch':'it_CH.ISO8859-1',\n'it_it':'it_IT.ISO8859-1',\n'italian':'it_IT.ISO8859-1',\n'iu':'iu_CA.NUNACOM-8',\n'iu_ca':'iu_CA.NUNACOM-8',\n'iu_ca.nunacom8':'iu_CA.NUNACOM-8',\n'iw':'he_IL.ISO8859-8',\n'iw_il':'he_IL.ISO8859-8',\n'iw_il.utf8':'iw_IL.UTF-8',\n'ja':'ja_JP.eucJP',\n'ja_jp':'ja_JP.eucJP',\n'ja_jp.euc':'ja_JP.eucJP',\n'ja_jp.mscode':'ja_JP.SJIS',\n'ja_jp.pck':'ja_JP.SJIS',\n'japan':'ja_JP.eucJP',\n'japanese':'ja_JP.eucJP',\n'japanese-euc':'ja_JP.eucJP',\n'japanese.euc':'ja_JP.eucJP',\n'jp_jp':'ja_JP.eucJP',\n'ka':'ka_GE.GEORGIAN-ACADEMY',\n'ka_ge':'ka_GE.GEORGIAN-ACADEMY',\n'ka_ge.georgianacademy':'ka_GE.GEORGIAN-ACADEMY',\n'ka_ge.georgianps':'ka_GE.GEORGIAN-PS',\n'ka_ge.georgianrs':'ka_GE.GEORGIAN-ACADEMY',\n'kab_dz':'kab_DZ.UTF-8',\n'kk_kz':'kk_KZ.ptcp154',\n'kl':'kl_GL.ISO8859-1',\n'kl_gl':'kl_GL.ISO8859-1',\n'km_kh':'km_KH.UTF-8',\n'kn':'kn_IN.UTF-8',\n'kn_in':'kn_IN.UTF-8',\n'ko':'ko_KR.eucKR',\n'ko_kr':'ko_KR.eucKR',\n'ko_kr.euc':'ko_KR.eucKR',\n'kok_in':'kok_IN.UTF-8',\n'korean':'ko_KR.eucKR',\n'korean.euc':'ko_KR.eucKR',\n'ks':'ks_IN.UTF-8',\n'ks_in':'ks_IN.UTF-8',\n'ks_in@devanagari.utf8':'ks_IN.UTF-8@devanagari',\n'ku_tr':'ku_TR.ISO8859-9',\n'kw':'kw_GB.ISO8859-1',\n'kw_gb':'kw_GB.ISO8859-1',\n'ky':'ky_KG.UTF-8',\n'ky_kg':'ky_KG.UTF-8',\n'lb_lu':'lb_LU.UTF-8',\n'lg_ug':'lg_UG.ISO8859-10',\n'li_be':'li_BE.UTF-8',\n'li_nl':'li_NL.UTF-8',\n'lij_it':'lij_IT.UTF-8',\n'lithuanian':'lt_LT.ISO8859-13',\n'ln_cd':'ln_CD.UTF-8',\n'lo':'lo_LA.MULELAO-1',\n'lo_la':'lo_LA.MULELAO-1',\n'lo_la.cp1133':'lo_LA.IBM-CP1133',\n'lo_la.ibmcp1133':'lo_LA.IBM-CP1133',\n'lo_la.mulelao1':'lo_LA.MULELAO-1',\n'lt':'lt_LT.ISO8859-13',\n'lt_lt':'lt_LT.ISO8859-13',\n'lv':'lv_LV.ISO8859-13',\n'lv_lv':'lv_LV.ISO8859-13',\n'lzh_tw':'lzh_TW.UTF-8',\n'mag_in':'mag_IN.UTF-8',\n'mai':'mai_IN.UTF-8',\n'mai_in':'mai_IN.UTF-8',\n'mai_np':'mai_NP.UTF-8',\n'mfe_mu':'mfe_MU.UTF-8',\n'mg_mg':'mg_MG.ISO8859-15',\n'mhr_ru':'mhr_RU.UTF-8',\n'mi':'mi_NZ.ISO8859-1',\n'mi_nz':'mi_NZ.ISO8859-1',\n'miq_ni':'miq_NI.UTF-8',\n'mjw_in':'mjw_IN.UTF-8',\n'mk':'mk_MK.ISO8859-5',\n'mk_mk':'mk_MK.ISO8859-5',\n'ml':'ml_IN.UTF-8',\n'ml_in':'ml_IN.UTF-8',\n'mn_mn':'mn_MN.UTF-8',\n'mni_in':'mni_IN.UTF-8',\n'mr':'mr_IN.UTF-8',\n'mr_in':'mr_IN.UTF-8',\n'ms':'ms_MY.ISO8859-1',\n'ms_my':'ms_MY.ISO8859-1',\n'mt':'mt_MT.ISO8859-3',\n'mt_mt':'mt_MT.ISO8859-3',\n'my_mm':'my_MM.UTF-8',\n'nan_tw':'nan_TW.UTF-8',\n'nb':'nb_NO.ISO8859-1',\n'nb_no':'nb_NO.ISO8859-1',\n'nds_de':'nds_DE.UTF-8',\n'nds_nl':'nds_NL.UTF-8',\n'ne_np':'ne_NP.UTF-8',\n'nhn_mx':'nhn_MX.UTF-8',\n'niu_nu':'niu_NU.UTF-8',\n'niu_nz':'niu_NZ.UTF-8',\n'nl':'nl_NL.ISO8859-1',\n'nl_aw':'nl_AW.UTF-8',\n'nl_be':'nl_BE.ISO8859-1',\n'nl_nl':'nl_NL.ISO8859-1',\n'nn':'nn_NO.ISO8859-1',\n'nn_no':'nn_NO.ISO8859-1',\n'no':'no_NO.ISO8859-1',\n'no@nynorsk':'ny_NO.ISO8859-1',\n'no_no':'no_NO.ISO8859-1',\n'no_no.iso88591@bokmal':'no_NO.ISO8859-1',\n'no_no.iso88591@nynorsk':'no_NO.ISO8859-1',\n'norwegian':'no_NO.ISO8859-1',\n'nr':'nr_ZA.ISO8859-1',\n'nr_za':'nr_ZA.ISO8859-1',\n'nso':'nso_ZA.ISO8859-15',\n'nso_za':'nso_ZA.ISO8859-15',\n'ny':'ny_NO.ISO8859-1',\n'ny_no':'ny_NO.ISO8859-1',\n'nynorsk':'nn_NO.ISO8859-1',\n'oc':'oc_FR.ISO8859-1',\n'oc_fr':'oc_FR.ISO8859-1',\n'om_et':'om_ET.UTF-8',\n'om_ke':'om_KE.ISO8859-1',\n'or':'or_IN.UTF-8',\n'or_in':'or_IN.UTF-8',\n'os_ru':'os_RU.UTF-8',\n'pa':'pa_IN.UTF-8',\n'pa_in':'pa_IN.UTF-8',\n'pa_pk':'pa_PK.UTF-8',\n'pap_an':'pap_AN.UTF-8',\n'pap_aw':'pap_AW.UTF-8',\n'pap_cw':'pap_CW.UTF-8',\n'pd':'pd_US.ISO8859-1',\n'pd_de':'pd_DE.ISO8859-1',\n'pd_us':'pd_US.ISO8859-1',\n'ph':'ph_PH.ISO8859-1',\n'ph_ph':'ph_PH.ISO8859-1',\n'pl':'pl_PL.ISO8859-2',\n'pl_pl':'pl_PL.ISO8859-2',\n'polish':'pl_PL.ISO8859-2',\n'portuguese':'pt_PT.ISO8859-1',\n'portuguese_brazil':'pt_BR.ISO8859-1',\n'posix':'C',\n'posix-utf2':'C',\n'pp':'pp_AN.ISO8859-1',\n'pp_an':'pp_AN.ISO8859-1',\n'ps_af':'ps_AF.UTF-8',\n'pt':'pt_PT.ISO8859-1',\n'pt_br':'pt_BR.ISO8859-1',\n'pt_pt':'pt_PT.ISO8859-1',\n'quz_pe':'quz_PE.UTF-8',\n'raj_in':'raj_IN.UTF-8',\n'ro':'ro_RO.ISO8859-2',\n'ro_ro':'ro_RO.ISO8859-2',\n'romanian':'ro_RO.ISO8859-2',\n'ru':'ru_RU.UTF-8',\n'ru_ru':'ru_RU.UTF-8',\n'ru_ua':'ru_UA.KOI8-U',\n'rumanian':'ro_RO.ISO8859-2',\n'russian':'ru_RU.KOI8-R',\n'rw':'rw_RW.ISO8859-1',\n'rw_rw':'rw_RW.ISO8859-1',\n'sa_in':'sa_IN.UTF-8',\n'sat_in':'sat_IN.UTF-8',\n'sc_it':'sc_IT.UTF-8',\n'sd':'sd_IN.UTF-8',\n'sd_in':'sd_IN.UTF-8',\n'sd_in@devanagari.utf8':'sd_IN.UTF-8@devanagari',\n'sd_pk':'sd_PK.UTF-8',\n'se_no':'se_NO.UTF-8',\n'serbocroatian':'sr_RS.UTF-8@latin',\n'sgs_lt':'sgs_LT.UTF-8',\n'sh':'sr_RS.UTF-8@latin',\n'sh_ba.iso88592@bosnia':'sr_CS.ISO8859-2',\n'sh_hr':'sh_HR.ISO8859-2',\n'sh_hr.iso88592':'hr_HR.ISO8859-2',\n'sh_sp':'sr_CS.ISO8859-2',\n'sh_yu':'sr_RS.UTF-8@latin',\n'shn_mm':'shn_MM.UTF-8',\n'shs_ca':'shs_CA.UTF-8',\n'si':'si_LK.UTF-8',\n'si_lk':'si_LK.UTF-8',\n'sid_et':'sid_ET.UTF-8',\n'sinhala':'si_LK.UTF-8',\n'sk':'sk_SK.ISO8859-2',\n'sk_sk':'sk_SK.ISO8859-2',\n'sl':'sl_SI.ISO8859-2',\n'sl_cs':'sl_CS.ISO8859-2',\n'sl_si':'sl_SI.ISO8859-2',\n'slovak':'sk_SK.ISO8859-2',\n'slovene':'sl_SI.ISO8859-2',\n'slovenian':'sl_SI.ISO8859-2',\n'sm_ws':'sm_WS.UTF-8',\n'so_dj':'so_DJ.ISO8859-1',\n'so_et':'so_ET.UTF-8',\n'so_ke':'so_KE.ISO8859-1',\n'so_so':'so_SO.ISO8859-1',\n'sp':'sr_CS.ISO8859-5',\n'sp_yu':'sr_CS.ISO8859-5',\n'spanish':'es_ES.ISO8859-1',\n'spanish_spain':'es_ES.ISO8859-1',\n'sq':'sq_AL.ISO8859-2',\n'sq_al':'sq_AL.ISO8859-2',\n'sq_mk':'sq_MK.UTF-8',\n'sr':'sr_RS.UTF-8',\n'sr@cyrillic':'sr_RS.UTF-8',\n'sr@latn':'sr_CS.UTF-8@latin',\n'sr_cs':'sr_CS.UTF-8',\n'sr_cs.iso88592@latn':'sr_CS.ISO8859-2',\n'sr_cs@latn':'sr_CS.UTF-8@latin',\n'sr_me':'sr_ME.UTF-8',\n'sr_rs':'sr_RS.UTF-8',\n'sr_rs@latn':'sr_RS.UTF-8@latin',\n'sr_sp':'sr_CS.ISO8859-2',\n'sr_yu':'sr_RS.UTF-8@latin',\n'sr_yu.cp1251@cyrillic':'sr_CS.CP1251',\n'sr_yu.iso88592':'sr_CS.ISO8859-2',\n'sr_yu.iso88595':'sr_CS.ISO8859-5',\n'sr_yu.iso88595@cyrillic':'sr_CS.ISO8859-5',\n'sr_yu.microsoftcp1251@cyrillic':'sr_CS.CP1251',\n'sr_yu.utf8':'sr_RS.UTF-8',\n'sr_yu.utf8@cyrillic':'sr_RS.UTF-8',\n'sr_yu@cyrillic':'sr_RS.UTF-8',\n'ss':'ss_ZA.ISO8859-1',\n'ss_za':'ss_ZA.ISO8859-1',\n'st':'st_ZA.ISO8859-1',\n'st_za':'st_ZA.ISO8859-1',\n'sv':'sv_SE.ISO8859-1',\n'sv_fi':'sv_FI.ISO8859-1',\n'sv_se':'sv_SE.ISO8859-1',\n'sw_ke':'sw_KE.UTF-8',\n'sw_tz':'sw_TZ.UTF-8',\n'swedish':'sv_SE.ISO8859-1',\n'szl_pl':'szl_PL.UTF-8',\n'ta':'ta_IN.TSCII-0',\n'ta_in':'ta_IN.TSCII-0',\n'ta_in.tscii':'ta_IN.TSCII-0',\n'ta_in.tscii0':'ta_IN.TSCII-0',\n'ta_lk':'ta_LK.UTF-8',\n'tcy_in.utf8':'tcy_IN.UTF-8',\n'te':'te_IN.UTF-8',\n'te_in':'te_IN.UTF-8',\n'tg':'tg_TJ.KOI8-C',\n'tg_tj':'tg_TJ.KOI8-C',\n'th':'th_TH.ISO8859-11',\n'th_th':'th_TH.ISO8859-11',\n'th_th.tactis':'th_TH.TIS620',\n'th_th.tis620':'th_TH.TIS620',\n'thai':'th_TH.ISO8859-11',\n'the_np':'the_NP.UTF-8',\n'ti_er':'ti_ER.UTF-8',\n'ti_et':'ti_ET.UTF-8',\n'tig_er':'tig_ER.UTF-8',\n'tk_tm':'tk_TM.UTF-8',\n'tl':'tl_PH.ISO8859-1',\n'tl_ph':'tl_PH.ISO8859-1',\n'tn':'tn_ZA.ISO8859-15',\n'tn_za':'tn_ZA.ISO8859-15',\n'to_to':'to_TO.UTF-8',\n'tpi_pg':'tpi_PG.UTF-8',\n'tr':'tr_TR.ISO8859-9',\n'tr_cy':'tr_CY.ISO8859-9',\n'tr_tr':'tr_TR.ISO8859-9',\n'ts':'ts_ZA.ISO8859-1',\n'ts_za':'ts_ZA.ISO8859-1',\n'tt':'tt_RU.TATAR-CYR',\n'tt_ru':'tt_RU.TATAR-CYR',\n'tt_ru.tatarcyr':'tt_RU.TATAR-CYR',\n'tt_ru@iqtelif':'tt_RU.UTF-8@iqtelif',\n'turkish':'tr_TR.ISO8859-9',\n'ug_cn':'ug_CN.UTF-8',\n'uk':'uk_UA.KOI8-U',\n'uk_ua':'uk_UA.KOI8-U',\n'univ':'en_US.utf',\n'universal':'en_US.utf',\n'universal.utf8@ucs4':'en_US.UTF-8',\n'unm_us':'unm_US.UTF-8',\n'ur':'ur_PK.CP1256',\n'ur_in':'ur_IN.UTF-8',\n'ur_pk':'ur_PK.CP1256',\n'uz':'uz_UZ.UTF-8',\n'uz_uz':'uz_UZ.UTF-8',\n'uz_uz@cyrillic':'uz_UZ.UTF-8',\n've':'ve_ZA.UTF-8',\n've_za':'ve_ZA.UTF-8',\n'vi':'vi_VN.TCVN',\n'vi_vn':'vi_VN.TCVN',\n'vi_vn.tcvn':'vi_VN.TCVN',\n'vi_vn.tcvn5712':'vi_VN.TCVN',\n'vi_vn.viscii':'vi_VN.VISCII',\n'vi_vn.viscii111':'vi_VN.VISCII',\n'wa':'wa_BE.ISO8859-1',\n'wa_be':'wa_BE.ISO8859-1',\n'wae_ch':'wae_CH.UTF-8',\n'wal_et':'wal_ET.UTF-8',\n'wo_sn':'wo_SN.UTF-8',\n'xh':'xh_ZA.ISO8859-1',\n'xh_za':'xh_ZA.ISO8859-1',\n'yi':'yi_US.CP1255',\n'yi_us':'yi_US.CP1255',\n'yo_ng':'yo_NG.UTF-8',\n'yue_hk':'yue_HK.UTF-8',\n'yuw_pg':'yuw_PG.UTF-8',\n'zh':'zh_CN.eucCN',\n'zh_cn':'zh_CN.gb2312',\n'zh_cn.big5':'zh_TW.big5',\n'zh_cn.euc':'zh_CN.eucCN',\n'zh_hk':'zh_HK.big5hkscs',\n'zh_hk.big5hk':'zh_HK.big5hkscs',\n'zh_sg':'zh_SG.GB2312',\n'zh_sg.gbk':'zh_SG.GBK',\n'zh_tw':'zh_TW.big5',\n'zh_tw.euc':'zh_TW.eucTW',\n'zh_tw.euctw':'zh_TW.eucTW',\n'zu':'zu_ZA.ISO8859-1',\n'zu_za':'zu_ZA.ISO8859-1',\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nwindows_locale={\n0x0436:\"af_ZA\",\n0x041c:\"sq_AL\",\n0x0484:\"gsw_FR\",\n0x045e:\"am_ET\",\n0x0401:\"ar_SA\",\n0x0801:\"ar_IQ\",\n0x0c01:\"ar_EG\",\n0x1001:\"ar_LY\",\n0x1401:\"ar_DZ\",\n0x1801:\"ar_MA\",\n0x1c01:\"ar_TN\",\n0x2001:\"ar_OM\",\n0x2401:\"ar_YE\",\n0x2801:\"ar_SY\",\n0x2c01:\"ar_JO\",\n0x3001:\"ar_LB\",\n0x3401:\"ar_KW\",\n0x3801:\"ar_AE\",\n0x3c01:\"ar_BH\",\n0x4001:\"ar_QA\",\n0x042b:\"hy_AM\",\n0x044d:\"as_IN\",\n0x042c:\"az_AZ\",\n0x082c:\"az_AZ\",\n0x046d:\"ba_RU\",\n0x042d:\"eu_ES\",\n0x0423:\"be_BY\",\n0x0445:\"bn_IN\",\n0x201a:\"bs_BA\",\n0x141a:\"bs_BA\",\n0x047e:\"br_FR\",\n0x0402:\"bg_BG\",\n\n0x0403:\"ca_ES\",\n0x0004:\"zh_CHS\",\n0x0404:\"zh_TW\",\n0x0804:\"zh_CN\",\n0x0c04:\"zh_HK\",\n0x1004:\"zh_SG\",\n0x1404:\"zh_MO\",\n0x7c04:\"zh_CHT\",\n0x0483:\"co_FR\",\n0x041a:\"hr_HR\",\n0x101a:\"hr_BA\",\n0x0405:\"cs_CZ\",\n0x0406:\"da_DK\",\n0x048c:\"gbz_AF\",\n0x0465:\"div_MV\",\n0x0413:\"nl_NL\",\n0x0813:\"nl_BE\",\n0x0409:\"en_US\",\n0x0809:\"en_GB\",\n0x0c09:\"en_AU\",\n0x1009:\"en_CA\",\n0x1409:\"en_NZ\",\n0x1809:\"en_IE\",\n0x1c09:\"en_ZA\",\n0x2009:\"en_JA\",\n0x2409:\"en_CB\",\n0x2809:\"en_BZ\",\n0x2c09:\"en_TT\",\n0x3009:\"en_ZW\",\n0x3409:\"en_PH\",\n0x4009:\"en_IN\",\n0x4409:\"en_MY\",\n0x4809:\"en_IN\",\n0x0425:\"et_EE\",\n0x0438:\"fo_FO\",\n0x0464:\"fil_PH\",\n0x040b:\"fi_FI\",\n0x040c:\"fr_FR\",\n0x080c:\"fr_BE\",\n0x0c0c:\"fr_CA\",\n0x100c:\"fr_CH\",\n0x140c:\"fr_LU\",\n0x180c:\"fr_MC\",\n0x0462:\"fy_NL\",\n0x0456:\"gl_ES\",\n0x0437:\"ka_GE\",\n0x0407:\"de_DE\",\n0x0807:\"de_CH\",\n0x0c07:\"de_AT\",\n0x1007:\"de_LU\",\n0x1407:\"de_LI\",\n0x0408:\"el_GR\",\n0x046f:\"kl_GL\",\n0x0447:\"gu_IN\",\n0x0468:\"ha_NG\",\n0x040d:\"he_IL\",\n0x0439:\"hi_IN\",\n0x040e:\"hu_HU\",\n0x040f:\"is_IS\",\n0x0421:\"id_ID\",\n0x045d:\"iu_CA\",\n0x085d:\"iu_CA\",\n0x083c:\"ga_IE\",\n0x0410:\"it_IT\",\n0x0810:\"it_CH\",\n0x0411:\"ja_JP\",\n0x044b:\"kn_IN\",\n0x043f:\"kk_KZ\",\n0x0453:\"kh_KH\",\n0x0486:\"qut_GT\",\n0x0487:\"rw_RW\",\n0x0457:\"kok_IN\",\n0x0412:\"ko_KR\",\n0x0440:\"ky_KG\",\n0x0454:\"lo_LA\",\n0x0426:\"lv_LV\",\n0x0427:\"lt_LT\",\n0x082e:\"dsb_DE\",\n0x046e:\"lb_LU\",\n0x042f:\"mk_MK\",\n0x043e:\"ms_MY\",\n0x083e:\"ms_BN\",\n0x044c:\"ml_IN\",\n0x043a:\"mt_MT\",\n0x0481:\"mi_NZ\",\n0x047a:\"arn_CL\",\n0x044e:\"mr_IN\",\n0x047c:\"moh_CA\",\n0x0450:\"mn_MN\",\n0x0850:\"mn_CN\",\n0x0461:\"ne_NP\",\n0x0414:\"nb_NO\",\n0x0814:\"nn_NO\",\n0x0482:\"oc_FR\",\n0x0448:\"or_IN\",\n0x0463:\"ps_AF\",\n0x0429:\"fa_IR\",\n0x0415:\"pl_PL\",\n0x0416:\"pt_BR\",\n0x0816:\"pt_PT\",\n0x0446:\"pa_IN\",\n0x046b:\"quz_BO\",\n0x086b:\"quz_EC\",\n0x0c6b:\"quz_PE\",\n0x0418:\"ro_RO\",\n0x0417:\"rm_CH\",\n0x0419:\"ru_RU\",\n0x243b:\"smn_FI\",\n0x103b:\"smj_NO\",\n0x143b:\"smj_SE\",\n0x043b:\"se_NO\",\n0x083b:\"se_SE\",\n0x0c3b:\"se_FI\",\n0x203b:\"sms_FI\",\n0x183b:\"sma_NO\",\n0x1c3b:\"sma_SE\",\n0x044f:\"sa_IN\",\n0x0c1a:\"sr_SP\",\n0x1c1a:\"sr_BA\",\n0x081a:\"sr_SP\",\n0x181a:\"sr_BA\",\n0x045b:\"si_LK\",\n0x046c:\"ns_ZA\",\n0x0432:\"tn_ZA\",\n0x041b:\"sk_SK\",\n0x0424:\"sl_SI\",\n0x040a:\"es_ES\",\n0x080a:\"es_MX\",\n0x0c0a:\"es_ES\",\n0x100a:\"es_GT\",\n0x140a:\"es_CR\",\n0x180a:\"es_PA\",\n0x1c0a:\"es_DO\",\n0x200a:\"es_VE\",\n0x240a:\"es_CO\",\n0x280a:\"es_PE\",\n0x2c0a:\"es_AR\",\n0x300a:\"es_EC\",\n0x340a:\"es_CL\",\n0x380a:\"es_UR\",\n0x3c0a:\"es_PY\",\n0x400a:\"es_BO\",\n0x440a:\"es_SV\",\n0x480a:\"es_HN\",\n0x4c0a:\"es_NI\",\n0x500a:\"es_PR\",\n0x540a:\"es_US\",\n\n0x0441:\"sw_KE\",\n0x041d:\"sv_SE\",\n0x081d:\"sv_FI\",\n0x045a:\"syr_SY\",\n0x0428:\"tg_TJ\",\n0x085f:\"tmz_DZ\",\n0x0449:\"ta_IN\",\n0x0444:\"tt_RU\",\n0x044a:\"te_IN\",\n0x041e:\"th_TH\",\n0x0851:\"bo_BT\",\n0x0451:\"bo_CN\",\n0x041f:\"tr_TR\",\n0x0442:\"tk_TM\",\n0x0480:\"ug_CN\",\n0x0422:\"uk_UA\",\n0x042e:\"wen_DE\",\n0x0420:\"ur_PK\",\n0x0820:\"ur_IN\",\n0x0443:\"uz_UZ\",\n0x0843:\"uz_UZ\",\n0x042a:\"vi_VN\",\n0x0452:\"cy_GB\",\n0x0488:\"wo_SN\",\n0x0434:\"xh_ZA\",\n0x0485:\"sah_RU\",\n0x0478:\"ii_CN\",\n0x046a:\"yo_NG\",\n0x0435:\"zu_ZA\",\n}\n\ndef _print_locale():\n\n ''\n \n categories={}\n def _init_categories(categories=categories):\n for k,v in globals().items():\n if k[:3]=='LC_':\n categories[k]=v\n _init_categories()\n del categories['LC_ALL']\n \n print('Locale defaults as determined by getdefaultlocale():')\n print('-'*72)\n lang,enc=getdefaultlocale()\n print('Language: ',lang or '(undefined)')\n print('Encoding: ',enc or '(undefined)')\n print()\n \n print('Locale settings on startup:')\n print('-'*72)\n for name,category in categories.items():\n print(name,'...')\n lang,enc=getlocale(category)\n print(' Language: ',lang or '(undefined)')\n print(' Encoding: ',enc or '(undefined)')\n print()\n \n print()\n print('Locale settings after calling resetlocale():')\n print('-'*72)\n resetlocale()\n for name,category in categories.items():\n print(name,'...')\n lang,enc=getlocale(category)\n print(' Language: ',lang or '(undefined)')\n print(' Encoding: ',enc or '(undefined)')\n print()\n \n try:\n setlocale(LC_ALL,\"\")\n except:\n print('NOTE:')\n print('setlocale(LC_ALL, \"\") does not support the default locale')\n print('given in the OS environment variables.')\n else:\n print()\n print('Locale settings after calling setlocale(LC_ALL, \"\"):')\n print('-'*72)\n for name,category in categories.items():\n print(name,'...')\n lang,enc=getlocale(category)\n print(' Language: ',lang or '(undefined)')\n print(' Encoding: ',enc or '(undefined)')\n print()\n \n \n \ntry:\n LC_MESSAGES\nexcept NameError:\n pass\nelse:\n __all__.append(\"LC_MESSAGES\")\n \nif __name__ =='__main__':\n print('Locale aliasing:')\n print()\n _print_locale()\n print()\n print('Number formatting:')\n print()\n _test()\n", ["_collections_abc", "_locale", "builtins", "encodings", "encodings.aliases", "functools", "os", "re", "sys", "warnings"]], "mimetypes": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport os\nimport sys\nimport posixpath\nimport urllib.parse\n\ntry:\n from _winapi import _mimetypes_read_windows_registry\nexcept ImportError:\n _mimetypes_read_windows_registry=None\n \ntry:\n import winreg as _winreg\nexcept ImportError:\n _winreg=None\n \n__all__=[\n\"knownfiles\",\"inited\",\"MimeTypes\",\n\"guess_type\",\"guess_all_extensions\",\"guess_extension\",\n\"add_type\",\"init\",\"read_mime_types\",\n\"suffix_map\",\"encodings_map\",\"types_map\",\"common_types\"\n]\n\nknownfiles=[\n\"/etc/mime.types\",\n\"/etc/httpd/mime.types\",\n\"/etc/httpd/conf/mime.types\",\n\"/etc/apache/mime.types\",\n\"/etc/apache2/mime.types\",\n\"/usr/local/etc/httpd/conf/mime.types\",\n\"/usr/local/lib/netscape/mime.types\",\n\"/usr/local/etc/httpd/conf/mime.types\",\n\"/usr/local/etc/mime.types\",\n]\n\ninited=False\n_db=None\n\n\nclass MimeTypes:\n ''\n\n\n\n\n \n \n def __init__(self,filenames=(),strict=True):\n if not inited:\n init()\n self.encodings_map=_encodings_map_default.copy()\n self.suffix_map=_suffix_map_default.copy()\n self.types_map=({},{})\n self.types_map_inv=({},{})\n for(ext,type)in _types_map_default.items():\n self.add_type(type,ext,True)\n for(ext,type)in _common_types_default.items():\n self.add_type(type,ext,False)\n for name in filenames:\n self.read(name,strict)\n \n def add_type(self,type,ext,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n \n self.types_map[strict][ext]=type\n exts=self.types_map_inv[strict].setdefault(type,[])\n if ext not in exts:\n exts.append(ext)\n \n def guess_type(self,url,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n url=os.fspath(url)\n scheme,url=urllib.parse._splittype(url)\n if scheme =='data':\n \n \n \n \n \n \n comma=url.find(',')\n if comma <0:\n \n return None,None\n semi=url.find(';',0,comma)\n if semi >=0:\n type=url[:semi]\n else:\n type=url[:comma]\n if '='in type or '/'not in type:\n type='text/plain'\n return type,None\n base,ext=posixpath.splitext(url)\n while(ext_lower :=ext.lower())in self.suffix_map:\n base,ext=posixpath.splitext(base+self.suffix_map[ext_lower])\n \n if ext in self.encodings_map:\n encoding=self.encodings_map[ext]\n base,ext=posixpath.splitext(base)\n else:\n encoding=None\n ext=ext.lower()\n types_map=self.types_map[True]\n if ext in types_map:\n return types_map[ext],encoding\n elif strict:\n return None,encoding\n types_map=self.types_map[False]\n if ext in types_map:\n return types_map[ext],encoding\n else:\n return None,encoding\n \n def guess_all_extensions(self,type,strict=True):\n ''\n\n\n\n\n\n\n\n\n \n type=type.lower()\n extensions=list(self.types_map_inv[True].get(type,[]))\n if not strict:\n for ext in self.types_map_inv[False].get(type,[]):\n if ext not in extensions:\n extensions.append(ext)\n return extensions\n \n def guess_extension(self,type,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n\n \n extensions=self.guess_all_extensions(type,strict)\n if not extensions:\n return None\n return extensions[0]\n \n def read(self,filename,strict=True):\n ''\n\n\n\n\n\n \n with open(filename,encoding='utf-8')as fp:\n self.readfp(fp,strict)\n \n def readfp(self,fp,strict=True):\n ''\n\n\n\n\n\n \n while line :=fp.readline():\n words=line.split()\n for i in range(len(words)):\n if words[i][0]=='#':\n del words[i:]\n break\n if not words:\n continue\n type,suffixes=words[0],words[1:]\n for suff in suffixes:\n self.add_type(type,'.'+suff,strict)\n \n def read_windows_registry(self,strict=True):\n ''\n\n\n\n\n\n \n \n if not _mimetypes_read_windows_registry and not _winreg:\n return\n \n add_type=self.add_type\n if strict:\n add_type=lambda type,ext:self.add_type(type,ext,True)\n \n \n if _mimetypes_read_windows_registry:\n _mimetypes_read_windows_registry(add_type)\n elif _winreg:\n self._read_windows_registry(add_type)\n \n @classmethod\n def _read_windows_registry(cls,add_type):\n def enum_types(mimedb):\n i=0\n while True:\n try:\n ctype=_winreg.EnumKey(mimedb,i)\n except OSError:\n break\n else:\n if '\\0'not in ctype:\n yield ctype\n i +=1\n \n with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,'')as hkcr:\n for subkeyname in enum_types(hkcr):\n try:\n with _winreg.OpenKey(hkcr,subkeyname)as subkey:\n \n if not subkeyname.startswith(\".\"):\n continue\n \n mimetype,datatype=_winreg.QueryValueEx(\n subkey,'Content Type')\n if datatype !=_winreg.REG_SZ:\n continue\n add_type(mimetype,subkeyname)\n except OSError:\n continue\n \ndef guess_type(url,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if _db is None:\n init()\n return _db.guess_type(url,strict)\n \n \ndef guess_all_extensions(type,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if _db is None:\n init()\n return _db.guess_all_extensions(type,strict)\n \ndef guess_extension(type,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n \n if _db is None:\n init()\n return _db.guess_extension(type,strict)\n \ndef add_type(type,ext,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n \n if _db is None:\n init()\n return _db.add_type(type,ext,strict)\n \n \ndef init(files=None):\n global suffix_map,types_map,encodings_map,common_types\n global inited,_db\n inited=True\n \n if files is None or _db is None:\n db=MimeTypes()\n \n db.read_windows_registry()\n \n if files is None:\n files=knownfiles\n else:\n files=knownfiles+list(files)\n else:\n db=_db\n \n for file in files:\n if os.path.isfile(file):\n db.read(file)\n encodings_map=db.encodings_map\n suffix_map=db.suffix_map\n types_map=db.types_map[True]\n common_types=db.types_map[False]\n \n _db=db\n \n \ndef read_mime_types(file):\n try:\n f=open(file,encoding='utf-8')\n except OSError:\n return None\n with f:\n db=MimeTypes()\n db.readfp(f,True)\n return db.types_map[True]\n \n \ndef _default_mime_types():\n global suffix_map,_suffix_map_default\n global encodings_map,_encodings_map_default\n global types_map,_types_map_default\n global common_types,_common_types_default\n \n suffix_map=_suffix_map_default={\n '.svgz':'.svg.gz',\n '.tgz':'.tar.gz',\n '.taz':'.tar.gz',\n '.tz':'.tar.gz',\n '.tbz2':'.tar.bz2',\n '.txz':'.tar.xz',\n }\n \n encodings_map=_encodings_map_default={\n '.gz':'gzip',\n '.Z':'compress',\n '.bz2':'bzip2',\n '.xz':'xz',\n '.br':'br',\n }\n \n \n \n \n \n \n \n \n types_map=_types_map_default={\n '.js':'text/javascript',\n '.mjs':'text/javascript',\n '.json':'application/json',\n '.webmanifest':'application/manifest+json',\n '.doc':'application/msword',\n '.dot':'application/msword',\n '.wiz':'application/msword',\n '.nq':'application/n-quads',\n '.nt':'application/n-triples',\n '.bin':'application/octet-stream',\n '.a':'application/octet-stream',\n '.dll':'application/octet-stream',\n '.exe':'application/octet-stream',\n '.o':'application/octet-stream',\n '.obj':'application/octet-stream',\n '.so':'application/octet-stream',\n '.oda':'application/oda',\n '.pdf':'application/pdf',\n '.p7c':'application/pkcs7-mime',\n '.ps':'application/postscript',\n '.ai':'application/postscript',\n '.eps':'application/postscript',\n '.trig':'application/trig',\n '.m3u':'application/vnd.apple.mpegurl',\n '.m3u8':'application/vnd.apple.mpegurl',\n '.xls':'application/vnd.ms-excel',\n '.xlb':'application/vnd.ms-excel',\n '.ppt':'application/vnd.ms-powerpoint',\n '.pot':'application/vnd.ms-powerpoint',\n '.ppa':'application/vnd.ms-powerpoint',\n '.pps':'application/vnd.ms-powerpoint',\n '.pwz':'application/vnd.ms-powerpoint',\n '.wasm':'application/wasm',\n '.bcpio':'application/x-bcpio',\n '.cpio':'application/x-cpio',\n '.csh':'application/x-csh',\n '.dvi':'application/x-dvi',\n '.gtar':'application/x-gtar',\n '.hdf':'application/x-hdf',\n '.h5':'application/x-hdf5',\n '.latex':'application/x-latex',\n '.mif':'application/x-mif',\n '.cdf':'application/x-netcdf',\n '.nc':'application/x-netcdf',\n '.p12':'application/x-pkcs12',\n '.pfx':'application/x-pkcs12',\n '.ram':'application/x-pn-realaudio',\n '.pyc':'application/x-python-code',\n '.pyo':'application/x-python-code',\n '.sh':'application/x-sh',\n '.shar':'application/x-shar',\n '.swf':'application/x-shockwave-flash',\n '.sv4cpio':'application/x-sv4cpio',\n '.sv4crc':'application/x-sv4crc',\n '.tar':'application/x-tar',\n '.tcl':'application/x-tcl',\n '.tex':'application/x-tex',\n '.texi':'application/x-texinfo',\n '.texinfo':'application/x-texinfo',\n '.roff':'application/x-troff',\n '.t':'application/x-troff',\n '.tr':'application/x-troff',\n '.man':'application/x-troff-man',\n '.me':'application/x-troff-me',\n '.ms':'application/x-troff-ms',\n '.ustar':'application/x-ustar',\n '.src':'application/x-wais-source',\n '.xsl':'application/xml',\n '.rdf':'application/xml',\n '.wsdl':'application/xml',\n '.xpdl':'application/xml',\n '.zip':'application/zip',\n '.3gp':'audio/3gpp',\n '.3gpp':'audio/3gpp',\n '.3g2':'audio/3gpp2',\n '.3gpp2':'audio/3gpp2',\n '.aac':'audio/aac',\n '.adts':'audio/aac',\n '.loas':'audio/aac',\n '.ass':'audio/aac',\n '.au':'audio/basic',\n '.snd':'audio/basic',\n '.mp3':'audio/mpeg',\n '.mp2':'audio/mpeg',\n '.opus':'audio/opus',\n '.aif':'audio/x-aiff',\n '.aifc':'audio/x-aiff',\n '.aiff':'audio/x-aiff',\n '.ra':'audio/x-pn-realaudio',\n '.wav':'audio/x-wav',\n '.avif':'image/avif',\n '.bmp':'image/bmp',\n '.gif':'image/gif',\n '.ief':'image/ief',\n '.jpg':'image/jpeg',\n '.jpe':'image/jpeg',\n '.jpeg':'image/jpeg',\n '.heic':'image/heic',\n '.heif':'image/heif',\n '.png':'image/png',\n '.svg':'image/svg+xml',\n '.tiff':'image/tiff',\n '.tif':'image/tiff',\n '.ico':'image/vnd.microsoft.icon',\n '.ras':'image/x-cmu-raster',\n '.pnm':'image/x-portable-anymap',\n '.pbm':'image/x-portable-bitmap',\n '.pgm':'image/x-portable-graymap',\n '.ppm':'image/x-portable-pixmap',\n '.rgb':'image/x-rgb',\n '.xbm':'image/x-xbitmap',\n '.xpm':'image/x-xpixmap',\n '.xwd':'image/x-xwindowdump',\n '.eml':'message/rfc822',\n '.mht':'message/rfc822',\n '.mhtml':'message/rfc822',\n '.nws':'message/rfc822',\n '.css':'text/css',\n '.csv':'text/csv',\n '.html':'text/html',\n '.htm':'text/html',\n '.n3':'text/n3',\n '.txt':'text/plain',\n '.bat':'text/plain',\n '.c':'text/plain',\n '.h':'text/plain',\n '.ksh':'text/plain',\n '.pl':'text/plain',\n '.srt':'text/plain',\n '.rtx':'text/richtext',\n '.tsv':'text/tab-separated-values',\n '.vtt':'text/vtt',\n '.py':'text/x-python',\n '.etx':'text/x-setext',\n '.sgm':'text/x-sgml',\n '.sgml':'text/x-sgml',\n '.vcf':'text/x-vcard',\n '.xml':'text/xml',\n '.mp4':'video/mp4',\n '.mpeg':'video/mpeg',\n '.m1v':'video/mpeg',\n '.mpa':'video/mpeg',\n '.mpe':'video/mpeg',\n '.mpg':'video/mpeg',\n '.mov':'video/quicktime',\n '.qt':'video/quicktime',\n '.webm':'video/webm',\n '.avi':'video/x-msvideo',\n '.movie':'video/x-sgi-movie',\n }\n \n \n \n \n \n common_types=_common_types_default={\n '.rtf':'application/rtf',\n '.midi':'audio/midi',\n '.mid':'audio/midi',\n '.jpg':'image/jpg',\n '.pict':'image/pict',\n '.pct':'image/pict',\n '.pic':'image/pict',\n '.webp':'image/webp',\n '.xul':'text/xul',\n }\n \n \n_default_mime_types()\n\n\ndef _main():\n import getopt\n \n USAGE=\"\"\"\\\nUsage: mimetypes.py [options] type\n\nOptions:\n --help / -h -- print this message and exit\n --lenient / -l -- additionally search of some common, but non-standard\n types.\n --extension / -e -- guess extension instead of type\n\nMore than one type argument may be given.\n\"\"\"\n \n def usage(code,msg=''):\n print(USAGE)\n if msg:print(msg)\n sys.exit(code)\n \n try:\n opts,args=getopt.getopt(sys.argv[1:],'hle',\n ['help','lenient','extension'])\n except getopt.error as msg:\n usage(1,msg)\n \n strict=1\n extension=0\n for opt,arg in opts:\n if opt in('-h','--help'):\n usage(0)\n elif opt in('-l','--lenient'):\n strict=0\n elif opt in('-e','--extension'):\n extension=1\n for gtype in args:\n if extension:\n guess=guess_extension(gtype,strict)\n if not guess:print(\"I don't know anything about type\",gtype)\n else:print(guess)\n else:\n guess,encoding=guess_type(gtype,strict)\n if not guess:print(\"I don't know anything about type\",gtype)\n else:print('type:',guess,'encoding:',encoding)\n \n \nif __name__ =='__main__':\n _main()\n", ["_winapi", "getopt", "os", "posixpath", "sys", "urllib.parse", "winreg"]], "nntplib": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport re\nimport socket\nimport collections\nimport datetime\nimport sys\nimport warnings\n\ntry :\n import ssl\nexcept ImportError:\n _have_ssl=False\nelse :\n _have_ssl=True\n \nfrom email.header import decode_header as _email_decode_header\nfrom socket import _GLOBAL_DEFAULT_TIMEOUT\n\n__all__=[\"NNTP\",\n\"NNTPError\",\"NNTPReplyError\",\"NNTPTemporaryError\",\n\"NNTPPermanentError\",\"NNTPProtocolError\",\"NNTPDataError\",\n\"decode_header\",\n]\n\nwarnings._deprecated(__name__,remove=(3,13))\n\n\n\n\n\n_MAXLINE=2048\n\n\n\nclass NNTPError(Exception):\n ''\n def __init__(self,*args):\n Exception.__init__(self,*args)\n try :\n self.response=args[0]\n except IndexError:\n self.response='No response given'\n \nclass NNTPReplyError(NNTPError):\n ''\n pass\n \nclass NNTPTemporaryError(NNTPError):\n ''\n pass\n \nclass NNTPPermanentError(NNTPError):\n ''\n pass\n \nclass NNTPProtocolError(NNTPError):\n ''\n pass\n \nclass NNTPDataError(NNTPError):\n ''\n pass\n \n \n \nNNTP_PORT=119\nNNTP_SSL_PORT=563\n\n\n_LONGRESP={\n'100',\n'101',\n'211',\n'215',\n'220',\n'221',\n'222',\n'224',\n'225',\n'230',\n'231',\n'282',\n}\n\n\n_DEFAULT_OVERVIEW_FMT=[\n\"subject\",\"from\",\"date\",\"message-id\",\"references\",\":bytes\",\":lines\"]\n\n\n_OVERVIEW_FMT_ALTERNATIVES={\n'bytes':':bytes',\n'lines':':lines',\n}\n\n\n_CRLF=b'\\r\\n'\n\nGroupInfo=collections.namedtuple('GroupInfo',\n['group','last','first','flag'])\n\nArticleInfo=collections.namedtuple('ArticleInfo',\n['number','message_id','lines'])\n\n\n\ndef decode_header(header_str):\n ''\n \n parts=[]\n for v,enc in _email_decode_header(header_str):\n if isinstance(v,bytes):\n parts.append(v.decode(enc or 'ascii'))\n else :\n parts.append(v)\n return ''.join(parts)\n \ndef _parse_overview_fmt(lines):\n ''\n\n\n \n fmt=[]\n for line in lines:\n if line[0]==':':\n \n name,_,suffix=line[1:].partition(':')\n name=':'+name\n else :\n \n name,_,suffix=line.partition(':')\n name=name.lower()\n name=_OVERVIEW_FMT_ALTERNATIVES.get(name,name)\n \n fmt.append(name)\n defaults=_DEFAULT_OVERVIEW_FMT\n if len(fmt)=len(fmt):\n \n \n \n continue\n field_name=fmt[i]\n is_metadata=field_name.startswith(':')\n if i >=n_defaults and not is_metadata:\n \n \n h=field_name+\": \"\n if token and token[:len(h)].lower()!=h:\n raise NNTPDataError(\"OVER/XOVER response doesn't include \"\n \"names of additional headers\")\n token=token[len(h):]if token else None\n fields[fmt[i]]=token\n overview.append((article_number,fields))\n return overview\n \ndef _parse_datetime(date_str,time_str=None ):\n ''\n\n\n \n if time_str is None :\n time_str=date_str[-6:]\n date_str=date_str[:-6]\n hours=int(time_str[:2])\n minutes=int(time_str[2:4])\n seconds=int(time_str[4:])\n year=int(date_str[:-4])\n month=int(date_str[-4:-2])\n day=int(date_str[-2:])\n \n \n if year <70:\n year +=2000\n elif year <100:\n year +=1900\n return datetime.datetime(year,month,day,hours,minutes,seconds)\n \ndef _unparse_datetime(dt,legacy=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if not isinstance(dt,datetime.datetime):\n time_str=\"000000\"\n else :\n time_str=\"{0.hour:02d}{0.minute:02d}{0.second:02d}\".format(dt)\n y=dt.year\n if legacy:\n y=y %100\n date_str=\"{0:02d}{1.month:02d}{1.day:02d}\".format(y,dt)\n else :\n date_str=\"{0:04d}{1.month:02d}{1.day:02d}\".format(y,dt)\n return date_str,time_str\n \n \nif _have_ssl:\n\n def _encrypt_on(sock,context,hostname):\n ''\n\n\n\n\n \n \n if context is None :\n context=ssl._create_stdlib_context()\n return context.wrap_socket(sock,server_hostname=hostname)\n \n \n \nclass NNTP:\n\n\n\n\n\n\n\n\n\n\n\n\n encoding='utf-8'\n errors='surrogateescape'\n \n def __init__(self,host,port=NNTP_PORT,user=None ,password=None ,\n readermode=None ,usenetrc=False ,\n timeout=_GLOBAL_DEFAULT_TIMEOUT):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.host=host\n self.port=port\n self.sock=self._create_socket(timeout)\n self.file=None\n try :\n self.file=self.sock.makefile(\"rwb\")\n self._base_init(readermode)\n if user or usenetrc:\n self.login(user,password,usenetrc)\n except :\n if self.file:\n self.file.close()\n self.sock.close()\n raise\n \n def _base_init(self,readermode):\n ''\n\n \n self.debugging=0\n self.welcome=self._getresp()\n \n \n self._caps=None\n self.getcapabilities()\n \n \n \n \n \n \n \n \n self.readermode_afterauth=False\n if readermode and 'READER'not in self._caps:\n self._setreadermode()\n if not self.readermode_afterauth:\n \n self._caps=None\n self.getcapabilities()\n \n \n \n \n self.tls_on=False\n \n \n self.authenticated=False\n \n def __enter__(self):\n return self\n \n def __exit__(self,*args):\n is_connected=lambda :hasattr(self,\"file\")\n if is_connected():\n try :\n self.quit()\n except (OSError,EOFError):\n pass\n finally :\n if is_connected():\n self._close()\n \n def _create_socket(self,timeout):\n if timeout is not None and not timeout:\n raise ValueError('Non-blocking socket (timeout=0) is not supported')\n sys.audit(\"nntplib.connect\",self,self.host,self.port)\n return socket.create_connection((self.host,self.port),timeout)\n \n def getwelcome(self):\n ''\n\n\n \n \n if self.debugging:print('*welcome*',repr(self.welcome))\n return self.welcome\n \n def getcapabilities(self):\n ''\n\n \n if self._caps is None :\n self.nntp_version=1\n self.nntp_implementation=None\n try :\n resp,caps=self.capabilities()\n except (NNTPPermanentError,NNTPTemporaryError):\n \n self._caps={}\n else :\n self._caps=caps\n if 'VERSION'in caps:\n \n \n self.nntp_version=max(map(int,caps['VERSION']))\n if 'IMPLEMENTATION'in caps:\n self.nntp_implementation=' '.join(caps['IMPLEMENTATION'])\n return self._caps\n \n def set_debuglevel(self,level):\n ''\n\n\n \n \n self.debugging=level\n debug=set_debuglevel\n \n def _putline(self,line):\n ''\n \n sys.audit(\"nntplib.putline\",self,line)\n line=line+_CRLF\n if self.debugging >1:print('*put*',repr(line))\n self.file.write(line)\n self.file.flush()\n \n def _putcmd(self,line):\n ''\n \n if self.debugging:print('*cmd*',repr(line))\n line=line.encode(self.encoding,self.errors)\n self._putline(line)\n \n def _getline(self,strip_crlf=True ):\n ''\n\n \n line=self.file.readline(_MAXLINE+1)\n if len(line)>_MAXLINE:\n raise NNTPDataError('line too long')\n if self.debugging >1:\n print('*get*',repr(line))\n if not line:raise EOFError\n if strip_crlf:\n if line[-2:]==_CRLF:\n line=line[:-2]\n elif line[-1:]in _CRLF:\n line=line[:-1]\n return line\n \n def _getresp(self):\n ''\n\n \n resp=self._getline()\n if self.debugging:print('*resp*',repr(resp))\n resp=resp.decode(self.encoding,self.errors)\n c=resp[:1]\n if c =='4':\n raise NNTPTemporaryError(resp)\n if c =='5':\n raise NNTPPermanentError(resp)\n if c not in '123':\n raise NNTPProtocolError(resp)\n return resp\n \n def _getlongresp(self,file=None ):\n ''\n\n\n\n\n\n \n \n openedFile=None\n try :\n \n if isinstance(file,(str,bytes)):\n openedFile=file=open(file,\"wb\")\n \n resp=self._getresp()\n if resp[:3]not in _LONGRESP:\n raise NNTPReplyError(resp)\n \n lines=[]\n if file is not None :\n \n terminators=(b'.'+_CRLF,b'.\\n')\n while 1:\n line=self._getline(False )\n if line in terminators:\n break\n if line.startswith(b'..'):\n line=line[1:]\n file.write(line)\n else :\n terminator=b'.'\n while 1:\n line=self._getline()\n if line ==terminator:\n break\n if line.startswith(b'..'):\n line=line[1:]\n lines.append(line)\n finally :\n \n if openedFile:\n openedFile.close()\n \n return resp,lines\n \n def _shortcmd(self,line):\n ''\n \n self._putcmd(line)\n return self._getresp()\n \n def _longcmd(self,line,file=None ):\n ''\n \n self._putcmd(line)\n return self._getlongresp(file)\n \n def _longcmdstring(self,line,file=None ):\n ''\n\n\n \n self._putcmd(line)\n resp,list=self._getlongresp(file)\n return resp,[line.decode(self.encoding,self.errors)\n for line in list]\n \n def _getoverviewfmt(self):\n ''\n \n try :\n return self._cachedoverviewfmt\n except AttributeError:\n pass\n try :\n resp,lines=self._longcmdstring(\"LIST OVERVIEW.FMT\")\n except NNTPPermanentError:\n \n fmt=_DEFAULT_OVERVIEW_FMT[:]\n else :\n fmt=_parse_overview_fmt(lines)\n self._cachedoverviewfmt=fmt\n return fmt\n \n def _grouplist(self,lines):\n \n return [GroupInfo(*line.split())for line in lines]\n \n def capabilities(self):\n ''\n\n\n\n\n \n caps={}\n resp,lines=self._longcmdstring(\"CAPABILITIES\")\n for line in lines:\n name,*tokens=line.split()\n caps[name]=tokens\n return resp,caps\n \n def newgroups(self,date,*,file=None ):\n ''\n\n\n\n\n \n if not isinstance(date,(datetime.date,datetime.date)):\n raise TypeError(\n \"the date parameter must be a date or datetime object, \"\n \"not '{:40}'\".format(date.__class__.__name__))\n date_str,time_str=_unparse_datetime(date,self.nntp_version <2)\n cmd='NEWGROUPS {0} {1}'.format(date_str,time_str)\n resp,lines=self._longcmdstring(cmd,file)\n return resp,self._grouplist(lines)\n \n def newnews(self,group,date,*,file=None ):\n ''\n\n\n\n\n\n \n if not isinstance(date,(datetime.date,datetime.date)):\n raise TypeError(\n \"the date parameter must be a date or datetime object, \"\n \"not '{:40}'\".format(date.__class__.__name__))\n date_str,time_str=_unparse_datetime(date,self.nntp_version <2)\n cmd='NEWNEWS {0} {1} {2}'.format(group,date_str,time_str)\n return self._longcmdstring(cmd,file)\n \n def list(self,group_pattern=None ,*,file=None ):\n ''\n\n\n\n\n\n \n if group_pattern is not None :\n command='LIST ACTIVE '+group_pattern\n else :\n command='LIST'\n resp,lines=self._longcmdstring(command,file)\n return resp,self._grouplist(lines)\n \n def _getdescriptions(self,group_pattern,return_all):\n line_pat=re.compile('^(?P[^ \\t]+)[ \\t]+(.*)$')\n \n resp,lines=self._longcmdstring('LIST NEWSGROUPS '+group_pattern)\n if not resp.startswith('215'):\n \n \n \n resp,lines=self._longcmdstring('XGTITLE '+group_pattern)\n groups={}\n for raw_line in lines:\n match=line_pat.search(raw_line.strip())\n if match:\n name,desc=match.group(1,2)\n if not return_all:\n return desc\n groups[name]=desc\n if return_all:\n return resp,groups\n else :\n \n return ''\n \n def description(self,group):\n ''\n\n\n\n\n\n\n\n\n \n return self._getdescriptions(group,False )\n \n def descriptions(self,group_pattern):\n ''\n return self._getdescriptions(group_pattern,True )\n \n def group(self,name):\n ''\n\n\n\n\n\n\n\n \n resp=self._shortcmd('GROUP '+name)\n if not resp.startswith('211'):\n raise NNTPReplyError(resp)\n words=resp.split()\n count=first=last=0\n n=len(words)\n if n >1:\n count=words[1]\n if n >2:\n first=words[2]\n if n >3:\n last=words[3]\n if n >4:\n name=words[4].lower()\n return resp,int(count),int(first),int(last),name\n \n def help(self,*,file=None ):\n ''\n\n\n\n\n\n \n return self._longcmdstring('HELP',file)\n \n def _statparse(self,resp):\n ''\n \n if not resp.startswith('22'):\n raise NNTPReplyError(resp)\n words=resp.split()\n art_num=int(words[1])\n message_id=words[2]\n return resp,art_num,message_id\n \n def _statcmd(self,line):\n ''\n resp=self._shortcmd(line)\n return self._statparse(resp)\n \n def stat(self,message_spec=None ):\n ''\n\n\n\n\n\n\n \n if message_spec:\n return self._statcmd('STAT {0}'.format(message_spec))\n else :\n return self._statcmd('STAT')\n \n def next(self):\n ''\n return self._statcmd('NEXT')\n \n def last(self):\n ''\n return self._statcmd('LAST')\n \n def _artcmd(self,line,file=None ):\n ''\n resp,lines=self._longcmd(line,file)\n resp,art_num,message_id=self._statparse(resp)\n return resp,ArticleInfo(art_num,message_id,lines)\n \n def head(self,message_spec=None ,*,file=None ):\n ''\n\n\n\n\n\n \n if message_spec is not None :\n cmd='HEAD {0}'.format(message_spec)\n else :\n cmd='HEAD'\n return self._artcmd(cmd,file)\n \n def body(self,message_spec=None ,*,file=None ):\n ''\n\n\n\n\n\n \n if message_spec is not None :\n cmd='BODY {0}'.format(message_spec)\n else :\n cmd='BODY'\n return self._artcmd(cmd,file)\n \n def article(self,message_spec=None ,*,file=None ):\n ''\n\n\n\n\n\n \n if message_spec is not None :\n cmd='ARTICLE {0}'.format(message_spec)\n else :\n cmd='ARTICLE'\n return self._artcmd(cmd,file)\n \n def slave(self):\n ''\n\n \n return self._shortcmd('SLAVE')\n \n def xhdr(self,hdr,str,*,file=None ):\n ''\n\n\n\n\n\n\n \n pat=re.compile('^([0-9]+) ?(.*)\\n?')\n resp,lines=self._longcmdstring('XHDR {0} {1}'.format(hdr,str),file)\n def remove_number(line):\n m=pat.match(line)\n return m.group(1,2)if m else line\n return resp,[remove_number(line)for line in lines]\n \n def xover(self,start,end,*,file=None ):\n ''\n\n\n\n\n\n\n \n resp,lines=self._longcmdstring('XOVER {0}-{1}'.format(start,end),\n file)\n fmt=self._getoverviewfmt()\n return resp,_parse_overview(lines,fmt)\n \n def over(self,message_spec,*,file=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n cmd='OVER'if 'OVER'in self._caps else 'XOVER'\n if isinstance(message_spec,(tuple,list)):\n start,end=message_spec\n cmd +=' {0}-{1}'.format(start,end or '')\n elif message_spec is not None :\n cmd=cmd+' '+message_spec\n resp,lines=self._longcmdstring(cmd,file)\n fmt=self._getoverviewfmt()\n return resp,_parse_overview(lines,fmt)\n \n def date(self):\n ''\n\n\n\n \n resp=self._shortcmd(\"DATE\")\n if not resp.startswith('111'):\n raise NNTPReplyError(resp)\n elem=resp.split()\n if len(elem)!=2:\n raise NNTPDataError(resp)\n date=elem[1]\n if len(date)!=14:\n raise NNTPDataError(resp)\n return resp,_parse_datetime(date,None )\n \n def _post(self,command,f):\n resp=self._shortcmd(command)\n \n if not resp.startswith('3'):\n raise NNTPReplyError(resp)\n if isinstance(f,(bytes,bytearray)):\n f=f.splitlines()\n \n \n \n \n for line in f:\n if not line.endswith(_CRLF):\n line=line.rstrip(b\"\\r\\n\")+_CRLF\n if line.startswith(b'.'):\n line=b'.'+line\n self.file.write(line)\n self.file.write(b\".\\r\\n\")\n self.file.flush()\n return self._getresp()\n \n def post(self,data):\n ''\n\n\n \n return self._post('POST',data)\n \n def ihave(self,message_id,data):\n ''\n\n\n\n\n \n return self._post('IHAVE {0}'.format(message_id),data)\n \n def _close(self):\n try :\n if self.file:\n self.file.close()\n del self.file\n finally :\n self.sock.close()\n \n def quit(self):\n ''\n \n try :\n resp=self._shortcmd('QUIT')\n finally :\n self._close()\n return resp\n \n def login(self,user=None ,password=None ,usenetrc=True ):\n if self.authenticated:\n raise ValueError(\"Already logged in.\")\n if not user and not usenetrc:\n raise ValueError(\n \"At least one of `user` and `usenetrc` must be specified\")\n \n \n \n try :\n if usenetrc and not user:\n import netrc\n credentials=netrc.netrc()\n auth=credentials.authenticators(self.host)\n if auth:\n user=auth[0]\n password=auth[2]\n except OSError:\n pass\n \n if not user:\n return\n resp=self._shortcmd('authinfo user '+user)\n if resp.startswith('381'):\n if not password:\n raise NNTPReplyError(resp)\n else :\n resp=self._shortcmd('authinfo pass '+password)\n if not resp.startswith('281'):\n raise NNTPPermanentError(resp)\n \n self._caps=None\n self.getcapabilities()\n \n \n if self.readermode_afterauth and 'READER'not in self._caps:\n self._setreadermode()\n \n self._caps=None\n self.getcapabilities()\n \n def _setreadermode(self):\n try :\n self.welcome=self._shortcmd('mode reader')\n except NNTPPermanentError:\n \n pass\n except NNTPTemporaryError as e:\n if e.response.startswith('480'):\n \n self.readermode_afterauth=True\n else :\n raise\n \n if _have_ssl:\n def starttls(self,context=None ):\n ''\n\n \n \n \n if self.tls_on:\n raise ValueError(\"TLS is already enabled.\")\n if self.authenticated:\n raise ValueError(\"TLS cannot be started after authentication.\")\n resp=self._shortcmd('STARTTLS')\n if resp.startswith('382'):\n self.file.close()\n self.sock=_encrypt_on(self.sock,context,self.host)\n self.file=self.sock.makefile(\"rwb\")\n self.tls_on=True\n \n \n self._caps=None\n self.getcapabilities()\n else :\n raise NNTPError(\"TLS failed to start.\")\n \n \nif _have_ssl:\n class NNTP_SSL(NNTP):\n \n def __init__(self,host,port=NNTP_SSL_PORT,\n user=None ,password=None ,ssl_context=None ,\n readermode=None ,usenetrc=False ,\n timeout=_GLOBAL_DEFAULT_TIMEOUT):\n ''\n\n \n self.ssl_context=ssl_context\n super().__init__(host,port,user,password,readermode,\n usenetrc,timeout)\n \n def _create_socket(self,timeout):\n sock=super()._create_socket(timeout)\n try :\n sock=_encrypt_on(sock,self.ssl_context,self.host)\n except :\n sock.close()\n raise\n else :\n return sock\n \n __all__.append(\"NNTP_SSL\")\n \n \n \nif __name__ =='__main__':\n import argparse\n \n parser=argparse.ArgumentParser(description=\"\"\"\\\n nntplib built-in demo - display the latest articles in a newsgroup\"\"\")\n parser.add_argument('-g','--group',default='gmane.comp.python.general',\n help='group to fetch messages from (default: %(default)s)')\n parser.add_argument('-s','--server',default='news.gmane.io',\n help='NNTP server hostname (default: %(default)s)')\n parser.add_argument('-p','--port',default=-1,type=int,\n help='NNTP port number (default: %s / %s)'%(NNTP_PORT,NNTP_SSL_PORT))\n parser.add_argument('-n','--nb-articles',default=10,type=int,\n help='number of articles to fetch (default: %(default)s)')\n parser.add_argument('-S','--ssl',action='store_true',default=False ,\n help='use NNTP over SSL')\n args=parser.parse_args()\n \n port=args.port\n if not args.ssl:\n if port ==-1:\n port=NNTP_PORT\n s=NNTP(host=args.server,port=port)\n else :\n if port ==-1:\n port=NNTP_SSL_PORT\n s=NNTP_SSL(host=args.server,port=port)\n \n caps=s.getcapabilities()\n if 'STARTTLS'in caps:\n s.starttls()\n resp,count,first,last,name=s.group(args.group)\n print('Group',name,'has',count,'articles, range',first,'to',last)\n \n def cut(s,lim):\n if len(s)>lim:\n s=s[:lim -4]+\"...\"\n return s\n \n first=str(int(last)-args.nb_articles+1)\n resp,overviews=s.xover(first,last)\n for artnum,over in overviews:\n author=decode_header(over['from']).split('<',1)[0]\n subject=decode_header(over['subject'])\n lines=int(over[':lines'])\n print(\"{:7} {:20} {:42} ({})\".format(\n artnum,cut(author,20),cut(subject,42),lines)\n )\n \n s.quit()\n", ["argparse", "collections", "datetime", "email.header", "netrc", "re", "socket", "ssl", "sys", "warnings"]], "ntpath": [".py", "\n''\n\n\n\n\n\n\n\n\ncurdir='.'\npardir='..'\nextsep='.'\nsep='\\\\'\npathsep=';'\naltsep='/'\ndefpath='.;C:\\\\bin'\ndevnull='nul'\n\nimport os\nimport sys\nimport stat\nimport genericpath\nfrom genericpath import *\n\n\n__all__=[\"normcase\",\"isabs\",\"join\",\"splitdrive\",\"splitroot\",\"split\",\"splitext\",\n\"basename\",\"dirname\",\"commonprefix\",\"getsize\",\"getmtime\",\n\"getatime\",\"getctime\",\"islink\",\"exists\",\"lexists\",\"isdir\",\"isfile\",\n\"ismount\",\"expanduser\",\"expandvars\",\"normpath\",\"abspath\",\n\"curdir\",\"pardir\",\"sep\",\"pathsep\",\"defpath\",\"altsep\",\n\"extsep\",\"devnull\",\"realpath\",\"supports_unicode_filenames\",\"relpath\",\n\"samefile\",\"sameopenfile\",\"samestat\",\"commonpath\",\"isjunction\"]\n\ndef _get_bothseps(path):\n if isinstance(path,bytes):\n return b'\\\\/'\n else:\n return '\\\\/'\n \n \n \n \n \ntry:\n from _winapi import(\n LCMapStringEx as _LCMapStringEx,\n LOCALE_NAME_INVARIANT as _LOCALE_NAME_INVARIANT,\n LCMAP_LOWERCASE as _LCMAP_LOWERCASE)\n \n def normcase(s):\n ''\n\n\n \n s=os.fspath(s)\n if not s:\n return s\n if isinstance(s,bytes):\n encoding=sys.getfilesystemencoding()\n s=s.decode(encoding,'surrogateescape').replace('/','\\\\')\n s=_LCMapStringEx(_LOCALE_NAME_INVARIANT,\n _LCMAP_LOWERCASE,s)\n return s.encode(encoding,'surrogateescape')\n else:\n return _LCMapStringEx(_LOCALE_NAME_INVARIANT,\n _LCMAP_LOWERCASE,\n s.replace('/','\\\\'))\nexcept ImportError:\n def normcase(s):\n ''\n\n\n \n s=os.fspath(s)\n if isinstance(s,bytes):\n return os.fsencode(os.fsdecode(s).replace('/','\\\\').lower())\n return s.replace('/','\\\\').lower()\n \n \n \n \n \n \n \n \ndef isabs(s):\n ''\n s=os.fspath(s)\n if isinstance(s,bytes):\n sep=b'\\\\'\n altsep=b'/'\n colon_sep=b':\\\\'\n else:\n sep='\\\\'\n altsep='/'\n colon_sep=':\\\\'\n s=s[:3].replace(altsep,sep)\n \n \n if s.startswith(sep)or s.startswith(colon_sep,1):\n return True\n return False\n \n \n \ndef join(path,*paths):\n path=os.fspath(path)\n if isinstance(path,bytes):\n sep=b'\\\\'\n seps=b'\\\\/'\n colon=b':'\n else:\n sep='\\\\'\n seps='\\\\/'\n colon=':'\n try:\n if not paths:\n path[:0]+sep\n result_drive,result_root,result_path=splitroot(path)\n for p in map(os.fspath,paths):\n p_drive,p_root,p_path=splitroot(p)\n if p_root:\n \n if p_drive or not result_drive:\n result_drive=p_drive\n result_root=p_root\n result_path=p_path\n continue\n elif p_drive and p_drive !=result_drive:\n if p_drive.lower()!=result_drive.lower():\n \n result_drive=p_drive\n result_root=p_root\n result_path=p_path\n continue\n \n result_drive=p_drive\n \n if result_path and result_path[-1]not in seps:\n result_path=result_path+sep\n result_path=result_path+p_path\n \n if(result_path and not result_root and\n result_drive and result_drive[-1:]not in colon+seps):\n return result_drive+sep+result_path\n return result_drive+result_root+result_path\n except(TypeError,AttributeError,BytesWarning):\n genericpath._check_arg_types('join',path,*paths)\n raise\n \n \n \n \n \ndef splitdrive(p):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n drive,root,tail=splitroot(p)\n return drive,root+tail\n \n \ndef splitroot(p):\n ''\n\n\n\n\n\n\n\n\n \n p=os.fspath(p)\n if isinstance(p,bytes):\n sep=b'\\\\'\n altsep=b'/'\n colon=b':'\n unc_prefix=b'\\\\\\\\?\\\\UNC\\\\'\n empty=b''\n else:\n sep='\\\\'\n altsep='/'\n colon=':'\n unc_prefix='\\\\\\\\?\\\\UNC\\\\'\n empty=''\n normp=p.replace(altsep,sep)\n if normp[:1]==sep:\n if normp[1:2]==sep:\n \n \n start=8 if normp[:8].upper()==unc_prefix else 2\n index=normp.find(sep,start)\n if index ==-1:\n return p,empty,empty\n index2=normp.find(sep,index+1)\n if index2 ==-1:\n return p,empty,empty\n return p[:index2],p[index2:index2+1],p[index2+1:]\n else:\n \n return empty,p[:1],p[1:]\n elif normp[1:2]==colon:\n if normp[2:3]==sep:\n \n return p[:2],p[2:3],p[3:]\n else:\n \n return p[:2],empty,p[2:]\n else:\n \n return empty,empty,p\n \n \n \n \n \n \n \ndef split(p):\n ''\n\n\n \n p=os.fspath(p)\n seps=_get_bothseps(p)\n d,r,p=splitroot(p)\n \n i=len(p)\n while i and p[i -1]not in seps:\n i -=1\n head,tail=p[:i],p[i:]\n return d+r+head.rstrip(seps),tail\n \n \n \n \n \n \n \ndef splitext(p):\n p=os.fspath(p)\n if isinstance(p,bytes):\n return genericpath._splitext(p,b'\\\\',b'/',b'.')\n else:\n return genericpath._splitext(p,'\\\\','/','.')\nsplitext.__doc__=genericpath._splitext.__doc__\n\n\n\n\ndef basename(p):\n ''\n return split(p)[1]\n \n \n \n \ndef dirname(p):\n ''\n return split(p)[0]\n \n \n \n \nif hasattr(os.stat_result,'st_reparse_tag'):\n def isjunction(path):\n ''\n try:\n st=os.lstat(path)\n except(OSError,ValueError,AttributeError):\n return False\n return bool(st.st_reparse_tag ==stat.IO_REPARSE_TAG_MOUNT_POINT)\nelse:\n def isjunction(path):\n ''\n os.fspath(path)\n return False\n \n \n \n \ndef lexists(path):\n ''\n try:\n st=os.lstat(path)\n except(OSError,ValueError):\n return False\n return True\n \n \n \n \n \n \n \n \n \n \n \ntry:\n from nt import _getvolumepathname\nexcept ImportError:\n _getvolumepathname=None\ndef ismount(path):\n ''\n \n path=os.fspath(path)\n seps=_get_bothseps(path)\n path=abspath(path)\n drive,root,rest=splitroot(path)\n if drive and drive[0]in seps:\n return not rest\n if root and not rest:\n return True\n \n if _getvolumepathname:\n x=path.rstrip(seps)\n y=_getvolumepathname(path).rstrip(seps)\n return x.casefold()==y.casefold()\n else:\n return False\n \n \n \n \n \n \n \n \n \n \n \ndef expanduser(path):\n ''\n\n \n path=os.fspath(path)\n if isinstance(path,bytes):\n tilde=b'~'\n else:\n tilde='~'\n if not path.startswith(tilde):\n return path\n i,n=1,len(path)\n while i 0 and comps[i -1]!=pardir:\n del comps[i -1:i+1]\n i -=1\n elif i ==0 and root:\n del comps[i]\n else:\n i +=1\n else:\n i +=1\n \n if not prefix and not comps:\n comps.append(curdir)\n return prefix+sep.join(comps)\n \nelse:\n def normpath(path):\n ''\n path=os.fspath(path)\n if isinstance(path,bytes):\n return os.fsencode(_path_normpath(os.fsdecode(path)))or b\".\"\n return _path_normpath(path)or \".\"\n \n \ndef _abspath_fallback(path):\n ''\n\n\n\n \n \n path=os.fspath(path)\n if not isabs(path):\n if isinstance(path,bytes):\n cwd=os.getcwdb()\n else:\n cwd=os.getcwd()\n path=join(cwd,path)\n return normpath(path)\n \n \ntry:\n from nt import _getfullpathname\n \nexcept ImportError:\n abspath=_abspath_fallback\n \nelse:\n def abspath(path):\n ''\n try:\n return _getfullpathname(normpath(path))\n except(OSError,ValueError):\n return _abspath_fallback(path)\n \ntry:\n from nt import _getfinalpathname,readlink as _nt_readlink\nexcept ImportError:\n\n realpath=abspath\nelse:\n def _readlink_deep(path):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_winerror=1,2,3,5,21,32,50,67,87,4390,4392,4393\n \n seen=set()\n while normcase(path)not in seen:\n seen.add(normcase(path))\n try:\n old_path=path\n path=_nt_readlink(path)\n \n \n if not isabs(path):\n \n \n \n if not islink(old_path):\n path=old_path\n break\n path=normpath(join(dirname(old_path),path))\n except OSError as ex:\n if ex.winerror in allowed_winerror:\n break\n raise\n except ValueError:\n \n break\n return path\n \n def _getfinalpathname_nonstrict(path):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_winerror=1,2,3,5,21,32,50,53,65,67,87,123,161,1920,1921\n \n \n \n tail=path[:0]\n while path:\n try:\n path=_getfinalpathname(path)\n return join(path,tail)if tail else path\n except OSError as ex:\n if ex.winerror not in allowed_winerror:\n raise\n try:\n \n \n \n new_path=_readlink_deep(path)\n if new_path !=path:\n return join(new_path,tail)if tail else new_path\n except OSError:\n \n pass\n path,name=split(path)\n \n \n \n if path and not name:\n return path+tail\n tail=join(name,tail)if tail else name\n return tail\n \n def realpath(path,*,strict=False):\n path=normpath(path)\n if isinstance(path,bytes):\n prefix=b'\\\\\\\\?\\\\'\n unc_prefix=b'\\\\\\\\?\\\\UNC\\\\'\n new_unc_prefix=b'\\\\\\\\'\n cwd=os.getcwdb()\n \n if normcase(path)==normcase(os.fsencode(devnull)):\n return b'\\\\\\\\.\\\\NUL'\n else:\n prefix='\\\\\\\\?\\\\'\n unc_prefix='\\\\\\\\?\\\\UNC\\\\'\n new_unc_prefix='\\\\\\\\'\n cwd=os.getcwd()\n \n if normcase(path)==normcase(devnull):\n return '\\\\\\\\.\\\\NUL'\n had_prefix=path.startswith(prefix)\n if not had_prefix and not isabs(path):\n path=join(cwd,path)\n try:\n path=_getfinalpathname(path)\n initial_winerror=0\n except OSError as ex:\n if strict:\n raise\n initial_winerror=ex.winerror\n path=_getfinalpathname_nonstrict(path)\n \n \n \n if not had_prefix and path.startswith(prefix):\n \n \n if path.startswith(unc_prefix):\n spath=new_unc_prefix+path[len(unc_prefix):]\n else:\n spath=path[len(prefix):]\n \n try:\n if _getfinalpathname(spath)==path:\n path=spath\n except OSError as ex:\n \n \n if ex.winerror ==initial_winerror:\n path=spath\n return path\n \n \n \nsupports_unicode_filenames=True\n\ndef relpath(path,start=None):\n ''\n path=os.fspath(path)\n if isinstance(path,bytes):\n sep=b'\\\\'\n curdir=b'.'\n pardir=b'..'\n else:\n sep='\\\\'\n curdir='.'\n pardir='..'\n \n if start is None:\n start=curdir\n \n if not path:\n raise ValueError(\"no path specified\")\n \n start=os.fspath(start)\n try:\n start_abs=abspath(normpath(start))\n path_abs=abspath(normpath(path))\n start_drive,_,start_rest=splitroot(start_abs)\n path_drive,_,path_rest=splitroot(path_abs)\n if normcase(start_drive)!=normcase(path_drive):\n raise ValueError(\"path is on mount %r, start on mount %r\"%(\n path_drive,start_drive))\n \n start_list=[x for x in start_rest.split(sep)if x]\n path_list=[x for x in path_rest.split(sep)if x]\n \n i=0\n for e1,e2 in zip(start_list,path_list):\n if normcase(e1)!=normcase(e2):\n break\n i +=1\n \n rel_list=[pardir]*(len(start_list)-i)+path_list[i:]\n if not rel_list:\n return curdir\n return join(*rel_list)\n except(TypeError,ValueError,AttributeError,BytesWarning,DeprecationWarning):\n genericpath._check_arg_types('relpath',path,start)\n raise\n \n \n \n \n \n \n \n \n \n \n \n \ndef commonpath(paths):\n ''\n \n if not paths:\n raise ValueError('commonpath() arg is an empty sequence')\n \n paths=tuple(map(os.fspath,paths))\n if isinstance(paths[0],bytes):\n sep=b'\\\\'\n altsep=b'/'\n curdir=b'.'\n else:\n sep='\\\\'\n altsep='/'\n curdir='.'\n \n try:\n drivesplits=[splitroot(p.replace(altsep,sep).lower())for p in paths]\n split_paths=[p.split(sep)for d,r,p in drivesplits]\n \n if len({r for d,r,p in drivesplits})!=1:\n raise ValueError(\"Can't mix absolute and relative paths\")\n \n \n \n \n if len({d for d,r,p in drivesplits})!=1:\n raise ValueError(\"Paths don't have the same drive\")\n \n drive,root,path=splitroot(paths[0].replace(altsep,sep))\n common=path.split(sep)\n common=[c for c in common if c and c !=curdir]\n \n split_paths=[[c for c in s if c and c !=curdir]for s in split_paths]\n s1=min(split_paths)\n s2=max(split_paths)\n for i,c in enumerate(s1):\n if c !=s2[i]:\n common=common[:i]\n break\n else:\n common=common[:len(s1)]\n \n return drive+root+sep.join(common)\n except(TypeError,AttributeError):\n genericpath._check_arg_types('commonpath',*paths)\n raise\n \n \ntry:\n\n\n\n from nt import _path_isdir as isdir\n from nt import _path_isfile as isfile\n from nt import _path_islink as islink\n from nt import _path_exists as exists\nexcept ImportError:\n\n pass\n \n \ntry:\n from nt import _path_isdevdrive\nexcept ImportError:\n def isdevdrive(path):\n ''\n \n return False\nelse:\n def isdevdrive(path):\n ''\n try:\n return _path_isdevdrive(abspath(path))\n except OSError:\n return False\n", ["_winapi", "genericpath", "nt", "os", "stat", "string", "sys"]], "numbers": [".py", "\n\n\n\"\"\"Abstract Base Classes (ABCs) for numbers, according to PEP 3141.\n\nTODO: Fill out more detailed documentation on the operators.\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfrom abc import ABCMeta,abstractmethod\n\n__all__=[\"Number\",\"Complex\",\"Real\",\"Rational\",\"Integral\"]\n\nclass Number(metaclass=ABCMeta):\n ''\n\n\n\n \n __slots__=()\n \n \n __hash__=None\n \n \n \n \n \n \n \n \n \n \nclass Complex(Number):\n ''\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def __complex__(self):\n ''\n \n def __bool__(self):\n ''\n return self !=0\n \n @property\n @abstractmethod\n def real(self):\n ''\n\n\n \n raise NotImplementedError\n \n @property\n @abstractmethod\n def imag(self):\n ''\n\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __add__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __radd__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __neg__(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __pos__(self):\n ''\n raise NotImplementedError\n \n def __sub__(self,other):\n ''\n return self+-other\n \n def __rsub__(self,other):\n ''\n return -self+other\n \n @abstractmethod\n def __mul__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rmul__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __truediv__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rtruediv__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __pow__(self,exponent):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rpow__(self,base):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __abs__(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def conjugate(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __eq__(self,other):\n ''\n raise NotImplementedError\n \nComplex.register(complex)\n\n\nclass Real(Complex):\n ''\n\n\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def __float__(self):\n ''\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __trunc__(self):\n ''\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __floor__(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __ceil__(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __round__(self,ndigits=None):\n ''\n\n\n\n \n raise NotImplementedError\n \n def __divmod__(self,other):\n ''\n\n\n\n \n return(self //other,self %other)\n \n def __rdivmod__(self,other):\n ''\n\n\n\n \n return(other //self,other %self)\n \n @abstractmethod\n def __floordiv__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rfloordiv__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __mod__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rmod__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __lt__(self,other):\n ''\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __le__(self,other):\n ''\n raise NotImplementedError\n \n \n def __complex__(self):\n ''\n return complex(float(self))\n \n @property\n def real(self):\n ''\n return+self\n \n @property\n def imag(self):\n ''\n return 0\n \n def conjugate(self):\n ''\n return+self\n \nReal.register(float)\n\n\nclass Rational(Real):\n ''\n \n __slots__=()\n \n @property\n @abstractmethod\n def numerator(self):\n raise NotImplementedError\n \n @property\n @abstractmethod\n def denominator(self):\n raise NotImplementedError\n \n \n def __float__(self):\n ''\n\n\n\n\n\n \n return int(self.numerator)/int(self.denominator)\n \n \nclass Integral(Rational):\n ''\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def __int__(self):\n ''\n raise NotImplementedError\n \n def __index__(self):\n ''\n return int(self)\n \n @abstractmethod\n def __pow__(self,exponent,modulus=None):\n ''\n\n\n\n\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __lshift__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rlshift__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rshift__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rrshift__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __and__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rand__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __xor__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rxor__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __or__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __ror__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __invert__(self):\n ''\n raise NotImplementedError\n \n \n def __float__(self):\n ''\n return float(int(self))\n \n @property\n def numerator(self):\n ''\n return+self\n \n @property\n def denominator(self):\n ''\n return 1\n \nIntegral.register(int)\n", ["abc"]], "opcode": [".py", "\n\"\"\"\nopcode module - potentially shared between dis and other modules which\noperate on bytecodes (e.g. peephole optimizers).\n\"\"\"\n\n__all__=[\"cmp_op\",\"hasarg\",\"hasconst\",\"hasname\",\"hasjrel\",\"hasjabs\",\n\"haslocal\",\"hascompare\",\"hasfree\",\"hasexc\",\"opname\",\"opmap\",\n\"HAVE_ARGUMENT\",\"EXTENDED_ARG\"]\n\n\n\n\n\n\n\n\ntry:\n from _opcode import stack_effect\n __all__.append('stack_effect')\nexcept ImportError:\n pass\n \ncmp_op=('<','<=','==','!=','>','>=')\n\nhasarg=[]\nhasconst=[]\nhasname=[]\nhasjrel=[]\nhasjabs=[]\nhaslocal=[]\nhascompare=[]\nhasfree=[]\nhasexc=[]\n\n\nENABLE_SPECIALIZATION=True\n\ndef is_pseudo(op):\n return op >=MIN_PSEUDO_OPCODE and op <=MAX_PSEUDO_OPCODE\n \noplists=[hasarg,hasconst,hasname,hasjrel,hasjabs,\nhaslocal,hascompare,hasfree,hasexc]\n\nopmap={}\n\n\n\n_pseudo_ops={}\n\ndef def_op(name,op):\n opmap[name]=op\n \ndef name_op(name,op):\n def_op(name,op)\n hasname.append(op)\n \ndef jrel_op(name,op):\n def_op(name,op)\n hasjrel.append(op)\n \ndef jabs_op(name,op):\n def_op(name,op)\n hasjabs.append(op)\n \ndef pseudo_op(name,op,real_ops):\n def_op(name,op)\n _pseudo_ops[name]=real_ops\n \n for oplist in oplists:\n res=[opmap[rop]in oplist for rop in real_ops]\n if any(res):\n assert all(res)\n oplist.append(op)\n \n \n \n \n \ndef_op('CACHE',0)\ndef_op('POP_TOP',1)\ndef_op('PUSH_NULL',2)\ndef_op('INTERPRETER_EXIT',3)\n\ndef_op('END_FOR',4)\ndef_op('END_SEND',5)\n\ndef_op('NOP',9)\n\ndef_op('UNARY_NEGATIVE',11)\ndef_op('UNARY_NOT',12)\n\ndef_op('UNARY_INVERT',15)\n\n\n\ndef_op('RESERVED',17)\n\ndef_op('BINARY_SUBSCR',25)\ndef_op('BINARY_SLICE',26)\ndef_op('STORE_SLICE',27)\n\ndef_op('GET_LEN',30)\ndef_op('MATCH_MAPPING',31)\ndef_op('MATCH_SEQUENCE',32)\ndef_op('MATCH_KEYS',33)\n\ndef_op('PUSH_EXC_INFO',35)\ndef_op('CHECK_EXC_MATCH',36)\ndef_op('CHECK_EG_MATCH',37)\n\ndef_op('WITH_EXCEPT_START',49)\ndef_op('GET_AITER',50)\ndef_op('GET_ANEXT',51)\ndef_op('BEFORE_ASYNC_WITH',52)\ndef_op('BEFORE_WITH',53)\ndef_op('END_ASYNC_FOR',54)\ndef_op('CLEANUP_THROW',55)\n\ndef_op('STORE_SUBSCR',60)\ndef_op('DELETE_SUBSCR',61)\n\ndef_op('GET_ITER',68)\ndef_op('GET_YIELD_FROM_ITER',69)\n\ndef_op('LOAD_BUILD_CLASS',71)\n\ndef_op('LOAD_ASSERTION_ERROR',74)\ndef_op('RETURN_GENERATOR',75)\n\ndef_op('RETURN_VALUE',83)\n\ndef_op('SETUP_ANNOTATIONS',85)\ndef_op('LOAD_LOCALS',87)\n\ndef_op('POP_EXCEPT',89)\n\nHAVE_ARGUMENT=90\n\nname_op('STORE_NAME',90)\nname_op('DELETE_NAME',91)\ndef_op('UNPACK_SEQUENCE',92)\njrel_op('FOR_ITER',93)\ndef_op('UNPACK_EX',94)\nname_op('STORE_ATTR',95)\nname_op('DELETE_ATTR',96)\nname_op('STORE_GLOBAL',97)\nname_op('DELETE_GLOBAL',98)\ndef_op('SWAP',99)\ndef_op('LOAD_CONST',100)\nhasconst.append(100)\nname_op('LOAD_NAME',101)\ndef_op('BUILD_TUPLE',102)\ndef_op('BUILD_LIST',103)\ndef_op('BUILD_SET',104)\ndef_op('BUILD_MAP',105)\nname_op('LOAD_ATTR',106)\ndef_op('COMPARE_OP',107)\nhascompare.append(107)\nname_op('IMPORT_NAME',108)\nname_op('IMPORT_FROM',109)\njrel_op('JUMP_FORWARD',110)\njrel_op('POP_JUMP_IF_FALSE',114)\njrel_op('POP_JUMP_IF_TRUE',115)\nname_op('LOAD_GLOBAL',116)\ndef_op('IS_OP',117)\ndef_op('CONTAINS_OP',118)\ndef_op('RERAISE',119)\ndef_op('COPY',120)\ndef_op('RETURN_CONST',121)\nhasconst.append(121)\ndef_op('BINARY_OP',122)\njrel_op('SEND',123)\ndef_op('LOAD_FAST',124)\nhaslocal.append(124)\ndef_op('STORE_FAST',125)\nhaslocal.append(125)\ndef_op('DELETE_FAST',126)\nhaslocal.append(126)\ndef_op('LOAD_FAST_CHECK',127)\nhaslocal.append(127)\njrel_op('POP_JUMP_IF_NOT_NONE',128)\njrel_op('POP_JUMP_IF_NONE',129)\ndef_op('RAISE_VARARGS',130)\ndef_op('GET_AWAITABLE',131)\ndef_op('MAKE_FUNCTION',132)\ndef_op('BUILD_SLICE',133)\njrel_op('JUMP_BACKWARD_NO_INTERRUPT',134)\ndef_op('MAKE_CELL',135)\nhasfree.append(135)\ndef_op('LOAD_CLOSURE',136)\nhasfree.append(136)\ndef_op('LOAD_DEREF',137)\nhasfree.append(137)\ndef_op('STORE_DEREF',138)\nhasfree.append(138)\ndef_op('DELETE_DEREF',139)\nhasfree.append(139)\njrel_op('JUMP_BACKWARD',140)\nname_op('LOAD_SUPER_ATTR',141)\ndef_op('CALL_FUNCTION_EX',142)\ndef_op('LOAD_FAST_AND_CLEAR',143)\nhaslocal.append(143)\n\ndef_op('EXTENDED_ARG',144)\nEXTENDED_ARG=144\ndef_op('LIST_APPEND',145)\ndef_op('SET_ADD',146)\ndef_op('MAP_ADD',147)\nhasfree.append(148)\ndef_op('COPY_FREE_VARS',149)\ndef_op('YIELD_VALUE',150)\ndef_op('RESUME',151)\ndef_op('MATCH_CLASS',152)\n\ndef_op('FORMAT_VALUE',155)\ndef_op('BUILD_CONST_KEY_MAP',156)\ndef_op('BUILD_STRING',157)\n\ndef_op('LIST_EXTEND',162)\ndef_op('SET_UPDATE',163)\ndef_op('DICT_MERGE',164)\ndef_op('DICT_UPDATE',165)\n\ndef_op('CALL',171)\ndef_op('KW_NAMES',172)\nhasconst.append(172)\ndef_op('CALL_INTRINSIC_1',173)\ndef_op('CALL_INTRINSIC_2',174)\n\nname_op('LOAD_FROM_DICT_OR_GLOBALS',175)\ndef_op('LOAD_FROM_DICT_OR_DEREF',176)\nhasfree.append(176)\n\n\nMIN_INSTRUMENTED_OPCODE=237\n\ndef_op('INSTRUMENTED_LOAD_SUPER_ATTR',237)\ndef_op('INSTRUMENTED_POP_JUMP_IF_NONE',238)\ndef_op('INSTRUMENTED_POP_JUMP_IF_NOT_NONE',239)\ndef_op('INSTRUMENTED_RESUME',240)\ndef_op('INSTRUMENTED_CALL',241)\ndef_op('INSTRUMENTED_RETURN_VALUE',242)\ndef_op('INSTRUMENTED_YIELD_VALUE',243)\ndef_op('INSTRUMENTED_CALL_FUNCTION_EX',244)\ndef_op('INSTRUMENTED_JUMP_FORWARD',245)\ndef_op('INSTRUMENTED_JUMP_BACKWARD',246)\ndef_op('INSTRUMENTED_RETURN_CONST',247)\ndef_op('INSTRUMENTED_FOR_ITER',248)\ndef_op('INSTRUMENTED_POP_JUMP_IF_FALSE',249)\ndef_op('INSTRUMENTED_POP_JUMP_IF_TRUE',250)\ndef_op('INSTRUMENTED_END_FOR',251)\ndef_op('INSTRUMENTED_END_SEND',252)\ndef_op('INSTRUMENTED_INSTRUCTION',253)\ndef_op('INSTRUMENTED_LINE',254)\n\n\nhasarg.extend([op for op in opmap.values()if op >=HAVE_ARGUMENT])\n\nMIN_PSEUDO_OPCODE=256\n\npseudo_op('SETUP_FINALLY',256,['NOP'])\nhasexc.append(256)\npseudo_op('SETUP_CLEANUP',257,['NOP'])\nhasexc.append(257)\npseudo_op('SETUP_WITH',258,['NOP'])\nhasexc.append(258)\npseudo_op('POP_BLOCK',259,['NOP'])\n\npseudo_op('JUMP',260,['JUMP_FORWARD','JUMP_BACKWARD'])\npseudo_op('JUMP_NO_INTERRUPT',261,['JUMP_FORWARD','JUMP_BACKWARD_NO_INTERRUPT'])\n\npseudo_op('LOAD_METHOD',262,['LOAD_ATTR'])\npseudo_op('LOAD_SUPER_METHOD',263,['LOAD_SUPER_ATTR'])\npseudo_op('LOAD_ZERO_SUPER_METHOD',264,['LOAD_SUPER_ATTR'])\npseudo_op('LOAD_ZERO_SUPER_ATTR',265,['LOAD_SUPER_ATTR'])\n\npseudo_op('STORE_FAST_MAYBE_NULL',266,['STORE_FAST'])\n\nMAX_PSEUDO_OPCODE=MIN_PSEUDO_OPCODE+len(_pseudo_ops)-1\n\ndel def_op,name_op,jrel_op,jabs_op,pseudo_op\n\nopname=['<%r>'%(op,)for op in range(MAX_PSEUDO_OPCODE+1)]\nfor op,i in opmap.items():\n opname[i]=op\n \n \n_nb_ops=[\n(\"NB_ADD\",\"+\"),\n(\"NB_AND\",\"&\"),\n(\"NB_FLOOR_DIVIDE\",\"//\"),\n(\"NB_LSHIFT\",\"<<\"),\n(\"NB_MATRIX_MULTIPLY\",\"@\"),\n(\"NB_MULTIPLY\",\"*\"),\n(\"NB_REMAINDER\",\"%\"),\n(\"NB_OR\",\"|\"),\n(\"NB_POWER\",\"**\"),\n(\"NB_RSHIFT\",\">>\"),\n(\"NB_SUBTRACT\",\"-\"),\n(\"NB_TRUE_DIVIDE\",\"/\"),\n(\"NB_XOR\",\"^\"),\n(\"NB_INPLACE_ADD\",\"+=\"),\n(\"NB_INPLACE_AND\",\"&=\"),\n(\"NB_INPLACE_FLOOR_DIVIDE\",\"//=\"),\n(\"NB_INPLACE_LSHIFT\",\"<<=\"),\n(\"NB_INPLACE_MATRIX_MULTIPLY\",\"@=\"),\n(\"NB_INPLACE_MULTIPLY\",\"*=\"),\n(\"NB_INPLACE_REMAINDER\",\"%=\"),\n(\"NB_INPLACE_OR\",\"|=\"),\n(\"NB_INPLACE_POWER\",\"**=\"),\n(\"NB_INPLACE_RSHIFT\",\">>=\"),\n(\"NB_INPLACE_SUBTRACT\",\"-=\"),\n(\"NB_INPLACE_TRUE_DIVIDE\",\"/=\"),\n(\"NB_INPLACE_XOR\",\"^=\"),\n]\n\n_intrinsic_1_descs=[\n\"INTRINSIC_1_INVALID\",\n\"INTRINSIC_PRINT\",\n\"INTRINSIC_IMPORT_STAR\",\n\"INTRINSIC_STOPITERATION_ERROR\",\n\"INTRINSIC_ASYNC_GEN_WRAP\",\n\"INTRINSIC_UNARY_POSITIVE\",\n\"INTRINSIC_LIST_TO_TUPLE\",\n\"INTRINSIC_TYPEVAR\",\n\"INTRINSIC_PARAMSPEC\",\n\"INTRINSIC_TYPEVARTUPLE\",\n\"INTRINSIC_SUBSCRIPT_GENERIC\",\n\"INTRINSIC_TYPEALIAS\",\n]\n\n_intrinsic_2_descs=[\n\"INTRINSIC_2_INVALID\",\n\"INTRINSIC_PREP_RERAISE_STAR\",\n\"INTRINSIC_TYPEVAR_WITH_BOUND\",\n\"INTRINSIC_TYPEVAR_WITH_CONSTRAINTS\",\n\"INTRINSIC_SET_FUNCTION_TYPE_PARAMS\",\n]\n\n_specializations={\n\"BINARY_OP\":[\n\"BINARY_OP_ADD_FLOAT\",\n\"BINARY_OP_ADD_INT\",\n\"BINARY_OP_ADD_UNICODE\",\n\"BINARY_OP_INPLACE_ADD_UNICODE\",\n\"BINARY_OP_MULTIPLY_FLOAT\",\n\"BINARY_OP_MULTIPLY_INT\",\n\"BINARY_OP_SUBTRACT_FLOAT\",\n\"BINARY_OP_SUBTRACT_INT\",\n],\n\"BINARY_SUBSCR\":[\n\"BINARY_SUBSCR_DICT\",\n\"BINARY_SUBSCR_GETITEM\",\n\"BINARY_SUBSCR_LIST_INT\",\n\"BINARY_SUBSCR_TUPLE_INT\",\n],\n\"CALL\":[\n\"CALL_PY_EXACT_ARGS\",\n\"CALL_PY_WITH_DEFAULTS\",\n\"CALL_BOUND_METHOD_EXACT_ARGS\",\n\"CALL_BUILTIN_CLASS\",\n\"CALL_BUILTIN_FAST_WITH_KEYWORDS\",\n\"CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS\",\n\"CALL_NO_KW_BUILTIN_FAST\",\n\"CALL_NO_KW_BUILTIN_O\",\n\"CALL_NO_KW_ISINSTANCE\",\n\"CALL_NO_KW_LEN\",\n\"CALL_NO_KW_LIST_APPEND\",\n\"CALL_NO_KW_METHOD_DESCRIPTOR_FAST\",\n\"CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS\",\n\"CALL_NO_KW_METHOD_DESCRIPTOR_O\",\n\"CALL_NO_KW_STR_1\",\n\"CALL_NO_KW_TUPLE_1\",\n\"CALL_NO_KW_TYPE_1\",\n],\n\"COMPARE_OP\":[\n\"COMPARE_OP_FLOAT\",\n\"COMPARE_OP_INT\",\n\"COMPARE_OP_STR\",\n],\n\"FOR_ITER\":[\n\"FOR_ITER_LIST\",\n\"FOR_ITER_TUPLE\",\n\"FOR_ITER_RANGE\",\n\"FOR_ITER_GEN\",\n],\n\"LOAD_SUPER_ATTR\":[\n\"LOAD_SUPER_ATTR_ATTR\",\n\"LOAD_SUPER_ATTR_METHOD\",\n],\n\"LOAD_ATTR\":[\n\n\"LOAD_ATTR_CLASS\",\n\"LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN\",\n\"LOAD_ATTR_INSTANCE_VALUE\",\n\"LOAD_ATTR_MODULE\",\n\"LOAD_ATTR_PROPERTY\",\n\"LOAD_ATTR_SLOT\",\n\"LOAD_ATTR_WITH_HINT\",\n\n\"LOAD_ATTR_METHOD_LAZY_DICT\",\n\"LOAD_ATTR_METHOD_NO_DICT\",\n\"LOAD_ATTR_METHOD_WITH_VALUES\",\n],\n\"LOAD_CONST\":[\n\"LOAD_CONST__LOAD_FAST\",\n],\n\"LOAD_FAST\":[\n\"LOAD_FAST__LOAD_CONST\",\n\"LOAD_FAST__LOAD_FAST\",\n],\n\"LOAD_GLOBAL\":[\n\"LOAD_GLOBAL_BUILTIN\",\n\"LOAD_GLOBAL_MODULE\",\n],\n\"STORE_ATTR\":[\n\"STORE_ATTR_INSTANCE_VALUE\",\n\"STORE_ATTR_SLOT\",\n\"STORE_ATTR_WITH_HINT\",\n],\n\"STORE_FAST\":[\n\"STORE_FAST__LOAD_FAST\",\n\"STORE_FAST__STORE_FAST\",\n],\n\"STORE_SUBSCR\":[\n\"STORE_SUBSCR_DICT\",\n\"STORE_SUBSCR_LIST_INT\",\n],\n\"UNPACK_SEQUENCE\":[\n\"UNPACK_SEQUENCE_LIST\",\n\"UNPACK_SEQUENCE_TUPLE\",\n\"UNPACK_SEQUENCE_TWO_TUPLE\",\n],\n\"SEND\":[\n\"SEND_GEN\",\n],\n}\n_specialized_instructions=[\nopcode for family in _specializations.values()for opcode in family\n]\n\n_cache_format={\n\"LOAD_GLOBAL\":{\n\"counter\":1,\n\"index\":1,\n\"module_keys_version\":1,\n\"builtin_keys_version\":1,\n},\n\"BINARY_OP\":{\n\"counter\":1,\n},\n\"UNPACK_SEQUENCE\":{\n\"counter\":1,\n},\n\"COMPARE_OP\":{\n\"counter\":1,\n},\n\"BINARY_SUBSCR\":{\n\"counter\":1,\n},\n\"FOR_ITER\":{\n\"counter\":1,\n},\n\"LOAD_SUPER_ATTR\":{\n\"counter\":1,\n},\n\"LOAD_ATTR\":{\n\"counter\":1,\n\"version\":2,\n\"keys_version\":2,\n\"descr\":4,\n},\n\"STORE_ATTR\":{\n\"counter\":1,\n\"version\":2,\n\"index\":1,\n},\n\"CALL\":{\n\"counter\":1,\n\"func_version\":2,\n},\n\"STORE_SUBSCR\":{\n\"counter\":1,\n},\n\"SEND\":{\n\"counter\":1,\n},\n}\n\n_inline_cache_entries=[\nsum(_cache_format.get(opname[opcode],{}).values())for opcode in range(256)\n]\n", ["_opcode"]], "operator": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n__all__=['abs','add','and_','attrgetter','call','concat','contains','countOf',\n'delitem','eq','floordiv','ge','getitem','gt','iadd','iand',\n'iconcat','ifloordiv','ilshift','imatmul','imod','imul',\n'index','indexOf','inv','invert','ior','ipow','irshift',\n'is_','is_not','isub','itemgetter','itruediv','ixor','le',\n'length_hint','lshift','lt','matmul','methodcaller','mod',\n'mul','ne','neg','not_','or_','pos','pow','rshift',\n'setitem','sub','truediv','truth','xor']\n\nfrom builtins import abs as _abs\n\n\n\n\ndef lt(a,b):\n ''\n return a =b\n \ndef gt(a,b):\n ''\n return a >b\n \n \n \ndef not_(a):\n ''\n return not a\n \ndef truth(a):\n ''\n return True if a else False\n \ndef is_(a,b):\n ''\n return a is b\n \ndef is_not(a,b):\n ''\n return a is not b\n \n \n \ndef abs(a):\n ''\n return _abs(a)\n \ndef add(a,b):\n ''\n return a+b\n \ndef and_(a,b):\n ''\n return a&b\n \ndef floordiv(a,b):\n ''\n return a //b\n \ndef index(a):\n ''\n return a.__index__()\n \ndef inv(a):\n ''\n return ~a\ninvert=inv\n\ndef lshift(a,b):\n ''\n return a <>b\n \ndef sub(a,b):\n ''\n return a -b\n \ndef truediv(a,b):\n ''\n return a /b\n \ndef xor(a,b):\n ''\n return a ^b\n \n \n \ndef concat(a,b):\n ''\n if not hasattr(a,'__getitem__'):\n msg=\"'%s' object can't be concatenated\"%type(a).__name__\n raise TypeError(msg)\n return a+b\n \ndef contains(a,b):\n ''\n return b in a\n \ndef countOf(a,b):\n ''\n count=0\n for i in a:\n if i is b or i ==b:\n count +=1\n return count\n \ndef delitem(a,b):\n ''\n del a[b]\n \ndef getitem(a,b):\n ''\n return a[b]\n \ndef indexOf(a,b):\n ''\n for i,j in enumerate(a):\n if j is b or j ==b:\n return i\n else :\n raise ValueError('sequence.index(x): x not in sequence')\n \ndef setitem(a,b,c):\n ''\n a[b]=c\n \ndef length_hint(obj,default=0):\n ''\n\n\n\n\n\n\n \n if not isinstance(default,int):\n msg=(\"'%s' object cannot be interpreted as an integer\"%\n type(default).__name__)\n raise TypeError(msg)\n \n try :\n return len(obj)\n except TypeError:\n pass\n \n try :\n hint=type(obj).__length_hint__\n except AttributeError:\n return default\n \n try :\n val=hint(obj)\n except TypeError:\n return default\n if val is NotImplemented:\n return default\n if not isinstance(val,int):\n msg=('__length_hint__ must be integer, not %s'%\n type(val).__name__)\n raise TypeError(msg)\n if val <0:\n msg='__length_hint__() should return >= 0'\n raise ValueError(msg)\n return val\n \n \n \ndef call(obj,/,*args,**kwargs):\n ''\n return obj(*args,**kwargs)\n \n \n \nclass attrgetter:\n ''\n\n\n\n\n\n \n __slots__=('_attrs','_call')\n \n def __init__(self,attr,*attrs):\n if not attrs:\n if not isinstance(attr,str):\n raise TypeError('attribute name must be a string')\n self._attrs=(attr,)\n names=attr.split('.')\n def func(obj):\n for name in names:\n obj=getattr(obj,name)\n return obj\n self._call=func\n else :\n self._attrs=(attr,)+attrs\n getters=tuple(map(attrgetter,self._attrs))\n def func(obj):\n return tuple(getter(obj)for getter in getters)\n self._call=func\n \n def __call__(self,obj):\n return self._call(obj)\n \n def __repr__(self):\n return '%s.%s(%s)'%(self.__class__.__module__,\n self.__class__.__qualname__,\n ', '.join(map(repr,self._attrs)))\n \n def __reduce__(self):\n return self.__class__,self._attrs\n \nclass itemgetter:\n ''\n\n\n\n \n __slots__=('_items','_call')\n \n def __init__(self,item,*items):\n if not items:\n self._items=(item,)\n def func(obj):\n return obj[item]\n self._call=func\n else :\n self._items=items=(item,)+items\n def func(obj):\n return tuple(obj[i]for i in items)\n self._call=func\n \n def __call__(self,obj):\n return self._call(obj)\n \n def __repr__(self):\n return '%s.%s(%s)'%(self.__class__.__module__,\n self.__class__.__name__,\n ', '.join(map(repr,self._items)))\n \n def __reduce__(self):\n return self.__class__,self._items\n \nclass methodcaller:\n ''\n\n\n\n\n \n __slots__=('_name','_args','_kwargs')\n \n def __init__(self,name,/,*args,**kwargs):\n self._name=name\n if not isinstance(self._name,str):\n raise TypeError('method name must be a string')\n self._args=args\n self._kwargs=kwargs\n \n def __call__(self,obj):\n return getattr(obj,self._name)(*self._args,**self._kwargs)\n \n def __repr__(self):\n args=[repr(self._name)]\n args.extend(map(repr,self._args))\n args.extend('%s=%r'%(k,v)for k,v in self._kwargs.items())\n return '%s.%s(%s)'%(self.__class__.__module__,\n self.__class__.__name__,\n ', '.join(args))\n \n def __reduce__(self):\n if not self._kwargs:\n return self.__class__,(self._name,)+self._args\n else :\n from functools import partial\n return partial(self.__class__,self._name,**self._kwargs),self._args\n \n \n \n \ndef iadd(a,b):\n ''\n a +=b\n return a\n \ndef iand(a,b):\n ''\n a &=b\n return a\n \ndef iconcat(a,b):\n ''\n if not hasattr(a,'__getitem__'):\n msg=\"'%s' object can't be concatenated\"%type(a).__name__\n raise TypeError(msg)\n a +=b\n return a\n \ndef ifloordiv(a,b):\n ''\n a //=b\n return a\n \ndef ilshift(a,b):\n ''\n a <<=b\n return a\n \ndef imod(a,b):\n ''\n a %=b\n return a\n \ndef imul(a,b):\n ''\n a *=b\n return a\n \ndef imatmul(a,b):\n ''\n a @=b\n return a\n \ndef ior(a,b):\n ''\n a |=b\n return a\n \ndef ipow(a,b):\n ''\n a **=b\n return a\n \ndef irshift(a,b):\n ''\n a >>=b\n return a\n \ndef isub(a,b):\n ''\n a -=b\n return a\n \ndef itruediv(a,b):\n ''\n a /=b\n return a\n \ndef ixor(a,b):\n ''\n a ^=b\n return a\n \n \ntry :\n from _operator import *\nexcept ImportError:\n pass\nelse :\n from _operator import __doc__\n \n \n \n__lt__=lt\n__le__=le\n__eq__=eq\n__ne__=ne\n__ge__=ge\n__gt__=gt\n__not__=not_\n__abs__=abs\n__add__=add\n__and__=and_\n__call__=call\n__floordiv__=floordiv\n__index__=index\n__inv__=inv\n__invert__=invert\n__lshift__=lshift\n__mod__=mod\n__mul__=mul\n__matmul__=matmul\n__neg__=neg\n__or__=or_\n__pos__=pos\n__pow__=pow\n__rshift__=rshift\n__sub__=sub\n__truediv__=truediv\n__xor__=xor\n__concat__=concat\n__contains__=contains\n__delitem__=delitem\n__getitem__=getitem\n__setitem__=setitem\n__iadd__=iadd\n__iand__=iand\n__iconcat__=iconcat\n__ifloordiv__=ifloordiv\n__ilshift__=ilshift\n__imod__=imod\n__imul__=imul\n__imatmul__=imatmul\n__ior__=ior\n__ipow__=ipow\n__irshift__=irshift\n__isub__=isub\n__itruediv__=itruediv\n__ixor__=ixor\n", ["_operator", "builtins", "functools"]], "optparse": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__version__=\"1.5.3\"\n\n__all__=['Option',\n'make_option',\n'SUPPRESS_HELP',\n'SUPPRESS_USAGE',\n'Values',\n'OptionContainer',\n'OptionGroup',\n'OptionParser',\n'HelpFormatter',\n'IndentedHelpFormatter',\n'TitledHelpFormatter',\n'OptParseError',\n'OptionError',\n'OptionConflictError',\n'OptionValueError',\n'BadOptionError',\n'check_choice']\n\n__copyright__=\"\"\"\nCopyright (c) 2001-2006 Gregory P. Ward. All rights reserved.\nCopyright (c) 2002-2006 Python Software Foundation. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n * Neither the name of the author nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\nEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\nPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\"\"\"\n\nimport sys,os\nimport textwrap\n\ndef _repr(self):\n return \"<%s at 0x%x: %s>\"%(self.__class__.__name__,id(self),self)\n \n \n \n \n \n \n \n \ntry :\n from gettext import gettext,ngettext\nexcept ImportError:\n def gettext(message):\n return message\n \n def ngettext(singular,plural,n):\n if n ==1:\n return singular\n return plural\n \n_=gettext\n\n\nclass OptParseError(Exception):\n def __init__(self,msg):\n self.msg=msg\n \n def __str__(self):\n return self.msg\n \n \nclass OptionError(OptParseError):\n ''\n\n\n \n \n def __init__(self,msg,option):\n self.msg=msg\n self.option_id=str(option)\n \n def __str__(self):\n if self.option_id:\n return \"option %s: %s\"%(self.option_id,self.msg)\n else :\n return self.msg\n \nclass OptionConflictError(OptionError):\n ''\n\n \n \nclass OptionValueError(OptParseError):\n ''\n\n\n \n \nclass BadOptionError(OptParseError):\n ''\n\n \n def __init__(self,opt_str):\n self.opt_str=opt_str\n \n def __str__(self):\n return _(\"no such option: %s\")%self.opt_str\n \nclass AmbiguousOptionError(BadOptionError):\n ''\n\n \n def __init__(self,opt_str,possibilities):\n BadOptionError.__init__(self,opt_str)\n self.possibilities=possibilities\n \n def __str__(self):\n return (_(\"ambiguous option: %s (%s?)\")\n %(self.opt_str,\", \".join(self.possibilities)))\n \n \nclass HelpFormatter:\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n NO_DEFAULT_VALUE=\"none\"\n \n def __init__(self,\n indent_increment,\n max_help_position,\n width,\n short_first):\n self.parser=None\n self.indent_increment=indent_increment\n if width is None :\n try :\n width=int(os.environ['COLUMNS'])\n except (KeyError,ValueError):\n width=80\n width -=2\n self.width=width\n self.help_position=self.max_help_position=\\\n min(max_help_position,max(width -20,indent_increment *2))\n self.current_indent=0\n self.level=0\n self.help_width=None\n self.short_first=short_first\n self.default_tag=\"%default\"\n self.option_strings={}\n self._short_opt_fmt=\"%s %s\"\n self._long_opt_fmt=\"%s=%s\"\n \n def set_parser(self,parser):\n self.parser=parser\n \n def set_short_opt_delimiter(self,delim):\n if delim not in (\"\",\" \"):\n raise ValueError(\n \"invalid metavar delimiter for short options: %r\"%delim)\n self._short_opt_fmt=\"%s\"+delim+\"%s\"\n \n def set_long_opt_delimiter(self,delim):\n if delim not in (\"=\",\" \"):\n raise ValueError(\n \"invalid metavar delimiter for long options: %r\"%delim)\n self._long_opt_fmt=\"%s\"+delim+\"%s\"\n \n def indent(self):\n self.current_indent +=self.indent_increment\n self.level +=1\n \n def dedent(self):\n self.current_indent -=self.indent_increment\n assert self.current_indent >=0,\"Indent decreased below 0.\"\n self.level -=1\n \n def format_usage(self,usage):\n raise NotImplementedError(\"subclasses must implement\")\n \n def format_heading(self,heading):\n raise NotImplementedError(\"subclasses must implement\")\n \n def _format_text(self,text):\n ''\n\n\n \n text_width=max(self.width -self.current_indent,11)\n indent=\" \"*self.current_indent\n return textwrap.fill(text,\n text_width,\n initial_indent=indent,\n subsequent_indent=indent)\n \n def format_description(self,description):\n if description:\n return self._format_text(description)+\"\\n\"\n else :\n return \"\"\n \n def format_epilog(self,epilog):\n if epilog:\n return \"\\n\"+self._format_text(epilog)+\"\\n\"\n else :\n return \"\"\n \n \n def expand_default(self,option):\n if self.parser is None or not self.default_tag:\n return option.help\n \n default_value=self.parser.defaults.get(option.dest)\n if default_value is NO_DEFAULT or default_value is None :\n default_value=self.NO_DEFAULT_VALUE\n \n return option.help.replace(self.default_tag,str(default_value))\n \n def format_option(self,option):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n result=[]\n opts=self.option_strings[option]\n opt_width=self.help_position -self.current_indent -2\n if len(opts)>opt_width:\n opts=\"%*s%s\\n\"%(self.current_indent,\"\",opts)\n indent_first=self.help_position\n else :\n opts=\"%*s%-*s \"%(self.current_indent,\"\",opt_width,opts)\n indent_first=0\n result.append(opts)\n if option.help:\n help_text=self.expand_default(option)\n help_lines=textwrap.wrap(help_text,self.help_width)\n result.append(\"%*s%s\\n\"%(indent_first,\"\",help_lines[0]))\n result.extend([\"%*s%s\\n\"%(self.help_position,\"\",line)\n for line in help_lines[1:]])\n elif opts[-1]!=\"\\n\":\n result.append(\"\\n\")\n return \"\".join(result)\n \n def store_option_strings(self,parser):\n self.indent()\n max_len=0\n for opt in parser.option_list:\n strings=self.format_option_strings(opt)\n self.option_strings[opt]=strings\n max_len=max(max_len,len(strings)+self.current_indent)\n self.indent()\n for group in parser.option_groups:\n for opt in group.option_list:\n strings=self.format_option_strings(opt)\n self.option_strings[opt]=strings\n max_len=max(max_len,len(strings)+self.current_indent)\n self.dedent()\n self.dedent()\n self.help_position=min(max_len+2,self.max_help_position)\n self.help_width=max(self.width -self.help_position,11)\n \n def format_option_strings(self,option):\n ''\n if option.takes_value():\n metavar=option.metavar or option.dest.upper()\n short_opts=[self._short_opt_fmt %(sopt,metavar)\n for sopt in option._short_opts]\n long_opts=[self._long_opt_fmt %(lopt,metavar)\n for lopt in option._long_opts]\n else :\n short_opts=option._short_opts\n long_opts=option._long_opts\n \n if self.short_first:\n opts=short_opts+long_opts\n else :\n opts=long_opts+short_opts\n \n return \", \".join(opts)\n \nclass IndentedHelpFormatter(HelpFormatter):\n ''\n \n \n def __init__(self,\n indent_increment=2,\n max_help_position=24,\n width=None ,\n short_first=1):\n HelpFormatter.__init__(\n self,indent_increment,max_help_position,width,short_first)\n \n def format_usage(self,usage):\n return _(\"Usage: %s\\n\")%usage\n \n def format_heading(self,heading):\n return \"%*s%s:\\n\"%(self.current_indent,\"\",heading)\n \n \nclass TitledHelpFormatter(HelpFormatter):\n ''\n \n \n def __init__(self,\n indent_increment=0,\n max_help_position=24,\n width=None ,\n short_first=0):\n HelpFormatter.__init__(\n self,indent_increment,max_help_position,width,short_first)\n \n def format_usage(self,usage):\n return \"%s %s\\n\"%(self.format_heading(_(\"Usage\")),usage)\n \n def format_heading(self,heading):\n return \"%s\\n%s\\n\"%(heading,\"=-\"[self.level]*len(heading))\n \n \ndef _parse_num(val,type):\n if val[:2].lower()==\"0x\":\n radix=16\n elif val[:2].lower()==\"0b\":\n radix=2\n val=val[2:]or \"0\"\n elif val[:1]==\"0\":\n radix=8\n else :\n radix=10\n \n return type(val,radix)\n \ndef _parse_int(val):\n return _parse_num(val,int)\n \n_builtin_cvt={\"int\":(_parse_int,_(\"integer\")),\n\"long\":(_parse_int,_(\"integer\")),\n\"float\":(float,_(\"floating-point\")),\n\"complex\":(complex,_(\"complex\"))}\n\ndef check_builtin(option,opt,value):\n (cvt,what)=_builtin_cvt[option.type]\n try :\n return cvt(value)\n except ValueError:\n raise OptionValueError(\n _(\"option %s: invalid %s value: %r\")%(opt,what,value))\n \ndef check_choice(option,opt,value):\n if value in option.choices:\n return value\n else :\n choices=\", \".join(map(repr,option.choices))\n raise OptionValueError(\n _(\"option %s: invalid choice: %r (choose from %s)\")\n %(opt,value,choices))\n \n \n \nNO_DEFAULT=(\"NO\",\"DEFAULT\")\n\n\nclass Option:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n ATTRS=['action',\n 'type',\n 'dest',\n 'default',\n 'nargs',\n 'const',\n 'choices',\n 'callback',\n 'callback_args',\n 'callback_kwargs',\n 'help',\n 'metavar']\n \n \n \n ACTIONS=(\"store\",\n \"store_const\",\n \"store_true\",\n \"store_false\",\n \"append\",\n \"append_const\",\n \"count\",\n \"callback\",\n \"help\",\n \"version\")\n \n \n \n \n STORE_ACTIONS=(\"store\",\n \"store_const\",\n \"store_true\",\n \"store_false\",\n \"append\",\n \"append_const\",\n \"count\")\n \n \n \n TYPED_ACTIONS=(\"store\",\n \"append\",\n \"callback\")\n \n \n \n ALWAYS_TYPED_ACTIONS=(\"store\",\n \"append\")\n \n \n CONST_ACTIONS=(\"store_const\",\n \"append_const\")\n \n \n \n TYPES=(\"string\",\"int\",\"long\",\"float\",\"complex\",\"choice\")\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n TYPE_CHECKER={\"int\":check_builtin,\n \"long\":check_builtin,\n \"float\":check_builtin,\n \"complex\":check_builtin,\n \"choice\":check_choice,\n }\n \n \n \n \n \n \n \n \n \n \n CHECK_METHODS=None\n \n \n \n \n def __init__(self,*opts,**attrs):\n \n \n self._short_opts=[]\n self._long_opts=[]\n opts=self._check_opt_strings(opts)\n self._set_opt_strings(opts)\n \n \n self._set_attrs(attrs)\n \n \n \n \n \n \n for checker in self.CHECK_METHODS:\n checker(self)\n \n def _check_opt_strings(self,opts):\n \n \n \n opts=[opt for opt in opts if opt]\n if not opts:\n raise TypeError(\"at least one option string must be supplied\")\n return opts\n \n def _set_opt_strings(self,opts):\n for opt in opts:\n if len(opt)<2:\n raise OptionError(\n \"invalid option string %r: \"\n \"must be at least two characters long\"%opt,self)\n elif len(opt)==2:\n if not (opt[0]==\"-\"and opt[1]!=\"-\"):\n raise OptionError(\n \"invalid short option string %r: \"\n \"must be of the form -x, (x any non-dash char)\"%opt,\n self)\n self._short_opts.append(opt)\n else :\n if not (opt[0:2]==\"--\"and opt[2]!=\"-\"):\n raise OptionError(\n \"invalid long option string %r: \"\n \"must start with --, followed by non-dash\"%opt,\n self)\n self._long_opts.append(opt)\n \n def _set_attrs(self,attrs):\n for attr in self.ATTRS:\n if attr in attrs:\n setattr(self,attr,attrs[attr])\n del attrs[attr]\n else :\n if attr =='default':\n setattr(self,attr,NO_DEFAULT)\n else :\n setattr(self,attr,None )\n if attrs:\n attrs=sorted(attrs.keys())\n raise OptionError(\n \"invalid keyword arguments: %s\"%\", \".join(attrs),\n self)\n \n \n \n \n def _check_action(self):\n if self.action is None :\n self.action=\"store\"\n elif self.action not in self.ACTIONS:\n raise OptionError(\"invalid action: %r\"%self.action,self)\n \n def _check_type(self):\n if self.type is None :\n if self.action in self.ALWAYS_TYPED_ACTIONS:\n if self.choices is not None :\n \n self.type=\"choice\"\n else :\n \n self.type=\"string\"\n else :\n \n \n if isinstance(self.type,type):\n self.type=self.type.__name__\n \n if self.type ==\"str\":\n self.type=\"string\"\n \n if self.type not in self.TYPES:\n raise OptionError(\"invalid option type: %r\"%self.type,self)\n if self.action not in self.TYPED_ACTIONS:\n raise OptionError(\n \"must not supply a type for action %r\"%self.action,self)\n \n def _check_choice(self):\n if self.type ==\"choice\":\n if self.choices is None :\n raise OptionError(\n \"must supply a list of choices for type 'choice'\",self)\n elif not isinstance(self.choices,(tuple,list)):\n raise OptionError(\n \"choices must be a list of strings ('%s' supplied)\"\n %str(type(self.choices)).split(\"'\")[1],self)\n elif self.choices is not None :\n raise OptionError(\n \"must not supply choices for type %r\"%self.type,self)\n \n def _check_dest(self):\n \n \n takes_value=(self.action in self.STORE_ACTIONS or\n self.type is not None )\n if self.dest is None and takes_value:\n \n \n \n if self._long_opts:\n \n self.dest=self._long_opts[0][2:].replace('-','_')\n else :\n self.dest=self._short_opts[0][1]\n \n def _check_const(self):\n if self.action not in self.CONST_ACTIONS and self.const is not None :\n raise OptionError(\n \"'const' must not be supplied for action %r\"%self.action,\n self)\n \n def _check_nargs(self):\n if self.action in self.TYPED_ACTIONS:\n if self.nargs is None :\n self.nargs=1\n elif self.nargs is not None :\n raise OptionError(\n \"'nargs' must not be supplied for action %r\"%self.action,\n self)\n \n def _check_callback(self):\n if self.action ==\"callback\":\n if not callable(self.callback):\n raise OptionError(\n \"callback not callable: %r\"%self.callback,self)\n if (self.callback_args is not None and\n not isinstance(self.callback_args,tuple)):\n raise OptionError(\n \"callback_args, if supplied, must be a tuple: not %r\"\n %self.callback_args,self)\n if (self.callback_kwargs is not None and\n not isinstance(self.callback_kwargs,dict)):\n raise OptionError(\n \"callback_kwargs, if supplied, must be a dict: not %r\"\n %self.callback_kwargs,self)\n else :\n if self.callback is not None :\n raise OptionError(\n \"callback supplied (%r) for non-callback option\"\n %self.callback,self)\n if self.callback_args is not None :\n raise OptionError(\n \"callback_args supplied for non-callback option\",self)\n if self.callback_kwargs is not None :\n raise OptionError(\n \"callback_kwargs supplied for non-callback option\",self)\n \n \n CHECK_METHODS=[_check_action,\n _check_type,\n _check_choice,\n _check_dest,\n _check_const,\n _check_nargs,\n _check_callback]\n \n \n \n \n def __str__(self):\n return \"/\".join(self._short_opts+self._long_opts)\n \n __repr__=_repr\n \n def takes_value(self):\n return self.type is not None\n \n def get_opt_string(self):\n if self._long_opts:\n return self._long_opts[0]\n else :\n return self._short_opts[0]\n \n \n \n \n def check_value(self,opt,value):\n checker=self.TYPE_CHECKER.get(self.type)\n if checker is None :\n return value\n else :\n return checker(self,opt,value)\n \n def convert_value(self,opt,value):\n if value is not None :\n if self.nargs ==1:\n return self.check_value(opt,value)\n else :\n return tuple([self.check_value(opt,v)for v in value])\n \n def process(self,opt,value,values,parser):\n \n \n \n value=self.convert_value(opt,value)\n \n \n \n \n return self.take_action(\n self.action,self.dest,opt,value,values,parser)\n \n def take_action(self,action,dest,opt,value,values,parser):\n if action ==\"store\":\n setattr(values,dest,value)\n elif action ==\"store_const\":\n setattr(values,dest,self.const)\n elif action ==\"store_true\":\n setattr(values,dest,True )\n elif action ==\"store_false\":\n setattr(values,dest,False )\n elif action ==\"append\":\n values.ensure_value(dest,[]).append(value)\n elif action ==\"append_const\":\n values.ensure_value(dest,[]).append(self.const)\n elif action ==\"count\":\n setattr(values,dest,values.ensure_value(dest,0)+1)\n elif action ==\"callback\":\n args=self.callback_args or ()\n kwargs=self.callback_kwargs or {}\n self.callback(self,opt,value,parser,*args,**kwargs)\n elif action ==\"help\":\n parser.print_help()\n parser.exit()\n elif action ==\"version\":\n parser.print_version()\n parser.exit()\n else :\n raise ValueError(\"unknown action %r\"%self.action)\n \n return 1\n \n \n \n \nSUPPRESS_HELP=\"SUPPRESS\"+\"HELP\"\nSUPPRESS_USAGE=\"SUPPRESS\"+\"USAGE\"\n\nclass Values:\n\n def __init__(self,defaults=None ):\n if defaults:\n for (attr,val)in defaults.items():\n setattr(self,attr,val)\n \n def __str__(self):\n return str(self.__dict__)\n \n __repr__=_repr\n \n def __eq__(self,other):\n if isinstance(other,Values):\n return self.__dict__ ==other.__dict__\n elif isinstance(other,dict):\n return self.__dict__ ==other\n else :\n return NotImplemented\n \n def _update_careful(self,dict):\n ''\n\n\n\n\n \n for attr in dir(self):\n if attr in dict:\n dval=dict[attr]\n if dval is not None :\n setattr(self,attr,dval)\n \n def _update_loose(self,dict):\n ''\n\n\n\n \n self.__dict__.update(dict)\n \n def _update(self,dict,mode):\n if mode ==\"careful\":\n self._update_careful(dict)\n elif mode ==\"loose\":\n self._update_loose(dict)\n else :\n raise ValueError(\"invalid update mode: %r\"%mode)\n \n def read_module(self,modname,mode=\"careful\"):\n __import__(modname)\n mod=sys.modules[modname]\n self._update(vars(mod),mode)\n \n def read_file(self,filename,mode=\"careful\"):\n vars={}\n exec(open(filename).read(),vars)\n self._update(vars,mode)\n \n def ensure_value(self,attr,value):\n if not hasattr(self,attr)or getattr(self,attr)is None :\n setattr(self,attr,value)\n return getattr(self,attr)\n \n \nclass OptionContainer:\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,option_class,conflict_handler,description):\n \n \n \n \n self._create_option_list()\n \n self.option_class=option_class\n self.set_conflict_handler(conflict_handler)\n self.set_description(description)\n \n def _create_option_mappings(self):\n \n \n \n self._short_opt={}\n self._long_opt={}\n self.defaults={}\n \n \n def _share_option_mappings(self,parser):\n \n \n self._short_opt=parser._short_opt\n self._long_opt=parser._long_opt\n self.defaults=parser.defaults\n \n def set_conflict_handler(self,handler):\n if handler not in (\"error\",\"resolve\"):\n raise ValueError(\"invalid conflict_resolution value %r\"%handler)\n self.conflict_handler=handler\n \n def set_description(self,description):\n self.description=description\n \n def get_description(self):\n return self.description\n \n \n def destroy(self):\n ''\n del self._short_opt\n del self._long_opt\n del self.defaults\n \n \n \n \n def _check_conflict(self,option):\n conflict_opts=[]\n for opt in option._short_opts:\n if opt in self._short_opt:\n conflict_opts.append((opt,self._short_opt[opt]))\n for opt in option._long_opts:\n if opt in self._long_opt:\n conflict_opts.append((opt,self._long_opt[opt]))\n \n if conflict_opts:\n handler=self.conflict_handler\n if handler ==\"error\":\n raise OptionConflictError(\n \"conflicting option string(s): %s\"\n %\", \".join([co[0]for co in conflict_opts]),\n option)\n elif handler ==\"resolve\":\n for (opt,c_option)in conflict_opts:\n if opt.startswith(\"--\"):\n c_option._long_opts.remove(opt)\n del self._long_opt[opt]\n else :\n c_option._short_opts.remove(opt)\n del self._short_opt[opt]\n if not (c_option._short_opts or c_option._long_opts):\n c_option.container.option_list.remove(c_option)\n \n def add_option(self,*args,**kwargs):\n ''\n\n \n if isinstance(args[0],str):\n option=self.option_class(*args,**kwargs)\n elif len(args)==1 and not kwargs:\n option=args[0]\n if not isinstance(option,Option):\n raise TypeError(\"not an Option instance: %r\"%option)\n else :\n raise TypeError(\"invalid arguments\")\n \n self._check_conflict(option)\n \n self.option_list.append(option)\n option.container=self\n for opt in option._short_opts:\n self._short_opt[opt]=option\n for opt in option._long_opts:\n self._long_opt[opt]=option\n \n if option.dest is not None :\n if option.default is not NO_DEFAULT:\n self.defaults[option.dest]=option.default\n elif option.dest not in self.defaults:\n self.defaults[option.dest]=None\n \n return option\n \n def add_options(self,option_list):\n for option in option_list:\n self.add_option(option)\n \n \n \n def get_option(self,opt_str):\n return (self._short_opt.get(opt_str)or\n self._long_opt.get(opt_str))\n \n def has_option(self,opt_str):\n return (opt_str in self._short_opt or\n opt_str in self._long_opt)\n \n def remove_option(self,opt_str):\n option=self._short_opt.get(opt_str)\n if option is None :\n option=self._long_opt.get(opt_str)\n if option is None :\n raise ValueError(\"no such option %r\"%opt_str)\n \n for opt in option._short_opts:\n del self._short_opt[opt]\n for opt in option._long_opts:\n del self._long_opt[opt]\n option.container.option_list.remove(option)\n \n \n \n \n def format_option_help(self,formatter):\n if not self.option_list:\n return \"\"\n result=[]\n for option in self.option_list:\n if not option.help is SUPPRESS_HELP:\n result.append(formatter.format_option(option))\n return \"\".join(result)\n \n def format_description(self,formatter):\n return formatter.format_description(self.get_description())\n \n def format_help(self,formatter):\n result=[]\n if self.description:\n result.append(self.format_description(formatter))\n if self.option_list:\n result.append(self.format_option_help(formatter))\n return \"\\n\".join(result)\n \n \nclass OptionGroup(OptionContainer):\n\n def __init__(self,parser,title,description=None ):\n self.parser=parser\n OptionContainer.__init__(\n self,parser.option_class,parser.conflict_handler,description)\n self.title=title\n \n def _create_option_list(self):\n self.option_list=[]\n self._share_option_mappings(self.parser)\n \n def set_title(self,title):\n self.title=title\n \n def destroy(self):\n ''\n OptionContainer.destroy(self)\n del self.option_list\n \n \n \n def format_help(self,formatter):\n result=formatter.format_heading(self.title)\n formatter.indent()\n result +=OptionContainer.format_help(self,formatter)\n formatter.dedent()\n return result\n \n \nclass OptionParser(OptionContainer):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n standard_option_list=[]\n \n def __init__(self,\n usage=None ,\n option_list=None ,\n option_class=Option,\n version=None ,\n conflict_handler=\"error\",\n description=None ,\n formatter=None ,\n add_help_option=True ,\n prog=None ,\n epilog=None ):\n OptionContainer.__init__(\n self,option_class,conflict_handler,description)\n self.set_usage(usage)\n self.prog=prog\n self.version=version\n self.allow_interspersed_args=True\n self.process_default_values=True\n if formatter is None :\n formatter=IndentedHelpFormatter()\n self.formatter=formatter\n self.formatter.set_parser(self)\n self.epilog=epilog\n \n \n \n \n \n self._populate_option_list(option_list,\n add_help=add_help_option)\n \n self._init_parsing_state()\n \n \n def destroy(self):\n ''\n\n\n\n\n \n OptionContainer.destroy(self)\n for group in self.option_groups:\n group.destroy()\n del self.option_list\n del self.option_groups\n del self.formatter\n \n \n \n \n \n def _create_option_list(self):\n self.option_list=[]\n self.option_groups=[]\n self._create_option_mappings()\n \n def _add_help_option(self):\n self.add_option(\"-h\",\"--help\",\n action=\"help\",\n help=_(\"show this help message and exit\"))\n \n def _add_version_option(self):\n self.add_option(\"--version\",\n action=\"version\",\n help=_(\"show program's version number and exit\"))\n \n def _populate_option_list(self,option_list,add_help=True ):\n if self.standard_option_list:\n self.add_options(self.standard_option_list)\n if option_list:\n self.add_options(option_list)\n if self.version:\n self._add_version_option()\n if add_help:\n self._add_help_option()\n \n def _init_parsing_state(self):\n \n self.rargs=None\n self.largs=None\n self.values=None\n \n \n \n \n def set_usage(self,usage):\n if usage is None :\n self.usage=_(\"%prog [options]\")\n elif usage is SUPPRESS_USAGE:\n self.usage=None\n \n elif usage.lower().startswith(\"usage: \"):\n self.usage=usage[7:]\n else :\n self.usage=usage\n \n def enable_interspersed_args(self):\n ''\n\n\n\n \n self.allow_interspersed_args=True\n \n def disable_interspersed_args(self):\n ''\n\n\n\n \n self.allow_interspersed_args=False\n \n def set_process_default_values(self,process):\n self.process_default_values=process\n \n def set_default(self,dest,value):\n self.defaults[dest]=value\n \n def set_defaults(self,**kwargs):\n self.defaults.update(kwargs)\n \n def _get_all_options(self):\n options=self.option_list[:]\n for group in self.option_groups:\n options.extend(group.option_list)\n return options\n \n def get_default_values(self):\n if not self.process_default_values:\n \n return Values(self.defaults)\n \n defaults=self.defaults.copy()\n for option in self._get_all_options():\n default=defaults.get(option.dest)\n if isinstance(default,str):\n opt_str=option.get_opt_string()\n defaults[option.dest]=option.check_value(opt_str,default)\n \n return Values(defaults)\n \n \n \n \n def add_option_group(self,*args,**kwargs):\n \n if isinstance(args[0],str):\n group=OptionGroup(self,*args,**kwargs)\n elif len(args)==1 and not kwargs:\n group=args[0]\n if not isinstance(group,OptionGroup):\n raise TypeError(\"not an OptionGroup instance: %r\"%group)\n if group.parser is not self:\n raise ValueError(\"invalid OptionGroup (wrong parser)\")\n else :\n raise TypeError(\"invalid arguments\")\n \n self.option_groups.append(group)\n return group\n \n def get_option_group(self,opt_str):\n option=(self._short_opt.get(opt_str)or\n self._long_opt.get(opt_str))\n if option and option.container is not self:\n return option.container\n return None\n \n \n \n \n def _get_args(self,args):\n if args is None :\n return sys.argv[1:]\n else :\n return args[:]\n \n def parse_args(self,args=None ,values=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n rargs=self._get_args(args)\n if values is None :\n values=self.get_default_values()\n \n \n \n \n \n \n \n \n \n \n self.rargs=rargs\n self.largs=largs=[]\n self.values=values\n \n try :\n stop=self._process_args(largs,rargs,values)\n except (BadOptionError,OptionValueError)as err:\n self.error(str(err))\n \n args=largs+rargs\n return self.check_values(values,args)\n \n def check_values(self,values,args):\n ''\n\n\n\n\n\n\n\n\n \n return (values,args)\n \n def _process_args(self,largs,rargs,values):\n ''\n\n\n\n\n\n\n\n \n while rargs:\n arg=rargs[0]\n \n \n \n if arg ==\"--\":\n del rargs[0]\n return\n elif arg[0:2]==\"--\":\n \n self._process_long_opt(rargs,values)\n elif arg[:1]==\"-\"and len(arg)>1:\n \n \n self._process_short_opts(rargs,values)\n elif self.allow_interspersed_args:\n largs.append(arg)\n del rargs[0]\n else :\n return\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def _match_long_opt(self,opt):\n ''\n\n\n\n\n \n return _match_abbrev(opt,self._long_opt)\n \n def _process_long_opt(self,rargs,values):\n arg=rargs.pop(0)\n \n \n \n if \"=\"in arg:\n (opt,next_arg)=arg.split(\"=\",1)\n rargs.insert(0,next_arg)\n had_explicit_value=True\n else :\n opt=arg\n had_explicit_value=False\n \n opt=self._match_long_opt(opt)\n option=self._long_opt[opt]\n if option.takes_value():\n nargs=option.nargs\n if len(rargs)\".format(self.path)\n return \"\"\n \n def add_dll_directory(path):\n ''\n\n\n\n\n\n\n\n \n import nt\n cookie=nt._add_dll_directory(path)\n return _AddedDllDirectory(\n path,\n cookie,\n nt._remove_dll_directory\n )\n \n \ndef scandir(*args,**kw):\n raise NotImplementedError('browsers cannot read a directory content')\n \ndef waitstatus_to_exitcode(status):\n return status >>8\n \n_set=set()\n\nsupports_dir_fd=_set\n\nsupports_effective_ids=_set\n\nsupports_fd=_set\n\nsupports_follow_symlinks=_set\n\n", ["abc", "nt", "os.path", "posix", "posixpath", "sys"]], "pathlib": [".py", "''\n\n\n\n\n\n\nimport fnmatch\nimport functools\nimport io\nimport ntpath\nimport os\nimport posixpath\nimport re\nimport sys\nimport warnings\nfrom _collections_abc import Sequence\nfrom errno import ENOENT,ENOTDIR,EBADF,ELOOP\nfrom stat import S_ISDIR,S_ISLNK,S_ISREG,S_ISSOCK,S_ISBLK,S_ISCHR,S_ISFIFO\nfrom urllib.parse import quote_from_bytes as urlquote_from_bytes\n\n\n__all__=[\n\"PurePath\",\"PurePosixPath\",\"PureWindowsPath\",\n\"Path\",\"PosixPath\",\"WindowsPath\",\n]\n\n\n\n\n\n\n\n_WIN_RESERVED_NAMES=frozenset(\n{'CON','PRN','AUX','NUL','CONIN$','CONOUT$'}|\n{f'COM{c}'for c in '123456789\\xb9\\xb2\\xb3'}|\n{f'LPT{c}'for c in '123456789\\xb9\\xb2\\xb3'}\n)\n\n_WINERROR_NOT_READY=21\n_WINERROR_INVALID_NAME=123\n_WINERROR_CANT_RESOLVE_FILENAME=1921\n\n\n_IGNORED_ERRNOS=(ENOENT,ENOTDIR,EBADF,ELOOP)\n\n_IGNORED_WINERRORS=(\n_WINERROR_NOT_READY,\n_WINERROR_INVALID_NAME,\n_WINERROR_CANT_RESOLVE_FILENAME)\n\ndef _ignore_error(exception):\n return(getattr(exception,'errno',None)in _IGNORED_ERRNOS or\n getattr(exception,'winerror',None)in _IGNORED_WINERRORS)\n \n \n@functools.cache\ndef _is_case_sensitive(flavour):\n return flavour.normcase('Aa')=='Aa'\n \n \n \n \n \n \n \n \n \n \n \n \n \n_FNMATCH_PREFIX,_FNMATCH_SUFFIX=fnmatch.translate('_').split('_')\n_FNMATCH_SLICE=slice(len(_FNMATCH_PREFIX),-len(_FNMATCH_SUFFIX))\n_SWAP_SEP_AND_NEWLINE={\n'/':str.maketrans({'/':'\\n','\\n':'/'}),\n'\\\\':str.maketrans({'\\\\':'\\n','\\n':'\\\\'}),\n}\n\n\n@functools.lru_cache()\ndef _make_selector(pattern_parts,flavour,case_sensitive):\n pat=pattern_parts[0]\n if not pat:\n return _TerminatingSelector()\n if pat =='**':\n child_parts_idx=1\n while child_parts_idx =len(self)or idx <-len(self):\n raise IndexError(idx)\n if idx <0:\n idx +=len(self)\n return self._path._from_parsed_parts(self._drv,self._root,\n self._tail[:-idx -1])\n \n def __repr__(self):\n return \"<{}.parents>\".format(type(self._path).__name__)\n \n \nclass PurePath(object):\n ''\n\n\n\n\n\n\n \n \n __slots__=(\n \n \n '_raw_path',\n \n \n \n \n \n \n \n \n '_drv','_root','_tail_cached',\n \n \n \n \n '_str',\n \n \n \n \n \n '_str_normcase_cached',\n \n \n \n \n \n '_parts_normcase_cached',\n \n \n \n '_lines_cached',\n \n \n \n '_hash',\n )\n _flavour=os.path\n \n def __new__(cls,*args,**kwargs):\n ''\n\n\n\n \n if cls is PurePath:\n cls=PureWindowsPath if os.name =='nt'else PurePosixPath\n return object.__new__(cls)\n \n def __reduce__(self):\n \n \n return(self.__class__,self.parts)\n \n def __init__(self,*args):\n paths=[]\n for arg in args:\n if isinstance(arg,PurePath):\n path=arg._raw_path\n if arg._flavour is ntpath and self._flavour is posixpath:\n \n path=path.replace('\\\\','/')\n else:\n try:\n path=os.fspath(arg)\n except TypeError:\n path=arg\n if not isinstance(path,str):\n raise TypeError(\n \"argument should be a str or an os.PathLike \"\n \"object where __fspath__ returns a str, \"\n f\"not {type(path).__name__ !r}\")\n paths.append(path)\n if len(paths)==0:\n self._raw_path=''\n elif len(paths)==1:\n self._raw_path=paths[0]\n else:\n self._raw_path=self._flavour.join(*paths)\n \n def with_segments(self,*pathsegments):\n ''\n\n\n \n return type(self)(*pathsegments)\n \n @classmethod\n def _parse_path(cls,path):\n if not path:\n return '','',[]\n sep=cls._flavour.sep\n altsep=cls._flavour.altsep\n if altsep:\n path=path.replace(altsep,sep)\n drv,root,rel=cls._flavour.splitroot(path)\n if not root and drv.startswith(sep)and not drv.endswith(sep):\n drv_parts=drv.split(sep)\n if len(drv_parts)==4 and drv_parts[2]not in '?.':\n \n root=sep\n elif len(drv_parts)==6:\n \n root=sep\n parsed=[sys.intern(str(x))for x in rel.split(sep)if x and x !='.']\n return drv,root,parsed\n \n def _load_parts(self):\n drv,root,tail=self._parse_path(self._raw_path)\n self._drv=drv\n self._root=root\n self._tail_cached=tail\n \n def _from_parsed_parts(self,drv,root,tail):\n path_str=self._format_parsed_parts(drv,root,tail)\n path=self.with_segments(path_str)\n path._str=path_str or '.'\n path._drv=drv\n path._root=root\n path._tail_cached=tail\n return path\n \n @classmethod\n def _format_parsed_parts(cls,drv,root,tail):\n if drv or root:\n return drv+root+cls._flavour.sep.join(tail)\n elif tail and cls._flavour.splitdrive(tail[0])[0]:\n tail=['.']+tail\n return cls._flavour.sep.join(tail)\n \n def __str__(self):\n ''\n \n try:\n return self._str\n except AttributeError:\n self._str=self._format_parsed_parts(self.drive,self.root,\n self._tail)or '.'\n return self._str\n \n def __fspath__(self):\n return str(self)\n \n def as_posix(self):\n ''\n \n f=self._flavour\n return str(self).replace(f.sep,'/')\n \n def __bytes__(self):\n ''\n \n return os.fsencode(self)\n \n def __repr__(self):\n return \"{}({!r})\".format(self.__class__.__name__,self.as_posix())\n \n def as_uri(self):\n ''\n if not self.is_absolute():\n raise ValueError(\"relative path can't be expressed as a file URI\")\n \n drive=self.drive\n if len(drive)==2 and drive[1]==':':\n \n prefix='file:///'+drive\n path=self.as_posix()[2:]\n elif drive:\n \n prefix='file:'\n path=self.as_posix()\n else:\n \n prefix='file://'\n path=str(self)\n return prefix+urlquote_from_bytes(os.fsencode(path))\n \n @property\n def _str_normcase(self):\n \n try:\n return self._str_normcase_cached\n except AttributeError:\n if _is_case_sensitive(self._flavour):\n self._str_normcase_cached=str(self)\n else:\n self._str_normcase_cached=str(self).lower()\n return self._str_normcase_cached\n \n @property\n def _parts_normcase(self):\n \n try:\n return self._parts_normcase_cached\n except AttributeError:\n self._parts_normcase_cached=self._str_normcase.split(self._flavour.sep)\n return self._parts_normcase_cached\n \n @property\n def _lines(self):\n \n try:\n return self._lines_cached\n except AttributeError:\n trans=_SWAP_SEP_AND_NEWLINE[self._flavour.sep]\n self._lines_cached=str(self).translate(trans)\n return self._lines_cached\n \n def __eq__(self,other):\n if not isinstance(other,PurePath):\n return NotImplemented\n return self._str_normcase ==other._str_normcase and self._flavour is other._flavour\n \n def __hash__(self):\n try:\n return self._hash\n except AttributeError:\n self._hash=hash(self._str_normcase)\n return self._hash\n \n def __lt__(self,other):\n if not isinstance(other,PurePath)or self._flavour is not other._flavour:\n return NotImplemented\n return self._parts_normcase other._parts_normcase\n \n def __ge__(self,other):\n if not isinstance(other,PurePath)or self._flavour is not other._flavour:\n return NotImplemented\n return self._parts_normcase >=other._parts_normcase\n \n @property\n def drive(self):\n ''\n try:\n return self._drv\n except AttributeError:\n self._load_parts()\n return self._drv\n \n @property\n def root(self):\n ''\n try:\n return self._root\n except AttributeError:\n self._load_parts()\n return self._root\n \n @property\n def _tail(self):\n try:\n return self._tail_cached\n except AttributeError:\n self._load_parts()\n return self._tail_cached\n \n @property\n def anchor(self):\n ''\n anchor=self.drive+self.root\n return anchor\n \n @property\n def name(self):\n ''\n tail=self._tail\n if not tail:\n return ''\n return tail[-1]\n \n @property\n def suffix(self):\n ''\n\n\n\n \n name=self.name\n i=name.rfind('.')\n if 0 >> import pdb\n >>> pdb.run('')\n\nThe debugger's prompt is '(Pdb) '. This will stop in the first\nfunction call in .\n\nAlternatively, if a statement terminated with an unhandled exception,\nyou can use pdb's post-mortem facility to inspect the contents of the\ntraceback:\n\n >>> \n \n >>> import pdb\n >>> pdb.pm()\n\nThe commands recognized by the debugger are listed in the next\nsection. Most can be abbreviated as indicated; e.g., h(elp) means\nthat 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',\nnor as 'H' or 'Help' or 'HELP'). Optional arguments are enclosed in\nsquare brackets. Alternatives in the command syntax are separated\nby a vertical bar (|).\n\nA blank line repeats the previous command literally, except for\n'list', where it lists the next 11 lines.\n\nCommands that the debugger doesn't recognize are assumed to be Python\nstatements and are executed in the context of the program being\ndebugged. Python statements can also be prefixed with an exclamation\npoint ('!'). This is a powerful way to inspect the program being\ndebugged; it is even possible to change variables or call functions.\nWhen an exception occurs in such a statement, the exception name is\nprinted but the debugger's state is not changed.\n\nThe debugger supports aliases, which can save typing. And aliases can\nhave parameters (see the alias help entry) which allows one a certain\nlevel of adaptability to the context under examination.\n\nMultiple commands may be entered on a single line, separated by the\npair ';;'. No intelligence is applied to separating the commands; the\ninput is split at the first ';;', even if it is in the middle of a\nquoted string.\n\nIf a file \".pdbrc\" exists in your home directory or in the current\ndirectory, it is read in and executed as if it had been typed at the\ndebugger prompt. This is particularly useful for aliases. If both\nfiles exist, the one in the home directory is read first and aliases\ndefined there can be overridden by the local file. This behavior can be\ndisabled by passing the \"readrc=False\" argument to the Pdb constructor.\n\nAside from aliases, the debugger is not directly programmable; but it\nis implemented as a class from which you can derive your own debugger\nclass, which you can make as fancy as you like.\n\n\nDebugger commands\n=================\n\n\"\"\"\n\n\n\nimport os\nimport io\nimport re\nimport sys\nimport cmd\nimport bdb\nimport dis\nimport code\nimport glob\nimport pprint\nimport signal\nimport inspect\nimport tokenize\nimport functools\nimport traceback\nimport linecache\n\nfrom typing import Union\n\n\nclass Restart(Exception):\n ''\n pass\n \n__all__=[\"run\",\"pm\",\"Pdb\",\"runeval\",\"runctx\",\"runcall\",\"set_trace\",\n\"post_mortem\",\"help\"]\n\ndef find_function(funcname,filename):\n cre=re.compile(r'def\\s+%s\\s*[(]'%re.escape(funcname))\n try:\n fp=tokenize.open(filename)\n except OSError:\n return None\n \n with fp:\n for lineno,line in enumerate(fp,start=1):\n if cre.match(line):\n return funcname,filename,lineno\n return None\n \ndef lasti2lineno(code,lasti):\n linestarts=list(dis.findlinestarts(code))\n linestarts.reverse()\n for i,lineno in linestarts:\n if lasti >=i:\n return lineno\n return 0\n \n \nclass _rstr(str):\n ''\n def __repr__(self):\n return self\n \n \nclass _ScriptTarget(str):\n def __new__(cls,val):\n \n res=super().__new__(cls,os.path.realpath(val))\n \n \n res.orig=val\n \n return res\n \n def check(self):\n if not os.path.exists(self):\n print('Error:',self.orig,'does not exist')\n sys.exit(1)\n \n \n sys.path[0]=os.path.dirname(self)\n \n @property\n def filename(self):\n return self\n \n @property\n def namespace(self):\n return dict(\n __name__='__main__',\n __file__=self,\n __builtins__=__builtins__,\n )\n \n @property\n def code(self):\n with io.open_code(self)as fp:\n return f\"exec(compile({fp.read()!r}, {self !r}, 'exec'))\"\n \n \nclass _ModuleTarget(str):\n def check(self):\n try:\n self._details\n except Exception:\n traceback.print_exc()\n sys.exit(1)\n \n @functools.cached_property\n def _details(self):\n import runpy\n return runpy._get_module_details(self)\n \n @property\n def filename(self):\n return self.code.co_filename\n \n @property\n def code(self):\n name,spec,code=self._details\n return code\n \n @property\n def _spec(self):\n name,spec,code=self._details\n return spec\n \n @property\n def namespace(self):\n return dict(\n __name__='__main__',\n __file__=os.path.normcase(os.path.abspath(self.filename)),\n __package__=self._spec.parent,\n __loader__=self._spec.loader,\n __spec__=self._spec,\n __builtins__=__builtins__,\n )\n \n \n \n \n \n \n \nline_prefix='\\n-> '\n\nclass Pdb(bdb.Bdb,cmd.Cmd):\n\n _previous_sigint_handler=None\n \n def __init__(self,completekey='tab',stdin=None,stdout=None,skip=None,\n nosigint=False,readrc=True):\n bdb.Bdb.__init__(self,skip=skip)\n cmd.Cmd.__init__(self,completekey,stdin,stdout)\n sys.audit(\"pdb.Pdb\")\n if stdout:\n self.use_rawinput=0\n self.prompt='(Pdb) '\n self.aliases={}\n self.displaying={}\n self.mainpyfile=''\n self._wait_for_mainpyfile=False\n self.tb_lineno={}\n \n try:\n import readline\n \n readline.set_completer_delims(' \\t\\n`@#$%^&*()=+[{]}\\\\|;:\\'\",<>?')\n except ImportError:\n pass\n self.allow_kbdint=False\n self.nosigint=nosigint\n \n \n self.rcLines=[]\n if readrc:\n try:\n with open(os.path.expanduser('~/.pdbrc'),encoding='utf-8')as rcFile:\n self.rcLines.extend(rcFile)\n except OSError:\n pass\n try:\n with open(\".pdbrc\",encoding='utf-8')as rcFile:\n self.rcLines.extend(rcFile)\n except OSError:\n pass\n \n self.commands={}\n self.commands_doprompt={}\n \n self.commands_silent={}\n \n self.commands_defining=False\n \n self.commands_bnum=None\n \n \n def sigint_handler(self,signum,frame):\n if self.allow_kbdint:\n raise KeyboardInterrupt\n self.message(\"\\nProgram interrupted. (Use 'cont' to resume).\")\n self.set_step()\n self.set_trace(frame)\n \n def reset(self):\n bdb.Bdb.reset(self)\n self.forget()\n \n def forget(self):\n self.lineno=None\n self.stack=[]\n self.curindex=0\n if hasattr(self,'curframe')and self.curframe:\n self.curframe.f_globals.pop('__pdb_convenience_variables',None)\n self.curframe=None\n self.tb_lineno.clear()\n \n def setup(self,f,tb):\n self.forget()\n self.stack,self.curindex=self.get_stack(f,tb)\n while tb:\n \n \n \n lineno=lasti2lineno(tb.tb_frame.f_code,tb.tb_lasti)\n self.tb_lineno[tb.tb_frame]=lineno\n tb=tb.tb_next\n self.curframe=self.stack[self.curindex][0]\n \n \n \n self.curframe_locals=self.curframe.f_locals\n self.set_convenience_variable(self.curframe,'_frame',self.curframe)\n return self.execRcLines()\n \n \n def execRcLines(self):\n if not self.rcLines:\n return\n \n rcLines=self.rcLines\n rcLines.reverse()\n \n self.rcLines=[]\n while rcLines:\n line=rcLines.pop().strip()\n if line and line[0]!='#':\n if self.onecmd(line):\n \n \n \n self.rcLines +=reversed(rcLines)\n return True\n \n \n \n def user_call(self,frame,argument_list):\n ''\n \n if self._wait_for_mainpyfile:\n return\n if self.stop_here(frame):\n self.message('--Call--')\n self.interaction(frame,None)\n \n def user_line(self,frame):\n ''\n if self._wait_for_mainpyfile:\n if(self.mainpyfile !=self.canonic(frame.f_code.co_filename)\n or frame.f_lineno <=0):\n return\n self._wait_for_mainpyfile=False\n if self.bp_commands(frame):\n self.interaction(frame,None)\n \n def bp_commands(self,frame):\n ''\n\n\n\n \n \n if getattr(self,\"currentbp\",False)and\\\n self.currentbp in self.commands:\n currentbp=self.currentbp\n self.currentbp=0\n lastcmd_back=self.lastcmd\n self.setup(frame,None)\n for line in self.commands[currentbp]:\n self.onecmd(line)\n self.lastcmd=lastcmd_back\n if not self.commands_silent[currentbp]:\n self.print_stack_entry(self.stack[self.curindex])\n if self.commands_doprompt[currentbp]:\n self._cmdloop()\n self.forget()\n return\n return 1\n \n def user_return(self,frame,return_value):\n ''\n if self._wait_for_mainpyfile:\n return\n frame.f_locals['__return__']=return_value\n self.set_convenience_variable(frame,'_retval',return_value)\n self.message('--Return--')\n self.interaction(frame,None)\n \n def user_exception(self,frame,exc_info):\n ''\n \n if self._wait_for_mainpyfile:\n return\n exc_type,exc_value,exc_traceback=exc_info\n frame.f_locals['__exception__']=exc_type,exc_value\n self.set_convenience_variable(frame,'_exception',exc_value)\n \n \n \n \n \n \n prefix='Internal 'if(not exc_traceback\n and exc_type is StopIteration)else ''\n self.message('%s%s'%(prefix,self._format_exc(exc_value)))\n self.interaction(frame,exc_traceback)\n \n \n def _cmdloop(self):\n while True:\n try:\n \n \n self.allow_kbdint=True\n self.cmdloop()\n self.allow_kbdint=False\n break\n except KeyboardInterrupt:\n self.message('--KeyboardInterrupt--')\n \n \n \n def preloop(self):\n displaying=self.displaying.get(self.curframe)\n if displaying:\n for expr,oldvalue in displaying.items():\n newvalue=self._getval_except(expr)\n \n \n \n if newvalue is not oldvalue and newvalue !=oldvalue:\n displaying[expr]=newvalue\n self.message('display %s: %r [old: %r]'%\n (expr,newvalue,oldvalue))\n \n def interaction(self,frame,traceback):\n \n if Pdb._previous_sigint_handler:\n try:\n signal.signal(signal.SIGINT,Pdb._previous_sigint_handler)\n except ValueError:\n pass\n else:\n Pdb._previous_sigint_handler=None\n if self.setup(frame,traceback):\n \n \n self.forget()\n return\n self.print_stack_entry(self.stack[self.curindex])\n self._cmdloop()\n self.forget()\n \n def displayhook(self,obj):\n ''\n\n \n \n if obj is not None:\n self.message(repr(obj))\n \n def default(self,line):\n if line[:1]=='!':line=line[1:].strip()\n locals=self.curframe_locals\n globals=self.curframe.f_globals\n try:\n code=compile(line+'\\n','','single')\n save_stdout=sys.stdout\n save_stdin=sys.stdin\n save_displayhook=sys.displayhook\n try:\n sys.stdin=self.stdin\n sys.stdout=self.stdout\n sys.displayhook=self.displayhook\n exec(code,globals,locals)\n finally:\n sys.stdout=save_stdout\n sys.stdin=save_stdin\n sys.displayhook=save_displayhook\n except:\n self._error_exc()\n \n def precmd(self,line):\n ''\n if not line.strip():\n return line\n args=line.split()\n while args[0]in self.aliases:\n line=self.aliases[args[0]]\n ii=1\n for tmpArg in args[1:]:\n line=line.replace(\"%\"+str(ii),\n tmpArg)\n ii +=1\n line=line.replace(\"%*\",' '.join(args[1:]))\n args=line.split()\n \n \n if args[0]!='alias':\n marker=line.find(';;')\n if marker >=0:\n \n next=line[marker+2:].lstrip()\n self.cmdqueue.append(next)\n line=line[:marker].rstrip()\n \n \n line=re.sub(r'\\$([a-zA-Z_][a-zA-Z0-9_]*)',r'__pdb_convenience_variables[\"\\1\"]',line)\n return line\n \n def onecmd(self,line):\n ''\n\n\n\n\n \n if not self.commands_defining:\n return cmd.Cmd.onecmd(self,line)\n else:\n return self.handle_command_def(line)\n \n def handle_command_def(self,line):\n ''\n cmd,arg,line=self.parseline(line)\n if not cmd:\n return\n if cmd =='silent':\n self.commands_silent[self.commands_bnum]=True\n return\n elif cmd =='end':\n self.cmdqueue=[]\n return 1\n cmdlist=self.commands[self.commands_bnum]\n if arg:\n cmdlist.append(cmd+' '+arg)\n else:\n cmdlist.append(cmd)\n \n try:\n func=getattr(self,'do_'+cmd)\n except AttributeError:\n func=self.default\n \n if func.__name__ in self.commands_resuming:\n self.commands_doprompt[self.commands_bnum]=False\n self.cmdqueue=[]\n return 1\n return\n \n \n \n def message(self,msg):\n print(msg,file=self.stdout)\n \n def error(self,msg):\n print('***',msg,file=self.stdout)\n \n \n \n def set_convenience_variable(self,frame,name,value):\n if '__pdb_convenience_variables'not in frame.f_globals:\n frame.f_globals['__pdb_convenience_variables']={}\n frame.f_globals['__pdb_convenience_variables'][name]=value\n \n \n \n \n def _complete_location(self,text,line,begidx,endidx):\n \n if line.strip().endswith((':',',')):\n \n return[]\n \n try:\n ret=self._complete_expression(text,line,begidx,endidx)\n except Exception:\n ret=[]\n \n globs=glob.glob(glob.escape(text)+'*')\n for fn in globs:\n if os.path.isdir(fn):\n ret.append(fn+'/')\n elif os.path.isfile(fn)and fn.lower().endswith(('.py','.pyw')):\n ret.append(fn+':')\n return ret\n \n def _complete_bpnumber(self,text,line,begidx,endidx):\n \n \n \n return[str(i)for i,bp in enumerate(bdb.Breakpoint.bpbynumber)\n if bp is not None and str(i).startswith(text)]\n \n def _complete_expression(self,text,line,begidx,endidx):\n \n if not self.curframe:\n return[]\n \n \n \n ns={**self.curframe.f_globals,**self.curframe_locals}\n if '.'in text:\n \n \n \n dotted=text.split('.')\n try:\n obj=ns[dotted[0]]\n for part in dotted[1:-1]:\n obj=getattr(obj,part)\n except(KeyError,AttributeError):\n return[]\n prefix='.'.join(dotted[:-1])+'.'\n return[prefix+n for n in dir(obj)if n.startswith(dotted[-1])]\n else:\n \n return[n for n in ns.keys()if n.startswith(text)]\n \n \n \n \n \n def do_commands(self,arg):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not arg:\n bnum=len(bdb.Breakpoint.bpbynumber)-1\n else:\n try:\n bnum=int(arg)\n except:\n self.error(\"Usage: commands [bnum]\\n ...\\n end\")\n return\n try:\n self.get_bpbynumber(bnum)\n except ValueError as err:\n self.error('cannot set commands: %s'%err)\n return\n \n self.commands_bnum=bnum\n \n if bnum in self.commands:\n old_command_defs=(self.commands[bnum],\n self.commands_doprompt[bnum],\n self.commands_silent[bnum])\n else:\n old_command_defs=None\n self.commands[bnum]=[]\n self.commands_doprompt[bnum]=True\n self.commands_silent[bnum]=False\n \n prompt_back=self.prompt\n self.prompt='(com) '\n self.commands_defining=True\n try:\n self.cmdloop()\n except KeyboardInterrupt:\n \n if old_command_defs:\n self.commands[bnum]=old_command_defs[0]\n self.commands_doprompt[bnum]=old_command_defs[1]\n self.commands_silent[bnum]=old_command_defs[2]\n else:\n del self.commands[bnum]\n del self.commands_doprompt[bnum]\n del self.commands_silent[bnum]\n self.error('command definition aborted, old commands restored')\n finally:\n self.commands_defining=False\n self.prompt=prompt_back\n \n complete_commands=_complete_bpnumber\n \n def do_break(self,arg,temporary=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not arg:\n if self.breaks:\n self.message(\"Num Type Disp Enb Where\")\n for bp in bdb.Breakpoint.bpbynumber:\n if bp:\n self.message(bp.bpformat())\n return\n \n \n filename=None\n lineno=None\n cond=None\n comma=arg.find(',')\n if comma >0:\n \n cond=arg[comma+1:].lstrip()\n if err :=self._compile_error_message(cond):\n self.error('Invalid condition %s: %r'%(cond,err))\n return\n arg=arg[:comma].rstrip()\n \n colon=arg.rfind(':')\n funcname=None\n if colon >=0:\n filename=arg[:colon].rstrip()\n f=self.lookupmodule(filename)\n if not f:\n self.error('%r not found from sys.path'%filename)\n return\n else:\n filename=f\n arg=arg[colon+1:].lstrip()\n try:\n lineno=int(arg)\n except ValueError:\n self.error('Bad lineno: %s'%arg)\n return\n else:\n \n try:\n lineno=int(arg)\n except ValueError:\n try:\n func=eval(arg,\n self.curframe.f_globals,\n self.curframe_locals)\n except:\n func=arg\n try:\n if hasattr(func,'__func__'):\n func=func.__func__\n code=func.__code__\n \n \n funcname=code.co_name\n lineno=code.co_firstlineno\n filename=code.co_filename\n except:\n \n (ok,filename,ln)=self.lineinfo(arg)\n if not ok:\n self.error('The specified object %r is not a function '\n 'or was not found along sys.path.'%arg)\n return\n funcname=ok\n lineno=int(ln)\n if not filename:\n filename=self.defaultFile()\n \n line=self.checkline(filename,lineno)\n if line:\n \n err=self.set_break(filename,line,temporary,cond,funcname)\n if err:\n self.error(err)\n else:\n bp=self.get_breaks(filename,line)[-1]\n self.message(\"Breakpoint %d at %s:%d\"%\n (bp.number,bp.file,bp.line))\n \n \n def defaultFile(self):\n ''\n filename=self.curframe.f_code.co_filename\n if filename ==''and self.mainpyfile:\n filename=self.mainpyfile\n return filename\n \n do_b=do_break\n \n complete_break=_complete_location\n complete_b=_complete_location\n \n def do_tbreak(self,arg):\n ''\n\n\n\n \n self.do_break(arg,1)\n \n complete_tbreak=_complete_location\n \n def lineinfo(self,identifier):\n failed=(None,None,None)\n \n idstring=identifier.split(\"'\")\n if len(idstring)==1:\n \n id=idstring[0].strip()\n elif len(idstring)==3:\n \n id=idstring[1].strip()\n else:\n return failed\n if id =='':return failed\n parts=id.split('.')\n \n if parts[0]=='self':\n del parts[0]\n if len(parts)==0:\n return failed\n \n fname=self.defaultFile()\n if len(parts)==1:\n item=parts[0]\n else:\n \n \n f=self.lookupmodule(parts[0])\n if f:\n fname=f\n item=parts[1]\n answer=find_function(item,fname)\n return answer or failed\n \n def checkline(self,filename,lineno):\n ''\n\n\n\n \n \n \n frame=getattr(self,'curframe',None)\n globs=frame.f_globals if frame else None\n line=linecache.getline(filename,lineno,globs)\n if not line:\n self.message('End of file')\n return 0\n line=line.strip()\n \n if(not line or(line[0]=='#')or\n (line[:3]=='\"\"\"')or line[:3]==\"'''\"):\n self.error('Blank or comment')\n return 0\n return lineno\n \n def do_enable(self,arg):\n ''\n\n\n\n \n args=arg.split()\n for i in args:\n try:\n bp=self.get_bpbynumber(i)\n except ValueError as err:\n self.error(err)\n else:\n bp.enable()\n self.message('Enabled %s'%bp)\n \n complete_enable=_complete_bpnumber\n \n def do_disable(self,arg):\n ''\n\n\n\n\n\n\n \n args=arg.split()\n for i in args:\n try:\n bp=self.get_bpbynumber(i)\n except ValueError as err:\n self.error(err)\n else:\n bp.disable()\n self.message('Disabled %s'%bp)\n \n complete_disable=_complete_bpnumber\n \n def do_condition(self,arg):\n ''\n\n\n\n\n\n \n args=arg.split(' ',1)\n try:\n cond=args[1]\n if err :=self._compile_error_message(cond):\n self.error('Invalid condition %s: %r'%(cond,err))\n return\n except IndexError:\n cond=None\n try:\n bp=self.get_bpbynumber(args[0].strip())\n except IndexError:\n self.error('Breakpoint number expected')\n except ValueError as err:\n self.error(err)\n else:\n bp.cond=cond\n if not cond:\n self.message('Breakpoint %d is now unconditional.'%bp.number)\n else:\n self.message('New condition set for breakpoint %d.'%bp.number)\n \n complete_condition=_complete_bpnumber\n \n def do_ignore(self,arg):\n ''\n\n\n\n\n\n\n\n \n args=arg.split()\n try:\n count=int(args[1].strip())\n except:\n count=0\n try:\n bp=self.get_bpbynumber(args[0].strip())\n except IndexError:\n self.error('Breakpoint number expected')\n except ValueError as err:\n self.error(err)\n else:\n bp.ignore=count\n if count >0:\n if count >1:\n countstr='%d crossings'%count\n else:\n countstr='1 crossing'\n self.message('Will ignore next %s of breakpoint %d.'%\n (countstr,bp.number))\n else:\n self.message('Will stop next time breakpoint %d is reached.'\n %bp.number)\n \n complete_ignore=_complete_bpnumber\n \n def do_clear(self,arg):\n ''\n\n\n\n\n\n \n if not arg:\n try:\n reply=input('Clear all breaks? ')\n except EOFError:\n reply='no'\n reply=reply.strip().lower()\n if reply in('y','yes'):\n bplist=[bp for bp in bdb.Breakpoint.bpbynumber if bp]\n self.clear_all_breaks()\n for bp in bplist:\n self.message('Deleted %s'%bp)\n return\n if ':'in arg:\n \n i=arg.rfind(':')\n filename=arg[:i]\n arg=arg[i+1:]\n try:\n lineno=int(arg)\n except ValueError:\n err=\"Invalid line number (%s)\"%arg\n else:\n bplist=self.get_breaks(filename,lineno)[:]\n err=self.clear_break(filename,lineno)\n if err:\n self.error(err)\n else:\n for bp in bplist:\n self.message('Deleted %s'%bp)\n return\n numberlist=arg.split()\n for i in numberlist:\n try:\n bp=self.get_bpbynumber(i)\n except ValueError as err:\n self.error(err)\n else:\n self.clear_bpbynumber(i)\n self.message('Deleted %s'%bp)\n do_cl=do_clear\n \n complete_clear=_complete_location\n complete_cl=_complete_location\n \n def do_where(self,arg):\n ''\n\n\n\n\n \n self.print_stack_trace()\n do_w=do_where\n do_bt=do_where\n \n def _select_frame(self,number):\n assert 0 <=number =2:\n self.error('No help for %r; please do not run Python with -OO '\n 'if you need command help'%arg)\n return\n if command.__doc__ is None:\n self.error('No help for %r; __doc__ string missing'%arg)\n return\n self.message(self._help_message_from_doc(command.__doc__))\n \n do_h=do_help\n \n def help_exec(self):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n self.message((self.help_exec.__doc__ or '').strip())\n \n def help_pdb(self):\n help()\n \n \n \n def lookupmodule(self,filename):\n ''\n\n\n\n \n if os.path.isabs(filename)and os.path.exists(filename):\n return filename\n f=os.path.join(sys.path[0],filename)\n if os.path.exists(f)and self.canonic(f)==self.mainpyfile:\n return f\n root,ext=os.path.splitext(filename)\n if ext =='':\n filename=filename+'.py'\n if os.path.isabs(filename):\n return filename\n for dirname in sys.path:\n while os.path.islink(dirname):\n dirname=os.readlink(dirname)\n fullname=os.path.join(dirname,filename)\n if os.path.exists(fullname):\n return fullname\n return None\n \n def _run(self,target:Union[_ModuleTarget,_ScriptTarget]):\n \n \n \n \n \n self._wait_for_mainpyfile=True\n self._user_requested_quit=False\n \n self.mainpyfile=self.canonic(target.filename)\n \n \n \n \n import __main__\n __main__.__dict__.clear()\n __main__.__dict__.update(target.namespace)\n \n self.run(target.code)\n \n def _format_exc(self,exc:BaseException):\n return traceback.format_exception_only(exc)[-1].strip()\n \n def _compile_error_message(self,expr):\n ''\n try:\n compile(expr,\"\",\"eval\")\n except SyntaxError as exc:\n return _rstr(self._format_exc(exc))\n return \"\"\n \n def _getsourcelines(self,obj):\n \n \n \n \n \n lines,lineno=inspect.getsourcelines(obj)\n lineno=max(1,lineno)\n return lines,lineno\n \n def _help_message_from_doc(self,doc):\n lines=[line.strip()for line in doc.rstrip().splitlines()]\n if not lines:\n return \"No help message found.\"\n if \"\"in lines:\n usage_end=lines.index(\"\")\n else:\n usage_end=1\n formatted=[]\n indent=\" \"*len(self.prompt)\n for i,line in enumerate(lines):\n if i ==0:\n prefix=\"Usage: \"\n elif i 0:\n self.commit_frame(force=True)\n self.current_frame=None\n \n def commit_frame(self,force=False):\n if self.current_frame:\n f=self.current_frame\n if f.tell()>=self._FRAME_SIZE_TARGET or force:\n data=f.getbuffer()\n write=self.file_write\n if len(data)>=self._FRAME_SIZE_MIN:\n \n \n \n \n write(FRAME+pack(\"':\n raise AttributeError(\"Can't get local attribute {!r} on {!r}\"\n .format(name,obj))\n try:\n parent=obj\n obj=getattr(obj,subpath)\n except AttributeError:\n raise AttributeError(\"Can't get attribute {!r} on {!r}\"\n .format(name,obj))from None\n return obj,parent\n \ndef whichmodule(obj,name):\n ''\n module_name=getattr(obj,'__module__',None)\n if module_name is not None:\n return module_name\n \n \n for module_name,module in sys.modules.copy().items():\n if(module_name =='__main__'\n or module_name =='__mp_main__'\n or module is None):\n continue\n try:\n if _getattribute(module,name)[0]is obj:\n return module_name\n except AttributeError:\n pass\n return '__main__'\n \ndef encode_long(x):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if x ==0:\n return b''\n nbytes=(x.bit_length()>>3)+1\n result=x.to_bytes(nbytes,byteorder='little',signed=True)\n if x <0 and nbytes >1:\n if result[-1]==0xff and(result[-2]&0x80)!=0:\n result=result[:-1]\n return result\n \ndef decode_long(data):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return int.from_bytes(data,byteorder='little',signed=True)\n \n \n \n \nclass _Pickler:\n\n def __init__(self,file,protocol=None,*,fix_imports=True,\n buffer_callback=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if protocol is None:\n protocol=DEFAULT_PROTOCOL\n if protocol <0:\n protocol=HIGHEST_PROTOCOL\n elif not 0 <=protocol <=HIGHEST_PROTOCOL:\n raise ValueError(\"pickle protocol must be <= %d\"%HIGHEST_PROTOCOL)\n if buffer_callback is not None and protocol <5:\n raise ValueError(\"buffer_callback needs protocol >= 5\")\n self._buffer_callback=buffer_callback\n try:\n self._file_write=file.write\n except AttributeError:\n raise TypeError(\"file must have a 'write' attribute\")\n self.framer=_Framer(self._file_write)\n self.write=self.framer.write\n self._write_large_bytes=self.framer.write_large_bytes\n self.memo={}\n self.proto=int(protocol)\n self.bin=protocol >=1\n self.fast=0\n self.fix_imports=fix_imports and protocol <3\n \n def clear_memo(self):\n ''\n\n\n\n\n\n \n self.memo.clear()\n \n def dump(self,obj):\n ''\n \n \n if not hasattr(self,\"_file_write\"):\n raise PicklingError(\"Pickler.__init__() was not called by \"\n \"%s.__init__()\"%(self.__class__.__name__,))\n if self.proto >=2:\n self.write(PROTO+pack(\"=4:\n self.framer.start_framing()\n self.save(obj)\n self.write(STOP)\n self.framer.end_framing()\n \n def memoize(self,obj):\n ''\n \n \n \n \n \n \n \n \n \n \n \n \n \n if self.fast:\n return\n assert id(obj)not in self.memo\n idx=len(self.memo)\n self.write(self.put(idx))\n self.memo[id(obj)]=idx,obj\n \n \n def put(self,idx):\n if self.proto >=4:\n return MEMOIZE\n elif self.bin:\n if idx <256:\n return BINPUT+pack(\"=2 and func_name ==\"__newobj_ex__\":\n cls,args,kwargs=args\n if not hasattr(cls,\"__new__\"):\n raise PicklingError(\"args[0] from {} args has no __new__\"\n .format(func_name))\n if obj is not None and cls is not obj.__class__:\n raise PicklingError(\"args[0] from {} args has the wrong class\"\n .format(func_name))\n if self.proto >=4:\n save(cls)\n save(args)\n save(kwargs)\n write(NEWOBJ_EX)\n else:\n func=partial(cls.__new__,cls,*args,**kwargs)\n save(func)\n save(())\n write(REDUCE)\n elif self.proto >=2 and func_name ==\"__newobj__\":\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n cls=args[0]\n if not hasattr(cls,\"__new__\"):\n raise PicklingError(\n \"args[0] from __newobj__ args has no __new__\")\n if obj is not None and cls is not obj.__class__:\n raise PicklingError(\n \"args[0] from __newobj__ args has the wrong class\")\n args=args[1:]\n save(cls)\n save(args)\n write(NEWOBJ)\n else:\n save(func)\n save(args)\n write(REDUCE)\n \n if obj is not None:\n \n \n \n if id(obj)in self.memo:\n write(POP+self.get(self.memo[id(obj)][0]))\n else:\n self.memoize(obj)\n \n \n \n \n \n \n if listitems is not None:\n self._batch_appends(listitems)\n \n if dictitems is not None:\n self._batch_setitems(dictitems)\n \n if state is not None:\n if state_setter is None:\n save(state)\n write(BUILD)\n else:\n \n \n \n \n save(state_setter)\n save(obj)\n save(state)\n write(TUPLE2)\n \n write(REDUCE)\n \n \n \n \n write(POP)\n \n \n \n dispatch={}\n \n def save_none(self,obj):\n self.write(NONE)\n dispatch[type(None)]=save_none\n \n def save_bool(self,obj):\n if self.proto >=2:\n self.write(NEWTRUE if obj else NEWFALSE)\n else:\n self.write(TRUE if obj else FALSE)\n dispatch[bool]=save_bool\n \n def save_long(self,obj):\n if self.bin:\n \n \n \n \n if obj >=0:\n if obj <=0xff:\n self.write(BININT1+pack(\"=2:\n encoded=encode_long(obj)\n n=len(encoded)\n if n <256:\n self.write(LONG1+pack(\"d',obj))\n else:\n self.write(FLOAT+repr(obj).encode(\"ascii\")+b'\\n')\n dispatch[float]=save_float\n \n def save_bytes(self,obj):\n if self.proto <3:\n if not obj:\n self.save_reduce(bytes,(),obj=obj)\n else:\n self.save_reduce(codecs.encode,\n (str(obj,'latin1'),'latin1'),obj=obj)\n return\n n=len(obj)\n if n <=0xff:\n self.write(SHORT_BINBYTES+pack(\"0xffffffff and self.proto >=4:\n self._write_large_bytes(BINBYTES8+pack(\"=self.framer._FRAME_SIZE_TARGET:\n self._write_large_bytes(BINBYTES+pack(\"=self.framer._FRAME_SIZE_TARGET:\n self._write_large_bytes(BYTEARRAY8+pack(\"= 5\")\n with obj.raw()as m:\n if not m.contiguous:\n raise PicklingError(\"PickleBuffer can not be pickled when \"\n \"pointing to a non-contiguous buffer\")\n in_band=True\n if self._buffer_callback is not None:\n in_band=bool(self._buffer_callback(obj))\n if in_band:\n \n \n if m.readonly:\n self.save_bytes(m.tobytes())\n else:\n self.save_bytearray(m.tobytes())\n else:\n \n self.write(NEXT_BUFFER)\n if m.readonly:\n self.write(READONLY_BUFFER)\n \n dispatch[PickleBuffer]=save_picklebuffer\n \n def save_str(self,obj):\n if self.bin:\n encoded=obj.encode('utf-8','surrogatepass')\n n=len(encoded)\n if n <=0xff and self.proto >=4:\n self.write(SHORT_BINUNICODE+pack(\"0xffffffff and self.proto >=4:\n self._write_large_bytes(BINUNICODE8+pack(\"=self.framer._FRAME_SIZE_TARGET:\n self._write_large_bytes(BINUNICODE+pack(\"=2:\n for element in obj:\n save(element)\n \n if id(obj)in memo:\n get=self.get(memo[id(obj)][0])\n self.write(POP *n+get)\n else:\n self.write(_tuplesize2code[n])\n self.memoize(obj)\n return\n \n \n \n write=self.write\n write(MARK)\n for element in obj:\n save(element)\n \n if id(obj)in memo:\n \n \n \n \n \n \n \n get=self.get(memo[id(obj)][0])\n if self.bin:\n write(POP_MARK+get)\n else:\n write(POP *(n+1)+get)\n return\n \n \n write(TUPLE)\n self.memoize(obj)\n \n dispatch[tuple]=save_tuple\n \n def save_list(self,obj):\n if self.bin:\n self.write(EMPTY_LIST)\n else:\n self.write(MARK+LIST)\n \n self.memoize(obj)\n self._batch_appends(obj)\n \n dispatch[list]=save_list\n \n _BATCHSIZE=1000\n \n def _batch_appends(self,items):\n \n save=self.save\n write=self.write\n \n if not self.bin:\n for x in items:\n save(x)\n write(APPEND)\n return\n \n it=iter(items)\n while True:\n tmp=list(islice(it,self._BATCHSIZE))\n n=len(tmp)\n if n >1:\n write(MARK)\n for x in tmp:\n save(x)\n write(APPENDS)\n elif n:\n save(tmp[0])\n write(APPEND)\n \n if n 1:\n write(MARK)\n for k,v in tmp:\n save(k)\n save(v)\n write(SETITEMS)\n elif n:\n k,v=tmp[0]\n save(k)\n save(v)\n write(SETITEM)\n \n if n 0:\n write(MARK)\n for item in batch:\n save(item)\n write(ADDITEMS)\n if n =2:\n code=_extension_registry.get((module_name,name))\n if code:\n assert code >0\n if code <=0xff:\n write(EXT1+pack(\"=4:\n self.save(module_name)\n self.save(name)\n write(STACK_GLOBAL)\n elif parent is not module:\n self.save_reduce(getattr,(parent,lastname))\n elif self.proto >=3:\n write(GLOBAL+bytes(module_name,\"utf-8\")+b'\\n'+\n bytes(name,\"utf-8\")+b'\\n')\n else:\n if self.fix_imports:\n r_name_mapping=_compat_pickle.REVERSE_NAME_MAPPING\n r_import_mapping=_compat_pickle.REVERSE_IMPORT_MAPPING\n if(module_name,name)in r_name_mapping:\n module_name,name=r_name_mapping[(module_name,name)]\n elif module_name in r_import_mapping:\n module_name=r_import_mapping[module_name]\n try:\n write(GLOBAL+bytes(module_name,\"ascii\")+b'\\n'+\n bytes(name,\"ascii\")+b'\\n')\n except UnicodeEncodeError:\n raise PicklingError(\n \"can't pickle global identifier '%s.%s' using \"\n \"pickle protocol %i\"%(module,name,self.proto))from None\n \n self.memoize(obj)\n \n def save_type(self,obj):\n if obj is type(None):\n return self.save_reduce(type,(None,),obj=obj)\n elif obj is type(NotImplemented):\n return self.save_reduce(type,(NotImplemented,),obj=obj)\n elif obj is type(...):\n return self.save_reduce(type,(...,),obj=obj)\n return self.save_global(obj)\n \n dispatch[FunctionType]=save_global\n dispatch[type]=save_type\n \n \n \n \nclass _Unpickler:\n\n def __init__(self,file,*,fix_imports=True,\n encoding=\"ASCII\",errors=\"strict\",buffers=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self._buffers=iter(buffers)if buffers is not None else None\n self._file_readline=file.readline\n self._file_read=file.read\n self.memo={}\n self.encoding=encoding\n self.errors=errors\n self.proto=0\n self.fix_imports=fix_imports\n \n def load(self):\n ''\n\n\n \n \n \n if not hasattr(self,\"_file_read\"):\n raise UnpicklingError(\"Unpickler.__init__() was not called by \"\n \"%s.__init__()\"%(self.__class__.__name__,))\n self._unframer=_Unframer(self._file_read,self._file_readline)\n self.read=self._unframer.read\n self.readinto=self._unframer.readinto\n self.readline=self._unframer.readline\n self.metastack=[]\n self.stack=[]\n self.append=self.stack.append\n self.proto=0\n read=self.read\n dispatch=self.dispatch\n try:\n while True:\n key=read(1)\n if not key:\n raise EOFError\n assert isinstance(key,bytes_types)\n dispatch[key[0]](self)\n except _Stop as stopinst:\n return stopinst.value\n \n \n def pop_mark(self):\n items=self.stack\n self.stack=self.metastack.pop()\n self.append=self.stack.append\n return items\n \n def persistent_load(self,pid):\n raise UnpicklingError(\"unsupported persistent id encountered\")\n \n dispatch={}\n \n def load_proto(self):\n proto=self.read(1)[0]\n if not 0 <=proto <=HIGHEST_PROTOCOL:\n raise ValueError(\"unsupported pickle protocol: %d\"%proto)\n self.proto=proto\n dispatch[PROTO[0]]=load_proto\n \n def load_frame(self):\n frame_size,=unpack('sys.maxsize:\n raise ValueError(\"frame size > sys.maxsize: %d\"%frame_size)\n self._unframer.load_frame(frame_size)\n dispatch[FRAME[0]]=load_frame\n \n def load_persid(self):\n try:\n pid=self.readline()[:-1].decode(\"ascii\")\n except UnicodeDecodeError:\n raise UnpicklingError(\n \"persistent IDs in protocol 0 must be ASCII strings\")\n self.append(self.persistent_load(pid))\n dispatch[PERSID[0]]=load_persid\n \n def load_binpersid(self):\n pid=self.stack.pop()\n self.append(self.persistent_load(pid))\n dispatch[BINPERSID[0]]=load_binpersid\n \n def load_none(self):\n self.append(None)\n dispatch[NONE[0]]=load_none\n \n def load_false(self):\n self.append(False)\n dispatch[NEWFALSE[0]]=load_false\n \n def load_true(self):\n self.append(True)\n dispatch[NEWTRUE[0]]=load_true\n \n def load_int(self):\n data=self.readline()\n if data ==FALSE[1:]:\n val=False\n elif data ==TRUE[1:]:\n val=True\n else:\n val=int(data,0)\n self.append(val)\n dispatch[INT[0]]=load_int\n \n def load_binint(self):\n self.append(unpack('d',self.read(8))[0])\n dispatch[BINFLOAT[0]]=load_binfloat\n \n def _decode_string(self,value):\n \n \n \n if self.encoding ==\"bytes\":\n return value\n else:\n return value.decode(self.encoding,self.errors)\n \n def load_string(self):\n data=self.readline()[:-1]\n \n if len(data)>=2 and data[0]==data[-1]and data[0]in b'\"\\'':\n data=data[1:-1]\n else:\n raise UnpicklingError(\"the STRING opcode argument must be quoted\")\n self.append(self._decode_string(codecs.escape_decode(data)[0]))\n dispatch[STRING[0]]=load_string\n \n def load_binstring(self):\n \n len,=unpack('maxsize:\n raise UnpicklingError(\"BINBYTES exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n self.append(self.read(len))\n dispatch[BINBYTES[0]]=load_binbytes\n \n def load_unicode(self):\n self.append(str(self.readline()[:-1],'raw-unicode-escape'))\n dispatch[UNICODE[0]]=load_unicode\n \n def load_binunicode(self):\n len,=unpack('maxsize:\n raise UnpicklingError(\"BINUNICODE exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n self.append(str(self.read(len),'utf-8','surrogatepass'))\n dispatch[BINUNICODE[0]]=load_binunicode\n \n def load_binunicode8(self):\n len,=unpack('maxsize:\n raise UnpicklingError(\"BINUNICODE8 exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n self.append(str(self.read(len),'utf-8','surrogatepass'))\n dispatch[BINUNICODE8[0]]=load_binunicode8\n \n def load_binbytes8(self):\n len,=unpack('maxsize:\n raise UnpicklingError(\"BINBYTES8 exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n self.append(self.read(len))\n dispatch[BINBYTES8[0]]=load_binbytes8\n \n def load_bytearray8(self):\n len,=unpack('maxsize:\n raise UnpicklingError(\"BYTEARRAY8 exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n b=bytearray(len)\n self.readinto(b)\n self.append(b)\n dispatch[BYTEARRAY8[0]]=load_bytearray8\n \n def load_next_buffer(self):\n if self._buffers is None:\n raise UnpicklingError(\"pickle stream refers to out-of-band data \"\n \"but no *buffers* argument was given\")\n try:\n buf=next(self._buffers)\n except StopIteration:\n raise UnpicklingError(\"not enough out-of-band buffers\")\n self.append(buf)\n dispatch[NEXT_BUFFER[0]]=load_next_buffer\n \n def load_readonly_buffer(self):\n buf=self.stack[-1]\n with memoryview(buf)as m:\n if not m.readonly:\n self.stack[-1]=m.toreadonly()\n dispatch[READONLY_BUFFER[0]]=load_readonly_buffer\n \n def load_short_binstring(self):\n len=self.read(1)[0]\n data=self.read(len)\n self.append(self._decode_string(data))\n dispatch[SHORT_BINSTRING[0]]=load_short_binstring\n \n def load_short_binbytes(self):\n len=self.read(1)[0]\n self.append(self.read(len))\n dispatch[SHORT_BINBYTES[0]]=load_short_binbytes\n \n def load_short_binunicode(self):\n len=self.read(1)[0]\n self.append(str(self.read(len),'utf-8','surrogatepass'))\n dispatch[SHORT_BINUNICODE[0]]=load_short_binunicode\n \n def load_tuple(self):\n items=self.pop_mark()\n self.append(tuple(items))\n dispatch[TUPLE[0]]=load_tuple\n \n def load_empty_tuple(self):\n self.append(())\n dispatch[EMPTY_TUPLE[0]]=load_empty_tuple\n \n def load_tuple1(self):\n self.stack[-1]=(self.stack[-1],)\n dispatch[TUPLE1[0]]=load_tuple1\n \n def load_tuple2(self):\n self.stack[-2:]=[(self.stack[-2],self.stack[-1])]\n dispatch[TUPLE2[0]]=load_tuple2\n \n def load_tuple3(self):\n self.stack[-3:]=[(self.stack[-3],self.stack[-2],self.stack[-1])]\n dispatch[TUPLE3[0]]=load_tuple3\n \n def load_empty_list(self):\n self.append([])\n dispatch[EMPTY_LIST[0]]=load_empty_list\n \n def load_empty_dictionary(self):\n self.append({})\n dispatch[EMPTY_DICT[0]]=load_empty_dictionary\n \n def load_empty_set(self):\n self.append(set())\n dispatch[EMPTY_SET[0]]=load_empty_set\n \n def load_frozenset(self):\n items=self.pop_mark()\n self.append(frozenset(items))\n dispatch[FROZENSET[0]]=load_frozenset\n \n def load_list(self):\n items=self.pop_mark()\n self.append(items)\n dispatch[LIST[0]]=load_list\n \n def load_dict(self):\n items=self.pop_mark()\n d={items[i]:items[i+1]\n for i in range(0,len(items),2)}\n self.append(d)\n dispatch[DICT[0]]=load_dict\n \n \n \n \n \n \n def _instantiate(self,klass,args):\n if(args or not isinstance(klass,type)or\n hasattr(klass,\"__getinitargs__\")):\n try:\n value=klass(*args)\n except TypeError as err:\n raise TypeError(\"in constructor for %s: %s\"%\n (klass.__name__,str(err)),err.__traceback__)\n else:\n value=klass.__new__(klass)\n self.append(value)\n \n def load_inst(self):\n module=self.readline()[:-1].decode(\"ascii\")\n name=self.readline()[:-1].decode(\"ascii\")\n klass=self.find_class(module,name)\n self._instantiate(klass,self.pop_mark())\n dispatch[INST[0]]=load_inst\n \n def load_obj(self):\n \n args=self.pop_mark()\n cls=args.pop(0)\n self._instantiate(cls,args)\n dispatch[OBJ[0]]=load_obj\n \n def load_newobj(self):\n args=self.stack.pop()\n cls=self.stack.pop()\n obj=cls.__new__(cls,*args)\n self.append(obj)\n dispatch[NEWOBJ[0]]=load_newobj\n \n def load_newobj_ex(self):\n kwargs=self.stack.pop()\n args=self.stack.pop()\n cls=self.stack.pop()\n obj=cls.__new__(cls,*args,**kwargs)\n self.append(obj)\n dispatch[NEWOBJ_EX[0]]=load_newobj_ex\n \n def load_global(self):\n module=self.readline()[:-1].decode(\"utf-8\")\n name=self.readline()[:-1].decode(\"utf-8\")\n klass=self.find_class(module,name)\n self.append(klass)\n dispatch[GLOBAL[0]]=load_global\n \n def load_stack_global(self):\n name=self.stack.pop()\n module=self.stack.pop()\n if type(name)is not str or type(module)is not str:\n raise UnpicklingError(\"STACK_GLOBAL requires str\")\n self.append(self.find_class(module,name))\n dispatch[STACK_GLOBAL[0]]=load_stack_global\n \n def load_ext1(self):\n code=self.read(1)[0]\n self.get_extension(code)\n dispatch[EXT1[0]]=load_ext1\n \n def load_ext2(self):\n code,=unpack('=4:\n return _getattribute(sys.modules[module],name)[0]\n else:\n return getattr(sys.modules[module],name)\n \n def load_reduce(self):\n stack=self.stack\n args=stack.pop()\n func=stack[-1]\n stack[-1]=func(*args)\n dispatch[REDUCE[0]]=load_reduce\n \n def load_pop(self):\n if self.stack:\n del self.stack[-1]\n else:\n self.pop_mark()\n dispatch[POP[0]]=load_pop\n \n def load_pop_mark(self):\n self.pop_mark()\n dispatch[POP_MARK[0]]=load_pop_mark\n \n def load_dup(self):\n self.append(self.stack[-1])\n dispatch[DUP[0]]=load_dup\n \n def load_get(self):\n i=int(self.readline()[:-1])\n try:\n self.append(self.memo[i])\n except KeyError:\n msg=f'Memo value not found at index {i}'\n raise UnpicklingError(msg)from None\n dispatch[GET[0]]=load_get\n \n def load_binget(self):\n i=self.read(1)[0]\n try:\n self.append(self.memo[i])\n except KeyError as exc:\n msg=f'Memo value not found at index {i}'\n raise UnpicklingError(msg)from None\n dispatch[BINGET[0]]=load_binget\n \n def load_long_binget(self):\n i,=unpack('maxsize:\n raise ValueError(\"negative LONG_BINPUT argument\")\n self.memo[i]=self.stack[-1]\n dispatch[LONG_BINPUT[0]]=load_long_binput\n \n def load_memoize(self):\n memo=self.memo\n memo[len(memo)]=self.stack[-1]\n dispatch[MEMOIZE[0]]=load_memoize\n \n def load_append(self):\n stack=self.stack\n value=stack.pop()\n list=stack[-1]\n list.append(value)\n dispatch[APPEND[0]]=load_append\n \n def load_appends(self):\n items=self.pop_mark()\n list_obj=self.stack[-1]\n try:\n extend=list_obj.extend\n except AttributeError:\n pass\n else:\n extend(items)\n return\n \n \n \n append=list_obj.append\n for item in items:\n append(item)\n dispatch[APPENDS[0]]=load_appends\n \n def load_setitem(self):\n stack=self.stack\n value=stack.pop()\n key=stack.pop()\n dict=stack[-1]\n dict[key]=value\n dispatch[SETITEM[0]]=load_setitem\n \n def load_setitems(self):\n items=self.pop_mark()\n dict=self.stack[-1]\n for i in range(0,len(items),2):\n dict[items[i]]=items[i+1]\n dispatch[SETITEMS[0]]=load_setitems\n \n def load_additems(self):\n items=self.pop_mark()\n set_obj=self.stack[-1]\n if isinstance(set_obj,set):\n set_obj.update(items)\n else:\n add=set_obj.add\n for item in items:\n add(item)\n dispatch[ADDITEMS[0]]=load_additems\n \n def load_build(self):\n stack=self.stack\n state=stack.pop()\n inst=stack[-1]\n setstate=getattr(inst,\"__setstate__\",None)\n if setstate is not None:\n setstate(state)\n return\n slotstate=None\n if isinstance(state,tuple)and len(state)==2:\n state,slotstate=state\n if state:\n inst_dict=inst.__dict__\n intern=sys.intern\n for k,v in state.items():\n if type(k)is str:\n inst_dict[intern(k)]=v\n else:\n inst_dict[k]=v\n if slotstate:\n for k,v in slotstate.items():\n setattr(inst,k,v)\n dispatch[BUILD[0]]=load_build\n \n def load_mark(self):\n self.metastack.append(self.stack)\n self.stack=[]\n self.append=self.stack.append\n dispatch[MARK[0]]=load_mark\n \n def load_stop(self):\n value=self.stack.pop()\n raise _Stop(value)\n dispatch[STOP[0]]=load_stop\n \n \n \n \ndef _dump(obj,file,protocol=None,*,fix_imports=True,buffer_callback=None):\n _Pickler(file,protocol,fix_imports=fix_imports,\n buffer_callback=buffer_callback).dump(obj)\n \ndef _dumps(obj,protocol=None,*,fix_imports=True,buffer_callback=None):\n f=io.BytesIO()\n _Pickler(f,protocol,fix_imports=fix_imports,\n buffer_callback=buffer_callback).dump(obj)\n res=f.getvalue()\n assert isinstance(res,bytes_types)\n return res\n \ndef _load(file,*,fix_imports=True,encoding=\"ASCII\",errors=\"strict\",\nbuffers=None):\n return _Unpickler(file,fix_imports=fix_imports,buffers=buffers,\n encoding=encoding,errors=errors).load()\n \ndef _loads(s,/,*,fix_imports=True,encoding=\"ASCII\",errors=\"strict\",\nbuffers=None):\n if isinstance(s,str):\n raise TypeError(\"Can't load pickle from unicode string\")\n file=io.BytesIO(s)\n return _Unpickler(file,fix_imports=fix_imports,buffers=buffers,\n encoding=encoding,errors=errors).load()\n \n \ntry:\n from _pickle import(\n PickleError,\n PicklingError,\n UnpicklingError,\n Pickler,\n Unpickler,\n dump,\n dumps,\n load,\n loads\n )\nexcept ImportError:\n Pickler,Unpickler=_Pickler,_Unpickler\n dump,dumps,load,loads=_dump,_dumps,_load,_loads\n \n \ndef _test():\n import doctest\n return doctest.testmod()\n \nif __name__ ==\"__main__\":\n import argparse\n parser=argparse.ArgumentParser(\n description='display contents of the pickle files')\n parser.add_argument(\n 'pickle_file',type=argparse.FileType('br'),\n nargs='*',help='the pickle file')\n parser.add_argument(\n '-t','--test',action='store_true',\n help='run self-test suite')\n parser.add_argument(\n '-v',action='store_true',\n help='run verbosely; only affects self-test run')\n args=parser.parse_args()\n if args.test:\n _test()\n else:\n if not args.pickle_file:\n parser.print_help()\n else:\n import pprint\n for f in args.pickle_file:\n obj=load(f)\n pprint.pprint(obj)\n", ["_compat_pickle", "_pickle", "argparse", "codecs", "copyreg", "doctest", "functools", "io", "itertools", "pprint", "re", "struct", "sys", "types"]], "pkgutil": [".py", "''\n\nfrom collections import namedtuple\nfrom functools import singledispatch as simplegeneric\nimport importlib\nimport importlib.util\nimport importlib.machinery\nimport os\nimport os.path\nimport sys\nfrom types import ModuleType\nimport warnings\n\n__all__=[\n'get_importer','iter_importers','get_loader','find_loader',\n'walk_packages','iter_modules','get_data',\n'read_code','extend_path',\n'ModuleInfo',\n]\n\n\nModuleInfo=namedtuple('ModuleInfo','module_finder name ispkg')\nModuleInfo.__doc__='A namedtuple with minimal info about a module.'\n\n\ndef read_code(stream):\n\n\n import marshal\n \n magic=stream.read(4)\n if magic !=importlib.util.MAGIC_NUMBER:\n return None\n \n stream.read(12)\n return marshal.load(stream)\n \n \ndef walk_packages(path=None,prefix='',onerror=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def seen(p,m={}):\n if p in m:\n return True\n m[p]=True\n \n for info in iter_modules(path,prefix):\n yield info\n \n if info.ispkg:\n try:\n __import__(info.name)\n except ImportError:\n if onerror is not None:\n onerror(info.name)\n except Exception:\n if onerror is not None:\n onerror(info.name)\n else:\n raise\n else:\n path=getattr(sys.modules[info.name],'__path__',None)or[]\n \n \n path=[p for p in path if not seen(p)]\n \n yield from walk_packages(path,info.name+'.',onerror)\n \n \ndef iter_modules(path=None,prefix=''):\n ''\n\n\n\n\n\n\n\n \n if path is None:\n importers=iter_importers()\n elif isinstance(path,str):\n raise ValueError(\"path must be None or list of paths to look for \"\n \"modules in\")\n else:\n importers=map(get_importer,path)\n \n yielded={}\n for i in importers:\n for name,ispkg in iter_importer_modules(i,prefix):\n if name not in yielded:\n yielded[name]=1\n yield ModuleInfo(i,name,ispkg)\n \n \n@simplegeneric\ndef iter_importer_modules(importer,prefix=''):\n if not hasattr(importer,'iter_modules'):\n return[]\n return importer.iter_modules(prefix)\n \n \n \ndef _iter_file_finder_modules(importer,prefix=''):\n if importer.path is None or not os.path.isdir(importer.path):\n return\n \n yielded={}\n import inspect\n try:\n filenames=os.listdir(importer.path)\n except OSError:\n \n filenames=[]\n filenames.sort()\n \n for fn in filenames:\n modname=inspect.getmodulename(fn)\n if modname =='__init__'or modname in yielded:\n continue\n \n path=os.path.join(importer.path,fn)\n ispkg=False\n \n if not modname and os.path.isdir(path)and '.'not in fn:\n modname=fn\n try:\n dircontents=os.listdir(path)\n except OSError:\n \n dircontents=[]\n for fn in dircontents:\n subname=inspect.getmodulename(fn)\n if subname =='__init__':\n ispkg=True\n break\n else:\n continue\n \n if modname and '.'not in modname:\n yielded[modname]=1\n yield prefix+modname,ispkg\n \niter_importer_modules.register(\nimportlib.machinery.FileFinder,_iter_file_finder_modules)\n\n\ntry:\n import zipimport\n from zipimport import zipimporter\n \n def iter_zipimport_modules(importer,prefix=''):\n dirlist=sorted(zipimport._zip_directory_cache[importer.archive])\n _prefix=importer.prefix\n plen=len(_prefix)\n yielded={}\n import inspect\n for fn in dirlist:\n if not fn.startswith(_prefix):\n continue\n \n fn=fn[plen:].split(os.sep)\n \n if len(fn)==2 and fn[1].startswith('__init__.py'):\n if fn[0]not in yielded:\n yielded[fn[0]]=1\n yield prefix+fn[0],True\n \n if len(fn)!=1:\n continue\n \n modname=inspect.getmodulename(fn[0])\n if modname =='__init__':\n continue\n \n if modname and '.'not in modname and modname not in yielded:\n yielded[modname]=1\n yield prefix+modname,False\n \n iter_importer_modules.register(zipimporter,iter_zipimport_modules)\n \nexcept ImportError:\n pass\n \n \ndef get_importer(path_item):\n ''\n\n\n\n\n\n\n \n path_item=os.fsdecode(path_item)\n try:\n importer=sys.path_importer_cache[path_item]\n except KeyError:\n for path_hook in sys.path_hooks:\n try:\n importer=path_hook(path_item)\n sys.path_importer_cache.setdefault(path_item,importer)\n break\n except ImportError:\n pass\n else:\n importer=None\n return importer\n \n \ndef iter_importers(fullname=\"\"):\n ''\n\n\n\n\n\n\n\n\n\n \n if fullname.startswith('.'):\n msg=\"Relative module name {!r} not supported\".format(fullname)\n raise ImportError(msg)\n if '.'in fullname:\n \n pkg_name=fullname.rpartition(\".\")[0]\n pkg=importlib.import_module(pkg_name)\n path=getattr(pkg,'__path__',None)\n if path is None:\n return\n else:\n yield from sys.meta_path\n path=sys.path\n for item in path:\n yield get_importer(item)\n \n \ndef get_loader(module_or_name):\n ''\n\n\n\n\n \n warnings._deprecated(\"pkgutil.get_loader\",\n f\"{warnings._DEPRECATED_MSG}; \"\n \"use importlib.util.find_spec() instead\",\n remove=(3,14))\n if module_or_name in sys.modules:\n module_or_name=sys.modules[module_or_name]\n if module_or_name is None:\n return None\n if isinstance(module_or_name,ModuleType):\n module=module_or_name\n loader=getattr(module,'__loader__',None)\n if loader is not None:\n return loader\n if getattr(module,'__spec__',None)is None:\n return None\n fullname=module.__name__\n else:\n fullname=module_or_name\n return find_loader(fullname)\n \n \ndef find_loader(fullname):\n ''\n\n\n\n\n \n warnings._deprecated(\"pkgutil.find_loader\",\n f\"{warnings._DEPRECATED_MSG}; \"\n \"use importlib.util.find_spec() instead\",\n remove=(3,14))\n if fullname.startswith('.'):\n msg=\"Relative module name {!r} not supported\".format(fullname)\n raise ImportError(msg)\n try:\n spec=importlib.util.find_spec(fullname)\n except(ImportError,AttributeError,TypeError,ValueError)as ex:\n \n \n \n msg=\"Error while finding loader for {!r} ({}: {})\"\n raise ImportError(msg.format(fullname,type(ex),ex))from ex\n return spec.loader if spec is not None else None\n \n \ndef extend_path(path,name):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if not isinstance(path,list):\n \n \n return path\n \n sname_pkg=name+\".pkg\"\n \n path=path[:]\n \n parent_package,_,final_name=name.rpartition('.')\n if parent_package:\n try:\n search_path=sys.modules[parent_package].__path__\n except(KeyError,AttributeError):\n \n \n return path\n else:\n search_path=sys.path\n \n for dir in search_path:\n if not isinstance(dir,str):\n continue\n \n finder=get_importer(dir)\n if finder is not None:\n portions=[]\n if hasattr(finder,'find_spec'):\n spec=finder.find_spec(final_name)\n if spec is not None:\n portions=spec.submodule_search_locations or[]\n \n elif hasattr(finder,'find_loader'):\n _,portions=finder.find_loader(final_name)\n \n for portion in portions:\n \n \n if portion not in path:\n path.append(portion)\n \n \n \n pkgfile=os.path.join(dir,sname_pkg)\n if os.path.isfile(pkgfile):\n try:\n f=open(pkgfile)\n except OSError as msg:\n sys.stderr.write(\"Can't open %s: %s\\n\"%\n (pkgfile,msg))\n else:\n with f:\n for line in f:\n line=line.rstrip('\\n')\n if not line or line.startswith('#'):\n continue\n path.append(line)\n \n return path\n \n \ndef get_data(package,resource):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n spec=importlib.util.find_spec(package)\n if spec is None:\n return None\n loader=spec.loader\n if loader is None or not hasattr(loader,'get_data'):\n return None\n \n mod=(sys.modules.get(package)or\n importlib._bootstrap._load(spec))\n if mod is None or not hasattr(mod,'__file__'):\n return None\n \n \n \n \n parts=resource.split('/')\n parts.insert(0,os.path.dirname(mod.__file__))\n resource_name=os.path.join(*parts)\n return loader.get_data(resource_name)\n \n \n_NAME_PATTERN=None\n\ndef resolve_name(name):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global _NAME_PATTERN\n if _NAME_PATTERN is None:\n \n import re\n dotted_words=r'(?!\\d)(\\w+)(\\.(?!\\d)(\\w+))*'\n _NAME_PATTERN=re.compile(f'^(?P{dotted_words})'\n f'(?P:(?P{dotted_words})?)?$',\n re.UNICODE)\n \n m=_NAME_PATTERN.match(name)\n if not m:\n raise ValueError(f'invalid format: {name !r}')\n gd=m.groupdict()\n if gd.get('cln'):\n \n mod=importlib.import_module(gd['pkg'])\n parts=gd.get('obj')\n parts=parts.split('.')if parts else[]\n else:\n \n parts=name.split('.')\n modname=parts.pop(0)\n \n mod=importlib.import_module(modname)\n while parts:\n p=parts[0]\n s=f'{modname}.{p}'\n try:\n mod=importlib.import_module(s)\n parts.pop(0)\n modname=s\n except ImportError:\n break\n \n \n \n result=mod\n for p in parts:\n result=getattr(result,p)\n return result\n", ["collections", "functools", "importlib", "importlib.machinery", "importlib.util", "inspect", "marshal", "os", "os.path", "re", "sys", "types", "warnings", "zipimport"]], "platform": [".py", "''\n\n\n\nfrom browser import self as window\n\ndef architecture(*args,**kw):\n return \"\",window.navigator.platform\n \ndef machine(*args,**kw):\n return ''\n \ndef node(*args,**kw):\n return ''\n \ndef platform(*args,**kw):\n return window.navigator.platform\n \ndef processor(*args,**kw):\n return ''\n \ndef python_build():\n return ('.'.join(map(str,__BRYTHON__.implementation[:-1])),\n __BRYTHON__.compiled_date)\n \ndef python_compiler():\n return ''\n \ndef python_branch():\n return ''\n \ndef python_implementation():\n return 'Brython'\n \ndef python_revision():\n return ''\n \ndef python_version():\n return '.'.join(map(str,__BRYTHON__.version_info[:3]))\n \ndef python_version_tuple():\n return __BRYTHON__.version_info[:3]\n \ndef release():\n return ''\n \ndef system():\n return window.navigator.platform\n \ndef system_alias(*args,**kw):\n return window.navigator.platform\n \ndef uname():\n from collections import namedtuple\n klass=namedtuple('uname_result',\n 'system node release version machine processor')\n return klass(window.navigator.platform,'','','','','')\n", ["browser", "collections"]], "posixpath": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ncurdir='.'\npardir='..'\nextsep='.'\nsep='/'\npathsep=':'\ndefpath='/bin:/usr/bin'\naltsep=None\ndevnull='/dev/null'\n\nimport os\nimport sys\nimport stat\nimport genericpath\nfrom genericpath import *\n\n__all__=[\"normcase\",\"isabs\",\"join\",\"splitdrive\",\"splitroot\",\"split\",\"splitext\",\n\"basename\",\"dirname\",\"commonprefix\",\"getsize\",\"getmtime\",\n\"getatime\",\"getctime\",\"islink\",\"exists\",\"lexists\",\"isdir\",\"isfile\",\n\"ismount\",\"expanduser\",\"expandvars\",\"normpath\",\"abspath\",\n\"samefile\",\"sameopenfile\",\"samestat\",\n\"curdir\",\"pardir\",\"sep\",\"pathsep\",\"defpath\",\"altsep\",\"extsep\",\n\"devnull\",\"realpath\",\"supports_unicode_filenames\",\"relpath\",\n\"commonpath\",\"isjunction\"]\n\n\ndef _get_sep(path):\n if isinstance(path,bytes):\n return b'/'\n else:\n return '/'\n \n \n \n \n \n \ndef normcase(s):\n ''\n return os.fspath(s)\n \n \n \n \n \ndef isabs(s):\n ''\n s=os.fspath(s)\n sep=_get_sep(s)\n return s.startswith(sep)\n \n \n \n \n \n \ndef join(a,*p):\n ''\n\n\n \n a=os.fspath(a)\n sep=_get_sep(a)\n path=a\n try:\n if not p:\n path[:0]+sep\n for b in map(os.fspath,p):\n if b.startswith(sep):\n path=b\n elif not path or path.endswith(sep):\n path +=b\n else:\n path +=sep+b\n except(TypeError,AttributeError,BytesWarning):\n genericpath._check_arg_types('join',a,*p)\n raise\n return path\n \n \n \n \n \n \n \ndef split(p):\n ''\n \n p=os.fspath(p)\n sep=_get_sep(p)\n i=p.rfind(sep)+1\n head,tail=p[:i],p[i:]\n if head and head !=sep *len(head):\n head=head.rstrip(sep)\n return head,tail\n \n \n \n \n \n \n \ndef splitext(p):\n p=os.fspath(p)\n if isinstance(p,bytes):\n sep=b'/'\n extsep=b'.'\n else:\n sep='/'\n extsep='.'\n return genericpath._splitext(p,sep,None,extsep)\nsplitext.__doc__=genericpath._splitext.__doc__\n\n\n\n\ndef splitdrive(p):\n ''\n \n p=os.fspath(p)\n return p[:0],p\n \n \ndef splitroot(p):\n ''\n\n\n\n\n\n\n\n \n p=os.fspath(p)\n if isinstance(p,bytes):\n sep=b'/'\n empty=b''\n else:\n sep='/'\n empty=''\n if p[:1]!=sep:\n \n return empty,empty,p\n elif p[1:2]!=sep or p[2:3]==sep:\n \n return empty,sep,p[1:]\n else:\n \n \n return empty,p[:2],p[2:]\n \n \n \n \ndef basename(p):\n ''\n p=os.fspath(p)\n sep=_get_sep(p)\n i=p.rfind(sep)+1\n return p[i:]\n \n \n \n \ndef dirname(p):\n ''\n p=os.fspath(p)\n sep=_get_sep(p)\n i=p.rfind(sep)+1\n head=p[:i]\n if head and head !=sep *len(head):\n head=head.rstrip(sep)\n return head\n \n \n \n \ndef isjunction(path):\n ''\n \n os.fspath(path)\n return False\n \n \n \n \ndef lexists(path):\n ''\n try:\n os.lstat(path)\n except(OSError,ValueError):\n return False\n return True\n \n \n \n \n \ndef ismount(path):\n ''\n try:\n s1=os.lstat(path)\n except(OSError,ValueError):\n \n return False\n else:\n \n if stat.S_ISLNK(s1.st_mode):\n return False\n \n path=os.fspath(path)\n if isinstance(path,bytes):\n parent=join(path,b'..')\n else:\n parent=join(path,'..')\n parent=realpath(parent)\n try:\n s2=os.lstat(parent)\n except(OSError,ValueError):\n return False\n \n dev1=s1.st_dev\n dev2=s2.st_dev\n if dev1 !=dev2:\n return True\n ino1=s1.st_ino\n ino2=s2.st_ino\n if ino1 ==ino2:\n return True\n return False\n \n \n \n \n \n \n \n \n \n \n \ndef expanduser(path):\n ''\n \n path=os.fspath(path)\n if isinstance(path,bytes):\n tilde=b'~'\n else:\n tilde='~'\n if not path.startswith(tilde):\n return path\n sep=_get_sep(path)\n i=path.find(sep,1)\n if i <0:\n i=len(path)\n if i ==1:\n if 'HOME'not in os.environ:\n try:\n import pwd\n except ImportError:\n \n return path\n try:\n userhome=pwd.getpwuid(os.getuid()).pw_dir\n except KeyError:\n \n \n return path\n else:\n userhome=os.environ['HOME']\n else:\n try:\n import pwd\n except ImportError:\n \n return path\n name=path[1:i]\n if isinstance(name,bytes):\n name=str(name,'ASCII')\n try:\n pwent=pwd.getpwnam(name)\n except KeyError:\n \n \n return path\n userhome=pwent.pw_dir\n \n if userhome is None and sys.platform ==\"vxworks\":\n return path\n if isinstance(path,bytes):\n userhome=os.fsencode(userhome)\n root=b'/'\n else:\n root='/'\n userhome=userhome.rstrip(root)\n return(userhome+path[i:])or root\n \n \n \n \n \n \n_varprog=None\n_varprogb=None\n\ndef expandvars(path):\n ''\n \n path=os.fspath(path)\n global _varprog,_varprogb\n if isinstance(path,bytes):\n if b'$'not in path:\n return path\n if not _varprogb:\n import re\n _varprogb=re.compile(br'\\$(\\w+|\\{[^}]*\\})',re.ASCII)\n search=_varprogb.search\n start=b'{'\n end=b'}'\n environ=getattr(os,'environb',None)\n else:\n if '$'not in path:\n return path\n if not _varprog:\n import re\n _varprog=re.compile(r'\\$(\\w+|\\{[^}]*\\})',re.ASCII)\n search=_varprog.search\n start='{'\n end='}'\n environ=os.environ\n i=0\n while True:\n m=search(path,i)\n if not m:\n break\n i,j=m.span(0)\n name=m.group(1)\n if name.startswith(start)and name.endswith(end):\n name=name[1:-1]\n try:\n if environ is None:\n value=os.fsencode(os.environ[os.fsdecode(name)])\n else:\n value=environ[name]\n except KeyError:\n i=j\n else:\n tail=path[j:]\n path=path[:i]+value\n i=len(path)\n path +=tail\n return path\n \n \n \n \n \n \ntry:\n from posix import _path_normpath\n \nexcept ImportError:\n def normpath(path):\n ''\n path=os.fspath(path)\n if isinstance(path,bytes):\n sep=b'/'\n empty=b''\n dot=b'.'\n dotdot=b'..'\n else:\n sep='/'\n empty=''\n dot='.'\n dotdot='..'\n if path ==empty:\n return dot\n _,initial_slashes,path=splitroot(path)\n comps=path.split(sep)\n new_comps=[]\n for comp in comps:\n if comp in(empty,dot):\n continue\n if(comp !=dotdot or(not initial_slashes and not new_comps)or\n (new_comps and new_comps[-1]==dotdot)):\n new_comps.append(comp)\n elif new_comps:\n new_comps.pop()\n comps=new_comps\n path=initial_slashes+sep.join(comps)\n return path or dot\n \nelse:\n def normpath(path):\n ''\n path=os.fspath(path)\n if isinstance(path,bytes):\n return os.fsencode(_path_normpath(os.fsdecode(path)))or b\".\"\n return _path_normpath(path)or \".\"\n \n \ndef abspath(path):\n ''\n path=os.fspath(path)\n if not isabs(path):\n if isinstance(path,bytes):\n cwd=os.getcwdb()\n else:\n cwd=os.getcwd()\n path=join(cwd,path)\n return normpath(path)\n \n \n \n \n \ndef realpath(filename,*,strict=False):\n ''\n \n filename=os.fspath(filename)\n print('posixpath 435, filename',filename,type(filename))\n path,ok=_joinrealpath(filename[:0],filename,strict,{})\n return abspath(path)\n \n \n \ndef _joinrealpath(path,rest,strict,seen):\n if isinstance(path,bytes):\n sep=b'/'\n curdir=b'.'\n pardir=b'..'\n else:\n sep='/'\n curdir='.'\n pardir='..'\n \n if isabs(rest):\n rest=rest[1:]\n path=sep\n \n while rest:\n name,_,rest=rest.partition(sep)\n if not name or name ==curdir:\n \n continue\n if name ==pardir:\n \n if path:\n path,name=split(path)\n if name ==pardir:\n path=join(path,pardir,pardir)\n else:\n path=pardir\n continue\n newpath=join(path,name)\n try:\n st=os.lstat(newpath)\n except OSError:\n if strict:\n raise\n is_link=False\n else:\n is_link=stat.S_ISLNK(st.st_mode)\n if not is_link:\n path=newpath\n continue\n \n if newpath in seen:\n \n path=seen[newpath]\n if path is not None:\n \n continue\n \n if strict:\n \n os.stat(newpath)\n else:\n \n return join(newpath,rest),False\n seen[newpath]=None\n path,ok=_joinrealpath(path,os.readlink(newpath),strict,seen)\n if not ok:\n return join(path,rest),False\n seen[newpath]=path\n \n return path,True\n \n \nsupports_unicode_filenames=(sys.platform =='darwin')\n\ndef relpath(path,start=None):\n ''\n \n if not path:\n raise ValueError(\"no path specified\")\n \n path=os.fspath(path)\n if isinstance(path,bytes):\n curdir=b'.'\n sep=b'/'\n pardir=b'..'\n else:\n curdir='.'\n sep='/'\n pardir='..'\n \n if start is None:\n start=curdir\n else:\n start=os.fspath(start)\n \n try:\n start_list=[x for x in abspath(start).split(sep)if x]\n path_list=[x for x in abspath(path).split(sep)if x]\n \n i=len(commonprefix([start_list,path_list]))\n \n rel_list=[pardir]*(len(start_list)-i)+path_list[i:]\n if not rel_list:\n return curdir\n return join(*rel_list)\n except(TypeError,AttributeError,BytesWarning,DeprecationWarning):\n genericpath._check_arg_types('relpath',path,start)\n raise\n \n \n \n \n \n \n \ndef commonpath(paths):\n ''\n \n if not paths:\n raise ValueError('commonpath() arg is an empty sequence')\n \n paths=tuple(map(os.fspath,paths))\n if isinstance(paths[0],bytes):\n sep=b'/'\n curdir=b'.'\n else:\n sep='/'\n curdir='.'\n \n try:\n split_paths=[path.split(sep)for path in paths]\n \n try:\n isabs,=set(p[:1]==sep for p in paths)\n except ValueError:\n raise ValueError(\"Can't mix absolute and relative paths\")from None\n \n split_paths=[[c for c in s if c and c !=curdir]for s in split_paths]\n s1=min(split_paths)\n s2=max(split_paths)\n common=s1\n for i,c in enumerate(s1):\n if c !=s2[i]:\n common=s1[:i]\n break\n \n prefix=sep if isabs else sep[:0]\n return prefix+sep.join(common)\n except(TypeError,AttributeError):\n genericpath._check_arg_types('commonpath',*paths)\n raise\n \n", ["genericpath", "os", "posix", "pwd", "re", "stat", "sys"]], "pprint": [".py", "\n\n\n\n\n\n\n\n\n\n\"\"\"Support to pretty-print lists, tuples, & dictionaries recursively.\n\nVery simple, but useful, especially in debugging data structures.\n\nClasses\n-------\n\nPrettyPrinter()\n Handle pretty-printing operations onto a stream using a configured\n set of formatting parameters.\n\nFunctions\n---------\n\npformat()\n Format a Python object into a pretty-printed representation.\n\npprint()\n Pretty-print a Python object to a stream [default is sys.stdout].\n\nsaferepr()\n Generate a 'standard' repr()-like value, but protect against recursive\n data structures.\n\n\"\"\"\n\nimport collections as _collections\nimport dataclasses as _dataclasses\nimport re\nimport sys as _sys\nimport types as _types\nfrom io import StringIO as _StringIO\n\n__all__=[\"pprint\",\"pformat\",\"isreadable\",\"isrecursive\",\"saferepr\",\n\"PrettyPrinter\",\"pp\"]\n\n\ndef pprint(object,stream=None,indent=1,width=80,depth=None,*,\ncompact=False,sort_dicts=True,underscore_numbers=False):\n ''\n printer=PrettyPrinter(\n stream=stream,indent=indent,width=width,depth=depth,\n compact=compact,sort_dicts=sort_dicts,\n underscore_numbers=underscore_numbers)\n printer.pprint(object)\n \ndef pformat(object,indent=1,width=80,depth=None,*,\ncompact=False,sort_dicts=True,underscore_numbers=False):\n ''\n return PrettyPrinter(indent=indent,width=width,depth=depth,\n compact=compact,sort_dicts=sort_dicts,\n underscore_numbers=underscore_numbers).pformat(object)\n \ndef pp(object,*args,sort_dicts=False,**kwargs):\n ''\n pprint(object,*args,sort_dicts=sort_dicts,**kwargs)\n \ndef saferepr(object):\n ''\n return PrettyPrinter()._safe_repr(object,{},None,0)[0]\n \ndef isreadable(object):\n ''\n return PrettyPrinter()._safe_repr(object,{},None,0)[1]\n \ndef isrecursive(object):\n ''\n return PrettyPrinter()._safe_repr(object,{},None,0)[2]\n \nclass _safe_key:\n ''\n\n\n\n\n\n\n \n \n __slots__=['obj']\n \n def __init__(self,obj):\n self.obj=obj\n \n def __lt__(self,other):\n try:\n return self.obj = 0')\n if depth is not None and depth <=0:\n raise ValueError('depth must be > 0')\n if not width:\n raise ValueError('width must be != 0')\n self._depth=depth\n self._indent_per_level=indent\n self._width=width\n if stream is not None:\n self._stream=stream\n else:\n self._stream=_sys.stdout\n self._compact=bool(compact)\n self._sort_dicts=sort_dicts\n self._underscore_numbers=underscore_numbers\n \n def pprint(self,object):\n if self._stream is not None:\n self._format(object,self._stream,0,0,{},0)\n self._stream.write(\"\\n\")\n \n def pformat(self,object):\n sio=_StringIO()\n self._format(object,sio,0,0,{},0)\n return sio.getvalue()\n \n def isrecursive(self,object):\n return self.format(object,{},0,0)[2]\n \n def isreadable(self,object):\n s,readable,recursive=self.format(object,{},0,0)\n return readable and not recursive\n \n def _format(self,object,stream,indent,allowance,context,level):\n objid=id(object)\n if objid in context:\n stream.write(_recursion(object))\n self._recursive=True\n self._readable=False\n return\n rep=self._repr(object,context,level)\n max_width=self._width -indent -allowance\n if len(rep)>max_width:\n p=self._dispatch.get(type(object).__repr__,None)\n if p is not None:\n context[objid]=1\n p(self,object,stream,indent,allowance,context,level+1)\n del context[objid]\n return\n elif(_dataclasses.is_dataclass(object)and\n not isinstance(object,type)and\n object.__dataclass_params__.repr and\n \n hasattr(object.__repr__,\"__wrapped__\")and\n \"__create_fn__\"in object.__repr__.__wrapped__.__qualname__):\n context[objid]=1\n self._pprint_dataclass(object,stream,indent,allowance,context,level+1)\n del context[objid]\n return\n stream.write(rep)\n \n def _pprint_dataclass(self,object,stream,indent,allowance,context,level):\n cls_name=object.__class__.__name__\n indent +=len(cls_name)+1\n items=[(f.name,getattr(object,f.name))for f in _dataclasses.fields(object)if f.repr]\n stream.write(cls_name+'(')\n self._format_namespace_items(items,stream,indent,allowance,context,level)\n stream.write(')')\n \n _dispatch={}\n \n def _pprint_dict(self,object,stream,indent,allowance,context,level):\n write=stream.write\n write('{')\n if self._indent_per_level >1:\n write((self._indent_per_level -1)*' ')\n length=len(object)\n if length:\n if self._sort_dicts:\n items=sorted(object.items(),key=_safe_tuple)\n else:\n items=object.items()\n self._format_dict_items(items,stream,indent,allowance+1,\n context,level)\n write('}')\n \n _dispatch[dict.__repr__]=_pprint_dict\n \n def _pprint_ordered_dict(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n cls=object.__class__\n stream.write(cls.__name__+'(')\n self._format(list(object.items()),stream,\n indent+len(cls.__name__)+1,allowance+1,\n context,level)\n stream.write(')')\n \n _dispatch[_collections.OrderedDict.__repr__]=_pprint_ordered_dict\n \n def _pprint_list(self,object,stream,indent,allowance,context,level):\n stream.write('[')\n self._format_items(object,stream,indent,allowance+1,\n context,level)\n stream.write(']')\n \n _dispatch[list.__repr__]=_pprint_list\n \n def _pprint_tuple(self,object,stream,indent,allowance,context,level):\n stream.write('(')\n endchar=',)'if len(object)==1 else ')'\n self._format_items(object,stream,indent,allowance+len(endchar),\n context,level)\n stream.write(endchar)\n \n _dispatch[tuple.__repr__]=_pprint_tuple\n \n def _pprint_set(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n typ=object.__class__\n if typ is set:\n stream.write('{')\n endchar='}'\n else:\n stream.write(typ.__name__+'({')\n endchar='})'\n indent +=len(typ.__name__)+1\n object=sorted(object,key=_safe_key)\n self._format_items(object,stream,indent,allowance+len(endchar),\n context,level)\n stream.write(endchar)\n \n _dispatch[set.__repr__]=_pprint_set\n _dispatch[frozenset.__repr__]=_pprint_set\n \n def _pprint_str(self,object,stream,indent,allowance,context,level):\n write=stream.write\n if not len(object):\n write(repr(object))\n return\n chunks=[]\n lines=object.splitlines(True)\n if level ==1:\n indent +=1\n allowance +=1\n max_width1=max_width=self._width -indent\n for i,line in enumerate(lines):\n rep=repr(line)\n if i ==len(lines)-1:\n max_width1 -=allowance\n if len(rep)<=max_width1:\n chunks.append(rep)\n else:\n \n parts=re.findall(r'\\S*\\s*',line)\n assert parts\n assert not parts[-1]\n parts.pop()\n max_width2=max_width\n current=''\n for j,part in enumerate(parts):\n candidate=current+part\n if j ==len(parts)-1 and i ==len(lines)-1:\n max_width2 -=allowance\n if len(repr(candidate))>max_width2:\n if current:\n chunks.append(repr(current))\n current=part\n else:\n current=candidate\n if current:\n chunks.append(repr(current))\n if len(chunks)==1:\n write(rep)\n return\n if level ==1:\n write('(')\n for i,rep in enumerate(chunks):\n if i >0:\n write('\\n'+' '*indent)\n write(rep)\n if level ==1:\n write(')')\n \n _dispatch[str.__repr__]=_pprint_str\n \n def _pprint_bytes(self,object,stream,indent,allowance,context,level):\n write=stream.write\n if len(object)<=4:\n write(repr(object))\n return\n parens=level ==1\n if parens:\n indent +=1\n allowance +=1\n write('(')\n delim=''\n for rep in _wrap_bytes_repr(object,self._width -indent,allowance):\n write(delim)\n write(rep)\n if not delim:\n delim='\\n'+' '*indent\n if parens:\n write(')')\n \n _dispatch[bytes.__repr__]=_pprint_bytes\n \n def _pprint_bytearray(self,object,stream,indent,allowance,context,level):\n write=stream.write\n write('bytearray(')\n self._pprint_bytes(bytes(object),stream,indent+10,\n allowance+1,context,level+1)\n write(')')\n \n _dispatch[bytearray.__repr__]=_pprint_bytearray\n \n def _pprint_mappingproxy(self,object,stream,indent,allowance,context,level):\n stream.write('mappingproxy(')\n self._format(object.copy(),stream,indent+13,allowance+1,\n context,level)\n stream.write(')')\n \n _dispatch[_types.MappingProxyType.__repr__]=_pprint_mappingproxy\n \n def _pprint_simplenamespace(self,object,stream,indent,allowance,context,level):\n if type(object)is _types.SimpleNamespace:\n \n \n cls_name='namespace'\n else:\n cls_name=object.__class__.__name__\n indent +=len(cls_name)+1\n items=object.__dict__.items()\n stream.write(cls_name+'(')\n self._format_namespace_items(items,stream,indent,allowance,context,level)\n stream.write(')')\n \n _dispatch[_types.SimpleNamespace.__repr__]=_pprint_simplenamespace\n \n def _format_dict_items(self,items,stream,indent,allowance,context,\n level):\n write=stream.write\n indent +=self._indent_per_level\n delimnl=',\\n'+' '*indent\n last_index=len(items)-1\n for i,(key,ent)in enumerate(items):\n last=i ==last_index\n rep=self._repr(key,context,level)\n write(rep)\n write(': ')\n self._format(ent,stream,indent+len(rep)+2,\n allowance if last else 1,\n context,level)\n if not last:\n write(delimnl)\n \n def _format_namespace_items(self,items,stream,indent,allowance,context,level):\n write=stream.write\n delimnl=',\\n'+' '*indent\n last_index=len(items)-1\n for i,(key,ent)in enumerate(items):\n last=i ==last_index\n write(key)\n write('=')\n if id(ent)in context:\n \n \n write(\"...\")\n else:\n self._format(ent,stream,indent+len(key)+1,\n allowance if last else 1,\n context,level)\n if not last:\n write(delimnl)\n \n def _format_items(self,items,stream,indent,allowance,context,level):\n write=stream.write\n indent +=self._indent_per_level\n if self._indent_per_level >1:\n write((self._indent_per_level -1)*' ')\n delimnl=',\\n'+' '*indent\n delim=''\n width=max_width=self._width -indent+1\n it=iter(items)\n try:\n next_ent=next(it)\n except StopIteration:\n return\n last=False\n while not last:\n ent=next_ent\n try:\n next_ent=next(it)\n except StopIteration:\n last=True\n max_width -=allowance\n width -=allowance\n if self._compact:\n rep=self._repr(ent,context,level)\n w=len(rep)+2\n if width =w:\n width -=w\n write(delim)\n delim=', '\n write(rep)\n continue\n write(delim)\n delim=delimnl\n self._format(ent,stream,indent,\n allowance if last else 1,\n context,level)\n \n def _repr(self,object,context,level):\n repr,readable,recursive=self.format(object,context.copy(),\n self._depth,level)\n if not readable:\n self._readable=False\n if recursive:\n self._recursive=True\n return repr\n \n def format(self,object,context,maxlevels,level):\n ''\n\n\n \n return self._safe_repr(object,context,maxlevels,level)\n \n def _pprint_default_dict(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n rdf=self._repr(object.default_factory,context,level)\n cls=object.__class__\n indent +=len(cls.__name__)+1\n stream.write('%s(%s,\\n%s'%(cls.__name__,rdf,' '*indent))\n self._pprint_dict(object,stream,indent,allowance+1,context,level)\n stream.write(')')\n \n _dispatch[_collections.defaultdict.__repr__]=_pprint_default_dict\n \n def _pprint_counter(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n cls=object.__class__\n stream.write(cls.__name__+'({')\n if self._indent_per_level >1:\n stream.write((self._indent_per_level -1)*' ')\n items=object.most_common()\n self._format_dict_items(items,stream,\n indent+len(cls.__name__)+1,allowance+2,\n context,level)\n stream.write('})')\n \n _dispatch[_collections.Counter.__repr__]=_pprint_counter\n \n def _pprint_chain_map(self,object,stream,indent,allowance,context,level):\n if not len(object.maps):\n stream.write(repr(object))\n return\n cls=object.__class__\n stream.write(cls.__name__+'(')\n indent +=len(cls.__name__)+1\n for i,m in enumerate(object.maps):\n if i ==len(object.maps)-1:\n self._format(m,stream,indent,allowance+1,context,level)\n stream.write(')')\n else:\n self._format(m,stream,indent,1,context,level)\n stream.write(',\\n'+' '*indent)\n \n _dispatch[_collections.ChainMap.__repr__]=_pprint_chain_map\n \n def _pprint_deque(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n cls=object.__class__\n stream.write(cls.__name__+'(')\n indent +=len(cls.__name__)+1\n stream.write('[')\n if object.maxlen is None:\n self._format_items(object,stream,indent,allowance+2,\n context,level)\n stream.write('])')\n else:\n self._format_items(object,stream,indent,2,\n context,level)\n rml=self._repr(object.maxlen,context,level)\n stream.write('],\\n%smaxlen=%s)'%(' '*indent,rml))\n \n _dispatch[_collections.deque.__repr__]=_pprint_deque\n \n def _pprint_user_dict(self,object,stream,indent,allowance,context,level):\n self._format(object.data,stream,indent,allowance,context,level -1)\n \n _dispatch[_collections.UserDict.__repr__]=_pprint_user_dict\n \n def _pprint_user_list(self,object,stream,indent,allowance,context,level):\n self._format(object.data,stream,indent,allowance,context,level -1)\n \n _dispatch[_collections.UserList.__repr__]=_pprint_user_list\n \n def _pprint_user_string(self,object,stream,indent,allowance,context,level):\n self._format(object.data,stream,indent,allowance,context,level -1)\n \n _dispatch[_collections.UserString.__repr__]=_pprint_user_string\n \n def _safe_repr(self,object,context,maxlevels,level):\n \n typ=type(object)\n if typ in _builtin_scalars:\n return repr(object),True,False\n \n r=getattr(typ,\"__repr__\",None)\n \n if issubclass(typ,int)and r is int.__repr__:\n if self._underscore_numbers:\n return f\"{object:_d}\",True,False\n else:\n return repr(object),True,False\n \n if issubclass(typ,dict)and r is dict.__repr__:\n if not object:\n return \"{}\",True,False\n objid=id(object)\n if maxlevels and level >=maxlevels:\n return \"{...}\",False,objid in context\n if objid in context:\n return _recursion(object),False,True\n context[objid]=1\n readable=True\n recursive=False\n components=[]\n append=components.append\n level +=1\n if self._sort_dicts:\n items=sorted(object.items(),key=_safe_tuple)\n else:\n items=object.items()\n for k,v in items:\n krepr,kreadable,krecur=self.format(\n k,context,maxlevels,level)\n vrepr,vreadable,vrecur=self.format(\n v,context,maxlevels,level)\n append(\"%s: %s\"%(krepr,vrepr))\n readable=readable and kreadable and vreadable\n if krecur or vrecur:\n recursive=True\n del context[objid]\n return \"{%s}\"%\", \".join(components),readable,recursive\n \n if(issubclass(typ,list)and r is list.__repr__)or\\\n (issubclass(typ,tuple)and r is tuple.__repr__):\n if issubclass(typ,list):\n if not object:\n return \"[]\",True,False\n format=\"[%s]\"\n elif len(object)==1:\n format=\"(%s,)\"\n else:\n if not object:\n return \"()\",True,False\n format=\"(%s)\"\n objid=id(object)\n if maxlevels and level >=maxlevels:\n return format %\"...\",False,objid in context\n if objid in context:\n return _recursion(object),False,True\n context[objid]=1\n readable=True\n recursive=False\n components=[]\n append=components.append\n level +=1\n for o in object:\n orepr,oreadable,orecur=self.format(\n o,context,maxlevels,level)\n append(orepr)\n if not oreadable:\n readable=False\n if orecur:\n recursive=True\n del context[objid]\n return format %\", \".join(components),readable,recursive\n \n rep=repr(object)\n return rep,(rep and not rep.startswith('<')),False\n \n_builtin_scalars=frozenset({str,bytes,bytearray,float,complex,\nbool,type(None)})\n\ndef _recursion(object):\n return(\"\"\n %(type(object).__name__,id(object)))\n \n \ndef _wrap_bytes_repr(object,width,allowance):\n current=b''\n last=len(object)//4 *4\n for i in range(0,len(object),4):\n part=object[i:i+4]\n candidate=current+part\n if i ==last:\n width -=allowance\n if len(repr(candidate))>width:\n if current:\n yield repr(current)\n current=part\n else:\n current=candidate\n if current:\n yield repr(current)\n", ["collections", "dataclasses", "io", "re", "sys", "types"]], "profile": [".py", "#! /usr/bin/env python3\n\n\n\n\n\n\n\n\"\"\"Class for profiling Python code.\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport importlib.machinery\nimport io\nimport sys\nimport time\nimport marshal\n\n__all__=[\"run\",\"runctx\",\"Profile\"]\n\n\n\n\n\n\n\n\n\nclass _Utils:\n ''\n\n\n \n \n def __init__(self,profiler):\n self.profiler=profiler\n \n def run(self,statement,filename,sort):\n prof=self.profiler()\n try:\n prof.run(statement)\n except SystemExit:\n pass\n finally:\n self._show(prof,filename,sort)\n \n def runctx(self,statement,globals,locals,filename,sort):\n prof=self.profiler()\n try:\n prof.runctx(statement,globals,locals)\n except SystemExit:\n pass\n finally:\n self._show(prof,filename,sort)\n \n def _show(self,prof,filename,sort):\n if filename is not None:\n prof.dump_stats(filename)\n else:\n prof.print_stats(sort)\n \n \n \n \n \n \n \ndef run(statement,filename=None,sort=-1):\n ''\n\n\n\n\n\n\n\n\n \n return _Utils(Profile).run(statement,filename,sort)\n \ndef runctx(statement,globals,locals,filename=None,sort=-1):\n ''\n\n\n\n \n return _Utils(Profile).runctx(statement,globals,locals,filename,sort)\n \n \nclass Profile:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n bias=0\n \n def __init__(self,timer=None,bias=None):\n self.timings={}\n self.cur=None\n self.cmd=\"\"\n self.c_func_name=\"\"\n \n if bias is None:\n bias=self.bias\n self.bias=bias\n \n if not timer:\n self.timer=self.get_time=time.process_time\n self.dispatcher=self.trace_dispatch_i\n else:\n self.timer=timer\n t=self.timer()\n try:\n length=len(t)\n except TypeError:\n self.get_time=timer\n self.dispatcher=self.trace_dispatch_i\n else:\n if length ==2:\n self.dispatcher=self.trace_dispatch\n else:\n self.dispatcher=self.trace_dispatch_l\n \n \n \n \n \n def get_time_timer(timer=timer,sum=sum):\n return sum(timer())\n self.get_time=get_time_timer\n self.t=self.get_time()\n self.simulate_call('profiler')\n \n \n \n def trace_dispatch(self,frame,event,arg):\n timer=self.timer\n t=timer()\n t=t[0]+t[1]-self.t -self.bias\n \n if event ==\"c_call\":\n self.c_func_name=arg.__name__\n \n if self.dispatch[event](self,frame,t):\n t=timer()\n self.t=t[0]+t[1]\n else:\n r=timer()\n self.t=r[0]+r[1]-t\n \n \n \n \n def trace_dispatch_i(self,frame,event,arg):\n timer=self.timer\n t=timer()-self.t -self.bias\n \n if event ==\"c_call\":\n self.c_func_name=arg.__name__\n \n if self.dispatch[event](self,frame,t):\n self.t=timer()\n else:\n self.t=timer()-t\n \n \n \n \n def trace_dispatch_mac(self,frame,event,arg):\n timer=self.timer\n t=timer()/60.0 -self.t -self.bias\n \n if event ==\"c_call\":\n self.c_func_name=arg.__name__\n \n if self.dispatch[event](self,frame,t):\n self.t=timer()/60.0\n else:\n self.t=timer()/60.0 -t\n \n \n \n def trace_dispatch_l(self,frame,event,arg):\n get_time=self.get_time\n t=get_time()-self.t -self.bias\n \n if event ==\"c_call\":\n self.c_func_name=arg.__name__\n \n if self.dispatch[event](self,frame,t):\n self.t=get_time()\n else:\n self.t=get_time()-t\n \n \n \n \n \n \n \n \n def trace_dispatch_exception(self,frame,t):\n rpt,rit,ret,rfn,rframe,rcur=self.cur\n if(rframe is not frame)and rcur:\n return self.trace_dispatch_return(rframe,t)\n self.cur=rpt,rit+t,ret,rfn,rframe,rcur\n return 1\n \n \n def trace_dispatch_call(self,frame,t):\n if self.cur and frame.f_back is not self.cur[-2]:\n rpt,rit,ret,rfn,rframe,rcur=self.cur\n if not isinstance(rframe,Profile.fake_frame):\n assert rframe.f_back is frame.f_back,(\"Bad call\",rfn,\n rframe,rframe.f_back,\n frame,frame.f_back)\n self.trace_dispatch_return(rframe,0)\n assert(self.cur is None or\\\n frame.f_back is self.cur[-2]),(\"Bad call\",\n self.cur[-3])\n fcode=frame.f_code\n fn=(fcode.co_filename,fcode.co_firstlineno,fcode.co_name)\n self.cur=(t,0,0,fn,frame,self.cur)\n timings=self.timings\n if fn in timings:\n cc,ns,tt,ct,callers=timings[fn]\n timings[fn]=cc,ns+1,tt,ct,callers\n else:\n timings[fn]=0,0,0,0,{}\n return 1\n \n def trace_dispatch_c_call(self,frame,t):\n fn=(\"\",0,self.c_func_name)\n self.cur=(t,0,0,fn,frame,self.cur)\n timings=self.timings\n if fn in timings:\n cc,ns,tt,ct,callers=timings[fn]\n timings[fn]=cc,ns+1,tt,ct,callers\n else:\n timings[fn]=0,0,0,0,{}\n return 1\n \n def trace_dispatch_return(self,frame,t):\n if frame is not self.cur[-2]:\n assert frame is self.cur[-2].f_back,(\"Bad return\",self.cur[-3])\n self.trace_dispatch_return(self.cur[-2],0)\n \n \n \n \n rpt,rit,ret,rfn,frame,rcur=self.cur\n rit=rit+t\n frame_total=rit+ret\n \n ppt,pit,pet,pfn,pframe,pcur=rcur\n self.cur=ppt,pit+rpt,pet+frame_total,pfn,pframe,pcur\n \n timings=self.timings\n cc,ns,tt,ct,callers=timings[rfn]\n if not ns:\n \n \n \n \n ct=ct+frame_total\n cc=cc+1\n \n if pfn in callers:\n callers[pfn]=callers[pfn]+1\n \n \n \n else:\n callers[pfn]=1\n \n timings[rfn]=cc,ns -1,tt+rit,ct,callers\n \n return 1\n \n \n dispatch={\n \"call\":trace_dispatch_call,\n \"exception\":trace_dispatch_exception,\n \"return\":trace_dispatch_return,\n \"c_call\":trace_dispatch_c_call,\n \"c_exception\":trace_dispatch_return,\n \"c_return\":trace_dispatch_return,\n }\n \n \n \n \n \n \n \n \n def set_cmd(self,cmd):\n if self.cur[-1]:return\n self.cmd=cmd\n self.simulate_call(cmd)\n \n class fake_code:\n def __init__(self,filename,line,name):\n self.co_filename=filename\n self.co_line=line\n self.co_name=name\n self.co_firstlineno=0\n \n def __repr__(self):\n return repr((self.co_filename,self.co_line,self.co_name))\n \n class fake_frame:\n def __init__(self,code,prior):\n self.f_code=code\n self.f_back=prior\n \n def simulate_call(self,name):\n code=self.fake_code('profile',0,name)\n if self.cur:\n pframe=self.cur[-2]\n else:\n pframe=None\n frame=self.fake_frame(code,pframe)\n self.dispatch['call'](self,frame,0)\n \n \n \n \n def simulate_cmd_complete(self):\n get_time=self.get_time\n t=get_time()-self.t\n while self.cur[-1]:\n \n \n self.dispatch['return'](self,self.cur[-2],t)\n t=0\n self.t=get_time()-t\n \n \n def print_stats(self,sort=-1):\n import pstats\n pstats.Stats(self).strip_dirs().sort_stats(sort).\\\n print_stats()\n \n def dump_stats(self,file):\n with open(file,'wb')as f:\n self.create_stats()\n marshal.dump(self.stats,f)\n \n def create_stats(self):\n self.simulate_cmd_complete()\n self.snapshot_stats()\n \n def snapshot_stats(self):\n self.stats={}\n for func,(cc,ns,tt,ct,callers)in self.timings.items():\n callers=callers.copy()\n nc=0\n for callcnt in callers.values():\n nc +=callcnt\n self.stats[func]=cc,nc,tt,ct,callers\n \n \n \n \n \n def run(self,cmd):\n import __main__\n dict=__main__.__dict__\n return self.runctx(cmd,dict,dict)\n \n def runctx(self,cmd,globals,locals):\n self.set_cmd(cmd)\n sys.setprofile(self.dispatcher)\n try:\n exec(cmd,globals,locals)\n finally:\n sys.setprofile(None)\n return self\n \n \n def runcall(self,func,/,*args,**kw):\n self.set_cmd(repr(func))\n sys.setprofile(self.dispatcher)\n try:\n return func(*args,**kw)\n finally:\n sys.setprofile(None)\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def calibrate(self,m,verbose=0):\n if self.__class__ is not Profile:\n raise TypeError(\"Subclasses must override .calibrate().\")\n \n saved_bias=self.bias\n self.bias=0\n try:\n return self._calibrate_inner(m,verbose)\n finally:\n self.bias=saved_bias\n \n def _calibrate_inner(self,m,verbose):\n get_time=self.get_time\n \n \n \n \n \n \n \n def f1(n):\n for i in range(n):\n x=1\n \n def f(m,f1=f1):\n for i in range(m):\n f1(100)\n \n f(m)\n \n \n t0=get_time()\n f(m)\n t1=get_time()\n elapsed_noprofile=t1 -t0\n if verbose:\n print(\"elapsed time without profiling =\",elapsed_noprofile)\n \n \n \n \n p=Profile()\n t0=get_time()\n p.runctx('f(m)',globals(),locals())\n t1=get_time()\n elapsed_profile=t1 -t0\n if verbose:\n print(\"elapsed time with profiling =\",elapsed_profile)\n \n \n total_calls=0.0\n reported_time=0.0\n for(filename,line,funcname),(cc,ns,tt,ct,callers)in\\\n p.timings.items():\n if funcname in(\"f\",\"f1\"):\n total_calls +=cc\n reported_time +=tt\n \n if verbose:\n print(\"'CPU seconds' profiler reported =\",reported_time)\n print(\"total # calls =\",total_calls)\n if total_calls !=m+1:\n raise ValueError(\"internal error: total calls = %d\"%total_calls)\n \n \n \n \n \n mean=(reported_time -elapsed_noprofile)/2.0 /total_calls\n if verbose:\n print(\"mean stopwatch overhead per profile event =\",mean)\n return mean\n \n \n \ndef main():\n import os\n from optparse import OptionParser\n \n usage=\"profile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...\"\n parser=OptionParser(usage=usage)\n parser.allow_interspersed_args=False\n parser.add_option('-o','--outfile',dest=\"outfile\",\n help=\"Save stats to \",default=None)\n parser.add_option('-m',dest=\"module\",action=\"store_true\",\n help=\"Profile a library module.\",default=False)\n parser.add_option('-s','--sort',dest=\"sort\",\n help=\"Sort order when printing to stdout, based on pstats.Stats class\",\n default=-1)\n \n if not sys.argv[1:]:\n parser.print_usage()\n sys.exit(2)\n \n (options,args)=parser.parse_args()\n sys.argv[:]=args\n \n \n \n if options.outfile is not None:\n options.outfile=os.path.abspath(options.outfile)\n \n if len(args)>0:\n if options.module:\n import runpy\n code=\"run_module(modname, run_name='__main__')\"\n globs={\n 'run_module':runpy.run_module,\n 'modname':args[0]\n }\n else:\n progname=args[0]\n sys.path.insert(0,os.path.dirname(progname))\n with io.open_code(progname)as fp:\n code=compile(fp.read(),progname,'exec')\n spec=importlib.machinery.ModuleSpec(name='__main__',loader=None,\n origin=progname)\n globs={\n '__spec__':spec,\n '__file__':spec.origin,\n '__name__':spec.name,\n '__package__':None,\n '__cached__':None,\n }\n try:\n runctx(code,globs,None,options.outfile,options.sort)\n except BrokenPipeError as exc:\n \n sys.stdout=None\n sys.exit(exc.errno)\n else:\n parser.print_usage()\n return parser\n \n \nif __name__ =='__main__':\n main()\n", ["__main__", "importlib.machinery", "io", "marshal", "optparse", "os", "pstats", "runpy", "sys", "time"]], "pwd": [".py", "\ndef getpwuid():\n pass\n", []], "pyclbr": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport ast\nimport sys\nimport importlib.util\n\n__all__=[\"readmodule\",\"readmodule_ex\",\"Class\",\"Function\"]\n\n_modules={}\n\n\nclass _Object:\n ''\n def __init__(self,module,name,file,lineno,end_lineno,parent):\n self.module=module\n self.name=name\n self.file=file\n self.lineno=lineno\n self.end_lineno=end_lineno\n self.parent=parent\n self.children={}\n if parent is not None:\n parent.children[name]=self\n \n \n \nclass Function(_Object):\n ''\n def __init__(self,module,name,file,lineno,\n parent=None,is_async=False,*,end_lineno=None):\n super().__init__(module,name,file,lineno,end_lineno,parent)\n self.is_async=is_async\n if isinstance(parent,Class):\n parent.methods[name]=lineno\n \n \nclass Class(_Object):\n ''\n def __init__(self,module,name,super_,file,lineno,\n parent=None,*,end_lineno=None):\n super().__init__(module,name,file,lineno,end_lineno,parent)\n self.super=super_ or[]\n self.methods={}\n \n \n \n \ndef _nest_function(ob,func_name,lineno,end_lineno,is_async=False):\n ''\n return Function(ob.module,func_name,ob.file,lineno,\n parent=ob,is_async=is_async,end_lineno=end_lineno)\n \ndef _nest_class(ob,class_name,lineno,end_lineno,super=None):\n ''\n return Class(ob.module,class_name,super,ob.file,lineno,\n parent=ob,end_lineno=end_lineno)\n \n \ndef readmodule(module,path=None):\n ''\n\n\n \n \n res={}\n for key,value in _readmodule(module,path or[]).items():\n if isinstance(value,Class):\n res[key]=value\n return res\n \ndef readmodule_ex(module,path=None):\n ''\n\n\n\n\n \n return _readmodule(module,path or[])\n \n \ndef _readmodule(module,path,inpackage=None):\n ''\n\n\n\n\n\n \n \n if inpackage is not None:\n fullmodule=\"%s.%s\"%(inpackage,module)\n else:\n fullmodule=module\n \n \n if fullmodule in _modules:\n return _modules[fullmodule]\n \n \n tree={}\n \n \n if module in sys.builtin_module_names and inpackage is None:\n _modules[module]=tree\n return tree\n \n \n i=module.rfind('.')\n if i >=0:\n package=module[:i]\n submodule=module[i+1:]\n parent=_readmodule(package,path,inpackage)\n if inpackage is not None:\n package=\"%s.%s\"%(inpackage,package)\n if not '__path__'in parent:\n raise ImportError('No package named {}'.format(package))\n return _readmodule(submodule,parent['__path__'],package)\n \n \n f=None\n if inpackage is not None:\n search_path=path\n else:\n search_path=path+sys.path\n spec=importlib.util._find_spec_from_path(fullmodule,search_path)\n if spec is None:\n raise ModuleNotFoundError(f\"no module named {fullmodule !r}\",name=fullmodule)\n _modules[fullmodule]=tree\n \n if spec.submodule_search_locations is not None:\n tree['__path__']=spec.submodule_search_locations\n try:\n source=spec.loader.get_source(fullmodule)\n except(AttributeError,ImportError):\n \n return tree\n else:\n if source is None:\n return tree\n \n fname=spec.loader.get_filename(fullmodule)\n return _create_tree(fullmodule,path,fname,source,tree,inpackage)\n \n \nclass _ModuleBrowser(ast.NodeVisitor):\n def __init__(self,module,path,file,tree,inpackage):\n self.path=path\n self.tree=tree\n self.file=file\n self.module=module\n self.inpackage=inpackage\n self.stack=[]\n \n def visit_ClassDef(self,node):\n bases=[]\n for base in node.bases:\n name=ast.unparse(base)\n if name in self.tree:\n \n bases.append(self.tree[name])\n elif len(names :=name.split(\".\"))>1:\n \n \n *_,module,class_=names\n if module in _modules:\n bases.append(_modules[module].get(class_,name))\n else:\n bases.append(name)\n \n parent=self.stack[-1]if self.stack else None\n class_=Class(self.module,node.name,bases,self.file,node.lineno,\n parent=parent,end_lineno=node.end_lineno)\n if parent is None:\n self.tree[node.name]=class_\n self.stack.append(class_)\n self.generic_visit(node)\n self.stack.pop()\n \n def visit_FunctionDef(self,node,*,is_async=False):\n parent=self.stack[-1]if self.stack else None\n function=Function(self.module,node.name,self.file,node.lineno,\n parent,is_async,end_lineno=node.end_lineno)\n if parent is None:\n self.tree[node.name]=function\n self.stack.append(function)\n self.generic_visit(node)\n self.stack.pop()\n \n def visit_AsyncFunctionDef(self,node):\n self.visit_FunctionDef(node,is_async=True)\n \n def visit_Import(self,node):\n if node.col_offset !=0:\n return\n \n for module in node.names:\n try:\n try:\n _readmodule(module.name,self.path,self.inpackage)\n except ImportError:\n _readmodule(module.name,[])\n except(ImportError,SyntaxError):\n \n \n continue\n \n def visit_ImportFrom(self,node):\n if node.col_offset !=0:\n return\n try:\n module=\".\"*node.level\n if node.module:\n module +=node.module\n module=_readmodule(module,self.path,self.inpackage)\n except(ImportError,SyntaxError):\n return\n \n for name in node.names:\n if name.name in module:\n self.tree[name.asname or name.name]=module[name.name]\n elif name.name ==\"*\":\n for import_name,import_value in module.items():\n if import_name.startswith(\"_\"):\n continue\n self.tree[import_name]=import_value\n \n \ndef _create_tree(fullmodule,path,fname,source,tree,inpackage):\n mbrowser=_ModuleBrowser(fullmodule,path,fname,tree,inpackage)\n mbrowser.visit(ast.parse(source))\n return mbrowser.tree\n \n \ndef _main():\n ''\n import os\n try:\n mod=sys.argv[1]\n except:\n mod=__file__\n if os.path.exists(mod):\n path=[os.path.dirname(mod)]\n mod=os.path.basename(mod)\n if mod.lower().endswith(\".py\"):\n mod=mod[:-3]\n else:\n path=[]\n tree=readmodule_ex(mod,path)\n lineno_key=lambda a:getattr(a,'lineno',0)\n objs=sorted(tree.values(),key=lineno_key,reverse=True)\n indent_level=2\n while objs:\n obj=objs.pop()\n if isinstance(obj,list):\n \n continue\n if not hasattr(obj,'indent'):\n obj.indent=0\n \n if isinstance(obj,_Object):\n new_objs=sorted(obj.children.values(),\n key=lineno_key,reverse=True)\n for ob in new_objs:\n ob.indent=obj.indent+indent_level\n objs.extend(new_objs)\n if isinstance(obj,Class):\n print(\"{}class {} {} {}\"\n .format(' '*obj.indent,obj.name,obj.super,obj.lineno))\n elif isinstance(obj,Function):\n print(\"{}def {} {}\".format(' '*obj.indent,obj.name,obj.lineno))\n \nif __name__ ==\"__main__\":\n _main()\n", ["ast", "importlib.util", "os", "sys"]], "pydoc": [".py", "#!/usr/bin/env python3\n''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['help']\n__author__=\"Ka-Ping Yee \"\n__date__=\"26 February 2001\"\n\n__credits__=\"\"\"Guido van Rossum, for an excellent programming language.\nTommy Burnette, the original creator of manpy.\nPaul Prescod, for all his work on onlinehelp.\nRichard Chamberlain, for the first implementation of textdoc.\n\"\"\"\n\n\n\n\n\n\n\n\nimport __future__\nimport builtins\nimport importlib._bootstrap\nimport importlib._bootstrap_external\nimport importlib.machinery\nimport importlib.util\nimport inspect\nimport io\nimport os\nimport pkgutil\nimport platform\nimport re\nimport sys\nimport sysconfig\nimport time\nimport tokenize\nimport urllib.parse\nimport warnings\nfrom collections import deque\nfrom reprlib import Repr\nfrom traceback import format_exception_only\n\n\n\n\ndef pathdirs():\n ''\n dirs=[]\n normdirs=[]\n for dir in sys.path:\n dir=os.path.abspath(dir or '.')\n normdir=os.path.normcase(dir)\n if normdir not in normdirs and os.path.isdir(dir):\n dirs.append(dir)\n normdirs.append(normdir)\n return dirs\n \ndef _findclass(func):\n cls=sys.modules.get(func.__module__)\n if cls is None:\n return None\n for name in func.__qualname__.split('.')[:-1]:\n cls=getattr(cls,name)\n if not inspect.isclass(cls):\n return None\n return cls\n \ndef _finddoc(obj):\n if inspect.ismethod(obj):\n name=obj.__func__.__name__\n self=obj.__self__\n if(inspect.isclass(self)and\n getattr(getattr(self,name,None),'__func__')is obj.__func__):\n \n cls=self\n else:\n cls=self.__class__\n elif inspect.isfunction(obj):\n name=obj.__name__\n cls=_findclass(obj)\n if cls is None or getattr(cls,name)is not obj:\n return None\n elif inspect.isbuiltin(obj):\n name=obj.__name__\n self=obj.__self__\n if(inspect.isclass(self)and\n self.__qualname__+'.'+name ==obj.__qualname__):\n \n cls=self\n else:\n cls=self.__class__\n \n elif isinstance(obj,property):\n func=obj.fget\n name=func.__name__\n cls=_findclass(func)\n if cls is None or getattr(cls,name)is not obj:\n return None\n elif inspect.ismethoddescriptor(obj)or inspect.isdatadescriptor(obj):\n name=obj.__name__\n cls=obj.__objclass__\n if getattr(cls,name)is not obj:\n return None\n if inspect.ismemberdescriptor(obj):\n slots=getattr(cls,'__slots__',None)\n if isinstance(slots,dict)and name in slots:\n return slots[name]\n else:\n return None\n for base in cls.__mro__:\n try:\n doc=_getowndoc(getattr(base,name))\n except AttributeError:\n continue\n if doc is not None:\n return doc\n return None\n \ndef _getowndoc(obj):\n ''\n \n try:\n doc=object.__getattribute__(obj,'__doc__')\n if doc is None:\n return None\n if obj is not type:\n typedoc=type(obj).__doc__\n if isinstance(typedoc,str)and typedoc ==doc:\n return None\n return doc\n except AttributeError:\n return None\n \ndef _getdoc(object):\n ''\n\n\n\n \n doc=_getowndoc(object)\n if doc is None:\n try:\n doc=_finddoc(object)\n except(AttributeError,TypeError):\n return None\n if not isinstance(doc,str):\n return None\n return inspect.cleandoc(doc)\n \ndef getdoc(object):\n ''\n result=_getdoc(object)or inspect.getcomments(object)\n return result and re.sub('^ *\\n','',result.rstrip())or ''\n \ndef splitdoc(doc):\n ''\n lines=doc.strip().split('\\n')\n if len(lines)==1:\n return lines[0],''\n elif len(lines)>=2 and not lines[1].rstrip():\n return lines[0],'\\n'.join(lines[2:])\n return '','\\n'.join(lines)\n \ndef classname(object,modname):\n ''\n name=object.__name__\n if object.__module__ !=modname:\n name=object.__module__+'.'+name\n return name\n \ndef isdata(object):\n ''\n return not(inspect.ismodule(object)or inspect.isclass(object)or\n inspect.isroutine(object)or inspect.isframe(object)or\n inspect.istraceback(object)or inspect.iscode(object))\n \ndef replace(text,*pairs):\n ''\n while pairs:\n text=pairs[1].join(text.split(pairs[0]))\n pairs=pairs[2:]\n return text\n \ndef cram(text,maxlen):\n ''\n if len(text)>maxlen:\n pre=max(0,(maxlen -3)//2)\n post=max(0,maxlen -3 -pre)\n return text[:pre]+'...'+text[len(text)-post:]\n return text\n \n_re_stripid=re.compile(r' at 0x[0-9a-f]{6,16}(>+)$',re.IGNORECASE)\ndef stripid(text):\n ''\n \n return _re_stripid.sub(r'\\1',text)\n \ndef _is_bound_method(fn):\n ''\n\n\n \n if inspect.ismethod(fn):\n return True\n if inspect.isbuiltin(fn):\n self=getattr(fn,'__self__',None)\n return not(inspect.ismodule(self)or(self is None))\n return False\n \n \ndef allmethods(cl):\n methods={}\n for key,value in inspect.getmembers(cl,inspect.isroutine):\n methods[key]=1\n for base in cl.__bases__:\n methods.update(allmethods(base))\n for key in methods.keys():\n methods[key]=getattr(cl,key)\n return methods\n \ndef _split_list(s,predicate):\n ''\n\n\n\n\n \n \n yes=[]\n no=[]\n for x in s:\n if predicate(x):\n yes.append(x)\n else:\n no.append(x)\n return yes,no\n \n_future_feature_names=set(__future__.all_feature_names)\n\ndef visiblename(name,all=None,obj=None):\n ''\n \n \n if name in{'__author__','__builtins__','__cached__','__credits__',\n '__date__','__doc__','__file__','__spec__',\n '__loader__','__module__','__name__','__package__',\n '__path__','__qualname__','__slots__','__version__'}:\n return 0\n \n if name.startswith('__')and name.endswith('__'):return 1\n \n if name.startswith('_')and hasattr(obj,'_fields'):\n return True\n \n if obj is not __future__ and name in _future_feature_names:\n if isinstance(getattr(obj,name,None),__future__._Feature):\n return False\n if all is not None:\n \n return name in all\n else:\n return not name.startswith('_')\n \ndef classify_class_attrs(object):\n ''\n results=[]\n for(name,kind,cls,value)in inspect.classify_class_attrs(object):\n if inspect.isdatadescriptor(value):\n kind='data descriptor'\n if isinstance(value,property)and value.fset is None:\n kind='readonly property'\n results.append((name,kind,cls,value))\n return results\n \ndef sort_attributes(attrs,object):\n ''\n \n \n fields=getattr(object,'_fields',[])\n try:\n field_order={name:i -len(fields)for(i,name)in enumerate(fields)}\n except TypeError:\n field_order={}\n keyfunc=lambda attr:(field_order.get(attr[0],0),attr[0])\n attrs.sort(key=keyfunc)\n \n \n \ndef ispackage(path):\n ''\n if os.path.isdir(path):\n for ext in('.py','.pyc'):\n if os.path.isfile(os.path.join(path,'__init__'+ext)):\n return True\n return False\n \ndef source_synopsis(file):\n line=file.readline()\n while line[:1]=='#'or not line.strip():\n line=file.readline()\n if not line:break\n line=line.strip()\n if line[:4]=='r\"\"\"':line=line[1:]\n if line[:3]=='\"\"\"':\n line=line[3:]\n if line[-1:]=='\\\\':line=line[:-1]\n while not line.strip():\n line=file.readline()\n if not line:break\n result=line.split('\"\"\"')[0].strip()\n else:result=None\n return result\n \ndef synopsis(filename,cache={}):\n ''\n mtime=os.stat(filename).st_mtime\n lastupdate,result=cache.get(filename,(None,None))\n if lastupdate is None or lastupdate ','>')\n \n def repr(self,object):\n return Repr.repr(self,object)\n \n def repr1(self,x,level):\n if hasattr(type(x),'__name__'):\n methodname='repr_'+'_'.join(type(x).__name__.split())\n if hasattr(self,methodname):\n return getattr(self,methodname)(x,level)\n return self.escape(cram(stripid(repr(x)),self.maxother))\n \n def repr_string(self,x,level):\n test=cram(x,self.maxstring)\n testrepr=repr(test)\n if '\\\\'in test and '\\\\'not in replace(testrepr,r'\\\\',''):\n \n \n return 'r'+testrepr[0]+self.escape(test)+testrepr[0]\n return re.sub(r'((\\\\[\\\\abfnrtv\\'\"]|\\\\[0-9]..|\\\\x..|\\\\u....)+)',\n r'\\1',\n self.escape(testrepr))\n \n repr_str=repr_string\n \n def repr_instance(self,x,level):\n try:\n return self.escape(cram(stripid(repr(x)),self.maxstring))\n except:\n return self.escape('<%s instance>'%x.__class__.__name__)\n \n repr_unicode=repr_string\n \nclass HTMLDoc(Doc):\n ''\n \n \n \n _repr_instance=HTMLRepr()\n repr=_repr_instance.repr\n escape=_repr_instance.escape\n \n def page(self,title,contents):\n ''\n return '''\\\n\n\n\n\nPython: %s\n\n%s\n'''%(title,contents)\n \n def heading(self,title,extras=''):\n ''\n return '''\n\n\n\n
 
%s
%s
\n '''%(title,extras or ' ')\n \n def section(self,title,cls,contents,width=6,\n prelude='',marginalia=None,gap=' '):\n ''\n if marginalia is None:\n marginalia=''+' '*width+''\n result='''

\n\n\n\n '''%(cls,title)\n if prelude:\n result=result+'''\n\n\n'''%(cls,marginalia,cls,prelude,gap)\n else:\n result=result+'''\n'''%(cls,marginalia,gap)\n \n return result+'\\n
 
%s
%s%s
%s
%s%s%s
'%contents\n \n def bigsection(self,title,*args):\n ''\n title='%s'%title\n return self.section(title,*args)\n \n def preformat(self,text):\n ''\n text=self.escape(text.expandtabs())\n return replace(text,'\\n\\n','\\n \\n','\\n\\n','\\n \\n',\n ' ',' ','\\n','
\\n')\n \n def multicolumn(self,list,format):\n ''\n result=''\n rows=(len(list)+3)//4\n for col in range(4):\n result=result+''\n for i in range(rows *col,rows *col+rows):\n if i \\n'\n result=result+''\n return '%s
'%result\n \n def grey(self,text):return '%s'%text\n \n def namelink(self,name,*dicts):\n ''\n for dict in dicts:\n if name in dict:\n return '
%s'%(dict[name],name)\n return name\n \n def classlink(self,object,modname):\n ''\n name,module=object.__name__,sys.modules.get(object.__module__)\n if hasattr(module,name)and getattr(module,name)is object:\n return '%s'%(\n module.__name__,name,classname(object,modname))\n return classname(object,modname)\n \n def modulelink(self,object):\n ''\n return '%s'%(object.__name__,object.__name__)\n \n def modpkglink(self,modpkginfo):\n ''\n name,path,ispackage,shadowed=modpkginfo\n if shadowed:\n return self.grey(name)\n if path:\n url='%s.%s.html'%(path,name)\n else:\n url='%s.html'%name\n if ispackage:\n text='%s (package)'%name\n else:\n text=name\n return '%s'%(url,text)\n \n def filelink(self,url,path):\n ''\n return '%s'%(url,path)\n \n def markup(self,text,escape=None,funcs={},classes={},methods={}):\n ''\n \n escape=escape or self.escape\n results=[]\n here=0\n pattern=re.compile(r'\\b((http|https|ftp)://\\S+[\\w/]|'\n r'RFC[- ]?(\\d+)|'\n r'PEP[- ]?(\\d+)|'\n r'(self\\.)?(\\w+))')\n while match :=pattern.search(text,here):\n start,end=match.span()\n results.append(escape(text[here:start]))\n \n all,scheme,rfc,pep,selfdot,name=match.groups()\n if scheme:\n url=escape(all).replace('\"','"')\n results.append('%s'%(url,url))\n elif rfc:\n url='https://www.rfc-editor.org/rfc/rfc%d.txt'%int(rfc)\n results.append('%s'%(url,escape(all)))\n elif pep:\n url='https://peps.python.org/pep-%04d/'%int(pep)\n results.append('%s'%(url,escape(all)))\n elif selfdot:\n \n \n if text[end:end+1]=='(':\n results.append('self.'+self.namelink(name,methods))\n else:\n results.append('self.%s'%name)\n elif text[end:end+1]=='(':\n results.append(self.namelink(name,methods,funcs,classes))\n else:\n results.append(self.namelink(name,classes))\n here=end\n results.append(escape(text[here:]))\n return ''.join(results)\n \n \n \n def formattree(self,tree,modname,parent=None):\n ''\n result=''\n for entry in tree:\n if isinstance(entry,tuple):\n c,bases=entry\n result=result+'

'\n result=result+self.classlink(c,modname)\n if bases and bases !=(parent,):\n parents=[]\n for base in bases:\n parents.append(self.classlink(base,modname))\n result=result+'('+', '.join(parents)+')'\n result=result+'\\n
'\n elif isinstance(entry,list):\n result=result+'
\\n%s
\\n'%self.formattree(\n entry,modname,c)\n return '
\\n%s
\\n'%result\n \n def docmodule(self,object,name=None,mod=None,*ignored):\n ''\n name=object.__name__\n try:\n all=object.__all__\n except AttributeError:\n all=None\n parts=name.split('.')\n links=[]\n for i in range(len(parts)-1):\n links.append(\n '%s'%\n ('.'.join(parts[:i+1]),parts[i]))\n linkedname='.'.join(links+parts[-1:])\n head='%s'%linkedname\n try:\n path=inspect.getabsfile(object)\n url=urllib.parse.quote(path)\n filelink=self.filelink(url,path)\n except TypeError:\n filelink='(built-in)'\n info=[]\n if hasattr(object,'__version__'):\n version=str(object.__version__)\n if version[:11]=='$'+'Revision: 'and version[-1:]=='$':\n version=version[11:-1].strip()\n info.append('version %s'%self.escape(version))\n if hasattr(object,'__date__'):\n info.append(self.escape(str(object.__date__)))\n if info:\n head=head+' (%s)'%', '.join(info)\n docloc=self.getdocloc(object)\n if docloc is not None:\n docloc='
Module Reference'%locals()\n else:\n docloc=''\n result=self.heading(head,'index
'+filelink+docloc)\n \n modules=inspect.getmembers(object,inspect.ismodule)\n \n classes,cdict=[],{}\n for key,value in inspect.getmembers(object,inspect.isclass):\n \n if(all is not None or\n (inspect.getmodule(value)or object)is object):\n if visiblename(key,all,object):\n classes.append((key,value))\n cdict[key]=cdict[value]='#'+key\n for key,value in classes:\n for base in value.__bases__:\n key,modname=base.__name__,base.__module__\n module=sys.modules.get(modname)\n if modname !=name and module and hasattr(module,key):\n if getattr(module,key)is base:\n if not key in cdict:\n cdict[key]=cdict[base]=modname+'.html#'+key\n funcs,fdict=[],{}\n for key,value in inspect.getmembers(object,inspect.isroutine):\n \n if(all is not None or\n inspect.isbuiltin(value)or inspect.getmodule(value)is object):\n if visiblename(key,all,object):\n funcs.append((key,value))\n fdict[key]='#-'+key\n if inspect.isfunction(value):fdict[value]=fdict[key]\n data=[]\n for key,value in inspect.getmembers(object,isdata):\n if visiblename(key,all,object):\n data.append((key,value))\n \n doc=self.markup(getdoc(object),self.preformat,fdict,cdict)\n doc=doc and '%s'%doc\n result=result+'

%s

\\n'%doc\n \n if hasattr(object,'__path__'):\n modpkgs=[]\n for importer,modname,ispkg in pkgutil.iter_modules(object.__path__):\n modpkgs.append((modname,name,ispkg,0))\n modpkgs.sort()\n contents=self.multicolumn(modpkgs,self.modpkglink)\n result=result+self.bigsection(\n 'Package Contents','pkg-content',contents)\n elif modules:\n contents=self.multicolumn(\n modules,lambda t:self.modulelink(t[1]))\n result=result+self.bigsection(\n 'Modules','pkg-content',contents)\n \n if classes:\n classlist=[value for(key,value)in classes]\n contents=[\n self.formattree(inspect.getclasstree(classlist,1),name)]\n for key,value in classes:\n contents.append(self.document(value,key,name,fdict,cdict))\n result=result+self.bigsection(\n 'Classes','index',' '.join(contents))\n if funcs:\n contents=[]\n for key,value in funcs:\n contents.append(self.document(value,key,name,fdict,cdict))\n result=result+self.bigsection(\n 'Functions','functions',' '.join(contents))\n if data:\n contents=[]\n for key,value in data:\n contents.append(self.document(value,key))\n result=result+self.bigsection(\n 'Data','data','
\\n'.join(contents))\n if hasattr(object,'__author__'):\n contents=self.markup(str(object.__author__),self.preformat)\n result=result+self.bigsection('Author','author',contents)\n if hasattr(object,'__credits__'):\n contents=self.markup(str(object.__credits__),self.preformat)\n result=result+self.bigsection('Credits','credits',contents)\n \n return result\n \n def docclass(self,object,name=None,mod=None,funcs={},classes={},\n *ignored):\n ''\n realname=object.__name__\n name=name or realname\n bases=object.__bases__\n \n contents=[]\n push=contents.append\n \n \n class HorizontalRule:\n def __init__(self):\n self.needone=0\n def maybe(self):\n if self.needone:\n push('
\\n')\n self.needone=1\n hr=HorizontalRule()\n \n \n mro=deque(inspect.getmro(object))\n if len(mro)>2:\n hr.maybe()\n push('
Method resolution order:
\\n')\n for base in mro:\n push('
%s
\\n'%self.classlink(base,\n object.__module__))\n push('
\\n')\n \n def spill(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n try:\n value=getattr(object,name)\n except Exception:\n \n \n push(self.docdata(value,name,mod))\n else:\n push(self.document(value,name,mod,\n funcs,classes,mdict,object))\n push('\\n')\n return attrs\n \n def spilldescriptors(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n push(self.docdata(value,name,mod))\n return attrs\n \n def spilldata(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n base=self.docother(getattr(object,name),name,mod)\n doc=getdoc(value)\n if not doc:\n push('
%s
\\n'%base)\n else:\n doc=self.markup(getdoc(value),self.preformat,\n funcs,classes,mdict)\n doc='
%s'%doc\n push('
%s%s
\\n'%(base,doc))\n push('\\n')\n return attrs\n \n attrs=[(name,kind,cls,value)\n for name,kind,cls,value in classify_class_attrs(object)\n if visiblename(name,obj=object)]\n \n mdict={}\n for key,kind,homecls,value in attrs:\n mdict[key]=anchor='#'+name+'-'+key\n try:\n value=getattr(object,name)\n except Exception:\n \n \n pass\n try:\n \n \n mdict[value]=anchor\n except TypeError:\n pass\n \n while attrs:\n if mro:\n thisclass=mro.popleft()\n else:\n thisclass=attrs[0][2]\n attrs,inherited=_split_list(attrs,lambda t:t[2]is thisclass)\n \n if object is not builtins.object and thisclass is builtins.object:\n attrs=inherited\n continue\n elif thisclass is object:\n tag='defined here'\n else:\n tag='inherited from %s'%self.classlink(thisclass,\n object.__module__)\n tag +=':
\\n'\n \n sort_attributes(attrs,object)\n \n \n attrs=spill('Methods %s'%tag,attrs,\n lambda t:t[1]=='method')\n attrs=spill('Class methods %s'%tag,attrs,\n lambda t:t[1]=='class method')\n attrs=spill('Static methods %s'%tag,attrs,\n lambda t:t[1]=='static method')\n attrs=spilldescriptors(\"Readonly properties %s\"%tag,attrs,\n lambda t:t[1]=='readonly property')\n attrs=spilldescriptors('Data descriptors %s'%tag,attrs,\n lambda t:t[1]=='data descriptor')\n attrs=spilldata('Data and other attributes %s'%tag,attrs,\n lambda t:t[1]=='data')\n assert attrs ==[]\n attrs=inherited\n \n contents=''.join(contents)\n \n if name ==realname:\n title='class %s'%(\n name,realname)\n else:\n title='%s = class %s'%(\n name,name,realname)\n if bases:\n parents=[]\n for base in bases:\n parents.append(self.classlink(base,object.__module__))\n title=title+'(%s)'%', '.join(parents)\n \n decl=''\n try:\n signature=inspect.signature(object)\n except(ValueError,TypeError):\n signature=None\n if signature:\n argspec=str(signature)\n if argspec and argspec !='()':\n decl=name+self.escape(argspec)+'\\n\\n'\n \n doc=getdoc(object)\n if decl:\n doc=decl+(doc or '')\n doc=self.markup(doc,self.preformat,funcs,classes,mdict)\n doc=doc and '%s
 
'%doc\n \n return self.section(title,'title',contents,3,doc)\n \n def formatvalue(self,object):\n ''\n return self.grey('='+self.repr(object))\n \n def docroutine(self,object,name=None,mod=None,\n funcs={},classes={},methods={},cl=None):\n ''\n realname=object.__name__\n name=name or realname\n anchor=(cl and cl.__name__ or '')+'-'+name\n note=''\n skipdocs=0\n if _is_bound_method(object):\n imclass=object.__self__.__class__\n if cl:\n if imclass is not cl:\n note=' from '+self.classlink(imclass,mod)\n else:\n if object.__self__ is not None:\n note=' method of %s instance'%self.classlink(\n object.__self__.__class__,mod)\n else:\n note=' unbound %s method'%self.classlink(imclass,mod)\n \n if(inspect.iscoroutinefunction(object)or\n inspect.isasyncgenfunction(object)):\n asyncqualifier='async '\n else:\n asyncqualifier=''\n \n if name ==realname:\n title='%s'%(anchor,realname)\n else:\n if cl and inspect.getattr_static(cl,realname,[])is object:\n reallink='%s'%(\n cl.__name__+'-'+realname,realname)\n skipdocs=1\n else:\n reallink=realname\n title='%s = %s'%(\n anchor,name,reallink)\n argspec=None\n if inspect.isroutine(object):\n try:\n signature=inspect.signature(object)\n except(ValueError,TypeError):\n signature=None\n if signature:\n argspec=str(signature)\n if realname =='':\n title='%s lambda '%name\n \n \n \n argspec=argspec[1:-1]\n if not argspec:\n argspec='(...)'\n \n decl=asyncqualifier+title+self.escape(argspec)+(note and\n self.grey('%s'%note))\n \n if skipdocs:\n return '
%s
\\n'%decl\n else:\n doc=self.markup(\n getdoc(object),self.preformat,funcs,classes,methods)\n doc=doc and '
%s
'%doc\n return '
%s
%s
\\n'%(decl,doc)\n \n def docdata(self,object,name=None,mod=None,cl=None):\n ''\n results=[]\n push=results.append\n \n if name:\n push('
%s
\\n'%name)\n doc=self.markup(getdoc(object),self.preformat)\n if doc:\n push('
%s
\\n'%doc)\n push('
\\n')\n \n return ''.join(results)\n \n docproperty=docdata\n \n def docother(self,object,name=None,mod=None,*ignored):\n ''\n lhs=name and '%s = '%name or ''\n return lhs+self.repr(object)\n \n def index(self,dir,shadowed=None):\n ''\n modpkgs=[]\n if shadowed is None:shadowed={}\n for importer,name,ispkg in pkgutil.iter_modules([dir]):\n if any((0xD800 <=ord(ch)<=0xDFFF)for ch in name):\n \n continue\n modpkgs.append((name,'',ispkg,name in shadowed))\n shadowed[name]=1\n \n modpkgs.sort()\n contents=self.multicolumn(modpkgs,self.modpkglink)\n return self.bigsection(dir,'index',contents)\n \n \n \nclass TextRepr(Repr):\n ''\n def __init__(self):\n Repr.__init__(self)\n self.maxlist=self.maxtuple=20\n self.maxdict=10\n self.maxstring=self.maxother=100\n \n def repr1(self,x,level):\n if hasattr(type(x),'__name__'):\n methodname='repr_'+'_'.join(type(x).__name__.split())\n if hasattr(self,methodname):\n return getattr(self,methodname)(x,level)\n return cram(stripid(repr(x)),self.maxother)\n \n def repr_string(self,x,level):\n test=cram(x,self.maxstring)\n testrepr=repr(test)\n if '\\\\'in test and '\\\\'not in replace(testrepr,r'\\\\',''):\n \n \n return 'r'+testrepr[0]+test+testrepr[0]\n return testrepr\n \n repr_str=repr_string\n \n def repr_instance(self,x,level):\n try:\n return cram(stripid(repr(x)),self.maxstring)\n except:\n return '<%s instance>'%x.__class__.__name__\n \nclass TextDoc(Doc):\n ''\n \n \n \n _repr_instance=TextRepr()\n repr=_repr_instance.repr\n \n def bold(self,text):\n ''\n return ''.join(ch+'\\b'+ch for ch in text)\n \n def indent(self,text,prefix=' '):\n ''\n if not text:return ''\n lines=[(prefix+line).rstrip()for line in text.split('\\n')]\n return '\\n'.join(lines)\n \n def section(self,title,contents):\n ''\n clean_contents=self.indent(contents).rstrip()\n return self.bold(title)+'\\n'+clean_contents+'\\n\\n'\n \n \n \n def formattree(self,tree,modname,parent=None,prefix=''):\n ''\n result=''\n for entry in tree:\n if isinstance(entry,tuple):\n c,bases=entry\n result=result+prefix+classname(c,modname)\n if bases and bases !=(parent,):\n parents=(classname(c,modname)for c in bases)\n result=result+'(%s)'%', '.join(parents)\n result=result+'\\n'\n elif isinstance(entry,list):\n result=result+self.formattree(\n entry,modname,c,prefix+' ')\n return result\n \n def docmodule(self,object,name=None,mod=None):\n ''\n name=object.__name__\n synop,desc=splitdoc(getdoc(object))\n result=self.section('NAME',name+(synop and ' - '+synop))\n all=getattr(object,'__all__',None)\n docloc=self.getdocloc(object)\n if docloc is not None:\n result=result+self.section('MODULE REFERENCE',docloc+\"\"\"\n\nThe following documentation is automatically generated from the Python\nsource files. It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations. When in doubt, consult the module reference at the\nlocation listed above.\n\"\"\")\n \n if desc:\n result=result+self.section('DESCRIPTION',desc)\n \n classes=[]\n for key,value in inspect.getmembers(object,inspect.isclass):\n \n if(all is not None\n or(inspect.getmodule(value)or object)is object):\n if visiblename(key,all,object):\n classes.append((key,value))\n funcs=[]\n for key,value in inspect.getmembers(object,inspect.isroutine):\n \n if(all is not None or\n inspect.isbuiltin(value)or inspect.getmodule(value)is object):\n if visiblename(key,all,object):\n funcs.append((key,value))\n data=[]\n for key,value in inspect.getmembers(object,isdata):\n if visiblename(key,all,object):\n data.append((key,value))\n \n modpkgs=[]\n modpkgs_names=set()\n if hasattr(object,'__path__'):\n for importer,modname,ispkg in pkgutil.iter_modules(object.__path__):\n modpkgs_names.add(modname)\n if ispkg:\n modpkgs.append(modname+' (package)')\n else:\n modpkgs.append(modname)\n \n modpkgs.sort()\n result=result+self.section(\n 'PACKAGE CONTENTS','\\n'.join(modpkgs))\n \n \n submodules=[]\n for key,value in inspect.getmembers(object,inspect.ismodule):\n if value.__name__.startswith(name+'.')and key not in modpkgs_names:\n submodules.append(key)\n if submodules:\n submodules.sort()\n result=result+self.section(\n 'SUBMODULES','\\n'.join(submodules))\n \n if classes:\n classlist=[value for key,value in classes]\n contents=[self.formattree(\n inspect.getclasstree(classlist,1),name)]\n for key,value in classes:\n contents.append(self.document(value,key,name))\n result=result+self.section('CLASSES','\\n'.join(contents))\n \n if funcs:\n contents=[]\n for key,value in funcs:\n contents.append(self.document(value,key,name))\n result=result+self.section('FUNCTIONS','\\n'.join(contents))\n \n if data:\n contents=[]\n for key,value in data:\n contents.append(self.docother(value,key,name,maxlen=70))\n result=result+self.section('DATA','\\n'.join(contents))\n \n if hasattr(object,'__version__'):\n version=str(object.__version__)\n if version[:11]=='$'+'Revision: 'and version[-1:]=='$':\n version=version[11:-1].strip()\n result=result+self.section('VERSION',version)\n if hasattr(object,'__date__'):\n result=result+self.section('DATE',str(object.__date__))\n if hasattr(object,'__author__'):\n result=result+self.section('AUTHOR',str(object.__author__))\n if hasattr(object,'__credits__'):\n result=result+self.section('CREDITS',str(object.__credits__))\n try:\n file=inspect.getabsfile(object)\n except TypeError:\n file='(built-in)'\n result=result+self.section('FILE',file)\n return result\n \n def docclass(self,object,name=None,mod=None,*ignored):\n ''\n realname=object.__name__\n name=name or realname\n bases=object.__bases__\n \n def makename(c,m=object.__module__):\n return classname(c,m)\n \n if name ==realname:\n title='class '+self.bold(realname)\n else:\n title=self.bold(name)+' = class '+realname\n if bases:\n parents=map(makename,bases)\n title=title+'(%s)'%', '.join(parents)\n \n contents=[]\n push=contents.append\n \n try:\n signature=inspect.signature(object)\n except(ValueError,TypeError):\n signature=None\n if signature:\n argspec=str(signature)\n if argspec and argspec !='()':\n push(name+argspec+'\\n')\n \n doc=getdoc(object)\n if doc:\n push(doc+'\\n')\n \n \n mro=deque(inspect.getmro(object))\n if len(mro)>2:\n push(\"Method resolution order:\")\n for base in mro:\n push(' '+makename(base))\n push('')\n \n \n subclasses=sorted(\n (str(cls.__name__)for cls in type.__subclasses__(object)\n if not cls.__name__.startswith(\"_\")and cls.__module__ ==\"builtins\"),\n key=str.lower\n )\n no_of_subclasses=len(subclasses)\n MAX_SUBCLASSES_TO_DISPLAY=4\n if subclasses:\n push(\"Built-in subclasses:\")\n for subclassname in subclasses[:MAX_SUBCLASSES_TO_DISPLAY]:\n push(' '+subclassname)\n if no_of_subclasses >MAX_SUBCLASSES_TO_DISPLAY:\n push(' ... and '+\n str(no_of_subclasses -MAX_SUBCLASSES_TO_DISPLAY)+\n ' other subclasses')\n push('')\n \n \n class HorizontalRule:\n def __init__(self):\n self.needone=0\n def maybe(self):\n if self.needone:\n push('-'*70)\n self.needone=1\n hr=HorizontalRule()\n \n def spill(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n try:\n value=getattr(object,name)\n except Exception:\n \n \n push(self.docdata(value,name,mod))\n else:\n push(self.document(value,\n name,mod,object))\n return attrs\n \n def spilldescriptors(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n push(self.docdata(value,name,mod))\n return attrs\n \n def spilldata(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n doc=getdoc(value)\n try:\n obj=getattr(object,name)\n except AttributeError:\n obj=homecls.__dict__[name]\n push(self.docother(obj,name,mod,maxlen=70,doc=doc)+\n '\\n')\n return attrs\n \n attrs=[(name,kind,cls,value)\n for name,kind,cls,value in classify_class_attrs(object)\n if visiblename(name,obj=object)]\n \n while attrs:\n if mro:\n thisclass=mro.popleft()\n else:\n thisclass=attrs[0][2]\n attrs,inherited=_split_list(attrs,lambda t:t[2]is thisclass)\n \n if object is not builtins.object and thisclass is builtins.object:\n attrs=inherited\n continue\n elif thisclass is object:\n tag=\"defined here\"\n else:\n tag=\"inherited from %s\"%classname(thisclass,\n object.__module__)\n \n sort_attributes(attrs,object)\n \n \n attrs=spill(\"Methods %s:\\n\"%tag,attrs,\n lambda t:t[1]=='method')\n attrs=spill(\"Class methods %s:\\n\"%tag,attrs,\n lambda t:t[1]=='class method')\n attrs=spill(\"Static methods %s:\\n\"%tag,attrs,\n lambda t:t[1]=='static method')\n attrs=spilldescriptors(\"Readonly properties %s:\\n\"%tag,attrs,\n lambda t:t[1]=='readonly property')\n attrs=spilldescriptors(\"Data descriptors %s:\\n\"%tag,attrs,\n lambda t:t[1]=='data descriptor')\n attrs=spilldata(\"Data and other attributes %s:\\n\"%tag,attrs,\n lambda t:t[1]=='data')\n \n assert attrs ==[]\n attrs=inherited\n \n contents='\\n'.join(contents)\n if not contents:\n return title+'\\n'\n return title+'\\n'+self.indent(contents.rstrip(),' | ')+'\\n'\n \n def formatvalue(self,object):\n ''\n return '='+self.repr(object)\n \n def docroutine(self,object,name=None,mod=None,cl=None):\n ''\n realname=object.__name__\n name=name or realname\n note=''\n skipdocs=0\n if _is_bound_method(object):\n imclass=object.__self__.__class__\n if cl:\n if imclass is not cl:\n note=' from '+classname(imclass,mod)\n else:\n if object.__self__ is not None:\n note=' method of %s instance'%classname(\n object.__self__.__class__,mod)\n else:\n note=' unbound %s method'%classname(imclass,mod)\n \n if(inspect.iscoroutinefunction(object)or\n inspect.isasyncgenfunction(object)):\n asyncqualifier='async '\n else:\n asyncqualifier=''\n \n if name ==realname:\n title=self.bold(realname)\n else:\n if cl and inspect.getattr_static(cl,realname,[])is object:\n skipdocs=1\n title=self.bold(name)+' = '+realname\n argspec=None\n \n if inspect.isroutine(object):\n try:\n signature=inspect.signature(object)\n except(ValueError,TypeError):\n signature=None\n if signature:\n argspec=str(signature)\n if realname =='':\n title=self.bold(name)+' lambda '\n \n \n \n argspec=argspec[1:-1]\n if not argspec:\n argspec='(...)'\n decl=asyncqualifier+title+argspec+note\n \n if skipdocs:\n return decl+'\\n'\n else:\n doc=getdoc(object)or ''\n return decl+'\\n'+(doc and self.indent(doc).rstrip()+'\\n')\n \n def docdata(self,object,name=None,mod=None,cl=None):\n ''\n results=[]\n push=results.append\n \n if name:\n push(self.bold(name))\n push('\\n')\n doc=getdoc(object)or ''\n if doc:\n push(self.indent(doc))\n push('\\n')\n return ''.join(results)\n \n docproperty=docdata\n \n def docother(self,object,name=None,mod=None,parent=None,maxlen=None,doc=None):\n ''\n repr=self.repr(object)\n if maxlen:\n line=(name and name+' = 'or '')+repr\n chop=maxlen -len(line)\n if chop <0:repr=repr[:chop]+'...'\n line=(name and self.bold(name)+' = 'or '')+repr\n if not doc:\n doc=getdoc(object)\n if doc:\n line +='\\n'+self.indent(str(doc))+'\\n'\n return line\n \nclass _PlainTextDoc(TextDoc):\n ''\n def bold(self,text):\n return text\n \n \n \ndef pager(text):\n ''\n global pager\n pager=getpager()\n pager(text)\n \ndef getpager():\n ''\n if not hasattr(sys.stdin,\"isatty\"):\n return plainpager\n if not hasattr(sys.stdout,\"isatty\"):\n return plainpager\n if not sys.stdin.isatty()or not sys.stdout.isatty():\n return plainpager\n if sys.platform ==\"emscripten\":\n return plainpager\n use_pager=os.environ.get('MANPAGER')or os.environ.get('PAGER')\n if use_pager:\n if sys.platform =='win32':\n return lambda text:tempfilepager(plain(text),use_pager)\n elif os.environ.get('TERM')in('dumb','emacs'):\n return lambda text:pipepager(plain(text),use_pager)\n else:\n return lambda text:pipepager(text,use_pager)\n if os.environ.get('TERM')in('dumb','emacs'):\n return plainpager\n if sys.platform =='win32':\n return lambda text:tempfilepager(plain(text),'more <')\n if hasattr(os,'system')and os.system('(less) 2>/dev/null')==0:\n return lambda text:pipepager(text,'less')\n \n import tempfile\n (fd,filename)=tempfile.mkstemp()\n os.close(fd)\n try:\n if hasattr(os,'system')and os.system('more \"%s\"'%filename)==0:\n return lambda text:pipepager(text,'more')\n else:\n return ttypager\n finally:\n os.unlink(filename)\n \ndef plain(text):\n ''\n return re.sub('.\\b','',text)\n \ndef pipepager(text,cmd):\n ''\n import subprocess\n proc=subprocess.Popen(cmd,shell=True,stdin=subprocess.PIPE,\n errors='backslashreplace')\n try:\n with proc.stdin as pipe:\n try:\n pipe.write(text)\n except KeyboardInterrupt:\n \n \n pass\n except OSError:\n pass\n while True:\n try:\n proc.wait()\n break\n except KeyboardInterrupt:\n \n \n pass\n \ndef tempfilepager(text,cmd):\n ''\n import tempfile\n with tempfile.TemporaryDirectory()as tempdir:\n filename=os.path.join(tempdir,'pydoc.out')\n with open(filename,'w',errors='backslashreplace',\n encoding=os.device_encoding(0)if\n sys.platform =='win32'else None\n )as file:\n file.write(text)\n os.system(cmd+' \"'+filename+'\"')\n \ndef _escape_stdout(text):\n\n encoding=getattr(sys.stdout,'encoding',None)or 'utf-8'\n return text.encode(encoding,'backslashreplace').decode(encoding)\n \ndef ttypager(text):\n ''\n lines=plain(_escape_stdout(text)).split('\\n')\n try:\n import tty\n fd=sys.stdin.fileno()\n old=tty.tcgetattr(fd)\n tty.setcbreak(fd)\n getchar=lambda:sys.stdin.read(1)\n except(ImportError,AttributeError,io.UnsupportedOperation):\n tty=None\n getchar=lambda:sys.stdin.readline()[:-1][:1]\n \n try:\n try:\n h=int(os.environ.get('LINES',0))\n except ValueError:\n h=0\n if h <=1:\n h=25\n r=inc=h -1\n sys.stdout.write('\\n'.join(lines[:inc])+'\\n')\n while lines[r:]:\n sys.stdout.write('-- more --')\n sys.stdout.flush()\n c=getchar()\n \n if c in('q','Q'):\n sys.stdout.write('\\r \\r')\n break\n elif c in('\\r','\\n'):\n sys.stdout.write('\\r \\r'+lines[r]+'\\n')\n r=r+1\n continue\n if c in('b','B','\\x1b'):\n r=r -inc -inc\n if r <0:r=0\n sys.stdout.write('\\n'+'\\n'.join(lines[r:r+inc])+'\\n')\n r=r+inc\n \n finally:\n if tty:\n tty.tcsetattr(fd,tty.TCSAFLUSH,old)\n \ndef plainpager(text):\n ''\n sys.stdout.write(plain(_escape_stdout(text)))\n \ndef describe(thing):\n ''\n if inspect.ismodule(thing):\n if thing.__name__ in sys.builtin_module_names:\n return 'built-in module '+thing.__name__\n if hasattr(thing,'__path__'):\n return 'package '+thing.__name__\n else:\n return 'module '+thing.__name__\n if inspect.isbuiltin(thing):\n return 'built-in function '+thing.__name__\n if inspect.isgetsetdescriptor(thing):\n return 'getset descriptor %s.%s.%s'%(\n thing.__objclass__.__module__,thing.__objclass__.__name__,\n thing.__name__)\n if inspect.ismemberdescriptor(thing):\n return 'member descriptor %s.%s.%s'%(\n thing.__objclass__.__module__,thing.__objclass__.__name__,\n thing.__name__)\n if inspect.isclass(thing):\n return 'class '+thing.__name__\n if inspect.isfunction(thing):\n return 'function '+thing.__name__\n if inspect.ismethod(thing):\n return 'method '+thing.__name__\n return type(thing).__name__\n \ndef locate(path,forceload=0):\n ''\n parts=[part for part in path.split('.')if part]\n module,n=None,0\n while n >','&',\n '|','^','~','<','>','<=','>=','==','!=','<>'),\n 'COMPARISON':('<','>','<=','>=','==','!=','<>'),\n 'UNARY':('-','~'),\n 'AUGMENTEDASSIGNMENT':('+=','-=','*=','/=','%=','&=','|=',\n '^=','<<=','>>=','**=','//='),\n 'BITWISE':('<<','>>','&','|','^','~'),\n 'COMPLEX':('j','J')\n }\n symbols={\n '%':'OPERATORS FORMATTING',\n '**':'POWER',\n ',':'TUPLES LISTS FUNCTIONS',\n '.':'ATTRIBUTES FLOAT MODULES OBJECTS',\n '...':'ELLIPSIS',\n ':':'SLICINGS DICTIONARYLITERALS',\n '@':'def class',\n '\\\\':'STRINGS',\n '_':'PRIVATENAMES',\n '__':'PRIVATENAMES SPECIALMETHODS',\n '`':'BACKQUOTES',\n '(':'TUPLES FUNCTIONS CALLS',\n ')':'TUPLES FUNCTIONS CALLS',\n '[':'LISTS SUBSCRIPTS SLICINGS',\n ']':'LISTS SUBSCRIPTS SLICINGS'\n }\n for topic,symbols_ in _symbols_inverse.items():\n for symbol in symbols_:\n topics=symbols.get(symbol,topic)\n if topic not in topics:\n topics=topics+' '+topic\n symbols[symbol]=topics\n del topic,symbols_,symbol,topics\n \n topics={\n 'TYPES':('types','STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS '\n 'FUNCTIONS CLASSES MODULES FILES inspect'),\n 'STRINGS':('strings','str UNICODE SEQUENCES STRINGMETHODS '\n 'FORMATTING TYPES'),\n 'STRINGMETHODS':('string-methods','STRINGS FORMATTING'),\n 'FORMATTING':('formatstrings','OPERATORS'),\n 'UNICODE':('strings','encodings unicode SEQUENCES STRINGMETHODS '\n 'FORMATTING TYPES'),\n 'NUMBERS':('numbers','INTEGER FLOAT COMPLEX TYPES'),\n 'INTEGER':('integers','int range'),\n 'FLOAT':('floating','float math'),\n 'COMPLEX':('imaginary','complex cmath'),\n 'SEQUENCES':('typesseq','STRINGMETHODS FORMATTING range LISTS'),\n 'MAPPINGS':'DICTIONARIES',\n 'FUNCTIONS':('typesfunctions','def TYPES'),\n 'METHODS':('typesmethods','class def CLASSES TYPES'),\n 'CODEOBJECTS':('bltin-code-objects','compile FUNCTIONS TYPES'),\n 'TYPEOBJECTS':('bltin-type-objects','types TYPES'),\n 'FRAMEOBJECTS':'TYPES',\n 'TRACEBACKS':'TYPES',\n 'NONE':('bltin-null-object',''),\n 'ELLIPSIS':('bltin-ellipsis-object','SLICINGS'),\n 'SPECIALATTRIBUTES':('specialattrs',''),\n 'CLASSES':('types','class SPECIALMETHODS PRIVATENAMES'),\n 'MODULES':('typesmodules','import'),\n 'PACKAGES':'import',\n 'EXPRESSIONS':('operator-summary','lambda or and not in is BOOLEAN '\n 'COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER '\n 'UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES '\n 'LISTS DICTIONARIES'),\n 'OPERATORS':'EXPRESSIONS',\n 'PRECEDENCE':'EXPRESSIONS',\n 'OBJECTS':('objects','TYPES'),\n 'SPECIALMETHODS':('specialnames','BASICMETHODS ATTRIBUTEMETHODS '\n 'CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS '\n 'NUMBERMETHODS CLASSES'),\n 'BASICMETHODS':('customization','hash repr str SPECIALMETHODS'),\n 'ATTRIBUTEMETHODS':('attribute-access','ATTRIBUTES SPECIALMETHODS'),\n 'CALLABLEMETHODS':('callable-types','CALLS SPECIALMETHODS'),\n 'SEQUENCEMETHODS':('sequence-types','SEQUENCES SEQUENCEMETHODS '\n 'SPECIALMETHODS'),\n 'MAPPINGMETHODS':('sequence-types','MAPPINGS SPECIALMETHODS'),\n 'NUMBERMETHODS':('numeric-types','NUMBERS AUGMENTEDASSIGNMENT '\n 'SPECIALMETHODS'),\n 'EXECUTION':('execmodel','NAMESPACES DYNAMICFEATURES EXCEPTIONS'),\n 'NAMESPACES':('naming','global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES'),\n 'DYNAMICFEATURES':('dynamic-features',''),\n 'SCOPING':'NAMESPACES',\n 'FRAMES':'NAMESPACES',\n 'EXCEPTIONS':('exceptions','try except finally raise'),\n 'CONVERSIONS':('conversions',''),\n 'IDENTIFIERS':('identifiers','keywords SPECIALIDENTIFIERS'),\n 'SPECIALIDENTIFIERS':('id-classes',''),\n 'PRIVATENAMES':('atom-identifiers',''),\n 'LITERALS':('atom-literals','STRINGS NUMBERS TUPLELITERALS '\n 'LISTLITERALS DICTIONARYLITERALS'),\n 'TUPLES':'SEQUENCES',\n 'TUPLELITERALS':('exprlists','TUPLES LITERALS'),\n 'LISTS':('typesseq-mutable','LISTLITERALS'),\n 'LISTLITERALS':('lists','LISTS LITERALS'),\n 'DICTIONARIES':('typesmapping','DICTIONARYLITERALS'),\n 'DICTIONARYLITERALS':('dict','DICTIONARIES LITERALS'),\n 'ATTRIBUTES':('attribute-references','getattr hasattr setattr ATTRIBUTEMETHODS'),\n 'SUBSCRIPTS':('subscriptions','SEQUENCEMETHODS'),\n 'SLICINGS':('slicings','SEQUENCEMETHODS'),\n 'CALLS':('calls','EXPRESSIONS'),\n 'POWER':('power','EXPRESSIONS'),\n 'UNARY':('unary','EXPRESSIONS'),\n 'BINARY':('binary','EXPRESSIONS'),\n 'SHIFTING':('shifting','EXPRESSIONS'),\n 'BITWISE':('bitwise','EXPRESSIONS'),\n 'COMPARISON':('comparisons','EXPRESSIONS BASICMETHODS'),\n 'BOOLEAN':('booleans','EXPRESSIONS TRUTHVALUE'),\n 'ASSERTION':'assert',\n 'ASSIGNMENT':('assignment','AUGMENTEDASSIGNMENT'),\n 'AUGMENTEDASSIGNMENT':('augassign','NUMBERMETHODS'),\n 'DELETION':'del',\n 'RETURNING':'return',\n 'IMPORTING':'import',\n 'CONDITIONAL':'if',\n 'LOOPING':('compound','for while break continue'),\n 'TRUTHVALUE':('truth','if while and or not BASICMETHODS'),\n 'DEBUGGING':('debugger','pdb'),\n 'CONTEXTMANAGERS':('context-managers','with'),\n }\n \n def __init__(self,input=None,output=None):\n self._input=input\n self._output=output\n \n @property\n def input(self):\n return self._input or sys.stdin\n \n @property\n def output(self):\n return self._output or sys.stdout\n \n def __repr__(self):\n if inspect.stack()[1][3]=='?':\n self()\n return ''\n return '<%s.%s instance>'%(self.__class__.__module__,\n self.__class__.__qualname__)\n \n _GoInteractive=object()\n def __call__(self,request=_GoInteractive):\n if request is not self._GoInteractive:\n try:\n self.help(request)\n except ImportError as err:\n self.output.write(f'{err}\\n')\n else:\n self.intro()\n self.interact()\n self.output.write('''\nYou are now leaving help and returning to the Python interpreter.\nIf you want to ask for help on a particular object directly from the\ninterpreter, you can type \"help(object)\". Executing \"help('string')\"\nhas the same effect as typing a particular string at the help> prompt.\n''')\n \n def interact(self):\n self.output.write('\\n')\n while True:\n try:\n request=self.getline('help> ')\n if not request:break\n except(KeyboardInterrupt,EOFError):\n break\n request=request.strip()\n \n \n \n if(len(request)>2 and request[0]==request[-1]in(\"'\",'\"')\n and request[0]not in request[1:-1]):\n request=request[1:-1]\n if request.lower()in('q','quit'):break\n if request =='help':\n self.intro()\n else:\n self.help(request)\n \n def getline(self,prompt):\n ''\n if self.input is sys.stdin:\n return input(prompt)\n else:\n self.output.write(prompt)\n self.output.flush()\n return self.input.readline()\n \n def help(self,request):\n if isinstance(request,str):\n request=request.strip()\n if request =='keywords':self.listkeywords()\n elif request =='symbols':self.listsymbols()\n elif request =='topics':self.listtopics()\n elif request =='modules':self.listmodules()\n elif request[:8]=='modules ':\n self.listmodules(request.split()[1])\n elif request in self.symbols:self.showsymbol(request)\n elif request in['True','False','None']:\n \n doc(eval(request),'Help on %s:')\n elif request in self.keywords:self.showtopic(request)\n elif request in self.topics:self.showtopic(request)\n elif request:doc(request,'Help on %s:',output=self._output)\n else:doc(str,'Help on %s:',output=self._output)\n elif isinstance(request,Helper):self()\n else:doc(request,'Help on %s:',output=self._output)\n self.output.write('\\n')\n \n def intro(self):\n self.output.write('''\nWelcome to Python {0}'s help utility!\n\nIf this is your first time using Python, you should definitely check out\nthe tutorial on the internet at https://docs.python.org/{0}/tutorial/.\n\nEnter the name of any module, keyword, or topic to get help on writing\nPython programs and using Python modules. To quit this help utility and\nreturn to the interpreter, just type \"quit\".\n\nTo get a list of available modules, keywords, symbols, or topics, type\n\"modules\", \"keywords\", \"symbols\", or \"topics\". Each module also comes\nwith a one-line summary of what it does; to list the modules whose name\nor summary contain a given string such as \"spam\", type \"modules spam\".\n'''.format('%d.%d'%sys.version_info[:2]))\n \n def list(self,items,columns=4,width=80):\n items=list(sorted(items))\n colw=width //columns\n rows=(len(items)+columns -1)//columns\n for row in range(rows):\n for col in range(columns):\n i=col *rows+row\n if i =0:\n callback(None,modname,desc)\n \n for importer,modname,ispkg in pkgutil.walk_packages(onerror=onerror):\n if self.quit:\n break\n \n if key is None:\n callback(None,modname,'')\n else:\n try:\n spec=importer.find_spec(modname)\n except SyntaxError:\n \n continue\n loader=spec.loader\n if hasattr(loader,'get_source'):\n try:\n source=loader.get_source(modname)\n except Exception:\n if onerror:\n onerror(modname)\n continue\n desc=source_synopsis(io.StringIO(source))or ''\n if hasattr(loader,'get_filename'):\n path=loader.get_filename(modname)\n else:\n path=None\n else:\n try:\n module=importlib._bootstrap._load(spec)\n except ImportError:\n if onerror:\n onerror(modname)\n continue\n desc=module.__doc__.splitlines()[0]if module.__doc__ else ''\n path=getattr(module,'__file__',None)\n name=modname+' - '+desc\n if name.lower().find(key)>=0:\n callback(path,modname,desc)\n \n if completer:\n completer()\n \ndef apropos(key):\n ''\n def callback(path,modname,desc):\n if modname[-9:]=='.__init__':\n modname=modname[:-9]+' (package)'\n print(modname,desc and '- '+desc)\n def onerror(modname):\n pass\n with warnings.catch_warnings():\n warnings.filterwarnings('ignore')\n ModuleScanner().run(callback,key,onerror=onerror)\n \n \n \ndef _start_server(urlhandler,hostname,port):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n import http.server\n import email.message\n import select\n import threading\n \n class DocHandler(http.server.BaseHTTPRequestHandler):\n \n def do_GET(self):\n ''\n\n\n\n \n if self.path.endswith('.css'):\n content_type='text/css'\n else:\n content_type='text/html'\n self.send_response(200)\n self.send_header('Content-Type','%s; charset=UTF-8'%content_type)\n self.end_headers()\n self.wfile.write(self.urlhandler(\n self.path,content_type).encode('utf-8'))\n \n def log_message(self,*args):\n \n pass\n \n class DocServer(http.server.HTTPServer):\n \n def __init__(self,host,port,callback):\n self.host=host\n self.address=(self.host,port)\n self.callback=callback\n self.base.__init__(self,self.address,self.handler)\n self.quit=False\n \n def serve_until_quit(self):\n while not self.quit:\n rd,wr,ex=select.select([self.socket.fileno()],[],[],1)\n if rd:\n self.handle_request()\n self.server_close()\n \n def server_activate(self):\n self.base.server_activate(self)\n if self.callback:\n self.callback(self)\n \n class ServerThread(threading.Thread):\n \n def __init__(self,urlhandler,host,port):\n self.urlhandler=urlhandler\n self.host=host\n self.port=int(port)\n threading.Thread.__init__(self)\n self.serving=False\n self.error=None\n \n def run(self):\n ''\n try:\n DocServer.base=http.server.HTTPServer\n DocServer.handler=DocHandler\n DocHandler.MessageClass=email.message.Message\n DocHandler.urlhandler=staticmethod(self.urlhandler)\n docsvr=DocServer(self.host,self.port,self.ready)\n self.docserver=docsvr\n docsvr.serve_until_quit()\n except Exception as err:\n self.error=err\n \n def ready(self,server):\n self.serving=True\n self.host=server.host\n self.port=server.server_port\n self.url='http://%s:%d/'%(self.host,self.port)\n \n def stop(self):\n ''\n self.docserver.quit=True\n self.join()\n \n \n self.docserver=None\n self.serving=False\n self.url=None\n \n thread=ServerThread(urlhandler,hostname,port)\n thread.start()\n \n \n while not thread.error and not thread.serving:\n time.sleep(.01)\n return thread\n \n \ndef _url_handler(url,content_type=\"text/html\"):\n ''\n\n\n\n\n\n\n \n class _HTMLDoc(HTMLDoc):\n \n def page(self,title,contents):\n ''\n css_path=\"pydoc_data/_pydoc.css\"\n css_link=(\n ''%\n css_path)\n return '''\\\n\n\n\n\nPydoc: %s\n%s%s
%s
\n'''%(title,css_link,html_navbar(),contents)\n \n \n html=_HTMLDoc()\n \n def html_navbar():\n version=html.escape(\"%s [%s, %s]\"%(platform.python_version(),\n platform.python_build()[0],\n platform.python_compiler()))\n return \"\"\"\n
\n Python %s
%s\n
\n
\n \n
\n
\n \n \n
 \n
\n \n \n
\n
\n
\n \"\"\"%(version,html.escape(platform.platform(terse=True)))\n \n def html_index():\n ''\n \n def bltinlink(name):\n return '%s'%(name,name)\n \n heading=html.heading(\n 'Index of Modules'\n )\n names=[name for name in sys.builtin_module_names\n if name !='__main__']\n contents=html.multicolumn(names,bltinlink)\n contents=[heading,'

'+html.bigsection(\n 'Built-in Modules','index',contents)]\n \n seen={}\n for dir in sys.path:\n contents.append(html.index(dir,seen))\n \n contents.append(\n '

pydoc by Ka-Ping Yee'\n '<ping@lfw.org>

')\n return 'Index of Modules',''.join(contents)\n \n def html_search(key):\n ''\n \n search_result=[]\n \n def callback(path,modname,desc):\n if modname[-9:]=='.__init__':\n modname=modname[:-9]+' (package)'\n search_result.append((modname,desc and '- '+desc))\n \n with warnings.catch_warnings():\n warnings.filterwarnings('ignore')\n def onerror(modname):\n pass\n ModuleScanner().run(callback,key,onerror=onerror)\n \n \n def bltinlink(name):\n return '%s'%(name,name)\n \n results=[]\n heading=html.heading(\n 'Search Results',\n )\n for name,desc in search_result:\n results.append(bltinlink(name)+desc)\n contents=heading+html.bigsection(\n 'key = %s'%key,'index','
'.join(results))\n return 'Search Results',contents\n \n def html_topics():\n ''\n \n def bltinlink(name):\n return '%s'%(name,name)\n \n heading=html.heading(\n 'INDEX',\n )\n names=sorted(Helper.topics.keys())\n \n contents=html.multicolumn(names,bltinlink)\n contents=heading+html.bigsection(\n 'Topics','index',contents)\n return 'Topics',contents\n \n def html_keywords():\n ''\n heading=html.heading(\n 'INDEX',\n )\n names=sorted(Helper.keywords.keys())\n \n def bltinlink(name):\n return '%s'%(name,name)\n \n contents=html.multicolumn(names,bltinlink)\n contents=heading+html.bigsection(\n 'Keywords','index',contents)\n return 'Keywords',contents\n \n def html_topicpage(topic):\n ''\n buf=io.StringIO()\n htmlhelp=Helper(buf,buf)\n contents,xrefs=htmlhelp._gettopic(topic)\n if topic in htmlhelp.keywords:\n title='KEYWORD'\n else:\n title='TOPIC'\n heading=html.heading(\n '%s'%title,\n )\n contents='
%s
'%html.markup(contents)\n contents=html.bigsection(topic,'index',contents)\n if xrefs:\n xrefs=sorted(xrefs.split())\n \n def bltinlink(name):\n return '%s'%(name,name)\n \n xrefs=html.multicolumn(xrefs,bltinlink)\n xrefs=html.section('Related help topics: ','index',xrefs)\n return('%s %s'%(title,topic),\n ''.join((heading,contents,xrefs)))\n \n def html_getobj(url):\n obj=locate(url,forceload=1)\n if obj is None and url !='None':\n raise ValueError('could not find object')\n title=describe(obj)\n content=html.document(obj,url)\n return title,content\n \n def html_error(url,exc):\n heading=html.heading(\n 'Error',\n )\n contents='
'.join(html.escape(line)for line in\n format_exception_only(type(exc),exc))\n contents=heading+html.bigsection(url,'error',contents)\n return \"Error - %s\"%url,contents\n \n def get_html_page(url):\n ''\n complete_url=url\n if url.endswith('.html'):\n url=url[:-5]\n try:\n if url in(\"\",\"index\"):\n title,content=html_index()\n elif url ==\"topics\":\n title,content=html_topics()\n elif url ==\"keywords\":\n title,content=html_keywords()\n elif '='in url:\n op,_,url=url.partition('=')\n if op ==\"search?key\":\n title,content=html_search(url)\n elif op ==\"topic?key\":\n \n try:\n title,content=html_topicpage(url)\n except ValueError:\n title,content=html_getobj(url)\n elif op ==\"get?key\":\n \n if url in(\"\",\"index\"):\n title,content=html_index()\n else:\n try:\n title,content=html_getobj(url)\n except ValueError:\n title,content=html_topicpage(url)\n else:\n raise ValueError('bad pydoc url')\n else:\n title,content=html_getobj(url)\n except Exception as exc:\n \n title,content=html_error(complete_url,exc)\n return html.page(title,content)\n \n if url.startswith('/'):\n url=url[1:]\n if content_type =='text/css':\n path_here=os.path.dirname(os.path.realpath(__file__))\n css_path=os.path.join(path_here,url)\n with open(css_path)as fp:\n return ''.join(fp.readlines())\n elif content_type =='text/html':\n return get_html_page(url)\n \n raise TypeError('unknown content type %r for url %s'%(content_type,url))\n \n \ndef browse(port=0,*,open_browser=True,hostname='localhost'):\n ''\n\n\n\n \n import webbrowser\n serverthread=_start_server(_url_handler,hostname,port)\n if serverthread.error:\n print(serverthread.error)\n return\n if serverthread.serving:\n server_help_msg='Server commands: [b]rowser, [q]uit'\n if open_browser:\n webbrowser.open(serverthread.url)\n try:\n print('Server ready at',serverthread.url)\n print(server_help_msg)\n while serverthread.serving:\n cmd=input('server> ')\n cmd=cmd.lower()\n if cmd =='q':\n break\n elif cmd =='b':\n webbrowser.open(serverthread.url)\n else:\n print(server_help_msg)\n except(KeyboardInterrupt,EOFError):\n print()\n finally:\n if serverthread.serving:\n serverthread.stop()\n print('Server stopped')\n \n \n \n \ndef ispath(x):\n return isinstance(x,str)and x.find(os.sep)>=0\n \ndef _get_revised_path(given_path,argv0):\n ''\n\n\n\n\n \n \n \n \n \n \n \n if ''in given_path or os.curdir in given_path or os.getcwd()in given_path:\n return None\n \n \n \n stdlib_dir=os.path.dirname(__file__)\n script_dir=os.path.dirname(argv0)\n revised_path=given_path.copy()\n if script_dir in given_path and not os.path.samefile(script_dir,stdlib_dir):\n revised_path.remove(script_dir)\n revised_path.insert(0,os.getcwd())\n return revised_path\n \n \n \ndef _adjust_cli_sys_path():\n ''\n\n\n \n revised_path=_get_revised_path(sys.path,sys.argv[0])\n if revised_path is not None:\n sys.path[:]=revised_path\n \n \ndef cli():\n ''\n import getopt\n class BadUsage(Exception):pass\n \n _adjust_cli_sys_path()\n \n try:\n opts,args=getopt.getopt(sys.argv[1:],'bk:n:p:w')\n writing=False\n start_server=False\n open_browser=False\n port=0\n hostname='localhost'\n for opt,val in opts:\n if opt =='-b':\n start_server=True\n open_browser=True\n if opt =='-k':\n apropos(val)\n return\n if opt =='-p':\n start_server=True\n port=val\n if opt =='-w':\n writing=True\n if opt =='-n':\n start_server=True\n hostname=val\n \n if start_server:\n browse(port,hostname=hostname,open_browser=open_browser)\n return\n \n if not args:raise BadUsage\n for arg in args:\n if ispath(arg)and not os.path.exists(arg):\n print('file %r does not exist'%arg)\n sys.exit(1)\n try:\n if ispath(arg)and os.path.isfile(arg):\n arg=importfile(arg)\n if writing:\n if ispath(arg)and os.path.isdir(arg):\n writedocs(arg)\n else:\n writedoc(arg)\n else:\n help.help(arg)\n except(ImportError,ErrorDuringImport)as value:\n print(value)\n sys.exit(1)\n \n except(getopt.error,BadUsage):\n cmd=os.path.splitext(os.path.basename(sys.argv[0]))[0]\n print(\"\"\"pydoc - the Python documentation tool\n\n{cmd} ...\n Show text documentation on something. may be the name of a\n Python keyword, topic, function, module, or package, or a dotted\n reference to a class or function within a module or module in a\n package. If contains a '{sep}', it is used as the path to a\n Python source file to document. If name is 'keywords', 'topics',\n or 'modules', a listing of these things is displayed.\n\n{cmd} -k \n Search for a keyword in the synopsis lines of all available modules.\n\n{cmd} -n \n Start an HTTP server with the given hostname (default: localhost).\n\n{cmd} -p \n Start an HTTP server on the given port on the local machine. Port\n number 0 can be used to get an arbitrary unused port.\n\n{cmd} -b\n Start an HTTP server on an arbitrary unused port and open a web browser\n to interactively browse documentation. This option can be used in\n combination with -n and/or -p.\n\n{cmd} -w ...\n Write out the HTML documentation for a module to a file in the current\n directory. If contains a '{sep}', it is treated as a filename; if\n it names a directory, documentation is written for all the contents.\n\"\"\".format(cmd=cmd,sep=os.sep))\n \nif __name__ =='__main__':\n cli()\n", ["__future__", "builtins", "collections", "email.message", "getopt", "http.server", "importlib._bootstrap", "importlib._bootstrap_external", "importlib.machinery", "importlib.util", "inspect", "io", "os", "pkgutil", "platform", "pydoc_data.topics", "re", "reprlib", "select", "subprocess", "sys", "sysconfig", "tempfile", "textwrap", "threading", "time", "tokenize", "traceback", "tty", "urllib.parse", "warnings", "webbrowser"]], "py_compile": [".py", "''\n\n\n\n\nimport enum\nimport importlib._bootstrap_external\nimport importlib.machinery\nimport importlib.util\nimport os\nimport os.path\nimport sys\nimport traceback\n\n__all__=[\"compile\",\"main\",\"PyCompileError\",\"PycInvalidationMode\"]\n\n\nclass PyCompileError(Exception):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,exc_type,exc_value,file,msg=''):\n exc_type_name=exc_type.__name__\n if exc_type is SyntaxError:\n tbtext=''.join(traceback.format_exception_only(\n exc_type,exc_value))\n errmsg=tbtext.replace('File \"\"','File \"%s\"'%file)\n else :\n errmsg=\"Sorry: %s: %s\"%(exc_type_name,exc_value)\n \n Exception.__init__(self,msg or errmsg,exc_type_name,exc_value,file)\n \n self.exc_type_name=exc_type_name\n self.exc_value=exc_value\n self.file=file\n self.msg=msg or errmsg\n \n def __str__(self):\n return self.msg\n \n \nclass PycInvalidationMode(enum.Enum):\n TIMESTAMP=1\n CHECKED_HASH=2\n UNCHECKED_HASH=3\n \n \ndef _get_default_invalidation_mode():\n if os.environ.get('SOURCE_DATE_EPOCH'):\n return PycInvalidationMode.CHECKED_HASH\n else :\n return PycInvalidationMode.TIMESTAMP\n \n \ndef compile(file,cfile=None ,dfile=None ,doraise=False ,optimize=-1,\ninvalidation_mode=None ,quiet=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if invalidation_mode is None :\n invalidation_mode=_get_default_invalidation_mode()\n if cfile is None :\n if optimize >=0:\n optimization=optimize if optimize >=1 else ''\n cfile=importlib.util.cache_from_source(file,\n optimization=optimization)\n else :\n cfile=importlib.util.cache_from_source(file)\n if os.path.islink(cfile):\n msg=('{} is a symlink and will be changed into a regular file if '\n 'import writes a byte-compiled file to it')\n raise FileExistsError(msg.format(cfile))\n elif os.path.exists(cfile)and not os.path.isfile(cfile):\n msg=('{} is a non-regular file and will be changed into a regular '\n 'one if import writes a byte-compiled file to it')\n raise FileExistsError(msg.format(cfile))\n loader=importlib.machinery.SourceFileLoader('',file)\n source_bytes=loader.get_data(file)\n try :\n code=loader.source_to_code(source_bytes,dfile or file,\n _optimize=optimize)\n except Exception as err:\n py_exc=PyCompileError(err.__class__,err,dfile or file)\n if quiet <2:\n if doraise:\n raise py_exc\n else :\n sys.stderr.write(py_exc.msg+'\\n')\n return\n try :\n dirname=os.path.dirname(cfile)\n if dirname:\n os.makedirs(dirname)\n except FileExistsError:\n pass\n if invalidation_mode ==PycInvalidationMode.TIMESTAMP:\n source_stats=loader.path_stats(file)\n bytecode=importlib._bootstrap_external._code_to_timestamp_pyc(\n code,source_stats['mtime'],source_stats['size'])\n else :\n source_hash=importlib.util.source_hash(source_bytes)\n bytecode=importlib._bootstrap_external._code_to_hash_pyc(\n code,\n source_hash,\n (invalidation_mode ==PycInvalidationMode.CHECKED_HASH),\n )\n mode=importlib._bootstrap_external._calc_mode(file)\n importlib._bootstrap_external._write_atomic(cfile,bytecode,mode)\n return cfile\n \n \ndef main():\n import argparse\n \n description='A simple command-line interface for py_compile module.'\n parser=argparse.ArgumentParser(description=description)\n parser.add_argument(\n '-q','--quiet',\n action='store_true',\n help='Suppress error output',\n )\n parser.add_argument(\n 'filenames',\n nargs='+',\n help='Files to compile',\n )\n args=parser.parse_args()\n if args.filenames ==['-']:\n filenames=[filename.rstrip('\\n')for filename in sys.stdin.readlines()]\n else :\n filenames=args.filenames\n for filename in filenames:\n try :\n compile(filename,doraise=True )\n except PyCompileError as error:\n if args.quiet:\n parser.exit(1)\n else :\n parser.exit(1,error.msg)\n except OSError as error:\n if args.quiet:\n parser.exit(1)\n else :\n parser.exit(1,str(error))\n \n \nif __name__ ==\"__main__\":\n main()\n", ["argparse", "enum", "importlib._bootstrap_external", "importlib.machinery", "importlib.util", "os", "os.path", "sys", "traceback"]], "queue": [".py", "''\n\nimport threading\nimport types\nfrom collections import deque\nfrom heapq import heappush,heappop\nfrom time import monotonic as time\ntry :\n from _queue import SimpleQueue\nexcept ImportError:\n SimpleQueue=None\n \n__all__=['Empty','Full','Queue','PriorityQueue','LifoQueue','SimpleQueue']\n\n\ntry :\n from _queue import Empty\nexcept ImportError:\n class Empty(Exception):\n ''\n pass\n \nclass Full(Exception):\n ''\n pass\n \n \nclass Queue:\n ''\n\n\n \n \n def __init__(self,maxsize=0):\n self.maxsize=maxsize\n self._init(maxsize)\n \n \n \n \n \n self.mutex=threading.Lock()\n \n \n \n self.not_empty=threading.Condition(self.mutex)\n \n \n \n self.not_full=threading.Condition(self.mutex)\n \n \n \n self.all_tasks_done=threading.Condition(self.mutex)\n self.unfinished_tasks=0\n \n def task_done(self):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n with self.all_tasks_done:\n unfinished=self.unfinished_tasks -1\n if unfinished <=0:\n if unfinished <0:\n raise ValueError('task_done() called too many times')\n self.all_tasks_done.notify_all()\n self.unfinished_tasks=unfinished\n \n def join(self):\n ''\n\n\n\n\n\n\n \n with self.all_tasks_done:\n while self.unfinished_tasks:\n self.all_tasks_done.wait()\n \n def qsize(self):\n ''\n with self.mutex:\n return self._qsize()\n \n def empty(self):\n ''\n\n\n\n\n\n\n\n\n \n with self.mutex:\n return not self._qsize()\n \n def full(self):\n ''\n\n\n\n\n\n \n with self.mutex:\n return 0 0:\n if not block:\n if self._qsize()>=self.maxsize:\n raise Full\n elif timeout is None :\n while self._qsize()>=self.maxsize:\n self.not_full.wait()\n elif timeout <0:\n raise ValueError(\"'timeout' must be a non-negative number\")\n else :\n endtime=time()+timeout\n while self._qsize()>=self.maxsize:\n remaining=endtime -time()\n if remaining <=0.0:\n raise Full\n self.not_full.wait(remaining)\n self._put(item)\n self.unfinished_tasks +=1\n self.not_empty.notify()\n \n def get(self,block=True ,timeout=None ):\n ''\n\n\n\n\n\n\n\n\n \n with self.not_empty:\n if not block:\n if not self._qsize():\n raise Empty\n elif timeout is None :\n while not self._qsize():\n self.not_empty.wait()\n elif timeout <0:\n raise ValueError(\"'timeout' must be a non-negative number\")\n else :\n endtime=time()+timeout\n while not self._qsize():\n remaining=endtime -time()\n if remaining <=0.0:\n raise Empty\n self.not_empty.wait(remaining)\n item=self._get()\n self.not_full.notify()\n return item\n \n def put_nowait(self,item):\n ''\n\n\n\n \n return self.put(item,block=False )\n \n def get_nowait(self):\n ''\n\n\n\n \n return self.get(block=False )\n \n \n \n \n \n \n def _init(self,maxsize):\n self.queue=deque()\n \n def _qsize(self):\n return len(self.queue)\n \n \n def _put(self,item):\n self.queue.append(item)\n \n \n def _get(self):\n return self.queue.popleft()\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \nclass PriorityQueue(Queue):\n ''\n\n\n \n \n def _init(self,maxsize):\n self.queue=[]\n \n def _qsize(self):\n return len(self.queue)\n \n def _put(self,item):\n heappush(self.queue,item)\n \n def _get(self):\n return heappop(self.queue)\n \n \nclass LifoQueue(Queue):\n ''\n \n def _init(self,maxsize):\n self.queue=[]\n \n def _qsize(self):\n return len(self.queue)\n \n def _put(self,item):\n self.queue.append(item)\n \n def _get(self):\n return self.queue.pop()\n \n \nclass _PySimpleQueue:\n ''\n\n\n \n \n \n \n \n \n def __init__(self):\n self._queue=deque()\n self._count=threading.Semaphore(0)\n \n def put(self,item,block=True ,timeout=None ):\n ''\n\n\n\n \n self._queue.append(item)\n self._count.release()\n \n def get(self,block=True ,timeout=None ):\n ''\n\n\n\n\n\n\n\n\n \n if timeout is not None and timeout <0:\n raise ValueError(\"'timeout' must be a non-negative number\")\n if not self._count.acquire(block,timeout):\n raise Empty\n return self._queue.popleft()\n \n def put_nowait(self,item):\n ''\n\n\n\n \n return self.put(item,block=False )\n \n def get_nowait(self):\n ''\n\n\n\n \n return self.get(block=False )\n \n def empty(self):\n ''\n return len(self._queue)==0\n \n def qsize(self):\n ''\n return len(self._queue)\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \nif SimpleQueue is None :\n SimpleQueue=_PySimpleQueue\n", ["_queue", "collections", "heapq", "threading", "time", "types"]], "quopri": [".py", "#! /usr/bin/env python3\n\n\"\"\"Conversions to/from quoted-printable transport encoding as per RFC 1521.\"\"\"\n\n\n\n__all__=[\"encode\",\"decode\",\"encodestring\",\"decodestring\"]\n\nESCAPE=b'='\nMAXLINESIZE=76\nHEX=b'0123456789ABCDEF'\nEMPTYSTRING=b''\n\ntry:\n from binascii import a2b_qp,b2a_qp\nexcept ImportError:\n a2b_qp=None\n b2a_qp=None\n \n \ndef needsquoting(c,quotetabs,header):\n ''\n\n\n\n\n \n assert isinstance(c,bytes)\n if c in b' \\t':\n return quotetabs\n \n if c ==b'_':\n return header\n return c ==ESCAPE or not(b' '<=c <=b'~')\n \ndef quote(c):\n ''\n assert isinstance(c,bytes)and len(c)==1\n c=ord(c)\n return ESCAPE+bytes((HEX[c //16],HEX[c %16]))\n \n \n \ndef encode(input,output,quotetabs,header=False):\n ''\n\n\n\n\n\n \n \n if b2a_qp is not None:\n data=input.read()\n odata=b2a_qp(data,quotetabs=quotetabs,header=header)\n output.write(odata)\n return\n \n def write(s,output=output,lineEnd=b'\\n'):\n \n \n if s and s[-1:]in b' \\t':\n output.write(s[:-1]+quote(s[-1:])+lineEnd)\n elif s ==b'.':\n output.write(quote(s)+lineEnd)\n else:\n output.write(s+lineEnd)\n \n prevline=None\n while line :=input.readline():\n outline=[]\n \n stripped=b''\n if line[-1:]==b'\\n':\n line=line[:-1]\n stripped=b'\\n'\n \n for c in line:\n c=bytes((c,))\n if needsquoting(c,quotetabs,header):\n c=quote(c)\n if header and c ==b' ':\n outline.append(b'_')\n else:\n outline.append(c)\n \n if prevline is not None:\n write(prevline)\n \n \n thisline=EMPTYSTRING.join(outline)\n while len(thisline)>MAXLINESIZE:\n \n \n write(thisline[:MAXLINESIZE -1],lineEnd=b'=\\n')\n thisline=thisline[MAXLINESIZE -1:]\n \n prevline=thisline\n \n if prevline is not None:\n write(prevline,lineEnd=stripped)\n \ndef encodestring(s,quotetabs=False,header=False):\n if b2a_qp is not None:\n return b2a_qp(s,quotetabs=quotetabs,header=header)\n from io import BytesIO\n infp=BytesIO(s)\n outfp=BytesIO()\n encode(infp,outfp,quotetabs,header)\n return outfp.getvalue()\n \n \n \ndef decode(input,output,header=False):\n ''\n\n \n \n if a2b_qp is not None:\n data=input.read()\n odata=a2b_qp(data,header=header)\n output.write(odata)\n return\n \n new=b''\n while line :=input.readline():\n i,n=0,len(line)\n if n >0 and line[n -1:n]==b'\\n':\n partial=0 ;n=n -1\n \n while n >0 and line[n -1:n]in b\" \\t\\r\":\n n=n -1\n else:\n partial=1\n while i =n:\n r=getrandbits(k)\n return r\n \n def _randbelow_without_getrandbits(self,n,maxsize=1 <=maxsize:\n _warn(\"Underlying random() generator does not supply \\n\"\n \"enough bits to choose from a population range this large.\\n\"\n \"To remove the range limitation, add a getrandbits() method.\")\n return _floor(random()*n)\n rem=maxsize %n\n limit=(maxsize -rem)/maxsize\n r=random()\n while r >=limit:\n r=random()\n return _floor(r *maxsize)%n\n \n _randbelow=_randbelow_with_getrandbits\n \n \n \n \n \n \n \n \n \n \n \n \n def randbytes(self,n):\n ''\n return self.getrandbits(n *8).to_bytes(n,'little')\n \n \n \n \n def randrange(self,start,stop=None,step=_ONE):\n ''\n\n\n\n\n \n \n \n \n istart=_index(start)\n if stop is None:\n \n \n if step is not _ONE:\n raise TypeError(\"Missing a non-None stop argument\")\n if istart >0:\n return self._randbelow(istart)\n raise ValueError(\"empty range for randrange()\")\n \n \n istop=_index(stop)\n width=istop -istart\n istep=_index(step)\n \n if istep ==1:\n if width >0:\n return istart+self._randbelow(width)\n raise ValueError(f\"empty range in randrange({start}, {stop})\")\n \n \n if istep >0:\n n=(width+istep -1)//istep\n elif istep <0:\n n=(width+istep+1)//istep\n else:\n raise ValueError(\"zero step for randrange()\")\n if n <=0:\n raise ValueError(f\"empty range in randrange({start}, {stop}, {step})\")\n return istart+istep *self._randbelow(n)\n \n def randint(self,a,b):\n ''\n \n \n return self.randrange(a,b+1)\n \n \n \n \n def choice(self,seq):\n ''\n \n \n \n if not len(seq):\n raise IndexError('Cannot choose from an empty sequence')\n return seq[self._randbelow(len(seq))]\n \n def shuffle(self,x):\n ''\n \n randbelow=self._randbelow\n for i in reversed(range(1,len(x))):\n \n j=randbelow(i+1)\n x[i],x[j]=x[j],x[i]\n \n def sample(self,population,k,*,counts=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if not isinstance(population,_Sequence):\n raise TypeError(\"Population must be a sequence. \"\n \"For dicts or sets, use sorted(d).\")\n n=len(population)\n if counts is not None:\n cum_counts=list(_accumulate(counts))\n if len(cum_counts)!=n:\n raise ValueError('The number of counts does not match the population')\n total=cum_counts.pop()\n if not isinstance(total,int):\n raise TypeError('Counts must be integers')\n if total <=0:\n raise ValueError('Total of counts must be greater than zero')\n selections=self.sample(range(total),k=k)\n bisect=_bisect\n return[population[bisect(cum_counts,s)]for s in selections]\n randbelow=self._randbelow\n if not 0 <=k <=n:\n raise ValueError(\"Sample larger than population or is negative\")\n result=[None]*k\n setsize=21\n if k >5:\n setsize +=4 **_ceil(_log(k *3,4))\n if n <=setsize:\n \n \n pool=list(population)\n for i in range(k):\n j=randbelow(n -i)\n result[i]=pool[j]\n pool[j]=pool[n -i -1]\n else:\n selected=set()\n selected_add=selected.add\n for i in range(k):\n j=randbelow(n)\n while j in selected:\n j=randbelow(n)\n selected_add(j)\n result[i]=population[j]\n return result\n \n def choices(self,population,weights=None,*,cum_weights=None,k=1):\n ''\n\n\n\n\n \n random=self.random\n n=len(population)\n if cum_weights is None:\n if weights is None:\n floor=_floor\n n +=0.0\n return[population[floor(random()*n)]for i in _repeat(None,k)]\n try:\n cum_weights=list(_accumulate(weights))\n except TypeError:\n if not isinstance(weights,int):\n raise\n k=weights\n raise TypeError(\n f'The number of choices must be a keyword argument: {k=}'\n )from None\n elif weights is not None:\n raise TypeError('Cannot specify both weights and cumulative weights')\n if len(cum_weights)!=n:\n raise ValueError('The number of weights does not match the population')\n total=cum_weights[-1]+0.0\n if total <=0.0:\n raise ValueError('Total of weights must be greater than zero')\n if not _isfinite(total):\n raise ValueError('Total of weights must be finite')\n bisect=_bisect\n hi=n -1\n return[population[bisect(cum_weights,random()*total,0,hi)]\n for i in _repeat(None,k)]\n \n \n \n \n def uniform(self,a,b):\n ''\n return a+(b -a)*self.random()\n \n def triangular(self,low=0.0,high=1.0,mode=None):\n ''\n\n\n\n\n\n\n \n u=self.random()\n try:\n c=0.5 if mode is None else(mode -low)/(high -low)\n except ZeroDivisionError:\n return low\n if u >c:\n u=1.0 -u\n c=1.0 -c\n low,high=high,low\n return low+(high -low)*_sqrt(u *c)\n \n def normalvariate(self,mu=0.0,sigma=1.0):\n ''\n\n\n\n \n \n \n \n \n \n random=self.random\n while True:\n u1=random()\n u2=1.0 -random()\n z=NV_MAGICCONST *(u1 -0.5)/u2\n zz=z *z /4.0\n if zz <=-_log(u2):\n break\n return mu+z *sigma\n \n def gauss(self,mu=0.0,sigma=1.0):\n ''\n\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n random=self.random\n z=self.gauss_next\n self.gauss_next=None\n if z is None:\n x2pi=random()*TWOPI\n g2rad=_sqrt(-2.0 *_log(1.0 -random()))\n z=_cos(x2pi)*g2rad\n self.gauss_next=_sin(x2pi)*g2rad\n \n return mu+z *sigma\n \n def lognormvariate(self,mu,sigma):\n ''\n\n\n\n\n\n \n return _exp(self.normalvariate(mu,sigma))\n \n def expovariate(self,lambd=1.0):\n ''\n\n\n\n\n\n\n\n \n \n \n \n \n \n return -_log(1.0 -self.random())/lambd\n \n def vonmisesvariate(self,mu,kappa):\n ''\n\n\n\n\n\n\n \n \n \n \n \n \n \n \n random=self.random\n if kappa <=1e-6:\n return TWOPI *random()\n \n s=0.5 /kappa\n r=s+_sqrt(1.0+s *s)\n \n while True:\n u1=random()\n z=_cos(_pi *u1)\n \n d=z /(r+z)\n u2=random()\n if u2 <1.0 -d *d or u2 <=(1.0 -d)*_exp(d):\n break\n \n q=1.0 /r\n f=(q+z)/(1.0+q *z)\n u3=random()\n if u3 >0.5:\n theta=(mu+_acos(f))%TWOPI\n else:\n theta=(mu -_acos(f))%TWOPI\n \n return theta\n \n def gammavariate(self,alpha,beta):\n ''\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n if alpha <=0.0 or beta <=0.0:\n raise ValueError('gammavariate: alpha and beta must be > 0.0')\n \n random=self.random\n if alpha >1.0:\n \n \n \n \n \n ainv=_sqrt(2.0 *alpha -1.0)\n bbb=alpha -LOG4\n ccc=alpha+ainv\n \n while True:\n u1=random()\n if not 1e-7 =0.0 or r >=_log(z):\n return x *beta\n \n elif alpha ==1.0:\n \n return -_log(1.0 -random())*beta\n \n else:\n \n \n while True:\n u=random()\n b=(_e+alpha)/_e\n p=b *u\n if p <=1.0:\n x=p **(1.0 /alpha)\n else:\n x=-_log((b -p)/alpha)\n u1=random()\n if p >1.0:\n if u1 <=x **(alpha -1.0):\n break\n elif u1 <=_exp(-x):\n break\n return x *beta\n \n def betavariate(self,alpha,beta):\n ''\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n y=self.gammavariate(alpha,1.0)\n if y:\n return y /(y+self.gammavariate(beta,1.0))\n return 0.0\n \n def paretovariate(self,alpha):\n ''\n \n \n u=1.0 -self.random()\n return u **(-1.0 /alpha)\n \n def weibullvariate(self,alpha,beta):\n ''\n\n\n\n \n \n \n u=1.0 -self.random()\n return alpha *(-_log(u))**(1.0 /beta)\n \n \n \n \n def binomialvariate(self,n=1,p=0.5):\n ''\n\n\n\n\n\n\n\n\n \n \n if n <0:\n raise ValueError(\"n must be non-negative\")\n if p <=0.0 or p >=1.0:\n if p ==0.0:\n return 0\n if p ==1.0:\n return n\n raise ValueError(\"p must be in the range 0.0 <= p <= 1.0\")\n \n random=self.random\n \n \n if n ==1:\n return _index(random()0.5:\n return n -self.binomialvariate(n,1.0 -p)\n \n if n *p <10.0:\n \n \n x=y=0\n c=_log2(1.0 -p)\n if not c:\n return x\n while True:\n y +=_floor(_log2(random())/c)+1\n if y >n:\n return x\n x +=1\n \n \n \n assert n *p >=10.0 and p <=0.5\n setup_complete=False\n \n spq=_sqrt(n *p *(1.0 -p))\n b=1.15+2.53 *spq\n a=-0.0873+0.0248 *b+0.01 *p\n c=n *p+0.5\n vr=0.92 -4.2 /b\n \n while True:\n \n u=random()\n u -=0.5\n us=0.5 -_fabs(u)\n k=_floor((2.0 *a /us+b)*u+c)\n if k <0 or k >n:\n continue\n \n \n \n v=random()\n if us >=0.07 and v <=vr:\n return k\n \n \n \n \n if not setup_complete:\n alpha=(2.83+5.1 /b)*spq\n lpq=_log(p /(1.0 -p))\n m=_floor((n+1)*p)\n h=_lgamma(m+1)+_lgamma(n -m+1)\n setup_complete=True\n v *=alpha /(a /(us *us)+b)\n if _log(v)<=h -_lgamma(k+1)-_lgamma(n -k+1)+(k -m)*lpq:\n return k\n \n \n \n \n \n \nclass SystemRandom(Random):\n ''\n\n\n\n\n\n \n \n def random(self):\n ''\n return(int.from_bytes(_urandom(7))>>3)*RECIP_BPF\n \n def getrandbits(self,k):\n ''\n if k <0:\n raise ValueError('number of bits must be non-negative')\n numbytes=(k+7)//8\n x=int.from_bytes(_urandom(numbytes))\n return x >>(numbytes *8 -k)\n \n def randbytes(self,n):\n ''\n \n \n return _urandom(n)\n \n def seed(self,*args,**kwds):\n ''\n return None\n \n def _notimplemented(self,*args,**kwds):\n ''\n raise NotImplementedError('System entropy source does not have state.')\n getstate=setstate=_notimplemented\n \n \n \n \n \n \n \n \n \n_inst=Random()\nseed=_inst.seed\nrandom=_inst.random\nuniform=_inst.uniform\ntriangular=_inst.triangular\nrandint=_inst.randint\nchoice=_inst.choice\nrandrange=_inst.randrange\nsample=_inst.sample\nshuffle=_inst.shuffle\nchoices=_inst.choices\nnormalvariate=_inst.normalvariate\nlognormvariate=_inst.lognormvariate\nexpovariate=_inst.expovariate\nvonmisesvariate=_inst.vonmisesvariate\ngammavariate=_inst.gammavariate\ngauss=_inst.gauss\nbetavariate=_inst.betavariate\nbinomialvariate=_inst.binomialvariate\nparetovariate=_inst.paretovariate\nweibullvariate=_inst.weibullvariate\ngetstate=_inst.getstate\nsetstate=_inst.setstate\ngetrandbits=_inst.getrandbits\nrandbytes=_inst.randbytes\n\n\n\n\n\ndef _test_generator(n,func,args):\n from statistics import stdev,fmean as mean\n from time import perf_counter\n \n t0=perf_counter()\n data=[func(*args)for i in _repeat(None,n)]\n t1=perf_counter()\n \n xbar=mean(data)\n sigma=stdev(data,xbar)\n low=min(data)\n high=max(data)\n \n print(f'{t1 -t0:.3f} sec, {n} times {func.__name__}{args !r}')\n print('avg %g, stddev %g, min %g, max %g\\n'%(xbar,sigma,low,high))\n \n \ndef _test(N=10_000):\n _test_generator(N,random,())\n _test_generator(N,normalvariate,(0.0,1.0))\n _test_generator(N,lognormvariate,(0.0,1.0))\n _test_generator(N,vonmisesvariate,(0.0,1.0))\n _test_generator(N,binomialvariate,(15,0.60))\n _test_generator(N,binomialvariate,(100,0.75))\n _test_generator(N,gammavariate,(0.01,1.0))\n _test_generator(N,gammavariate,(0.1,1.0))\n _test_generator(N,gammavariate,(0.1,2.0))\n _test_generator(N,gammavariate,(0.5,1.0))\n _test_generator(N,gammavariate,(0.9,1.0))\n _test_generator(N,gammavariate,(1.0,1.0))\n _test_generator(N,gammavariate,(2.0,1.0))\n _test_generator(N,gammavariate,(20.0,1.0))\n _test_generator(N,gammavariate,(200.0,1.0))\n _test_generator(N,gauss,(0.0,1.0))\n _test_generator(N,betavariate,(3.0,3.0))\n _test_generator(N,triangular,(0.0,1.0,1.0 /3.0))\n \n \n \n \n \nif hasattr(_os,\"fork\"):\n _os.register_at_fork(after_in_child=_inst.seed)\n \n \nif __name__ =='__main__':\n _test()\n", ["_collections_abc", "_random", "_sha512", "bisect", "hashlib", "itertools", "math", "operator", "os", "statistics", "time", "warnings"]], "re": [".py", "from python_re import *\n\nimport python_re\n_compile=python_re._compile\n_reconstructor=python_re._reconstructor\n\npython_re._reconstructor.__module__='re'\n", ["python_re"]], "re1": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nr\"\"\"Support for regular expressions (RE).\n\nThis module provides regular expression matching operations similar to\nthose found in Perl. It supports both 8-bit and Unicode strings; both\nthe pattern and the strings being processed can contain null bytes and\ncharacters outside the US ASCII range.\n\nRegular expressions can contain both special and ordinary characters.\nMost ordinary characters, like \"A\", \"a\", or \"0\", are the simplest\nregular expressions; they simply match themselves. You can\nconcatenate ordinary characters, so last matches the string 'last'.\n\nThe special characters are:\n \".\" Matches any character except a newline.\n \"^\" Matches the start of the string.\n \"$\" Matches the end of the string or just before the newline at\n the end of the string.\n \"*\" Matches 0 or more (greedy) repetitions of the preceding RE.\n Greedy means that it will match as many repetitions as possible.\n \"+\" Matches 1 or more (greedy) repetitions of the preceding RE.\n \"?\" Matches 0 or 1 (greedy) of the preceding RE.\n *?,+?,?? Non-greedy versions of the previous three special characters.\n {m,n} Matches from m to n repetitions of the preceding RE.\n {m,n}? Non-greedy version of the above.\n \"\\\\\" Either escapes special characters or signals a special sequence.\n [] Indicates a set of characters.\n A \"^\" as the first character indicates a complementing set.\n \"|\" A|B, creates an RE that will match either A or B.\n (...) Matches the RE inside the parentheses.\n The contents can be retrieved or matched later in the string.\n (?aiLmsux) The letters set the corresponding flags defined below.\n (?:...) Non-grouping version of regular parentheses.\n (?P...) The substring matched by the group is accessible by name.\n (?P=name) Matches the text matched earlier by the group named name.\n (?#...) A comment; ignored.\n (?=...) Matches if ... matches next, but doesn't consume the string.\n (?!...) Matches if ... doesn't match next.\n (?<=...) Matches if preceded by ... (must be fixed length).\n (?1:\n res=f'~({res})'\n else :\n res=f'~{res}'\n return res\n __str__=object.__str__\nglobals().update(RegexFlag.__members__)\n\n\nerror=sre_compile.error\n\n\n\n\ndef match(pattern,string,flags=0):\n ''\n \n return _compile(pattern,flags).match(string)\n \ndef fullmatch(pattern,string,flags=0):\n ''\n \n return _compile(pattern,flags).fullmatch(string)\n \ndef search(pattern,string,flags=0):\n ''\n \n return _compile(pattern,flags).search(string)\n \ndef sub(pattern,repl,string,count=0,flags=0):\n ''\n\n\n\n\n \n return _compile(pattern,flags).sub(repl,string,count)\n \ndef subn(pattern,repl,string,count=0,flags=0):\n ''\n\n\n\n\n\n\n \n return _compile(pattern,flags).subn(repl,string,count)\n \ndef split(pattern,string,maxsplit=0,flags=0):\n ''\n\n\n\n\n\n \n return _compile(pattern,flags).split(string,maxsplit)\n \ndef findall(pattern,string,flags=0):\n ''\n\n\n\n\n\n \n return _compile(pattern,flags).findall(string)\n \ndef finditer(pattern,string,flags=0):\n ''\n\n\n \n return _compile(pattern,flags).finditer(string)\n \ndef compile(pattern,flags=0):\n ''\n return _compile(pattern,flags)\n \ndef purge():\n ''\n _cache.clear()\n _compile_repl.cache_clear()\n \ndef template(pattern,flags=0):\n ''\n return _compile(pattern,flags |T)\n \n \n \n \n \n \n_special_chars_map={i:'\\\\'+chr(i)for i in b'()[]{}?*+-|^$\\\\.&~# \\t\\n\\r\\v\\f'}\n\ndef escape(pattern):\n ''\n\n \n if isinstance(pattern,str):\n return pattern.translate(_special_chars_map)\n else :\n pattern=str(pattern,'latin1')\n return pattern.translate(_special_chars_map).encode('latin1')\n \nPattern=type(sre_compile.compile('',0))\nMatch=type(sre_compile.compile('',0).match(''))\n\n\n\n\n_cache={}\n\n_MAXCACHE=512\ndef _compile(pattern,flags):\n\n if isinstance(flags,RegexFlag):\n flags=flags.value\n try :\n return _cache[type(pattern),pattern,flags]\n except KeyError:\n pass\n if isinstance(pattern,Pattern):\n if flags:\n raise ValueError(\n \"cannot process flags argument with a compiled pattern\")\n return pattern\n if not sre_compile.isstring(pattern):\n raise TypeError(\"first argument must be string or compiled pattern\")\n p=sre_compile.compile(pattern,flags)\n if not (flags&DEBUG):\n if len(_cache)>=_MAXCACHE:\n \n try :\n del _cache[next(iter(_cache))]\n except (StopIteration,RuntimeError,KeyError):\n pass\n _cache[type(pattern),pattern,flags]=p\n return p\n \n@functools.lru_cache(_MAXCACHE)\ndef _compile_repl(repl,pattern):\n\n return sre_parse.parse_template(repl,pattern)\n \ndef _expand(pattern,match,template):\n\n template=sre_parse.parse_template(template,pattern)\n return sre_parse.expand_template(template,match)\n \ndef _subx(pattern,template):\n\n template=_compile_repl(template,pattern)\n if not template[0]and len(template[1])==1:\n \n return template[1][0]\n def filter(match,template=template):\n return sre_parse.expand_template(template,match)\n return filter\n \n \n \nimport copyreg\n\ndef _pickle(p):\n return _compile,(p.pattern,p.flags)\n \ncopyreg.pickle(Pattern,_pickle,_compile)\n\n\n\n\nclass Scanner:\n def __init__(self,lexicon,flags=0):\n from sre_constants import BRANCH,SUBPATTERN\n if isinstance(flags,RegexFlag):\n flags=flags.value\n self.lexicon=lexicon\n \n p=[]\n s=sre_parse.State()\n s.flags=flags\n for phrase,action in lexicon:\n gid=s.opengroup()\n p.append(sre_parse.SubPattern(s,[\n (SUBPATTERN,(gid,0,0,sre_parse.parse(phrase,flags))),\n ]))\n s.closegroup(gid,p[-1])\n p=sre_parse.SubPattern(s,[(BRANCH,(None ,p))])\n self.scanner=sre_compile.compile(p)\n def scan(self,string):\n result=[]\n append=result.append\n match=self.scanner.scanner(string).match\n i=0\n while True :\n m=match()\n if not m:\n break\n j=m.end()\n if i ==j:\n break\n action=self.lexicon[m.lastindex -1][1]\n if callable(action):\n self.match=m\n action=action(self,m.group())\n if action is not None :\n append(action)\n i=j\n return result,string[i:]\n", ["_locale", "copyreg", "enum", "functools", "sre_compile", "sre_constants", "sre_parse"]], "reprlib": [".py", "''\n\n__all__=[\"Repr\",\"repr\",\"recursive_repr\"]\n\nimport builtins\nfrom itertools import islice\nfrom _thread import get_ident\n\ndef recursive_repr(fillvalue='...'):\n ''\n \n def decorating_function(user_function):\n repr_running=set()\n \n def wrapper(self):\n key=id(self),get_ident()\n if key in repr_running:\n return fillvalue\n repr_running.add(key)\n try:\n result=user_function(self)\n finally:\n repr_running.discard(key)\n return result\n \n \n wrapper.__module__=getattr(user_function,'__module__')\n wrapper.__doc__=getattr(user_function,'__doc__')\n wrapper.__name__=getattr(user_function,'__name__')\n wrapper.__qualname__=getattr(user_function,'__qualname__')\n wrapper.__annotations__=getattr(user_function,'__annotations__',{})\n return wrapper\n \n return decorating_function\n \nclass Repr:\n\n def __init__(\n self,*,maxlevel=6,maxtuple=6,maxlist=6,maxarray=5,maxdict=4,\n maxset=6,maxfrozenset=6,maxdeque=6,maxstring=30,maxlong=40,\n maxother=30,fillvalue='...',indent=None,\n ):\n self.maxlevel=maxlevel\n self.maxtuple=maxtuple\n self.maxlist=maxlist\n self.maxarray=maxarray\n self.maxdict=maxdict\n self.maxset=maxset\n self.maxfrozenset=maxfrozenset\n self.maxdeque=maxdeque\n self.maxstring=maxstring\n self.maxlong=maxlong\n self.maxother=maxother\n self.fillvalue=fillvalue\n self.indent=indent\n \n def repr(self,x):\n return self.repr1(x,self.maxlevel)\n \n def repr1(self,x,level):\n typename=type(x).__name__\n if ' 'in typename:\n parts=typename.split()\n typename='_'.join(parts)\n if hasattr(self,'repr_'+typename):\n return getattr(self,'repr_'+typename)(x,level)\n else:\n return self.repr_instance(x,level)\n \n def _join(self,pieces,level):\n if self.indent is None:\n return ', '.join(pieces)\n if not pieces:\n return ''\n indent=self.indent\n if isinstance(indent,int):\n if indent <0:\n raise ValueError(\n f'Repr.indent cannot be negative int (was {indent !r})'\n )\n indent *=' '\n try:\n sep=',\\n'+(self.maxlevel -level+1)*indent\n except TypeError as error:\n raise TypeError(\n f'Repr.indent must be a str, int or None, not {type(indent)}'\n )from error\n return sep.join(('',*pieces,''))[1:-len(indent)or None]\n \n def _repr_iterable(self,x,level,left,right,maxiter,trail=''):\n n=len(x)\n if level <=0 and n:\n s=self.fillvalue\n else:\n newlevel=level -1\n repr1=self.repr1\n pieces=[repr1(elem,newlevel)for elem in islice(x,maxiter)]\n if n >maxiter:\n pieces.append(self.fillvalue)\n s=self._join(pieces,level)\n if n ==1 and trail and self.indent is None:\n right=trail+right\n return '%s%s%s'%(left,s,right)\n \n def repr_tuple(self,x,level):\n return self._repr_iterable(x,level,'(',')',self.maxtuple,',')\n \n def repr_list(self,x,level):\n return self._repr_iterable(x,level,'[',']',self.maxlist)\n \n def repr_array(self,x,level):\n if not x:\n return \"array('%s')\"%x.typecode\n header=\"array('%s', [\"%x.typecode\n return self._repr_iterable(x,level,header,'])',self.maxarray)\n \n def repr_set(self,x,level):\n if not x:\n return 'set()'\n x=_possibly_sorted(x)\n return self._repr_iterable(x,level,'{','}',self.maxset)\n \n def repr_frozenset(self,x,level):\n if not x:\n return 'frozenset()'\n x=_possibly_sorted(x)\n return self._repr_iterable(x,level,'frozenset({','})',\n self.maxfrozenset)\n \n def repr_deque(self,x,level):\n return self._repr_iterable(x,level,'deque([','])',self.maxdeque)\n \n def repr_dict(self,x,level):\n n=len(x)\n if n ==0:\n return '{}'\n if level <=0:\n return '{'+self.fillvalue+'}'\n newlevel=level -1\n repr1=self.repr1\n pieces=[]\n for key in islice(_possibly_sorted(x),self.maxdict):\n keyrepr=repr1(key,newlevel)\n valrepr=repr1(x[key],newlevel)\n pieces.append('%s: %s'%(keyrepr,valrepr))\n if n >self.maxdict:\n pieces.append(self.fillvalue)\n s=self._join(pieces,level)\n return '{%s}'%(s,)\n \n def repr_str(self,x,level):\n s=builtins.repr(x[:self.maxstring])\n if len(s)>self.maxstring:\n i=max(0,(self.maxstring -3)//2)\n j=max(0,self.maxstring -3 -i)\n s=builtins.repr(x[:i]+x[len(x)-j:])\n s=s[:i]+self.fillvalue+s[len(s)-j:]\n return s\n \n def repr_int(self,x,level):\n s=builtins.repr(x)\n if len(s)>self.maxlong:\n i=max(0,(self.maxlong -3)//2)\n j=max(0,self.maxlong -3 -i)\n s=s[:i]+self.fillvalue+s[len(s)-j:]\n return s\n \n def repr_instance(self,x,level):\n try:\n s=builtins.repr(x)\n \n \n except Exception:\n return '<%s instance at %#x>'%(x.__class__.__name__,id(x))\n if len(s)>self.maxother:\n i=max(0,(self.maxother -3)//2)\n j=max(0,self.maxother -3 -i)\n s=s[:i]+self.fillvalue+s[len(s)-j:]\n return s\n \n \ndef _possibly_sorted(x):\n\n\n\n try:\n return sorted(x)\n except Exception:\n return list(x)\n \naRepr=Repr()\nrepr=aRepr.repr\n", ["_thread", "builtins", "itertools"]], "secrets": [".py", "''\n\n\n\n\n\n\n\n__all__=['choice','randbelow','randbits','SystemRandom',\n'token_bytes','token_hex','token_urlsafe',\n'compare_digest',\n]\n\n\nimport base64\n\nfrom hmac import compare_digest\nfrom random import SystemRandom\n\n_sysrand=SystemRandom()\n\nrandbits=_sysrand.getrandbits\nchoice=_sysrand.choice\n\ndef randbelow(exclusive_upper_bound):\n ''\n if exclusive_upper_bound <=0:\n raise ValueError(\"Upper bound must be positive.\")\n return _sysrand._randbelow(exclusive_upper_bound)\n \nDEFAULT_ENTROPY=32\n\ndef token_bytes(nbytes=None):\n ''\n\n\n\n\n\n\n\n \n if nbytes is None:\n nbytes=DEFAULT_ENTROPY\n return _sysrand.randbytes(nbytes)\n \ndef token_hex(nbytes=None):\n ''\n\n\n\n\n\n\n\n\n \n return token_bytes(nbytes).hex()\n \ndef token_urlsafe(nbytes=None):\n ''\n\n\n\n\n\n\n\n \n tok=token_bytes(nbytes)\n return base64.urlsafe_b64encode(tok).rstrip(b'=').decode('ascii')\n", ["base64", "hmac", "random"]], "select": [".py", "''\n\n\n\n\nimport errno\nimport os\n\nclass error(Exception):\n pass\n \nALL=None\n\n_exception_map={}\n\ndef _map_exception(exc,circumstance=ALL):\n try :\n mapped_exception=_exception_map[(exc.__class__,circumstance)]\n mapped_exception.java_exception=exc\n return mapped_exception\n except KeyError:\n return error(-1,'Unmapped java exception: <%s:%s>'%(exc.toString(),circumstance))\n \nPOLLIN=1\nPOLLOUT=2\n\n\n\n\n\nPOLLPRI=4\nPOLLERR=8\nPOLLHUP=16\nPOLLNVAL=32\n\ndef _getselectable(selectable_object):\n try :\n channel=selectable_object.getchannel()\n except :\n try :\n channel=selectable_object.fileno().getChannel()\n except :\n raise TypeError(\"Object '%s' is not watchable\"%selectable_object,\n errno.ENOTSOCK)\n \n return channel\n \n \nclass Selector:\n\n def close(self):\n pass\n \n def keys(self):\n return []\n \n def select(self,timeout=None ):\n return []\n \n def selectedKeys(self):\n class SelectedKeys:\n def iterator(self):\n return []\n return SelectedKeys()\n \n def selectNow(self,timeout=None ):\n return []\n \nclass poll:\n\n def __init__(self):\n self.selector=Selector()\n self.chanmap={}\n self.unconnected_sockets=[]\n \n def _register_channel(self,socket_object,channel,mask):\n jmask=0\n if mask&POLLIN:\n \n if channel.validOps()&OP_ACCEPT:\n jmask=OP_ACCEPT\n else :\n jmask=OP_READ\n if mask&POLLOUT:\n if channel.validOps()&OP_WRITE:\n jmask |=OP_WRITE\n if channel.validOps()&OP_CONNECT:\n jmask |=OP_CONNECT\n selectionkey=channel.register(self.selector,jmask)\n self.chanmap[channel]=(socket_object,selectionkey)\n \n def _check_unconnected_sockets(self):\n temp_list=[]\n for socket_object,mask in self.unconnected_sockets:\n channel=_getselectable(socket_object)\n if channel is not None :\n self._register_channel(socket_object,channel,mask)\n else :\n temp_list.append((socket_object,mask))\n self.unconnected_sockets=temp_list\n \n def register(self,socket_object,mask=POLLIN |POLLOUT |POLLPRI):\n try :\n channel=_getselectable(socket_object)\n if channel is None :\n \n \n self.unconnected_sockets.append((socket_object,mask))\n return\n self._register_channel(socket_object,channel,mask)\n except BaseException as exc:\n raise _map_exception(exc)\n \n def unregister(self,socket_object):\n try :\n channel=_getselectable(socket_object)\n self.chanmap[channel][1].cancel()\n del self.chanmap[channel]\n except BaseException as exc:\n raise _map_exception(exc)\n \n def _dopoll(self,timeout):\n if timeout is None or timeout <0:\n self.selector.select()\n else :\n try :\n timeout=int(timeout)\n if not timeout:\n self.selector.selectNow()\n else :\n \n self.selector.select(timeout)\n except ValueError as vx:\n raise error(\"poll timeout must be a number of milliseconds or None\",errno.EINVAL)\n \n return self.selector.selectedKeys()\n \n def poll(self,timeout=None ):\n return []\n \n def _deregister_all(self):\n try :\n for k in self.selector.keys():\n k.cancel()\n \n self.selector.selectNow()\n except BaseException as exc:\n raise _map_exception(exc)\n \n def close(self):\n try :\n self._deregister_all()\n self.selector.close()\n except BaseException as exc:\n raise _map_exception(exc)\n \ndef _calcselecttimeoutvalue(value):\n if value is None :\n return None\n try :\n floatvalue=float(value)\n except Exception as x:\n raise TypeError(\"Select timeout value must be a number or None\")\n if value <0:\n raise error(\"Select timeout value cannot be negative\",errno.EINVAL)\n if floatvalue <0.000001:\n return 0\n return int(floatvalue *1000)\n \n \n \n \nclass poll_object_cache:\n\n def __init__(self):\n self.is_windows=os.name =='nt'\n if self.is_windows:\n self.poll_object_queue=Queue.Queue()\n import atexit\n atexit.register(self.finalize)\n \n def get_poll_object(self):\n if not self.is_windows:\n return poll()\n try :\n return self.poll_object_queue.get(False )\n except Queue.Empty:\n return poll()\n \n def release_poll_object(self,pobj):\n if self.is_windows:\n pobj._deregister_all()\n self.poll_object_queue.put(pobj)\n else :\n pobj.close()\n \n def finalize(self):\n if self.is_windows:\n while True :\n try :\n p=self.poll_object_queue.get(False )\n p.close()\n except Queue.Empty:\n return\n \n_poll_object_cache=poll_object_cache()\n\ndef native_select(read_fd_list,write_fd_list,outofband_fd_list,timeout=None ):\n timeout=_calcselecttimeoutvalue(timeout)\n \n pobj=_poll_object_cache.get_poll_object()\n try :\n registered_for_read={}\n \n for fd in read_fd_list:\n pobj.register(fd,POLLIN)\n registered_for_read[fd]=1\n \n for fd in write_fd_list:\n if fd in registered_for_read:\n \n pobj.register(fd,POLLIN |POLLOUT)\n else :\n pobj.register(fd,POLLOUT)\n results=pobj.poll(timeout)\n \n read_ready_list,write_ready_list,oob_ready_list=[],[],[]\n for fd,mask in results:\n if mask&POLLIN:\n read_ready_list.append(fd)\n if mask&POLLOUT:\n write_ready_list.append(fd)\n return read_ready_list,write_ready_list,oob_ready_list\n finally :\n _poll_object_cache.release_poll_object(pobj)\n \nselect=native_select\n\ndef cpython_compatible_select(read_fd_list,write_fd_list,outofband_fd_list,timeout=None ):\n\n\n modified_channels=[]\n try :\n for socket_list in [read_fd_list,write_fd_list,outofband_fd_list]:\n for s in socket_list:\n channel=_getselectable(s)\n if channel.isBlocking():\n modified_channels.append(channel)\n channel.configureBlocking(0)\n return native_select(read_fd_list,write_fd_list,outofband_fd_list,timeout)\n finally :\n for channel in modified_channels:\n channel.configureBlocking(1)\n", ["atexit", "errno", "os"]], "selectors": [".py", "''\n\n\n\n\n\n\nfrom abc import ABCMeta,abstractmethod\nfrom collections import namedtuple\nfrom collections.abc import Mapping\nimport math\nimport select\nimport sys\n\n\n\nEVENT_READ=(1 <<0)\nEVENT_WRITE=(1 <<1)\n\n\ndef _fileobj_to_fd(fileobj):\n ''\n\n\n\n\n\n\n\n\n\n \n if isinstance(fileobj,int):\n fd=fileobj\n else :\n try :\n fd=int(fileobj.fileno())\n except (AttributeError,TypeError,ValueError):\n raise ValueError(\"Invalid file object: \"\n \"{!r}\".format(fileobj))from None\n if fd <0:\n raise ValueError(\"Invalid file descriptor: {}\".format(fd))\n return fd\n \n \nSelectorKey=namedtuple('SelectorKey',['fileobj','fd','events','data'])\n\nSelectorKey.__doc__=\"\"\"SelectorKey(fileobj, fd, events, data)\n\n Object used to associate a file object to its backing\n file descriptor, selected event mask, and attached data.\n\"\"\"\nSelectorKey.fileobj.__doc__='File object registered.'\nSelectorKey.fd.__doc__='Underlying file descriptor.'\nSelectorKey.events.__doc__='Events that must be waited for on this file object.'\nSelectorKey.data.__doc__=('''Optional opaque data associated to this file object.\nFor example, this could be used to store a per-client session ID.''')\n\n\nclass _SelectorMapping(Mapping):\n ''\n \n def __init__(self,selector):\n self._selector=selector\n \n def __len__(self):\n return len(self._selector._fd_to_key)\n \n def __getitem__(self,fileobj):\n try :\n fd=self._selector._fileobj_lookup(fileobj)\n return self._selector._fd_to_key[fd]\n except KeyError:\n raise KeyError(\"{!r} is not registered\".format(fileobj))from None\n \n def __iter__(self):\n return iter(self._selector._fd_to_key)\n \n \nclass BaseSelector(metaclass=ABCMeta):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n @abstractmethod\n def register(self,fileobj,events,data=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n @abstractmethod\n def unregister(self,fileobj):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n def modify(self,fileobj,events,data=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n self.unregister(fileobj)\n return self.register(fileobj,events,data)\n \n @abstractmethod\n def select(self,timeout=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n def close(self):\n ''\n\n\n \n pass\n \n def get_key(self,fileobj):\n ''\n\n\n\n \n mapping=self.get_map()\n if mapping is None :\n raise RuntimeError('Selector is closed')\n try :\n return mapping[fileobj]\n except KeyError:\n raise KeyError(\"{!r} is not registered\".format(fileobj))from None\n \n @abstractmethod\n def get_map(self):\n ''\n raise NotImplementedError\n \n def __enter__(self):\n return self\n \n def __exit__(self,*args):\n self.close()\n \n \nclass _BaseSelectorImpl(BaseSelector):\n ''\n \n def __init__(self):\n \n self._fd_to_key={}\n \n self._map=_SelectorMapping(self)\n \n def _fileobj_lookup(self,fileobj):\n ''\n\n\n\n\n\n\n \n try :\n return _fileobj_to_fd(fileobj)\n except ValueError:\n \n for key in self._fd_to_key.values():\n if key.fileobj is fileobj:\n return key.fd\n \n raise\n \n def register(self,fileobj,events,data=None ):\n if (not events)or (events&~(EVENT_READ |EVENT_WRITE)):\n raise ValueError(\"Invalid events: {!r}\".format(events))\n \n key=SelectorKey(fileobj,self._fileobj_lookup(fileobj),events,data)\n \n if key.fd in self._fd_to_key:\n raise KeyError(\"{!r} (FD {}) is already registered\"\n .format(fileobj,key.fd))\n \n self._fd_to_key[key.fd]=key\n return key\n \n def unregister(self,fileobj):\n try :\n key=self._fd_to_key.pop(self._fileobj_lookup(fileobj))\n except KeyError:\n raise KeyError(\"{!r} is not registered\".format(fileobj))from None\n return key\n \n def modify(self,fileobj,events,data=None ):\n try :\n key=self._fd_to_key[self._fileobj_lookup(fileobj)]\n except KeyError:\n raise KeyError(\"{!r} is not registered\".format(fileobj))from None\n if events !=key.events:\n self.unregister(fileobj)\n key=self.register(fileobj,events,data)\n elif data !=key.data:\n \n key=key._replace(data=data)\n self._fd_to_key[key.fd]=key\n return key\n \n def close(self):\n self._fd_to_key.clear()\n self._map=None\n \n def get_map(self):\n return self._map\n \n def _key_from_fd(self,fd):\n ''\n\n\n\n\n\n\n \n try :\n return self._fd_to_key[fd]\n except KeyError:\n return None\n \n \nclass SelectSelector(_BaseSelectorImpl):\n ''\n \n def __init__(self):\n super().__init__()\n self._readers=set()\n self._writers=set()\n \n def register(self,fileobj,events,data=None ):\n key=super().register(fileobj,events,data)\n if events&EVENT_READ:\n self._readers.add(key.fd)\n if events&EVENT_WRITE:\n self._writers.add(key.fd)\n return key\n \n def unregister(self,fileobj):\n key=super().unregister(fileobj)\n self._readers.discard(key.fd)\n self._writers.discard(key.fd)\n return key\n \n if sys.platform =='win32':\n def _select(self,r,w,_,timeout=None ):\n r,w,x=select.select(r,w,w,timeout)\n return r,w+x,[]\n else :\n _select=select.select\n \n def select(self,timeout=None ):\n timeout=None if timeout is None else max(timeout,0)\n ready=[]\n try :\n r,w,_=self._select(self._readers,self._writers,[],timeout)\n except InterruptedError:\n return ready\n r=set(r)\n w=set(w)\n for fd in r |w:\n events=0\n if fd in r:\n events |=EVENT_READ\n if fd in w:\n events |=EVENT_WRITE\n \n key=self._key_from_fd(fd)\n if key:\n ready.append((key,events&key.events))\n return ready\n \n \nclass _PollLikeSelector(_BaseSelectorImpl):\n ''\n _selector_cls=None\n _EVENT_READ=None\n _EVENT_WRITE=None\n \n def __init__(self):\n super().__init__()\n self._selector=self._selector_cls()\n \n def register(self,fileobj,events,data=None ):\n key=super().register(fileobj,events,data)\n poller_events=0\n if events&EVENT_READ:\n poller_events |=self._EVENT_READ\n if events&EVENT_WRITE:\n poller_events |=self._EVENT_WRITE\n try :\n self._selector.register(key.fd,poller_events)\n except :\n super().unregister(fileobj)\n raise\n return key\n \n def unregister(self,fileobj):\n key=super().unregister(fileobj)\n try :\n self._selector.unregister(key.fd)\n except OSError:\n \n \n pass\n return key\n \n def modify(self,fileobj,events,data=None ):\n try :\n key=self._fd_to_key[self._fileobj_lookup(fileobj)]\n except KeyError:\n raise KeyError(f\"{fileobj!r} is not registered\")from None\n \n changed=False\n if events !=key.events:\n selector_events=0\n if events&EVENT_READ:\n selector_events |=self._EVENT_READ\n if events&EVENT_WRITE:\n selector_events |=self._EVENT_WRITE\n try :\n self._selector.modify(key.fd,selector_events)\n except :\n super().unregister(fileobj)\n raise\n changed=True\n if data !=key.data:\n changed=True\n \n if changed:\n key=key._replace(events=events,data=data)\n self._fd_to_key[key.fd]=key\n return key\n \n def select(self,timeout=None ):\n \n \n if timeout is None :\n timeout=None\n elif timeout <=0:\n timeout=0\n else :\n \n \n timeout=math.ceil(timeout *1e3)\n ready=[]\n try :\n fd_event_list=self._selector.poll(timeout)\n except InterruptedError:\n return ready\n for fd,event in fd_event_list:\n events=0\n if event&~self._EVENT_READ:\n events |=EVENT_WRITE\n if event&~self._EVENT_WRITE:\n events |=EVENT_READ\n \n key=self._key_from_fd(fd)\n if key:\n ready.append((key,events&key.events))\n return ready\n \n \nif hasattr(select,'poll'):\n\n class PollSelector(_PollLikeSelector):\n ''\n _selector_cls=select.poll\n _EVENT_READ=select.POLLIN\n _EVENT_WRITE=select.POLLOUT\n \n \nif hasattr(select,'epoll'):\n\n class EpollSelector(_PollLikeSelector):\n ''\n _selector_cls=select.epoll\n _EVENT_READ=select.EPOLLIN\n _EVENT_WRITE=select.EPOLLOUT\n \n def fileno(self):\n return self._selector.fileno()\n \n def select(self,timeout=None ):\n if timeout is None :\n timeout=-1\n elif timeout <=0:\n timeout=0\n else :\n \n \n timeout=math.ceil(timeout *1e3)*1e-3\n \n \n \n \n max_ev=max(len(self._fd_to_key),1)\n \n ready=[]\n try :\n fd_event_list=self._selector.poll(timeout,max_ev)\n except InterruptedError:\n return ready\n for fd,event in fd_event_list:\n events=0\n if event&~select.EPOLLIN:\n events |=EVENT_WRITE\n if event&~select.EPOLLOUT:\n events |=EVENT_READ\n \n key=self._key_from_fd(fd)\n if key:\n ready.append((key,events&key.events))\n return ready\n \n def close(self):\n self._selector.close()\n super().close()\n \n \nif hasattr(select,'devpoll'):\n\n class DevpollSelector(_PollLikeSelector):\n ''\n _selector_cls=select.devpoll\n _EVENT_READ=select.POLLIN\n _EVENT_WRITE=select.POLLOUT\n \n def fileno(self):\n return self._selector.fileno()\n \n def close(self):\n self._selector.close()\n super().close()\n \n \nif hasattr(select,'kqueue'):\n\n class KqueueSelector(_BaseSelectorImpl):\n ''\n \n def __init__(self):\n super().__init__()\n self._selector=select.kqueue()\n \n def fileno(self):\n return self._selector.fileno()\n \n def register(self,fileobj,events,data=None ):\n key=super().register(fileobj,events,data)\n try :\n if events&EVENT_READ:\n kev=select.kevent(key.fd,select.KQ_FILTER_READ,\n select.KQ_EV_ADD)\n self._selector.control([kev],0,0)\n if events&EVENT_WRITE:\n kev=select.kevent(key.fd,select.KQ_FILTER_WRITE,\n select.KQ_EV_ADD)\n self._selector.control([kev],0,0)\n except :\n super().unregister(fileobj)\n raise\n return key\n \n def unregister(self,fileobj):\n key=super().unregister(fileobj)\n if key.events&EVENT_READ:\n kev=select.kevent(key.fd,select.KQ_FILTER_READ,\n select.KQ_EV_DELETE)\n try :\n self._selector.control([kev],0,0)\n except OSError:\n \n \n pass\n if key.events&EVENT_WRITE:\n kev=select.kevent(key.fd,select.KQ_FILTER_WRITE,\n select.KQ_EV_DELETE)\n try :\n self._selector.control([kev],0,0)\n except OSError:\n \n pass\n return key\n \n def select(self,timeout=None ):\n timeout=None if timeout is None else max(timeout,0)\n \n \n \n max_ev=max(len(self._fd_to_key),1)\n ready=[]\n try :\n kev_list=self._selector.control(None ,max_ev,timeout)\n except InterruptedError:\n return ready\n for kev in kev_list:\n fd=kev.ident\n flag=kev.filter\n events=0\n if flag ==select.KQ_FILTER_READ:\n events |=EVENT_READ\n if flag ==select.KQ_FILTER_WRITE:\n events |=EVENT_WRITE\n \n key=self._key_from_fd(fd)\n if key:\n ready.append((key,events&key.events))\n return ready\n \n def close(self):\n self._selector.close()\n super().close()\n \n \ndef _can_use(method):\n ''\n \n \n selector=getattr(select,method,None )\n if selector is None :\n \n return False\n \n \n try :\n selector_obj=selector()\n if method =='poll':\n \n selector_obj.poll(0)\n else :\n \n selector_obj.close()\n return True\n except OSError:\n return False\n \n \n \n \n \nif _can_use('kqueue'):\n DefaultSelector=KqueueSelector\nelif _can_use('epoll'):\n DefaultSelector=EpollSelector\nelif _can_use('devpoll'):\n DefaultSelector=DevpollSelector\nelif _can_use('poll'):\n DefaultSelector=PollSelector\nelse :\n DefaultSelector=SelectSelector\n", ["abc", "collections", "collections.abc", "math", "select", "sys"]], "shlex": [".py", "''\n\n\n\n\n\n\n\n\nimport os\nimport re\nimport sys\nfrom collections import deque\n\nfrom io import StringIO\n\n__all__=[\"shlex\",\"split\",\"quote\",\"join\"]\n\nclass shlex:\n ''\n def __init__(self,instream=None,infile=None,posix=False,\n punctuation_chars=False):\n if isinstance(instream,str):\n instream=StringIO(instream)\n if instream is not None:\n self.instream=instream\n self.infile=infile\n else:\n self.instream=sys.stdin\n self.infile=None\n self.posix=posix\n if posix:\n self.eof=None\n else:\n self.eof=''\n self.commenters='#'\n self.wordchars=('abcdfeghijklmnopqrstuvwxyz'\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_')\n if self.posix:\n self.wordchars +=('\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff'\n '\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de')\n self.whitespace=' \\t\\r\\n'\n self.whitespace_split=False\n self.quotes='\\'\"'\n self.escape='\\\\'\n self.escapedquotes='\"'\n self.state=' '\n self.pushback=deque()\n self.lineno=1\n self.debug=0\n self.token=''\n self.filestack=deque()\n self.source=None\n if not punctuation_chars:\n punctuation_chars=''\n elif punctuation_chars is True:\n punctuation_chars='();<>|&'\n self._punctuation_chars=punctuation_chars\n if punctuation_chars:\n \n self._pushback_chars=deque()\n \n self.wordchars +='~-./*?='\n \n t=self.wordchars.maketrans(dict.fromkeys(punctuation_chars))\n self.wordchars=self.wordchars.translate(t)\n \n @property\n def punctuation_chars(self):\n return self._punctuation_chars\n \n def push_token(self,tok):\n ''\n if self.debug >=1:\n print(\"shlex: pushing token \"+repr(tok))\n self.pushback.appendleft(tok)\n \n def push_source(self,newstream,newfile=None):\n ''\n if isinstance(newstream,str):\n newstream=StringIO(newstream)\n self.filestack.appendleft((self.infile,self.instream,self.lineno))\n self.infile=newfile\n self.instream=newstream\n self.lineno=1\n if self.debug:\n if newfile is not None:\n print('shlex: pushing to file %s'%(self.infile,))\n else:\n print('shlex: pushing to stream %s'%(self.instream,))\n \n def pop_source(self):\n ''\n self.instream.close()\n (self.infile,self.instream,self.lineno)=self.filestack.popleft()\n if self.debug:\n print('shlex: popping to %s, line %d'\\\n %(self.instream,self.lineno))\n self.state=' '\n \n def get_token(self):\n ''\n if self.pushback:\n tok=self.pushback.popleft()\n if self.debug >=1:\n print(\"shlex: popping token \"+repr(tok))\n return tok\n \n raw=self.read_token()\n \n if self.source is not None:\n while raw ==self.source:\n spec=self.sourcehook(self.read_token())\n if spec:\n (newfile,newstream)=spec\n self.push_source(newstream,newfile)\n raw=self.get_token()\n \n while raw ==self.eof:\n if not self.filestack:\n return self.eof\n else:\n self.pop_source()\n raw=self.get_token()\n \n if self.debug >=1:\n if raw !=self.eof:\n print(\"shlex: token=\"+repr(raw))\n else:\n print(\"shlex: token=EOF\")\n return raw\n \n def read_token(self):\n quoted=False\n escapedstate=' '\n while True:\n if self.punctuation_chars and self._pushback_chars:\n nextchar=self._pushback_chars.pop()\n else:\n nextchar=self.instream.read(1)\n if nextchar =='\\n':\n self.lineno +=1\n if self.debug >=3:\n print(\"shlex: in state %r I see character: %r\"%(self.state,\n nextchar))\n if self.state is None:\n self.token=''\n break\n elif self.state ==' ':\n if not nextchar:\n self.state=None\n break\n elif nextchar in self.whitespace:\n if self.debug >=2:\n print(\"shlex: I see whitespace in whitespace state\")\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n elif nextchar in self.commenters:\n self.instream.readline()\n self.lineno +=1\n elif self.posix and nextchar in self.escape:\n escapedstate='a'\n self.state=nextchar\n elif nextchar in self.wordchars:\n self.token=nextchar\n self.state='a'\n elif nextchar in self.punctuation_chars:\n self.token=nextchar\n self.state='c'\n elif nextchar in self.quotes:\n if not self.posix:\n self.token=nextchar\n self.state=nextchar\n elif self.whitespace_split:\n self.token=nextchar\n self.state='a'\n else:\n self.token=nextchar\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n elif self.state in self.quotes:\n quoted=True\n if not nextchar:\n if self.debug >=2:\n print(\"shlex: I see EOF in quotes state\")\n \n raise ValueError(\"No closing quotation\")\n if nextchar ==self.state:\n if not self.posix:\n self.token +=nextchar\n self.state=' '\n break\n else:\n self.state='a'\n elif(self.posix and nextchar in self.escape and self.state\n in self.escapedquotes):\n escapedstate=self.state\n self.state=nextchar\n else:\n self.token +=nextchar\n elif self.state in self.escape:\n if not nextchar:\n if self.debug >=2:\n print(\"shlex: I see EOF in escape state\")\n \n raise ValueError(\"No escaped character\")\n \n \n if(escapedstate in self.quotes and\n nextchar !=self.state and nextchar !=escapedstate):\n self.token +=self.state\n self.token +=nextchar\n self.state=escapedstate\n elif self.state in('a','c'):\n if not nextchar:\n self.state=None\n break\n elif nextchar in self.whitespace:\n if self.debug >=2:\n print(\"shlex: I see whitespace in word state\")\n self.state=' '\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n elif nextchar in self.commenters:\n self.instream.readline()\n self.lineno +=1\n if self.posix:\n self.state=' '\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n elif self.state =='c':\n if nextchar in self.punctuation_chars:\n self.token +=nextchar\n else:\n if nextchar not in self.whitespace:\n self._pushback_chars.append(nextchar)\n self.state=' '\n break\n elif self.posix and nextchar in self.quotes:\n self.state=nextchar\n elif self.posix and nextchar in self.escape:\n escapedstate='a'\n self.state=nextchar\n elif(nextchar in self.wordchars or nextchar in self.quotes\n or(self.whitespace_split and\n nextchar not in self.punctuation_chars)):\n self.token +=nextchar\n else:\n if self.punctuation_chars:\n self._pushback_chars.append(nextchar)\n else:\n self.pushback.appendleft(nextchar)\n if self.debug >=2:\n print(\"shlex: I see punctuation in word state\")\n self.state=' '\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n result=self.token\n self.token=''\n if self.posix and not quoted and result =='':\n result=None\n if self.debug >1:\n if result:\n print(\"shlex: raw token=\"+repr(result))\n else:\n print(\"shlex: raw token=EOF\")\n return result\n \n def sourcehook(self,newfile):\n ''\n if newfile[0]=='\"':\n newfile=newfile[1:-1]\n \n if isinstance(self.infile,str)and not os.path.isabs(newfile):\n newfile=os.path.join(os.path.dirname(self.infile),newfile)\n return(newfile,open(newfile,\"r\"))\n \n def error_leader(self,infile=None,lineno=None):\n ''\n if infile is None:\n infile=self.infile\n if lineno is None:\n lineno=self.lineno\n return \"\\\"%s\\\", line %d: \"%(infile,lineno)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n token=self.get_token()\n if token ==self.eof:\n raise StopIteration\n return token\n \ndef split(s,comments=False,posix=True):\n ''\n if s is None:\n raise ValueError(\"s argument must not be None\")\n lex=shlex(s,posix=posix)\n lex.whitespace_split=True\n if not comments:\n lex.commenters=''\n return list(lex)\n \n \ndef join(split_command):\n ''\n return ' '.join(quote(arg)for arg in split_command)\n \n \n_find_unsafe=re.compile(r'[^\\w@%+=:,./-]',re.ASCII).search\n\ndef quote(s):\n ''\n if not s:\n return \"''\"\n if _find_unsafe(s)is None:\n return s\n \n \n \n return \"'\"+s.replace(\"'\",\"'\\\"'\\\"'\")+\"'\"\n \n \ndef _print_tokens(lexer):\n while tt :=lexer.get_token():\n print(\"Token: \"+repr(tt))\n \nif __name__ =='__main__':\n if len(sys.argv)==1:\n _print_tokens(shlex())\n else:\n fn=sys.argv[1]\n with open(fn)as f:\n _print_tokens(shlex(f,fn))\n", ["collections", "io", "os", "re", "sys"]], "shutil": [".py", "''\n\n\n\n\n\nimport os\nimport sys\nimport stat\nimport fnmatch\nimport collections\nimport errno\n\ntry :\n import zlib\n del zlib\n _ZLIB_SUPPORTED=True\nexcept ImportError:\n _ZLIB_SUPPORTED=False\n \ntry :\n import bz2\n del bz2\n _BZ2_SUPPORTED=True\nexcept ImportError:\n _BZ2_SUPPORTED=False\n \ntry :\n import lzma\n del lzma\n _LZMA_SUPPORTED=True\nexcept ImportError:\n _LZMA_SUPPORTED=False\n \n_WINDOWS=os.name =='nt'\nposix=nt=None\nif os.name =='posix':\n import posix\nelif _WINDOWS:\n import nt\n \nCOPY_BUFSIZE=1024 *1024 if _WINDOWS else 64 *1024\n_USE_CP_SENDFILE=hasattr(os,\"sendfile\")and sys.platform.startswith(\"linux\")\n_HAS_FCOPYFILE=posix and hasattr(posix,\"_fcopyfile\")\n\n\n_WIN_DEFAULT_PATHEXT=\".COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC\"\n\n__all__=[\"copyfileobj\",\"copyfile\",\"copymode\",\"copystat\",\"copy\",\"copy2\",\n\"copytree\",\"move\",\"rmtree\",\"Error\",\"SpecialFileError\",\n\"ExecError\",\"make_archive\",\"get_archive_formats\",\n\"register_archive_format\",\"unregister_archive_format\",\n\"get_unpack_formats\",\"register_unpack_format\",\n\"unregister_unpack_format\",\"unpack_archive\",\n\"ignore_patterns\",\"chown\",\"which\",\"get_terminal_size\",\n\"SameFileError\"]\n\n\nclass Error(OSError):\n pass\n \nclass SameFileError(Error):\n ''\n \nclass SpecialFileError(OSError):\n ''\n \n \nclass ExecError(OSError):\n ''\n \nclass ReadError(OSError):\n ''\n \nclass RegistryError(Exception):\n ''\n \n \nclass _GiveupOnFastCopy(Exception):\n ''\n\n \n \ndef _fastcopy_fcopyfile(fsrc,fdst,flags):\n ''\n\n \n try :\n infd=fsrc.fileno()\n outfd=fdst.fileno()\n except Exception as err:\n raise _GiveupOnFastCopy(err)\n \n try :\n posix._fcopyfile(infd,outfd,flags)\n except OSError as err:\n err.filename=fsrc.name\n err.filename2=fdst.name\n if err.errno in {errno.EINVAL,errno.ENOTSUP}:\n raise _GiveupOnFastCopy(err)\n else :\n raise err from None\n \ndef _fastcopy_sendfile(fsrc,fdst):\n ''\n\n\n \n \n \n \n \n \n \n \n \n \n global _USE_CP_SENDFILE\n try :\n infd=fsrc.fileno()\n outfd=fdst.fileno()\n except Exception as err:\n raise _GiveupOnFastCopy(err)\n \n \n \n \n \n \n try :\n blocksize=max(os.fstat(infd).st_size,2 **23)\n except OSError:\n blocksize=2 **27\n \n \n if sys.maxsize <2 **32:\n blocksize=min(blocksize,2 **30)\n \n offset=0\n while True :\n try :\n sent=os.sendfile(outfd,infd,offset,blocksize)\n except OSError as err:\n \n err.filename=fsrc.name\n err.filename2=fdst.name\n \n if err.errno ==errno.ENOTSOCK:\n \n \n \n _USE_CP_SENDFILE=False\n raise _GiveupOnFastCopy(err)\n \n if err.errno ==errno.ENOSPC:\n raise err from None\n \n \n if offset ==0 and os.lseek(outfd,0,os.SEEK_CUR)==0:\n raise _GiveupOnFastCopy(err)\n \n raise err\n else :\n if sent ==0:\n break\n offset +=sent\n \ndef _copyfileobj_readinto(fsrc,fdst,length=COPY_BUFSIZE):\n ''\n\n\n \n \n fsrc_readinto=fsrc.readinto\n fdst_write=fdst.write\n with memoryview(bytearray(length))as mv:\n while True :\n n=fsrc_readinto(mv)\n if not n:\n break\n elif n 0:\n _copyfileobj_readinto(fsrc,fdst,min(file_size,COPY_BUFSIZE))\n return dst\n \n copyfileobj(fsrc,fdst)\n \n \n except IsADirectoryError as e:\n if os.path.exists(dst):\n raise\n else :\n raise FileNotFoundError(f'Directory does not exist: {dst}')from e\n \n return dst\n \ndef copymode(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n \n sys.audit(\"shutil.copymode\",src,dst)\n \n if not follow_symlinks and _islink(src)and os.path.islink(dst):\n if hasattr(os,'lchmod'):\n stat_func,chmod_func=os.lstat,os.lchmod\n else :\n return\n else :\n stat_func,chmod_func=_stat,os.chmod\n \n st=stat_func(src)\n chmod_func(dst,stat.S_IMODE(st.st_mode))\n \nif hasattr(os,'listxattr'):\n def _copyxattr(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n \n \n try :\n names=os.listxattr(src,follow_symlinks=follow_symlinks)\n except OSError as e:\n if e.errno not in (errno.ENOTSUP,errno.ENODATA,errno.EINVAL):\n raise\n return\n for name in names:\n try :\n value=os.getxattr(src,name,follow_symlinks=follow_symlinks)\n os.setxattr(dst,name,value,follow_symlinks=follow_symlinks)\n except OSError as e:\n if e.errno not in (errno.EPERM,errno.ENOTSUP,errno.ENODATA,\n errno.EINVAL):\n raise\nelse :\n def _copyxattr(*args,**kwargs):\n pass\n \ndef copystat(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.copystat\",src,dst)\n \n def _nop(*args,ns=None ,follow_symlinks=None ):\n pass\n \n \n follow=follow_symlinks or not (_islink(src)and os.path.islink(dst))\n if follow:\n \n def lookup(name):\n return getattr(os,name,_nop)\n else :\n \n \n def lookup(name):\n fn=getattr(os,name,_nop)\n if fn in os.supports_follow_symlinks:\n return fn\n return _nop\n \n if isinstance(src,os.DirEntry):\n st=src.stat(follow_symlinks=follow)\n else :\n st=lookup(\"stat\")(src,follow_symlinks=follow)\n mode=stat.S_IMODE(st.st_mode)\n lookup(\"utime\")(dst,ns=(st.st_atime_ns,st.st_mtime_ns),\n follow_symlinks=follow)\n \n \n _copyxattr(src,dst,follow_symlinks=follow)\n try :\n lookup(\"chmod\")(dst,mode,follow_symlinks=follow)\n except NotImplementedError:\n \n \n \n \n \n \n \n \n \n \n pass\n if hasattr(st,'st_flags'):\n try :\n lookup(\"chflags\")(dst,st.st_flags,follow_symlinks=follow)\n except OSError as why:\n for err in 'EOPNOTSUPP','ENOTSUP':\n if hasattr(errno,err)and why.errno ==getattr(errno,err):\n break\n else :\n raise\n \ndef copy(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n\n\n\n\n \n if os.path.isdir(dst):\n dst=os.path.join(dst,os.path.basename(src))\n copyfile(src,dst,follow_symlinks=follow_symlinks)\n copymode(src,dst,follow_symlinks=follow_symlinks)\n return dst\n \ndef copy2(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n\n\n\n \n if os.path.isdir(dst):\n dst=os.path.join(dst,os.path.basename(src))\n copyfile(src,dst,follow_symlinks=follow_symlinks)\n copystat(src,dst,follow_symlinks=follow_symlinks)\n return dst\n \ndef ignore_patterns(*patterns):\n ''\n\n\n \n def _ignore_patterns(path,names):\n ignored_names=[]\n for pattern in patterns:\n ignored_names.extend(fnmatch.filter(names,pattern))\n return set(ignored_names)\n return _ignore_patterns\n \ndef _copytree(entries,src,dst,symlinks,ignore,copy_function,\nignore_dangling_symlinks,dirs_exist_ok=False ):\n if ignore is not None :\n ignored_names=ignore(os.fspath(src),[x.name for x in entries])\n else :\n ignored_names=set()\n \n os.makedirs(dst,exist_ok=dirs_exist_ok)\n errors=[]\n use_srcentry=copy_function is copy2 or copy_function is copy\n \n for srcentry in entries:\n if srcentry.name in ignored_names:\n continue\n srcname=os.path.join(src,srcentry.name)\n dstname=os.path.join(dst,srcentry.name)\n srcobj=srcentry if use_srcentry else srcname\n try :\n is_symlink=srcentry.is_symlink()\n if is_symlink and os.name =='nt':\n \n \n lstat=srcentry.stat(follow_symlinks=False )\n if lstat.st_reparse_tag ==stat.IO_REPARSE_TAG_MOUNT_POINT:\n is_symlink=False\n if is_symlink:\n linkto=os.readlink(srcname)\n if symlinks:\n \n \n \n os.symlink(linkto,dstname)\n copystat(srcobj,dstname,follow_symlinks=not symlinks)\n else :\n \n if not os.path.exists(linkto)and ignore_dangling_symlinks:\n continue\n \n if srcentry.is_dir():\n copytree(srcobj,dstname,symlinks,ignore,\n copy_function,dirs_exist_ok=dirs_exist_ok)\n else :\n copy_function(srcobj,dstname)\n elif srcentry.is_dir():\n copytree(srcobj,dstname,symlinks,ignore,copy_function,\n dirs_exist_ok=dirs_exist_ok)\n else :\n \n copy_function(srcobj,dstname)\n \n \n except Error as err:\n errors.extend(err.args[0])\n except OSError as why:\n errors.append((srcname,dstname,str(why)))\n try :\n copystat(src,dst)\n except OSError as why:\n \n if getattr(why,'winerror',None )is None :\n errors.append((src,dst,str(why)))\n if errors:\n raise Error(errors)\n return dst\n \ndef copytree(src,dst,symlinks=False ,ignore=None ,copy_function=copy2,\nignore_dangling_symlinks=False ,dirs_exist_ok=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.copytree\",src,dst)\n with os.scandir(src)as itr:\n entries=list(itr)\n return _copytree(entries=entries,src=src,dst=dst,symlinks=symlinks,\n ignore=ignore,copy_function=copy_function,\n ignore_dangling_symlinks=ignore_dangling_symlinks,\n dirs_exist_ok=dirs_exist_ok)\n \nif hasattr(os.stat_result,'st_file_attributes'):\n\n\n\n def _rmtree_isdir(entry):\n try :\n st=entry.stat(follow_symlinks=False )\n return (stat.S_ISDIR(st.st_mode)and not\n (st.st_file_attributes&stat.FILE_ATTRIBUTE_REPARSE_POINT\n and st.st_reparse_tag ==stat.IO_REPARSE_TAG_MOUNT_POINT))\n except OSError:\n return False\n \n def _rmtree_islink(path):\n try :\n st=os.lstat(path)\n return (stat.S_ISLNK(st.st_mode)or\n (st.st_file_attributes&stat.FILE_ATTRIBUTE_REPARSE_POINT\n and st.st_reparse_tag ==stat.IO_REPARSE_TAG_MOUNT_POINT))\n except OSError:\n return False\nelse :\n def _rmtree_isdir(entry):\n try :\n return entry.is_dir(follow_symlinks=False )\n except OSError:\n return False\n \n def _rmtree_islink(path):\n return os.path.islink(path)\n \n \ndef _rmtree_unsafe(path,onerror):\n try :\n with os.scandir(path)as scandir_it:\n entries=list(scandir_it)\n except OSError:\n onerror(os.scandir,path,sys.exc_info())\n entries=[]\n for entry in entries:\n fullname=entry.path\n if _rmtree_isdir(entry):\n try :\n if entry.is_symlink():\n \n \n \n raise OSError(\"Cannot call rmtree on a symbolic link\")\n except OSError:\n onerror(os.path.islink,fullname,sys.exc_info())\n continue\n _rmtree_unsafe(fullname,onerror)\n else :\n try :\n os.unlink(fullname)\n except OSError:\n onerror(os.unlink,fullname,sys.exc_info())\n try :\n os.rmdir(path)\n except OSError:\n onerror(os.rmdir,path,sys.exc_info())\n \n \ndef _rmtree_safe_fd(topfd,path,onerror):\n try :\n with os.scandir(topfd)as scandir_it:\n entries=list(scandir_it)\n except OSError as err:\n err.filename=path\n onerror(os.scandir,path,sys.exc_info())\n return\n for entry in entries:\n fullname=os.path.join(path,entry.name)\n try :\n is_dir=entry.is_dir(follow_symlinks=False )\n except OSError:\n is_dir=False\n else :\n if is_dir:\n try :\n orig_st=entry.stat(follow_symlinks=False )\n is_dir=stat.S_ISDIR(orig_st.st_mode)\n except OSError:\n onerror(os.lstat,fullname,sys.exc_info())\n continue\n if is_dir:\n try :\n dirfd=os.open(entry.name,os.O_RDONLY,dir_fd=topfd)\n except OSError:\n onerror(os.open,fullname,sys.exc_info())\n else :\n try :\n if os.path.samestat(orig_st,os.fstat(dirfd)):\n _rmtree_safe_fd(dirfd,fullname,onerror)\n try :\n os.rmdir(entry.name,dir_fd=topfd)\n except OSError:\n onerror(os.rmdir,fullname,sys.exc_info())\n else :\n try :\n \n \n \n raise OSError(\"Cannot call rmtree on a symbolic \"\n \"link\")\n except OSError:\n onerror(os.path.islink,fullname,sys.exc_info())\n finally :\n os.close(dirfd)\n else :\n try :\n os.unlink(entry.name,dir_fd=topfd)\n except OSError:\n onerror(os.unlink,fullname,sys.exc_info())\n \n_use_fd_functions=({os.open,os.stat,os.unlink,os.rmdir}<=\nos.supports_dir_fd and\nos.scandir in os.supports_fd and\nos.stat in os.supports_follow_symlinks)\n\ndef rmtree(path,ignore_errors=False ,onerror=None ):\n ''\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.rmtree\",path)\n if ignore_errors:\n def onerror(*args):\n pass\n elif onerror is None :\n def onerror(*args):\n raise\n if _use_fd_functions:\n \n if isinstance(path,bytes):\n path=os.fsdecode(path)\n \n \n try :\n orig_st=os.lstat(path)\n except Exception:\n onerror(os.lstat,path,sys.exc_info())\n return\n try :\n fd=os.open(path,os.O_RDONLY)\n except Exception:\n onerror(os.open,path,sys.exc_info())\n return\n try :\n if os.path.samestat(orig_st,os.fstat(fd)):\n _rmtree_safe_fd(fd,path,onerror)\n try :\n os.rmdir(path)\n except OSError:\n onerror(os.rmdir,path,sys.exc_info())\n else :\n try :\n \n raise OSError(\"Cannot call rmtree on a symbolic link\")\n except OSError:\n onerror(os.path.islink,path,sys.exc_info())\n finally :\n os.close(fd)\n else :\n try :\n if _rmtree_islink(path):\n \n raise OSError(\"Cannot call rmtree on a symbolic link\")\n except OSError:\n onerror(os.path.islink,path,sys.exc_info())\n \n return\n return _rmtree_unsafe(path,onerror)\n \n \n \nrmtree.avoids_symlink_attacks=_use_fd_functions\n\ndef _basename(path):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n path=os.fspath(path)\n sep=os.path.sep+(os.path.altsep or '')\n return os.path.basename(path.rstrip(sep))\n \ndef move(src,dst,copy_function=copy2):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.move\",src,dst)\n real_dst=dst\n if os.path.isdir(dst):\n if _samefile(src,dst):\n \n \n os.rename(src,dst)\n return\n \n \n \n real_dst=os.path.join(dst,_basename(src))\n \n if os.path.exists(real_dst):\n raise Error(\"Destination path '%s' already exists\"%real_dst)\n try :\n os.rename(src,real_dst)\n except OSError:\n if os.path.islink(src):\n linkto=os.readlink(src)\n os.symlink(linkto,real_dst)\n os.unlink(src)\n elif os.path.isdir(src):\n if _destinsrc(src,dst):\n raise Error(\"Cannot move a directory '%s' into itself\"\n \" '%s'.\"%(src,dst))\n if (_is_immutable(src)\n or (not os.access(src,os.W_OK)and os.listdir(src)\n and sys.platform =='darwin')):\n raise PermissionError(\"Cannot move the non-empty directory \"\n \"'%s': Lacking write permission to '%s'.\"\n %(src,src))\n copytree(src,real_dst,copy_function=copy_function,\n symlinks=True )\n rmtree(src)\n else :\n copy_function(src,real_dst)\n os.unlink(src)\n return real_dst\n \ndef _destinsrc(src,dst):\n src=os.path.abspath(src)\n dst=os.path.abspath(dst)\n if not src.endswith(os.path.sep):\n src +=os.path.sep\n if not dst.endswith(os.path.sep):\n dst +=os.path.sep\n return dst.startswith(src)\n \ndef _is_immutable(src):\n st=_stat(src)\n immutable_states=[stat.UF_IMMUTABLE,stat.SF_IMMUTABLE]\n return hasattr(st,'st_flags')and st.st_flags in immutable_states\n \ndef _get_gid(name):\n ''\n if name is None :\n return None\n \n try :\n from grp import getgrnam\n except ImportError:\n return None\n \n try :\n result=getgrnam(name)\n except KeyError:\n result=None\n if result is not None :\n return result[2]\n return None\n \ndef _get_uid(name):\n ''\n if name is None :\n return None\n \n try :\n from pwd import getpwnam\n except ImportError:\n return None\n \n try :\n result=getpwnam(name)\n except KeyError:\n result=None\n if result is not None :\n return result[2]\n return None\n \ndef _make_tarball(base_name,base_dir,compress=\"gzip\",verbose=0,dry_run=0,\nowner=None ,group=None ,logger=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n if compress is None :\n tar_compression=''\n elif _ZLIB_SUPPORTED and compress =='gzip':\n tar_compression='gz'\n elif _BZ2_SUPPORTED and compress =='bzip2':\n tar_compression='bz2'\n elif _LZMA_SUPPORTED and compress =='xz':\n tar_compression='xz'\n else :\n raise ValueError(\"bad value for 'compress', or compression format not \"\n \"supported : {0}\".format(compress))\n \n import tarfile\n \n compress_ext='.'+tar_compression if compress else ''\n archive_name=base_name+'.tar'+compress_ext\n archive_dir=os.path.dirname(archive_name)\n \n if archive_dir and not os.path.exists(archive_dir):\n if logger is not None :\n logger.info(\"creating %s\",archive_dir)\n if not dry_run:\n os.makedirs(archive_dir)\n \n \n if logger is not None :\n logger.info('Creating tar archive')\n \n uid=_get_uid(owner)\n gid=_get_gid(group)\n \n def _set_uid_gid(tarinfo):\n if gid is not None :\n tarinfo.gid=gid\n tarinfo.gname=group\n if uid is not None :\n tarinfo.uid=uid\n tarinfo.uname=owner\n return tarinfo\n \n if not dry_run:\n tar=tarfile.open(archive_name,'w|%s'%tar_compression)\n try :\n tar.add(base_dir,filter=_set_uid_gid)\n finally :\n tar.close()\n \n return archive_name\n \ndef _make_zipfile(base_name,base_dir,verbose=0,dry_run=0,logger=None ):\n ''\n\n\n\n \n import zipfile\n \n zip_filename=base_name+\".zip\"\n archive_dir=os.path.dirname(base_name)\n \n if archive_dir and not os.path.exists(archive_dir):\n if logger is not None :\n logger.info(\"creating %s\",archive_dir)\n if not dry_run:\n os.makedirs(archive_dir)\n \n if logger is not None :\n logger.info(\"creating '%s' and adding '%s' to it\",\n zip_filename,base_dir)\n \n if not dry_run:\n with zipfile.ZipFile(zip_filename,\"w\",\n compression=zipfile.ZIP_DEFLATED)as zf:\n path=os.path.normpath(base_dir)\n if path !=os.curdir:\n zf.write(path,path)\n if logger is not None :\n logger.info(\"adding '%s'\",path)\n for dirpath,dirnames,filenames in os.walk(base_dir):\n for name in sorted(dirnames):\n path=os.path.normpath(os.path.join(dirpath,name))\n zf.write(path,path)\n if logger is not None :\n logger.info(\"adding '%s'\",path)\n for name in filenames:\n path=os.path.normpath(os.path.join(dirpath,name))\n if os.path.isfile(path):\n zf.write(path,path)\n if logger is not None :\n logger.info(\"adding '%s'\",path)\n \n return zip_filename\n \n_ARCHIVE_FORMATS={\n'tar':(_make_tarball,[('compress',None )],\"uncompressed tar file\"),\n}\n\nif _ZLIB_SUPPORTED:\n _ARCHIVE_FORMATS['gztar']=(_make_tarball,[('compress','gzip')],\n \"gzip'ed tar-file\")\n _ARCHIVE_FORMATS['zip']=(_make_zipfile,[],\"ZIP file\")\n \nif _BZ2_SUPPORTED:\n _ARCHIVE_FORMATS['bztar']=(_make_tarball,[('compress','bzip2')],\n \"bzip2'ed tar-file\")\n \nif _LZMA_SUPPORTED:\n _ARCHIVE_FORMATS['xztar']=(_make_tarball,[('compress','xz')],\n \"xz'ed tar-file\")\n \ndef get_archive_formats():\n ''\n\n\n \n formats=[(name,registry[2])for name,registry in\n _ARCHIVE_FORMATS.items()]\n formats.sort()\n return formats\n \ndef register_archive_format(name,function,extra_args=None ,description=''):\n ''\n\n\n\n\n\n\n \n if extra_args is None :\n extra_args=[]\n if not callable(function):\n raise TypeError('The %s object is not callable'%function)\n if not isinstance(extra_args,(tuple,list)):\n raise TypeError('extra_args needs to be a sequence')\n for element in extra_args:\n if not isinstance(element,(tuple,list))or len(element)!=2:\n raise TypeError('extra_args elements are : (arg_name, value)')\n \n _ARCHIVE_FORMATS[name]=(function,extra_args,description)\n \ndef unregister_archive_format(name):\n del _ARCHIVE_FORMATS[name]\n \ndef make_archive(base_name,format,root_dir=None ,base_dir=None ,verbose=0,\ndry_run=0,owner=None ,group=None ,logger=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.make_archive\",base_name,format,root_dir,base_dir)\n save_cwd=os.getcwd()\n if root_dir is not None :\n if logger is not None :\n logger.debug(\"changing into '%s'\",root_dir)\n base_name=os.path.abspath(base_name)\n if not dry_run:\n os.chdir(root_dir)\n \n if base_dir is None :\n base_dir=os.curdir\n \n kwargs={'dry_run':dry_run,'logger':logger}\n \n try :\n format_info=_ARCHIVE_FORMATS[format]\n except KeyError:\n raise ValueError(\"unknown archive format '%s'\"%format)from None\n \n func=format_info[0]\n for arg,val in format_info[1]:\n kwargs[arg]=val\n \n if format !='zip':\n kwargs['owner']=owner\n kwargs['group']=group\n \n try :\n filename=func(base_name,base_dir,**kwargs)\n finally :\n if root_dir is not None :\n if logger is not None :\n logger.debug(\"changing back to '%s'\",save_cwd)\n os.chdir(save_cwd)\n \n return filename\n \n \ndef get_unpack_formats():\n ''\n\n\n\n \n formats=[(name,info[0],info[3])for name,info in\n _UNPACK_FORMATS.items()]\n formats.sort()\n return formats\n \ndef _check_unpack_options(extensions,function,extra_args):\n ''\n \n existing_extensions={}\n for name,info in _UNPACK_FORMATS.items():\n for ext in info[0]:\n existing_extensions[ext]=name\n \n for extension in extensions:\n if extension in existing_extensions:\n msg='%s is already registered for \"%s\"'\n raise RegistryError(msg %(extension,\n existing_extensions[extension]))\n \n if not callable(function):\n raise TypeError('The registered function must be a callable')\n \n \ndef register_unpack_format(name,extensions,function,extra_args=None ,\ndescription=''):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if extra_args is None :\n extra_args=[]\n _check_unpack_options(extensions,function,extra_args)\n _UNPACK_FORMATS[name]=extensions,function,extra_args,description\n \ndef unregister_unpack_format(name):\n ''\n del _UNPACK_FORMATS[name]\n \ndef _ensure_directory(path):\n ''\n dirname=os.path.dirname(path)\n if not os.path.isdir(dirname):\n os.makedirs(dirname)\n \ndef _unpack_zipfile(filename,extract_dir):\n ''\n \n import zipfile\n \n if not zipfile.is_zipfile(filename):\n raise ReadError(\"%s is not a zip file\"%filename)\n \n zip=zipfile.ZipFile(filename)\n try :\n for info in zip.infolist():\n name=info.filename\n \n \n if name.startswith('/')or '..'in name:\n continue\n \n targetpath=os.path.join(extract_dir,*name.split('/'))\n if not targetpath:\n continue\n \n _ensure_directory(targetpath)\n if not name.endswith('/'):\n \n with zip.open(name,'r')as source,\\\n open(targetpath,'wb')as target:\n copyfileobj(source,target)\n finally :\n zip.close()\n \ndef _unpack_tarfile(filename,extract_dir):\n ''\n \n import tarfile\n try :\n tarobj=tarfile.open(filename)\n except tarfile.TarError:\n raise ReadError(\n \"%s is not a compressed or uncompressed tar file\"%filename)\n try :\n tarobj.extractall(extract_dir)\n finally :\n tarobj.close()\n \n_UNPACK_FORMATS={\n'tar':(['.tar'],_unpack_tarfile,[],\"uncompressed tar file\"),\n'zip':(['.zip'],_unpack_zipfile,[],\"ZIP file\"),\n}\n\nif _ZLIB_SUPPORTED:\n _UNPACK_FORMATS['gztar']=(['.tar.gz','.tgz'],_unpack_tarfile,[],\n \"gzip'ed tar-file\")\n \nif _BZ2_SUPPORTED:\n _UNPACK_FORMATS['bztar']=(['.tar.bz2','.tbz2'],_unpack_tarfile,[],\n \"bzip2'ed tar-file\")\n \nif _LZMA_SUPPORTED:\n _UNPACK_FORMATS['xztar']=(['.tar.xz','.txz'],_unpack_tarfile,[],\n \"xz'ed tar-file\")\n \ndef _find_unpack_format(filename):\n for name,info in _UNPACK_FORMATS.items():\n for extension in info[0]:\n if filename.endswith(extension):\n return name\n return None\n \ndef unpack_archive(filename,extract_dir=None ,format=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.unpack_archive\",filename,extract_dir,format)\n \n if extract_dir is None :\n extract_dir=os.getcwd()\n \n extract_dir=os.fspath(extract_dir)\n filename=os.fspath(filename)\n \n if format is not None :\n try :\n format_info=_UNPACK_FORMATS[format]\n except KeyError:\n raise ValueError(\"Unknown unpack format '{0}'\".format(format))from None\n \n func=format_info[1]\n func(filename,extract_dir,**dict(format_info[2]))\n else :\n \n format=_find_unpack_format(filename)\n if format is None :\n raise ReadError(\"Unknown archive format '{0}'\".format(filename))\n \n func=_UNPACK_FORMATS[format][1]\n kwargs=dict(_UNPACK_FORMATS[format][2])\n func(filename,extract_dir,**kwargs)\n \n \nif hasattr(os,'statvfs'):\n\n __all__.append('disk_usage')\n _ntuple_diskusage=collections.namedtuple('usage','total used free')\n _ntuple_diskusage.total.__doc__='Total space in bytes'\n _ntuple_diskusage.used.__doc__='Used space in bytes'\n _ntuple_diskusage.free.__doc__='Free space in bytes'\n \n def disk_usage(path):\n ''\n\n\n\n \n st=os.statvfs(path)\n free=st.f_bavail *st.f_frsize\n total=st.f_blocks *st.f_frsize\n used=(st.f_blocks -st.f_bfree)*st.f_frsize\n return _ntuple_diskusage(total,used,free)\n \nelif _WINDOWS:\n\n __all__.append('disk_usage')\n _ntuple_diskusage=collections.namedtuple('usage','total used free')\n \n def disk_usage(path):\n ''\n\n\n\n \n total,free=nt._getdiskusage(path)\n used=total -free\n return _ntuple_diskusage(total,used,free)\n \n \ndef chown(path,user=None ,group=None ):\n ''\n\n\n\n \n sys.audit('shutil.chown',path,user,group)\n \n if user is None and group is None :\n raise ValueError(\"user and/or group must be set\")\n \n _user=user\n _group=group\n \n \n if user is None :\n _user=-1\n \n elif isinstance(user,str):\n _user=_get_uid(user)\n if _user is None :\n raise LookupError(\"no such user: {!r}\".format(user))\n \n if group is None :\n _group=-1\n elif not isinstance(group,int):\n _group=_get_gid(group)\n if _group is None :\n raise LookupError(\"no such group: {!r}\".format(group))\n \n os.chown(path,_user,_group)\n \ndef get_terminal_size(fallback=(80,24)):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n try :\n columns=int(os.environ['COLUMNS'])\n except (KeyError,ValueError):\n columns=0\n \n try :\n lines=int(os.environ['LINES'])\n except (KeyError,ValueError):\n lines=0\n \n \n if columns <=0 or lines <=0:\n try :\n size=os.get_terminal_size(sys.__stdout__.fileno())\n except (AttributeError,ValueError,OSError):\n \n \n size=os.terminal_size(fallback)\n if columns <=0:\n columns=size.columns\n if lines <=0:\n lines=size.lines\n \n return os.terminal_size((columns,lines))\n \n \n \n \n \ndef _access_check(fn,mode):\n return (os.path.exists(fn)and os.access(fn,mode)\n and not os.path.isdir(fn))\n \n \ndef which(cmd,mode=os.F_OK |os.X_OK,path=None ):\n ''\n\n\n\n\n\n\n\n \n \n \n \n if os.path.dirname(cmd):\n if _access_check(cmd,mode):\n return cmd\n return None\n \n use_bytes=isinstance(cmd,bytes)\n \n if path is None :\n path=os.environ.get(\"PATH\",None )\n if path is None :\n try :\n path=os.confstr(\"CS_PATH\")\n except (AttributeError,ValueError):\n \n path=os.defpath\n \n \n \n \n if not path:\n return None\n \n if use_bytes:\n path=os.fsencode(path)\n path=path.split(os.fsencode(os.pathsep))\n else :\n path=os.fsdecode(path)\n path=path.split(os.pathsep)\n \n if sys.platform ==\"win32\":\n \n curdir=os.curdir\n if use_bytes:\n curdir=os.fsencode(curdir)\n if curdir not in path:\n path.insert(0,curdir)\n \n \n pathext_source=os.getenv(\"PATHEXT\")or _WIN_DEFAULT_PATHEXT\n pathext=[ext for ext in pathext_source.split(os.pathsep)if ext]\n \n if use_bytes:\n pathext=[os.fsencode(ext)for ext in pathext]\n \n \n \n \n if any(cmd.lower().endswith(ext.lower())for ext in pathext):\n files=[cmd]\n else :\n files=[cmd+ext for ext in pathext]\n else :\n \n \n files=[cmd]\n \n seen=set()\n for dir in path:\n normdir=os.path.normcase(dir)\n if not normdir in seen:\n seen.add(normdir)\n for thefile in files:\n name=os.path.join(dir,thefile)\n if _access_check(name,mode):\n return name\n return None\n", ["bz2", "collections", "errno", "fnmatch", "grp", "lzma", "nt", "os", "posix", "pwd", "stat", "sys", "tarfile", "zipfile", "zlib"]], "signal": [".py", "import _signal\nfrom _signal import *\nfrom enum import IntEnum as _IntEnum\n\n_globals=globals()\n\n_IntEnum._convert_(\n'Signals',__name__,\nlambda name:\nname.isupper()\nand (name.startswith('SIG')and not name.startswith('SIG_'))\nor name.startswith('CTRL_'))\n\n_IntEnum._convert_(\n'Handlers',__name__,\nlambda name:name in ('SIG_DFL','SIG_IGN'))\n\nif 'pthread_sigmask'in _globals:\n _IntEnum._convert_(\n 'Sigmasks',__name__,\n lambda name:name in ('SIG_BLOCK','SIG_UNBLOCK','SIG_SETMASK'))\n \n \ndef _int_to_enum(value,enum_klass):\n ''\n\n \n try :\n return enum_klass(value)\n except ValueError:\n return value\n \n \ndef _enum_to_int(value):\n ''\n\n \n try :\n return int(value)\n except (ValueError,TypeError):\n return value\n \n \n \n \n \n \ndef _wraps(wrapped):\n def decorator(wrapper):\n wrapper.__doc__=wrapped.__doc__\n return wrapper\n return decorator\n \n@_wraps(_signal.signal)\ndef signal(signalnum,handler):\n handler=_signal.signal(_enum_to_int(signalnum),_enum_to_int(handler))\n return _int_to_enum(handler,Handlers)\n \n \n@_wraps(_signal.getsignal)\ndef getsignal(signalnum):\n handler=_signal.getsignal(signalnum)\n return _int_to_enum(handler,Handlers)\n \n \nif 'pthread_sigmask'in _globals:\n @_wraps(_signal.pthread_sigmask)\n def pthread_sigmask(how,mask):\n sigs_set=_signal.pthread_sigmask(how,mask)\n return set(_int_to_enum(x,Signals)for x in sigs_set)\n \n \nif 'sigpending'in _globals:\n @_wraps(_signal.sigpending)\n def sigpending():\n return {_int_to_enum(x,Signals)for x in _signal.sigpending()}\n \n \nif 'sigwait'in _globals:\n @_wraps(_signal.sigwait)\n def sigwait(sigset):\n retsig=_signal.sigwait(sigset)\n return _int_to_enum(retsig,Signals)\n \n \nif 'valid_signals'in _globals:\n @_wraps(_signal.valid_signals)\n def valid_signals():\n return {_int_to_enum(x,Signals)for x in _signal.valid_signals()}\n \n \ndel _globals,_wraps\n", ["_signal", "enum"]], "site": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport sys\nimport os\nimport builtins\nimport _sitebuiltins\nimport io\n\n\nPREFIXES=[sys.prefix,sys.exec_prefix]\n\n\nENABLE_USER_SITE=None\n\n\n\n\nUSER_SITE=None\nUSER_BASE=None\n\n\ndef _trace(message):\n if sys.flags.verbose:\n print(message,file=sys.stderr)\n \n \ndef makepath(*paths):\n dir=os.path.join(*paths)\n try:\n dir=os.path.abspath(dir)\n except OSError:\n pass\n return dir,os.path.normcase(dir)\n \n \ndef abs_paths():\n ''\n for m in set(sys.modules.values()):\n loader_module=None\n try:\n loader_module=m.__loader__.__module__\n except AttributeError:\n try:\n loader_module=m.__spec__.loader.__module__\n except AttributeError:\n pass\n if loader_module not in{'_frozen_importlib','_frozen_importlib_external'}:\n continue\n try:\n m.__file__=os.path.abspath(m.__file__)\n except(AttributeError,OSError,TypeError):\n pass\n try:\n m.__cached__=os.path.abspath(m.__cached__)\n except(AttributeError,OSError,TypeError):\n pass\n \n \ndef removeduppaths():\n ''\n \n \n \n L=[]\n known_paths=set()\n for dir in sys.path:\n \n \n \n dir,dircase=makepath(dir)\n if dircase not in known_paths:\n L.append(dir)\n known_paths.add(dircase)\n sys.path[:]=L\n return known_paths\n \n \ndef _init_pathinfo():\n ''\n d=set()\n for item in sys.path:\n try:\n if os.path.exists(item):\n _,itemcase=makepath(item)\n d.add(itemcase)\n except TypeError:\n continue\n return d\n \n \ndef addpackage(sitedir,name,known_paths):\n ''\n\n\n \n if known_paths is None:\n known_paths=_init_pathinfo()\n reset=True\n else:\n reset=False\n fullname=os.path.join(sitedir,name)\n _trace(f\"Processing .pth file: {fullname !r}\")\n try:\n \n \n f=io.TextIOWrapper(io.open_code(fullname),encoding=\"locale\")\n except OSError:\n return\n with f:\n for n,line in enumerate(f):\n if line.startswith(\"#\"):\n continue\n if line.strip()==\"\":\n continue\n try:\n if line.startswith((\"import \",\"import\\t\")):\n exec(line)\n continue\n line=line.rstrip()\n dir,dircase=makepath(sitedir,line)\n if not dircase in known_paths and os.path.exists(dir):\n sys.path.append(dir)\n known_paths.add(dircase)\n except Exception as exc:\n print(\"Error processing line {:d} of {}:\\n\".format(n+1,fullname),\n file=sys.stderr)\n import traceback\n for record in traceback.format_exception(exc):\n for line in record.splitlines():\n print(' '+line,file=sys.stderr)\n print(\"\\nRemainder of file ignored\",file=sys.stderr)\n break\n if reset:\n known_paths=None\n return known_paths\n \n \ndef addsitedir(sitedir,known_paths=None):\n ''\n \n _trace(f\"Adding directory: {sitedir !r}\")\n if known_paths is None:\n known_paths=_init_pathinfo()\n reset=True\n else:\n reset=False\n sitedir,sitedircase=makepath(sitedir)\n if not sitedircase in known_paths:\n sys.path.append(sitedir)\n known_paths.add(sitedircase)\n try:\n names=os.listdir(sitedir)\n except OSError:\n return\n names=[name for name in names if name.endswith(\".pth\")]\n for name in sorted(names):\n addpackage(sitedir,name,known_paths)\n if reset:\n known_paths=None\n return known_paths\n \n \ndef check_enableusersite():\n ''\n\n\n\n\n\n\n\n \n if sys.flags.no_user_site:\n return False\n \n if hasattr(os,\"getuid\")and hasattr(os,\"geteuid\"):\n \n if os.geteuid()!=os.getuid():\n return None\n if hasattr(os,\"getgid\")and hasattr(os,\"getegid\"):\n \n if os.getegid()!=os.getgid():\n return None\n \n return True\n \n \n \n \n \n \n \n \n \ndef _getuserbase():\n env_base=os.environ.get(\"PYTHONUSERBASE\",None)\n if env_base:\n return env_base\n \n \n if sys.platform in{\"emscripten\",\"vxworks\",\"wasi\"}:\n return None\n \n def joinuser(*args):\n return os.path.expanduser(os.path.join(*args))\n \n if os.name ==\"nt\":\n base=os.environ.get(\"APPDATA\")or \"~\"\n return joinuser(base,\"Python\")\n \n if sys.platform ==\"darwin\"and sys._framework:\n return joinuser(\"~\",\"Library\",sys._framework,\n \"%d.%d\"%sys.version_info[:2])\n \n return joinuser(\"~\",\".local\")\n \n \n \ndef _get_path(userbase):\n version=sys.version_info\n \n if os.name =='nt':\n ver_nodot=sys.winver.replace('.','')\n return f'{userbase}\\\\Python{ver_nodot}\\\\site-packages'\n \n if sys.platform =='darwin'and sys._framework:\n return f'{userbase}/lib/python/site-packages'\n \n return f'{userbase}/lib/python{version[0]}.{version[1]}/site-packages'\n \n \ndef getuserbase():\n ''\n\n\n\n\n \n global USER_BASE\n if USER_BASE is None:\n USER_BASE=_getuserbase()\n return USER_BASE\n \n \ndef getusersitepackages():\n ''\n\n\n\n \n global USER_SITE,ENABLE_USER_SITE\n userbase=getuserbase()\n \n if USER_SITE is None:\n if userbase is None:\n ENABLE_USER_SITE=False\n else:\n USER_SITE=_get_path(userbase)\n \n return USER_SITE\n \ndef addusersitepackages(known_paths):\n ''\n\n\n\n \n \n \n _trace(\"Processing user site-packages\")\n user_site=getusersitepackages()\n \n if ENABLE_USER_SITE and os.path.isdir(user_site):\n addsitedir(user_site,known_paths)\n return known_paths\n \ndef getsitepackages(prefixes=None):\n ''\n\n\n\n\n \n sitepackages=[]\n seen=set()\n \n if prefixes is None:\n prefixes=PREFIXES\n \n for prefix in prefixes:\n if not prefix or prefix in seen:\n continue\n seen.add(prefix)\n \n if os.sep =='/':\n libdirs=[sys.platlibdir]\n if sys.platlibdir !=\"lib\":\n libdirs.append(\"lib\")\n \n for libdir in libdirs:\n path=os.path.join(prefix,libdir,\n \"python%d.%d\"%sys.version_info[:2],\n \"site-packages\")\n sitepackages.append(path)\n else:\n sitepackages.append(prefix)\n sitepackages.append(os.path.join(prefix,\"Lib\",\"site-packages\"))\n return sitepackages\n \ndef addsitepackages(known_paths,prefixes=None):\n ''\n _trace(\"Processing global site-packages\")\n for sitedir in getsitepackages(prefixes):\n if os.path.isdir(sitedir):\n addsitedir(sitedir,known_paths)\n \n return known_paths\n \ndef setquit():\n ''\n\n\n\n\n \n if os.sep =='\\\\':\n eof='Ctrl-Z plus Return'\n else:\n eof='Ctrl-D (i.e. EOF)'\n \n builtins.quit=_sitebuiltins.Quitter('quit',eof)\n builtins.exit=_sitebuiltins.Quitter('exit',eof)\n \n \ndef setcopyright():\n ''\n builtins.copyright=_sitebuiltins._Printer(\"copyright\",sys.copyright)\n builtins.credits=_sitebuiltins._Printer(\"credits\",\"\"\"\\\n Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands\n for supporting Python development. See www.python.org for more information.\"\"\")\n files,dirs=[],[]\n \n \n here=getattr(sys,'_stdlib_dir',None)\n if not here and hasattr(os,'__file__'):\n here=os.path.dirname(os.__file__)\n if here:\n files.extend([\"LICENSE.txt\",\"LICENSE\"])\n dirs.extend([os.path.join(here,os.pardir),here,os.curdir])\n builtins.license=_sitebuiltins._Printer(\n \"license\",\n \"See https://www.python.org/psf/license/\",\n files,dirs)\n \n \ndef sethelper():\n builtins.help=_sitebuiltins._Helper()\n \ndef enablerlcompleter():\n ''\n\n\n\n\n\n\n \n def register_readline():\n import atexit\n try:\n import readline\n import rlcompleter\n except ImportError:\n return\n \n \n \n readline_doc=getattr(readline,'__doc__','')\n if readline_doc is not None and 'libedit'in readline_doc:\n readline.parse_and_bind('bind ^I rl_complete')\n else:\n readline.parse_and_bind('tab: complete')\n \n try:\n readline.read_init_file()\n except OSError:\n \n \n \n \n pass\n \n if readline.get_current_history_length()==0:\n \n \n \n \n \n history=os.path.join(os.path.expanduser('~'),\n '.python_history')\n try:\n readline.read_history_file(history)\n except OSError:\n pass\n \n def write_history():\n try:\n readline.write_history_file(history)\n except OSError:\n \n \n pass\n \n atexit.register(write_history)\n \n sys.__interactivehook__=register_readline\n \ndef venv(known_paths):\n global PREFIXES,ENABLE_USER_SITE\n \n env=os.environ\n if sys.platform =='darwin'and '__PYVENV_LAUNCHER__'in env:\n executable=sys._base_executable=os.environ['__PYVENV_LAUNCHER__']\n else:\n executable=sys.executable\n exe_dir=os.path.dirname(os.path.abspath(executable))\n site_prefix=os.path.dirname(exe_dir)\n sys._home=None\n conf_basename='pyvenv.cfg'\n candidate_conf=next(\n (\n conffile for conffile in(\n os.path.join(exe_dir,conf_basename),\n os.path.join(site_prefix,conf_basename)\n )\n if os.path.isfile(conffile)\n ),\n None\n )\n \n if candidate_conf:\n virtual_conf=candidate_conf\n system_site=\"true\"\n \n \n with open(virtual_conf,encoding='utf-8')as f:\n for line in f:\n if '='in line:\n key,_,value=line.partition('=')\n key=key.strip().lower()\n value=value.strip()\n if key =='include-system-site-packages':\n system_site=value.lower()\n elif key =='home':\n sys._home=value\n \n sys.prefix=sys.exec_prefix=site_prefix\n \n \n addsitepackages(known_paths,[sys.prefix])\n \n \n \n if system_site ==\"true\":\n PREFIXES.insert(0,sys.prefix)\n else:\n PREFIXES=[sys.prefix]\n ENABLE_USER_SITE=False\n \n return known_paths\n \n \ndef execsitecustomize():\n ''\n try:\n try:\n import sitecustomize\n except ImportError as exc:\n if exc.name =='sitecustomize':\n pass\n else:\n raise\n except Exception as err:\n if sys.flags.verbose:\n sys.excepthook(*sys.exc_info())\n else:\n sys.stderr.write(\n \"Error in sitecustomize; set PYTHONVERBOSE for traceback:\\n\"\n \"%s: %s\\n\"%\n (err.__class__.__name__,err))\n \n \ndef execusercustomize():\n ''\n try:\n try:\n import usercustomize\n except ImportError as exc:\n if exc.name =='usercustomize':\n pass\n else:\n raise\n except Exception as err:\n if sys.flags.verbose:\n sys.excepthook(*sys.exc_info())\n else:\n sys.stderr.write(\n \"Error in usercustomize; set PYTHONVERBOSE for traceback:\\n\"\n \"%s: %s\\n\"%\n (err.__class__.__name__,err))\n \n \ndef main():\n ''\n\n\n\n \n global ENABLE_USER_SITE\n \n orig_path=sys.path[:]\n known_paths=removeduppaths()\n if orig_path !=sys.path:\n \n \n abs_paths()\n \n known_paths=venv(known_paths)\n if ENABLE_USER_SITE is None:\n ENABLE_USER_SITE=check_enableusersite()\n known_paths=addusersitepackages(known_paths)\n known_paths=addsitepackages(known_paths)\n setquit()\n setcopyright()\n sethelper()\n if not sys.flags.isolated:\n enablerlcompleter()\n execsitecustomize()\n if ENABLE_USER_SITE:\n execusercustomize()\n \n \n \nif not sys.flags.no_site:\n main()\n \ndef _script():\n help=\"\"\"\\\n %s [--user-base] [--user-site]\n\n Without arguments print some useful information\n With arguments print the value of USER_BASE and/or USER_SITE separated\n by '%s'.\n\n Exit codes with --user-base or --user-site:\n 0 - user site directory is enabled\n 1 - user site directory is disabled by user\n 2 - user site directory is disabled by super user\n or for security reasons\n >2 - unknown error\n \"\"\"\n args=sys.argv[1:]\n if not args:\n user_base=getuserbase()\n user_site=getusersitepackages()\n print(\"sys.path = [\")\n for dir in sys.path:\n print(\" %r,\"%(dir,))\n print(\"]\")\n def exists(path):\n if path is not None and os.path.isdir(path):\n return \"exists\"\n else:\n return \"doesn't exist\"\n print(f\"USER_BASE: {user_base !r} ({exists(user_base)})\")\n print(f\"USER_SITE: {user_site !r} ({exists(user_site)})\")\n print(f\"ENABLE_USER_SITE: {ENABLE_USER_SITE !r}\")\n sys.exit(0)\n \n buffer=[]\n if '--user-base'in args:\n buffer.append(USER_BASE)\n if '--user-site'in args:\n buffer.append(USER_SITE)\n \n if buffer:\n print(os.pathsep.join(buffer))\n if ENABLE_USER_SITE:\n sys.exit(0)\n elif ENABLE_USER_SITE is False:\n sys.exit(1)\n elif ENABLE_USER_SITE is None:\n sys.exit(2)\n else:\n sys.exit(3)\n else:\n import textwrap\n print(textwrap.dedent(help %(sys.argv[0],os.pathsep)))\n sys.exit(10)\n \nif __name__ =='__main__':\n _script()\n", ["_sitebuiltins", "atexit", "builtins", "io", "os", "readline", "rlcompleter", "sitecustomize", "sys", "textwrap", "traceback", "usercustomize"]], "socket": [".py", "\n\n\n\"\"\"\\\nThis module provides socket operations and some related functions.\nOn Unix, it supports IP (Internet Protocol) and Unix domain sockets.\nOn other systems, it only supports IP. Functions specific for a\nsocket are available as methods of the socket object.\n\nFunctions:\n\nsocket() -- create a new socket object\nsocketpair() -- create a pair of new socket objects [*]\nfromfd() -- create a socket object from an open file descriptor [*]\nsend_fds() -- Send file descriptor to the socket.\nrecv_fds() -- Receive file descriptors from the socket.\nfromshare() -- create a socket object from data received from socket.share() [*]\ngethostname() -- return the current hostname\ngethostbyname() -- map a hostname to its IP number\ngethostbyaddr() -- map an IP number or hostname to DNS info\ngetservbyname() -- map a service name and a protocol name to a port number\ngetprotobyname() -- map a protocol name (e.g. 'tcp') to a number\nntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order\nhtons(), htonl() -- convert 16, 32 bit int from host to network byte order\ninet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format\ninet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)\nsocket.getdefaulttimeout() -- get the default timeout value\nsocket.setdefaulttimeout() -- set the default timeout value\ncreate_connection() -- connects to an address, with an optional timeout and\n optional source address.\n\n [*] not available on all platforms!\n\nSpecial objects:\n\nSocketType -- type object for socket objects\nerror -- exception raised for I/O errors\nhas_ipv6 -- boolean value indicating if IPv6 is supported\n\nIntEnum constants:\n\nAF_INET, AF_UNIX -- socket domains (first argument to socket() call)\nSOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)\n\nInteger constants:\n\nMany other constants may be defined; these may be used in calls to\nthe setsockopt() and getsockopt() methods.\n\"\"\"\n\nimport _socket\nfrom _socket import *\n\nimport os,sys,io,selectors\nfrom enum import IntEnum,IntFlag\n\ntry :\n import errno\nexcept ImportError:\n errno=None\nEBADF=getattr(errno,'EBADF',9)\nEAGAIN=getattr(errno,'EAGAIN',11)\nEWOULDBLOCK=getattr(errno,'EWOULDBLOCK',11)\n\n__all__=[\"fromfd\",\"getfqdn\",\"create_connection\",\"create_server\",\n\"has_dualstack_ipv6\",\"AddressFamily\",\"SocketKind\"]\n__all__.extend(os._get_exports_list(_socket))\n\n\n\n\n\n\n\nIntEnum._convert_(\n'AddressFamily',\n__name__,\nlambda C:C.isupper()and C.startswith('AF_'))\n\nIntEnum._convert_(\n'SocketKind',\n__name__,\nlambda C:C.isupper()and C.startswith('SOCK_'))\n\nIntFlag._convert_(\n'MsgFlag',\n__name__,\nlambda C:C.isupper()and C.startswith('MSG_'))\n\nIntFlag._convert_(\n'AddressInfo',\n__name__,\nlambda C:C.isupper()and C.startswith('AI_'))\n\n_LOCALHOST='127.0.0.1'\n_LOCALHOST_V6='::1'\n\n\ndef _intenum_converter(value,enum_klass):\n ''\n\n\n \n try :\n return enum_klass(value)\n except ValueError:\n return value\n \n \n \nif sys.platform.lower().startswith(\"win\"):\n errorTab={}\n errorTab[6]=\"Specified event object handle is invalid.\"\n errorTab[8]=\"Insufficient memory available.\"\n errorTab[87]=\"One or more parameters are invalid.\"\n errorTab[995]=\"Overlapped operation aborted.\"\n errorTab[996]=\"Overlapped I/O event object not in signaled state.\"\n errorTab[997]=\"Overlapped operation will complete later.\"\n errorTab[10004]=\"The operation was interrupted.\"\n errorTab[10009]=\"A bad file handle was passed.\"\n errorTab[10013]=\"Permission denied.\"\n errorTab[10014]=\"A fault occurred on the network??\"\n errorTab[10022]=\"An invalid operation was attempted.\"\n errorTab[10024]=\"Too many open files.\"\n errorTab[10035]=\"The socket operation would block.\"\n errorTab[10036]=\"A blocking operation is already in progress.\"\n errorTab[10037]=\"Operation already in progress.\"\n errorTab[10038]=\"Socket operation on nonsocket.\"\n errorTab[10039]=\"Destination address required.\"\n errorTab[10040]=\"Message too long.\"\n errorTab[10041]=\"Protocol wrong type for socket.\"\n errorTab[10042]=\"Bad protocol option.\"\n errorTab[10043]=\"Protocol not supported.\"\n errorTab[10044]=\"Socket type not supported.\"\n errorTab[10045]=\"Operation not supported.\"\n errorTab[10046]=\"Protocol family not supported.\"\n errorTab[10047]=\"Address family not supported by protocol family.\"\n errorTab[10048]=\"The network address is in use.\"\n errorTab[10049]=\"Cannot assign requested address.\"\n errorTab[10050]=\"Network is down.\"\n errorTab[10051]=\"Network is unreachable.\"\n errorTab[10052]=\"Network dropped connection on reset.\"\n errorTab[10053]=\"Software caused connection abort.\"\n errorTab[10054]=\"The connection has been reset.\"\n errorTab[10055]=\"No buffer space available.\"\n errorTab[10056]=\"Socket is already connected.\"\n errorTab[10057]=\"Socket is not connected.\"\n errorTab[10058]=\"The network has been shut down.\"\n errorTab[10059]=\"Too many references.\"\n errorTab[10060]=\"The operation timed out.\"\n errorTab[10061]=\"Connection refused.\"\n errorTab[10062]=\"Cannot translate name.\"\n errorTab[10063]=\"The name is too long.\"\n errorTab[10064]=\"The host is down.\"\n errorTab[10065]=\"The host is unreachable.\"\n errorTab[10066]=\"Directory not empty.\"\n errorTab[10067]=\"Too many processes.\"\n errorTab[10068]=\"User quota exceeded.\"\n errorTab[10069]=\"Disk quota exceeded.\"\n errorTab[10070]=\"Stale file handle reference.\"\n errorTab[10071]=\"Item is remote.\"\n errorTab[10091]=\"Network subsystem is unavailable.\"\n errorTab[10092]=\"Winsock.dll version out of range.\"\n errorTab[10093]=\"Successful WSAStartup not yet performed.\"\n errorTab[10101]=\"Graceful shutdown in progress.\"\n errorTab[10102]=\"No more results from WSALookupServiceNext.\"\n errorTab[10103]=\"Call has been canceled.\"\n errorTab[10104]=\"Procedure call table is invalid.\"\n errorTab[10105]=\"Service provider is invalid.\"\n errorTab[10106]=\"Service provider failed to initialize.\"\n errorTab[10107]=\"System call failure.\"\n errorTab[10108]=\"Service not found.\"\n errorTab[10109]=\"Class type not found.\"\n errorTab[10110]=\"No more results from WSALookupServiceNext.\"\n errorTab[10111]=\"Call was canceled.\"\n errorTab[10112]=\"Database query was refused.\"\n errorTab[11001]=\"Host not found.\"\n errorTab[11002]=\"Nonauthoritative host not found.\"\n errorTab[11003]=\"This is a nonrecoverable error.\"\n errorTab[11004]=\"Valid name, no data record requested type.\"\n errorTab[11005]=\"QoS receivers.\"\n errorTab[11006]=\"QoS senders.\"\n errorTab[11007]=\"No QoS senders.\"\n errorTab[11008]=\"QoS no receivers.\"\n errorTab[11009]=\"QoS request confirmed.\"\n errorTab[11010]=\"QoS admission error.\"\n errorTab[11011]=\"QoS policy failure.\"\n errorTab[11012]=\"QoS bad style.\"\n errorTab[11013]=\"QoS bad object.\"\n errorTab[11014]=\"QoS traffic control error.\"\n errorTab[11015]=\"QoS generic error.\"\n errorTab[11016]=\"QoS service type error.\"\n errorTab[11017]=\"QoS flowspec error.\"\n errorTab[11018]=\"Invalid QoS provider buffer.\"\n errorTab[11019]=\"Invalid QoS filter style.\"\n errorTab[11020]=\"Invalid QoS filter style.\"\n errorTab[11021]=\"Incorrect QoS filter count.\"\n errorTab[11022]=\"Invalid QoS object length.\"\n errorTab[11023]=\"Incorrect QoS flow count.\"\n errorTab[11024]=\"Unrecognized QoS object.\"\n errorTab[11025]=\"Invalid QoS policy object.\"\n errorTab[11026]=\"Invalid QoS flow descriptor.\"\n errorTab[11027]=\"Invalid QoS provider-specific flowspec.\"\n errorTab[11028]=\"Invalid QoS provider-specific filterspec.\"\n errorTab[11029]=\"Invalid QoS shape discard mode object.\"\n errorTab[11030]=\"Invalid QoS shaping rate object.\"\n errorTab[11031]=\"Reserved policy QoS element type.\"\n __all__.append(\"errorTab\")\n \n \nclass _GiveupOnSendfile(Exception):pass\n\n\nclass socket(_socket.socket):\n\n ''\n \n __slots__=[\"__weakref__\",\"_io_refs\",\"_closed\"]\n \n def __init__(self,family=-1,type=-1,proto=-1,fileno=None ):\n \n \n \n \n if fileno is None :\n if family ==-1:\n family=AF_INET\n if type ==-1:\n type=SOCK_STREAM\n if proto ==-1:\n proto=0\n _socket.socket.__init__(self,family,type,proto,fileno)\n self._io_refs=0\n self._closed=False\n \n def __enter__(self):\n return self\n \n def __exit__(self,*args):\n if not self._closed:\n self.close()\n \n def __repr__(self):\n ''\n\n \n closed=getattr(self,'_closed',False )\n s=\"<%s.%s%s fd=%i, family=%s, type=%s, proto=%i\"\\\n %(self.__class__.__module__,\n self.__class__.__qualname__,\n \" [closed]\"if closed else \"\",\n self.fileno(),\n self.family,\n self.type,\n self.proto)\n if not closed:\n try :\n laddr=self.getsockname()\n if laddr:\n s +=\", laddr=%s\"%str(laddr)\n except error:\n pass\n try :\n raddr=self.getpeername()\n if raddr:\n s +=\", raddr=%s\"%str(raddr)\n except error:\n pass\n s +='>'\n return s\n \n def __getstate__(self):\n raise TypeError(f\"cannot pickle {self.__class__.__name__!r} object\")\n \n def dup(self):\n ''\n\n\n\n \n fd=dup(self.fileno())\n sock=self.__class__(self.family,self.type,self.proto,fileno=fd)\n sock.settimeout(self.gettimeout())\n return sock\n \n def accept(self):\n ''\n\n\n\n\n \n fd,addr=self._accept()\n sock=socket(self.family,self.type,self.proto,fileno=fd)\n \n \n \n if getdefaulttimeout()is None and self.gettimeout():\n sock.setblocking(True )\n return sock,addr\n \n def makefile(self,mode=\"r\",buffering=None ,*,\n encoding=None ,errors=None ,newline=None ):\n ''\n\n\n\n \n \n if not set(mode)<={\"r\",\"w\",\"b\"}:\n raise ValueError(\"invalid mode %r (only r, w, b allowed)\"%(mode,))\n writing=\"w\"in mode\n reading=\"r\"in mode or not writing\n assert reading or writing\n binary=\"b\"in mode\n rawmode=\"\"\n if reading:\n rawmode +=\"r\"\n if writing:\n rawmode +=\"w\"\n raw=SocketIO(self,rawmode)\n self._io_refs +=1\n if buffering is None :\n buffering=-1\n if buffering <0:\n buffering=io.DEFAULT_BUFFER_SIZE\n if buffering ==0:\n if not binary:\n raise ValueError(\"unbuffered streams must be binary\")\n return raw\n if reading and writing:\n buffer=io.BufferedRWPair(raw,raw,buffering)\n elif reading:\n buffer=io.BufferedReader(raw,buffering)\n else :\n assert writing\n buffer=io.BufferedWriter(raw,buffering)\n if binary:\n return buffer\n encoding=io.text_encoding(encoding)\n text=io.TextIOWrapper(buffer,encoding,errors,newline)\n text.mode=mode\n return text\n \n if hasattr(os,'sendfile'):\n \n def _sendfile_use_sendfile(self,file,offset=0,count=None ):\n self._check_sendfile_params(file,offset,count)\n sockno=self.fileno()\n try :\n fileno=file.fileno()\n except (AttributeError,io.UnsupportedOperation)as err:\n raise _GiveupOnSendfile(err)\n try :\n fsize=os.fstat(fileno).st_size\n except OSError as err:\n raise _GiveupOnSendfile(err)\n if not fsize:\n return 0\n \n blocksize=min(count or fsize,2 **30)\n timeout=self.gettimeout()\n if timeout ==0:\n raise ValueError(\"non-blocking sockets are not supported\")\n \n \n \n if hasattr(selectors,'PollSelector'):\n selector=selectors.PollSelector()\n else :\n selector=selectors.SelectSelector()\n selector.register(sockno,selectors.EVENT_WRITE)\n \n total_sent=0\n \n selector_select=selector.select\n os_sendfile=os.sendfile\n try :\n while True :\n if timeout and not selector_select(timeout):\n raise TimeoutError('timed out')\n if count:\n blocksize=count -total_sent\n if blocksize <=0:\n break\n try :\n sent=os_sendfile(sockno,fileno,offset,blocksize)\n except BlockingIOError:\n if not timeout:\n \n \n selector_select()\n continue\n except OSError as err:\n if total_sent ==0:\n \n \n \n \n raise _GiveupOnSendfile(err)\n raise err from None\n else :\n if sent ==0:\n break\n offset +=sent\n total_sent +=sent\n return total_sent\n finally :\n if total_sent >0 and hasattr(file,'seek'):\n file.seek(offset)\n else :\n def _sendfile_use_sendfile(self,file,offset=0,count=None ):\n raise _GiveupOnSendfile(\n \"os.sendfile() not available on this platform\")\n \n def _sendfile_use_send(self,file,offset=0,count=None ):\n self._check_sendfile_params(file,offset,count)\n if self.gettimeout()==0:\n raise ValueError(\"non-blocking sockets are not supported\")\n if offset:\n file.seek(offset)\n blocksize=min(count,8192)if count else 8192\n total_sent=0\n \n file_read=file.read\n sock_send=self.send\n try :\n while True :\n if count:\n blocksize=min(count -total_sent,blocksize)\n if blocksize <=0:\n break\n data=memoryview(file_read(blocksize))\n if not data:\n break\n while True :\n try :\n sent=sock_send(data)\n except BlockingIOError:\n continue\n else :\n total_sent +=sent\n if sent 0 and hasattr(file,'seek'):\n file.seek(offset+total_sent)\n \n def _check_sendfile_params(self,file,offset,count):\n if 'b'not in getattr(file,'mode','b'):\n raise ValueError(\"file should be opened in binary mode\")\n if not self.type&SOCK_STREAM:\n raise ValueError(\"only SOCK_STREAM type sockets are supported\")\n if count is not None :\n if not isinstance(count,int):\n raise TypeError(\n \"count must be a positive integer (got {!r})\".format(count))\n if count <=0:\n raise ValueError(\n \"count must be a positive integer (got {!r})\".format(count))\n \n def sendfile(self,file,offset=0,count=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return self._sendfile_use_sendfile(file,offset,count)\n except _GiveupOnSendfile:\n return self._sendfile_use_send(file,offset,count)\n \n def _decref_socketios(self):\n if self._io_refs >0:\n self._io_refs -=1\n if self._closed:\n self.close()\n \n def _real_close(self,_ss=_socket.socket):\n \n _ss.close(self)\n \n def close(self):\n \n self._closed=True\n if self._io_refs <=0:\n self._real_close()\n \n def detach(self):\n ''\n\n\n\n\n \n self._closed=True\n return super().detach()\n \n @property\n def family(self):\n ''\n \n return _intenum_converter(super().family,AddressFamily)\n \n @property\n def type(self):\n ''\n \n return _intenum_converter(super().type,SocketKind)\n \n if os.name =='nt':\n def get_inheritable(self):\n return os.get_handle_inheritable(self.fileno())\n def set_inheritable(self,inheritable):\n os.set_handle_inheritable(self.fileno(),inheritable)\n else :\n def get_inheritable(self):\n return os.get_inheritable(self.fileno())\n def set_inheritable(self,inheritable):\n os.set_inheritable(self.fileno(),inheritable)\n get_inheritable.__doc__=\"Get the inheritable flag of the socket\"\n set_inheritable.__doc__=\"Set the inheritable flag of the socket\"\n \ndef fromfd(fd,family,type,proto=0):\n ''\n\n\n\n \n nfd=dup(fd)\n return socket(family,type,proto,nfd)\n \nif hasattr(_socket.socket,\"sendmsg\"):\n import array\n \n def send_fds(sock,buffers,fds,flags=0,address=None ):\n ''\n\n\n \n return sock.sendmsg(buffers,[(_socket.SOL_SOCKET,\n _socket.SCM_RIGHTS,array.array(\"i\",fds))])\n __all__.append(\"send_fds\")\n \nif hasattr(_socket.socket,\"recvmsg\"):\n import array\n \n def recv_fds(sock,bufsize,maxfds,flags=0):\n ''\n\n\n\n\n \n \n fds=array.array(\"i\")\n msg,ancdata,flags,addr=sock.recvmsg(bufsize,\n _socket.CMSG_LEN(maxfds *fds.itemsize))\n for cmsg_level,cmsg_type,cmsg_data in ancdata:\n if (cmsg_level ==_socket.SOL_SOCKET and cmsg_type ==_socket.SCM_RIGHTS):\n fds.frombytes(cmsg_data[:\n len(cmsg_data)-(len(cmsg_data)%fds.itemsize)])\n \n return msg,list(fds),flags,addr\n __all__.append(\"recv_fds\")\n \nif hasattr(_socket.socket,\"share\"):\n def fromshare(info):\n ''\n\n\n\n \n return socket(0,0,0,info)\n __all__.append(\"fromshare\")\n \nif hasattr(_socket,\"socketpair\"):\n\n def socketpair(family=None ,type=SOCK_STREAM,proto=0):\n ''\n\n\n\n\n\n \n if family is None :\n try :\n family=AF_UNIX\n except NameError:\n family=AF_INET\n a,b=_socket.socketpair(family,type,proto)\n a=socket(family,type,proto,a.detach())\n b=socket(family,type,proto,b.detach())\n return a,b\n \nelse :\n\n\n def socketpair(family=AF_INET,type=SOCK_STREAM,proto=0):\n if family ==AF_INET:\n host=_LOCALHOST\n elif family ==AF_INET6:\n host=_LOCALHOST_V6\n else :\n raise ValueError(\"Only AF_INET and AF_INET6 socket address families \"\n \"are supported\")\n if type !=SOCK_STREAM:\n raise ValueError(\"Only SOCK_STREAM socket type is supported\")\n if proto !=0:\n raise ValueError(\"Only protocol zero is supported\")\n \n \n \n lsock=socket(family,type,proto)\n try :\n lsock.bind((host,0))\n lsock.listen()\n \n addr,port=lsock.getsockname()[:2]\n csock=socket(family,type,proto)\n try :\n csock.setblocking(False )\n try :\n csock.connect((addr,port))\n except (BlockingIOError,InterruptedError):\n pass\n csock.setblocking(True )\n ssock,_=lsock.accept()\n except :\n csock.close()\n raise\n finally :\n lsock.close()\n return (ssock,csock)\n __all__.append(\"socketpair\")\n \nsocketpair.__doc__=\"\"\"socketpair([family[, type[, proto]]]) -> (socket object, socket object)\nCreate a pair of socket objects from the sockets returned by the platform\nsocketpair() function.\nThe arguments are the same as for socket() except the default family is AF_UNIX\nif defined on the platform; otherwise, the default is AF_INET.\n\"\"\"\n\n_blocking_errnos={EAGAIN,EWOULDBLOCK}\n\nclass SocketIO(io.RawIOBase):\n\n ''\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n def __init__(self,sock,mode):\n if mode not in (\"r\",\"w\",\"rw\",\"rb\",\"wb\",\"rwb\"):\n raise ValueError(\"invalid mode: %r\"%mode)\n io.RawIOBase.__init__(self)\n self._sock=sock\n if \"b\"not in mode:\n mode +=\"b\"\n self._mode=mode\n self._reading=\"r\"in mode\n self._writing=\"w\"in mode\n self._timeout_occurred=False\n \n def readinto(self,b):\n ''\n\n\n\n\n\n \n self._checkClosed()\n self._checkReadable()\n if self._timeout_occurred:\n raise OSError(\"cannot read from timed out object\")\n while True :\n try :\n return self._sock.recv_into(b)\n except timeout:\n self._timeout_occurred=True\n raise\n except error as e:\n if e.errno in _blocking_errnos:\n return None\n raise\n \n def write(self,b):\n ''\n\n\n\n \n self._checkClosed()\n self._checkWritable()\n try :\n return self._sock.send(b)\n except error as e:\n \n if e.errno in _blocking_errnos:\n return None\n raise\n \n def readable(self):\n ''\n \n if self.closed:\n raise ValueError(\"I/O operation on closed socket.\")\n return self._reading\n \n def writable(self):\n ''\n \n if self.closed:\n raise ValueError(\"I/O operation on closed socket.\")\n return self._writing\n \n def seekable(self):\n ''\n \n if self.closed:\n raise ValueError(\"I/O operation on closed socket.\")\n return super().seekable()\n \n def fileno(self):\n ''\n \n self._checkClosed()\n return self._sock.fileno()\n \n @property\n def name(self):\n if not self.closed:\n return self.fileno()\n else :\n return -1\n \n @property\n def mode(self):\n return self._mode\n \n def close(self):\n ''\n\n \n if self.closed:\n return\n io.RawIOBase.close(self)\n self._sock._decref_socketios()\n self._sock=None\n \n \ndef getfqdn(name=''):\n ''\n\n\n\n\n\n\n\n \n name=name.strip()\n if not name or name =='0.0.0.0':\n name=gethostname()\n try :\n hostname,aliases,ipaddrs=gethostbyaddr(name)\n except error:\n pass\n else :\n aliases.insert(0,hostname)\n for name in aliases:\n if '.'in name:\n break\n else :\n name=hostname\n return name\n \n \n_GLOBAL_DEFAULT_TIMEOUT=object()\n\ndef create_connection(address,timeout=_GLOBAL_DEFAULT_TIMEOUT,\nsource_address=None ,*,all_errors=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n host,port=address\n exceptions=[]\n for res in getaddrinfo(host,port,0,SOCK_STREAM):\n af,socktype,proto,canonname,sa=res\n sock=None\n try :\n sock=socket(af,socktype,proto)\n if timeout is not _GLOBAL_DEFAULT_TIMEOUT:\n sock.settimeout(timeout)\n if source_address:\n sock.bind(source_address)\n sock.connect(sa)\n \n exceptions.clear()\n return sock\n \n except error as exc:\n if not all_errors:\n exceptions.clear()\n exceptions.append(exc)\n if sock is not None :\n sock.close()\n \n if len(exceptions):\n try :\n if not all_errors:\n raise exceptions[0]\n raise ExceptionGroup(\"create_connection failed\",exceptions)\n finally :\n \n exceptions.clear()\n else :\n raise error(\"getaddrinfo returns an empty list\")\n \n \ndef has_dualstack_ipv6():\n ''\n\n \n if not has_ipv6\\\n or not hasattr(_socket,'IPPROTO_IPV6')\\\n or not hasattr(_socket,'IPV6_V6ONLY'):\n return False\n try :\n with socket(AF_INET6,SOCK_STREAM)as sock:\n sock.setsockopt(IPPROTO_IPV6,IPV6_V6ONLY,0)\n return True\n except error:\n return False\n \n \ndef create_server(address,*,family=AF_INET,backlog=None ,reuse_port=False ,\ndualstack_ipv6=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if reuse_port and not hasattr(_socket,\"SO_REUSEPORT\"):\n raise ValueError(\"SO_REUSEPORT not supported on this platform\")\n if dualstack_ipv6:\n if not has_dualstack_ipv6():\n raise ValueError(\"dualstack_ipv6 not supported on this platform\")\n if family !=AF_INET6:\n raise ValueError(\"dualstack_ipv6 requires AF_INET6 family\")\n sock=socket(family,SOCK_STREAM)\n try :\n \n \n \n \n \n \n \n \n \n if os.name not in ('nt','cygwin')and\\\n hasattr(_socket,'SO_REUSEADDR'):\n try :\n sock.setsockopt(SOL_SOCKET,SO_REUSEADDR,1)\n except error:\n \n \n pass\n if reuse_port:\n sock.setsockopt(SOL_SOCKET,SO_REUSEPORT,1)\n if has_ipv6 and family ==AF_INET6:\n if dualstack_ipv6:\n sock.setsockopt(IPPROTO_IPV6,IPV6_V6ONLY,0)\n elif hasattr(_socket,\"IPV6_V6ONLY\")and\\\n hasattr(_socket,\"IPPROTO_IPV6\"):\n sock.setsockopt(IPPROTO_IPV6,IPV6_V6ONLY,1)\n try :\n sock.bind(address)\n except error as err:\n msg='%s (while attempting to bind on address %r)'%\\\n (err.strerror,address)\n raise error(err.errno,msg)from None\n if backlog is None :\n sock.listen()\n else :\n sock.listen(backlog)\n return sock\n except error:\n sock.close()\n raise\n \n \ndef getaddrinfo(host,port,family=0,type=0,proto=0,flags=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n addrlist=[]\n for res in _socket.getaddrinfo(host,port,family,type,proto,flags):\n af,socktype,proto,canonname,sa=res\n addrlist.append((_intenum_converter(af,AddressFamily),\n _intenum_converter(socktype,SocketKind),\n proto,canonname,sa))\n return addrlist\n", ["_socket", "array", "enum", "errno", "io", "os", "selectors", "sys"]], "sre_compile": [".py", "import warnings\nwarnings.warn(f\"module {__name__!r} is deprecated\",\nDeprecationWarning,\nstacklevel=2)\n\nfrom re import _compiler as _\nglobals().update({k:v for k,v in vars(_).items()if k[:2]!='__'})\n", ["re", "warnings"]], "sre_constants": [".py", "import warnings\nwarnings.warn(f\"module {__name__!r} is deprecated\",\nDeprecationWarning,\nstacklevel=2)\n\nfrom re import _constants as _\nglobals().update({k:v for k,v in vars(_).items()if k[:2]!='__'})\n", ["re", "warnings"]], "sre_parse": [".py", "import warnings\nwarnings.warn(f\"module {__name__!r} is deprecated\",\nDeprecationWarning,\nstacklevel=2)\n\nfrom re import _parser as _\nglobals().update({k:v for k,v in vars(_).items()if k[:2]!='__'})\n", ["re", "warnings"]], "stat": [".py", "''\n\n\n\n\n\n\nST_MODE=0\nST_INO=1\nST_DEV=2\nST_NLINK=3\nST_UID=4\nST_GID=5\nST_SIZE=6\nST_ATIME=7\nST_MTIME=8\nST_CTIME=9\n\n\n\ndef S_IMODE(mode):\n ''\n\n \n return mode&0o7777\n \ndef S_IFMT(mode):\n ''\n\n \n return mode&0o170000\n \n \n \n \nS_IFDIR=0o040000\nS_IFCHR=0o020000\nS_IFBLK=0o060000\nS_IFREG=0o100000\nS_IFIFO=0o010000\nS_IFLNK=0o120000\nS_IFSOCK=0o140000\n\nS_IFDOOR=0\nS_IFPORT=0\nS_IFWHT=0\n\n\n\ndef S_ISDIR(mode):\n ''\n return S_IFMT(mode)==S_IFDIR\n \ndef S_ISCHR(mode):\n ''\n return S_IFMT(mode)==S_IFCHR\n \ndef S_ISBLK(mode):\n ''\n return S_IFMT(mode)==S_IFBLK\n \ndef S_ISREG(mode):\n ''\n return S_IFMT(mode)==S_IFREG\n \ndef S_ISFIFO(mode):\n ''\n return S_IFMT(mode)==S_IFIFO\n \ndef S_ISLNK(mode):\n ''\n return S_IFMT(mode)==S_IFLNK\n \ndef S_ISSOCK(mode):\n ''\n return S_IFMT(mode)==S_IFSOCK\n \ndef S_ISDOOR(mode):\n ''\n return False\n \ndef S_ISPORT(mode):\n ''\n return False\n \ndef S_ISWHT(mode):\n ''\n return False\n \n \n \nS_ISUID=0o4000\nS_ISGID=0o2000\nS_ENFMT=S_ISGID\nS_ISVTX=0o1000\nS_IREAD=0o0400\nS_IWRITE=0o0200\nS_IEXEC=0o0100\nS_IRWXU=0o0700\nS_IRUSR=0o0400\nS_IWUSR=0o0200\nS_IXUSR=0o0100\nS_IRWXG=0o0070\nS_IRGRP=0o0040\nS_IWGRP=0o0020\nS_IXGRP=0o0010\nS_IRWXO=0o0007\nS_IROTH=0o0004\nS_IWOTH=0o0002\nS_IXOTH=0o0001\n\n\n\nUF_NODUMP=0x00000001\nUF_IMMUTABLE=0x00000002\nUF_APPEND=0x00000004\nUF_OPAQUE=0x00000008\nUF_NOUNLINK=0x00000010\nUF_COMPRESSED=0x00000020\nUF_HIDDEN=0x00008000\nSF_ARCHIVED=0x00010000\nSF_IMMUTABLE=0x00020000\nSF_APPEND=0x00040000\nSF_NOUNLINK=0x00100000\nSF_SNAPSHOT=0x00200000\n\n\n_filemode_table=(\n((S_IFLNK,\"l\"),\n(S_IFSOCK,\"s\"),\n(S_IFREG,\"-\"),\n(S_IFBLK,\"b\"),\n(S_IFDIR,\"d\"),\n(S_IFCHR,\"c\"),\n(S_IFIFO,\"p\")),\n\n((S_IRUSR,\"r\"),),\n((S_IWUSR,\"w\"),),\n((S_IXUSR |S_ISUID,\"s\"),\n(S_ISUID,\"S\"),\n(S_IXUSR,\"x\")),\n\n((S_IRGRP,\"r\"),),\n((S_IWGRP,\"w\"),),\n((S_IXGRP |S_ISGID,\"s\"),\n(S_ISGID,\"S\"),\n(S_IXGRP,\"x\")),\n\n((S_IROTH,\"r\"),),\n((S_IWOTH,\"w\"),),\n((S_IXOTH |S_ISVTX,\"t\"),\n(S_ISVTX,\"T\"),\n(S_IXOTH,\"x\"))\n)\n\ndef filemode(mode):\n ''\n perm=[]\n for table in _filemode_table:\n for bit,char in table:\n if mode&bit ==bit:\n perm.append(char)\n break\n else :\n perm.append(\"-\")\n return \"\".join(perm)\n \n \n \n \n \nFILE_ATTRIBUTE_ARCHIVE=32\nFILE_ATTRIBUTE_COMPRESSED=2048\nFILE_ATTRIBUTE_DEVICE=64\nFILE_ATTRIBUTE_DIRECTORY=16\nFILE_ATTRIBUTE_ENCRYPTED=16384\nFILE_ATTRIBUTE_HIDDEN=2\nFILE_ATTRIBUTE_INTEGRITY_STREAM=32768\nFILE_ATTRIBUTE_NORMAL=128\nFILE_ATTRIBUTE_NOT_CONTENT_INDEXED=8192\nFILE_ATTRIBUTE_NO_SCRUB_DATA=131072\nFILE_ATTRIBUTE_OFFLINE=4096\nFILE_ATTRIBUTE_READONLY=1\nFILE_ATTRIBUTE_REPARSE_POINT=1024\nFILE_ATTRIBUTE_SPARSE_FILE=512\nFILE_ATTRIBUTE_SYSTEM=4\nFILE_ATTRIBUTE_TEMPORARY=256\nFILE_ATTRIBUTE_VIRTUAL=65536\n\n\n\ntry :\n from _stat import *\nexcept ImportError:\n pass\n", ["_stat"]], "statistics": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\n'NormalDist',\n'StatisticsError',\n'correlation',\n'covariance',\n'fmean',\n'geometric_mean',\n'harmonic_mean',\n'linear_regression',\n'mean',\n'median',\n'median_grouped',\n'median_high',\n'median_low',\n'mode',\n'multimode',\n'pstdev',\n'pvariance',\n'quantiles',\n'stdev',\n'variance',\n]\n\nimport math\nimport numbers\nimport random\nimport sys\n\nfrom fractions import Fraction\nfrom decimal import Decimal\nfrom itertools import count,groupby,repeat\nfrom bisect import bisect_left,bisect_right\nfrom math import hypot,sqrt,fabs,exp,erf,tau,log,fsum,sumprod\nfrom functools import reduce\nfrom operator import itemgetter\nfrom collections import Counter,namedtuple,defaultdict\n\n_SQRT2=sqrt(2.0)\n\n\n\nclass StatisticsError(ValueError):\n pass\n \n \n \n \ndef _sum(data):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n count=0\n types=set()\n types_add=types.add\n partials={}\n partials_get=partials.get\n for typ,values in groupby(data,type):\n types_add(typ)\n for n,d in map(_exact_ratio,values):\n count +=1\n partials[d]=partials_get(d,0)+n\n if None in partials:\n \n \n total=partials[None]\n assert not _isfinite(total)\n else:\n \n total=sum(Fraction(n,d)for d,n in partials.items())\n T=reduce(_coerce,types,int)\n return(T,total,count)\n \n \ndef _ss(data,c=None):\n ''\n\n\n\n\n\n\n \n if c is not None:\n T,ssd,count=_sum((d :=x -c)*d for x in data)\n return(T,ssd,c,count)\n count=0\n types=set()\n types_add=types.add\n sx_partials=defaultdict(int)\n sxx_partials=defaultdict(int)\n for typ,values in groupby(data,type):\n types_add(typ)\n for n,d in map(_exact_ratio,values):\n count +=1\n sx_partials[d]+=n\n sxx_partials[d]+=n *n\n if not count:\n ssd=c=Fraction(0)\n elif None in sx_partials:\n \n \n ssd=c=sx_partials[None]\n assert not _isfinite(ssd)\n else:\n sx=sum(Fraction(n,d)for d,n in sx_partials.items())\n sxx=sum(Fraction(n,d *d)for d,n in sxx_partials.items())\n \n \n ssd=(count *sxx -sx *sx)/count\n c=sx /count\n T=reduce(_coerce,types,int)\n return(T,ssd,c,count)\n \n \ndef _isfinite(x):\n try:\n return x.is_finite()\n except AttributeError:\n return math.isfinite(x)\n \n \ndef _coerce(T,S):\n ''\n\n\n\n \n \n assert T is not bool,\"initial type T is bool\"\n \n \n \n if T is S:return T\n \n if S is int or S is bool:return T\n if T is int:return S\n \n if issubclass(S,T):return S\n if issubclass(T,S):return T\n \n if issubclass(T,int):return S\n if issubclass(S,int):return T\n \n if issubclass(T,Fraction)and issubclass(S,float):\n return S\n if issubclass(T,float)and issubclass(S,Fraction):\n return T\n \n msg=\"don't know how to coerce %s and %s\"\n raise TypeError(msg %(T.__name__,S.__name__))\n \n \ndef _exact_ratio(x):\n ''\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n try:\n return x.as_integer_ratio()\n except AttributeError:\n pass\n except(OverflowError,ValueError):\n \n assert not _isfinite(x)\n return(x,None)\n try:\n \n return(x.numerator,x.denominator)\n except AttributeError:\n msg=f\"can't convert type '{type(x).__name__}' to numerator/denominator\"\n raise TypeError(msg)\n \n \ndef _convert(value,T):\n ''\n if type(value)is T:\n \n \n return value\n if issubclass(T,int)and value.denominator !=1:\n T=float\n try:\n \n return T(value)\n except TypeError:\n if issubclass(T,Decimal):\n return T(value.numerator)/T(value.denominator)\n else:\n raise\n \n \ndef _fail_neg(values,errmsg='negative value'):\n ''\n for x in values:\n if x <0:\n raise StatisticsError(errmsg)\n yield x\n \n \ndef _rank(data,/,*,key=None,reverse=False,ties='average',start=1)->list[float]:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n if ties !='average':\n raise ValueError(f'Unknown tie resolution method: {ties !r}')\n if key is not None:\n data=map(key,data)\n val_pos=sorted(zip(data,count()),reverse=reverse)\n i=start -1\n result=[0]*len(val_pos)\n for _,g in groupby(val_pos,key=itemgetter(0)):\n group=list(g)\n size=len(group)\n rank=i+(size+1)/2\n for value,orig_pos in group:\n result[orig_pos]=rank\n i +=size\n return result\n \n \ndef _integer_sqrt_of_frac_rto(n:int,m:int)->int:\n ''\n \n a=math.isqrt(n //m)\n return a |(a *a *m !=n)\n \n \n \n \n_sqrt_bit_width:int=2 *sys.float_info.mant_dig+3\n\n\ndef _float_sqrt_of_frac(n:int,m:int)->float:\n ''\n \n q=(n.bit_length()-m.bit_length()-_sqrt_bit_width)//2\n if q >=0:\n numerator=_integer_sqrt_of_frac_rto(n,m <<2 *q)<Decimal:\n ''\n \n \n \n if n <=0:\n if not n:\n return Decimal('0.0')\n n,m=-n,-m\n \n root=(Decimal(n)/Decimal(m)).sqrt()\n nr,dr=root.as_integer_ratio()\n \n plus=root.next_plus()\n np,dp=plus.as_integer_ratio()\n \n if 4 *n *(dr *dp)**2 >m *(dr *np+dp *nr)**2:\n return plus\n \n minus=root.next_minus()\n nm,dm=minus.as_integer_ratio()\n \n if 4 *n *(dr *dm)**2 ld -1 else j\n delta=i *m -j *n\n interpolated=(data[j -1]*(n -delta)+data[j]*delta)/n\n result.append(interpolated)\n return result\n raise ValueError(f'Unknown method: {method !r}')\n \n \n \n \n \n \n \n \ndef variance(data,xbar=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n T,ss,c,n=_ss(data,xbar)\n if n <2:\n raise StatisticsError('variance requires at least two data points')\n return _convert(ss /(n -1),T)\n \n \ndef pvariance(data,mu=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n T,ss,c,n=_ss(data,mu)\n if n <1:\n raise StatisticsError('pvariance requires at least one data point')\n return _convert(ss /n,T)\n \n \ndef stdev(data,xbar=None):\n ''\n\n\n\n\n\n\n \n T,ss,c,n=_ss(data,xbar)\n if n <2:\n raise StatisticsError('stdev requires at least two data points')\n mss=ss /(n -1)\n if issubclass(T,Decimal):\n return _decimal_sqrt_of_frac(mss.numerator,mss.denominator)\n return _float_sqrt_of_frac(mss.numerator,mss.denominator)\n \n \ndef pstdev(data,mu=None):\n ''\n\n\n\n\n\n\n \n T,ss,c,n=_ss(data,mu)\n if n <1:\n raise StatisticsError('pstdev requires at least one data point')\n mss=ss /n\n if issubclass(T,Decimal):\n return _decimal_sqrt_of_frac(mss.numerator,mss.denominator)\n return _float_sqrt_of_frac(mss.numerator,mss.denominator)\n \n \ndef _mean_stdev(data):\n ''\n T,ss,xbar,n=_ss(data)\n if n <2:\n raise StatisticsError('stdev requires at least two data points')\n mss=ss /(n -1)\n try:\n return float(xbar),_float_sqrt_of_frac(mss.numerator,mss.denominator)\n except AttributeError:\n \n return float(xbar),float(xbar)/float(ss)\n \n \n \n \n \n \n \n \n \ndef covariance(x,y,/):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n n=len(x)\n if len(y)!=n:\n raise StatisticsError('covariance requires that both inputs have same number of data points')\n if n <2:\n raise StatisticsError('covariance requires at least two data points')\n xbar=fsum(x)/n\n ybar=fsum(y)/n\n sxy=sumprod((xi -xbar for xi in x),(yi -ybar for yi in y))\n return sxy /(n -1)\n \n \ndef correlation(x,y,/,*,method='linear'):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n n=len(x)\n if len(y)!=n:\n raise StatisticsError('correlation requires that both inputs have same number of data points')\n if n <2:\n raise StatisticsError('correlation requires at least two data points')\n if method not in{'linear','ranked'}:\n raise ValueError(f'Unknown method: {method !r}')\n if method =='ranked':\n start=(n -1)/-2\n x=_rank(x,start=start)\n y=_rank(y,start=start)\n else:\n xbar=fsum(x)/n\n ybar=fsum(y)/n\n x=[xi -xbar for xi in x]\n y=[yi -ybar for yi in y]\n sxy=sumprod(x,y)\n sxx=sumprod(x,x)\n syy=sumprod(y,y)\n try:\n return sxy /sqrt(sxx *syy)\n except ZeroDivisionError:\n raise StatisticsError('at least one of the inputs is constant')\n \n \nLinearRegression=namedtuple('LinearRegression',('slope','intercept'))\n\n\ndef linear_regression(x,y,/,*,proportional=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n n=len(x)\n if len(y)!=n:\n raise StatisticsError('linear regression requires that both inputs have same number of data points')\n if n <2:\n raise StatisticsError('linear regression requires at least two data points')\n if not proportional:\n xbar=fsum(x)/n\n ybar=fsum(y)/n\n x=[xi -xbar for xi in x]\n y=(yi -ybar for yi in y)\n sxy=sumprod(x,y)+0.0\n sxx=sumprod(x,x)\n try:\n slope=sxy /sxx\n except ZeroDivisionError:\n raise StatisticsError('x is constant')\n intercept=0.0 if proportional else ybar -slope *xbar\n return LinearRegression(slope=slope,intercept=intercept)\n \n \n \n \n \ndef _normal_dist_inv_cdf(p,mu,sigma):\n\n\n\n\n\n q=p -0.5\n if fabs(q)<=0.425:\n r=0.180625 -q *q\n \n num=(((((((2.50908_09287_30122_6727e+3 *r+\n 3.34305_75583_58812_8105e+4)*r+\n 6.72657_70927_00870_0853e+4)*r+\n 4.59219_53931_54987_1457e+4)*r+\n 1.37316_93765_50946_1125e+4)*r+\n 1.97159_09503_06551_4427e+3)*r+\n 1.33141_66789_17843_7745e+2)*r+\n 3.38713_28727_96366_6080e+0)*q\n den=(((((((5.22649_52788_52854_5610e+3 *r+\n 2.87290_85735_72194_2674e+4)*r+\n 3.93078_95800_09271_0610e+4)*r+\n 2.12137_94301_58659_5867e+4)*r+\n 5.39419_60214_24751_1077e+3)*r+\n 6.87187_00749_20579_0830e+2)*r+\n 4.23133_30701_60091_1252e+1)*r+\n 1.0)\n x=num /den\n return mu+(x *sigma)\n r=p if q <=0.0 else 1.0 -p\n r=sqrt(-log(r))\n if r <=5.0:\n r=r -1.6\n \n num=(((((((7.74545_01427_83414_07640e-4 *r+\n 2.27238_44989_26918_45833e-2)*r+\n 2.41780_72517_74506_11770e-1)*r+\n 1.27045_82524_52368_38258e+0)*r+\n 3.64784_83247_63204_60504e+0)*r+\n 5.76949_72214_60691_40550e+0)*r+\n 4.63033_78461_56545_29590e+0)*r+\n 1.42343_71107_49683_57734e+0)\n den=(((((((1.05075_00716_44416_84324e-9 *r+\n 5.47593_80849_95344_94600e-4)*r+\n 1.51986_66563_61645_71966e-2)*r+\n 1.48103_97642_74800_74590e-1)*r+\n 6.89767_33498_51000_04550e-1)*r+\n 1.67638_48301_83803_84940e+0)*r+\n 2.05319_16266_37758_82187e+0)*r+\n 1.0)\n else:\n r=r -5.0\n \n num=(((((((2.01033_43992_92288_13265e-7 *r+\n 2.71155_55687_43487_57815e-5)*r+\n 1.24266_09473_88078_43860e-3)*r+\n 2.65321_89526_57612_30930e-2)*r+\n 2.96560_57182_85048_91230e-1)*r+\n 1.78482_65399_17291_33580e+0)*r+\n 5.46378_49111_64114_36990e+0)*r+\n 6.65790_46435_01103_77720e+0)\n den=(((((((2.04426_31033_89939_78564e-15 *r+\n 1.42151_17583_16445_88870e-7)*r+\n 1.84631_83175_10054_68180e-5)*r+\n 7.86869_13114_56132_59100e-4)*r+\n 1.48753_61290_85061_48525e-2)*r+\n 1.36929_88092_27358_05310e-1)*r+\n 5.99832_20655_58879_37690e-1)*r+\n 1.0)\n x=num /den\n if q <0.0:\n x=-x\n return mu+(x *sigma)\n \n \n \ntry:\n from _statistics import _normal_dist_inv_cdf\nexcept ImportError:\n pass\n \n \nclass NormalDist:\n ''\n \n \n \n __slots__={\n '_mu':'Arithmetic mean of a normal distribution',\n '_sigma':'Standard deviation of a normal distribution',\n }\n \n def __init__(self,mu=0.0,sigma=1.0):\n ''\n if sigma <0.0:\n raise StatisticsError('sigma must be non-negative')\n self._mu=float(mu)\n self._sigma=float(sigma)\n \n @classmethod\n def from_samples(cls,data):\n ''\n return cls(*_mean_stdev(data))\n \n def samples(self,n,*,seed=None):\n ''\n gauss=random.gauss if seed is None else random.Random(seed).gauss\n mu,sigma=self._mu,self._sigma\n return[gauss(mu,sigma)for _ in repeat(None,n)]\n \n def pdf(self,x):\n ''\n variance=self._sigma *self._sigma\n if not variance:\n raise StatisticsError('pdf() not defined when sigma is zero')\n diff=x -self._mu\n return exp(diff *diff /(-2.0 *variance))/sqrt(tau *variance)\n \n def cdf(self,x):\n ''\n if not self._sigma:\n raise StatisticsError('cdf() not defined when sigma is zero')\n return 0.5 *(1.0+erf((x -self._mu)/(self._sigma *_SQRT2)))\n \n def inv_cdf(self,p):\n ''\n\n\n\n\n\n\n\n \n if p <=0.0 or p >=1.0:\n raise StatisticsError('p must be in the range 0.0 < p < 1.0')\n return _normal_dist_inv_cdf(p,self._mu,self._sigma)\n \n def quantiles(self,n=4):\n ''\n\n\n\n\n\n\n \n return[self.inv_cdf(i /n)for i in range(1,n)]\n \n def overlap(self,other):\n ''\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n if not isinstance(other,NormalDist):\n raise TypeError('Expected another NormalDist instance')\n X,Y=self,other\n if(Y._sigma,Y._mu)<(X._sigma,X._mu):\n X,Y=Y,X\n X_var,Y_var=X.variance,Y.variance\n if not X_var or not Y_var:\n raise StatisticsError('overlap() not defined when sigma is zero')\n dv=Y_var -X_var\n dm=fabs(Y._mu -X._mu)\n if not dv:\n return 1.0 -erf(dm /(2.0 *X._sigma *_SQRT2))\n a=X._mu *Y_var -Y._mu *X_var\n b=X._sigma *Y._sigma *sqrt(dm *dm+dv *log(Y_var /X_var))\n x1=(a+b)/dv\n x2=(a -b)/dv\n return 1.0 -(fabs(Y.cdf(x1)-X.cdf(x1))+fabs(Y.cdf(x2)-X.cdf(x2)))\n \n def zscore(self,x):\n ''\n\n\n\n \n \n if not self._sigma:\n raise StatisticsError('zscore() not defined when sigma is zero')\n return(x -self._mu)/self._sigma\n \n @property\n def mean(self):\n ''\n return self._mu\n \n @property\n def median(self):\n ''\n return self._mu\n \n @property\n def mode(self):\n ''\n\n\n\n \n return self._mu\n \n @property\n def stdev(self):\n ''\n return self._sigma\n \n @property\n def variance(self):\n ''\n return self._sigma *self._sigma\n \n def __add__(x1,x2):\n ''\n\n\n\n\n\n\n\n \n if isinstance(x2,NormalDist):\n return NormalDist(x1._mu+x2._mu,hypot(x1._sigma,x2._sigma))\n return NormalDist(x1._mu+x2,x1._sigma)\n \n def __sub__(x1,x2):\n ''\n\n\n\n\n\n\n\n \n if isinstance(x2,NormalDist):\n return NormalDist(x1._mu -x2._mu,hypot(x1._sigma,x2._sigma))\n return NormalDist(x1._mu -x2,x1._sigma)\n \n def __mul__(x1,x2):\n ''\n\n\n\n \n return NormalDist(x1._mu *x2,x1._sigma *fabs(x2))\n \n def __truediv__(x1,x2):\n ''\n\n\n\n \n return NormalDist(x1._mu /x2,x1._sigma /fabs(x2))\n \n def __pos__(x1):\n ''\n return NormalDist(x1._mu,x1._sigma)\n \n def __neg__(x1):\n ''\n return NormalDist(-x1._mu,x1._sigma)\n \n __radd__=__add__\n \n def __rsub__(x1,x2):\n ''\n return -(x1 -x2)\n \n __rmul__=__mul__\n \n def __eq__(x1,x2):\n ''\n if not isinstance(x2,NormalDist):\n return NotImplemented\n return x1._mu ==x2._mu and x1._sigma ==x2._sigma\n \n def __hash__(self):\n ''\n return hash((self._mu,self._sigma))\n \n def __repr__(self):\n return f'{type(self).__name__}(mu={self._mu !r}, sigma={self._sigma !r})'\n \n def __getstate__(self):\n return self._mu,self._sigma\n \n def __setstate__(self,state):\n self._mu,self._sigma=state\n", ["_statistics", "bisect", "collections", "decimal", "fractions", "functools", "itertools", "math", "numbers", "operator", "random", "sys"]], "string": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\"ascii_letters\",\"ascii_lowercase\",\"ascii_uppercase\",\"capwords\",\n\"digits\",\"hexdigits\",\"octdigits\",\"printable\",\"punctuation\",\n\"whitespace\",\"Formatter\",\"Template\"]\n\nimport _string\n\n\nwhitespace=' \\t\\n\\r\\v\\f'\nascii_lowercase='abcdefghijklmnopqrstuvwxyz'\nascii_uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nascii_letters=ascii_lowercase+ascii_uppercase\ndigits='0123456789'\nhexdigits=digits+'abcdef'+'ABCDEF'\noctdigits='01234567'\npunctuation=r\"\"\"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\"\"\"\nprintable=digits+ascii_letters+punctuation+whitespace\n\n\n\n\ndef capwords(s,sep=None):\n ''\n\n\n\n\n\n\n\n\n \n return(sep or ' ').join(map(str.capitalize,s.split(sep)))\n \n \n \nimport re as _re\nfrom collections import ChainMap as _ChainMap\n\n_sentinel_dict={}\n\nclass Template:\n ''\n \n delimiter='$'\n \n \n \n \n idpattern=r'(?a:[_a-z][_a-z0-9]*)'\n braceidpattern=None\n flags=_re.IGNORECASE\n \n def __init_subclass__(cls):\n super().__init_subclass__()\n if 'pattern'in cls.__dict__:\n pattern=cls.pattern\n else:\n delim=_re.escape(cls.delimiter)\n id=cls.idpattern\n bid=cls.braceidpattern or cls.idpattern\n pattern=fr\"\"\"\n {delim}(?:\n (?P{delim}) | # Escape sequence of two delimiters\n (?P{id}) | # delimiter and a Python identifier\n {{(?P{bid})}} | # delimiter and a braced identifier\n (?P) # Other ill-formed delimiter exprs\n )\n \"\"\"\n cls.pattern=_re.compile(pattern,cls.flags |_re.VERBOSE)\n \n def __init__(self,template):\n self.template=template\n \n \n \n def _invalid(self,mo):\n i=mo.start('invalid')\n lines=self.template[:i].splitlines(keepends=True)\n if not lines:\n colno=1\n lineno=1\n else:\n colno=i -len(''.join(lines[:-1]))\n lineno=len(lines)\n raise ValueError('Invalid placeholder in string: line %d, col %d'%\n (lineno,colno))\n \n def substitute(self,mapping=_sentinel_dict,/,**kws):\n if mapping is _sentinel_dict:\n mapping=kws\n elif kws:\n mapping=_ChainMap(kws,mapping)\n \n def convert(mo):\n \n named=mo.group('named')or mo.group('braced')\n if named is not None:\n return str(mapping[named])\n if mo.group('escaped')is not None:\n return self.delimiter\n if mo.group('invalid')is not None:\n self._invalid(mo)\n raise ValueError('Unrecognized named group in pattern',\n self.pattern)\n return self.pattern.sub(convert,self.template)\n \n def safe_substitute(self,mapping=_sentinel_dict,/,**kws):\n if mapping is _sentinel_dict:\n mapping=kws\n elif kws:\n mapping=_ChainMap(kws,mapping)\n \n def convert(mo):\n named=mo.group('named')or mo.group('braced')\n if named is not None:\n try:\n return str(mapping[named])\n except KeyError:\n return mo.group()\n if mo.group('escaped')is not None:\n return self.delimiter\n if mo.group('invalid')is not None:\n return mo.group()\n raise ValueError('Unrecognized named group in pattern',\n self.pattern)\n return self.pattern.sub(convert,self.template)\n \n def is_valid(self):\n for mo in self.pattern.finditer(self.template):\n if mo.group('invalid')is not None:\n return False\n if(mo.group('named')is None\n and mo.group('braced')is None\n and mo.group('escaped')is None):\n \n \n raise ValueError('Unrecognized named group in pattern',\n self.pattern)\n return True\n \n def get_identifiers(self):\n ids=[]\n for mo in self.pattern.finditer(self.template):\n named=mo.group('named')or mo.group('braced')\n if named is not None and named not in ids:\n \n ids.append(named)\n elif(named is None\n and mo.group('invalid')is None\n and mo.group('escaped')is None):\n \n \n raise ValueError('Unrecognized named group in pattern',\n self.pattern)\n return ids\n \n \n \nTemplate.__init_subclass__()\n\n\n\n\n\n\n\n\n\n\n\n\nclass Formatter:\n def format(self,format_string,/,*args,**kwargs):\n return self.vformat(format_string,args,kwargs)\n \n def vformat(self,format_string,args,kwargs):\n used_args=set()\n result,_=self._vformat(format_string,args,kwargs,used_args,2)\n self.check_unused_args(used_args,args,kwargs)\n return result\n \n def _vformat(self,format_string,args,kwargs,used_args,recursion_depth,\n auto_arg_index=0):\n if recursion_depth <0:\n raise ValueError('Max string recursion exceeded')\n result=[]\n for literal_text,field_name,format_spec,conversion in\\\n self.parse(format_string):\n \n \n if literal_text:\n result.append(literal_text)\n \n \n if field_name is not None:\n \n \n \n \n if field_name =='':\n if auto_arg_index is False:\n raise ValueError('cannot switch from manual field '\n 'specification to automatic field '\n 'numbering')\n field_name=str(auto_arg_index)\n auto_arg_index +=1\n elif field_name.isdigit():\n if auto_arg_index:\n raise ValueError('cannot switch from manual field '\n 'specification to automatic field '\n 'numbering')\n \n \n auto_arg_index=False\n \n \n \n obj,arg_used=self.get_field(field_name,args,kwargs)\n used_args.add(arg_used)\n \n \n obj=self.convert_field(obj,conversion)\n \n \n format_spec,auto_arg_index=self._vformat(\n format_spec,args,kwargs,\n used_args,recursion_depth -1,\n auto_arg_index=auto_arg_index)\n \n \n result.append(self.format_field(obj,format_spec))\n \n return ''.join(result),auto_arg_index\n \n \n def get_value(self,key,args,kwargs):\n if isinstance(key,int):\n return args[key]\n else:\n return kwargs[key]\n \n \n def check_unused_args(self,used_args,args,kwargs):\n pass\n \n \n def format_field(self,value,format_spec):\n return format(value,format_spec)\n \n \n def convert_field(self,value,conversion):\n \n if conversion is None:\n return value\n elif conversion =='s':\n return str(value)\n elif conversion =='r':\n return repr(value)\n elif conversion =='a':\n return ascii(value)\n raise ValueError(\"Unknown conversion specifier {0!s}\".format(conversion))\n \n \n \n \n \n \n \n \n \n def parse(self,format_string):\n return _string.formatter_parser(format_string)\n \n \n \n \n \n \n \n def get_field(self,field_name,args,kwargs):\n first,rest=_string.formatter_field_name_split(field_name)\n \n obj=self.get_value(first,args,kwargs)\n \n \n \n for is_attr,i in rest:\n if is_attr:\n obj=getattr(obj,i)\n else:\n obj=obj[i]\n \n return obj,first\n", ["_string", "collections", "re"]], "stringprep": [".py", "\n''\n\n\n\n\n\nfrom unicodedata import ucd_3_2_0 as unicodedata\n\nassert unicodedata.unidata_version =='3.2.0'\n\ndef in_table_a1(code):\n if unicodedata.category(code)!='Cn':return False\n c=ord(code)\n if 0xFDD0 <=c <0xFDF0:return False\n return (c&0xFFFF)not in (0xFFFE,0xFFFF)\n \n \nb1_set=set([173,847,6150,6155,6156,6157,8203,8204,8205,8288,65279]+list(range(65024,65040)))\ndef in_table_b1(code):\n return ord(code)in b1_set\n \n \nb3_exceptions={\n0xb5:'\\u03bc',0xdf:'ss',0x130:'i\\u0307',0x149:'\\u02bcn',\n0x17f:'s',0x1f0:'j\\u030c',0x345:'\\u03b9',0x37a:' \\u03b9',\n0x390:'\\u03b9\\u0308\\u0301',0x3b0:'\\u03c5\\u0308\\u0301',0x3c2:'\\u03c3',0x3d0:'\\u03b2',\n0x3d1:'\\u03b8',0x3d2:'\\u03c5',0x3d3:'\\u03cd',0x3d4:'\\u03cb',\n0x3d5:'\\u03c6',0x3d6:'\\u03c0',0x3f0:'\\u03ba',0x3f1:'\\u03c1',\n0x3f2:'\\u03c3',0x3f5:'\\u03b5',0x587:'\\u0565\\u0582',0x1e96:'h\\u0331',\n0x1e97:'t\\u0308',0x1e98:'w\\u030a',0x1e99:'y\\u030a',0x1e9a:'a\\u02be',\n0x1e9b:'\\u1e61',0x1f50:'\\u03c5\\u0313',0x1f52:'\\u03c5\\u0313\\u0300',0x1f54:'\\u03c5\\u0313\\u0301',\n0x1f56:'\\u03c5\\u0313\\u0342',0x1f80:'\\u1f00\\u03b9',0x1f81:'\\u1f01\\u03b9',0x1f82:'\\u1f02\\u03b9',\n0x1f83:'\\u1f03\\u03b9',0x1f84:'\\u1f04\\u03b9',0x1f85:'\\u1f05\\u03b9',0x1f86:'\\u1f06\\u03b9',\n0x1f87:'\\u1f07\\u03b9',0x1f88:'\\u1f00\\u03b9',0x1f89:'\\u1f01\\u03b9',0x1f8a:'\\u1f02\\u03b9',\n0x1f8b:'\\u1f03\\u03b9',0x1f8c:'\\u1f04\\u03b9',0x1f8d:'\\u1f05\\u03b9',0x1f8e:'\\u1f06\\u03b9',\n0x1f8f:'\\u1f07\\u03b9',0x1f90:'\\u1f20\\u03b9',0x1f91:'\\u1f21\\u03b9',0x1f92:'\\u1f22\\u03b9',\n0x1f93:'\\u1f23\\u03b9',0x1f94:'\\u1f24\\u03b9',0x1f95:'\\u1f25\\u03b9',0x1f96:'\\u1f26\\u03b9',\n0x1f97:'\\u1f27\\u03b9',0x1f98:'\\u1f20\\u03b9',0x1f99:'\\u1f21\\u03b9',0x1f9a:'\\u1f22\\u03b9',\n0x1f9b:'\\u1f23\\u03b9',0x1f9c:'\\u1f24\\u03b9',0x1f9d:'\\u1f25\\u03b9',0x1f9e:'\\u1f26\\u03b9',\n0x1f9f:'\\u1f27\\u03b9',0x1fa0:'\\u1f60\\u03b9',0x1fa1:'\\u1f61\\u03b9',0x1fa2:'\\u1f62\\u03b9',\n0x1fa3:'\\u1f63\\u03b9',0x1fa4:'\\u1f64\\u03b9',0x1fa5:'\\u1f65\\u03b9',0x1fa6:'\\u1f66\\u03b9',\n0x1fa7:'\\u1f67\\u03b9',0x1fa8:'\\u1f60\\u03b9',0x1fa9:'\\u1f61\\u03b9',0x1faa:'\\u1f62\\u03b9',\n0x1fab:'\\u1f63\\u03b9',0x1fac:'\\u1f64\\u03b9',0x1fad:'\\u1f65\\u03b9',0x1fae:'\\u1f66\\u03b9',\n0x1faf:'\\u1f67\\u03b9',0x1fb2:'\\u1f70\\u03b9',0x1fb3:'\\u03b1\\u03b9',0x1fb4:'\\u03ac\\u03b9',\n0x1fb6:'\\u03b1\\u0342',0x1fb7:'\\u03b1\\u0342\\u03b9',0x1fbc:'\\u03b1\\u03b9',0x1fbe:'\\u03b9',\n0x1fc2:'\\u1f74\\u03b9',0x1fc3:'\\u03b7\\u03b9',0x1fc4:'\\u03ae\\u03b9',0x1fc6:'\\u03b7\\u0342',\n0x1fc7:'\\u03b7\\u0342\\u03b9',0x1fcc:'\\u03b7\\u03b9',0x1fd2:'\\u03b9\\u0308\\u0300',0x1fd3:'\\u03b9\\u0308\\u0301',\n0x1fd6:'\\u03b9\\u0342',0x1fd7:'\\u03b9\\u0308\\u0342',0x1fe2:'\\u03c5\\u0308\\u0300',0x1fe3:'\\u03c5\\u0308\\u0301',\n0x1fe4:'\\u03c1\\u0313',0x1fe6:'\\u03c5\\u0342',0x1fe7:'\\u03c5\\u0308\\u0342',0x1ff2:'\\u1f7c\\u03b9',\n0x1ff3:'\\u03c9\\u03b9',0x1ff4:'\\u03ce\\u03b9',0x1ff6:'\\u03c9\\u0342',0x1ff7:'\\u03c9\\u0342\\u03b9',\n0x1ffc:'\\u03c9\\u03b9',0x20a8:'rs',0x2102:'c',0x2103:'\\xb0c',\n0x2107:'\\u025b',0x2109:'\\xb0f',0x210b:'h',0x210c:'h',\n0x210d:'h',0x2110:'i',0x2111:'i',0x2112:'l',\n0x2115:'n',0x2116:'no',0x2119:'p',0x211a:'q',\n0x211b:'r',0x211c:'r',0x211d:'r',0x2120:'sm',\n0x2121:'tel',0x2122:'tm',0x2124:'z',0x2128:'z',\n0x212c:'b',0x212d:'c',0x2130:'e',0x2131:'f',\n0x2133:'m',0x213e:'\\u03b3',0x213f:'\\u03c0',0x2145:'d',\n0x3371:'hpa',0x3373:'au',0x3375:'ov',0x3380:'pa',\n0x3381:'na',0x3382:'\\u03bca',0x3383:'ma',0x3384:'ka',\n0x3385:'kb',0x3386:'mb',0x3387:'gb',0x338a:'pf',\n0x338b:'nf',0x338c:'\\u03bcf',0x3390:'hz',0x3391:'khz',\n0x3392:'mhz',0x3393:'ghz',0x3394:'thz',0x33a9:'pa',\n0x33aa:'kpa',0x33ab:'mpa',0x33ac:'gpa',0x33b4:'pv',\n0x33b5:'nv',0x33b6:'\\u03bcv',0x33b7:'mv',0x33b8:'kv',\n0x33b9:'mv',0x33ba:'pw',0x33bb:'nw',0x33bc:'\\u03bcw',\n0x33bd:'mw',0x33be:'kw',0x33bf:'mw',0x33c0:'k\\u03c9',\n0x33c1:'m\\u03c9',0x33c3:'bq',0x33c6:'c\\u2215kg',0x33c7:'co.',\n0x33c8:'db',0x33c9:'gy',0x33cb:'hp',0x33cd:'kk',\n0x33ce:'km',0x33d7:'ph',0x33d9:'ppm',0x33da:'pr',\n0x33dc:'sv',0x33dd:'wb',0xfb00:'ff',0xfb01:'fi',\n0xfb02:'fl',0xfb03:'ffi',0xfb04:'ffl',0xfb05:'st',\n0xfb06:'st',0xfb13:'\\u0574\\u0576',0xfb14:'\\u0574\\u0565',0xfb15:'\\u0574\\u056b',\n0xfb16:'\\u057e\\u0576',0xfb17:'\\u0574\\u056d',0x1d400:'a',0x1d401:'b',\n0x1d402:'c',0x1d403:'d',0x1d404:'e',0x1d405:'f',\n0x1d406:'g',0x1d407:'h',0x1d408:'i',0x1d409:'j',\n0x1d40a:'k',0x1d40b:'l',0x1d40c:'m',0x1d40d:'n',\n0x1d40e:'o',0x1d40f:'p',0x1d410:'q',0x1d411:'r',\n0x1d412:'s',0x1d413:'t',0x1d414:'u',0x1d415:'v',\n0x1d416:'w',0x1d417:'x',0x1d418:'y',0x1d419:'z',\n0x1d434:'a',0x1d435:'b',0x1d436:'c',0x1d437:'d',\n0x1d438:'e',0x1d439:'f',0x1d43a:'g',0x1d43b:'h',\n0x1d43c:'i',0x1d43d:'j',0x1d43e:'k',0x1d43f:'l',\n0x1d440:'m',0x1d441:'n',0x1d442:'o',0x1d443:'p',\n0x1d444:'q',0x1d445:'r',0x1d446:'s',0x1d447:'t',\n0x1d448:'u',0x1d449:'v',0x1d44a:'w',0x1d44b:'x',\n0x1d44c:'y',0x1d44d:'z',0x1d468:'a',0x1d469:'b',\n0x1d46a:'c',0x1d46b:'d',0x1d46c:'e',0x1d46d:'f',\n0x1d46e:'g',0x1d46f:'h',0x1d470:'i',0x1d471:'j',\n0x1d472:'k',0x1d473:'l',0x1d474:'m',0x1d475:'n',\n0x1d476:'o',0x1d477:'p',0x1d478:'q',0x1d479:'r',\n0x1d47a:'s',0x1d47b:'t',0x1d47c:'u',0x1d47d:'v',\n0x1d47e:'w',0x1d47f:'x',0x1d480:'y',0x1d481:'z',\n0x1d49c:'a',0x1d49e:'c',0x1d49f:'d',0x1d4a2:'g',\n0x1d4a5:'j',0x1d4a6:'k',0x1d4a9:'n',0x1d4aa:'o',\n0x1d4ab:'p',0x1d4ac:'q',0x1d4ae:'s',0x1d4af:'t',\n0x1d4b0:'u',0x1d4b1:'v',0x1d4b2:'w',0x1d4b3:'x',\n0x1d4b4:'y',0x1d4b5:'z',0x1d4d0:'a',0x1d4d1:'b',\n0x1d4d2:'c',0x1d4d3:'d',0x1d4d4:'e',0x1d4d5:'f',\n0x1d4d6:'g',0x1d4d7:'h',0x1d4d8:'i',0x1d4d9:'j',\n0x1d4da:'k',0x1d4db:'l',0x1d4dc:'m',0x1d4dd:'n',\n0x1d4de:'o',0x1d4df:'p',0x1d4e0:'q',0x1d4e1:'r',\n0x1d4e2:'s',0x1d4e3:'t',0x1d4e4:'u',0x1d4e5:'v',\n0x1d4e6:'w',0x1d4e7:'x',0x1d4e8:'y',0x1d4e9:'z',\n0x1d504:'a',0x1d505:'b',0x1d507:'d',0x1d508:'e',\n0x1d509:'f',0x1d50a:'g',0x1d50d:'j',0x1d50e:'k',\n0x1d50f:'l',0x1d510:'m',0x1d511:'n',0x1d512:'o',\n0x1d513:'p',0x1d514:'q',0x1d516:'s',0x1d517:'t',\n0x1d518:'u',0x1d519:'v',0x1d51a:'w',0x1d51b:'x',\n0x1d51c:'y',0x1d538:'a',0x1d539:'b',0x1d53b:'d',\n0x1d53c:'e',0x1d53d:'f',0x1d53e:'g',0x1d540:'i',\n0x1d541:'j',0x1d542:'k',0x1d543:'l',0x1d544:'m',\n0x1d546:'o',0x1d54a:'s',0x1d54b:'t',0x1d54c:'u',\n0x1d54d:'v',0x1d54e:'w',0x1d54f:'x',0x1d550:'y',\n0x1d56c:'a',0x1d56d:'b',0x1d56e:'c',0x1d56f:'d',\n0x1d570:'e',0x1d571:'f',0x1d572:'g',0x1d573:'h',\n0x1d574:'i',0x1d575:'j',0x1d576:'k',0x1d577:'l',\n0x1d578:'m',0x1d579:'n',0x1d57a:'o',0x1d57b:'p',\n0x1d57c:'q',0x1d57d:'r',0x1d57e:'s',0x1d57f:'t',\n0x1d580:'u',0x1d581:'v',0x1d582:'w',0x1d583:'x',\n0x1d584:'y',0x1d585:'z',0x1d5a0:'a',0x1d5a1:'b',\n0x1d5a2:'c',0x1d5a3:'d',0x1d5a4:'e',0x1d5a5:'f',\n0x1d5a6:'g',0x1d5a7:'h',0x1d5a8:'i',0x1d5a9:'j',\n0x1d5aa:'k',0x1d5ab:'l',0x1d5ac:'m',0x1d5ad:'n',\n0x1d5ae:'o',0x1d5af:'p',0x1d5b0:'q',0x1d5b1:'r',\n0x1d5b2:'s',0x1d5b3:'t',0x1d5b4:'u',0x1d5b5:'v',\n0x1d5b6:'w',0x1d5b7:'x',0x1d5b8:'y',0x1d5b9:'z',\n0x1d5d4:'a',0x1d5d5:'b',0x1d5d6:'c',0x1d5d7:'d',\n0x1d5d8:'e',0x1d5d9:'f',0x1d5da:'g',0x1d5db:'h',\n0x1d5dc:'i',0x1d5dd:'j',0x1d5de:'k',0x1d5df:'l',\n0x1d5e0:'m',0x1d5e1:'n',0x1d5e2:'o',0x1d5e3:'p',\n0x1d5e4:'q',0x1d5e5:'r',0x1d5e6:'s',0x1d5e7:'t',\n0x1d5e8:'u',0x1d5e9:'v',0x1d5ea:'w',0x1d5eb:'x',\n0x1d5ec:'y',0x1d5ed:'z',0x1d608:'a',0x1d609:'b',\n0x1d60a:'c',0x1d60b:'d',0x1d60c:'e',0x1d60d:'f',\n0x1d60e:'g',0x1d60f:'h',0x1d610:'i',0x1d611:'j',\n0x1d612:'k',0x1d613:'l',0x1d614:'m',0x1d615:'n',\n0x1d616:'o',0x1d617:'p',0x1d618:'q',0x1d619:'r',\n0x1d61a:'s',0x1d61b:'t',0x1d61c:'u',0x1d61d:'v',\n0x1d61e:'w',0x1d61f:'x',0x1d620:'y',0x1d621:'z',\n0x1d63c:'a',0x1d63d:'b',0x1d63e:'c',0x1d63f:'d',\n0x1d640:'e',0x1d641:'f',0x1d642:'g',0x1d643:'h',\n0x1d644:'i',0x1d645:'j',0x1d646:'k',0x1d647:'l',\n0x1d648:'m',0x1d649:'n',0x1d64a:'o',0x1d64b:'p',\n0x1d64c:'q',0x1d64d:'r',0x1d64e:'s',0x1d64f:'t',\n0x1d650:'u',0x1d651:'v',0x1d652:'w',0x1d653:'x',\n0x1d654:'y',0x1d655:'z',0x1d670:'a',0x1d671:'b',\n0x1d672:'c',0x1d673:'d',0x1d674:'e',0x1d675:'f',\n0x1d676:'g',0x1d677:'h',0x1d678:'i',0x1d679:'j',\n0x1d67a:'k',0x1d67b:'l',0x1d67c:'m',0x1d67d:'n',\n0x1d67e:'o',0x1d67f:'p',0x1d680:'q',0x1d681:'r',\n0x1d682:'s',0x1d683:'t',0x1d684:'u',0x1d685:'v',\n0x1d686:'w',0x1d687:'x',0x1d688:'y',0x1d689:'z',\n0x1d6a8:'\\u03b1',0x1d6a9:'\\u03b2',0x1d6aa:'\\u03b3',0x1d6ab:'\\u03b4',\n0x1d6ac:'\\u03b5',0x1d6ad:'\\u03b6',0x1d6ae:'\\u03b7',0x1d6af:'\\u03b8',\n0x1d6b0:'\\u03b9',0x1d6b1:'\\u03ba',0x1d6b2:'\\u03bb',0x1d6b3:'\\u03bc',\n0x1d6b4:'\\u03bd',0x1d6b5:'\\u03be',0x1d6b6:'\\u03bf',0x1d6b7:'\\u03c0',\n0x1d6b8:'\\u03c1',0x1d6b9:'\\u03b8',0x1d6ba:'\\u03c3',0x1d6bb:'\\u03c4',\n0x1d6bc:'\\u03c5',0x1d6bd:'\\u03c6',0x1d6be:'\\u03c7',0x1d6bf:'\\u03c8',\n0x1d6c0:'\\u03c9',0x1d6d3:'\\u03c3',0x1d6e2:'\\u03b1',0x1d6e3:'\\u03b2',\n0x1d6e4:'\\u03b3',0x1d6e5:'\\u03b4',0x1d6e6:'\\u03b5',0x1d6e7:'\\u03b6',\n0x1d6e8:'\\u03b7',0x1d6e9:'\\u03b8',0x1d6ea:'\\u03b9',0x1d6eb:'\\u03ba',\n0x1d6ec:'\\u03bb',0x1d6ed:'\\u03bc',0x1d6ee:'\\u03bd',0x1d6ef:'\\u03be',\n0x1d6f0:'\\u03bf',0x1d6f1:'\\u03c0',0x1d6f2:'\\u03c1',0x1d6f3:'\\u03b8',\n0x1d6f4:'\\u03c3',0x1d6f5:'\\u03c4',0x1d6f6:'\\u03c5',0x1d6f7:'\\u03c6',\n0x1d6f8:'\\u03c7',0x1d6f9:'\\u03c8',0x1d6fa:'\\u03c9',0x1d70d:'\\u03c3',\n0x1d71c:'\\u03b1',0x1d71d:'\\u03b2',0x1d71e:'\\u03b3',0x1d71f:'\\u03b4',\n0x1d720:'\\u03b5',0x1d721:'\\u03b6',0x1d722:'\\u03b7',0x1d723:'\\u03b8',\n0x1d724:'\\u03b9',0x1d725:'\\u03ba',0x1d726:'\\u03bb',0x1d727:'\\u03bc',\n0x1d728:'\\u03bd',0x1d729:'\\u03be',0x1d72a:'\\u03bf',0x1d72b:'\\u03c0',\n0x1d72c:'\\u03c1',0x1d72d:'\\u03b8',0x1d72e:'\\u03c3',0x1d72f:'\\u03c4',\n0x1d730:'\\u03c5',0x1d731:'\\u03c6',0x1d732:'\\u03c7',0x1d733:'\\u03c8',\n0x1d734:'\\u03c9',0x1d747:'\\u03c3',0x1d756:'\\u03b1',0x1d757:'\\u03b2',\n0x1d758:'\\u03b3',0x1d759:'\\u03b4',0x1d75a:'\\u03b5',0x1d75b:'\\u03b6',\n0x1d75c:'\\u03b7',0x1d75d:'\\u03b8',0x1d75e:'\\u03b9',0x1d75f:'\\u03ba',\n0x1d760:'\\u03bb',0x1d761:'\\u03bc',0x1d762:'\\u03bd',0x1d763:'\\u03be',\n0x1d764:'\\u03bf',0x1d765:'\\u03c0',0x1d766:'\\u03c1',0x1d767:'\\u03b8',\n0x1d768:'\\u03c3',0x1d769:'\\u03c4',0x1d76a:'\\u03c5',0x1d76b:'\\u03c6',\n0x1d76c:'\\u03c7',0x1d76d:'\\u03c8',0x1d76e:'\\u03c9',0x1d781:'\\u03c3',\n0x1d790:'\\u03b1',0x1d791:'\\u03b2',0x1d792:'\\u03b3',0x1d793:'\\u03b4',\n0x1d794:'\\u03b5',0x1d795:'\\u03b6',0x1d796:'\\u03b7',0x1d797:'\\u03b8',\n0x1d798:'\\u03b9',0x1d799:'\\u03ba',0x1d79a:'\\u03bb',0x1d79b:'\\u03bc',\n0x1d79c:'\\u03bd',0x1d79d:'\\u03be',0x1d79e:'\\u03bf',0x1d79f:'\\u03c0',\n0x1d7a0:'\\u03c1',0x1d7a1:'\\u03b8',0x1d7a2:'\\u03c3',0x1d7a3:'\\u03c4',\n0x1d7a4:'\\u03c5',0x1d7a5:'\\u03c6',0x1d7a6:'\\u03c7',0x1d7a7:'\\u03c8',\n0x1d7a8:'\\u03c9',0x1d7bb:'\\u03c3',}\n\ndef map_table_b3(code):\n r=b3_exceptions.get(ord(code))\n if r is not None :return r\n return code.lower()\n \n \ndef map_table_b2(a):\n al=map_table_b3(a)\n b=unicodedata.normalize(\"NFKC\",al)\n bl=\"\".join([map_table_b3(ch)for ch in b])\n c=unicodedata.normalize(\"NFKC\",bl)\n if b !=c:\n return c\n else :\n return al\n \n \ndef in_table_c11(code):\n return code ==\" \"\n \n \ndef in_table_c12(code):\n return unicodedata.category(code)==\"Zs\"and code !=\" \"\n \ndef in_table_c11_c12(code):\n return unicodedata.category(code)==\"Zs\"\n \n \ndef in_table_c21(code):\n return ord(code)<128 and unicodedata.category(code)==\"Cc\"\n \nc22_specials=set([1757,1807,6158,8204,8205,8232,8233,65279]+list(range(8288,8292))+list(range(8298,8304))+list(range(65529,65533))+list(range(119155,119163)))\ndef in_table_c22(code):\n c=ord(code)\n if c <128:return False\n if unicodedata.category(code)==\"Cc\":return True\n return c in c22_specials\n \ndef in_table_c21_c22(code):\n return unicodedata.category(code)==\"Cc\"or\\\n ord(code)in c22_specials\n \n \ndef in_table_c3(code):\n return unicodedata.category(code)==\"Co\"\n \n \ndef in_table_c4(code):\n c=ord(code)\n if c <0xFDD0:return False\n if c <0xFDF0:return True\n return (ord(code)&0xFFFF)in (0xFFFE,0xFFFF)\n \n \ndef in_table_c5(code):\n return unicodedata.category(code)==\"Cs\"\n \n \nc6_set=set(range(65529,65534))\ndef in_table_c6(code):\n return ord(code)in c6_set\n \n \nc7_set=set(range(12272,12284))\ndef in_table_c7(code):\n return ord(code)in c7_set\n \n \nc8_set=set([832,833,8206,8207]+list(range(8234,8239))+list(range(8298,8304)))\ndef in_table_c8(code):\n return ord(code)in c8_set\n \n \nc9_set=set([917505]+list(range(917536,917632)))\ndef in_table_c9(code):\n return ord(code)in c9_set\n \n \ndef in_table_d1(code):\n return unicodedata.bidirectional(code)in (\"R\",\"AL\")\n \n \ndef in_table_d2(code):\n return unicodedata.bidirectional(code)==\"L\"\n", ["unicodedata"]], "struct": [".py", "__all__=[\n\n'calcsize','pack','pack_into','unpack','unpack_from',\n'iter_unpack',\n\n\n'Struct',\n\n\n'error'\n]\n\nfrom _struct import *\nfrom _struct import _clearcache\nfrom _struct import __doc__\n", ["_struct"]], "subprocess": [".py", "\n\n\n\n\n\n\n\nr\"\"\"Subprocesses with accessible I/O streams\n\nThis module allows you to spawn processes, connect to their\ninput/output/error pipes, and obtain their return codes.\n\nFor a complete description of this module see the Python documentation.\n\nMain API\n========\nrun(...): Runs a command, waits for it to complete, then returns a\n CompletedProcess instance.\nPopen(...): A class for flexibly executing a command in a new process\n\nConstants\n---------\nDEVNULL: Special value that indicates that os.devnull should be used\nPIPE: Special value that indicates a pipe should be created\nSTDOUT: Special value that indicates that stderr should go to stdout\n\n\nOlder API\n=========\ncall(...): Runs a command, waits for it to complete, then returns\n the return code.\ncheck_call(...): Same as call() but raises CalledProcessError()\n if return code is not 0\ncheck_output(...): Same as check_call() but returns the contents of\n stdout instead of a return code\ngetoutput(...): Runs a command in the shell, waits for it to complete,\n then returns the output\ngetstatusoutput(...): Runs a command in the shell, waits for it to complete,\n then returns a (exitcode, output) tuple\n\"\"\"\n\nimport builtins\nimport errno\nimport io\nimport locale\nimport os\nimport time\nimport signal\nimport sys\nimport threading\nimport warnings\nimport contextlib\nfrom time import monotonic as _time\nimport types\n\ntry :\n import fcntl\nexcept ImportError:\n fcntl=None\n \n \n__all__=[\"Popen\",\"PIPE\",\"STDOUT\",\"call\",\"check_call\",\"getstatusoutput\",\n\"getoutput\",\"check_output\",\"run\",\"CalledProcessError\",\"DEVNULL\",\n\"SubprocessError\",\"TimeoutExpired\",\"CompletedProcess\"]\n\n\n\n\ntry :\n import msvcrt\nexcept ModuleNotFoundError:\n _mswindows=False\nelse :\n _mswindows=True\n \n \n_can_fork_exec=sys.platform not in {\"emscripten\",\"wasi\"}\n\nif _mswindows:\n import _winapi\n from _winapi import (CREATE_NEW_CONSOLE,CREATE_NEW_PROCESS_GROUP,\n STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,\n STD_ERROR_HANDLE,SW_HIDE,\n STARTF_USESTDHANDLES,STARTF_USESHOWWINDOW,\n ABOVE_NORMAL_PRIORITY_CLASS,BELOW_NORMAL_PRIORITY_CLASS,\n HIGH_PRIORITY_CLASS,IDLE_PRIORITY_CLASS,\n NORMAL_PRIORITY_CLASS,REALTIME_PRIORITY_CLASS,\n CREATE_NO_WINDOW,DETACHED_PROCESS,\n CREATE_DEFAULT_ERROR_MODE,CREATE_BREAKAWAY_FROM_JOB)\n \n __all__.extend([\"CREATE_NEW_CONSOLE\",\"CREATE_NEW_PROCESS_GROUP\",\n \"STD_INPUT_HANDLE\",\"STD_OUTPUT_HANDLE\",\n \"STD_ERROR_HANDLE\",\"SW_HIDE\",\n \"STARTF_USESTDHANDLES\",\"STARTF_USESHOWWINDOW\",\n \"STARTUPINFO\",\n \"ABOVE_NORMAL_PRIORITY_CLASS\",\"BELOW_NORMAL_PRIORITY_CLASS\",\n \"HIGH_PRIORITY_CLASS\",\"IDLE_PRIORITY_CLASS\",\n \"NORMAL_PRIORITY_CLASS\",\"REALTIME_PRIORITY_CLASS\",\n \"CREATE_NO_WINDOW\",\"DETACHED_PROCESS\",\n \"CREATE_DEFAULT_ERROR_MODE\",\"CREATE_BREAKAWAY_FROM_JOB\"])\nelse :\n if _can_fork_exec:\n from _posixsubprocess import fork_exec as _fork_exec\n \n _waitpid=os.waitpid\n _waitstatus_to_exitcode=os.waitstatus_to_exitcode\n _WIFSTOPPED=os.WIFSTOPPED\n _WSTOPSIG=os.WSTOPSIG\n _WNOHANG=os.WNOHANG\n else :\n _fork_exec=None\n _waitpid=None\n _waitstatus_to_exitcode=None\n _WIFSTOPPED=None\n _WSTOPSIG=None\n _WNOHANG=None\n import select\n import selectors\n \n \n \nclass SubprocessError(Exception):pass\n\n\nclass CalledProcessError(SubprocessError):\n ''\n\n\n\n\n \n def __init__(self,returncode,cmd,output=None ,stderr=None ):\n self.returncode=returncode\n self.cmd=cmd\n self.output=output\n self.stderr=stderr\n \n def __str__(self):\n if self.returncode and self.returncode <0:\n try :\n return \"Command '%s' died with %r.\"%(\n self.cmd,signal.Signals(-self.returncode))\n except ValueError:\n return \"Command '%s' died with unknown signal %d.\"%(\n self.cmd,-self.returncode)\n else :\n return \"Command '%s' returned non-zero exit status %d.\"%(\n self.cmd,self.returncode)\n \n @property\n def stdout(self):\n ''\n return self.output\n \n @stdout.setter\n def stdout(self,value):\n \n \n self.output=value\n \n \nclass TimeoutExpired(SubprocessError):\n ''\n\n\n\n\n \n def __init__(self,cmd,timeout,output=None ,stderr=None ):\n self.cmd=cmd\n self.timeout=timeout\n self.output=output\n self.stderr=stderr\n \n def __str__(self):\n return (\"Command '%s' timed out after %s seconds\"%\n (self.cmd,self.timeout))\n \n @property\n def stdout(self):\n return self.output\n \n @stdout.setter\n def stdout(self,value):\n \n \n self.output=value\n \n \nif _mswindows:\n class STARTUPINFO:\n def __init__(self,*,dwFlags=0,hStdInput=None ,hStdOutput=None ,\n hStdError=None ,wShowWindow=0,lpAttributeList=None ):\n self.dwFlags=dwFlags\n self.hStdInput=hStdInput\n self.hStdOutput=hStdOutput\n self.hStdError=hStdError\n self.wShowWindow=wShowWindow\n self.lpAttributeList=lpAttributeList or {\"handle_list\":[]}\n \n def copy(self):\n attr_list=self.lpAttributeList.copy()\n if 'handle_list'in attr_list:\n attr_list['handle_list']=list(attr_list['handle_list'])\n \n return STARTUPINFO(dwFlags=self.dwFlags,\n hStdInput=self.hStdInput,\n hStdOutput=self.hStdOutput,\n hStdError=self.hStdError,\n wShowWindow=self.wShowWindow,\n lpAttributeList=attr_list)\n \n \n class Handle(int):\n closed=False\n \n def Close(self,CloseHandle=_winapi.CloseHandle):\n if not self.closed:\n self.closed=True\n CloseHandle(self)\n \n def Detach(self):\n if not self.closed:\n self.closed=True\n return int(self)\n raise ValueError(\"already closed\")\n \n def __repr__(self):\n return \"%s(%d)\"%(self.__class__.__name__,int(self))\n \n __del__=Close\nelse :\n\n\n\n _PIPE_BUF=getattr(select,'PIPE_BUF',512)\n \n \n \n \n if hasattr(selectors,'PollSelector'):\n _PopenSelector=selectors.PollSelector\n else :\n _PopenSelector=selectors.SelectSelector\n \n \nif _mswindows:\n\n\n\n\n\n\n\n\n _active=None\n \n def _cleanup():\n pass\nelse :\n\n\n\n\n _active=[]\n \n def _cleanup():\n if _active is None :\n return\n for inst in _active[:]:\n res=inst._internal_poll(_deadstate=sys.maxsize)\n if res is not None :\n try :\n _active.remove(inst)\n except ValueError:\n \n \n pass\n \nPIPE=-1\nSTDOUT=-2\nDEVNULL=-3\n\n\n\n\n\n\ndef _optim_args_from_interpreter_flags():\n ''\n \n args=[]\n value=sys.flags.optimize\n if value >0:\n args.append('-'+'O'*value)\n return args\n \n \ndef _args_from_interpreter_flags():\n ''\n \n flag_opt_map={\n 'debug':'d',\n \n \n 'dont_write_bytecode':'B',\n 'no_site':'S',\n 'verbose':'v',\n 'bytes_warning':'b',\n 'quiet':'q',\n \n }\n args=_optim_args_from_interpreter_flags()\n for flag,opt in flag_opt_map.items():\n v=getattr(sys.flags,flag)\n if v >0:\n args.append('-'+opt *v)\n \n if sys.flags.isolated:\n args.append('-I')\n else :\n if sys.flags.ignore_environment:\n args.append('-E')\n if sys.flags.no_user_site:\n args.append('-s')\n if sys.flags.safe_path:\n args.append('-P')\n \n \n warnopts=sys.warnoptions[:]\n xoptions=getattr(sys,'_xoptions',{})\n bytes_warning=sys.flags.bytes_warning\n dev_mode=sys.flags.dev_mode\n \n if bytes_warning >1:\n warnopts.remove(\"error::BytesWarning\")\n elif bytes_warning:\n warnopts.remove(\"default::BytesWarning\")\n if dev_mode:\n warnopts.remove('default')\n for opt in warnopts:\n args.append('-W'+opt)\n \n \n if dev_mode:\n args.extend(('-X','dev'))\n for opt in ('faulthandler','tracemalloc','importtime',\n 'showrefcount','utf8'):\n if opt in xoptions:\n value=xoptions[opt]\n if value is True :\n arg=opt\n else :\n arg='%s=%s'%(opt,value)\n args.extend(('-X',arg))\n \n return args\n \n \ndef _text_encoding():\n\n\n if sys.flags.warn_default_encoding:\n f=sys._getframe()\n filename=f.f_code.co_filename\n stacklevel=2\n while f :=f.f_back:\n if f.f_code.co_filename !=filename:\n break\n stacklevel +=1\n warnings.warn(\"'encoding' argument not specified.\",\n EncodingWarning,stacklevel)\n \n if sys.flags.utf8_mode:\n return \"utf-8\"\n else :\n return locale.getencoding()\n \n \ndef call(*popenargs,timeout=None ,**kwargs):\n ''\n\n\n\n\n\n \n with Popen(*popenargs,**kwargs)as p:\n try :\n return p.wait(timeout=timeout)\n except :\n p.kill()\n \n raise\n \n \ndef check_call(*popenargs,**kwargs):\n ''\n\n\n\n\n\n\n\n \n retcode=call(*popenargs,**kwargs)\n if retcode:\n cmd=kwargs.get(\"args\")\n if cmd is None :\n cmd=popenargs[0]\n raise CalledProcessError(retcode,cmd)\n return 0\n \n \ndef check_output(*popenargs,timeout=None ,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n for kw in ('stdout','check'):\n if kw in kwargs:\n raise ValueError(f'{kw} argument not allowed, it will be overridden.')\n \n if 'input'in kwargs and kwargs['input']is None :\n \n \n if kwargs.get('universal_newlines')or kwargs.get('text'):\n empty=''\n else :\n empty=b''\n kwargs['input']=empty\n \n return run(*popenargs,stdout=PIPE,timeout=timeout,check=True ,\n **kwargs).stdout\n \n \nclass CompletedProcess(object):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,args,returncode,stdout=None ,stderr=None ):\n self.args=args\n self.returncode=returncode\n self.stdout=stdout\n self.stderr=stderr\n \n def __repr__(self):\n args=['args={!r}'.format(self.args),\n 'returncode={!r}'.format(self.returncode)]\n if self.stdout is not None :\n args.append('stdout={!r}'.format(self.stdout))\n if self.stderr is not None :\n args.append('stderr={!r}'.format(self.stderr))\n return \"{}({})\".format(type(self).__name__,', '.join(args))\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \n def check_returncode(self):\n ''\n if self.returncode:\n raise CalledProcessError(self.returncode,self.args,self.stdout,\n self.stderr)\n \n \ndef run(*popenargs,\ninput=None ,capture_output=False ,timeout=None ,check=False ,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if input is not None :\n if kwargs.get('stdin')is not None :\n raise ValueError('stdin and input arguments may not both be used.')\n kwargs['stdin']=PIPE\n \n if capture_output:\n if kwargs.get('stdout')is not None or kwargs.get('stderr')is not None :\n raise ValueError('stdout and stderr arguments may not be used '\n 'with capture_output.')\n kwargs['stdout']=PIPE\n kwargs['stderr']=PIPE\n \n with Popen(*popenargs,**kwargs)as process:\n try :\n stdout,stderr=process.communicate(input,timeout=timeout)\n except TimeoutExpired as exc:\n process.kill()\n if _mswindows:\n \n \n \n \n \n exc.stdout,exc.stderr=process.communicate()\n else :\n \n \n process.wait()\n raise\n except :\n process.kill()\n \n raise\n retcode=process.poll()\n if check and retcode:\n raise CalledProcessError(retcode,process.args,\n output=stdout,stderr=stderr)\n return CompletedProcess(process.args,retcode,stdout,stderr)\n \n \ndef list2cmdline(seq):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n result=[]\n needquote=False\n for arg in map(os.fsdecode,seq):\n bs_buf=[]\n \n \n if result:\n result.append(' ')\n \n needquote=(\" \"in arg)or (\"\\t\"in arg)or not arg\n if needquote:\n result.append('\"')\n \n for c in arg:\n if c =='\\\\':\n \n bs_buf.append(c)\n elif c =='\"':\n \n result.append('\\\\'*len(bs_buf)*2)\n bs_buf=[]\n result.append('\\\\\"')\n else :\n \n if bs_buf:\n result.extend(bs_buf)\n bs_buf=[]\n result.append(c)\n \n \n if bs_buf:\n result.extend(bs_buf)\n \n if needquote:\n result.extend(bs_buf)\n result.append('\"')\n \n return ''.join(result)\n \n \n \n \n \ndef getstatusoutput(cmd,*,encoding=None ,errors=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n data=check_output(cmd,shell=True ,text=True ,stderr=STDOUT,\n encoding=encoding,errors=errors)\n exitcode=0\n except CalledProcessError as ex:\n data=ex.output\n exitcode=ex.returncode\n if data[-1:]=='\\n':\n data=data[:-1]\n return exitcode,data\n \ndef getoutput(cmd,*,encoding=None ,errors=None ):\n ''\n\n\n\n\n\n\n\n \n return getstatusoutput(cmd,encoding=encoding,errors=errors)[1]\n \n \n \ndef _use_posix_spawn():\n ''\n\n\n\n\n\n\n\n\n\n\n \n if _mswindows or not hasattr(os,'posix_spawn'):\n \n return False\n \n if sys.platform in ('darwin','sunos5'):\n \n \n return True\n \n \n try :\n ver=os.confstr('CS_GNU_LIBC_VERSION')\n \n parts=ver.split(maxsplit=1)\n if len(parts)!=2:\n \n raise ValueError\n libc=parts[0]\n version=tuple(map(int,parts[1].split('.')))\n \n if sys.platform =='linux'and libc =='glibc'and version >=(2,24):\n \n \n return True\n \n \n \n except (AttributeError,ValueError,OSError):\n \n pass\n \n \n return False\n \n \n \n \n_USE_POSIX_SPAWN=_use_posix_spawn()\n_USE_VFORK=True\n\n\nclass Popen:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n _child_created=False\n \n def __init__(self,args,bufsize=-1,executable=None ,\n stdin=None ,stdout=None ,stderr=None ,\n preexec_fn=None ,close_fds=True ,\n shell=False ,cwd=None ,env=None ,universal_newlines=None ,\n startupinfo=None ,creationflags=0,\n restore_signals=True ,start_new_session=False ,\n pass_fds=(),*,user=None ,group=None ,extra_groups=None ,\n encoding=None ,errors=None ,text=None ,umask=-1,pipesize=-1,\n process_group=None ):\n ''\n if not _can_fork_exec:\n raise OSError(\n errno.ENOTSUP,f\"{sys.platform} does not support processes.\"\n )\n \n _cleanup()\n \n \n \n \n \n self._waitpid_lock=threading.Lock()\n \n self._input=None\n self._communication_started=False\n if bufsize is None :\n bufsize=-1\n if not isinstance(bufsize,int):\n raise TypeError(\"bufsize must be an integer\")\n \n if pipesize is None :\n pipesize=-1\n if not isinstance(pipesize,int):\n raise TypeError(\"pipesize must be an integer\")\n \n if _mswindows:\n if preexec_fn is not None :\n raise ValueError(\"preexec_fn is not supported on Windows \"\n \"platforms\")\n else :\n \n if pass_fds and not close_fds:\n warnings.warn(\"pass_fds overriding close_fds.\",RuntimeWarning)\n close_fds=True\n if startupinfo is not None :\n raise ValueError(\"startupinfo is only supported on Windows \"\n \"platforms\")\n if creationflags !=0:\n raise ValueError(\"creationflags is only supported on Windows \"\n \"platforms\")\n \n self.args=args\n self.stdin=None\n self.stdout=None\n self.stderr=None\n self.pid=None\n self.returncode=None\n self.encoding=encoding\n self.errors=errors\n self.pipesize=pipesize\n \n \n if (text is not None and universal_newlines is not None\n and bool(universal_newlines)!=bool(text)):\n raise SubprocessError('Cannot disambiguate when both text '\n 'and universal_newlines are supplied but '\n 'different. Pass one or the other.')\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n (p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)=self._get_handles(stdin,stdout,stderr)\n \n \n \n \n \n if _mswindows:\n if p2cwrite !=-1:\n p2cwrite=msvcrt.open_osfhandle(p2cwrite.Detach(),0)\n if c2pread !=-1:\n c2pread=msvcrt.open_osfhandle(c2pread.Detach(),0)\n if errread !=-1:\n errread=msvcrt.open_osfhandle(errread.Detach(),0)\n \n self.text_mode=encoding or errors or text or universal_newlines\n if self.text_mode and encoding is None :\n self.encoding=encoding=_text_encoding()\n \n \n \n \n self._sigint_wait_secs=0.25\n \n self._closed_child_pipe_fds=False\n \n if self.text_mode:\n if bufsize ==1:\n line_buffering=True\n \n \n bufsize=-1\n else :\n line_buffering=False\n \n if process_group is None :\n process_group=-1\n \n gid=None\n if group is not None :\n if not hasattr(os,'setregid'):\n raise ValueError(\"The 'group' parameter is not supported on the \"\n \"current platform\")\n \n elif isinstance(group,str):\n try :\n import grp\n except ImportError:\n raise ValueError(\"The group parameter cannot be a string \"\n \"on systems without the grp module\")\n \n gid=grp.getgrnam(group).gr_gid\n elif isinstance(group,int):\n gid=group\n else :\n raise TypeError(\"Group must be a string or an integer, not {}\"\n .format(type(group)))\n \n if gid <0:\n raise ValueError(f\"Group ID cannot be negative, got {gid}\")\n \n gids=None\n if extra_groups is not None :\n if not hasattr(os,'setgroups'):\n raise ValueError(\"The 'extra_groups' parameter is not \"\n \"supported on the current platform\")\n \n elif isinstance(extra_groups,str):\n raise ValueError(\"Groups must be a list, not a string\")\n \n gids=[]\n for extra_group in extra_groups:\n if isinstance(extra_group,str):\n try :\n import grp\n except ImportError:\n raise ValueError(\"Items in extra_groups cannot be \"\n \"strings on systems without the \"\n \"grp module\")\n \n gids.append(grp.getgrnam(extra_group).gr_gid)\n elif isinstance(extra_group,int):\n gids.append(extra_group)\n else :\n raise TypeError(\"Items in extra_groups must be a string \"\n \"or integer, not {}\"\n .format(type(extra_group)))\n \n \n \n for gid_check in gids:\n if gid_check <0:\n raise ValueError(f\"Group ID cannot be negative, got {gid_check}\")\n \n uid=None\n if user is not None :\n if not hasattr(os,'setreuid'):\n raise ValueError(\"The 'user' parameter is not supported on \"\n \"the current platform\")\n \n elif isinstance(user,str):\n try :\n import pwd\n except ImportError:\n raise ValueError(\"The user parameter cannot be a string \"\n \"on systems without the pwd module\")\n uid=pwd.getpwnam(user).pw_uid\n elif isinstance(user,int):\n uid=user\n else :\n raise TypeError(\"User must be a string or an integer\")\n \n if uid <0:\n raise ValueError(f\"User ID cannot be negative, got {uid}\")\n \n try :\n if p2cwrite !=-1:\n self.stdin=io.open(p2cwrite,'wb',bufsize)\n if self.text_mode:\n self.stdin=io.TextIOWrapper(self.stdin,write_through=True ,\n line_buffering=line_buffering,\n encoding=encoding,errors=errors)\n if c2pread !=-1:\n self.stdout=io.open(c2pread,'rb',bufsize)\n if self.text_mode:\n self.stdout=io.TextIOWrapper(self.stdout,\n encoding=encoding,errors=errors)\n if errread !=-1:\n self.stderr=io.open(errread,'rb',bufsize)\n if self.text_mode:\n self.stderr=io.TextIOWrapper(self.stderr,\n encoding=encoding,errors=errors)\n \n self._execute_child(args,executable,preexec_fn,close_fds,\n pass_fds,cwd,env,\n startupinfo,creationflags,shell,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite,\n restore_signals,\n gid,gids,uid,umask,\n start_new_session,process_group)\n except :\n \n for f in filter(None ,(self.stdin,self.stdout,self.stderr)):\n try :\n f.close()\n except OSError:\n pass\n \n if not self._closed_child_pipe_fds:\n to_close=[]\n if stdin ==PIPE:\n to_close.append(p2cread)\n if stdout ==PIPE:\n to_close.append(c2pwrite)\n if stderr ==PIPE:\n to_close.append(errwrite)\n if hasattr(self,'_devnull'):\n to_close.append(self._devnull)\n for fd in to_close:\n try :\n if _mswindows and isinstance(fd,Handle):\n fd.Close()\n else :\n os.close(fd)\n except OSError:\n pass\n \n raise\n \n def __repr__(self):\n obj_repr=(\n f\"<{self.__class__.__name__}: \"\n f\"returncode: {self.returncode} args: {self.args!r}>\"\n )\n if len(obj_repr)>80:\n obj_repr=obj_repr[:76]+\"...>\"\n return obj_repr\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n @property\n def universal_newlines(self):\n \n \n return self.text_mode\n \n @universal_newlines.setter\n def universal_newlines(self,universal_newlines):\n self.text_mode=bool(universal_newlines)\n \n def _translate_newlines(self,data,encoding,errors):\n data=data.decode(encoding,errors)\n return data.replace(\"\\r\\n\",\"\\n\").replace(\"\\r\",\"\\n\")\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,value,traceback):\n if self.stdout:\n self.stdout.close()\n if self.stderr:\n self.stderr.close()\n try :\n if self.stdin:\n self.stdin.close()\n finally :\n if exc_type ==KeyboardInterrupt:\n \n \n \n \n \n \n \n if self._sigint_wait_secs >0:\n try :\n self._wait(timeout=self._sigint_wait_secs)\n except TimeoutExpired:\n pass\n self._sigint_wait_secs=0\n return\n \n \n self.wait()\n \n def __del__(self,_maxsize=sys.maxsize,_warn=warnings.warn):\n if not self._child_created:\n \n return\n if self.returncode is None :\n \n \n _warn(\"subprocess %s is still running\"%self.pid,\n ResourceWarning,source=self)\n \n self._internal_poll(_deadstate=_maxsize)\n if self.returncode is None and _active is not None :\n \n _active.append(self)\n \n def _get_devnull(self):\n if not hasattr(self,'_devnull'):\n self._devnull=os.open(os.devnull,os.O_RDWR)\n return self._devnull\n \n def _stdin_write(self,input):\n if input:\n try :\n self.stdin.write(input)\n except BrokenPipeError:\n pass\n except OSError as exc:\n if exc.errno ==errno.EINVAL:\n \n \n \n pass\n else :\n raise\n \n try :\n self.stdin.close()\n except BrokenPipeError:\n pass\n except OSError as exc:\n if exc.errno ==errno.EINVAL:\n pass\n else :\n raise\n \n def communicate(self,input=None ,timeout=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if self._communication_started and input:\n raise ValueError(\"Cannot send input after starting communication\")\n \n \n \n \n if (timeout is None and not self._communication_started and\n [self.stdin,self.stdout,self.stderr].count(None )>=2):\n stdout=None\n stderr=None\n if self.stdin:\n self._stdin_write(input)\n elif self.stdout:\n stdout=self.stdout.read()\n self.stdout.close()\n elif self.stderr:\n stderr=self.stderr.read()\n self.stderr.close()\n self.wait()\n else :\n if timeout is not None :\n endtime=_time()+timeout\n else :\n endtime=None\n \n try :\n stdout,stderr=self._communicate(input,endtime,timeout)\n except KeyboardInterrupt:\n \n \n if timeout is not None :\n sigint_timeout=min(self._sigint_wait_secs,\n self._remaining_time(endtime))\n else :\n sigint_timeout=self._sigint_wait_secs\n self._sigint_wait_secs=0\n try :\n self._wait(timeout=sigint_timeout)\n except TimeoutExpired:\n pass\n raise\n \n finally :\n self._communication_started=True\n \n sts=self.wait(timeout=self._remaining_time(endtime))\n \n return (stdout,stderr)\n \n \n def poll(self):\n ''\n \n return self._internal_poll()\n \n \n def _remaining_time(self,endtime):\n ''\n if endtime is None :\n return None\n else :\n return endtime -_time()\n \n \n def _check_timeout(self,endtime,orig_timeout,stdout_seq,stderr_seq,\n skip_check_and_raise=False ):\n ''\n if endtime is None :\n return\n if skip_check_and_raise or _time()>endtime:\n raise TimeoutExpired(\n self.args,orig_timeout,\n output=b''.join(stdout_seq)if stdout_seq else None ,\n stderr=b''.join(stderr_seq)if stderr_seq else None )\n \n \n def wait(self,timeout=None ):\n ''\n if timeout is not None :\n endtime=_time()+timeout\n try :\n return self._wait(timeout=timeout)\n except KeyboardInterrupt:\n \n \n \n \n if timeout is not None :\n sigint_timeout=min(self._sigint_wait_secs,\n self._remaining_time(endtime))\n else :\n sigint_timeout=self._sigint_wait_secs\n self._sigint_wait_secs=0\n try :\n self._wait(timeout=sigint_timeout)\n except TimeoutExpired:\n pass\n raise\n \n def _close_pipe_fds(self,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite):\n \n devnull_fd=getattr(self,'_devnull',None )\n \n with contextlib.ExitStack()as stack:\n if _mswindows:\n if p2cread !=-1:\n stack.callback(p2cread.Close)\n if c2pwrite !=-1:\n stack.callback(c2pwrite.Close)\n if errwrite !=-1:\n stack.callback(errwrite.Close)\n else :\n if p2cread !=-1 and p2cwrite !=-1 and p2cread !=devnull_fd:\n stack.callback(os.close,p2cread)\n if c2pwrite !=-1 and c2pread !=-1 and c2pwrite !=devnull_fd:\n stack.callback(os.close,c2pwrite)\n if errwrite !=-1 and errread !=-1 and errwrite !=devnull_fd:\n stack.callback(os.close,errwrite)\n \n if devnull_fd is not None :\n stack.callback(os.close,devnull_fd)\n \n \n self._closed_child_pipe_fds=True\n \n if _mswindows:\n \n \n \n def _get_handles(self,stdin,stdout,stderr):\n ''\n\n \n if stdin is None and stdout is None and stderr is None :\n return (-1,-1,-1,-1,-1,-1)\n \n p2cread,p2cwrite=-1,-1\n c2pread,c2pwrite=-1,-1\n errread,errwrite=-1,-1\n \n if stdin is None :\n p2cread=_winapi.GetStdHandle(_winapi.STD_INPUT_HANDLE)\n if p2cread is None :\n p2cread,_=_winapi.CreatePipe(None ,0)\n p2cread=Handle(p2cread)\n _winapi.CloseHandle(_)\n elif stdin ==PIPE:\n p2cread,p2cwrite=_winapi.CreatePipe(None ,0)\n p2cread,p2cwrite=Handle(p2cread),Handle(p2cwrite)\n elif stdin ==DEVNULL:\n p2cread=msvcrt.get_osfhandle(self._get_devnull())\n elif isinstance(stdin,int):\n p2cread=msvcrt.get_osfhandle(stdin)\n else :\n \n p2cread=msvcrt.get_osfhandle(stdin.fileno())\n p2cread=self._make_inheritable(p2cread)\n \n if stdout is None :\n c2pwrite=_winapi.GetStdHandle(_winapi.STD_OUTPUT_HANDLE)\n if c2pwrite is None :\n _,c2pwrite=_winapi.CreatePipe(None ,0)\n c2pwrite=Handle(c2pwrite)\n _winapi.CloseHandle(_)\n elif stdout ==PIPE:\n c2pread,c2pwrite=_winapi.CreatePipe(None ,0)\n c2pread,c2pwrite=Handle(c2pread),Handle(c2pwrite)\n elif stdout ==DEVNULL:\n c2pwrite=msvcrt.get_osfhandle(self._get_devnull())\n elif isinstance(stdout,int):\n c2pwrite=msvcrt.get_osfhandle(stdout)\n else :\n \n c2pwrite=msvcrt.get_osfhandle(stdout.fileno())\n c2pwrite=self._make_inheritable(c2pwrite)\n \n if stderr is None :\n errwrite=_winapi.GetStdHandle(_winapi.STD_ERROR_HANDLE)\n if errwrite is None :\n _,errwrite=_winapi.CreatePipe(None ,0)\n errwrite=Handle(errwrite)\n _winapi.CloseHandle(_)\n elif stderr ==PIPE:\n errread,errwrite=_winapi.CreatePipe(None ,0)\n errread,errwrite=Handle(errread),Handle(errwrite)\n elif stderr ==STDOUT:\n errwrite=c2pwrite\n elif stderr ==DEVNULL:\n errwrite=msvcrt.get_osfhandle(self._get_devnull())\n elif isinstance(stderr,int):\n errwrite=msvcrt.get_osfhandle(stderr)\n else :\n \n errwrite=msvcrt.get_osfhandle(stderr.fileno())\n errwrite=self._make_inheritable(errwrite)\n \n return (p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n \n def _make_inheritable(self,handle):\n ''\n h=_winapi.DuplicateHandle(\n _winapi.GetCurrentProcess(),handle,\n _winapi.GetCurrentProcess(),0,1,\n _winapi.DUPLICATE_SAME_ACCESS)\n return Handle(h)\n \n \n def _filter_handle_list(self,handle_list):\n ''\n\n \n \n \n \n return list({handle for handle in handle_list\n if handle&0x3 !=0x3\n or _winapi.GetFileType(handle)!=\n _winapi.FILE_TYPE_CHAR})\n \n \n def _execute_child(self,args,executable,preexec_fn,close_fds,\n pass_fds,cwd,env,\n startupinfo,creationflags,shell,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite,\n unused_restore_signals,\n unused_gid,unused_gids,unused_uid,\n unused_umask,\n unused_start_new_session,unused_process_group):\n ''\n \n assert not pass_fds,\"pass_fds not supported on Windows.\"\n \n if isinstance(args,str):\n pass\n elif isinstance(args,bytes):\n if shell:\n raise TypeError('bytes args is not allowed on Windows')\n args=list2cmdline([args])\n elif isinstance(args,os.PathLike):\n if shell:\n raise TypeError('path-like args is not allowed when '\n 'shell is true')\n args=list2cmdline([args])\n else :\n args=list2cmdline(args)\n \n if executable is not None :\n executable=os.fsdecode(executable)\n \n \n if startupinfo is None :\n startupinfo=STARTUPINFO()\n else :\n \n \n startupinfo=startupinfo.copy()\n \n use_std_handles=-1 not in (p2cread,c2pwrite,errwrite)\n if use_std_handles:\n startupinfo.dwFlags |=_winapi.STARTF_USESTDHANDLES\n startupinfo.hStdInput=p2cread\n startupinfo.hStdOutput=c2pwrite\n startupinfo.hStdError=errwrite\n \n attribute_list=startupinfo.lpAttributeList\n have_handle_list=bool(attribute_list and\n \"handle_list\"in attribute_list and\n attribute_list[\"handle_list\"])\n \n \n if have_handle_list or (use_std_handles and close_fds):\n if attribute_list is None :\n attribute_list=startupinfo.lpAttributeList={}\n handle_list=attribute_list[\"handle_list\"]=\\\n list(attribute_list.get(\"handle_list\",[]))\n \n if use_std_handles:\n handle_list +=[int(p2cread),int(c2pwrite),int(errwrite)]\n \n handle_list[:]=self._filter_handle_list(handle_list)\n \n if handle_list:\n if not close_fds:\n warnings.warn(\"startupinfo.lpAttributeList['handle_list'] \"\n \"overriding close_fds\",RuntimeWarning)\n \n \n \n \n close_fds=False\n \n if shell:\n startupinfo.dwFlags |=_winapi.STARTF_USESHOWWINDOW\n startupinfo.wShowWindow=_winapi.SW_HIDE\n comspec=os.environ.get(\"COMSPEC\",\"cmd.exe\")\n args='{} /c \"{}\"'.format(comspec,args)\n \n if cwd is not None :\n cwd=os.fsdecode(cwd)\n \n sys.audit(\"subprocess.Popen\",executable,args,cwd,env)\n \n \n try :\n hp,ht,pid,tid=_winapi.CreateProcess(executable,args,\n \n None ,None ,\n int(not close_fds),\n creationflags,\n env,\n cwd,\n startupinfo)\n finally :\n \n \n \n \n \n \n self._close_pipe_fds(p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n \n self._child_created=True\n self._handle=Handle(hp)\n self.pid=pid\n _winapi.CloseHandle(ht)\n \n def _internal_poll(self,_deadstate=None ,\n _WaitForSingleObject=_winapi.WaitForSingleObject,\n _WAIT_OBJECT_0=_winapi.WAIT_OBJECT_0,\n _GetExitCodeProcess=_winapi.GetExitCodeProcess):\n ''\n\n\n\n\n\n \n if self.returncode is None :\n if _WaitForSingleObject(self._handle,0)==_WAIT_OBJECT_0:\n self.returncode=_GetExitCodeProcess(self._handle)\n return self.returncode\n \n \n def _wait(self,timeout):\n ''\n if timeout is None :\n timeout_millis=_winapi.INFINITE\n else :\n timeout_millis=int(timeout *1000)\n if self.returncode is None :\n \n result=_winapi.WaitForSingleObject(self._handle,\n timeout_millis)\n if result ==_winapi.WAIT_TIMEOUT:\n raise TimeoutExpired(self.args,timeout)\n self.returncode=_winapi.GetExitCodeProcess(self._handle)\n return self.returncode\n \n \n def _readerthread(self,fh,buffer):\n buffer.append(fh.read())\n fh.close()\n \n \n def _communicate(self,input,endtime,orig_timeout):\n \n \n if self.stdout and not hasattr(self,\"_stdout_buff\"):\n self._stdout_buff=[]\n self.stdout_thread=\\\n threading.Thread(target=self._readerthread,\n args=(self.stdout,self._stdout_buff))\n self.stdout_thread.daemon=True\n self.stdout_thread.start()\n if self.stderr and not hasattr(self,\"_stderr_buff\"):\n self._stderr_buff=[]\n self.stderr_thread=\\\n threading.Thread(target=self._readerthread,\n args=(self.stderr,self._stderr_buff))\n self.stderr_thread.daemon=True\n self.stderr_thread.start()\n \n if self.stdin:\n self._stdin_write(input)\n \n \n \n \n if self.stdout is not None :\n self.stdout_thread.join(self._remaining_time(endtime))\n if self.stdout_thread.is_alive():\n raise TimeoutExpired(self.args,orig_timeout)\n if self.stderr is not None :\n self.stderr_thread.join(self._remaining_time(endtime))\n if self.stderr_thread.is_alive():\n raise TimeoutExpired(self.args,orig_timeout)\n \n \n \n stdout=None\n stderr=None\n if self.stdout:\n stdout=self._stdout_buff\n self.stdout.close()\n if self.stderr:\n stderr=self._stderr_buff\n self.stderr.close()\n \n \n stdout=stdout[0]if stdout else None\n stderr=stderr[0]if stderr else None\n \n return (stdout,stderr)\n \n def send_signal(self,sig):\n ''\n \n if self.returncode is not None :\n return\n if sig ==signal.SIGTERM:\n self.terminate()\n elif sig ==signal.CTRL_C_EVENT:\n os.kill(self.pid,signal.CTRL_C_EVENT)\n elif sig ==signal.CTRL_BREAK_EVENT:\n os.kill(self.pid,signal.CTRL_BREAK_EVENT)\n else :\n raise ValueError(\"Unsupported signal: {}\".format(sig))\n \n def terminate(self):\n ''\n \n if self.returncode is not None :\n return\n try :\n _winapi.TerminateProcess(self._handle,1)\n except PermissionError:\n \n \n rc=_winapi.GetExitCodeProcess(self._handle)\n if rc ==_winapi.STILL_ACTIVE:\n raise\n self.returncode=rc\n \n kill=terminate\n \n else :\n \n \n \n def _get_handles(self,stdin,stdout,stderr):\n ''\n\n \n p2cread,p2cwrite=-1,-1\n c2pread,c2pwrite=-1,-1\n errread,errwrite=-1,-1\n \n if stdin is None :\n pass\n elif stdin ==PIPE:\n p2cread,p2cwrite=os.pipe()\n if self.pipesize >0 and hasattr(fcntl,\"F_SETPIPE_SZ\"):\n fcntl.fcntl(p2cwrite,fcntl.F_SETPIPE_SZ,self.pipesize)\n elif stdin ==DEVNULL:\n p2cread=self._get_devnull()\n elif isinstance(stdin,int):\n p2cread=stdin\n else :\n \n p2cread=stdin.fileno()\n \n if stdout is None :\n pass\n elif stdout ==PIPE:\n c2pread,c2pwrite=os.pipe()\n if self.pipesize >0 and hasattr(fcntl,\"F_SETPIPE_SZ\"):\n fcntl.fcntl(c2pwrite,fcntl.F_SETPIPE_SZ,self.pipesize)\n elif stdout ==DEVNULL:\n c2pwrite=self._get_devnull()\n elif isinstance(stdout,int):\n c2pwrite=stdout\n else :\n \n c2pwrite=stdout.fileno()\n \n if stderr is None :\n pass\n elif stderr ==PIPE:\n errread,errwrite=os.pipe()\n if self.pipesize >0 and hasattr(fcntl,\"F_SETPIPE_SZ\"):\n fcntl.fcntl(errwrite,fcntl.F_SETPIPE_SZ,self.pipesize)\n elif stderr ==STDOUT:\n if c2pwrite !=-1:\n errwrite=c2pwrite\n else :\n errwrite=sys.__stdout__.fileno()\n elif stderr ==DEVNULL:\n errwrite=self._get_devnull()\n elif isinstance(stderr,int):\n errwrite=stderr\n else :\n \n errwrite=stderr.fileno()\n \n return (p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n \n def _posix_spawn(self,args,executable,env,restore_signals,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite):\n ''\n if env is None :\n env=os.environ\n \n kwargs={}\n if restore_signals:\n \n sigset=[]\n for signame in ('SIGPIPE','SIGXFZ','SIGXFSZ'):\n signum=getattr(signal,signame,None )\n if signum is not None :\n sigset.append(signum)\n kwargs['setsigdef']=sigset\n \n file_actions=[]\n for fd in (p2cwrite,c2pread,errread):\n if fd !=-1:\n file_actions.append((os.POSIX_SPAWN_CLOSE,fd))\n for fd,fd2 in (\n (p2cread,0),\n (c2pwrite,1),\n (errwrite,2),\n ):\n if fd !=-1:\n file_actions.append((os.POSIX_SPAWN_DUP2,fd,fd2))\n if file_actions:\n kwargs['file_actions']=file_actions\n \n self.pid=os.posix_spawn(executable,args,env,**kwargs)\n self._child_created=True\n \n self._close_pipe_fds(p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n def _execute_child(self,args,executable,preexec_fn,close_fds,\n pass_fds,cwd,env,\n startupinfo,creationflags,shell,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite,\n restore_signals,\n gid,gids,uid,umask,\n start_new_session,process_group):\n ''\n \n if isinstance(args,(str,bytes)):\n args=[args]\n elif isinstance(args,os.PathLike):\n if shell:\n raise TypeError('path-like args is not allowed when '\n 'shell is true')\n args=[args]\n else :\n args=list(args)\n \n if shell:\n \n unix_shell=('/system/bin/sh'if\n hasattr(sys,'getandroidapilevel')else '/bin/sh')\n args=[unix_shell,\"-c\"]+args\n if executable:\n args[0]=executable\n \n if executable is None :\n executable=args[0]\n \n sys.audit(\"subprocess.Popen\",executable,args,cwd,env)\n \n if (_USE_POSIX_SPAWN\n and os.path.dirname(executable)\n and preexec_fn is None\n and not close_fds\n and not pass_fds\n and cwd is None\n and (p2cread ==-1 or p2cread >2)\n and (c2pwrite ==-1 or c2pwrite >2)\n and (errwrite ==-1 or errwrite >2)\n and not start_new_session\n and process_group ==-1\n and gid is None\n and gids is None\n and uid is None\n and umask <0):\n self._posix_spawn(args,executable,env,restore_signals,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n return\n \n orig_executable=executable\n \n \n \n \n errpipe_read,errpipe_write=os.pipe()\n \n low_fds_to_close=[]\n while errpipe_write <3:\n low_fds_to_close.append(errpipe_write)\n errpipe_write=os.dup(errpipe_write)\n for low_fd in low_fds_to_close:\n os.close(low_fd)\n try :\n try :\n \n \n \n \n \n if env is not None :\n env_list=[]\n for k,v in env.items():\n k=os.fsencode(k)\n if b'='in k:\n raise ValueError(\"illegal environment variable name\")\n env_list.append(k+b'='+os.fsencode(v))\n else :\n env_list=None\n executable=os.fsencode(executable)\n if os.path.dirname(executable):\n executable_list=(executable,)\n else :\n \n executable_list=tuple(\n os.path.join(os.fsencode(dir),executable)\n for dir in os.get_exec_path(env))\n fds_to_keep=set(pass_fds)\n fds_to_keep.add(errpipe_write)\n self.pid=_fork_exec(\n args,executable_list,\n close_fds,tuple(sorted(map(int,fds_to_keep))),\n cwd,env_list,\n p2cread,p2cwrite,c2pread,c2pwrite,\n errread,errwrite,\n errpipe_read,errpipe_write,\n restore_signals,start_new_session,\n process_group,gid,gids,uid,umask,\n preexec_fn,_USE_VFORK)\n self._child_created=True\n finally :\n \n os.close(errpipe_write)\n \n self._close_pipe_fds(p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n \n \n errpipe_data=bytearray()\n while True :\n part=os.read(errpipe_read,50000)\n errpipe_data +=part\n if not part or len(errpipe_data)>50000:\n break\n finally :\n \n os.close(errpipe_read)\n \n if errpipe_data:\n try :\n pid,sts=os.waitpid(self.pid,0)\n if pid ==self.pid:\n self._handle_exitstatus(sts)\n else :\n self.returncode=sys.maxsize\n except ChildProcessError:\n pass\n \n try :\n exception_name,hex_errno,err_msg=(\n errpipe_data.split(b':',2))\n \n \n \n err_msg=err_msg.decode()\n except ValueError:\n exception_name=b'SubprocessError'\n hex_errno=b'0'\n err_msg='Bad exception data from child: {!r}'.format(\n bytes(errpipe_data))\n child_exception_type=getattr(\n builtins,exception_name.decode('ascii'),\n SubprocessError)\n if issubclass(child_exception_type,OSError)and hex_errno:\n errno_num=int(hex_errno,16)\n child_exec_never_called=(err_msg ==\"noexec\")\n if child_exec_never_called:\n err_msg=\"\"\n \n err_filename=cwd\n else :\n err_filename=orig_executable\n if errno_num !=0:\n err_msg=os.strerror(errno_num)\n raise child_exception_type(errno_num,err_msg,err_filename)\n raise child_exception_type(err_msg)\n \n \n def _handle_exitstatus(self,sts,\n _waitstatus_to_exitcode=_waitstatus_to_exitcode,\n _WIFSTOPPED=_WIFSTOPPED,\n _WSTOPSIG=_WSTOPSIG):\n ''\n \n \n if _WIFSTOPPED(sts):\n self.returncode=-_WSTOPSIG(sts)\n else :\n self.returncode=_waitstatus_to_exitcode(sts)\n \n def _internal_poll(self,_deadstate=None ,_waitpid=_waitpid,\n _WNOHANG=_WNOHANG,_ECHILD=errno.ECHILD):\n ''\n\n\n\n\n\n \n if self.returncode is None :\n if not self._waitpid_lock.acquire(False ):\n \n \n return None\n try :\n if self.returncode is not None :\n return self.returncode\n pid,sts=_waitpid(self.pid,_WNOHANG)\n if pid ==self.pid:\n self._handle_exitstatus(sts)\n except OSError as e:\n if _deadstate is not None :\n self.returncode=_deadstate\n elif e.errno ==_ECHILD:\n \n \n \n \n \n self.returncode=0\n finally :\n self._waitpid_lock.release()\n return self.returncode\n \n \n def _try_wait(self,wait_flags):\n ''\n try :\n (pid,sts)=os.waitpid(self.pid,wait_flags)\n except ChildProcessError:\n \n \n \n pid=self.pid\n sts=0\n return (pid,sts)\n \n \n def _wait(self,timeout):\n ''\n if self.returncode is not None :\n return self.returncode\n \n if timeout is not None :\n endtime=_time()+timeout\n \n \n delay=0.0005\n while True :\n if self._waitpid_lock.acquire(False ):\n try :\n if self.returncode is not None :\n break\n (pid,sts)=self._try_wait(os.WNOHANG)\n assert pid ==self.pid or pid ==0\n if pid ==self.pid:\n self._handle_exitstatus(sts)\n break\n finally :\n self._waitpid_lock.release()\n remaining=self._remaining_time(endtime)\n if remaining <=0:\n raise TimeoutExpired(self.args,timeout)\n delay=min(delay *2,remaining,.05)\n time.sleep(delay)\n else :\n while self.returncode is None :\n with self._waitpid_lock:\n if self.returncode is not None :\n break\n (pid,sts)=self._try_wait(0)\n \n \n \n if pid ==self.pid:\n self._handle_exitstatus(sts)\n return self.returncode\n \n \n def _communicate(self,input,endtime,orig_timeout):\n if self.stdin and not self._communication_started:\n \n \n try :\n self.stdin.flush()\n except BrokenPipeError:\n pass\n if not input:\n try :\n self.stdin.close()\n except BrokenPipeError:\n pass\n \n stdout=None\n stderr=None\n \n \n if not self._communication_started:\n self._fileobj2output={}\n if self.stdout:\n self._fileobj2output[self.stdout]=[]\n if self.stderr:\n self._fileobj2output[self.stderr]=[]\n \n if self.stdout:\n stdout=self._fileobj2output[self.stdout]\n if self.stderr:\n stderr=self._fileobj2output[self.stderr]\n \n self._save_input(input)\n \n if self._input:\n input_view=memoryview(self._input)\n \n with _PopenSelector()as selector:\n if self.stdin and input:\n selector.register(self.stdin,selectors.EVENT_WRITE)\n if self.stdout and not self.stdout.closed:\n selector.register(self.stdout,selectors.EVENT_READ)\n if self.stderr and not self.stderr.closed:\n selector.register(self.stderr,selectors.EVENT_READ)\n \n while selector.get_map():\n timeout=self._remaining_time(endtime)\n if timeout is not None and timeout <0:\n self._check_timeout(endtime,orig_timeout,\n stdout,stderr,\n skip_check_and_raise=True )\n raise RuntimeError(\n '_check_timeout(..., skip_check_and_raise=True) '\n 'failed to raise TimeoutExpired.')\n \n ready=selector.select(timeout)\n self._check_timeout(endtime,orig_timeout,stdout,stderr)\n \n \n \n \n for key,events in ready:\n if key.fileobj is self.stdin:\n chunk=input_view[self._input_offset:\n self._input_offset+_PIPE_BUF]\n try :\n self._input_offset +=os.write(key.fd,chunk)\n except BrokenPipeError:\n selector.unregister(key.fileobj)\n key.fileobj.close()\n else :\n if self._input_offset >=len(self._input):\n selector.unregister(key.fileobj)\n key.fileobj.close()\n elif key.fileobj in (self.stdout,self.stderr):\n data=os.read(key.fd,32768)\n if not data:\n selector.unregister(key.fileobj)\n key.fileobj.close()\n self._fileobj2output[key.fileobj].append(data)\n \n self.wait(timeout=self._remaining_time(endtime))\n \n \n if stdout is not None :\n stdout=b''.join(stdout)\n if stderr is not None :\n stderr=b''.join(stderr)\n \n \n \n if self.text_mode:\n if stdout is not None :\n stdout=self._translate_newlines(stdout,\n self.stdout.encoding,\n self.stdout.errors)\n if stderr is not None :\n stderr=self._translate_newlines(stderr,\n self.stderr.encoding,\n self.stderr.errors)\n \n return (stdout,stderr)\n \n \n def _save_input(self,input):\n \n \n \n if self.stdin and self._input is None :\n self._input_offset=0\n self._input=input\n if input is not None and self.text_mode:\n self._input=self._input.encode(self.stdin.encoding,\n self.stdin.errors)\n \n \n def send_signal(self,sig):\n ''\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n self.poll()\n if self.returncode is not None :\n \n return\n \n \n \n \n try :\n os.kill(self.pid,sig)\n except ProcessLookupError:\n \n pass\n \n def terminate(self):\n ''\n \n self.send_signal(signal.SIGTERM)\n \n def kill(self):\n ''\n \n self.send_signal(signal.SIGKILL)\n", ["_posixsubprocess", "_winapi", "builtins", "contextlib", "errno", "fcntl", "grp", "io", "locale", "msvcrt", "os", "pwd", "select", "selectors", "signal", "sys", "threading", "time", "types", "warnings"]], "symtable": [".py", "''\n\nimport _symtable\nfrom _symtable import (USE,DEF_GLOBAL,DEF_NONLOCAL,DEF_LOCAL,DEF_PARAM,\nDEF_IMPORT,DEF_BOUND,DEF_ANNOT,SCOPE_OFF,SCOPE_MASK,FREE,\nLOCAL,GLOBAL_IMPLICIT,GLOBAL_EXPLICIT,CELL)\n\nimport weakref\n\n__all__=[\"symtable\",\"SymbolTable\",\"Class\",\"Function\",\"Symbol\"]\n\ndef symtable(code,filename,compile_type):\n ''\n\n\n\n \n top=_symtable.symtable(code,filename,compile_type)\n return _newSymbolTable(top,filename)\n \nclass SymbolTableFactory:\n def __init__(self):\n self.__memo=weakref.WeakValueDictionary()\n \n def new(self,table,filename):\n if table.type ==_symtable.TYPE_FUNCTION:\n return Function(table,filename)\n if table.type ==_symtable.TYPE_CLASS:\n return Class(table,filename)\n return SymbolTable(table,filename)\n \n def __call__(self,table,filename):\n key=table,filename\n obj=self.__memo.get(key,None )\n if obj is None :\n obj=self.__memo[key]=self.new(table,filename)\n return obj\n \n_newSymbolTable=SymbolTableFactory()\n\n\nclass SymbolTable:\n\n def __init__(self,raw_table,filename):\n self._table=raw_table\n self._filename=filename\n self._symbols={}\n \n def __repr__(self):\n if self.__class__ ==SymbolTable:\n kind=\"\"\n else :\n kind=\"%s \"%self.__class__.__name__\n \n if self._table.name ==\"top\":\n return \"<{0}SymbolTable for module {1}>\".format(kind,self._filename)\n else :\n return \"<{0}SymbolTable for {1} in {2}>\".format(kind,\n self._table.name,\n self._filename)\n \n def get_type(self):\n ''\n\n\n\n \n if self._table.type ==_symtable.TYPE_MODULE:\n return \"module\"\n if self._table.type ==_symtable.TYPE_FUNCTION:\n return \"function\"\n if self._table.type ==_symtable.TYPE_CLASS:\n return \"class\"\n assert self._table.type in (1,2,3),\\\n \"unexpected type: {0}\".format(self._table.type)\n \n def get_id(self):\n ''\n \n return self._table.id\n \n def get_name(self):\n ''\n\n\n\n\n \n return self._table.name\n \n def get_lineno(self):\n ''\n\n \n return self._table.lineno\n \n def is_optimized(self):\n ''\n\n \n return bool(self._table.type ==_symtable.TYPE_FUNCTION)\n \n def is_nested(self):\n ''\n \n return bool(self._table.nested)\n \n def has_children(self):\n ''\n \n return bool(self._table.children)\n \n def get_identifiers(self):\n ''\n \n return self._table.symbols.keys()\n \n def lookup(self,name):\n ''\n\n\n \n sym=self._symbols.get(name)\n if sym is None :\n flags=self._table.symbols[name]\n namespaces=self.__check_children(name)\n module_scope=(self._table.name ==\"top\")\n sym=self._symbols[name]=Symbol(name,flags,namespaces,\n module_scope=module_scope)\n return sym\n \n def get_symbols(self):\n ''\n\n \n return [self.lookup(ident)for ident in self.get_identifiers()]\n \n def __check_children(self,name):\n return [_newSymbolTable(st,self._filename)\n for st in self._table.children\n if st.name ==name]\n \n def get_children(self):\n ''\n \n return [_newSymbolTable(st,self._filename)\n for st in self._table.children]\n \n \nclass Function(SymbolTable):\n\n\n __params=None\n __locals=None\n __frees=None\n __globals=None\n __nonlocals=None\n \n def __idents_matching(self,test_func):\n return tuple(ident for ident in self.get_identifiers()\n if test_func(self._table.symbols[ident]))\n \n def get_parameters(self):\n ''\n \n if self.__params is None :\n self.__params=self.__idents_matching(lambda x:x&DEF_PARAM)\n return self.__params\n \n def get_locals(self):\n ''\n \n if self.__locals is None :\n locs=(LOCAL,CELL)\n test=lambda x:((x >>SCOPE_OFF)&SCOPE_MASK)in locs\n self.__locals=self.__idents_matching(test)\n return self.__locals\n \n def get_globals(self):\n ''\n \n if self.__globals is None :\n glob=(GLOBAL_IMPLICIT,GLOBAL_EXPLICIT)\n test=lambda x:((x >>SCOPE_OFF)&SCOPE_MASK)in glob\n self.__globals=self.__idents_matching(test)\n return self.__globals\n \n def get_nonlocals(self):\n ''\n \n if self.__nonlocals is None :\n self.__nonlocals=self.__idents_matching(lambda x:x&DEF_NONLOCAL)\n return self.__nonlocals\n \n def get_frees(self):\n ''\n \n if self.__frees is None :\n is_free=lambda x:((x >>SCOPE_OFF)&SCOPE_MASK)==FREE\n self.__frees=self.__idents_matching(is_free)\n return self.__frees\n \n \nclass Class(SymbolTable):\n\n __methods=None\n \n def get_methods(self):\n ''\n \n if self.__methods is None :\n d={}\n for st in self._table.children:\n d[st.name]=1\n self.__methods=tuple(d)\n return self.__methods\n \n \nclass Symbol:\n\n def __init__(self,name,flags,namespaces=None ,*,module_scope=False ):\n self.__name=name\n self.__flags=flags\n self.__scope=(flags >>SCOPE_OFF)&SCOPE_MASK\n self.__namespaces=namespaces or ()\n self.__module_scope=module_scope\n \n def __repr__(self):\n return \"\".format(self.__name)\n \n def get_name(self):\n ''\n \n return self.__name\n \n def is_referenced(self):\n ''\n\n \n return bool(self.__flags&_symtable.USE)\n \n def is_parameter(self):\n ''\n \n return bool(self.__flags&DEF_PARAM)\n \n def is_global(self):\n ''\n \n return bool(self.__scope in (GLOBAL_IMPLICIT,GLOBAL_EXPLICIT)\n or (self.__module_scope and self.__flags&DEF_BOUND))\n \n def is_nonlocal(self):\n ''\n return bool(self.__flags&DEF_NONLOCAL)\n \n def is_declared_global(self):\n ''\n \n return bool(self.__scope ==GLOBAL_EXPLICIT)\n \n def is_local(self):\n ''\n \n return bool(self.__scope in (LOCAL,CELL)\n or (self.__module_scope and self.__flags&DEF_BOUND))\n \n def is_annotated(self):\n ''\n \n return bool(self.__flags&DEF_ANNOT)\n \n def is_free(self):\n ''\n\n \n return bool(self.__scope ==FREE)\n \n def is_imported(self):\n ''\n\n \n return bool(self.__flags&DEF_IMPORT)\n \n def is_assigned(self):\n ''\n return bool(self.__flags&DEF_LOCAL)\n \n def is_namespace(self):\n ''\n\n\n\n\n\n\n\n\n \n return bool(self.__namespaces)\n \n def get_namespaces(self):\n ''\n return self.__namespaces\n \n def get_namespace(self):\n ''\n\n\n\n \n if len(self.__namespaces)==0:\n raise ValueError(\"name is not bound to any namespaces\")\n elif len(self.__namespaces)>1:\n raise ValueError(\"name is bound to multiple namespaces\")\n else :\n return self.__namespaces[0]\n \nif __name__ ==\"__main__\":\n import os,sys\n with open(sys.argv[0])as f:\n src=f.read()\n mod=symtable(src,os.path.split(sys.argv[0])[1],\"exec\")\n for ident in mod.get_identifiers():\n info=mod.lookup(ident)\n print(info,info.is_local(),info.is_namespace())\n", ["_symtable", "os", "sys", "weakref"]], "sys": [".py", "\nfrom _sys import *\n\nimport browser\nimport javascript\n\nclass Error(Exception):\n pass\n \n_getframe=Getframe\n\nabiflags=0\n\ndef audit(event,*args):\n ''\n pass\n \nbrython_debug_mode=__BRYTHON__.get_option('debug')\n\nbase_exec_prefix=__BRYTHON__.brython_path\n\nbase_prefix=__BRYTHON__.brython_path\n\nbuiltin_module_names=__BRYTHON__.builtin_module_names\n\nbyteorder='little'\n\ndont_write_bytecode=True\n\nexec_prefix=__BRYTHON__.brython_path\n\nexecutable=__BRYTHON__.brython_path+'brython.js'\n\nargv=orig_argv=[__BRYTHON__.script_path]+list(__BRYTHON__.get_option('args'))\n\ndef displayhook(value):\n if value is not None :\n stdout.write(repr(value))\n \n__displayhook__=displayhook\n\ndef exit(i=None ):\n raise SystemExit('')\n \nclass flag_class:\n\n def __init__(self):\n self.debug=0\n self.inspect=0\n self.interactive=0\n self.optimize=0\n self.dont_write_bytecode=0\n self.no_user_site=0\n self.no_site=0\n self.ignore_environment=0\n self.verbose=0\n self.bytes_warning=0\n self.quiet=0\n self.hash_randomization=1\n self.isolated=0\n self.dev_mode=False\n self.utf8_mode=0\n self.warn_default_encoding=0\n \nflags=flag_class()\n\ndef getfilesystemencoding(*args,**kw):\n ''\n\n \n return 'utf-8'\n \ndef getfilesystemencodeerrors():\n return \"utf-8\"\n \ndef intern(string):\n return string\n \nclass int_info:\n bits_per_digit=30\n sizeof_digit=4\n default_max_str_digits=__BRYTHON__.int_max_str_digits\n str_digits_check_threshold=__BRYTHON__.str_digits_check_threshold\n \ndef get_int_max_str_digits():\n return __BRYTHON__.int_max_str_digits\n \ndef set_int_max_str_digits(value):\n try :\n value=int(value)\n except :\n raise ValueError(f\"'{value.__class__.__name__}' object \"\n \"cannot be interpreted as an integer\")\n if value !=0 and value =other\n \n raise Error(\"Error! I don't know how to compare!\")\n \n def __gt__(self,other):\n if isinstance(other,tuple):\n return (self.major,self.minor,self.micro)>other\n \n raise Error(\"Error! I don't know how to compare!\")\n \n def __le__(self,other):\n if isinstance(other,tuple):\n return (self.major,self.minor,self.micro)<=other\n \n raise Error(\"Error! I don't know how to compare!\")\n \n def __lt__(self,other):\n if isinstance(other,tuple):\n return (self.major,self.minor,self.micro)0:\n for name in tuple(variables):\n value=notdone[name]\n m1=re.search(_findvar1_rx,value)\n m2=re.search(_findvar2_rx,value)\n if m1 and m2:\n m=m1 if m1.start()=\"5\":\n osname=\"solaris\"\n release=f\"{int(release[0])-3}.{release[2:]}\"\n \n \n \n bitness={2147483647:\"32bit\",9223372036854775807:\"64bit\"}\n machine +=f\".{bitness[sys.maxsize]}\"\n \n elif osname[:3]==\"aix\":\n from _aix_support import aix_platform\n return aix_platform()\n elif osname[:6]==\"cygwin\":\n osname=\"cygwin\"\n import re\n rel_re=re.compile(r'[\\d.]+')\n m=rel_re.match(release)\n if m:\n release=m.group()\n elif osname[:6]==\"darwin\":\n import _osx_support\n osname,release,machine=_osx_support.get_platform_osx(\n get_config_vars(),\n osname,release,machine)\n \n return f\"{osname}-{release}-{machine}\"\n \n \ndef get_python_version():\n return _PY_VERSION_SHORT\n \n \ndef expand_makefile_vars(s,vars):\n ''\n\n\n\n\n\n \n import re\n \n \n \n \n \n \n \n while True:\n m=re.search(_findvar1_rx,s)or re.search(_findvar2_rx,s)\n if m:\n (beg,end)=m.span()\n s=s[0:beg]+vars.get(m.group(1))+s[end:]\n else:\n break\n return s\n \n \ndef _print_dict(title,data):\n for index,(key,value)in enumerate(sorted(data.items())):\n if index ==0:\n print(f'{title}: ')\n print(f'\\t{key} = \"{value}\"')\n \n \ndef _main():\n ''\n if '--generate-posix-vars'in sys.argv:\n _generate_posix_vars()\n return\n print(f'Platform: \"{get_platform()}\"')\n print(f'Python version: \"{get_python_version()}\"')\n print(f'Current installation scheme: \"{get_default_scheme()}\"')\n print()\n _print_dict('Paths',get_paths())\n print()\n _print_dict('Variables',get_config_vars())\n \n \nif __name__ =='__main__':\n _main()\n", ["_aix_support", "_imp", "_osx_support", "os", "os.path", "pprint", "re", "sys", "threading", "types", "warnings"]], "tabnanny": [".py", "#! /usr/bin/env python3\n\n\"\"\"The Tab Nanny despises ambiguous indentation. She knows no mercy.\n\ntabnanny -- Detection of ambiguous indentation\n\nFor the time being this module is intended to be called as a script.\nHowever it is possible to import it into an IDE and use the function\ncheck() described below.\n\nWarning: The API provided by this module is likely to change in future\nreleases; such changes may not be backward compatible.\n\"\"\"\n\n\n\n\n\n\n\n__version__=\"6\"\n\nimport os\nimport sys\nimport tokenize\n\n__all__=[\"check\",\"NannyNag\",\"process_tokens\"]\n\nverbose=0\nfilename_only=0\n\ndef errprint(*args):\n sep=\"\"\n for arg in args:\n sys.stderr.write(sep+str(arg))\n sep=\" \"\n sys.stderr.write(\"\\n\")\n sys.exit(1)\n \ndef main():\n import getopt\n \n global verbose,filename_only\n try:\n opts,args=getopt.getopt(sys.argv[1:],\"qv\")\n except getopt.error as msg:\n errprint(msg)\n for o,a in opts:\n if o =='-q':\n filename_only=filename_only+1\n if o =='-v':\n verbose=verbose+1\n if not args:\n errprint(\"Usage:\",sys.argv[0],\"[-v] file_or_directory ...\")\n for arg in args:\n check(arg)\n \nclass NannyNag(Exception):\n ''\n\n\n \n def __init__(self,lineno,msg,line):\n self.lineno,self.msg,self.line=lineno,msg,line\n def get_lineno(self):\n return self.lineno\n def get_msg(self):\n return self.msg\n def get_line(self):\n return self.line\n \ndef check(file):\n ''\n\n\n\n\n\n\n \n \n if os.path.isdir(file)and not os.path.islink(file):\n if verbose:\n print(\"%r: listing directory\"%(file,))\n names=os.listdir(file)\n for name in names:\n fullname=os.path.join(file,name)\n if(os.path.isdir(fullname)and\n not os.path.islink(fullname)or\n os.path.normcase(name[-3:])==\".py\"):\n check(fullname)\n return\n \n try:\n f=tokenize.open(file)\n except OSError as msg:\n errprint(\"%r: I/O Error: %s\"%(file,msg))\n return\n \n if verbose >1:\n print(\"checking %r ...\"%file)\n \n try:\n process_tokens(tokenize.generate_tokens(f.readline))\n \n except tokenize.TokenError as msg:\n errprint(\"%r: Token Error: %s\"%(file,msg))\n return\n \n except SyntaxError as msg:\n errprint(\"%r: Token Error: %s\"%(file,msg))\n return\n \n except IndentationError as msg:\n errprint(\"%r: Indentation Error: %s\"%(file,msg))\n return\n \n except NannyNag as nag:\n badline=nag.get_lineno()\n line=nag.get_line()\n if verbose:\n print(\"%r: *** Line %d: trouble in tab city! ***\"%(file,badline))\n print(\"offending line: %r\"%(line,))\n print(nag.get_msg())\n else:\n if ' 'in file:file='\"'+file+'\"'\n if filename_only:print(file)\n else:print(file,badline,repr(line))\n return\n \n finally:\n f.close()\n \n if verbose:\n print(\"%r: Clean bill of health.\"%(file,))\n \nclass Whitespace:\n\n S,T=' \\t'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def __init__(self,ws):\n self.raw=ws\n S,T=Whitespace.S,Whitespace.T\n count=[]\n b=n=nt=0\n for ch in self.raw:\n if ch ==S:\n n=n+1\n b=b+1\n elif ch ==T:\n n=n+1\n nt=nt+1\n if b >=len(count):\n count=count+[0]*(b -len(count)+1)\n count[b]=count[b]+1\n b=0\n else:\n break\n self.n=n\n self.nt=nt\n self.norm=tuple(count),b\n self.is_simple=len(count)<=1\n \n \n \n def longest_run_of_spaces(self):\n count,trailing=self.norm\n return max(len(count)-1,trailing)\n \n def indent_level(self,tabsize):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n count,trailing=self.norm\n il=0\n for i in range(tabsize,len(count)):\n il=il+i //tabsize *count[i]\n return trailing+tabsize *(il+self.nt)\n \n \n \n def equal(self,other):\n return self.norm ==other.norm\n \n \n \n \n \n def not_equal_witness(self,other):\n n=max(self.longest_run_of_spaces(),\n other.longest_run_of_spaces())+1\n a=[]\n for ts in range(1,n+1):\n if self.indent_level(ts)!=other.indent_level(ts):\n a.append((ts,\n self.indent_level(ts),\n other.indent_level(ts)))\n return a\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def less(self,other):\n if self.n >=other.n:\n return False\n if self.is_simple and other.is_simple:\n return self.nt <=other.nt\n n=max(self.longest_run_of_spaces(),\n other.longest_run_of_spaces())+1\n \n for ts in range(2,n+1):\n if self.indent_level(ts)>=other.indent_level(ts):\n return False\n return True\n \n \n \n \n \n def not_less_witness(self,other):\n n=max(self.longest_run_of_spaces(),\n other.longest_run_of_spaces())+1\n a=[]\n for ts in range(1,n+1):\n if self.indent_level(ts)>=other.indent_level(ts):\n a.append((ts,\n self.indent_level(ts),\n other.indent_level(ts)))\n return a\n \ndef format_witnesses(w):\n firsts=(str(tup[0])for tup in w)\n prefix=\"at tab size\"\n if len(w)>1:\n prefix=prefix+\"s\"\n return prefix+\" \"+', '.join(firsts)\n \ndef process_tokens(tokens):\n try:\n _process_tokens(tokens)\n except TabError as e:\n raise NannyNag(e.lineno,e.msg,e.text)\n \ndef _process_tokens(tokens):\n INDENT=tokenize.INDENT\n DEDENT=tokenize.DEDENT\n NEWLINE=tokenize.NEWLINE\n JUNK=tokenize.COMMENT,tokenize.NL\n indents=[Whitespace(\"\")]\n check_equal=0\n \n for(type,token,start,end,line)in tokens:\n if type ==NEWLINE:\n \n \n \n \n \n check_equal=1\n \n elif type ==INDENT:\n check_equal=0\n thisguy=Whitespace(token)\n if not indents[-1].less(thisguy):\n witness=indents[-1].not_less_witness(thisguy)\n msg=\"indent not greater e.g. \"+format_witnesses(witness)\n raise NannyNag(start[0],msg,line)\n indents.append(thisguy)\n \n elif type ==DEDENT:\n \n \n \n \n \n \n \n \n \n check_equal=1\n \n del indents[-1]\n \n elif check_equal and type not in JUNK:\n \n \n \n \n \n \n check_equal=0\n thisguy=Whitespace(line)\n if not indents[-1].equal(thisguy):\n witness=indents[-1].not_equal_witness(thisguy)\n msg=\"indent not equal e.g. \"+format_witnesses(witness)\n raise NannyNag(start[0],msg,line)\n \n \nif __name__ =='__main__':\n main()\n", ["getopt", "os", "sys", "tokenize"]], "tarfile": [".py", "#!/usr/bin/env python3\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n''\n\n\nversion=\"0.9.0\"\n__author__=\"Lars Gust\\u00e4bel (lars@gustaebel.de)\"\n__credits__=\"Gustavo Niemeyer, Niels Gust\\u00e4bel, Richard Townsend.\"\n\n\n\n\nfrom builtins import open as bltn_open\nimport sys\nimport os\nimport io\nimport shutil\nimport stat\nimport time\nimport struct\nimport copy\nimport re\nimport warnings\n\ntry:\n import pwd\nexcept ImportError:\n pwd=None\ntry:\n import grp\nexcept ImportError:\n grp=None\n \n \n \n \nsymlink_exception=(AttributeError,NotImplementedError,OSError)\n\n\n__all__=[\"TarFile\",\"TarInfo\",\"is_tarfile\",\"TarError\",\"ReadError\",\n\"CompressionError\",\"StreamError\",\"ExtractError\",\"HeaderError\",\n\"ENCODING\",\"USTAR_FORMAT\",\"GNU_FORMAT\",\"PAX_FORMAT\",\n\"DEFAULT_FORMAT\",\"open\",\"fully_trusted_filter\",\"data_filter\",\n\"tar_filter\",\"FilterError\",\"AbsoluteLinkError\",\n\"OutsideDestinationError\",\"SpecialFileError\",\"AbsolutePathError\",\n\"LinkOutsideDestinationError\"]\n\n\n\n\n\nNUL=b\"\\0\"\nBLOCKSIZE=512\nRECORDSIZE=BLOCKSIZE *20\nGNU_MAGIC=b\"ustar \\0\"\nPOSIX_MAGIC=b\"ustar\\x0000\"\n\nLENGTH_NAME=100\nLENGTH_LINK=100\nLENGTH_PREFIX=155\n\nREGTYPE=b\"0\"\nAREGTYPE=b\"\\0\"\nLNKTYPE=b\"1\"\nSYMTYPE=b\"2\"\nCHRTYPE=b\"3\"\nBLKTYPE=b\"4\"\nDIRTYPE=b\"5\"\nFIFOTYPE=b\"6\"\nCONTTYPE=b\"7\"\n\nGNUTYPE_LONGNAME=b\"L\"\nGNUTYPE_LONGLINK=b\"K\"\nGNUTYPE_SPARSE=b\"S\"\n\nXHDTYPE=b\"x\"\nXGLTYPE=b\"g\"\nSOLARIS_XHDTYPE=b\"X\"\n\nUSTAR_FORMAT=0\nGNU_FORMAT=1\nPAX_FORMAT=2\nDEFAULT_FORMAT=PAX_FORMAT\n\n\n\n\n\nSUPPORTED_TYPES=(REGTYPE,AREGTYPE,LNKTYPE,\nSYMTYPE,DIRTYPE,FIFOTYPE,\nCONTTYPE,CHRTYPE,BLKTYPE,\nGNUTYPE_LONGNAME,GNUTYPE_LONGLINK,\nGNUTYPE_SPARSE)\n\n\nREGULAR_TYPES=(REGTYPE,AREGTYPE,\nCONTTYPE,GNUTYPE_SPARSE)\n\n\nGNU_TYPES=(GNUTYPE_LONGNAME,GNUTYPE_LONGLINK,\nGNUTYPE_SPARSE)\n\n\nPAX_FIELDS=(\"path\",\"linkpath\",\"size\",\"mtime\",\n\"uid\",\"gid\",\"uname\",\"gname\")\n\n\nPAX_NAME_FIELDS={\"path\",\"linkpath\",\"uname\",\"gname\"}\n\n\n\nPAX_NUMBER_FIELDS={\n\"atime\":float,\n\"ctime\":float,\n\"mtime\":float,\n\"uid\":int,\n\"gid\":int,\n\"size\":int\n}\n\n\n\n\nif os.name ==\"nt\":\n ENCODING=\"utf-8\"\nelse:\n ENCODING=sys.getfilesystemencoding()\n \n \n \n \n \ndef stn(s,length,encoding,errors):\n ''\n \n if s is None:\n raise ValueError(\"metadata cannot contain None\")\n s=s.encode(encoding,errors)\n return s[:length]+(length -len(s))*NUL\n \ndef nts(s,encoding,errors):\n ''\n \n p=s.find(b\"\\0\")\n if p !=-1:\n s=s[:p]\n return s.decode(encoding,errors)\n \ndef nti(s):\n ''\n \n \n \n if s[0]in(0o200,0o377):\n n=0\n for i in range(len(s)-1):\n n <<=8\n n +=s[i+1]\n if s[0]==0o377:\n n=-(256 **(len(s)-1)-n)\n else:\n try:\n s=nts(s,\"ascii\",\"strict\")\n n=int(s.strip()or \"0\",8)\n except ValueError:\n raise InvalidHeaderError(\"invalid header\")\n return n\n \ndef itn(n,digits=8,format=DEFAULT_FORMAT):\n ''\n \n \n \n \n \n \n \n \n \n original_n=n\n n=int(n)\n if 0 <=n <8 **(digits -1):\n s=bytes(\"%0*o\"%(digits -1,n),\"ascii\")+NUL\n elif format ==GNU_FORMAT and -256 **(digits -1)<=n <256 **(digits -1):\n if n >=0:\n s=bytearray([0o200])\n else:\n s=bytearray([0o377])\n n=256 **digits+n\n \n for i in range(digits -1):\n s.insert(1,n&0o377)\n n >>=8\n else:\n raise ValueError(\"overflow in number field\")\n \n return s\n \ndef calc_chksums(buf):\n ''\n\n\n\n\n\n\n \n unsigned_chksum=256+sum(struct.unpack_from(\"148B8x356B\",buf))\n signed_chksum=256+sum(struct.unpack_from(\"148b8x356b\",buf))\n return unsigned_chksum,signed_chksum\n \ndef copyfileobj(src,dst,length=None,exception=OSError,bufsize=None):\n ''\n\n \n bufsize=bufsize or 16 *1024\n if length ==0:\n return\n if length is None:\n shutil.copyfileobj(src,dst,bufsize)\n return\n \n blocks,remainder=divmod(length,bufsize)\n for b in range(blocks):\n buf=src.read(bufsize)\n if len(buf)self.bufsize:\n self.fileobj.write(self.buf[:self.bufsize])\n self.buf=self.buf[self.bufsize:]\n \n def close(self):\n ''\n\n \n if self.closed:\n return\n \n self.closed=True\n try:\n if self.mode ==\"w\"and self.comptype !=\"tar\":\n self.buf +=self.cmp.flush()\n \n if self.mode ==\"w\"and self.buf:\n self.fileobj.write(self.buf)\n self.buf=b\"\"\n if self.comptype ==\"gz\":\n self.fileobj.write(struct.pack(\"=0:\n blocks,remainder=divmod(pos -self.pos,self.bufsize)\n for i in range(blocks):\n self.read(self.bufsize)\n self.read(remainder)\n else:\n raise StreamError(\"seeking backwards is not allowed\")\n return self.pos\n \n def read(self,size):\n ''\n assert size is not None\n buf=self._read(size)\n self.pos +=len(buf)\n return buf\n \n def _read(self,size):\n ''\n \n if self.comptype ==\"tar\":\n return self.__read(size)\n \n c=len(self.dbuf)\n t=[self.dbuf]\n while c lastpos:\n self.map.append((False,lastpos,offset,None))\n self.map.append((True,offset,offset+size,realpos))\n realpos +=size\n lastpos=offset+size\n if lastpos 0:\n while True:\n data,start,stop,offset=self.map[self.map_index]\n if start <=self.position \"%(self.__class__.__name__,self.name,id(self))\n \n def replace(self,*,\n name=_KEEP,mtime=_KEEP,mode=_KEEP,linkname=_KEEP,\n uid=_KEEP,gid=_KEEP,uname=_KEEP,gname=_KEEP,\n deep=True,_KEEP=_KEEP):\n ''\n \n if deep:\n result=copy.deepcopy(self)\n else:\n result=copy.copy(self)\n if name is not _KEEP:\n result.name=name\n if mtime is not _KEEP:\n result.mtime=mtime\n if mode is not _KEEP:\n result.mode=mode\n if linkname is not _KEEP:\n result.linkname=linkname\n if uid is not _KEEP:\n result.uid=uid\n if gid is not _KEEP:\n result.gid=gid\n if uname is not _KEEP:\n result.uname=uname\n if gname is not _KEEP:\n result.gname=gname\n return result\n \n def get_info(self):\n ''\n \n if self.mode is None:\n mode=None\n else:\n mode=self.mode&0o7777\n info={\n \"name\":self.name,\n \"mode\":mode,\n \"uid\":self.uid,\n \"gid\":self.gid,\n \"size\":self.size,\n \"mtime\":self.mtime,\n \"chksum\":self.chksum,\n \"type\":self.type,\n \"linkname\":self.linkname,\n \"uname\":self.uname,\n \"gname\":self.gname,\n \"devmajor\":self.devmajor,\n \"devminor\":self.devminor\n }\n \n if info[\"type\"]==DIRTYPE and not info[\"name\"].endswith(\"/\"):\n info[\"name\"]+=\"/\"\n \n return info\n \n def tobuf(self,format=DEFAULT_FORMAT,encoding=ENCODING,errors=\"surrogateescape\"):\n ''\n \n info=self.get_info()\n for name,value in info.items():\n if value is None:\n raise ValueError(\"%s may not be None\"%name)\n \n if format ==USTAR_FORMAT:\n return self.create_ustar_header(info,encoding,errors)\n elif format ==GNU_FORMAT:\n return self.create_gnu_header(info,encoding,errors)\n elif format ==PAX_FORMAT:\n return self.create_pax_header(info,encoding)\n else:\n raise ValueError(\"invalid format\")\n \n def create_ustar_header(self,info,encoding,errors):\n ''\n \n info[\"magic\"]=POSIX_MAGIC\n \n if len(info[\"linkname\"].encode(encoding,errors))>LENGTH_LINK:\n raise ValueError(\"linkname is too long\")\n \n if len(info[\"name\"].encode(encoding,errors))>LENGTH_NAME:\n info[\"prefix\"],info[\"name\"]=self._posix_split_name(info[\"name\"],encoding,errors)\n \n return self._create_header(info,USTAR_FORMAT,encoding,errors)\n \n def create_gnu_header(self,info,encoding,errors):\n ''\n \n info[\"magic\"]=GNU_MAGIC\n \n buf=b\"\"\n if len(info[\"linkname\"].encode(encoding,errors))>LENGTH_LINK:\n buf +=self._create_gnu_long_header(info[\"linkname\"],GNUTYPE_LONGLINK,encoding,errors)\n \n if len(info[\"name\"].encode(encoding,errors))>LENGTH_NAME:\n buf +=self._create_gnu_long_header(info[\"name\"],GNUTYPE_LONGNAME,encoding,errors)\n \n return buf+self._create_header(info,GNU_FORMAT,encoding,errors)\n \n def create_pax_header(self,info,encoding):\n ''\n\n\n \n info[\"magic\"]=POSIX_MAGIC\n pax_headers=self.pax_headers.copy()\n \n \n \n for name,hname,length in(\n (\"name\",\"path\",LENGTH_NAME),(\"linkname\",\"linkpath\",LENGTH_LINK),\n (\"uname\",\"uname\",32),(\"gname\",\"gname\",32)):\n \n if hname in pax_headers:\n \n continue\n \n \n try:\n info[name].encode(\"ascii\",\"strict\")\n except UnicodeEncodeError:\n pax_headers[hname]=info[name]\n continue\n \n if len(info[name])>length:\n pax_headers[hname]=info[name]\n \n \n \n for name,digits in((\"uid\",8),(\"gid\",8),(\"size\",12),(\"mtime\",12)):\n needs_pax=False\n \n val=info[name]\n val_is_float=isinstance(val,float)\n val_int=round(val)if val_is_float else val\n if not 0 <=val_int <8 **(digits -1):\n \n info[name]=0\n needs_pax=True\n elif val_is_float:\n \n \n info[name]=val_int\n needs_pax=True\n \n \n if needs_pax and name not in pax_headers:\n pax_headers[name]=str(val)\n \n \n if pax_headers:\n buf=self._create_pax_generic_header(pax_headers,XHDTYPE,encoding)\n else:\n buf=b\"\"\n \n return buf+self._create_header(info,USTAR_FORMAT,\"ascii\",\"replace\")\n \n @classmethod\n def create_pax_global_header(cls,pax_headers):\n ''\n \n return cls._create_pax_generic_header(pax_headers,XGLTYPE,\"utf-8\")\n \n def _posix_split_name(self,name,encoding,errors):\n ''\n\n \n components=name.split(\"/\")\n for i in range(1,len(components)):\n prefix=\"/\".join(components[:i])\n name=\"/\".join(components[i:])\n if len(prefix.encode(encoding,errors))<=LENGTH_PREFIX and\\\n len(name.encode(encoding,errors))<=LENGTH_NAME:\n break\n else:\n raise ValueError(\"name is too long\")\n \n return prefix,name\n \n @staticmethod\n def _create_header(info,format,encoding,errors):\n ''\n\n \n has_device_fields=info.get(\"type\")in(CHRTYPE,BLKTYPE)\n if has_device_fields:\n devmajor=itn(info.get(\"devmajor\",0),8,format)\n devminor=itn(info.get(\"devminor\",0),8,format)\n else:\n devmajor=stn(\"\",8,encoding,errors)\n devminor=stn(\"\",8,encoding,errors)\n \n \n \n filetype=info.get(\"type\",REGTYPE)\n if filetype is None:\n raise ValueError(\"TarInfo.type must not be None\")\n \n parts=[\n stn(info.get(\"name\",\"\"),100,encoding,errors),\n itn(info.get(\"mode\",0)&0o7777,8,format),\n itn(info.get(\"uid\",0),8,format),\n itn(info.get(\"gid\",0),8,format),\n itn(info.get(\"size\",0),12,format),\n itn(info.get(\"mtime\",0),12,format),\n b\" \",\n filetype,\n stn(info.get(\"linkname\",\"\"),100,encoding,errors),\n info.get(\"magic\",POSIX_MAGIC),\n stn(info.get(\"uname\",\"\"),32,encoding,errors),\n stn(info.get(\"gname\",\"\"),32,encoding,errors),\n devmajor,\n devminor,\n stn(info.get(\"prefix\",\"\"),155,encoding,errors)\n ]\n \n buf=struct.pack(\"%ds\"%BLOCKSIZE,b\"\".join(parts))\n chksum=calc_chksums(buf[-BLOCKSIZE:])[0]\n buf=buf[:-364]+bytes(\"%06o\\0\"%chksum,\"ascii\")+buf[-357:]\n return buf\n \n @staticmethod\n def _create_payload(payload):\n ''\n\n \n blocks,remainder=divmod(len(payload),BLOCKSIZE)\n if remainder >0:\n payload +=(BLOCKSIZE -remainder)*NUL\n return payload\n \n @classmethod\n def _create_gnu_long_header(cls,name,type,encoding,errors):\n ''\n\n \n name=name.encode(encoding,errors)+NUL\n \n info={}\n info[\"name\"]=\"././@LongLink\"\n info[\"type\"]=type\n info[\"size\"]=len(name)\n info[\"magic\"]=GNU_MAGIC\n \n \n return cls._create_header(info,USTAR_FORMAT,encoding,errors)+\\\n cls._create_payload(name)\n \n @classmethod\n def _create_pax_generic_header(cls,pax_headers,type,encoding):\n ''\n\n\n \n \n \n binary=False\n for keyword,value in pax_headers.items():\n try:\n value.encode(\"utf-8\",\"strict\")\n except UnicodeEncodeError:\n binary=True\n break\n \n records=b\"\"\n if binary:\n \n records +=b\"21 hdrcharset=BINARY\\n\"\n \n for keyword,value in pax_headers.items():\n keyword=keyword.encode(\"utf-8\")\n if binary:\n \n \n value=value.encode(encoding,\"surrogateescape\")\n else:\n value=value.encode(\"utf-8\")\n \n l=len(keyword)+len(value)+3\n n=p=0\n while True:\n n=l+len(str(p))\n if n ==p:\n break\n p=n\n records +=bytes(str(p),\"ascii\")+b\" \"+keyword+b\"=\"+value+b\"\\n\"\n \n \n \n info={}\n info[\"name\"]=\"././@PaxHeader\"\n info[\"type\"]=type\n info[\"size\"]=len(records)\n info[\"magic\"]=POSIX_MAGIC\n \n \n return cls._create_header(info,USTAR_FORMAT,\"ascii\",\"replace\")+\\\n cls._create_payload(records)\n \n @classmethod\n def frombuf(cls,buf,encoding,errors):\n ''\n \n if len(buf)==0:\n raise EmptyHeaderError(\"empty header\")\n if len(buf)!=BLOCKSIZE:\n raise TruncatedHeaderError(\"truncated header\")\n if buf.count(NUL)==BLOCKSIZE:\n raise EOFHeaderError(\"end of file header\")\n \n chksum=nti(buf[148:156])\n if chksum not in calc_chksums(buf):\n raise InvalidHeaderError(\"bad checksum\")\n \n obj=cls()\n obj.name=nts(buf[0:100],encoding,errors)\n obj.mode=nti(buf[100:108])\n obj.uid=nti(buf[108:116])\n obj.gid=nti(buf[116:124])\n obj.size=nti(buf[124:136])\n obj.mtime=nti(buf[136:148])\n obj.chksum=chksum\n obj.type=buf[156:157]\n obj.linkname=nts(buf[157:257],encoding,errors)\n obj.uname=nts(buf[265:297],encoding,errors)\n obj.gname=nts(buf[297:329],encoding,errors)\n obj.devmajor=nti(buf[329:337])\n obj.devminor=nti(buf[337:345])\n prefix=nts(buf[345:500],encoding,errors)\n \n \n \n if obj.type ==AREGTYPE and obj.name.endswith(\"/\"):\n obj.type=DIRTYPE\n \n \n \n \n if obj.type ==GNUTYPE_SPARSE:\n pos=386\n structs=[]\n for i in range(4):\n try:\n offset=nti(buf[pos:pos+12])\n numbytes=nti(buf[pos+12:pos+24])\n except ValueError:\n break\n structs.append((offset,numbytes))\n pos +=24\n isextended=bool(buf[482])\n origsize=nti(buf[483:495])\n obj._sparse_structs=(structs,isextended,origsize)\n \n \n if obj.isdir():\n obj.name=obj.name.rstrip(\"/\")\n \n \n if prefix and obj.type not in GNU_TYPES:\n obj.name=prefix+\"/\"+obj.name\n return obj\n \n @classmethod\n def fromtarfile(cls,tarfile):\n ''\n\n \n buf=tarfile.fileobj.read(BLOCKSIZE)\n obj=cls.frombuf(buf,tarfile.encoding,tarfile.errors)\n obj.offset=tarfile.fileobj.tell()-BLOCKSIZE\n return obj._proc_member(tarfile)\n \n \n \n \n \n \n \n \n \n \n \n \n def _proc_member(self,tarfile):\n ''\n\n \n if self.type in(GNUTYPE_LONGNAME,GNUTYPE_LONGLINK):\n return self._proc_gnulong(tarfile)\n elif self.type ==GNUTYPE_SPARSE:\n return self._proc_sparse(tarfile)\n elif self.type in(XHDTYPE,XGLTYPE,SOLARIS_XHDTYPE):\n return self._proc_pax(tarfile)\n else:\n return self._proc_builtin(tarfile)\n \n def _proc_builtin(self,tarfile):\n ''\n\n \n self.offset_data=tarfile.fileobj.tell()\n offset=self.offset_data\n if self.isreg()or self.type not in SUPPORTED_TYPES:\n \n offset +=self._block(self.size)\n tarfile.offset=offset\n \n \n \n self._apply_pax_info(tarfile.pax_headers,tarfile.encoding,tarfile.errors)\n \n \n \n if self.isdir():\n self.name=self.name.rstrip(\"/\")\n \n return self\n \n def _proc_gnulong(self,tarfile):\n ''\n\n \n buf=tarfile.fileobj.read(self._block(self.size))\n \n \n try:\n next=self.fromtarfile(tarfile)\n except HeaderError as e:\n raise SubsequentHeaderError(str(e))from None\n \n \n \n next.offset=self.offset\n if self.type ==GNUTYPE_LONGNAME:\n next.name=nts(buf,tarfile.encoding,tarfile.errors)\n elif self.type ==GNUTYPE_LONGLINK:\n next.linkname=nts(buf,tarfile.encoding,tarfile.errors)\n \n \n \n if next.isdir():\n next.name=next.name.removesuffix(\"/\")\n \n return next\n \n def _proc_sparse(self,tarfile):\n ''\n \n \n structs,isextended,origsize=self._sparse_structs\n del self._sparse_structs\n \n \n while isextended:\n buf=tarfile.fileobj.read(BLOCKSIZE)\n pos=0\n for i in range(21):\n try:\n offset=nti(buf[pos:pos+12])\n numbytes=nti(buf[pos+12:pos+24])\n except ValueError:\n break\n if offset and numbytes:\n structs.append((offset,numbytes))\n pos +=24\n isextended=bool(buf[504])\n self.sparse=structs\n \n self.offset_data=tarfile.fileobj.tell()\n tarfile.offset=self.offset_data+self._block(self.size)\n self.size=origsize\n return self\n \n def _proc_pax(self,tarfile):\n ''\n\n \n \n buf=tarfile.fileobj.read(self._block(self.size))\n \n \n \n \n if self.type ==XGLTYPE:\n pax_headers=tarfile.pax_headers\n else:\n pax_headers=tarfile.pax_headers.copy()\n \n \n \n \n \n \n match=re.search(br\"\\d+ hdrcharset=([^\\n]+)\\n\",buf)\n if match is not None:\n pax_headers[\"hdrcharset\"]=match.group(1).decode(\"utf-8\")\n \n \n \n \n hdrcharset=pax_headers.get(\"hdrcharset\")\n if hdrcharset ==\"BINARY\":\n encoding=tarfile.encoding\n else:\n encoding=\"utf-8\"\n \n \n \n \n \n regex=re.compile(br\"(\\d+) ([^=]+)=\")\n pos=0\n while match :=regex.match(buf,pos):\n length,keyword=match.groups()\n length=int(length)\n if length ==0:\n raise InvalidHeaderError(\"invalid header\")\n value=buf[match.end(2)+1:match.start(1)+length -1]\n \n \n \n \n \n \n \n \n keyword=self._decode_pax_field(keyword,\"utf-8\",\"utf-8\",\n tarfile.errors)\n if keyword in PAX_NAME_FIELDS:\n value=self._decode_pax_field(value,encoding,tarfile.encoding,\n tarfile.errors)\n else:\n value=self._decode_pax_field(value,\"utf-8\",\"utf-8\",\n tarfile.errors)\n \n pax_headers[keyword]=value\n pos +=length\n \n \n try:\n next=self.fromtarfile(tarfile)\n except HeaderError as e:\n raise SubsequentHeaderError(str(e))from None\n \n \n if \"GNU.sparse.map\"in pax_headers:\n \n self._proc_gnusparse_01(next,pax_headers)\n \n elif \"GNU.sparse.size\"in pax_headers:\n \n self._proc_gnusparse_00(next,pax_headers,buf)\n \n elif pax_headers.get(\"GNU.sparse.major\")==\"1\"and pax_headers.get(\"GNU.sparse.minor\")==\"0\":\n \n self._proc_gnusparse_10(next,pax_headers,tarfile)\n \n if self.type in(XHDTYPE,SOLARIS_XHDTYPE):\n \n next._apply_pax_info(pax_headers,tarfile.encoding,tarfile.errors)\n next.offset=self.offset\n \n if \"size\"in pax_headers:\n \n \n \n offset=next.offset_data\n if next.isreg()or next.type not in SUPPORTED_TYPES:\n offset +=next._block(next.size)\n tarfile.offset=offset\n \n return next\n \n def _proc_gnusparse_00(self,next,pax_headers,buf):\n ''\n \n offsets=[]\n for match in re.finditer(br\"\\d+ GNU.sparse.offset=(\\d+)\\n\",buf):\n offsets.append(int(match.group(1)))\n numbytes=[]\n for match in re.finditer(br\"\\d+ GNU.sparse.numbytes=(\\d+)\\n\",buf):\n numbytes.append(int(match.group(1)))\n next.sparse=list(zip(offsets,numbytes))\n \n def _proc_gnusparse_01(self,next,pax_headers):\n ''\n \n sparse=[int(x)for x in pax_headers[\"GNU.sparse.map\"].split(\",\")]\n next.sparse=list(zip(sparse[::2],sparse[1::2]))\n \n def _proc_gnusparse_10(self,next,pax_headers,tarfile):\n ''\n \n fields=None\n sparse=[]\n buf=tarfile.fileobj.read(BLOCKSIZE)\n fields,buf=buf.split(b\"\\n\",1)\n fields=int(fields)\n while len(sparse)0:\n self.fileobj.write(NUL *(RECORDSIZE -remainder))\n finally:\n if not self._extfileobj:\n self.fileobj.close()\n \n def getmember(self,name):\n ''\n\n\n\n \n tarinfo=self._getmember(name.rstrip('/'))\n if tarinfo is None:\n raise KeyError(\"filename %r not found\"%name)\n return tarinfo\n \n def getmembers(self):\n ''\n\n \n self._check()\n if not self._loaded:\n self._load()\n \n return self.members\n \n def getnames(self):\n ''\n\n \n return[tarinfo.name for tarinfo in self.getmembers()]\n \n def gettarinfo(self,name=None,arcname=None,fileobj=None):\n ''\n\n\n\n\n\n\n \n self._check(\"awx\")\n \n \n \n if fileobj is not None:\n name=fileobj.name\n \n \n \n \n if arcname is None:\n arcname=name\n drv,arcname=os.path.splitdrive(arcname)\n arcname=arcname.replace(os.sep,\"/\")\n arcname=arcname.lstrip(\"/\")\n \n \n \n tarinfo=self.tarinfo()\n tarinfo.tarfile=self\n \n \n if fileobj is None:\n if not self.dereference:\n statres=os.lstat(name)\n else:\n statres=os.stat(name)\n else:\n statres=os.fstat(fileobj.fileno())\n linkname=\"\"\n \n stmd=statres.st_mode\n if stat.S_ISREG(stmd):\n inode=(statres.st_ino,statres.st_dev)\n if not self.dereference and statres.st_nlink >1 and\\\n inode in self.inodes and arcname !=self.inodes[inode]:\n \n \n type=LNKTYPE\n linkname=self.inodes[inode]\n else:\n \n \n type=REGTYPE\n if inode[0]:\n self.inodes[inode]=arcname\n elif stat.S_ISDIR(stmd):\n type=DIRTYPE\n elif stat.S_ISFIFO(stmd):\n type=FIFOTYPE\n elif stat.S_ISLNK(stmd):\n type=SYMTYPE\n linkname=os.readlink(name)\n elif stat.S_ISCHR(stmd):\n type=CHRTYPE\n elif stat.S_ISBLK(stmd):\n type=BLKTYPE\n else:\n return None\n \n \n \n tarinfo.name=arcname\n tarinfo.mode=stmd\n tarinfo.uid=statres.st_uid\n tarinfo.gid=statres.st_gid\n if type ==REGTYPE:\n tarinfo.size=statres.st_size\n else:\n tarinfo.size=0\n tarinfo.mtime=statres.st_mtime\n tarinfo.type=type\n tarinfo.linkname=linkname\n if pwd:\n try:\n tarinfo.uname=pwd.getpwuid(tarinfo.uid)[0]\n except KeyError:\n pass\n if grp:\n try:\n tarinfo.gname=grp.getgrgid(tarinfo.gid)[0]\n except KeyError:\n pass\n \n if type in(CHRTYPE,BLKTYPE):\n if hasattr(os,\"major\")and hasattr(os,\"minor\"):\n tarinfo.devmajor=os.major(statres.st_rdev)\n tarinfo.devminor=os.minor(statres.st_rdev)\n return tarinfo\n \n def list(self,verbose=True,*,members=None):\n ''\n\n\n\n \n self._check()\n \n if members is None:\n members=self\n for tarinfo in members:\n if verbose:\n if tarinfo.mode is None:\n _safe_print(\"??????????\")\n else:\n _safe_print(stat.filemode(tarinfo.mode))\n _safe_print(\"%s/%s\"%(tarinfo.uname or tarinfo.uid,\n tarinfo.gname or tarinfo.gid))\n if tarinfo.ischr()or tarinfo.isblk():\n _safe_print(\"%10s\"%\n (\"%d,%d\"%(tarinfo.devmajor,tarinfo.devminor)))\n else:\n _safe_print(\"%10d\"%tarinfo.size)\n if tarinfo.mtime is None:\n _safe_print(\"????-??-?? ??:??:??\")\n else:\n _safe_print(\"%d-%02d-%02d %02d:%02d:%02d\"\\\n %time.localtime(tarinfo.mtime)[:6])\n \n _safe_print(tarinfo.name+(\"/\"if tarinfo.isdir()else \"\"))\n \n if verbose:\n if tarinfo.issym():\n _safe_print(\"-> \"+tarinfo.linkname)\n if tarinfo.islnk():\n _safe_print(\"link to \"+tarinfo.linkname)\n print()\n \n def add(self,name,arcname=None,recursive=True,*,filter=None):\n ''\n\n\n\n\n\n\n\n \n self._check(\"awx\")\n \n if arcname is None:\n arcname=name\n \n \n if self.name is not None and os.path.abspath(name)==self.name:\n self._dbg(2,\"tarfile: Skipped %r\"%name)\n return\n \n self._dbg(1,name)\n \n \n tarinfo=self.gettarinfo(name,arcname)\n \n if tarinfo is None:\n self._dbg(1,\"tarfile: Unsupported type %r\"%name)\n return\n \n \n if filter is not None:\n tarinfo=filter(tarinfo)\n if tarinfo is None:\n self._dbg(2,\"tarfile: Excluded %r\"%name)\n return\n \n \n if tarinfo.isreg():\n with bltn_open(name,\"rb\")as f:\n self.addfile(tarinfo,f)\n \n elif tarinfo.isdir():\n self.addfile(tarinfo)\n if recursive:\n for f in sorted(os.listdir(name)):\n self.add(os.path.join(name,f),os.path.join(arcname,f),\n recursive,filter=filter)\n \n else:\n self.addfile(tarinfo)\n \n def addfile(self,tarinfo,fileobj=None):\n ''\n\n\n\n \n self._check(\"awx\")\n \n tarinfo=copy.copy(tarinfo)\n \n buf=tarinfo.tobuf(self.format,self.encoding,self.errors)\n self.fileobj.write(buf)\n self.offset +=len(buf)\n bufsize=self.copybufsize\n \n if fileobj is not None:\n copyfileobj(fileobj,self.fileobj,tarinfo.size,bufsize=bufsize)\n blocks,remainder=divmod(tarinfo.size,BLOCKSIZE)\n if remainder >0:\n self.fileobj.write(NUL *(BLOCKSIZE -remainder))\n blocks +=1\n self.offset +=blocks *BLOCKSIZE\n \n self.members.append(tarinfo)\n \n def _get_filter_function(self,filter):\n if filter is None:\n filter=self.extraction_filter\n if filter is None:\n warnings.warn(\n 'Python 3.14 will, by default, filter extracted tar '\n +'archives and reject files or modify their metadata. '\n +'Use the filter argument to control this behavior.',\n DeprecationWarning)\n return fully_trusted_filter\n if isinstance(filter,str):\n raise TypeError(\n 'String names are not supported for '\n +'TarFile.extraction_filter. Use a function such as '\n +'tarfile.data_filter directly.')\n return filter\n if callable(filter):\n return filter\n try:\n return _NAMED_FILTERS[filter]\n except KeyError:\n raise ValueError(f\"filter {filter !r} not found\")from None\n \n def extractall(self,path=\".\",members=None,*,numeric_owner=False,\n filter=None):\n ''\n\n\n\n\n\n\n\n\n\n\n \n directories=[]\n \n filter_function=self._get_filter_function(filter)\n if members is None:\n members=self\n \n for member in members:\n tarinfo=self._get_extract_tarinfo(member,filter_function,path)\n if tarinfo is None:\n continue\n if tarinfo.isdir():\n \n \n \n directories.append(tarinfo)\n self._extract_one(tarinfo,path,set_attrs=not tarinfo.isdir(),\n numeric_owner=numeric_owner)\n \n \n directories.sort(key=lambda a:a.name,reverse=True)\n \n \n for tarinfo in directories:\n dirpath=os.path.join(path,tarinfo.name)\n try:\n self.chown(tarinfo,dirpath,numeric_owner=numeric_owner)\n self.utime(tarinfo,dirpath)\n self.chmod(tarinfo,dirpath)\n except ExtractError as e:\n self._handle_nonfatal_error(e)\n \n def extract(self,member,path=\"\",set_attrs=True,*,numeric_owner=False,\n filter=None):\n ''\n\n\n\n\n\n\n\n\n\n\n \n filter_function=self._get_filter_function(filter)\n tarinfo=self._get_extract_tarinfo(member,filter_function,path)\n if tarinfo is not None:\n self._extract_one(tarinfo,path,set_attrs,numeric_owner)\n \n def _get_extract_tarinfo(self,member,filter_function,path):\n ''\n if isinstance(member,str):\n tarinfo=self.getmember(member)\n else:\n tarinfo=member\n \n unfiltered=tarinfo\n try:\n tarinfo=filter_function(tarinfo,path)\n except(OSError,FilterError)as e:\n self._handle_fatal_error(e)\n except ExtractError as e:\n self._handle_nonfatal_error(e)\n if tarinfo is None:\n self._dbg(2,\"tarfile: Excluded %r\"%unfiltered.name)\n return None\n \n if tarinfo.islnk():\n tarinfo=copy.copy(tarinfo)\n tarinfo._link_target=os.path.join(path,tarinfo.linkname)\n return tarinfo\n \n def _extract_one(self,tarinfo,path,set_attrs,numeric_owner):\n ''\n self._check(\"r\")\n \n try:\n self._extract_member(tarinfo,os.path.join(path,tarinfo.name),\n set_attrs=set_attrs,\n numeric_owner=numeric_owner)\n except OSError as e:\n self._handle_fatal_error(e)\n except ExtractError as e:\n self._handle_nonfatal_error(e)\n \n def _handle_nonfatal_error(self,e):\n ''\n if self.errorlevel >1:\n raise\n else:\n self._dbg(1,\"tarfile: %s\"%e)\n \n def _handle_fatal_error(self,e):\n ''\n if self.errorlevel >0:\n raise\n elif isinstance(e,OSError):\n if e.filename is None:\n self._dbg(1,\"tarfile: %s\"%e.strerror)\n else:\n self._dbg(1,\"tarfile: %s %r\"%(e.strerror,e.filename))\n else:\n self._dbg(1,\"tarfile: %s %s\"%(type(e).__name__,e))\n \n def extractfile(self,member):\n ''\n\n\n\n\n \n self._check(\"r\")\n \n if isinstance(member,str):\n tarinfo=self.getmember(member)\n else:\n tarinfo=member\n \n if tarinfo.isreg()or tarinfo.type not in SUPPORTED_TYPES:\n \n return self.fileobject(self,tarinfo)\n \n elif tarinfo.islnk()or tarinfo.issym():\n if isinstance(self.fileobj,_Stream):\n \n \n \n raise StreamError(\"cannot extract (sym)link as file object\")\n else:\n \n return self.extractfile(self._find_link_target(tarinfo))\n else:\n \n \n return None\n \n def _extract_member(self,tarinfo,targetpath,set_attrs=True,\n numeric_owner=False):\n ''\n\n \n \n \n \n targetpath=targetpath.rstrip(\"/\")\n targetpath=targetpath.replace(\"/\",os.sep)\n \n \n upperdirs=os.path.dirname(targetpath)\n if upperdirs and not os.path.exists(upperdirs):\n \n \n os.makedirs(upperdirs)\n \n if tarinfo.islnk()or tarinfo.issym():\n self._dbg(1,\"%s -> %s\"%(tarinfo.name,tarinfo.linkname))\n else:\n self._dbg(1,tarinfo.name)\n \n if tarinfo.isreg():\n self.makefile(tarinfo,targetpath)\n elif tarinfo.isdir():\n self.makedir(tarinfo,targetpath)\n elif tarinfo.isfifo():\n self.makefifo(tarinfo,targetpath)\n elif tarinfo.ischr()or tarinfo.isblk():\n self.makedev(tarinfo,targetpath)\n elif tarinfo.islnk()or tarinfo.issym():\n self.makelink(tarinfo,targetpath)\n elif tarinfo.type not in SUPPORTED_TYPES:\n self.makeunknown(tarinfo,targetpath)\n else:\n self.makefile(tarinfo,targetpath)\n \n if set_attrs:\n self.chown(tarinfo,targetpath,numeric_owner)\n if not tarinfo.issym():\n self.chmod(tarinfo,targetpath)\n self.utime(tarinfo,targetpath)\n \n \n \n \n \n \n def makedir(self,tarinfo,targetpath):\n ''\n \n try:\n if tarinfo.mode is None:\n \n os.mkdir(targetpath)\n else:\n \n \n os.mkdir(targetpath,0o700)\n except FileExistsError:\n pass\n \n def makefile(self,tarinfo,targetpath):\n ''\n \n source=self.fileobj\n source.seek(tarinfo.offset_data)\n bufsize=self.copybufsize\n with bltn_open(targetpath,\"wb\")as target:\n if tarinfo.sparse is not None:\n for offset,size in tarinfo.sparse:\n target.seek(offset)\n copyfileobj(source,target,size,ReadError,bufsize)\n target.seek(tarinfo.size)\n target.truncate()\n else:\n copyfileobj(source,target,tarinfo.size,ReadError,bufsize)\n \n def makeunknown(self,tarinfo,targetpath):\n ''\n\n \n self.makefile(tarinfo,targetpath)\n self._dbg(1,\"tarfile: Unknown file type %r, \"\\\n \"extracted as regular file.\"%tarinfo.type)\n \n def makefifo(self,tarinfo,targetpath):\n ''\n \n if hasattr(os,\"mkfifo\"):\n os.mkfifo(targetpath)\n else:\n raise ExtractError(\"fifo not supported by system\")\n \n def makedev(self,tarinfo,targetpath):\n ''\n \n if not hasattr(os,\"mknod\")or not hasattr(os,\"makedev\"):\n raise ExtractError(\"special devices not supported by system\")\n \n mode=tarinfo.mode\n if mode is None:\n \n mode=0o600\n if tarinfo.isblk():\n mode |=stat.S_IFBLK\n else:\n mode |=stat.S_IFCHR\n \n os.mknod(targetpath,mode,\n os.makedev(tarinfo.devmajor,tarinfo.devminor))\n \n def makelink(self,tarinfo,targetpath):\n ''\n\n\n \n try:\n \n if tarinfo.issym():\n if os.path.lexists(targetpath):\n \n os.unlink(targetpath)\n os.symlink(tarinfo.linkname,targetpath)\n else:\n if os.path.exists(tarinfo._link_target):\n os.link(tarinfo._link_target,targetpath)\n else:\n self._extract_member(self._find_link_target(tarinfo),\n targetpath)\n except symlink_exception:\n try:\n self._extract_member(self._find_link_target(tarinfo),\n targetpath)\n except KeyError:\n raise ExtractError(\"unable to resolve link inside archive\")from None\n \n def chown(self,tarinfo,targetpath,numeric_owner):\n ''\n\n\n\n \n if hasattr(os,\"geteuid\")and os.geteuid()==0:\n \n g=tarinfo.gid\n u=tarinfo.uid\n if not numeric_owner:\n try:\n if grp and tarinfo.gname:\n g=grp.getgrnam(tarinfo.gname)[2]\n except KeyError:\n pass\n try:\n if pwd and tarinfo.uname:\n u=pwd.getpwnam(tarinfo.uname)[2]\n except KeyError:\n pass\n if g is None:\n g=-1\n if u is None:\n u=-1\n try:\n if tarinfo.issym()and hasattr(os,\"lchown\"):\n os.lchown(targetpath,u,g)\n else:\n os.chown(targetpath,u,g)\n except OSError as e:\n raise ExtractError(\"could not change owner\")from e\n \n def chmod(self,tarinfo,targetpath):\n ''\n \n if tarinfo.mode is None:\n return\n try:\n os.chmod(targetpath,tarinfo.mode)\n except OSError as e:\n raise ExtractError(\"could not change mode\")from e\n \n def utime(self,tarinfo,targetpath):\n ''\n \n mtime=tarinfo.mtime\n if mtime is None:\n return\n if not hasattr(os,'utime'):\n return\n try:\n os.utime(targetpath,(mtime,mtime))\n except OSError as e:\n raise ExtractError(\"could not change modification time\")from e\n \n \n def next(self):\n ''\n\n\n \n self._check(\"ra\")\n if self.firstmember is not None:\n m=self.firstmember\n self.firstmember=None\n return m\n \n \n if self.offset !=self.fileobj.tell():\n if self.offset ==0:\n return None\n self.fileobj.seek(self.offset -1)\n if not self.fileobj.read(1):\n raise ReadError(\"unexpected end of data\")\n \n \n tarinfo=None\n while True:\n try:\n tarinfo=self.tarinfo.fromtarfile(self)\n except EOFHeaderError as e:\n if self.ignore_zeros:\n self._dbg(2,\"0x%X: %s\"%(self.offset,e))\n self.offset +=BLOCKSIZE\n continue\n except InvalidHeaderError as e:\n if self.ignore_zeros:\n self._dbg(2,\"0x%X: %s\"%(self.offset,e))\n self.offset +=BLOCKSIZE\n continue\n elif self.offset ==0:\n raise ReadError(str(e))from None\n except EmptyHeaderError:\n if self.offset ==0:\n raise ReadError(\"empty file\")from None\n except TruncatedHeaderError as e:\n if self.offset ==0:\n raise ReadError(str(e))from None\n except SubsequentHeaderError as e:\n raise ReadError(str(e))from None\n except Exception as e:\n try:\n import zlib\n if isinstance(e,zlib.error):\n raise ReadError(f'zlib error: {e}')from None\n else:\n raise e\n except ImportError:\n raise e\n break\n \n if tarinfo is not None:\n self.members.append(tarinfo)\n else:\n self._loaded=True\n \n return tarinfo\n \n \n \n \n def _getmember(self,name,tarinfo=None,normalize=False):\n ''\n\n \n \n members=self.getmembers()\n \n \n skipping=False\n if tarinfo is not None:\n try:\n index=members.index(tarinfo)\n except ValueError:\n \n \n skipping=True\n else:\n \n members=members[:index]\n \n if normalize:\n name=os.path.normpath(name)\n \n for member in reversed(members):\n if skipping:\n if tarinfo.offset ==member.offset:\n skipping=False\n continue\n if normalize:\n member_name=os.path.normpath(member.name)\n else:\n member_name=member.name\n \n if name ==member_name:\n return member\n \n if skipping:\n \n raise ValueError(tarinfo)\n \n def _load(self):\n ''\n\n \n while self.next()is not None:\n pass\n self._loaded=True\n \n def _check(self,mode=None):\n ''\n\n \n if self.closed:\n raise OSError(\"%s is closed\"%self.__class__.__name__)\n if mode is not None and self.mode not in mode:\n raise OSError(\"bad operation for mode %r\"%self.mode)\n \n def _find_link_target(self,tarinfo):\n ''\n\n \n if tarinfo.issym():\n \n linkname=\"/\".join(filter(None,(os.path.dirname(tarinfo.name),tarinfo.linkname)))\n limit=None\n else:\n \n \n linkname=tarinfo.linkname\n limit=tarinfo\n \n member=self._getmember(linkname,tarinfo=limit,normalize=True)\n if member is None:\n raise KeyError(\"linkname %r not found\"%linkname)\n return member\n \n def __iter__(self):\n ''\n \n if self._loaded:\n yield from self.members\n return\n \n \n \n index=0\n \n \n \n if self.firstmember is not None:\n tarinfo=self.next()\n index +=1\n yield tarinfo\n \n while True:\n if index ',''),\n help='Extract tarfile into target dir')\n group.add_argument('-c','--create',nargs='+',\n metavar=('',''),\n help='Create tarfile from sources')\n group.add_argument('-t','--test',metavar='',\n help='Test if a tarfile is valid')\n \n args=parser.parse_args()\n \n if args.filter and args.extract is None:\n parser.exit(1,'--filter is only valid for extraction\\n')\n \n if args.test is not None:\n src=args.test\n if is_tarfile(src):\n with open(src,'r')as tar:\n tar.getmembers()\n print(tar.getmembers(),file=sys.stderr)\n if args.verbose:\n print('{!r} is a tar archive.'.format(src))\n else:\n parser.exit(1,'{!r} is not a tar archive.\\n'.format(src))\n \n elif args.list is not None:\n src=args.list\n if is_tarfile(src):\n with TarFile.open(src,'r:*')as tf:\n tf.list(verbose=args.verbose)\n else:\n parser.exit(1,'{!r} is not a tar archive.\\n'.format(src))\n \n elif args.extract is not None:\n if len(args.extract)==1:\n src=args.extract[0]\n curdir=os.curdir\n elif len(args.extract)==2:\n src,curdir=args.extract\n else:\n parser.exit(1,parser.format_help())\n \n if is_tarfile(src):\n with TarFile.open(src,'r:*')as tf:\n tf.extractall(path=curdir,filter=args.filter)\n if args.verbose:\n if curdir =='.':\n msg='{!r} file is extracted.'.format(src)\n else:\n msg=('{!r} file is extracted '\n 'into {!r} directory.').format(src,curdir)\n print(msg)\n else:\n parser.exit(1,'{!r} is not a tar archive.\\n'.format(src))\n \n elif args.create is not None:\n tar_name=args.create.pop(0)\n _,ext=os.path.splitext(tar_name)\n compressions={\n \n '.gz':'gz',\n '.tgz':'gz',\n \n '.xz':'xz',\n '.txz':'xz',\n \n '.bz2':'bz2',\n '.tbz':'bz2',\n '.tbz2':'bz2',\n '.tb2':'bz2',\n }\n tar_mode='w:'+compressions[ext]if ext in compressions else 'w'\n tar_files=args.create\n \n with TarFile.open(tar_name,tar_mode)as tf:\n for file_name in tar_files:\n tf.add(file_name)\n \n if args.verbose:\n print('{!r} file created.'.format(tar_name))\n \nif __name__ =='__main__':\n main()\n", ["argparse", "builtins", "bz2", "copy", "grp", "gzip", "io", "lzma", "os", "pwd", "re", "shutil", "stat", "struct", "sys", "time", "warnings", "zlib"]], "tb": [".py", "import sys\nfrom browser import console\n\nclass Trace:\n\n def __init__(self):\n self.lines=[]\n \n def write(self,*data):\n self.lines.append(\" \".join([str(x)for x in data]))\n \n def format(self):\n return '\\n'.join(self.lines)+'\\n'\n \ndef format_exc():\n trace=Trace()\n exc_class,exc,tb=sys.exc_info()\n exc_msg=str(exc)\n \n def handle_repeats(filename,lineno,count_repeats):\n if count_repeats >0:\n trace_lines=trace.lines[:]\n for _ in range(2):\n if not filename.startswith('<'):\n trace.write(trace_lines[-2])\n trace.write(trace_lines[-1])\n else:\n trace.write(trace_lines[-1])\n count_repeats -=1\n if count_repeats ==0:\n break\n if count_repeats:\n trace.write(f'[Previous line repeated {count_repeats} '+\n f'more time{\"s\"if count_repeats >1 else \"\"}]')\n \n def show_line():\n trace.write(f' File \"{filename}\", line {lineno}, in {name}')\n if not filename.startswith(\"<\"):\n src=open(filename,encoding='utf-8').read()\n lines=src.split('\\n')\n line=lines[tb.tb_lineno -1]\n trace.write(f\" {line.strip()}\")\n \n show=True\n started=False\n save_filename=None\n save_lineno=None\n save_scope=None\n same_line=False\n count_repeats=0\n \n while tb is not None:\n if show:\n trace.write(\"Traceback (most recent call last):\")\n show=False\n frame=tb.tb_frame\n code=frame.f_code\n lineno=frame.f_lineno\n name=code.co_name\n filename=code.co_filename\n if filename ==save_filename and lineno ==save_lineno\\\n and name ==save_name:\n count_repeats +=1\n tb=tb.tb_next\n continue\n handle_repeats(save_filename,save_lineno,count_repeats)\n save_filename=filename\n save_lineno=lineno\n save_name=name\n count_repeats=0\n show_line()\n tb=tb.tb_next\n \n handle_repeats(filename,lineno,count_repeats)\n \n if isinstance(exc,SyntaxError):\n trace.write(syntax_error(exc.args))\n else:\n message=exc_msg\n if isinstance(exc,AttributeError):\n suggestion=__BRYTHON__.offer_suggestions_for_attribute_error(exc)\n if suggestion is not None:\n message +=f\". Did you mean: '{suggestion}'?\"\n elif isinstance(exc,NameError):\n suggestion=__BRYTHON__.offer_suggestions_for_name_error(exc)\n if suggestion is not None:\n message +=f\". Did you mean: '{suggestion}'?\"\n elif exc.name in __BRYTHON__.stdlib_module_names:\n message +=f\". Did you forget to import '{exc.name}'?\"\n trace.write(f\"{exc_class.__name__}: {message}\")\n \n return trace.format()\n \ndef print_exc(file=None):\n if file is None:\n file=sys.stderr\n file.write(format_exc())\n \ndef syntax_error(args):\n trace=Trace()\n info,[filename,lineno,offset,line,*extra]=args\n trace.write(f' File \"{filename}\", line {lineno}')\n indent=len(line)-len(line.lstrip())\n trace.write(\" \"+line.strip())\n nb_marks=1\n if extra:\n end_lineno,end_offset=extra\n if end_lineno >lineno:\n nb_marks=len(line)-offset\n else:\n nb_marks=end_offset -offset\n nb_marks=max(nb_marks,1)\n trace.write(\" \"+(offset -1)*\" \"+\"^\"*nb_marks)\n trace.write(\"SyntaxError:\",info)\n return trace.format()\n", ["browser", "sys"]], "tempfile": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\n\"NamedTemporaryFile\",\"TemporaryFile\",\n\"SpooledTemporaryFile\",\"TemporaryDirectory\",\n\"mkstemp\",\"mkdtemp\",\n\"mktemp\",\n\"TMP_MAX\",\"gettempprefix\",\n\"tempdir\",\"gettempdir\",\n\"gettempprefixb\",\"gettempdirb\",\n]\n\n\n\n\nimport functools as _functools\nimport warnings as _warnings\nimport io as _io\nimport os as _os\nimport shutil as _shutil\nimport errno as _errno\nfrom random import Random as _Random\nimport sys as _sys\nimport types as _types\nimport weakref as _weakref\nimport _thread\n_allocate_lock=_thread.allocate_lock\n\n_text_openflags=_os.O_RDWR |_os.O_CREAT |_os.O_EXCL\nif hasattr(_os,'O_NOFOLLOW'):\n _text_openflags |=_os.O_NOFOLLOW\n \n_bin_openflags=_text_openflags\nif hasattr(_os,'O_BINARY'):\n _bin_openflags |=_os.O_BINARY\n \nif hasattr(_os,'TMP_MAX'):\n TMP_MAX=_os.TMP_MAX\nelse:\n TMP_MAX=10000\n \n \n \n \n \ntemplate=\"tmp\"\n\n\n\n_once_lock=_allocate_lock()\n\n\ndef _exists(fn):\n try:\n _os.lstat(fn)\n except OSError:\n return False\n else:\n return True\n \n \ndef _infer_return_type(*args):\n ''\n return_type=None\n for arg in args:\n if arg is None:\n continue\n \n if isinstance(arg,_os.PathLike):\n arg=_os.fspath(arg)\n \n if isinstance(arg,bytes):\n if return_type is str:\n raise TypeError(\"Can't mix bytes and non-bytes in \"\n \"path components.\")\n return_type=bytes\n else:\n if return_type is bytes:\n raise TypeError(\"Can't mix bytes and non-bytes in \"\n \"path components.\")\n return_type=str\n if return_type is None:\n if tempdir is None or isinstance(tempdir,str):\n return str\n else:\n \n return bytes\n return return_type\n \n \ndef _sanitize_params(prefix,suffix,dir):\n ''\n output_type=_infer_return_type(prefix,suffix,dir)\n if suffix is None:\n suffix=output_type()\n if prefix is None:\n if output_type is str:\n prefix=template\n else:\n prefix=_os.fsencode(template)\n if dir is None:\n if output_type is str:\n dir=gettempdir()\n else:\n dir=gettempdirb()\n return prefix,suffix,dir,output_type\n \n \nclass _RandomNameSequence:\n ''\n\n\n\n\n \n \n characters=\"abcdefghijklmnopqrstuvwxyz0123456789_\"\n \n @property\n def rng(self):\n cur_pid=_os.getpid()\n if cur_pid !=getattr(self,'_rng_pid',None):\n self._rng=_Random()\n self._rng_pid=cur_pid\n return self._rng\n \n def __iter__(self):\n return self\n \n def __next__(self):\n return ''.join(self.rng.choices(self.characters,k=8))\n \ndef _candidate_tempdir_list():\n ''\n \n \n dirlist=[]\n \n \n for envname in 'TMPDIR','TEMP','TMP':\n dirname=_os.getenv(envname)\n if dirname:dirlist.append(dirname)\n \n \n if _os.name =='nt':\n dirlist.extend([_os.path.expanduser(r'~\\AppData\\Local\\Temp'),\n _os.path.expandvars(r'%SYSTEMROOT%\\Temp'),\n r'c:\\temp',r'c:\\tmp',r'\\temp',r'\\tmp'])\n else:\n dirlist.extend(['/tmp','/var/tmp','/usr/tmp'])\n \n \n try:\n dirlist.append(_os.getcwd())\n except(AttributeError,OSError):\n dirlist.append(_os.curdir)\n \n return dirlist\n \ndef _get_default_tempdir():\n ''\n\n\n\n\n\n \n \n namer=_RandomNameSequence()\n dirlist=_candidate_tempdir_list()\n \n for dir in dirlist:\n if dir !=_os.curdir:\n dir=_os.path.abspath(dir)\n \n for seq in range(100):\n name=next(namer)\n filename=_os.path.join(dir,name)\n try:\n fd=_os.open(filename,_bin_openflags,0o600)\n try:\n try:\n _os.write(fd,b'blat')\n finally:\n _os.close(fd)\n finally:\n _os.unlink(filename)\n return dir\n except FileExistsError:\n pass\n except PermissionError:\n \n \n if(_os.name =='nt'and _os.path.isdir(dir)and\n _os.access(dir,_os.W_OK)):\n continue\n break\n except OSError:\n break\n raise FileNotFoundError(_errno.ENOENT,\n \"No usable temporary directory found in %s\"%\n dirlist)\n \n_name_sequence=None\n\ndef _get_candidate_names():\n ''\n \n global _name_sequence\n if _name_sequence is None:\n _once_lock.acquire()\n try:\n if _name_sequence is None:\n _name_sequence=_RandomNameSequence()\n finally:\n _once_lock.release()\n return _name_sequence\n \n \ndef _mkstemp_inner(dir,pre,suf,flags,output_type):\n ''\n \n dir=_os.path.abspath(dir)\n names=_get_candidate_names()\n if output_type is bytes:\n names=map(_os.fsencode,names)\n \n for seq in range(TMP_MAX):\n name=next(names)\n file=_os.path.join(dir,pre+name+suf)\n _sys.audit(\"tempfile.mkstemp\",file)\n try:\n fd=_os.open(file,flags,0o600)\n except FileExistsError:\n continue\n except PermissionError:\n \n \n if(_os.name =='nt'and _os.path.isdir(dir)and\n _os.access(dir,_os.W_OK)):\n continue\n else:\n raise\n return fd,file\n \n raise FileExistsError(_errno.EEXIST,\n \"No usable temporary file name found\")\n \n \n \n \ndef gettempprefix():\n ''\n return _os.fsdecode(template)\n \ndef gettempprefixb():\n ''\n return _os.fsencode(template)\n \ntempdir=None\n\ndef _gettempdir():\n ''\n global tempdir\n if tempdir is None:\n _once_lock.acquire()\n try:\n if tempdir is None:\n tempdir=_get_default_tempdir()\n finally:\n _once_lock.release()\n return tempdir\n \ndef gettempdir():\n ''\n return _os.fsdecode(_gettempdir())\n \ndef gettempdirb():\n ''\n return _os.fsencode(_gettempdir())\n \ndef mkstemp(suffix=None,prefix=None,dir=None,text=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n prefix,suffix,dir,output_type=_sanitize_params(prefix,suffix,dir)\n \n if text:\n flags=_text_openflags\n else:\n flags=_bin_openflags\n \n return _mkstemp_inner(dir,prefix,suffix,flags,output_type)\n \n \ndef mkdtemp(suffix=None,prefix=None,dir=None):\n ''\n\n\n\n\n\n\n\n\n\n \n \n prefix,suffix,dir,output_type=_sanitize_params(prefix,suffix,dir)\n \n names=_get_candidate_names()\n if output_type is bytes:\n names=map(_os.fsencode,names)\n \n for seq in range(TMP_MAX):\n name=next(names)\n file=_os.path.join(dir,prefix+name+suffix)\n _sys.audit(\"tempfile.mkdtemp\",file)\n try:\n _os.mkdir(file,0o700)\n except FileExistsError:\n continue\n except PermissionError:\n \n \n if(_os.name =='nt'and _os.path.isdir(dir)and\n _os.access(dir,_os.W_OK)):\n continue\n else:\n raise\n return _os.path.abspath(file)\n \n raise FileExistsError(_errno.EEXIST,\n \"No usable temporary directory name found\")\n \ndef mktemp(suffix=\"\",prefix=template,dir=None):\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n if dir is None:\n dir=gettempdir()\n \n names=_get_candidate_names()\n for seq in range(TMP_MAX):\n name=next(names)\n file=_os.path.join(dir,prefix+name+suffix)\n if not _exists(file):\n return file\n \n raise FileExistsError(_errno.EEXIST,\n \"No usable temporary filename found\")\n \n \nclass _TemporaryFileCloser:\n ''\n\n \n \n cleanup_called=False\n close_called=False\n \n def __init__(self,file,name,delete=True,delete_on_close=True):\n self.file=file\n self.name=name\n self.delete=delete\n self.delete_on_close=delete_on_close\n \n def cleanup(self,windows=(_os.name =='nt'),unlink=_os.unlink):\n if not self.cleanup_called:\n self.cleanup_called=True\n try:\n if not self.close_called:\n self.close_called=True\n self.file.close()\n finally:\n \n \n if self.delete and not(windows and self.delete_on_close):\n try:\n unlink(self.name)\n except FileNotFoundError:\n pass\n \n def close(self):\n if not self.close_called:\n self.close_called=True\n try:\n self.file.close()\n finally:\n if self.delete and self.delete_on_close:\n self.cleanup()\n \n def __del__(self):\n self.cleanup()\n \n \nclass _TemporaryFileWrapper:\n ''\n\n\n\n\n \n \n def __init__(self,file,name,delete=True,delete_on_close=True):\n self.file=file\n self.name=name\n self._closer=_TemporaryFileCloser(file,name,delete,\n delete_on_close)\n \n def __getattr__(self,name):\n \n \n \n file=self.__dict__['file']\n a=getattr(file,name)\n if hasattr(a,'__call__'):\n func=a\n @_functools.wraps(func)\n def func_wrapper(*args,**kwargs):\n return func(*args,**kwargs)\n \n \n func_wrapper._closer=self._closer\n a=func_wrapper\n if not isinstance(a,int):\n setattr(self,name,a)\n return a\n \n \n \n def __enter__(self):\n self.file.__enter__()\n return self\n \n \n \n def __exit__(self,exc,value,tb):\n result=self.file.__exit__(exc,value,tb)\n self._closer.cleanup()\n return result\n \n def close(self):\n ''\n\n \n self._closer.close()\n \n \n def __iter__(self):\n \n \n \n \n \n for line in self.file:\n yield line\n \ndef NamedTemporaryFile(mode='w+b',buffering=-1,encoding=None,\nnewline=None,suffix=None,prefix=None,\ndir=None,delete=True,*,errors=None,\ndelete_on_close=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n prefix,suffix,dir,output_type=_sanitize_params(prefix,suffix,dir)\n \n flags=_bin_openflags\n \n \n \n if _os.name =='nt'and delete and delete_on_close:\n flags |=_os.O_TEMPORARY\n \n if \"b\"not in mode:\n encoding=_io.text_encoding(encoding)\n \n name=None\n def opener(*args):\n nonlocal name\n fd,name=_mkstemp_inner(dir,prefix,suffix,flags,output_type)\n return fd\n try:\n file=_io.open(dir,mode,buffering=buffering,\n newline=newline,encoding=encoding,errors=errors,\n opener=opener)\n try:\n raw=getattr(file,'buffer',file)\n raw=getattr(raw,'raw',raw)\n raw.name=name\n return _TemporaryFileWrapper(file,name,delete,delete_on_close)\n except:\n file.close()\n raise\n except:\n if name is not None and not(\n _os.name =='nt'and delete and delete_on_close):\n _os.unlink(name)\n raise\n \nif _os.name !='posix'or _sys.platform =='cygwin':\n\n\n TemporaryFile=NamedTemporaryFile\n \nelse:\n\n\n\n _O_TMPFILE_WORKS=hasattr(_os,'O_TMPFILE')\n \n def TemporaryFile(mode='w+b',buffering=-1,encoding=None,\n newline=None,suffix=None,prefix=None,\n dir=None,*,errors=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n global _O_TMPFILE_WORKS\n \n if \"b\"not in mode:\n encoding=_io.text_encoding(encoding)\n \n prefix,suffix,dir,output_type=_sanitize_params(prefix,suffix,dir)\n \n flags=_bin_openflags\n if _O_TMPFILE_WORKS:\n fd=None\n def opener(*args):\n nonlocal fd\n flags2=(flags |_os.O_TMPFILE)&~_os.O_CREAT\n fd=_os.open(dir,flags2,0o600)\n return fd\n try:\n file=_io.open(dir,mode,buffering=buffering,\n newline=newline,encoding=encoding,\n errors=errors,opener=opener)\n raw=getattr(file,'buffer',file)\n raw=getattr(raw,'raw',raw)\n raw.name=fd\n return file\n except IsADirectoryError:\n \n \n \n \n \n _O_TMPFILE_WORKS=False\n except OSError:\n \n \n \n \n \n \n \n pass\n \n \n fd=None\n def opener(*args):\n nonlocal fd\n fd,name=_mkstemp_inner(dir,prefix,suffix,flags,output_type)\n try:\n _os.unlink(name)\n except BaseException as e:\n _os.close(fd)\n raise\n return fd\n file=_io.open(dir,mode,buffering=buffering,\n newline=newline,encoding=encoding,errors=errors,\n opener=opener)\n raw=getattr(file,'buffer',file)\n raw=getattr(raw,'raw',raw)\n raw.name=fd\n return file\n \nclass SpooledTemporaryFile(_io.IOBase):\n ''\n\n\n \n _rolled=False\n \n def __init__(self,max_size=0,mode='w+b',buffering=-1,\n encoding=None,newline=None,\n suffix=None,prefix=None,dir=None,*,errors=None):\n if 'b'in mode:\n self._file=_io.BytesIO()\n else:\n encoding=_io.text_encoding(encoding)\n self._file=_io.TextIOWrapper(_io.BytesIO(),\n encoding=encoding,errors=errors,\n newline=newline)\n self._max_size=max_size\n self._rolled=False\n self._TemporaryFileArgs={'mode':mode,'buffering':buffering,\n 'suffix':suffix,'prefix':prefix,\n 'encoding':encoding,'newline':newline,\n 'dir':dir,'errors':errors}\n \n __class_getitem__=classmethod(_types.GenericAlias)\n \n def _check(self,file):\n if self._rolled:return\n max_size=self._max_size\n if max_size and file.tell()>max_size:\n self.rollover()\n \n def rollover(self):\n if self._rolled:return\n file=self._file\n newfile=self._file=TemporaryFile(**self._TemporaryFileArgs)\n del self._TemporaryFileArgs\n \n pos=file.tell()\n if hasattr(newfile,'buffer'):\n newfile.buffer.write(file.detach().getvalue())\n else:\n newfile.write(file.getvalue())\n newfile.seek(pos,0)\n \n self._rolled=True\n \n \n \n \n \n \n \n def __enter__(self):\n if self._file.closed:\n raise ValueError(\"Cannot enter context with closed file\")\n return self\n \n def __exit__(self,exc,value,tb):\n self._file.close()\n \n \n def __iter__(self):\n return self._file.__iter__()\n \n def __del__(self):\n if not self.closed:\n _warnings.warn(\n \"Unclosed file {!r}\".format(self),\n ResourceWarning,\n stacklevel=2,\n source=self\n )\n self.close()\n \n def close(self):\n self._file.close()\n \n @property\n def closed(self):\n return self._file.closed\n \n @property\n def encoding(self):\n return self._file.encoding\n \n @property\n def errors(self):\n return self._file.errors\n \n def fileno(self):\n self.rollover()\n return self._file.fileno()\n \n def flush(self):\n self._file.flush()\n \n def isatty(self):\n return self._file.isatty()\n \n @property\n def mode(self):\n try:\n return self._file.mode\n except AttributeError:\n return self._TemporaryFileArgs['mode']\n \n @property\n def name(self):\n try:\n return self._file.name\n except AttributeError:\n return None\n \n @property\n def newlines(self):\n return self._file.newlines\n \n def readable(self):\n return self._file.readable()\n \n def read(self,*args):\n return self._file.read(*args)\n \n def read1(self,*args):\n return self._file.read1(*args)\n \n def readinto(self,b):\n return self._file.readinto(b)\n \n def readinto1(self,b):\n return self._file.readinto1(b)\n \n def readline(self,*args):\n return self._file.readline(*args)\n \n def readlines(self,*args):\n return self._file.readlines(*args)\n \n def seekable(self):\n return self._file.seekable()\n \n def seek(self,*args):\n return self._file.seek(*args)\n \n def tell(self):\n return self._file.tell()\n \n def truncate(self,size=None):\n if size is None:\n return self._file.truncate()\n else:\n if size >self._max_size:\n self.rollover()\n return self._file.truncate(size)\n \n def writable(self):\n return self._file.writable()\n \n def write(self,s):\n file=self._file\n rv=file.write(s)\n self._check(file)\n return rv\n \n def writelines(self,iterable):\n file=self._file\n rv=file.writelines(iterable)\n self._check(file)\n return rv\n \n def detach(self):\n return self._file.detach()\n \n \nclass TemporaryDirectory:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,suffix=None,prefix=None,dir=None,\n ignore_cleanup_errors=False,*,delete=True):\n self.name=mkdtemp(suffix,prefix,dir)\n self._ignore_cleanup_errors=ignore_cleanup_errors\n self._delete=delete\n self._finalizer=_weakref.finalize(\n self,self._cleanup,self.name,\n warn_message=\"Implicitly cleaning up {!r}\".format(self),\n ignore_errors=self._ignore_cleanup_errors,delete=self._delete)\n \n @classmethod\n def _rmtree(cls,name,ignore_errors=False):\n def onexc(func,path,exc):\n if isinstance(exc,PermissionError):\n def resetperms(path):\n try:\n _os.chflags(path,0)\n except AttributeError:\n pass\n _os.chmod(path,0o700)\n \n try:\n if path !=name:\n resetperms(_os.path.dirname(path))\n resetperms(path)\n \n try:\n _os.unlink(path)\n \n except(IsADirectoryError,PermissionError):\n cls._rmtree(path,ignore_errors=ignore_errors)\n except FileNotFoundError:\n pass\n elif isinstance(exc,FileNotFoundError):\n pass\n else:\n if not ignore_errors:\n raise\n \n _shutil.rmtree(name,onexc=onexc)\n \n @classmethod\n def _cleanup(cls,name,warn_message,ignore_errors=False,delete=True):\n if delete:\n cls._rmtree(name,ignore_errors=ignore_errors)\n _warnings.warn(warn_message,ResourceWarning)\n \n def __repr__(self):\n return \"<{} {!r}>\".format(self.__class__.__name__,self.name)\n \n def __enter__(self):\n return self.name\n \n def __exit__(self,exc,value,tb):\n if self._delete:\n self.cleanup()\n \n def cleanup(self):\n if self._finalizer.detach()or _os.path.exists(self.name):\n self._rmtree(self.name,ignore_errors=self._ignore_cleanup_errors)\n \n __class_getitem__=classmethod(_types.GenericAlias)\n", ["_thread", "errno", "functools", "io", "os", "random", "shutil", "sys", "types", "warnings", "weakref"]], "textwrap": [".py", "''\n\n\n\n\n\n\nimport re\n\n__all__=['TextWrapper','wrap','fill','dedent','indent','shorten']\n\n\n\n\n_whitespace='\\t\\n\\x0b\\x0c\\r '\n\nclass TextWrapper:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n unicode_whitespace_trans=dict.fromkeys(map(ord,_whitespace),ord(' '))\n \n \n \n \n \n \n \n word_punct=r'[\\w!\"\\'&.,?]'\n letter=r'[^\\d\\W]'\n whitespace=r'[%s]'%re.escape(_whitespace)\n nowhitespace='[^'+whitespace[1:]\n wordsep_re=re.compile(r'''\n ( # any whitespace\n %(ws)s+\n | # em-dash between words\n (?<=%(wp)s) -{2,} (?=\\w)\n | # word, possibly hyphenated\n %(nws)s+? (?:\n # hyphenated word\n -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))\n (?= %(lt)s -? %(lt)s)\n | # end of word\n (?=%(ws)s|\\Z)\n | # em-dash\n (?<=%(wp)s) (?=-{2,}\\w)\n )\n )'''%{'wp':word_punct,'lt':letter,\n 'ws':whitespace,'nws':nowhitespace},\n re.VERBOSE)\n del word_punct,letter,nowhitespace\n \n \n \n \n \n wordsep_simple_re=re.compile(r'(%s+)'%whitespace)\n del whitespace\n \n \n \n sentence_end_re=re.compile(r'[a-z]'\n r'[\\.\\!\\?]'\n r'[\\\"\\']?'\n r'\\Z')\n \n def __init__(self,\n width=70,\n initial_indent=\"\",\n subsequent_indent=\"\",\n expand_tabs=True ,\n replace_whitespace=True ,\n fix_sentence_endings=False ,\n break_long_words=True ,\n drop_whitespace=True ,\n break_on_hyphens=True ,\n tabsize=8,\n *,\n max_lines=None ,\n placeholder=' [...]'):\n self.width=width\n self.initial_indent=initial_indent\n self.subsequent_indent=subsequent_indent\n self.expand_tabs=expand_tabs\n self.replace_whitespace=replace_whitespace\n self.fix_sentence_endings=fix_sentence_endings\n self.break_long_words=break_long_words\n self.drop_whitespace=drop_whitespace\n self.break_on_hyphens=break_on_hyphens\n self.tabsize=tabsize\n self.max_lines=max_lines\n self.placeholder=placeholder\n \n \n \n \n \n def _munge_whitespace(self,text):\n ''\n\n\n\n\n \n if self.expand_tabs:\n text=text.expandtabs(self.tabsize)\n if self.replace_whitespace:\n text=text.translate(self.unicode_whitespace_trans)\n return text\n \n \n def _split(self,text):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self.break_on_hyphens is True :\n chunks=self.wordsep_re.split(text)\n else :\n chunks=self.wordsep_simple_re.split(text)\n chunks=[c for c in chunks if c]\n return chunks\n \n def _fix_sentence_endings(self,chunks):\n ''\n\n\n\n\n\n\n \n i=0\n patsearch=self.sentence_end_re.search\n while i space_left:\n \n \n hyphen=chunk.rfind('-',0,space_left)\n if hyphen >0 and any(c !='-'for c in chunk[:hyphen]):\n end=hyphen+1\n cur_line.append(chunk[:end])\n reversed_chunks[-1]=chunk[end:]\n \n \n \n \n elif not cur_line:\n cur_line.append(reversed_chunks.pop())\n \n \n \n \n \n \n \n def _wrap_chunks(self,chunks):\n ''\n\n\n\n\n\n\n\n\n\n\n \n lines=[]\n if self.width <=0:\n raise ValueError(\"invalid width %r (must be > 0)\"%self.width)\n if self.max_lines is not None :\n if self.max_lines >1:\n indent=self.subsequent_indent\n else :\n indent=self.initial_indent\n if len(indent)+len(self.placeholder.lstrip())>self.width:\n raise ValueError(\"placeholder too large for max width\")\n \n \n \n chunks.reverse()\n \n while chunks:\n \n \n \n cur_line=[]\n cur_len=0\n \n \n if lines:\n indent=self.subsequent_indent\n else :\n indent=self.initial_indent\n \n \n width=self.width -len(indent)\n \n \n \n if self.drop_whitespace and chunks[-1].strip()==''and lines:\n del chunks[-1]\n \n while chunks:\n l=len(chunks[-1])\n \n \n if cur_len+l <=width:\n cur_line.append(chunks.pop())\n cur_len +=l\n \n \n else :\n break\n \n \n \n if chunks and len(chunks[-1])>width:\n self._handle_long_word(chunks,cur_line,cur_len,width)\n cur_len=sum(map(len,cur_line))\n \n \n if self.drop_whitespace and cur_line and cur_line[-1].strip()=='':\n cur_len -=len(cur_line[-1])\n del cur_line[-1]\n \n if cur_line:\n if (self.max_lines is None or\n len(lines)+1 \"%(\n \"locked\"if self._block.locked()else \"unlocked\",\n self.__class__.__module__,\n self.__class__.__qualname__,\n owner,\n self._count,\n hex(id(self))\n )\n \n def _at_fork_reinit(self):\n self._block._at_fork_reinit()\n self._owner=None\n self._count=0\n \n def acquire(self,blocking=True,timeout=-1):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n me=get_ident()\n if self._owner ==me:\n self._count +=1\n return 1\n rc=self._block.acquire(blocking,timeout)\n if rc:\n self._owner=me\n self._count=1\n return rc\n \n __enter__=acquire\n \n def release(self):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self._owner !=get_ident():\n raise RuntimeError(\"cannot release un-acquired lock\")\n self._count=count=self._count -1\n if not count:\n self._owner=None\n self._block.release()\n \n def __exit__(self,t,v,tb):\n self.release()\n \n \n \n def _acquire_restore(self,state):\n self._block.acquire()\n self._count,self._owner=state\n \n def _release_save(self):\n if self._count ==0:\n raise RuntimeError(\"cannot release un-acquired lock\")\n count=self._count\n self._count=0\n owner=self._owner\n self._owner=None\n self._block.release()\n return(count,owner)\n \n def _is_owned(self):\n return self._owner ==get_ident()\n \n_PyRLock=_RLock\n\n\nclass Condition:\n ''\n\n\n\n\n\n\n\n\n \n \n def __init__(self,lock=None):\n if lock is None:\n lock=RLock()\n self._lock=lock\n \n self.acquire=lock.acquire\n self.release=lock.release\n \n \n \n if hasattr(lock,'_release_save'):\n self._release_save=lock._release_save\n if hasattr(lock,'_acquire_restore'):\n self._acquire_restore=lock._acquire_restore\n if hasattr(lock,'_is_owned'):\n self._is_owned=lock._is_owned\n self._waiters=_deque()\n \n def _at_fork_reinit(self):\n self._lock._at_fork_reinit()\n self._waiters.clear()\n \n def __enter__(self):\n return self._lock.__enter__()\n \n def __exit__(self,*args):\n return self._lock.__exit__(*args)\n \n def __repr__(self):\n return \"\"%(self._lock,len(self._waiters))\n \n def _release_save(self):\n self._lock.release()\n \n def _acquire_restore(self,x):\n self._lock.acquire()\n \n def _is_owned(self):\n \n \n if self._lock.acquire(False):\n self._lock.release()\n return False\n else:\n return True\n \n def wait(self,timeout=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not self._is_owned():\n raise RuntimeError(\"cannot wait on un-acquired lock\")\n waiter=_allocate_lock()\n waiter.acquire()\n self._waiters.append(waiter)\n saved_state=self._release_save()\n gotit=False\n try:\n if timeout is None:\n waiter.acquire()\n gotit=True\n else:\n if timeout >0:\n gotit=waiter.acquire(True,timeout)\n else:\n gotit=waiter.acquire(False)\n return gotit\n finally:\n self._acquire_restore(saved_state)\n if not gotit:\n try:\n self._waiters.remove(waiter)\n except ValueError:\n pass\n \n def wait_for(self,predicate,timeout=None):\n ''\n\n\n\n\n\n \n endtime=None\n waittime=timeout\n result=predicate()\n while not result:\n if waittime is not None:\n if endtime is None:\n endtime=_time()+waittime\n else:\n waittime=endtime -_time()\n if waittime <=0:\n break\n self.wait(waittime)\n result=predicate()\n return result\n \n def notify(self,n=1):\n ''\n\n\n\n\n\n\n\n \n if not self._is_owned():\n raise RuntimeError(\"cannot notify on un-acquired lock\")\n waiters=self._waiters\n while waiters and n >0:\n waiter=waiters[0]\n try:\n waiter.release()\n except RuntimeError:\n \n \n \n \n pass\n else:\n n -=1\n try:\n waiters.remove(waiter)\n except ValueError:\n pass\n \n def notify_all(self):\n ''\n\n\n\n\n \n self.notify(len(self._waiters))\n \n def notifyAll(self):\n ''\n\n\n\n \n import warnings\n warnings.warn('notifyAll() is deprecated, use notify_all() instead',\n DeprecationWarning,stacklevel=2)\n self.notify_all()\n \n \nclass Semaphore:\n ''\n\n\n\n\n\n\n \n \n \n \n def __init__(self,value=1):\n if value <0:\n raise ValueError(\"semaphore initial value must be >= 0\")\n self._cond=Condition(Lock())\n self._value=value\n \n def __repr__(self):\n cls=self.__class__\n return(f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}:\"\n f\" value={self._value}>\")\n \n def acquire(self,blocking=True,timeout=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not blocking and timeout is not None:\n raise ValueError(\"can't specify timeout for non-blocking acquire\")\n rc=False\n endtime=None\n with self._cond:\n while self._value ==0:\n if not blocking:\n break\n if timeout is not None:\n if endtime is None:\n endtime=_time()+timeout\n else:\n timeout=endtime -_time()\n if timeout <=0:\n break\n self._cond.wait(timeout)\n else:\n self._value -=1\n rc=True\n return rc\n \n __enter__=acquire\n \n def release(self,n=1):\n ''\n\n\n\n\n \n if n <1:\n raise ValueError('n must be one or more')\n with self._cond:\n self._value +=n\n self._cond.notify(n)\n \n def __exit__(self,t,v,tb):\n self.release()\n \n \nclass BoundedSemaphore(Semaphore):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,value=1):\n super().__init__(value)\n self._initial_value=value\n \n def __repr__(self):\n cls=self.__class__\n return(f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}:\"\n f\" value={self._value}/{self._initial_value}>\")\n \n def release(self,n=1):\n ''\n\n\n\n\n\n\n\n \n if n <1:\n raise ValueError('n must be one or more')\n with self._cond:\n if self._value+n >self._initial_value:\n raise ValueError(\"Semaphore released too many times\")\n self._value +=n\n self._cond.notify(n)\n \n \nclass Event:\n ''\n\n\n\n\n\n \n \n \n \n def __init__(self):\n self._cond=Condition(Lock())\n self._flag=False\n \n def __repr__(self):\n cls=self.__class__\n status='set'if self._flag else 'unset'\n return f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}: {status}>\"\n \n def _at_fork_reinit(self):\n \n self._cond._at_fork_reinit()\n \n def is_set(self):\n ''\n return self._flag\n \n def isSet(self):\n ''\n\n\n\n \n import warnings\n warnings.warn('isSet() is deprecated, use is_set() instead',\n DeprecationWarning,stacklevel=2)\n return self.is_set()\n \n def set(self):\n ''\n\n\n\n\n \n with self._cond:\n self._flag=True\n self._cond.notify_all()\n \n def clear(self):\n ''\n\n\n\n\n \n with self._cond:\n self._flag=False\n \n def wait(self,timeout=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n with self._cond:\n signaled=self._flag\n if not signaled:\n signaled=self._cond.wait(timeout)\n return signaled\n \n \n \n \n \n \n \n \n \n \n \n \n \nclass Barrier:\n ''\n\n\n\n\n\n \n \n def __init__(self,parties,action=None,timeout=None):\n ''\n\n\n\n\n\n\n \n self._cond=Condition(Lock())\n self._action=action\n self._timeout=timeout\n self._parties=parties\n self._state=0\n self._count=0\n \n def __repr__(self):\n cls=self.__class__\n if self.broken:\n return f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}: broken>\"\n return(f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}:\"\n f\" waiters={self.n_waiting}/{self.parties}>\")\n \n def wait(self,timeout=None):\n ''\n\n\n\n\n\n\n \n if timeout is None:\n timeout=self._timeout\n with self._cond:\n self._enter()\n index=self._count\n self._count +=1\n try:\n if index+1 ==self._parties:\n \n self._release()\n else:\n \n self._wait(timeout)\n return index\n finally:\n self._count -=1\n \n self._exit()\n \n \n \n def _enter(self):\n while self._state in(-1,1):\n \n self._cond.wait()\n \n if self._state <0:\n raise BrokenBarrierError\n assert self._state ==0\n \n \n \n def _release(self):\n try:\n if self._action:\n self._action()\n \n self._state=1\n self._cond.notify_all()\n except:\n \n self._break()\n raise\n \n \n \n def _wait(self,timeout):\n if not self._cond.wait_for(lambda:self._state !=0,timeout):\n \n self._break()\n raise BrokenBarrierError\n if self._state <0:\n raise BrokenBarrierError\n assert self._state ==1\n \n \n \n def _exit(self):\n if self._count ==0:\n if self._state in(-1,1):\n \n self._state=0\n self._cond.notify_all()\n \n def reset(self):\n ''\n\n\n\n\n \n with self._cond:\n if self._count >0:\n if self._state ==0:\n \n self._state=-1\n elif self._state ==-2:\n \n \n self._state=-1\n else:\n self._state=0\n self._cond.notify_all()\n \n def abort(self):\n ''\n\n\n\n\n \n with self._cond:\n self._break()\n \n def _break(self):\n \n \n self._state=-2\n self._cond.notify_all()\n \n @property\n def parties(self):\n ''\n return self._parties\n \n @property\n def n_waiting(self):\n ''\n \n \n if self._state ==0:\n return self._count\n return 0\n \n @property\n def broken(self):\n ''\n return self._state ==-2\n \n \nclass BrokenBarrierError(RuntimeError):\n pass\n \n \n \n_counter=_count(1).__next__\ndef _newname(name_template):\n return name_template %_counter()\n \n \n \n \n \n_active_limbo_lock=RLock()\n_active={}\n_limbo={}\n_dangling=WeakSet()\n\n\n\n\n_shutdown_locks_lock=_allocate_lock()\n_shutdown_locks=set()\n\ndef _maintain_shutdown_locks():\n ''\n\n\n\n\n\n\n \n \n to_remove=[lock for lock in _shutdown_locks if not lock.locked()]\n _shutdown_locks.difference_update(to_remove)\n \n \n \n \nclass Thread:\n ''\n\n\n\n\n\n \n \n _initialized=False\n \n def __init__(self,group=None,target=None,name=None,\n args=(),kwargs=None,*,daemon=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n assert group is None,\"group argument must be None for now\"\n if kwargs is None:\n kwargs={}\n if name:\n name=str(name)\n else:\n name=_newname(\"Thread-%d\")\n if target is not None:\n try:\n target_name=target.__name__\n name +=f\" ({target_name})\"\n except AttributeError:\n pass\n \n self._target=target\n self._name=name\n self._args=args\n self._kwargs=kwargs\n if daemon is not None:\n if daemon and not _daemon_threads_allowed():\n raise RuntimeError('daemon threads are disabled in this (sub)interpreter')\n self._daemonic=daemon\n else:\n self._daemonic=current_thread().daemon\n self._ident=None\n if _HAVE_THREAD_NATIVE_ID:\n self._native_id=None\n self._tstate_lock=None\n self._started=Event()\n self._is_stopped=False\n self._initialized=True\n \n self._stderr=_sys.stderr\n self._invoke_excepthook=_make_invoke_excepthook()\n \n _dangling.add(self)\n \n def _reset_internal_locks(self,is_alive):\n \n \n self._started._at_fork_reinit()\n if is_alive:\n \n \n \n if self._tstate_lock is not None:\n self._tstate_lock._at_fork_reinit()\n self._tstate_lock.acquire()\n else:\n \n \n self._is_stopped=True\n self._tstate_lock=None\n \n def __repr__(self):\n assert self._initialized,\"Thread.__init__() was not called\"\n status=\"initial\"\n if self._started.is_set():\n status=\"started\"\n self.is_alive()\n if self._is_stopped:\n status=\"stopped\"\n if self._daemonic:\n status +=\" daemon\"\n if self._ident is not None:\n status +=\" %s\"%self._ident\n return \"<%s(%s, %s)>\"%(self.__class__.__name__,self._name,status)\n \n def start(self):\n ''\n\n\n\n\n\n\n\n \n if not self._initialized:\n raise RuntimeError(\"thread.__init__() not called\")\n \n if self._started.is_set():\n raise RuntimeError(\"threads can only be started once\")\n \n with _active_limbo_lock:\n _limbo[self]=self\n try:\n _start_new_thread(self._bootstrap,())\n except Exception:\n with _active_limbo_lock:\n del _limbo[self]\n raise\n self._started.wait()\n \n def run(self):\n ''\n\n\n\n\n\n\n \n try:\n if self._target is not None:\n self._target(*self._args,**self._kwargs)\n finally:\n \n \n del self._target,self._args,self._kwargs\n \n def _bootstrap(self):\n \n \n \n \n \n \n \n \n \n \n \n \n try:\n self._bootstrap_inner()\n except:\n if self._daemonic and _sys is None:\n return\n raise\n \n def _set_ident(self):\n self._ident=get_ident()\n \n if _HAVE_THREAD_NATIVE_ID:\n def _set_native_id(self):\n self._native_id=get_native_id()\n \n def _set_tstate_lock(self):\n ''\n\n\n \n self._tstate_lock=_set_sentinel()\n self._tstate_lock.acquire()\n \n if not self.daemon:\n with _shutdown_locks_lock:\n _maintain_shutdown_locks()\n _shutdown_locks.add(self._tstate_lock)\n \n def _bootstrap_inner(self):\n try:\n self._set_ident()\n self._set_tstate_lock()\n if _HAVE_THREAD_NATIVE_ID:\n self._set_native_id()\n self._started.set()\n with _active_limbo_lock:\n _active[self._ident]=self\n del _limbo[self]\n \n if _trace_hook:\n _sys.settrace(_trace_hook)\n if _profile_hook:\n _sys.setprofile(_profile_hook)\n \n try:\n self.run()\n except:\n self._invoke_excepthook(self)\n finally:\n self._delete()\n \n def _stop(self):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n lock=self._tstate_lock\n if lock is not None:\n assert not lock.locked()\n self._is_stopped=True\n self._tstate_lock=None\n if not self.daemon:\n with _shutdown_locks_lock:\n \n _maintain_shutdown_locks()\n \n def _delete(self):\n ''\n with _active_limbo_lock:\n del _active[get_ident()]\n \n \n \n \n \n def join(self,timeout=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not self._initialized:\n raise RuntimeError(\"Thread.__init__() not called\")\n if not self._started.is_set():\n raise RuntimeError(\"cannot join thread before it is started\")\n if self is current_thread():\n raise RuntimeError(\"cannot join current thread\")\n \n if timeout is None:\n self._wait_for_tstate_lock()\n else:\n \n \n self._wait_for_tstate_lock(timeout=max(timeout,0))\n \n def _wait_for_tstate_lock(self,block=True,timeout=-1):\n \n \n \n \n \n \n lock=self._tstate_lock\n if lock is None:\n \n assert self._is_stopped\n return\n \n try:\n if lock.acquire(block,timeout):\n lock.release()\n self._stop()\n except:\n if lock.locked():\n \n \n \n \n lock.release()\n self._stop()\n raise\n \n @property\n def name(self):\n ''\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n return self._name\n \n @name.setter\n def name(self,name):\n assert self._initialized,\"Thread.__init__() not called\"\n self._name=str(name)\n \n @property\n def ident(self):\n ''\n\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n return self._ident\n \n if _HAVE_THREAD_NATIVE_ID:\n @property\n def native_id(self):\n ''\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n return self._native_id\n \n def is_alive(self):\n ''\n\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n if self._is_stopped or not self._started.is_set():\n return False\n self._wait_for_tstate_lock(False)\n return not self._is_stopped\n \n @property\n def daemon(self):\n ''\n\n\n\n\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n return self._daemonic\n \n @daemon.setter\n def daemon(self,daemonic):\n if not self._initialized:\n raise RuntimeError(\"Thread.__init__() not called\")\n if daemonic and not _daemon_threads_allowed():\n raise RuntimeError('daemon threads are disabled in this interpreter')\n if self._started.is_set():\n raise RuntimeError(\"cannot set daemon status of active thread\")\n self._daemonic=daemonic\n \n def isDaemon(self):\n ''\n\n\n\n \n import warnings\n warnings.warn('isDaemon() is deprecated, get the daemon attribute instead',\n DeprecationWarning,stacklevel=2)\n return self.daemon\n \n def setDaemon(self,daemonic):\n ''\n\n\n\n \n import warnings\n warnings.warn('setDaemon() is deprecated, set the daemon attribute instead',\n DeprecationWarning,stacklevel=2)\n self.daemon=daemonic\n \n def getName(self):\n ''\n\n\n\n \n import warnings\n warnings.warn('getName() is deprecated, get the name attribute instead',\n DeprecationWarning,stacklevel=2)\n return self.name\n \n def setName(self,name):\n ''\n\n\n\n \n import warnings\n warnings.warn('setName() is deprecated, set the name attribute instead',\n DeprecationWarning,stacklevel=2)\n self.name=name\n \n \ntry:\n from _thread import(_excepthook as excepthook,\n _ExceptHookArgs as ExceptHookArgs)\nexcept ImportError:\n\n from traceback import print_exception as _print_exception\n from collections import namedtuple\n \n _ExceptHookArgs=namedtuple(\n 'ExceptHookArgs',\n 'exc_type exc_value exc_traceback thread')\n \n def ExceptHookArgs(args):\n return _ExceptHookArgs(*args)\n \n def excepthook(args,/):\n ''\n\n \n if args.exc_type ==SystemExit:\n \n return\n \n if _sys is not None and _sys.stderr is not None:\n stderr=_sys.stderr\n elif args.thread is not None:\n stderr=args.thread._stderr\n if stderr is None:\n \n \n return\n else:\n \n return\n \n if args.thread is not None:\n name=args.thread.name\n else:\n name=get_ident()\n print(f\"Exception in thread {name}:\",\n file=stderr,flush=True)\n _print_exception(args.exc_type,args.exc_value,args.exc_traceback,\n file=stderr)\n stderr.flush()\n \n \n \n__excepthook__=excepthook\n\n\ndef _make_invoke_excepthook():\n\n\n\n\n old_excepthook=excepthook\n old_sys_excepthook=_sys.excepthook\n if old_excepthook is None:\n raise RuntimeError(\"threading.excepthook is None\")\n if old_sys_excepthook is None:\n raise RuntimeError(\"sys.excepthook is None\")\n \n sys_exc_info=_sys.exc_info\n local_print=print\n local_sys=_sys\n \n def invoke_excepthook(thread):\n global excepthook\n try:\n hook=excepthook\n if hook is None:\n hook=old_excepthook\n \n args=ExceptHookArgs([*sys_exc_info(),thread])\n \n hook(args)\n except Exception as exc:\n exc.__suppress_context__=True\n del exc\n \n if local_sys is not None and local_sys.stderr is not None:\n stderr=local_sys.stderr\n else:\n stderr=thread._stderr\n \n local_print(\"Exception in threading.excepthook:\",\n file=stderr,flush=True)\n \n if local_sys is not None and local_sys.excepthook is not None:\n sys_excepthook=local_sys.excepthook\n else:\n sys_excepthook=old_sys_excepthook\n \n sys_excepthook(*sys_exc_info())\n finally:\n \n args=None\n \n return invoke_excepthook\n \n \n \n \nclass Timer(Thread):\n ''\n\n\n\n\n\n \n \n def __init__(self,interval,function,args=None,kwargs=None):\n Thread.__init__(self)\n self.interval=interval\n self.function=function\n self.args=args if args is not None else[]\n self.kwargs=kwargs if kwargs is not None else{}\n self.finished=Event()\n \n def cancel(self):\n ''\n self.finished.set()\n \n def run(self):\n self.finished.wait(self.interval)\n if not self.finished.is_set():\n self.function(*self.args,**self.kwargs)\n self.finished.set()\n \n \n \n \nclass _MainThread(Thread):\n\n def __init__(self):\n Thread.__init__(self,name=\"MainThread\",daemon=False)\n self._set_tstate_lock()\n self._started.set()\n self._set_ident()\n if _HAVE_THREAD_NATIVE_ID:\n self._set_native_id()\n with _active_limbo_lock:\n _active[self._ident]=self\n \n \n \n \n \n \n \n \n \n \nclass _DummyThread(Thread):\n\n def __init__(self):\n Thread.__init__(self,name=_newname(\"Dummy-%d\"),\n daemon=_daemon_threads_allowed())\n \n self._started.set()\n self._set_ident()\n if _HAVE_THREAD_NATIVE_ID:\n self._set_native_id()\n with _active_limbo_lock:\n _active[self._ident]=self\n \n def _stop(self):\n pass\n \n def is_alive(self):\n assert not self._is_stopped and self._started.is_set()\n return True\n \n def join(self,timeout=None):\n assert False,\"cannot join a dummy thread\"\n \n \n \n \ndef current_thread():\n ''\n\n\n\n\n \n try:\n return _active[get_ident()]\n except KeyError:\n return _DummyThread()\n \ndef currentThread():\n ''\n\n\n\n \n import warnings\n warnings.warn('currentThread() is deprecated, use current_thread() instead',\n DeprecationWarning,stacklevel=2)\n return current_thread()\n \ndef active_count():\n ''\n\n\n\n\n \n \n \n with _active_limbo_lock:\n return len(_active)+len(_limbo)\n \ndef activeCount():\n ''\n\n\n\n \n import warnings\n warnings.warn('activeCount() is deprecated, use active_count() instead',\n DeprecationWarning,stacklevel=2)\n return active_count()\n \ndef _enumerate():\n\n return list(_active.values())+list(_limbo.values())\n \ndef enumerate():\n ''\n\n\n\n\n\n \n with _active_limbo_lock:\n return list(_active.values())+list(_limbo.values())\n \n \n_threading_atexits=[]\n_SHUTTING_DOWN=False\n\ndef _register_atexit(func,*arg,**kwargs):\n ''\n\n\n\n\n\n\n\n \n if _SHUTTING_DOWN:\n raise RuntimeError(\"can't register atexit after shutdown\")\n \n call=functools.partial(func,*arg,**kwargs)\n _threading_atexits.append(call)\n \n \nfrom _thread import stack_size\n\n\n\n\n\n_main_thread=_MainThread()\n\ndef _shutdown():\n ''\n\n \n \n \n \n \n \n if _main_thread._is_stopped:\n \n return\n \n global _SHUTTING_DOWN\n _SHUTTING_DOWN=True\n \n \n \n for atexit_call in reversed(_threading_atexits):\n atexit_call()\n \n \n if _main_thread.ident ==get_ident():\n tlock=_main_thread._tstate_lock\n \n \n assert tlock is not None\n assert tlock.locked()\n tlock.release()\n _main_thread._stop()\n else:\n \n \n \n \n \n pass\n \n \n while True:\n with _shutdown_locks_lock:\n locks=list(_shutdown_locks)\n _shutdown_locks.clear()\n \n if not locks:\n break\n \n for lock in locks:\n \n lock.acquire()\n lock.release()\n \n \n \n \n \ndef main_thread():\n ''\n\n\n\n \n return _main_thread\n \n \n \n \ntry:\n from _thread import _local as local\nexcept ImportError:\n from _threading_local import local\n \n \ndef _after_fork():\n ''\n\n \n \n \n global _active_limbo_lock,_main_thread\n global _shutdown_locks_lock,_shutdown_locks\n _active_limbo_lock=RLock()\n \n \n new_active={}\n \n try:\n current=_active[get_ident()]\n except KeyError:\n \n \n \n current=_MainThread()\n \n _main_thread=current\n \n \n _shutdown_locks_lock=_allocate_lock()\n _shutdown_locks=set()\n \n with _active_limbo_lock:\n \n \n threads=set(_enumerate())\n threads.update(_dangling)\n for thread in threads:\n \n \n if thread is current:\n \n \n thread._reset_internal_locks(True)\n ident=get_ident()\n thread._ident=ident\n new_active[ident]=thread\n else:\n \n thread._reset_internal_locks(False)\n thread._stop()\n \n _limbo.clear()\n _active.clear()\n _active.update(new_active)\n assert len(_active)==1\n \n \nif hasattr(_os,\"register_at_fork\"):\n _os.register_at_fork(after_in_child=_after_fork)\n", ["_collections", "_thread", "_threading_local", "_weakrefset", "collections", "functools", "itertools", "os", "sys", "time", "traceback", "warnings"]], "time": [".py", "from browser import self as window\nimport _locale\nimport javascript\n\n\ndate=javascript.Date.new\nnow=javascript.Date.now\n\n\n\n\n\n\n\n_STRUCT_TM_ITEMS=9\n\n\n\n\n\ndef _get_day_of_year(arg):\n ''\n\n\n\n\n\n\n\n\n\n \n ml=[31,28,31,30,31,30,31,31,30,31,30,31]\n if arg[0]%4 ==0:\n ml[1]+=1\n i=1\n yday=0\n while i mm >13:\n raise ValueError(\"month out of range\")\n \n dd=t[2]\n if dd ==0:dd=1\n if -1 >dd >32:\n raise ValueError(\"day of month out of range\")\n \n hh=t[3]\n if -1 >hh >24:\n raise ValueError(\"hour out of range\")\n \n minu=t[4]\n if -1 >minu >60:\n raise ValueError(\"minute out of range\")\n \n ss=t[5]\n if -1 >ss >62:\n raise ValueError(\"seconds out of range\")\n \n wd=t[6]%7\n if wd <-2:\n raise ValueError(\"day of week out of range\")\n \n dy=t[7]\n if dy ==0:dy=1\n if -1 >dy >367:\n raise ValueError(\"day of year out of range\")\n \n return t[0],mm,dd,hh,minu,ss,wd,dy,t[-1]\n \n \ndef _is_dst(secs=None ):\n ''\n d=date()\n if secs is not None :\n d=date(secs *1000)\n \n \n \n jan=date(d.getFullYear(),0,1)\n jul=date(d.getFullYear(),6,1)\n dst=int(d.getTimezoneOffset()=0 else 6\n tmp=struct_time([d.getUTCFullYear(),\n d.getUTCMonth()+1,d.getUTCDate(),\n d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),\n wday,0,0])\n tmp.args[7]=_get_day_of_year(tmp.args)\n return tmp\n \ndef localtime(secs=None ):\n d=date()\n if secs is not None :\n d=date(secs *1000)\n dst=_is_dst(secs)\n wday=d.getDay()-1 if d.getDay()-1 >=0 else 6\n tmp=struct_time([d.getFullYear(),\n d.getMonth()+1,d.getDate(),\n d.getHours(),d.getMinutes(),d.getSeconds(),\n wday,0,dst])\n tmp.args[7]=_get_day_of_year(tmp.args)\n return tmp\n \ndef mktime(t):\n if isinstance(t,struct_time):\n d1=date(t.tm_year,t.tm_mon -1,t.tm_mday,\n t.tm_hour,t.tm_min,t.tm_sec,0).getTime()\n elif isinstance(t,tuple):\n d1=date(t[0],t[1]-1,t[2],t[3],t[4],t[5],0).getTime()\n else :\n raise ValueError(\"Tuple or struct_time argument required\")\n d2=date(0).getTime()\n return (d1 -d2)/1000.\n \ndef monotonic():\n return now()/1000.\n \ndef perf_counter():\n return window.performance.now()/1000.\n \ndef process_time():\n return now()/1000.\n \ndef time():\n return float(date().getTime()/1000)\n \ndef sleep(secs):\n ''\n\n \n \n float(secs)\n raise NotImplementedError(\"Blocking functions like time.sleep() are not \"\n \"supported in the browser. Use functions in module browser.timer \"\n \"instead.\")\n \ndef strftime(_format,t=None ):\n def ns(t,nb):\n \n res=str(t)\n while len(res) float\n repeat(string, string) -> list\n default_timer() -> float\n\n\"\"\"\n\nimport gc\nimport sys\nimport time\nimport itertools\n\n__all__=[\"Timer\",\"timeit\",\"repeat\",\"default_timer\"]\n\ndummy_src_name=\"\"\ndefault_number=1000000\ndefault_repeat=5\ndefault_timer=time.perf_counter\n\n_globals=globals\n\n\n\n\ntemplate=\"\"\"\ndef inner(_it, _timer{init}):\n {setup}\n _t0 = _timer()\n for _i in _it:\n {stmt}\n pass\n _t1 = _timer()\n return _t1 - _t0\n\"\"\"\n\ndef reindent(src,indent):\n ''\n return src.replace(\"\\n\",\"\\n\"+\" \"*indent)\n \nclass Timer:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,stmt=\"pass\",setup=\"pass\",timer=default_timer,\n globals=None):\n ''\n self.timer=timer\n local_ns={}\n global_ns=_globals()if globals is None else globals\n init=''\n if isinstance(setup,str):\n \n compile(setup,dummy_src_name,\"exec\")\n stmtprefix=setup+'\\n'\n setup=reindent(setup,4)\n elif callable(setup):\n local_ns['_setup']=setup\n init +=', _setup=_setup'\n stmtprefix=''\n setup='_setup()'\n else:\n raise ValueError(\"setup is neither a string nor callable\")\n if isinstance(stmt,str):\n \n compile(stmtprefix+stmt,dummy_src_name,\"exec\")\n stmt=reindent(stmt,8)\n elif callable(stmt):\n local_ns['_stmt']=stmt\n init +=', _stmt=_stmt'\n stmt='_stmt()'\n else:\n raise ValueError(\"stmt is neither a string nor callable\")\n src=template.format(stmt=stmt,setup=setup,init=init)\n self.src=src\n code=compile(src,dummy_src_name,\"exec\")\n exec(code,global_ns,local_ns)\n self.inner=local_ns[\"inner\"]\n \n def print_exc(self,file=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n import linecache,traceback\n if self.src is not None:\n linecache.cache[dummy_src_name]=(len(self.src),\n None,\n self.src.split(\"\\n\"),\n dummy_src_name)\n \n \n traceback.print_exc(file=file)\n \n def timeit(self,number=default_number):\n ''\n\n\n\n\n\n\n\n \n it=itertools.repeat(None,number)\n gcold=gc.isenabled()\n gc.disable()\n try:\n timing=self.inner(it,self.timer)\n finally:\n if gcold:\n gc.enable()\n return timing\n \n def repeat(self,repeat=default_repeat,number=default_number):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n r=[]\n for i in range(repeat):\n t=self.timeit(number)\n r.append(t)\n return r\n \n def autorange(self,callback=None):\n ''\n\n\n\n\n\n\n\n \n i=1\n while True:\n for j in 1,2,5:\n number=i *j\n time_taken=self.timeit(number)\n if callback:\n callback(number,time_taken)\n if time_taken >=0.2:\n return(number,time_taken)\n i *=10\n \ndef timeit(stmt=\"pass\",setup=\"pass\",timer=default_timer,\nnumber=default_number,globals=None):\n ''\n return Timer(stmt,setup,timer,globals).timeit(number)\n \ndef repeat(stmt=\"pass\",setup=\"pass\",timer=default_timer,\nrepeat=default_repeat,number=default_number,globals=None):\n ''\n return Timer(stmt,setup,timer,globals).repeat(repeat,number)\n \ndef main(args=None,*,_wrap_timer=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if args is None:\n args=sys.argv[1:]\n import getopt\n try:\n opts,args=getopt.getopt(args,\"n:u:s:r:pvh\",\n [\"number=\",\"setup=\",\"repeat=\",\n \"process\",\"verbose\",\"unit=\",\"help\"])\n except getopt.error as err:\n print(err)\n print(\"use -h/--help for command line help\")\n return 2\n \n timer=default_timer\n stmt=\"\\n\".join(args)or \"pass\"\n number=0\n setup=[]\n repeat=default_repeat\n verbose=0\n time_unit=None\n units={\"nsec\":1e-9,\"usec\":1e-6,\"msec\":1e-3,\"sec\":1.0}\n precision=3\n for o,a in opts:\n if o in(\"-n\",\"--number\"):\n number=int(a)\n if o in(\"-s\",\"--setup\"):\n setup.append(a)\n if o in(\"-u\",\"--unit\"):\n if a in units:\n time_unit=a\n else:\n print(\"Unrecognized unit. Please select nsec, usec, msec, or sec.\",\n file=sys.stderr)\n return 2\n if o in(\"-r\",\"--repeat\"):\n repeat=int(a)\n if repeat <=0:\n repeat=1\n if o in(\"-p\",\"--process\"):\n timer=time.process_time\n if o in(\"-v\",\"--verbose\"):\n if verbose:\n precision +=1\n verbose +=1\n if o in(\"-h\",\"--help\"):\n print(__doc__,end=' ')\n return 0\n setup=\"\\n\".join(setup)or \"pass\"\n \n \n \n \n import os\n sys.path.insert(0,os.curdir)\n if _wrap_timer is not None:\n timer=_wrap_timer(timer)\n \n t=Timer(stmt,setup,timer)\n if number ==0:\n \n callback=None\n if verbose:\n def callback(number,time_taken):\n msg=\"{num} loop{s} -> {secs:.{prec}g} secs\"\n plural=(number !=1)\n print(msg.format(num=number,s='s'if plural else '',\n secs=time_taken,prec=precision))\n try:\n number,_=t.autorange(callback)\n except:\n t.print_exc()\n return 1\n \n if verbose:\n print()\n \n try:\n raw_timings=t.repeat(repeat,number)\n except:\n t.print_exc()\n return 1\n \n def format_time(dt):\n unit=time_unit\n \n if unit is not None:\n scale=units[unit]\n else:\n scales=[(scale,unit)for unit,scale in units.items()]\n scales.sort(reverse=True)\n for scale,unit in scales:\n if dt >=scale:\n break\n \n return \"%.*g %s\"%(precision,dt /scale,unit)\n \n if verbose:\n print(\"raw times: %s\"%\", \".join(map(format_time,raw_timings)))\n print()\n timings=[dt /number for dt in raw_timings]\n \n best=min(timings)\n print(\"%d loop%s, best of %d: %s per loop\"\n %(number,'s'if number !=1 else '',\n repeat,format_time(best)))\n \n best=min(timings)\n worst=max(timings)\n if worst >=best *4:\n import warnings\n warnings.warn_explicit(\"The test results are likely unreliable. \"\n \"The worst time (%s) was more than four times \"\n \"slower than the best time (%s).\"\n %(format_time(worst),format_time(best)),\n UserWarning,'',0)\n return None\n \nif __name__ ==\"__main__\":\n sys.exit(main())\n", ["gc", "getopt", "itertools", "linecache", "os", "sys", "time", "traceback", "warnings"]], "token": [".py", "''\n\n\n__all__=['tok_name','ISTERMINAL','ISNONTERMINAL','ISEOF']\n\nENDMARKER=0\nNAME=1\nNUMBER=2\nSTRING=3\nNEWLINE=4\nINDENT=5\nDEDENT=6\nLPAR=7\nRPAR=8\nLSQB=9\nRSQB=10\nCOLON=11\nCOMMA=12\nSEMI=13\nPLUS=14\nMINUS=15\nSTAR=16\nSLASH=17\nVBAR=18\nAMPER=19\nLESS=20\nGREATER=21\nEQUAL=22\nDOT=23\nPERCENT=24\nLBRACE=25\nRBRACE=26\nEQEQUAL=27\nNOTEQUAL=28\nLESSEQUAL=29\nGREATEREQUAL=30\nTILDE=31\nCIRCUMFLEX=32\nLEFTSHIFT=33\nRIGHTSHIFT=34\nDOUBLESTAR=35\nPLUSEQUAL=36\nMINEQUAL=37\nSTAREQUAL=38\nSLASHEQUAL=39\nPERCENTEQUAL=40\nAMPEREQUAL=41\nVBAREQUAL=42\nCIRCUMFLEXEQUAL=43\nLEFTSHIFTEQUAL=44\nRIGHTSHIFTEQUAL=45\nDOUBLESTAREQUAL=46\nDOUBLESLASH=47\nDOUBLESLASHEQUAL=48\nAT=49\nATEQUAL=50\nRARROW=51\nELLIPSIS=52\nCOLONEQUAL=53\nEXCLAMATION=54\nOP=55\nAWAIT=56\nASYNC=57\nTYPE_IGNORE=58\nTYPE_COMMENT=59\nSOFT_KEYWORD=60\nFSTRING_START=61\nFSTRING_MIDDLE=62\nFSTRING_END=63\nCOMMENT=64\nNL=65\n\nERRORTOKEN=66\nENCODING=67\nN_TOKENS=68\n\nNT_OFFSET=256\n\ntok_name={value:name\nfor name,value in globals().items()\nif isinstance(value,int)and not name.startswith('_')}\n__all__.extend(tok_name.values())\n\nEXACT_TOKEN_TYPES={\n'!':EXCLAMATION,\n'!=':NOTEQUAL,\n'%':PERCENT,\n'%=':PERCENTEQUAL,\n'&':AMPER,\n'&=':AMPEREQUAL,\n'(':LPAR,\n')':RPAR,\n'*':STAR,\n'**':DOUBLESTAR,\n'**=':DOUBLESTAREQUAL,\n'*=':STAREQUAL,\n'+':PLUS,\n'+=':PLUSEQUAL,\n',':COMMA,\n'-':MINUS,\n'-=':MINEQUAL,\n'->':RARROW,\n'.':DOT,\n'...':ELLIPSIS,\n'/':SLASH,\n'//':DOUBLESLASH,\n'//=':DOUBLESLASHEQUAL,\n'/=':SLASHEQUAL,\n':':COLON,\n':=':COLONEQUAL,\n';':SEMI,\n'<':LESS,\n'<<':LEFTSHIFT,\n'<<=':LEFTSHIFTEQUAL,\n'<=':LESSEQUAL,\n'=':EQUAL,\n'==':EQEQUAL,\n'>':GREATER,\n'>=':GREATEREQUAL,\n'>>':RIGHTSHIFT,\n'>>=':RIGHTSHIFTEQUAL,\n'@':AT,\n'@=':ATEQUAL,\n'[':LSQB,\n']':RSQB,\n'^':CIRCUMFLEX,\n'^=':CIRCUMFLEXEQUAL,\n'{':LBRACE,\n'|':VBAR,\n'|=':VBAREQUAL,\n'}':RBRACE,\n'~':TILDE,\n}\n\ndef ISTERMINAL(x):\n return x =NT_OFFSET\n \ndef ISEOF(x):\n return x ==ENDMARKER\n", []], "tokenize": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__author__='Ka-Ping Yee '\n__credits__=('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '\n'Skip Montanaro, Raymond Hettinger, Trent Nelson, '\n'Michael Foord')\nfrom builtins import open as _builtin_open\nfrom codecs import lookup,BOM_UTF8\nimport collections\nimport functools\nfrom io import TextIOWrapper\nimport itertools as _itertools\nimport re\nimport sys\nfrom token import *\nfrom token import EXACT_TOKEN_TYPES\nimport _tokenize\n\ncookie_re=re.compile(r'^[ \\t\\f]*#.*?coding[:=][ \\t]*([-\\w.]+)',re.ASCII)\nblank_re=re.compile(br'^[ \\t\\f]*(?:[#\\r\\n]|$)',re.ASCII)\n\nimport token\n__all__=token.__all__+[\"tokenize\",\"generate_tokens\",\"detect_encoding\",\n\"untokenize\",\"TokenInfo\"]\ndel token\n\nclass TokenInfo(collections.namedtuple('TokenInfo','type string start end line')):\n def __repr__(self):\n annotated_type='%d (%s)'%(self.type,tok_name[self.type])\n return('TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r)'%\n self._replace(type=annotated_type))\n \n @property\n def exact_type(self):\n if self.type ==OP and self.string in EXACT_TOKEN_TYPES:\n return EXACT_TOKEN_TYPES[self.string]\n else:\n return self.type\n \ndef group(*choices):return '('+'|'.join(choices)+')'\ndef any(*choices):return group(*choices)+'*'\ndef maybe(*choices):return group(*choices)+'?'\n\n\n\nWhitespace=r'[ \\f\\t]*'\nComment=r'#[^\\r\\n]*'\nIgnore=Whitespace+any(r'\\\\\\r?\\n'+Whitespace)+maybe(Comment)\nName=r'\\w+'\n\nHexnumber=r'0[xX](?:_?[0-9a-fA-F])+'\nBinnumber=r'0[bB](?:_?[01])+'\nOctnumber=r'0[oO](?:_?[0-7])+'\nDecnumber=r'(?:0(?:_?0)*|[1-9](?:_?[0-9])*)'\nIntnumber=group(Hexnumber,Binnumber,Octnumber,Decnumber)\nExponent=r'[eE][-+]?[0-9](?:_?[0-9])*'\nPointfloat=group(r'[0-9](?:_?[0-9])*\\.(?:[0-9](?:_?[0-9])*)?',\nr'\\.[0-9](?:_?[0-9])*')+maybe(Exponent)\nExpfloat=r'[0-9](?:_?[0-9])*'+Exponent\nFloatnumber=group(Pointfloat,Expfloat)\nImagnumber=group(r'[0-9](?:_?[0-9])*[jJ]',Floatnumber+r'[jJ]')\nNumber=group(Imagnumber,Floatnumber,Intnumber)\n\n\ndef _all_string_prefixes():\n\n\n\n _valid_string_prefixes=['b','r','u','f','br','fr']\n \n result={''}\n for prefix in _valid_string_prefixes:\n for t in _itertools.permutations(prefix):\n \n \n for u in _itertools.product(*[(c,c.upper())for c in t]):\n result.add(''.join(u))\n return result\n \n@functools.lru_cache\ndef _compile(expr):\n return re.compile(expr,re.UNICODE)\n \n \n \nStringPrefix=group(*_all_string_prefixes())\n\n\nSingle=r\"[^'\\\\]*(?:\\\\.[^'\\\\]*)*'\"\n\nDouble=r'[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"'\n\nSingle3=r\"[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''\"\n\nDouble3=r'[^\"\\\\]*(?:(?:\\\\.|\"(?!\"\"))[^\"\\\\]*)*\"\"\"'\nTriple=group(StringPrefix+\"'''\",StringPrefix+'\"\"\"')\n\nString=group(StringPrefix+r\"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'\",\nStringPrefix+r'\"[^\\n\"\\\\]*(?:\\\\.[^\\n\"\\\\]*)*\"')\n\n\n\n\nSpecial=group(*map(re.escape,sorted(EXACT_TOKEN_TYPES,reverse=True)))\nFunny=group(r'\\r?\\n',Special)\n\nPlainToken=group(Number,Funny,String,Name)\nToken=Ignore+PlainToken\n\n\nContStr=group(StringPrefix+r\"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*\"+\ngroup(\"'\",r'\\\\\\r?\\n'),\nStringPrefix+r'\"[^\\n\"\\\\]*(?:\\\\.[^\\n\"\\\\]*)*'+\ngroup('\"',r'\\\\\\r?\\n'))\nPseudoExtras=group(r'\\\\\\r?\\n|\\Z',Comment,Triple)\nPseudoToken=Whitespace+group(PseudoExtras,Number,Funny,ContStr,Name)\n\n\n\n\nendpats={}\nfor _prefix in _all_string_prefixes():\n endpats[_prefix+\"'\"]=Single\n endpats[_prefix+'\"']=Double\n endpats[_prefix+\"'''\"]=Single3\n endpats[_prefix+'\"\"\"']=Double3\ndel _prefix\n\n\n\nsingle_quoted=set()\ntriple_quoted=set()\nfor t in _all_string_prefixes():\n for u in(t+'\"',t+\"'\"):\n single_quoted.add(u)\n for u in(t+'\"\"\"',t+\"'''\"):\n triple_quoted.add(u)\ndel t,u\n\ntabsize=8\n\nclass TokenError(Exception):pass\n\n\nclass StopTokenizing(Exception):pass\n\nclass Untokenizer:\n\n def __init__(self):\n self.tokens=[]\n self.prev_row=1\n self.prev_col=0\n self.encoding=None\n \n def add_whitespace(self,start):\n row,col=start\n if row =len(indent):\n self.tokens.append(indent)\n self.prev_col=len(indent)\n startline=False\n elif tok_type ==FSTRING_MIDDLE:\n if '{'in token or '}'in token:\n end_line,end_col=end\n end=(end_line,end_col+token.count('{')+token.count('}'))\n token=re.sub('{','{{',token)\n token=re.sub('}','}}',token)\n \n \n self.add_whitespace(start)\n self.tokens.append(token)\n self.prev_row,self.prev_col=end\n if tok_type in(NEWLINE,NL):\n self.prev_row +=1\n self.prev_col=0\n return \"\".join(self.tokens)\n \n def compat(self,token,iterable):\n indents=[]\n toks_append=self.tokens.append\n startline=token[0]in(NEWLINE,NL)\n prevstring=False\n \n for tok in _itertools.chain([token],iterable):\n toknum,tokval=tok[:2]\n if toknum ==ENCODING:\n self.encoding=tokval\n continue\n \n if toknum in(NAME,NUMBER):\n tokval +=' '\n \n \n if toknum ==STRING:\n if prevstring:\n tokval=' '+tokval\n prevstring=True\n else:\n prevstring=False\n \n if toknum ==INDENT:\n indents.append(tokval)\n continue\n elif toknum ==DEDENT:\n indents.pop()\n continue\n elif toknum in(NEWLINE,NL):\n startline=True\n elif startline and indents:\n toks_append(indents[-1])\n startline=False\n elif toknum ==FSTRING_MIDDLE:\n if '{'in tokval or '}'in tokval:\n tokval=re.sub('{','{{',tokval)\n tokval=re.sub('}','}}',tokval)\n \n toks_append(tokval)\n \n \ndef untokenize(iterable):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n ut=Untokenizer()\n out=ut.untokenize(iterable)\n if ut.encoding is not None:\n out=out.encode(ut.encoding)\n return out\n \n \ndef _get_normal_name(orig_enc):\n ''\n \n enc=orig_enc[:12].lower().replace(\"_\",\"-\")\n if enc ==\"utf-8\"or enc.startswith(\"utf-8-\"):\n return \"utf-8\"\n if enc in(\"latin-1\",\"iso-8859-1\",\"iso-latin-1\")or\\\n enc.startswith((\"latin-1-\",\"iso-8859-1-\",\"iso-latin-1-\")):\n return \"iso-8859-1\"\n return orig_enc\n \ndef detect_encoding(readline):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n filename=readline.__self__.name\n except AttributeError:\n filename=None\n bom_found=False\n encoding=None\n default='utf-8'\n def read_or_stop():\n try:\n return readline()\n except StopIteration:\n return b''\n \n def find_cookie(line):\n try:\n \n \n \n line_string=line.decode('utf-8')\n except UnicodeDecodeError:\n msg=\"invalid or missing encoding declaration\"\n if filename is not None:\n msg='{} for {!r}'.format(msg,filename)\n raise SyntaxError(msg)\n \n match=cookie_re.match(line_string)\n if not match:\n return None\n encoding=_get_normal_name(match.group(1))\n try:\n codec=lookup(encoding)\n except LookupError:\n \n if filename is None:\n msg=\"unknown encoding: \"+encoding\n else:\n msg=\"unknown encoding for {!r}: {}\".format(filename,\n encoding)\n raise SyntaxError(msg)\n \n if bom_found:\n if encoding !='utf-8':\n \n if filename is None:\n msg='encoding problem: utf-8'\n else:\n msg='encoding problem for {!r}: utf-8'.format(filename)\n raise SyntaxError(msg)\n encoding +='-sig'\n return encoding\n \n first=read_or_stop()\n if first.startswith(BOM_UTF8):\n bom_found=True\n first=first[3:]\n default='utf-8-sig'\n if not first:\n return default,[]\n \n encoding=find_cookie(first)\n if encoding:\n return encoding,[first]\n if not blank_re.match(first):\n return default,[first]\n \n second=read_or_stop()\n if not second:\n return default,[first]\n \n encoding=find_cookie(second)\n if encoding:\n return encoding,[first,second]\n \n return default,[first,second]\n \n \ndef open(filename):\n ''\n\n \n buffer=_builtin_open(filename,'rb')\n try:\n encoding,lines=detect_encoding(buffer.readline)\n buffer.seek(0)\n text=TextIOWrapper(buffer,encoding,line_buffering=True)\n text.mode='r'\n return text\n except:\n buffer.close()\n raise\n \ndef tokenize(readline):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n encoding,consumed=detect_encoding(readline)\n rl_gen=_itertools.chain(consumed,iter(readline,b\"\"))\n if encoding is not None:\n if encoding ==\"utf-8-sig\":\n \n encoding=\"utf-8\"\n yield TokenInfo(ENCODING,encoding,(0,0),(0,0),'')\n yield from _generate_tokens_from_c_tokenizer(rl_gen.__next__,encoding,extra_tokens=True)\n \ndef generate_tokens(readline):\n ''\n\n\n\n \n return _generate_tokens_from_c_tokenizer(readline,extra_tokens=True)\n \ndef main():\n import argparse\n \n \n def perror(message):\n sys.stderr.write(message)\n sys.stderr.write('\\n')\n \n def error(message,filename=None,location=None):\n if location:\n args=(filename,)+location+(message,)\n perror(\"%s:%d:%d: error: %s\"%args)\n elif filename:\n perror(\"%s: error: %s\"%(filename,message))\n else:\n perror(\"error: %s\"%message)\n sys.exit(1)\n \n \n parser=argparse.ArgumentParser(prog='python -m tokenize')\n parser.add_argument(dest='filename',nargs='?',\n metavar='filename.py',\n help='the file to tokenize; defaults to stdin')\n parser.add_argument('-e','--exact',dest='exact',action='store_true',\n help='display token names using the exact type')\n args=parser.parse_args()\n \n try:\n \n if args.filename:\n filename=args.filename\n with _builtin_open(filename,'rb')as f:\n tokens=list(tokenize(f.readline))\n else:\n filename=\"\"\n tokens=_generate_tokens_from_c_tokenizer(\n sys.stdin.readline,extra_tokens=True)\n \n \n \n for token in tokens:\n token_type=token.type\n if args.exact:\n token_type=token.exact_type\n token_range=\"%d,%d-%d,%d:\"%(token.start+token.end)\n print(\"%-20s%-15s%-15r\"%\n (token_range,tok_name[token_type],token.string))\n except IndentationError as err:\n line,column=err.args[1][1:3]\n error(err.args[0],filename,(line,column))\n except TokenError as err:\n line,column=err.args[1]\n error(err.args[0],filename,(line,column))\n except SyntaxError as err:\n error(err,filename)\n except OSError as err:\n error(err)\n except KeyboardInterrupt:\n print(\"interrupted\\n\")\n except Exception as err:\n perror(\"unexpected error: %s\"%err)\n raise\n \ndef _generate_tokens_from_c_tokenizer(source,encoding=None,extra_tokens=False):\n ''\n if encoding is None:\n it=_tokenize.TokenizerIter(source,extra_tokens=extra_tokens)\n else:\n it=_tokenize.TokenizerIter(source,encoding=encoding,extra_tokens=extra_tokens)\n for info in it:\n yield TokenInfo._make(info)\n \n \nif __name__ ==\"__main__\":\n main()\n", ["_tokenize", "argparse", "builtins", "codecs", "collections", "functools", "io", "itertools", "re", "sys", "token"]], "traceback": [".py", "''\n\nimport collections.abc\nimport itertools\nimport linecache\nimport sys\nimport textwrap\nfrom contextlib import suppress\n\n__all__=['extract_stack','extract_tb','format_exception',\n'format_exception_only','format_list','format_stack',\n'format_tb','print_exc','format_exc','print_exception',\n'print_last','print_stack','print_tb','clear_frames',\n'FrameSummary','StackSummary','TracebackException',\n'walk_stack','walk_tb']\n\n\n\n\n\ndef print_list(extracted_list,file=None):\n ''\n \n if file is None:\n file=sys.stderr\n for item in StackSummary.from_list(extracted_list).format():\n print(item,file=file,end=\"\")\n \ndef format_list(extracted_list):\n ''\n\n\n\n\n\n\n\n\n\n \n return StackSummary.from_list(extracted_list).format()\n \n \n \n \n \ndef print_tb(tb,limit=None,file=None):\n ''\n\n\n\n\n\n \n print_list(extract_tb(tb,limit=limit),file=file)\n \ndef format_tb(tb,limit=None):\n ''\n return extract_tb(tb,limit=limit).format()\n \ndef extract_tb(tb,limit=None):\n ''\n\n\n\n\n\n\n\n\n\n\n \n return StackSummary._extract_from_extended_frame_gen(\n _walk_tb_with_full_positions(tb),limit=limit)\n \n \n \n \n \n_cause_message=(\n\"\\nThe above exception was the direct cause \"\n\"of the following exception:\\n\\n\")\n\n_context_message=(\n\"\\nDuring handling of the above exception, \"\n\"another exception occurred:\\n\\n\")\n\n\nclass _Sentinel:\n def __repr__(self):\n return \"\"\n \n_sentinel=_Sentinel()\n\ndef _parse_value_tb(exc,value,tb):\n if(value is _sentinel)!=(tb is _sentinel):\n raise ValueError(\"Both or neither of value and tb must be given\")\n if value is tb is _sentinel:\n if exc is not None:\n if isinstance(exc,BaseException):\n return exc,exc.__traceback__\n \n raise TypeError(f'Exception expected for value, '\n f'{type(exc).__name__} found')\n else:\n return None,None\n return value,tb\n \n \ndef print_exception(exc,/,value=_sentinel,tb=_sentinel,limit=None,\\\nfile=None,chain=True):\n ''\n\n\n\n\n\n\n\n\n \n value,tb=_parse_value_tb(exc,value,tb)\n te=TracebackException(type(value),value,tb,limit=limit,compact=True)\n te.print(file=file,chain=chain)\n \n \ndef format_exception(exc,/,value=_sentinel,tb=_sentinel,limit=None,\\\nchain=True):\n ''\n\n\n\n\n\n\n \n value,tb=_parse_value_tb(exc,value,tb)\n te=TracebackException(type(value),value,tb,limit=limit,compact=True)\n return list(te.format(chain=chain))\n \n \ndef format_exception_only(exc,/,value=_sentinel):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if value is _sentinel:\n value=exc\n te=TracebackException(type(value),value,None,compact=True)\n return list(te.format_exception_only())\n \n \n \n \ndef _format_final_exc_line(etype,value):\n valuestr=_safe_string(value,'exception')\n if value is None or not valuestr:\n line=\"%s\\n\"%etype\n else:\n line=\"%s: %s\\n\"%(etype,valuestr)\n return line\n \ndef _safe_string(value,what,func=str):\n try:\n return func(value)\n except:\n return f'<{what} {func.__name__}() failed>'\n \n \n \ndef print_exc(limit=None,file=None,chain=True):\n ''\n print_exception(sys.exception(),limit=limit,file=file,chain=chain)\n \ndef format_exc(limit=None,chain=True):\n ''\n return \"\".join(format_exception(sys.exception(),limit=limit,chain=chain))\n \ndef print_last(limit=None,file=None,chain=True):\n ''\n if not hasattr(sys,\"last_exc\")and not hasattr(sys,\"last_type\"):\n raise ValueError(\"no last exception\")\n \n if hasattr(sys,\"last_exc\"):\n print_exception(sys.last_exc,limit,file,chain)\n else:\n print_exception(sys.last_type,sys.last_value,sys.last_traceback,\n limit,file,chain)\n \n \n \n \n \n \ndef print_stack(f=None,limit=None,file=None):\n ''\n\n\n\n\n \n if f is None:\n f=sys._getframe().f_back\n print_list(extract_stack(f,limit=limit),file=file)\n \n \ndef format_stack(f=None,limit=None):\n ''\n if f is None:\n f=sys._getframe().f_back\n return format_list(extract_stack(f,limit=limit))\n \n \ndef extract_stack(f=None,limit=None):\n ''\n\n\n\n\n\n\n \n if f is None:\n f=sys._getframe().f_back\n stack=StackSummary.extract(walk_stack(f),limit=limit)\n stack.reverse()\n return stack\n \n \ndef clear_frames(tb):\n ''\n while tb is not None:\n try:\n tb.tb_frame.clear()\n except RuntimeError:\n \n pass\n tb=tb.tb_next\n \n \nclass FrameSummary:\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('filename','lineno','end_lineno','colno','end_colno',\n 'name','_line','locals')\n \n def __init__(self,filename,lineno,name,*,lookup_line=True,\n locals=None,line=None,\n end_lineno=None,colno=None,end_colno=None):\n ''\n\n\n\n\n\n\n\n \n self.filename=filename\n self.lineno=lineno\n self.name=name\n self._line=line\n if lookup_line:\n self.line\n self.locals={k:_safe_string(v,'local',func=repr)\n for k,v in locals.items()}if locals else None\n self.end_lineno=end_lineno\n self.colno=colno\n self.end_colno=end_colno\n \n def __eq__(self,other):\n if isinstance(other,FrameSummary):\n return(self.filename ==other.filename and\n self.lineno ==other.lineno and\n self.name ==other.name and\n self.locals ==other.locals)\n if isinstance(other,tuple):\n return(self.filename,self.lineno,self.name,self.line)==other\n return NotImplemented\n \n def __getitem__(self,pos):\n return(self.filename,self.lineno,self.name,self.line)[pos]\n \n def __iter__(self):\n return iter([self.filename,self.lineno,self.name,self.line])\n \n def __repr__(self):\n return \"\".format(\n filename=self.filename,lineno=self.lineno,name=self.name)\n \n def __len__(self):\n return 4\n \n @property\n def _original_line(self):\n \n self.line\n return self._line\n \n @property\n def line(self):\n if self._line is None:\n if self.lineno is None:\n return None\n self._line=linecache.getline(self.filename,self.lineno)\n return self._line.strip()\n \n \ndef walk_stack(f):\n ''\n\n\n\n \n if f is None:\n f=sys._getframe().f_back.f_back.f_back.f_back\n while f is not None:\n yield f,f.f_lineno\n f=f.f_back\n \n \ndef walk_tb(tb):\n ''\n\n\n\n \n while tb is not None:\n yield tb.tb_frame,tb.tb_lineno\n tb=tb.tb_next\n \n \ndef _walk_tb_with_full_positions(tb):\n\n\n while tb is not None:\n positions=_get_code_position(tb.tb_frame.f_code,tb.tb_lasti)\n \n \n if positions[0]is None:\n yield tb.tb_frame,(tb.tb_lineno,)+positions[1:]\n else:\n yield tb.tb_frame,positions\n tb=tb.tb_next\n \n \ndef _get_code_position(code,instruction_index):\n if instruction_index <0:\n return(None,None,None,None)\n positions_gen=code.co_positions()\n return next(itertools.islice(positions_gen,instruction_index //2,None))\n \n \n_RECURSIVE_CUTOFF=3\n\nclass StackSummary(list):\n ''\n \n @classmethod\n def extract(klass,frame_gen,*,limit=None,lookup_lines=True,\n capture_locals=False):\n ''\n\n\n\n\n\n\n\n\n\n \n def extended_frame_gen():\n for f,lineno in frame_gen:\n yield f,(lineno,None,None,None)\n \n return klass._extract_from_extended_frame_gen(\n extended_frame_gen(),limit=limit,lookup_lines=lookup_lines,\n capture_locals=capture_locals)\n \n @classmethod\n def _extract_from_extended_frame_gen(klass,frame_gen,*,limit=None,\n lookup_lines=True,capture_locals=False):\n \n \n \n \n if limit is None:\n limit=getattr(sys,'tracebacklimit',None)\n if limit is not None and limit <0:\n limit=0\n if limit is not None:\n if limit >=0:\n frame_gen=itertools.islice(frame_gen,limit)\n else:\n frame_gen=collections.deque(frame_gen,maxlen=-limit)\n \n result=klass()\n fnames=set()\n for f,(lineno,end_lineno,colno,end_colno)in frame_gen:\n co=f.f_code\n filename=co.co_filename\n name=co.co_name\n \n fnames.add(filename)\n linecache.lazycache(filename,f.f_globals)\n \n if capture_locals:\n f_locals=f.f_locals\n else:\n f_locals=None\n result.append(FrameSummary(\n filename,lineno,name,lookup_line=False,locals=f_locals,\n end_lineno=end_lineno,colno=colno,end_colno=end_colno))\n for filename in fnames:\n linecache.checkcache(filename)\n \n if lookup_lines:\n for f in result:\n f.line\n return result\n \n @classmethod\n def from_list(klass,a_list):\n ''\n\n\n \n \n \n \n \n result=StackSummary()\n for frame in a_list:\n if isinstance(frame,FrameSummary):\n result.append(frame)\n else:\n filename,lineno,name,line=frame\n result.append(FrameSummary(filename,lineno,name,line=line))\n return result\n \n def format_frame_summary(self,frame_summary):\n ''\n\n\n\n \n row=[]\n row.append(' File \"{}\", line {}, in {}\\n'.format(\n frame_summary.filename,frame_summary.lineno,frame_summary.name))\n if frame_summary.line:\n stripped_line=frame_summary.line.strip()\n row.append(' {}\\n'.format(stripped_line))\n \n orig_line_len=len(frame_summary._original_line)\n frame_line_len=len(frame_summary.line.lstrip())\n stripped_characters=orig_line_len -frame_line_len\n if(\n frame_summary.colno is not None\n and frame_summary.end_colno is not None\n ):\n start_offset=_byte_offset_to_character_offset(\n frame_summary._original_line,frame_summary.colno)+1\n end_offset=_byte_offset_to_character_offset(\n frame_summary._original_line,frame_summary.end_colno)+1\n \n anchors=None\n if frame_summary.lineno ==frame_summary.end_lineno:\n with suppress(Exception):\n anchors=_extract_caret_anchors_from_line_segment(\n frame_summary._original_line[start_offset -1:end_offset -1]\n )\n else:\n end_offset=stripped_characters+len(stripped_line)\n \n \n if end_offset -start_offset 0):\n row.append(' ')\n row.append(' '*(start_offset -stripped_characters))\n \n if anchors:\n row.append(anchors.primary_char *(anchors.left_end_offset))\n row.append(anchors.secondary_char *(anchors.right_start_offset -anchors.left_end_offset))\n row.append(anchors.primary_char *(end_offset -start_offset -anchors.right_start_offset))\n else:\n row.append('^'*(end_offset -start_offset))\n \n row.append('\\n')\n \n if frame_summary.locals:\n for name,value in sorted(frame_summary.locals.items()):\n row.append(' {name} = {value}\\n'.format(name=name,value=value))\n \n return ''.join(row)\n \n def format(self):\n ''\n\n\n\n\n\n\n\n\n\n \n result=[]\n last_file=None\n last_line=None\n last_name=None\n count=0\n for frame_summary in self:\n formatted_frame=self.format_frame_summary(frame_summary)\n if formatted_frame is None:\n continue\n if(last_file is None or last_file !=frame_summary.filename or\n last_line is None or last_line !=frame_summary.lineno or\n last_name is None or last_name !=frame_summary.name):\n if count >_RECURSIVE_CUTOFF:\n count -=_RECURSIVE_CUTOFF\n result.append(\n f' [Previous line repeated {count} more '\n f'time{\"s\"if count >1 else \"\"}]\\n'\n )\n last_file=frame_summary.filename\n last_line=frame_summary.lineno\n last_name=frame_summary.name\n count=0\n count +=1\n if count >_RECURSIVE_CUTOFF:\n continue\n result.append(formatted_frame)\n \n if count >_RECURSIVE_CUTOFF:\n count -=_RECURSIVE_CUTOFF\n result.append(\n f' [Previous line repeated {count} more '\n f'time{\"s\"if count >1 else \"\"}]\\n'\n )\n return result\n \n \ndef _byte_offset_to_character_offset(str,offset):\n as_utf8=str.encode('utf-8')\n return len(as_utf8[:offset].decode(\"utf-8\",errors=\"replace\"))\n \n \n_Anchors=collections.namedtuple(\n\"_Anchors\",\n[\n\"left_end_offset\",\n\"right_start_offset\",\n\"primary_char\",\n\"secondary_char\",\n],\ndefaults=[\"~\",\"^\"]\n)\n\ndef _extract_caret_anchors_from_line_segment(segment):\n import ast\n \n try:\n tree=ast.parse(segment)\n except SyntaxError:\n return None\n \n if len(tree.body)!=1:\n return None\n \n normalize=lambda offset:_byte_offset_to_character_offset(segment,offset)\n statement=tree.body[0]\n match statement:\n case ast.Expr(expr):\n match expr:\n case ast.BinOp():\n operator_start=normalize(expr.left.end_col_offset)\n operator_end=normalize(expr.right.col_offset)\n operator_str=segment[operator_start:operator_end]\n operator_offset=len(operator_str)-len(operator_str.lstrip())\n \n left_anchor=expr.left.end_col_offset+operator_offset\n right_anchor=left_anchor+1\n if(\n operator_offset+1 \"\n stype=smod+'.'+stype\n \n if not issubclass(self.exc_type,SyntaxError):\n yield _format_final_exc_line(stype,self._str)\n else:\n yield from self._format_syntax_error(stype)\n \n if(\n isinstance(self.__notes__,collections.abc.Sequence)\n and not isinstance(self.__notes__,(str,bytes))\n ):\n for note in self.__notes__:\n note=_safe_string(note,'note')\n yield from[l+'\\n'for l in note.split('\\n')]\n elif self.__notes__ is not None:\n yield \"{}\\n\".format(_safe_string(self.__notes__,'__notes__',func=repr))\n \n def _format_syntax_error(self,stype):\n ''\n \n filename_suffix=''\n if self.lineno is not None:\n yield ' File \"{}\", line {}\\n'.format(\n self.filename or \"\",self.lineno)\n elif self.filename is not None:\n filename_suffix=' ({})'.format(self.filename)\n \n text=self.text\n if text is not None:\n \n \n \n rtext=text.rstrip('\\n')\n ltext=rtext.lstrip(' \\n\\f')\n spaces=len(rtext)-len(ltext)\n yield ' {}\\n'.format(ltext)\n \n if self.offset is not None:\n offset=self.offset\n end_offset=self.end_offset if self.end_offset not in{None,0}else offset\n if offset ==end_offset or end_offset ==-1:\n end_offset=offset+1\n \n \n colno=offset -1 -spaces\n end_colno=end_offset -1 -spaces\n if colno >=0:\n \n caretspace=((c if c.isspace()else ' ')for c in ltext[:colno])\n yield ' {}{}'.format(\"\".join(caretspace),('^'*(end_colno -colno)+\"\\n\"))\n msg=self.msg or \"\"\n yield \"{}: {}{}\\n\".format(stype,msg,filename_suffix)\n \n def format(self,*,chain=True,_ctx=None):\n ''\n\n\n\n\n\n\n\n\n\n \n \n if _ctx is None:\n _ctx=_ExceptionPrintContext()\n \n output=[]\n exc=self\n if chain:\n while exc:\n if exc.__cause__ is not None:\n chained_msg=_cause_message\n chained_exc=exc.__cause__\n elif(exc.__context__ is not None and\n not exc.__suppress_context__):\n chained_msg=_context_message\n chained_exc=exc.__context__\n else:\n chained_msg=None\n chained_exc=None\n \n output.append((chained_msg,exc))\n exc=chained_exc\n else:\n output.append((None,exc))\n \n for msg,exc in reversed(output):\n if msg is not None:\n yield from _ctx.emit(msg)\n if exc.exceptions is None:\n if exc.stack:\n yield from _ctx.emit('Traceback (most recent call last):\\n')\n yield from _ctx.emit(exc.stack.format())\n yield from _ctx.emit(exc.format_exception_only())\n elif _ctx.exception_group_depth >self.max_group_depth:\n \n yield from _ctx.emit(\n f\"... (max_group_depth is {self.max_group_depth})\\n\")\n else:\n \n is_toplevel=(_ctx.exception_group_depth ==0)\n if is_toplevel:\n _ctx.exception_group_depth +=1\n \n if exc.stack:\n yield from _ctx.emit(\n 'Exception Group Traceback (most recent call last):\\n',\n margin_char='+'if is_toplevel else None)\n yield from _ctx.emit(exc.stack.format())\n \n yield from _ctx.emit(exc.format_exception_only())\n num_excs=len(exc.exceptions)\n if num_excs <=self.max_group_width:\n n=num_excs\n else:\n n=self.max_group_width+1\n _ctx.need_close=False\n for i in range(n):\n last_exc=(i ==n -1)\n if last_exc:\n \n _ctx.need_close=True\n \n if self.max_group_width is not None:\n truncated=(i >=self.max_group_width)\n else:\n truncated=False\n title=f'{i+1}'if not truncated else '...'\n yield(_ctx.indent()+\n ('+-'if i ==0 else ' ')+\n f'+---------------- {title} ----------------\\n')\n _ctx.exception_group_depth +=1\n if not truncated:\n yield from exc.exceptions[i].format(chain=chain,_ctx=_ctx)\n else:\n remaining=num_excs -self.max_group_width\n plural='s'if remaining >1 else ''\n yield from _ctx.emit(\n f\"and {remaining} more exception{plural}\\n\")\n \n if last_exc and _ctx.need_close:\n yield(_ctx.indent()+\n \"+------------------------------------\\n\")\n _ctx.need_close=False\n _ctx.exception_group_depth -=1\n \n if is_toplevel:\n assert _ctx.exception_group_depth ==1\n _ctx.exception_group_depth=0\n \n \n def print(self,*,file=None,chain=True):\n ''\n if file is None:\n file=sys.stderr\n for line in self.format(chain=chain):\n print(line,file=file,end=\"\")\n \n \n_MAX_CANDIDATE_ITEMS=750\n_MAX_STRING_SIZE=40\n_MOVE_COST=2\n_CASE_COST=1\n\n\ndef _substitution_cost(ch_a,ch_b):\n if ch_a ==ch_b:\n return 0\n if ch_a.lower()==ch_b.lower():\n return _CASE_COST\n return _MOVE_COST\n \n \ndef _compute_suggestion_error(exc_value,tb,wrong_name):\n if wrong_name is None or not isinstance(wrong_name,str):\n return None\n if isinstance(exc_value,AttributeError):\n obj=exc_value.obj\n try:\n d=dir(obj)\n except Exception:\n return None\n elif isinstance(exc_value,ImportError):\n try:\n mod=__import__(exc_value.name)\n d=dir(mod)\n except Exception:\n return None\n else:\n assert isinstance(exc_value,NameError)\n \n if tb is None:\n return None\n while tb.tb_next is not None:\n tb=tb.tb_next\n frame=tb.tb_frame\n d=(\n list(frame.f_locals)\n +list(frame.f_globals)\n +list(frame.f_builtins)\n )\n \n \n \n if 'self'in frame.f_locals:\n self=frame.f_locals['self']\n if hasattr(self,wrong_name):\n return f\"self.{wrong_name}\"\n \n \n \n if len(d)>_MAX_CANDIDATE_ITEMS:\n return None\n wrong_name_len=len(wrong_name)\n if wrong_name_len >_MAX_STRING_SIZE:\n return None\n best_distance=wrong_name_len\n suggestion=None\n for possible_name in d:\n if possible_name ==wrong_name:\n \n continue\n \n max_distance=(len(possible_name)+wrong_name_len+3)*_MOVE_COST //6\n \n max_distance=min(max_distance,best_distance -1)\n current_distance=_levenshtein_distance(wrong_name,possible_name,max_distance)\n if current_distance >max_distance:\n continue\n if not suggestion or current_distance _MAX_STRING_SIZE or len(b)>_MAX_STRING_SIZE:\n return max_cost+1\n \n \n if len(b)max_cost:\n return max_cost+1\n \n \n \n \n row=list(range(_MOVE_COST,_MOVE_COST *(len(a)+1),_MOVE_COST))\n \n result=0\n for bindex in range(len(b)):\n bchar=b[bindex]\n distance=result=bindex *_MOVE_COST\n minimum=sys.maxsize\n for index in range(len(a)):\n \n substitute=distance+_substitution_cost(bchar,a[index])\n \n distance=row[index]\n \n \n insert_delete=min(result,distance)+_MOVE_COST\n result=min(insert_delete,substitute)\n \n \n row[index]=result\n if result max_cost:\n \n return max_cost+1\n return result\n", ["ast", "collections.abc", "contextlib", "itertools", "linecache", "sys", "textwrap"]], "turtle": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport math\nimport sys\n\nfrom math import cos,sin\n\nfrom browser import console,document,html,timer\nimport _svg as svg\n\n\n\n\n\n\n_CFG={\n\n\n\"canvwidth\":500,\n\"canvheight\":500,\n\n\n\"mode\":\"standard\",\n\n\n\n\"shape\":\"classic\",\n\"pencolor\":\"black\",\n\"fillcolor\":\"black\",\n\n\"visible\":True ,\n\n\n\n\n\n\n\n\"turtle_canvas_wrapper\":None ,\n\"turtle_canvas_id\":\"turtle-canvas\",\n\"min_duration\":\"1ms\"\n}\n\n_cfg_copy=_CFG.copy()\n\n\ndef set_defaults(**params):\n ''\n _CFG.update(**params)\n Screen().reset()\n \n \nclass FormattedTuple(tuple):\n ''\n def __new__(cls,x,y):\n return tuple.__new__(cls,(x,y))\n def __repr__(self):\n return \"(%.2f, %.2f)\"%self\n \ndef create_circle(r):\n ''\n circle=svg.circle(x=0,y=0,r=r,stroke=\"black\",fill=\"black\")\n circle.setAttribute(\"stroke-width\",1)\n return circle\n \n \ndef create_polygon(points):\n ''\n points=[\"%s,%s \"%(x,y)for x,y in points]\n polygon=svg.polygon(points=points,stroke=\"black\",fill=\"black\")\n polygon.setAttribute(\"stroke-width\",1)\n return polygon\n \n \ndef create_rectangle(width=2,height=2,rx=None ,ry=None ):\n ''\n \n rectangle=svg.rect(x=-width /2,y=-height /2,width=width,\n height=height,stroke=\"black\",fill=\"black\")\n rectangle.setAttribute(\"stroke-width\",1)\n if rx is not None :\n rectangle.setAttribute(\"rx\",rx)\n if ry is not None :\n rectangle.setAttribute(\"ry\",ry)\n return rectangle\n \n \ndef create_square(size=2,r=None ):\n ''\n \n return create_rectangle(width=size,height=size,rx=r,ry=r)\n \n \nclass TurtleGraphicsError(Exception):\n ''\n \n pass\n \n \nclass Singleton(type):\n _instances={}\n def __call__(cls,*args,**kwargs):\n if cls not in cls._instances:\n cls._instances[cls]=super(Singleton,cls).__call__(*args,**kwargs)\n return cls._instances[cls]\n \n \nclass Screen(metaclass=Singleton):\n\n def __init__(self):\n self.shapes={\n 'arrow':(create_polygon,((-10,0),(10,0),(0,10))),\n 'turtle':(create_polygon,((0,16),(-2,14),(-1,10),(-4,7),\n (-7,9),(-9,8),(-6,5),(-7,1),(-5,-3),(-8,-6),\n (-6,-8),(-4,-5),(0,-7),(4,-5),(6,-8),(8,-6),\n (5,-3),(7,1),(6,5),(9,8),(7,9),(4,7),(1,10),\n (2,14))),\n 'classic':(create_polygon,((0,0),(-5,-9),(0,-7),(5,-9))),\n 'triangle':(create_polygon,((10,-5.77),(0,11.55),(-10,-5.77))),\n 'square':(create_square,20),\n 'circle':(create_circle,10)\n }\n self.reset()\n self._set_geometry()\n \n def bgcolor(self,color=None ):\n ''\n\n \n if color is None :\n return self.background_color\n self.background_color=color\n width=_CFG['canvwidth']\n height=_CFG['canvheight']\n if self.mode()in ['logo','standard']:\n x=-width //2\n y=-height //2\n else :\n x=0\n y=-height\n \n self.frame_index +=1\n rect=svg.rect(x=x,y=y,width=width,height=height,fill=color,\n style={'display':'none'})\n an=svg.animate(Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"display\",attributeType=\"CSS\",\n From=\"block\",to=\"block\",\n dur=_CFG[\"min_duration\"],fill='freeze')\n an.setAttribute('begin',\"animation_frame%s.end\"%(self.frame_index -1))\n rect <=an\n \n self.background_canvas <=rect\n \n def _convert_coordinates(self,x,y):\n ''\n\n\n\n\n\n \n return x *self.yscale,self.y_points_down *y *self.yscale\n \n \n def create_svg_turtle(self,_turtle,name):\n if name in self.shapes:\n fn=self.shapes[name][0]\n arg=self.shapes[name][1]\n else :\n print(\"Unknown turtle '%s'; the default turtle will be used\")\n fn=self.shapes[_CVG[\"shape\"]][0]\n arg=self.shapes[_CVG[\"shape\"]][1]\n shape=fn(arg)\n if self._mode =='standard'or self._mode =='world':\n rotation=-90\n else :\n rotation=0\n return shape,rotation\n \n def _dot(self,pos,size,color):\n ''\n if color is None :\n color='black'\n if size is None or size <1:\n size=1\n self.frame_index +=1\n \n \n radius=size /2\n \n x,y=self._convert_coordinates(pos[0],pos[1])\n \n circle=svg.circle(cx=x,cy=y,r=radius,fill=color,\n style={'display':'none'})\n an=svg.animate(Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"display\",attributeType=\"CSS\",\n From=\"block\",to=\"block\",\n dur=_CFG[\"min_duration\"],fill='freeze')\n an.setAttribute('begin',\"animation_frame%s.end\"%(self.frame_index -1))\n circle <=an\n self.canvas <=circle\n \n def _drawline(self,_turtle,coordlist=None ,\n color=None ,width=1,speed=None ):\n ''\n\n\n\n\n \n \n outline=color[0]\n fill=color[1]\n \n x0,y0=coordlist[0]\n x1,y1=coordlist[1]\n \n x0,y0=self._convert_coordinates(x0,y0)\n x1,y1=self._convert_coordinates(x1,y1)\n \n \n if speed ==0:\n duration=_CFG[\"min_duration\"]\n else :\n dist=_turtle._distance\n if speed is None or speed ==1:\n duration=0.02 *dist\n else :\n duration=0.02 *dist /speed **1.2\n if duration <0.001:\n duration=_CFG[\"min_duration\"]\n else :\n duration=\"%6.3fs\"%duration\n \n drawing=_turtle._drawing\n \n _line=svg.line(x1=x0,y1=y0,x2=x0,y2=y0,\n style={'stroke':outline,'stroke-width':width})\n if not drawing:\n _line.setAttribute('opacity',0)\n \n \n begin=\"animation_frame%s.end\"%self.frame_index\n self.frame_index +=1\n _an1=svg.animate(Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"x2\",attributeType=\"XML\",\n From=x0,to=x1,dur=duration,fill='freeze',\n begin=begin)\n _line <=_an1\n \n \n if drawing:\n _an2=svg.animate(attributeName=\"y2\",attributeType=\"XML\",\n begin=begin,\n From=y0,to=y1,dur=duration,fill='freeze')\n _line <=_an2\n \n if width >2:\n _line_cap=svg.set(attributeName=\"stroke-linecap\",\n begin=begin,\n attributeType=\"xml\",to=\"round\",dur=duration,fill='freeze')\n _line <=_line_cap\n \n self.canvas <=_line\n return begin,duration,(x0,y0),(x1,y1)\n \n def _drawpoly(self,coordlist,outline=None ,fill=None ,width=None ):\n ''\n\n\n\n\n \n self.frame_index +=1\n shape=[\"%s,%s\"%self._convert_coordinates(x,y)for x,y in coordlist]\n \n style={'display':'none'}\n if fill is not None :\n style['fill']=fill\n if outline is not None :\n style['stroke']=outline\n if width is not None :\n style['stroke-width']=width\n else :\n style['stroke-width']=1\n \n polygon=svg.polygon(points=\" \".join(shape),style=style)\n \n an=svg.animate(Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"display\",attributeType=\"CSS\",\n From=\"block\",to=\"block\",\n dur=_CFG[\"min_duration\"],fill='freeze')\n \n an.setAttribute('begin',\"animation_frame%s.end\"%(self.frame_index -1))\n polygon <=an\n self.canvas <=polygon\n \n \n def _new_frame(self):\n ''\n \n previous_end=\"animation_frame%s.end\"%self.frame_index\n self.frame_index +=1\n new_frame_id=\"animation_frame%s\"%self.frame_index\n return previous_end,new_frame_id\n \n def mode(self,_mode=None ):\n if _mode is None :\n return self._mode\n _CFG['mode']=_mode\n self.reset()\n \n \n def reset(self):\n self._turtles=[]\n self.frame_index=0\n self.background_color=\"white\"\n self._set_geometry()\n \n def _set_geometry(self):\n self.width=_CFG[\"canvwidth\"]\n self.height=_CFG[\"canvheight\"]\n self.x_offset=self.y_offset=0\n self.xscale=self.yscale=1\n \n self.y_points_down=-1\n self._mode=_CFG[\"mode\"].lower()\n if self._mode in ['logo','standard']:\n self.translate_canvas=(self.width //2,self.height //2)\n elif self._mode =='world':\n self.translate_canvas=(0,self.height)\n self._setup_canvas()\n \n def _setup_canvas(self):\n self.svg_scene=svg.svg(Id=_CFG[\"turtle_canvas_id\"],width=self.width,\n height=self.height)\n translate=\"translate(%d %d)\"%self.translate_canvas\n \n \n self.svg_scene <=svg.animate(\n Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"width\",attributeType=\"CSS\",\n From=self.width,to=self.width,begin=\"0s\",\n dur=_CFG[\"min_duration\"],fill='freeze')\n \n \n \n \n self.background_canvas=svg.g(transform=translate)\n self.canvas=svg.g(transform=translate)\n self.writing_canvas=svg.g(transform=translate)\n self.turtle_canvas=svg.g(transform=translate)\n \n self.svg_scene <=self.background_canvas\n self.svg_scene <=self.canvas\n self.svg_scene <=self.writing_canvas\n self.svg_scene <=self.turtle_canvas\n \n \n def setworldcoordinates(self,llx,lly,urx,ury):\n ''\n\n\n\n\n\n\n\n\n\n\n \n self._mode=\"world\"\n \n if urx 2:\n self.screen._drawpoly(self._fillpath,outline=self._pencolor,\n fill=self._fillcolor,)\n else :\n print(\"No path to fill.\")\n self._fillpath=None\n \n def dot(self,size=None ,color=None ):\n ''\n \n if size is None :\n size=max(self._pensize+4,2 *self._pensize)\n if color is None :\n color=self._pencolor\n item=self.screen._dot((self._x,self._y),size,color=color)\n \n def _write(self,txt,align,font,color=None ):\n ''\n \n if color is None :\n color=self._pencolor\n self.screen._write((self._x,self._y),txt,align,font,color)\n \n \n def write(self,arg,align=\"left\",font=(\"Arial\",8,\"normal\"),color=None ):\n ''\n\n\n\n\n\n\n \n self._write(str(arg),align.lower(),font,color=color)\n \n def begin_poly(self):\n ''\n \n self._poly=[(self._x,self._y)]\n self._creatingPoly=True\n \n def end_poly(self):\n ''\n \n self._creatingPoly=False\n \n def get_poly(self):\n ''\n \n \n if self._poly is not None :\n return tuple(self._poly)\n \n def getscreen(self):\n ''\n \n return self.screen\n \n def getturtle(self):\n ''\n\n\n \n return self\n getpen=getturtle\n \n def _make_copy(self,name=None ):\n ''\n\n \n \n if name is None :\n name=self.name\n \n \n \n \n \n _turtle,rotation=self.screen.create_svg_turtle(self,name=name)\n _turtle.setAttribute(\"opacity\",0)\n _turtle.setAttribute(\"fill\",self._fillcolor)\n _turtle.setAttribute(\"stroke\",self._pencolor)\n \n \n \n previous_end,new_frame_id=self.screen._new_frame()\n x,y=self.screen._convert_coordinates(self._x,self._y)\n _turtle <=svg.animateMotion(begin=previous_end,dur=_CFG[\"min_duration\"],\n fill=\"remove\")\n \n _turtle <=svg.animateMotion(Id=new_frame_id,\n From=\"%s,%s\"%(x,y),to=\"%s,%s\"%(x,y),\n dur=_CFG[\"min_duration\"],begin=previous_end,\n fill=\"freeze\")\n _turtle <=svg.animateTransform(attributeName=\"transform\",\n type=\"rotate\",\n From=\"%s,%s,%s\"%(self._old_heading,0,0),\n to=\"%s,%s,%s\"%(self._old_heading,0,0),\n begin=previous_end,\n dur=_CFG[\"min_duration\"],fill=\"freeze\")\n _turtle <=svg.animate(begin=previous_end,\n dur=_CFG[\"min_duration\"],fill=\"freeze\",\n attributeName=\"opacity\",attributeType=\"XML\",\n From=0,to=1)\n return _turtle\n \n def stamp(self):\n ''\n \n _turtle=self._make_copy(name=self.name)\n self.screen.canvas <=_turtle\n \n \n def clone(self):\n ''\n \n n=Turtle(self.name)\n \n attrs=vars(self)\n new_dict={}\n for attr in attrs:\n if isinstance(getattr(self,attr),(int,str,float)):\n new_dict[attr]=getattr(self,attr)\n n.__dict__.update(**new_dict)\n \n if not n._shown:\n n._shown=True\n n.hideturtle()\n n.left(0)\n n.fd(0)\n n.color(n.color())\n return n\n \n \nPen=Turtle\n\n\ndef done():\n Screen().show_scene()\nshow_scene=done\n\n\ndef replay_scene():\n ''\n if (_CFG[\"turtle_canvas_id\"]in document and\n document[_CFG[\"turtle_canvas_id\"]]is not None ):\n element=document[_CFG[\"turtle_canvas_id\"]]\n element.parentNode.removeChild(element)\n show_scene()\n \n \ndef restart():\n ''\n _CFG.update(_cfg_copy)\n Screen().reset()\n Turtle._pen=None\n \n if (_CFG[\"turtle_canvas_id\"]in document and\n document[_CFG[\"turtle_canvas_id\"]]is not None ):\n element=document[_CFG[\"turtle_canvas_id\"]]\n element.parentNode.removeChild(element)\n \n \n \n_tg_screen_functions=['addshape','bgcolor','bgpic','bye',\n'clearscreen','colormode','delay','exitonclick','getcanvas',\n'getshapes','listen','mainloop','mode','numinput',\n'onkey','onkeypress','onkeyrelease','onscreenclick','ontimer',\n'register_shape','resetscreen','screensize','setup',\n'setworldcoordinates','textinput','title','tracer','turtles','update',\n'window_height','window_width']\n\n_tg_turtle_functions=['back','backward','begin_fill','begin_poly','bk',\n'circle','clear','clearstamp','clearstamps','clone','color',\n'degrees','distance','dot','down','end_fill','end_poly','fd',\n'fillcolor','filling','forward','get_poly','getpen','getscreen','get_shapepoly',\n'getturtle','goto','heading','hideturtle','home','ht','isdown',\n'isvisible','left','lt','onclick','ondrag','onrelease','pd',\n'pen','pencolor','pendown','pensize','penup','pos','position',\n'pu','radians','right','reset','resizemode','rt',\n'seth','setheading','setpos','setposition','settiltangle',\n'setundobuffer','setx','sety','shape','shapesize','shapetransform','shearfactor','showturtle',\n'speed','st','stamp','tilt','tiltangle','towards',\n'turtlesize','undo','undobufferentries','up','width',\n'write','xcor','ycor']\n\n\n__all__=(_tg_screen_functions+_tg_turtle_functions+\n['done','restart','replay_scene','Turtle','Screen'])\n\n\n\n\n\n__func_body=\"\"\"\\\ndef {name}(*args, **kw):\n if {obj} is None:\n {obj} = {init}\n return {obj}.{name}(*args, **kw)\n\"\"\"\n\ndef _make_global_funcs(functions,cls,obj,init):\n for methodname in functions:\n try :\n method=getattr(cls,methodname)\n except AttributeError:\n print(\"methodname missing:\",methodname)\n continue\n defstr=__func_body.format(obj=obj,init=init,name=methodname)\n exec(defstr,globals())\n \n_make_global_funcs(_tg_turtle_functions,Turtle,'Turtle._pen','Turtle()')\n\n_make_global_funcs(_tg_screen_functions,Screen,'Turtle.screen','Screen()')\n", ["_svg", "browser", "browser.timer", "math", "sys"]], "types": [".py", "''\n\n\nimport sys\n\n\n\n\n\n\ndef _f():pass\nFunctionType=type(_f)\nLambdaType=type(lambda:None)\nCodeType=type(_f.__code__)\nMappingProxyType=type(type.__dict__)\nSimpleNamespace=type(sys.implementation)\n\ndef _cell_factory():\n a=1\n def f():\n nonlocal a\n return f.__closure__[0]\nCellType=type(_cell_factory())\n\ndef _g():\n yield 1\nGeneratorType=type(_g())\n\nasync def _c():pass\n_c=_c()\nCoroutineType=type(_c)\n_c.close()\n\nasync def _ag():\n yield\n_ag=_ag()\nAsyncGeneratorType=type(_ag)\n\nclass _C:\n def _m(self):pass\nMethodType=type(_C()._m)\n\nBuiltinFunctionType=type(len)\nBuiltinMethodType=type([].append)\n\nWrapperDescriptorType=type(object.__init__)\nMethodWrapperType=type(object().__str__)\nMethodDescriptorType=type(str.join)\nClassMethodDescriptorType=type(dict.__dict__['fromkeys'])\n\nModuleType=type(sys)\n\ntry:\n raise TypeError\nexcept TypeError as exc:\n TracebackType=type(exc.__traceback__)\n FrameType=type(exc.__traceback__.tb_frame)\n \nGetSetDescriptorType=type(FunctionType.__code__)\nMemberDescriptorType=type(FunctionType.__globals__)\n\ndel sys,_f,_g,_C,_c,_ag,_cell_factory\n\n\n\ndef new_class(name,bases=(),kwds=None,exec_body=None):\n ''\n resolved_bases=resolve_bases(bases)\n meta,ns,kwds=prepare_class(name,resolved_bases,kwds)\n if exec_body is not None:\n exec_body(ns)\n if resolved_bases is not bases:\n ns['__orig_bases__']=bases\n return meta(name,resolved_bases,ns,**kwds)\n \ndef resolve_bases(bases):\n ''\n new_bases=list(bases)\n updated=False\n shift=0\n for i,base in enumerate(bases):\n if isinstance(base,type):\n continue\n if not hasattr(base,\"__mro_entries__\"):\n continue\n new_base=base.__mro_entries__(bases)\n updated=True\n if not isinstance(new_base,tuple):\n raise TypeError(\"__mro_entries__ must return a tuple\")\n else:\n new_bases[i+shift:i+shift+1]=new_base\n shift +=len(new_base)-1\n if not updated:\n return bases\n return tuple(new_bases)\n \ndef prepare_class(name,bases=(),kwds=None):\n ''\n\n\n\n\n\n\n\n\n \n if kwds is None:\n kwds={}\n else:\n kwds=dict(kwds)\n if 'metaclass'in kwds:\n meta=kwds.pop('metaclass')\n else:\n if bases:\n meta=type(bases[0])\n else:\n meta=type\n if isinstance(meta,type):\n \n \n meta=_calculate_meta(meta,bases)\n if hasattr(meta,'__prepare__'):\n ns=meta.__prepare__(name,bases,**kwds)\n else:\n ns={}\n return meta,ns,kwds\n \ndef _calculate_meta(meta,bases):\n ''\n winner=meta\n for base in bases:\n base_meta=type(base)\n if issubclass(winner,base_meta):\n continue\n if issubclass(base_meta,winner):\n winner=base_meta\n continue\n \n raise TypeError(\"metaclass conflict: \"\n \"the metaclass of a derived class \"\n \"must be a (non-strict) subclass \"\n \"of the metaclasses of all its bases\")\n return winner\n \n \ndef get_original_bases(cls,/):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n return cls.__orig_bases__\n except AttributeError:\n try:\n return cls.__bases__\n except AttributeError:\n raise TypeError(\n f'Expected an instance of type, not {type(cls).__name__ !r}'\n )from None\n \n \nclass DynamicClassAttribute:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,fget=None,fset=None,fdel=None,doc=None):\n self.fget=fget\n self.fset=fset\n self.fdel=fdel\n \n self.__doc__=doc or fget.__doc__\n self.overwrite_doc=doc is None\n \n self.__isabstractmethod__=bool(getattr(fget,'__isabstractmethod__',False))\n \n def __get__(self,instance,ownerclass=None):\n if instance is None:\n if self.__isabstractmethod__:\n return self\n raise AttributeError()\n elif self.fget is None:\n raise AttributeError(\"unreadable attribute\")\n return self.fget(instance)\n \n def __set__(self,instance,value):\n if self.fset is None:\n raise AttributeError(\"can't set attribute\")\n self.fset(instance,value)\n \n def __delete__(self,instance):\n if self.fdel is None:\n raise AttributeError(\"can't delete attribute\")\n self.fdel(instance)\n \n def getter(self,fget):\n fdoc=fget.__doc__ if self.overwrite_doc else None\n result=type(self)(fget,self.fset,self.fdel,fdoc or self.__doc__)\n result.overwrite_doc=self.overwrite_doc\n return result\n \n def setter(self,fset):\n result=type(self)(self.fget,fset,self.fdel,self.__doc__)\n result.overwrite_doc=self.overwrite_doc\n return result\n \n def deleter(self,fdel):\n result=type(self)(self.fget,self.fset,fdel,self.__doc__)\n result.overwrite_doc=self.overwrite_doc\n return result\n \n \nclass _GeneratorWrapper:\n\n def __init__(self,gen):\n self.__wrapped=gen\n self.__isgen=gen.__class__ is GeneratorType\n self.__name__=getattr(gen,'__name__',None)\n self.__qualname__=getattr(gen,'__qualname__',None)\n def send(self,val):\n return self.__wrapped.send(val)\n def throw(self,tp,*rest):\n return self.__wrapped.throw(tp,*rest)\n def close(self):\n return self.__wrapped.close()\n @property\n def gi_code(self):\n return self.__wrapped.gi_code\n @property\n def gi_frame(self):\n return self.__wrapped.gi_frame\n @property\n def gi_running(self):\n return self.__wrapped.gi_running\n @property\n def gi_yieldfrom(self):\n return self.__wrapped.gi_yieldfrom\n cr_code=gi_code\n cr_frame=gi_frame\n cr_running=gi_running\n cr_await=gi_yieldfrom\n def __next__(self):\n return next(self.__wrapped)\n def __iter__(self):\n if self.__isgen:\n return self.__wrapped\n return self\n __await__=__iter__\n \ndef coroutine(func):\n ''\n \n if not callable(func):\n raise TypeError('types.coroutine() expects a callable')\n \n if(func.__class__ is FunctionType and\n getattr(func,'__code__',None).__class__ is CodeType):\n \n co_flags=func.__code__.co_flags\n \n \n \n if co_flags&0x180:\n return func\n \n \n \n if co_flags&0x20:\n \n co=func.__code__\n \n func.__code__=co.replace(co_flags=co.co_flags |0x100)\n return func\n \n \n \n \n \n \n import functools\n import _collections_abc\n @functools.wraps(func)\n def wrapped(*args,**kwargs):\n coro=func(*args,**kwargs)\n if(coro.__class__ is CoroutineType or\n coro.__class__ is GeneratorType and coro.gi_code.co_flags&0x100):\n \n return coro\n if(isinstance(coro,_collections_abc.Generator)and\n not isinstance(coro,_collections_abc.Coroutine)):\n \n \n \n return _GeneratorWrapper(coro)\n \n \n return coro\n \n return wrapped\n \nGenericAlias=type(list[int])\nUnionType=type(int |str)\n\nEllipsisType=type(Ellipsis)\nNoneType=type(None)\nNotImplementedType=type(NotImplemented)\n\n__all__=[n for n in globals()if n[:1]!='_']\n", ["_collections_abc", "functools", "sys"]], "typing": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfrom abc import abstractmethod,ABCMeta\nimport collections\nfrom collections import defaultdict\nimport collections.abc\nimport copyreg\nimport contextlib\nimport functools\nimport operator\nimport re as stdlib_re\nimport sys\nimport types\nimport warnings\nfrom types import WrapperDescriptorType,MethodWrapperType,MethodDescriptorType,GenericAlias\n\nfrom _typing import(\n_idfunc,\nTypeVar,\nParamSpec,\nTypeVarTuple,\nParamSpecArgs,\nParamSpecKwargs,\nTypeAliasType,\nGeneric,\n)\n\n\n__all__=[\n\n'Annotated',\n'Any',\n'Callable',\n'ClassVar',\n'Concatenate',\n'Final',\n'ForwardRef',\n'Generic',\n'Literal',\n'Optional',\n'ParamSpec',\n'Protocol',\n'Tuple',\n'Type',\n'TypeVar',\n'TypeVarTuple',\n'Union',\n\n\n'AbstractSet',\n'ByteString',\n'Container',\n'ContextManager',\n'Hashable',\n'ItemsView',\n'Iterable',\n'Iterator',\n'KeysView',\n'Mapping',\n'MappingView',\n'MutableMapping',\n'MutableSequence',\n'MutableSet',\n'Sequence',\n'Sized',\n'ValuesView',\n'Awaitable',\n'AsyncIterator',\n'AsyncIterable',\n'Coroutine',\n'Collection',\n'AsyncGenerator',\n'AsyncContextManager',\n\n\n'Reversible',\n'SupportsAbs',\n'SupportsBytes',\n'SupportsComplex',\n'SupportsFloat',\n'SupportsIndex',\n'SupportsInt',\n'SupportsRound',\n\n\n'ChainMap',\n'Counter',\n'Deque',\n'Dict',\n'DefaultDict',\n'List',\n'OrderedDict',\n'Set',\n'FrozenSet',\n'NamedTuple',\n'TypedDict',\n'Generator',\n\n\n'BinaryIO',\n'IO',\n'Match',\n'Pattern',\n'TextIO',\n\n\n'AnyStr',\n'assert_type',\n'assert_never',\n'cast',\n'clear_overloads',\n'dataclass_transform',\n'final',\n'get_args',\n'get_origin',\n'get_overloads',\n'get_type_hints',\n'is_typeddict',\n'LiteralString',\n'Never',\n'NewType',\n'no_type_check',\n'no_type_check_decorator',\n'NoReturn',\n'NotRequired',\n'overload',\n'override',\n'ParamSpecArgs',\n'ParamSpecKwargs',\n'Required',\n'reveal_type',\n'runtime_checkable',\n'Self',\n'Text',\n'TYPE_CHECKING',\n'TypeAlias',\n'TypeGuard',\n'TypeAliasType',\n'Unpack',\n]\n\n\n\n\n\n\ndef _type_convert(arg,module=None,*,allow_special_forms=False):\n ''\n if arg is None:\n return type(None)\n if isinstance(arg,str):\n return ForwardRef(arg,module=module,is_class=allow_special_forms)\n return arg\n \n \ndef _type_check(arg,msg,is_argument=True,module=None,*,allow_special_forms=False):\n ''\n\n\n\n\n\n\n\n\n\n \n invalid_generic_forms=(Generic,Protocol)\n if not allow_special_forms:\n invalid_generic_forms +=(ClassVar,)\n if is_argument:\n invalid_generic_forms +=(Final,)\n \n arg=_type_convert(arg,module=module,allow_special_forms=allow_special_forms)\n if(isinstance(arg,_GenericAlias)and\n arg.__origin__ in invalid_generic_forms):\n raise TypeError(f\"{arg} is not valid as type argument\")\n if arg in(Any,LiteralString,NoReturn,Never,Self,TypeAlias):\n return arg\n if allow_special_forms and arg in(ClassVar,Final):\n return arg\n if isinstance(arg,_SpecialForm)or arg in(Generic,Protocol):\n raise TypeError(f\"Plain {arg} is not valid as type argument\")\n if type(arg)is tuple:\n raise TypeError(f\"{msg} Got {arg !r:.100}.\")\n return arg\n \n \ndef _is_param_expr(arg):\n return arg is ...or isinstance(arg,\n (tuple,list,ParamSpec,_ConcatenateGenericAlias))\n \n \ndef _should_unflatten_callable_args(typ,args):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n return(\n typ.__origin__ is collections.abc.Callable\n and not(len(args)==2 and _is_param_expr(args[0]))\n )\n \n \ndef _type_repr(obj):\n ''\n\n\n\n\n\n \n \n \n \n if isinstance(obj,type):\n if obj.__module__ =='builtins':\n return obj.__qualname__\n return f'{obj.__module__}.{obj.__qualname__}'\n if obj is ...:\n return '...'\n if isinstance(obj,types.FunctionType):\n return obj.__name__\n if isinstance(obj,tuple):\n \n return '['+', '.join(_type_repr(t)for t in obj)+']'\n return repr(obj)\n \n \ndef _collect_parameters(args):\n ''\n\n\n\n\n\n \n parameters=[]\n for t in args:\n if isinstance(t,type):\n \n pass\n elif isinstance(t,tuple):\n \n \n for x in t:\n for collected in _collect_parameters([x]):\n if collected not in parameters:\n parameters.append(collected)\n elif hasattr(t,'__typing_subst__'):\n if t not in parameters:\n parameters.append(t)\n else:\n for x in getattr(t,'__parameters__',()):\n if x not in parameters:\n parameters.append(x)\n return tuple(parameters)\n \n \ndef _check_generic(cls,parameters,elen):\n ''\n\n\n \n if not elen:\n raise TypeError(f\"{cls} is not a generic class\")\n alen=len(parameters)\n if alen !=elen:\n raise TypeError(f\"Too {'many'if alen >elen else 'few'} arguments for {cls};\"\n f\" actual {alen}, expected {elen}\")\n \ndef _unpack_args(args):\n newargs=[]\n for arg in args:\n subargs=getattr(arg,'__typing_unpacked_tuple_args__',None)\n if subargs is not None and not(subargs and subargs[-1]is ...):\n newargs.extend(subargs)\n else:\n newargs.append(arg)\n return newargs\n \ndef _deduplicate(params):\n\n all_params=set(params)\n if len(all_params)','eval')\n except SyntaxError:\n raise SyntaxError(f\"Forward reference must be an expression -- got {arg !r}\")\n \n self.__forward_arg__=arg\n self.__forward_code__=code\n self.__forward_evaluated__=False\n self.__forward_value__=None\n self.__forward_is_argument__=is_argument\n self.__forward_is_class__=is_class\n self.__forward_module__=module\n \n def _evaluate(self,globalns,localns,recursive_guard):\n if self.__forward_arg__ in recursive_guard:\n return self\n if not self.__forward_evaluated__ or localns is not globalns:\n if globalns is None and localns is None:\n globalns=localns={}\n elif globalns is None:\n globalns=localns\n elif localns is None:\n localns=globalns\n if self.__forward_module__ is not None:\n globalns=getattr(\n sys.modules.get(self.__forward_module__,None),'__dict__',globalns\n )\n type_=_type_check(\n eval(self.__forward_code__,globalns,localns),\n \"Forward references must evaluate to types.\",\n is_argument=self.__forward_is_argument__,\n allow_special_forms=self.__forward_is_class__,\n )\n self.__forward_value__=_eval_type(\n type_,globalns,localns,recursive_guard |{self.__forward_arg__}\n )\n self.__forward_evaluated__=True\n return self.__forward_value__\n \n def __eq__(self,other):\n if not isinstance(other,ForwardRef):\n return NotImplemented\n if self.__forward_evaluated__ and other.__forward_evaluated__:\n return(self.__forward_arg__ ==other.__forward_arg__ and\n self.__forward_value__ ==other.__forward_value__)\n return(self.__forward_arg__ ==other.__forward_arg__ and\n self.__forward_module__ ==other.__forward_module__)\n \n def __hash__(self):\n return hash((self.__forward_arg__,self.__forward_module__))\n \n def __or__(self,other):\n return Union[self,other]\n \n def __ror__(self,other):\n return Union[other,self]\n \n def __repr__(self):\n if self.__forward_module__ is None:\n module_repr=''\n else:\n module_repr=f', module={self.__forward_module__ !r}'\n return f'ForwardRef({self.__forward_arg__ !r}{module_repr})'\n \n \ndef _is_unpacked_typevartuple(x:Any)->bool:\n return((not isinstance(x,type))and\n getattr(x,'__typing_is_unpacked_typevartuple__',False))\n \n \ndef _is_typevar_like(x:Any)->bool:\n return isinstance(x,(TypeVar,ParamSpec))or _is_unpacked_typevartuple(x)\n \n \nclass _PickleUsingNameMixin:\n ''\n \n def __reduce__(self):\n return self.__name__\n \n \ndef _typevar_subst(self,arg):\n msg=\"Parameters to generic types must be types.\"\n arg=_type_check(arg,msg,is_argument=True)\n if((isinstance(arg,_GenericAlias)and arg.__origin__ is Unpack)or\n (isinstance(arg,GenericAlias)and getattr(arg,'__unpacked__',False))):\n raise TypeError(f\"{arg} is not valid as type argument\")\n return arg\n \n \ndef _typevartuple_prepare_subst(self,alias,args):\n params=alias.__parameters__\n typevartuple_index=params.index(self)\n for param in params[typevartuple_index+1:]:\n if isinstance(param,TypeVarTuple):\n raise TypeError(f\"More than one TypeVarTuple parameter in {alias}\")\n \n alen=len(args)\n plen=len(params)\n left=typevartuple_index\n right=plen -typevartuple_index -1\n var_tuple_index=None\n fillarg=None\n for k,arg in enumerate(args):\n if not isinstance(arg,type):\n subargs=getattr(arg,'__typing_unpacked_tuple_args__',None)\n if subargs and len(subargs)==2 and subargs[-1]is ...:\n if var_tuple_index is not None:\n raise TypeError(\"More than one unpacked arbitrary-length tuple argument\")\n var_tuple_index=k\n fillarg=subargs[0]\n if var_tuple_index is not None:\n left=min(left,var_tuple_index)\n right=min(right,alen -var_tuple_index -1)\n elif left+right >alen:\n raise TypeError(f\"Too few arguments for {alias};\"\n f\" actual {alen}, expected at least {plen -1}\")\n \n return(\n *args[:left],\n *([fillarg]*(typevartuple_index -left)),\n tuple(args[left:alen -right]),\n *([fillarg]*(plen -right -left -typevartuple_index -1)),\n *args[alen -right:],\n )\n \n \ndef _paramspec_subst(self,arg):\n if isinstance(arg,(list,tuple)):\n arg=tuple(_type_check(a,\"Expected a type.\")for a in arg)\n elif not _is_param_expr(arg):\n raise TypeError(f\"Expected a list of types, an ellipsis, \"\n f\"ParamSpec, or Concatenate. Got {arg}\")\n return arg\n \n \ndef _paramspec_prepare_subst(self,alias,args):\n params=alias.__parameters__\n i=params.index(self)\n if i >=len(args):\n raise TypeError(f\"Too few arguments for {alias}\")\n \n if len(params)==1 and not _is_param_expr(args[0]):\n assert i ==0\n args=(args,)\n \n elif isinstance(args[i],list):\n args=(*args[:i],tuple(args[i]),*args[i+1:])\n return args\n \n \n@_tp_cache\ndef _generic_class_getitem(cls,params):\n ''\n\n\n\n\n\n\n\n \n if not isinstance(params,tuple):\n params=(params,)\n \n params=tuple(_type_convert(p)for p in params)\n is_generic_or_protocol=cls in(Generic,Protocol)\n \n if is_generic_or_protocol:\n \n if not params:\n raise TypeError(\n f\"Parameter list to {cls.__qualname__}[...] cannot be empty\"\n )\n if not all(_is_typevar_like(p)for p in params):\n raise TypeError(\n f\"Parameters to {cls.__name__}[...] must all be type variables \"\n f\"or parameter specification variables.\")\n if len(set(params))!=len(params):\n raise TypeError(\n f\"Parameters to {cls.__name__}[...] must all be unique\")\n else:\n \n for param in cls.__parameters__:\n prepare=getattr(param,'__typing_prepare_subst__',None)\n if prepare is not None:\n params=prepare(cls,params)\n _check_generic(cls,params,len(cls.__parameters__))\n \n new_args=[]\n for param,new_arg in zip(cls.__parameters__,params):\n if isinstance(param,TypeVarTuple):\n new_args.extend(new_arg)\n else:\n new_args.append(new_arg)\n params=tuple(new_args)\n \n return _GenericAlias(cls,params)\n \n \ndef _generic_init_subclass(cls,*args,**kwargs):\n super(Generic,cls).__init_subclass__(*args,**kwargs)\n tvars=[]\n if '__orig_bases__'in cls.__dict__:\n error=Generic in cls.__orig_bases__\n else:\n error=(Generic in cls.__bases__ and\n cls.__name__ !='Protocol'and\n type(cls)!=_TypedDictMeta)\n if error:\n raise TypeError(\"Cannot inherit from plain Generic\")\n if '__orig_bases__'in cls.__dict__:\n tvars=_collect_parameters(cls.__orig_bases__)\n \n \n \n \n \n gvars=None\n for base in cls.__orig_bases__:\n if(isinstance(base,_GenericAlias)and\n base.__origin__ is Generic):\n if gvars is not None:\n raise TypeError(\n \"Cannot inherit from Generic[...] multiple times.\")\n gvars=base.__parameters__\n if gvars is not None:\n tvarset=set(tvars)\n gvarset=set(gvars)\n if not tvarset <=gvarset:\n s_vars=', '.join(str(t)for t in tvars if t not in gvarset)\n s_args=', '.join(str(g)for g in gvars)\n raise TypeError(f\"Some type variables ({s_vars}) are\"\n f\" not listed in Generic[{s_args}]\")\n tvars=gvars\n cls.__parameters__=tuple(tvars)\n \n \ndef _is_dunder(attr):\n return attr.startswith('__')and attr.endswith('__')\n \nclass _BaseGenericAlias(_Final,_root=True):\n ''\n\n\n\n\n\n\n \n \n def __init__(self,origin,*,inst=True,name=None):\n self._inst=inst\n self._name=name\n self.__origin__=origin\n self.__slots__=None\n \n def __call__(self,*args,**kwargs):\n if not self._inst:\n raise TypeError(f\"Type {self._name} cannot be instantiated; \"\n f\"use {self.__origin__.__name__}() instead\")\n result=self.__origin__(*args,**kwargs)\n try:\n result.__orig_class__=self\n except AttributeError:\n pass\n return result\n \n def __mro_entries__(self,bases):\n res=[]\n if self.__origin__ not in bases:\n res.append(self.__origin__)\n i=bases.index(self)\n for b in bases[i+1:]:\n if isinstance(b,_BaseGenericAlias)or issubclass(b,Generic):\n break\n else:\n res.append(Generic)\n return tuple(res)\n \n def __getattr__(self,attr):\n if attr in{'__name__','__qualname__'}:\n return self._name or self.__origin__.__name__\n \n \n \n if '__origin__'in self.__dict__ and not _is_dunder(attr):\n return getattr(self.__origin__,attr)\n raise AttributeError(attr)\n \n def __setattr__(self,attr,val):\n if _is_dunder(attr)or attr in{'_name','_inst','_nparams'}:\n super().__setattr__(attr,val)\n else:\n setattr(self.__origin__,attr,val)\n \n def __instancecheck__(self,obj):\n return self.__subclasscheck__(type(obj))\n \n def __subclasscheck__(self,cls):\n raise TypeError(\"Subscripted generics cannot be used with\"\n \" class and instance checks\")\n \n def __dir__(self):\n return list(set(super().__dir__()\n +[attr for attr in dir(self.__origin__)if not _is_dunder(attr)]))\n \n \n \n \n \n \n \n \n \n \n \n \n \nclass _GenericAlias(_BaseGenericAlias,_root=True):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n def __init__(self,origin,args,*,inst=True,name=None):\n super().__init__(origin,inst=inst,name=name)\n if not isinstance(args,tuple):\n args=(args,)\n self.__args__=tuple(...if a is _TypingEllipsis else\n a for a in args)\n self.__parameters__=_collect_parameters(args)\n if not name:\n self.__module__=origin.__module__\n \n def __eq__(self,other):\n if not isinstance(other,_GenericAlias):\n return NotImplemented\n return(self.__origin__ ==other.__origin__\n and self.__args__ ==other.__args__)\n \n def __hash__(self):\n return hash((self.__origin__,self.__args__))\n \n def __or__(self,right):\n return Union[self,right]\n \n def __ror__(self,left):\n return Union[left,self]\n \n @_tp_cache\n def __getitem__(self,args):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if self.__origin__ in(Generic,Protocol):\n \n raise TypeError(f\"Cannot subscript already-subscripted {self}\")\n if not self.__parameters__:\n raise TypeError(f\"{self} is not a generic class\")\n \n \n if not isinstance(args,tuple):\n args=(args,)\n args=tuple(_type_convert(p)for p in args)\n args=_unpack_args(args)\n new_args=self._determine_new_args(args)\n r=self.copy_with(new_args)\n return r\n \n def _determine_new_args(self,args):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n params=self.__parameters__\n \n for param in params:\n prepare=getattr(param,'__typing_prepare_subst__',None)\n if prepare is not None:\n args=prepare(self,args)\n alen=len(args)\n plen=len(params)\n if alen !=plen:\n raise TypeError(f\"Too {'many'if alen >plen else 'few'} arguments for {self};\"\n f\" actual {alen}, expected {plen}\")\n new_arg_by_param=dict(zip(params,args))\n return tuple(self._make_substitution(self.__args__,new_arg_by_param))\n \n def _make_substitution(self,args,new_arg_by_param):\n ''\n new_args=[]\n for old_arg in args:\n if isinstance(old_arg,type):\n new_args.append(old_arg)\n continue\n \n substfunc=getattr(old_arg,'__typing_subst__',None)\n if substfunc:\n new_arg=substfunc(new_arg_by_param[old_arg])\n else:\n subparams=getattr(old_arg,'__parameters__',())\n if not subparams:\n new_arg=old_arg\n else:\n subargs=[]\n for x in subparams:\n if isinstance(x,TypeVarTuple):\n subargs.extend(new_arg_by_param[x])\n else:\n subargs.append(new_arg_by_param[x])\n new_arg=old_arg[tuple(subargs)]\n \n if self.__origin__ ==collections.abc.Callable and isinstance(new_arg,tuple):\n \n \n \n \n \n \n \n \n \n \n new_args.extend(new_arg)\n elif _is_unpacked_typevartuple(old_arg):\n \n \n \n \n \n \n \n \n \n new_args.extend(new_arg)\n elif isinstance(old_arg,tuple):\n \n \n \n \n \n \n \n new_args.append(\n tuple(self._make_substitution(old_arg,new_arg_by_param)),\n )\n else:\n new_args.append(new_arg)\n return new_args\n \n def copy_with(self,args):\n return self.__class__(self.__origin__,args,name=self._name,inst=self._inst)\n \n def __repr__(self):\n if self._name:\n name='typing.'+self._name\n else:\n name=_type_repr(self.__origin__)\n if self.__args__:\n args=\", \".join([_type_repr(a)for a in self.__args__])\n else:\n \n args=\"()\"\n return f'{name}[{args}]'\n \n def __reduce__(self):\n if self._name:\n origin=globals()[self._name]\n else:\n origin=self.__origin__\n args=tuple(self.__args__)\n if len(args)==1 and not isinstance(args[0],tuple):\n args,=args\n return operator.getitem,(origin,args)\n \n def __mro_entries__(self,bases):\n if isinstance(self.__origin__,_SpecialForm):\n raise TypeError(f\"Cannot subclass {self !r}\")\n \n if self._name:\n return super().__mro_entries__(bases)\n if self.__origin__ is Generic:\n if Protocol in bases:\n return()\n i=bases.index(self)\n for b in bases[i+1:]:\n if isinstance(b,_BaseGenericAlias)and b is not self:\n return()\n return(self.__origin__,)\n \n def __iter__(self):\n yield Unpack[self]\n \n \n \n \n \n \nclass _SpecialGenericAlias(_NotIterable,_BaseGenericAlias,_root=True):\n def __init__(self,origin,nparams,*,inst=True,name=None):\n if name is None:\n name=origin.__name__\n super().__init__(origin,inst=inst,name=name)\n self._nparams=nparams\n if origin.__module__ =='builtins':\n self.__doc__=f'A generic version of {origin.__qualname__}.'\n else:\n self.__doc__=f'A generic version of {origin.__module__}.{origin.__qualname__}.'\n \n @_tp_cache\n def __getitem__(self,params):\n if not isinstance(params,tuple):\n params=(params,)\n msg=\"Parameters to generic types must be types.\"\n params=tuple(_type_check(p,msg)for p in params)\n _check_generic(self,params,self._nparams)\n return self.copy_with(params)\n \n def copy_with(self,params):\n return _GenericAlias(self.__origin__,params,\n name=self._name,inst=self._inst)\n \n def __repr__(self):\n return 'typing.'+self._name\n \n def __subclasscheck__(self,cls):\n if isinstance(cls,_SpecialGenericAlias):\n return issubclass(cls.__origin__,self.__origin__)\n if not isinstance(cls,_GenericAlias):\n return issubclass(cls,self.__origin__)\n return super().__subclasscheck__(cls)\n \n def __reduce__(self):\n return self._name\n \n def __or__(self,right):\n return Union[self,right]\n \n def __ror__(self,left):\n return Union[left,self]\n \n \nclass _DeprecatedGenericAlias(_SpecialGenericAlias,_root=True):\n def __init__(\n self,origin,nparams,*,removal_version,inst=True,name=None\n ):\n super().__init__(origin,nparams,inst=inst,name=name)\n self._removal_version=removal_version\n \n def __instancecheck__(self,inst):\n import warnings\n warnings._deprecated(\n f\"{self.__module__}.{self._name}\",remove=self._removal_version\n )\n return super().__instancecheck__(inst)\n \n \nclass _CallableGenericAlias(_NotIterable,_GenericAlias,_root=True):\n def __repr__(self):\n assert self._name =='Callable'\n args=self.__args__\n if len(args)==2 and _is_param_expr(args[0]):\n return super().__repr__()\n return(f'typing.Callable'\n f'[[{\", \".join([_type_repr(a)for a in args[:-1]])}], '\n f'{_type_repr(args[-1])}]')\n \n def __reduce__(self):\n args=self.__args__\n if not(len(args)==2 and _is_param_expr(args[0])):\n args=list(args[:-1]),args[-1]\n return operator.getitem,(Callable,args)\n \n \nclass _CallableType(_SpecialGenericAlias,_root=True):\n def copy_with(self,params):\n return _CallableGenericAlias(self.__origin__,params,\n name=self._name,inst=self._inst)\n \n def __getitem__(self,params):\n if not isinstance(params,tuple)or len(params)!=2:\n raise TypeError(\"Callable must be used as \"\n \"Callable[[arg, ...], result].\")\n args,result=params\n \n \n \n if isinstance(args,list):\n params=(tuple(args),result)\n else:\n params=(args,result)\n return self.__getitem_inner__(params)\n \n @_tp_cache\n def __getitem_inner__(self,params):\n args,result=params\n msg=\"Callable[args, result]: result must be a type.\"\n result=_type_check(result,msg)\n if args is Ellipsis:\n return self.copy_with((_TypingEllipsis,result))\n if not isinstance(args,tuple):\n args=(args,)\n args=tuple(_type_convert(arg)for arg in args)\n params=args+(result,)\n return self.copy_with(params)\n \n \nclass _TupleType(_SpecialGenericAlias,_root=True):\n @_tp_cache\n def __getitem__(self,params):\n if not isinstance(params,tuple):\n params=(params,)\n if len(params)>=2 and params[-1]is ...:\n msg=\"Tuple[t, ...]: t must be a type.\"\n params=tuple(_type_check(p,msg)for p in params[:-1])\n return self.copy_with((*params,_TypingEllipsis))\n msg=\"Tuple[t0, t1, ...]: each t must be a type.\"\n params=tuple(_type_check(p,msg)for p in params)\n return self.copy_with(params)\n \n \nclass _UnionGenericAlias(_NotIterable,_GenericAlias,_root=True):\n def copy_with(self,params):\n return Union[params]\n \n def __eq__(self,other):\n if not isinstance(other,(_UnionGenericAlias,types.UnionType)):\n return NotImplemented\n return set(self.__args__)==set(other.__args__)\n \n def __hash__(self):\n return hash(frozenset(self.__args__))\n \n def __repr__(self):\n args=self.__args__\n if len(args)==2:\n if args[0]is type(None):\n return f'typing.Optional[{_type_repr(args[1])}]'\n elif args[1]is type(None):\n return f'typing.Optional[{_type_repr(args[0])}]'\n return super().__repr__()\n \n def __instancecheck__(self,obj):\n return self.__subclasscheck__(type(obj))\n \n def __subclasscheck__(self,cls):\n for arg in self.__args__:\n if issubclass(cls,arg):\n return True\n \n def __reduce__(self):\n func,(origin,args)=super().__reduce__()\n return func,(Union,args)\n \n \ndef _value_and_type_iter(parameters):\n return((p,type(p))for p in parameters)\n \n \nclass _LiteralGenericAlias(_GenericAlias,_root=True):\n def __eq__(self,other):\n if not isinstance(other,_LiteralGenericAlias):\n return NotImplemented\n \n return set(_value_and_type_iter(self.__args__))==set(_value_and_type_iter(other.__args__))\n \n def __hash__(self):\n return hash(frozenset(_value_and_type_iter(self.__args__)))\n \n \nclass _ConcatenateGenericAlias(_GenericAlias,_root=True):\n def copy_with(self,params):\n if isinstance(params[-1],(list,tuple)):\n return(*params[:-1],*params[-1])\n if isinstance(params[-1],_ConcatenateGenericAlias):\n params=(*params[:-1],*params[-1].__args__)\n return super().copy_with(params)\n \n \n@_SpecialForm\ndef Unpack(self,parameters):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n item=_type_check(parameters,f'{self} accepts only single type.')\n return _UnpackGenericAlias(origin=self,args=(item,))\n \n \nclass _UnpackGenericAlias(_GenericAlias,_root=True):\n def __repr__(self):\n \n \n return f'typing.Unpack[{_type_repr(self.__args__[0])}]'\n \n def __getitem__(self,args):\n if self.__typing_is_unpacked_typevartuple__:\n return args\n return super().__getitem__(args)\n \n @property\n def __typing_unpacked_tuple_args__(self):\n assert self.__origin__ is Unpack\n assert len(self.__args__)==1\n arg,=self.__args__\n if isinstance(arg,_GenericAlias):\n assert arg.__origin__ is tuple\n return arg.__args__\n return None\n \n @property\n def __typing_is_unpacked_typevartuple__(self):\n assert self.__origin__ is Unpack\n assert len(self.__args__)==1\n return isinstance(self.__args__[0],TypeVarTuple)\n \n \nclass _TypingEllipsis:\n ''\n \n \n_TYPING_INTERNALS=frozenset({\n'__parameters__','__orig_bases__','__orig_class__',\n'_is_protocol','_is_runtime_protocol','__protocol_attrs__',\n'__callable_proto_members_only__','__type_params__',\n})\n\n_SPECIAL_NAMES=frozenset({\n'__abstractmethods__','__annotations__','__dict__','__doc__',\n'__init__','__module__','__new__','__slots__',\n'__subclasshook__','__weakref__','__class_getitem__'\n})\n\n\nEXCLUDED_ATTRIBUTES=_TYPING_INTERNALS |_SPECIAL_NAMES |{'_MutableMapping__marker'}\n\n\ndef _get_protocol_attrs(cls):\n ''\n\n\n\n \n attrs=set()\n for base in cls.__mro__[:-1]:\n if base.__name__ in{'Protocol','Generic'}:\n continue\n annotations=getattr(base,'__annotations__',{})\n for attr in(*base.__dict__,*annotations):\n if not attr.startswith('_abc_')and attr not in EXCLUDED_ATTRIBUTES:\n attrs.add(attr)\n return attrs\n \n \ndef _no_init_or_replace_init(self,*args,**kwargs):\n cls=type(self)\n \n if cls._is_protocol:\n raise TypeError('Protocols cannot be instantiated')\n \n \n \n if cls.__init__ is not _no_init_or_replace_init:\n return\n \n \n \n \n \n \n \n for base in cls.__mro__:\n init=base.__dict__.get('__init__',_no_init_or_replace_init)\n if init is not _no_init_or_replace_init:\n cls.__init__=init\n break\n else:\n \n cls.__init__=object.__init__\n \n cls.__init__(self,*args,**kwargs)\n \n \ndef _caller(depth=1,default='__main__'):\n try:\n return sys._getframemodulename(depth+1)or default\n except AttributeError:\n pass\n try:\n return sys._getframe(depth+1).f_globals.get('__name__',default)\n except(AttributeError,ValueError):\n pass\n return None\n \ndef _allow_reckless_class_checks(depth=2):\n ''\n\n\n\n \n return _caller(depth)in{'abc','functools',None}\n \n \n_PROTO_ALLOWLIST={\n'collections.abc':[\n'Callable','Awaitable','Iterable','Iterator','AsyncIterable',\n'Hashable','Sized','Container','Collection','Reversible','Buffer',\n],\n'contextlib':['AbstractContextManager','AbstractAsyncContextManager'],\n}\n\n\n@functools.cache\ndef _lazy_load_getattr_static():\n\n\n from inspect import getattr_static\n return getattr_static\n \n \n_cleanups.append(_lazy_load_getattr_static.cache_clear)\n\ndef _pickle_psargs(psargs):\n return ParamSpecArgs,(psargs.__origin__,)\n \ncopyreg.pickle(ParamSpecArgs,_pickle_psargs)\n\ndef _pickle_pskwargs(pskwargs):\n return ParamSpecKwargs,(pskwargs.__origin__,)\n \ncopyreg.pickle(ParamSpecKwargs,_pickle_pskwargs)\n\ndel _pickle_psargs,_pickle_pskwargs\n\n\nclass _ProtocolMeta(ABCMeta):\n\n\n def __new__(mcls,name,bases,namespace,/,**kwargs):\n if name ==\"Protocol\"and bases ==(Generic,):\n pass\n elif Protocol in bases:\n for base in bases:\n if not(\n base in{object,Generic}\n or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__,[])\n or(\n issubclass(base,Generic)\n and getattr(base,\"_is_protocol\",False)\n )\n ):\n raise TypeError(\n f\"Protocols can only inherit from other protocols, \"\n f\"got {base !r}\"\n )\n return super().__new__(mcls,name,bases,namespace,**kwargs)\n \n def __init__(cls,*args,**kwargs):\n super().__init__(*args,**kwargs)\n if getattr(cls,\"_is_protocol\",False):\n cls.__protocol_attrs__=_get_protocol_attrs(cls)\n \n \n cls.__callable_proto_members_only__=all(\n callable(getattr(cls,attr,None))for attr in cls.__protocol_attrs__\n )\n \n def __subclasscheck__(cls,other):\n if cls is Protocol:\n return type.__subclasscheck__(cls,other)\n if(\n getattr(cls,'_is_protocol',False)\n and not _allow_reckless_class_checks()\n ):\n if not isinstance(other,type):\n \n raise TypeError('issubclass() arg 1 must be a class')\n if(\n not cls.__callable_proto_members_only__\n and cls.__dict__.get(\"__subclasshook__\")is _proto_hook\n ):\n raise TypeError(\n \"Protocols with non-method members don't support issubclass()\"\n )\n if not getattr(cls,'_is_runtime_protocol',False):\n raise TypeError(\n \"Instance and class checks can only be used with \"\n \"@runtime_checkable protocols\"\n )\n return super().__subclasscheck__(other)\n \n def __instancecheck__(cls,instance):\n \n \n if cls is Protocol:\n return type.__instancecheck__(cls,instance)\n if not getattr(cls,\"_is_protocol\",False):\n \n return super().__instancecheck__(instance)\n \n if(\n not getattr(cls,'_is_runtime_protocol',False)and\n not _allow_reckless_class_checks()\n ):\n raise TypeError(\"Instance and class checks can only be used with\"\n \" @runtime_checkable protocols\")\n \n if super().__instancecheck__(instance):\n return True\n \n getattr_static=_lazy_load_getattr_static()\n for attr in cls.__protocol_attrs__:\n try:\n val=getattr_static(instance,attr)\n except AttributeError:\n break\n if val is None and callable(getattr(cls,attr,None)):\n break\n else:\n return True\n \n return False\n \n \n@classmethod\ndef _proto_hook(cls,other):\n if not cls.__dict__.get('_is_protocol',False):\n return NotImplemented\n \n for attr in cls.__protocol_attrs__:\n for base in other.__mro__:\n \n if attr in base.__dict__:\n if base.__dict__[attr]is None:\n return NotImplemented\n break\n \n \n annotations=getattr(base,'__annotations__',{})\n if(isinstance(annotations,collections.abc.Mapping)and\n attr in annotations and\n issubclass(other,Generic)and getattr(other,'_is_protocol',False)):\n break\n else:\n return NotImplemented\n return True\n \n \nclass Protocol(Generic,metaclass=_ProtocolMeta):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=()\n _is_protocol=True\n _is_runtime_protocol=False\n \n def __init_subclass__(cls,*args,**kwargs):\n super().__init_subclass__(*args,**kwargs)\n \n \n if not cls.__dict__.get('_is_protocol',False):\n cls._is_protocol=any(b is Protocol for b in cls.__bases__)\n \n \n if '__subclasshook__'not in cls.__dict__:\n cls.__subclasshook__=_proto_hook\n \n \n if cls._is_protocol and cls.__init__ is Protocol.__init__:\n cls.__init__=_no_init_or_replace_init\n \n \nclass _AnnotatedAlias(_NotIterable,_GenericAlias,_root=True):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,origin,metadata):\n if isinstance(origin,_AnnotatedAlias):\n metadata=origin.__metadata__+metadata\n origin=origin.__origin__\n super().__init__(origin,origin,name='Annotated')\n self.__metadata__=metadata\n \n def copy_with(self,params):\n assert len(params)==1\n new_type=params[0]\n return _AnnotatedAlias(new_type,self.__metadata__)\n \n def __repr__(self):\n return \"typing.Annotated[{}, {}]\".format(\n _type_repr(self.__origin__),\n \", \".join(repr(a)for a in self.__metadata__)\n )\n \n def __reduce__(self):\n return operator.getitem,(\n Annotated,(self.__origin__,)+self.__metadata__\n )\n \n def __eq__(self,other):\n if not isinstance(other,_AnnotatedAlias):\n return NotImplemented\n return(self.__origin__ ==other.__origin__\n and self.__metadata__ ==other.__metadata__)\n \n def __hash__(self):\n return hash((self.__origin__,self.__metadata__))\n \n def __getattr__(self,attr):\n if attr in{'__name__','__qualname__'}:\n return 'Annotated'\n return super().__getattr__(attr)\n \n def __mro_entries__(self,bases):\n return(self.__origin__,)\n \n \nclass Annotated:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n def __new__(cls,*args,**kwargs):\n raise TypeError(\"Type Annotated cannot be instantiated.\")\n \n @_tp_cache\n def __class_getitem__(cls,params):\n if not isinstance(params,tuple)or len(params)<2:\n raise TypeError(\"Annotated[...] should be used \"\n \"with at least two arguments (a type and an \"\n \"annotation).\")\n if _is_unpacked_typevartuple(params[0]):\n raise TypeError(\"Annotated[...] should not be used with an \"\n \"unpacked TypeVarTuple\")\n msg=\"Annotated[t, ...]: t must be a type.\"\n origin=_type_check(params[0],msg,allow_special_forms=True)\n metadata=tuple(params[1:])\n return _AnnotatedAlias(origin,metadata)\n \n def __init_subclass__(cls,*args,**kwargs):\n raise TypeError(\n \"Cannot subclass {}.Annotated\".format(cls.__module__)\n )\n \n \ndef runtime_checkable(cls):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not issubclass(cls,Generic)or not getattr(cls,'_is_protocol',False):\n raise TypeError('@runtime_checkable can be only applied to protocol classes,'\n ' got %r'%cls)\n cls._is_runtime_protocol=True\n return cls\n \n \ndef cast(typ,val):\n ''\n\n\n\n\n\n \n return val\n \n \ndef assert_type(val,typ,/):\n ''\n\n\n\n\n\n\n\n\n\n\n \n return val\n \n \n_allowed_types=(types.FunctionType,types.BuiltinFunctionType,\ntypes.MethodType,types.ModuleType,\nWrapperDescriptorType,MethodWrapperType,MethodDescriptorType)\n\n\ndef get_type_hints(obj,globalns=None,localns=None,include_extras=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if getattr(obj,'__no_type_check__',None):\n return{}\n \n if isinstance(obj,type):\n hints={}\n for base in reversed(obj.__mro__):\n if globalns is None:\n base_globals=getattr(sys.modules.get(base.__module__,None),'__dict__',{})\n else:\n base_globals=globalns\n ann=base.__dict__.get('__annotations__',{})\n if isinstance(ann,types.GetSetDescriptorType):\n ann={}\n base_locals=dict(vars(base))if localns is None else localns\n if localns is None and globalns is None:\n \n \n \n \n \n \n base_globals,base_locals=base_locals,base_globals\n for name,value in ann.items():\n if value is None:\n value=type(None)\n if isinstance(value,str):\n value=ForwardRef(value,is_argument=False,is_class=True)\n value=_eval_type(value,base_globals,base_locals)\n hints[name]=value\n return hints if include_extras else{k:_strip_annotations(t)for k,t in hints.items()}\n \n if globalns is None:\n if isinstance(obj,types.ModuleType):\n globalns=obj.__dict__\n else:\n nsobj=obj\n \n while hasattr(nsobj,'__wrapped__'):\n nsobj=nsobj.__wrapped__\n globalns=getattr(nsobj,'__globals__',{})\n if localns is None:\n localns=globalns\n elif localns is None:\n localns=globalns\n hints=getattr(obj,'__annotations__',None)\n if hints is None:\n \n if isinstance(obj,_allowed_types):\n return{}\n else:\n raise TypeError('{!r} is not a module, class, method, '\n 'or function.'.format(obj))\n hints=dict(hints)\n for name,value in hints.items():\n if value is None:\n value=type(None)\n if isinstance(value,str):\n \n \n value=ForwardRef(\n value,\n is_argument=not isinstance(obj,types.ModuleType),\n is_class=False,\n )\n hints[name]=_eval_type(value,globalns,localns)\n return hints if include_extras else{k:_strip_annotations(t)for k,t in hints.items()}\n \n \ndef _strip_annotations(t):\n ''\n if isinstance(t,_AnnotatedAlias):\n return _strip_annotations(t.__origin__)\n if hasattr(t,\"__origin__\")and t.__origin__ in(Required,NotRequired):\n return _strip_annotations(t.__args__[0])\n if isinstance(t,_GenericAlias):\n stripped_args=tuple(_strip_annotations(a)for a in t.__args__)\n if stripped_args ==t.__args__:\n return t\n return t.copy_with(stripped_args)\n if isinstance(t,GenericAlias):\n stripped_args=tuple(_strip_annotations(a)for a in t.__args__)\n if stripped_args ==t.__args__:\n return t\n return GenericAlias(t.__origin__,stripped_args)\n if isinstance(t,types.UnionType):\n stripped_args=tuple(_strip_annotations(a)for a in t.__args__)\n if stripped_args ==t.__args__:\n return t\n return functools.reduce(operator.or_,stripped_args)\n \n return t\n \n \ndef get_origin(tp):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(tp,_AnnotatedAlias):\n return Annotated\n if isinstance(tp,(_BaseGenericAlias,GenericAlias,\n ParamSpecArgs,ParamSpecKwargs)):\n return tp.__origin__\n if tp is Generic:\n return Generic\n if isinstance(tp,types.UnionType):\n return types.UnionType\n return None\n \n \ndef get_args(tp):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(tp,_AnnotatedAlias):\n return(tp.__origin__,)+tp.__metadata__\n if isinstance(tp,(_GenericAlias,GenericAlias)):\n res=tp.__args__\n if _should_unflatten_callable_args(tp,res):\n res=(list(res[:-1]),res[-1])\n return res\n if isinstance(tp,types.UnionType):\n return tp.__args__\n return()\n \n \ndef is_typeddict(tp):\n ''\n\n\n\n\n\n\n\n\n\n \n return isinstance(tp,_TypedDictMeta)\n \n \n_ASSERT_NEVER_REPR_MAX_LENGTH=100\n\n\ndef assert_never(arg:Never,/)->Never:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n value=repr(arg)\n if len(value)>_ASSERT_NEVER_REPR_MAX_LENGTH:\n value=value[:_ASSERT_NEVER_REPR_MAX_LENGTH]+'...'\n raise AssertionError(f\"Expected code to be unreachable, but got: {value}\")\n \n \ndef no_type_check(arg):\n ''\n\n\n\n\n\n\n \n if isinstance(arg,type):\n for key in dir(arg):\n obj=getattr(arg,key)\n if(\n not hasattr(obj,'__qualname__')\n or obj.__qualname__ !=f'{arg.__qualname__}.{obj.__name__}'\n or getattr(obj,'__module__',None)!=arg.__module__\n ):\n \n \n \n continue\n \n if isinstance(obj,types.FunctionType):\n obj.__no_type_check__=True\n if isinstance(obj,types.MethodType):\n obj.__func__.__no_type_check__=True\n \n if isinstance(obj,type):\n no_type_check(obj)\n try:\n arg.__no_type_check__=True\n except TypeError:\n pass\n return arg\n \n \ndef no_type_check_decorator(decorator):\n ''\n\n\n\n \n @functools.wraps(decorator)\n def wrapped_decorator(*args,**kwds):\n func=decorator(*args,**kwds)\n func=no_type_check(func)\n return func\n \n return wrapped_decorator\n \n \ndef _overload_dummy(*args,**kwds):\n ''\n raise NotImplementedError(\n \"You should not call an overloaded function. \"\n \"A series of @overload-decorated functions \"\n \"outside a stub module should always be followed \"\n \"by an implementation that is not @overload-ed.\")\n \n \n \n_overload_registry=defaultdict(functools.partial(defaultdict,dict))\n\n\ndef overload(func):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n f=getattr(func,\"__func__\",func)\n try:\n _overload_registry[f.__module__][f.__qualname__][f.__code__.co_firstlineno]=func\n except AttributeError:\n \n pass\n return _overload_dummy\n \n \ndef get_overloads(func):\n ''\n \n f=getattr(func,\"__func__\",func)\n if f.__module__ not in _overload_registry:\n return[]\n mod_dict=_overload_registry[f.__module__]\n if f.__qualname__ not in mod_dict:\n return[]\n return list(mod_dict[f.__qualname__].values())\n \n \ndef clear_overloads():\n ''\n _overload_registry.clear()\n \n \ndef final(f):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n f.__final__=True\n except(AttributeError,TypeError):\n \n \n \n pass\n return f\n \n \n \n \n \nT=TypeVar('T')\nKT=TypeVar('KT')\nVT=TypeVar('VT')\nT_co=TypeVar('T_co',covariant=True)\nV_co=TypeVar('V_co',covariant=True)\nVT_co=TypeVar('VT_co',covariant=True)\nT_contra=TypeVar('T_contra',contravariant=True)\n\nCT_co=TypeVar('CT_co',covariant=True,bound=type)\n\n\n\n\nAnyStr=TypeVar('AnyStr',bytes,str)\n\n\n\n_alias=_SpecialGenericAlias\n\nHashable=_alias(collections.abc.Hashable,0)\nAwaitable=_alias(collections.abc.Awaitable,1)\nCoroutine=_alias(collections.abc.Coroutine,3)\nAsyncIterable=_alias(collections.abc.AsyncIterable,1)\nAsyncIterator=_alias(collections.abc.AsyncIterator,1)\nIterable=_alias(collections.abc.Iterable,1)\nIterator=_alias(collections.abc.Iterator,1)\nReversible=_alias(collections.abc.Reversible,1)\nSized=_alias(collections.abc.Sized,0)\nContainer=_alias(collections.abc.Container,1)\nCollection=_alias(collections.abc.Collection,1)\nCallable=_CallableType(collections.abc.Callable,2)\nCallable.__doc__=\\\n\"\"\"Deprecated alias to collections.abc.Callable.\n\n Callable[[int], str] signifies a function that takes a single\n parameter of type int and returns a str.\n\n The subscription syntax must always be used with exactly two\n values: the argument list and the return type.\n The argument list must be a list of types, a ParamSpec,\n Concatenate or ellipsis. The return type must be a single type.\n\n There is no syntax to indicate optional or keyword arguments;\n such function types are rarely used as callback types.\n \"\"\"\nAbstractSet=_alias(collections.abc.Set,1,name='AbstractSet')\nMutableSet=_alias(collections.abc.MutableSet,1)\n\nMapping=_alias(collections.abc.Mapping,2)\nMutableMapping=_alias(collections.abc.MutableMapping,2)\nSequence=_alias(collections.abc.Sequence,1)\nMutableSequence=_alias(collections.abc.MutableSequence,1)\nByteString=_DeprecatedGenericAlias(\ncollections.abc.ByteString,0,removal_version=(3,14)\n)\n\nTuple=_TupleType(tuple,-1,inst=False,name='Tuple')\nTuple.__doc__=\\\n\"\"\"Deprecated alias to builtins.tuple.\n\n Tuple[X, Y] is the cross-product type of X and Y.\n\n Example: Tuple[T1, T2] is a tuple of two elements corresponding\n to type variables T1 and T2. Tuple[int, float, str] is a tuple\n of an int, a float and a string.\n\n To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].\n \"\"\"\nList=_alias(list,1,inst=False,name='List')\nDeque=_alias(collections.deque,1,name='Deque')\nSet=_alias(set,1,inst=False,name='Set')\nFrozenSet=_alias(frozenset,1,inst=False,name='FrozenSet')\nMappingView=_alias(collections.abc.MappingView,1)\nKeysView=_alias(collections.abc.KeysView,1)\nItemsView=_alias(collections.abc.ItemsView,2)\nValuesView=_alias(collections.abc.ValuesView,1)\nContextManager=_alias(contextlib.AbstractContextManager,1,name='ContextManager')\nAsyncContextManager=_alias(contextlib.AbstractAsyncContextManager,1,name='AsyncContextManager')\nDict=_alias(dict,2,inst=False,name='Dict')\nDefaultDict=_alias(collections.defaultdict,2,name='DefaultDict')\nOrderedDict=_alias(collections.OrderedDict,2)\nCounter=_alias(collections.Counter,1)\nChainMap=_alias(collections.ChainMap,2)\nGenerator=_alias(collections.abc.Generator,3)\nAsyncGenerator=_alias(collections.abc.AsyncGenerator,2)\nType=_alias(type,1,inst=False,name='Type')\nType.__doc__=\\\n\"\"\"Deprecated alias to builtins.type.\n\n builtins.type or typing.Type can be used to annotate class objects.\n For example, suppose we have the following classes::\n\n class User: ... # Abstract base for User classes\n class BasicUser(User): ...\n class ProUser(User): ...\n class TeamUser(User): ...\n\n And a function that takes a class argument that's a subclass of\n User and returns an instance of the corresponding class::\n\n def new_user[U](user_class: Type[U]) -> U:\n user = user_class()\n # (Here we could write the user object to a database)\n return user\n\n joe = new_user(BasicUser)\n\n At this point the type checker knows that joe has type BasicUser.\n \"\"\"\n\n\n@runtime_checkable\nclass SupportsInt(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __int__(self)->int:\n pass\n \n \n@runtime_checkable\nclass SupportsFloat(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __float__(self)->float:\n pass\n \n \n@runtime_checkable\nclass SupportsComplex(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __complex__(self)->complex:\n pass\n \n \n@runtime_checkable\nclass SupportsBytes(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __bytes__(self)->bytes:\n pass\n \n \n@runtime_checkable\nclass SupportsIndex(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __index__(self)->int:\n pass\n \n \n@runtime_checkable\nclass SupportsAbs[T](Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __abs__(self)->T:\n pass\n \n \n@runtime_checkable\nclass SupportsRound[T](Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __round__(self,ndigits:int=0)->T:\n pass\n \n \ndef _make_nmtuple(name,types,module,defaults=()):\n fields=[n for n,t in types]\n types={n:_type_check(t,f\"field {n} annotation must be a type\")\n for n,t in types}\n nm_tpl=collections.namedtuple(name,fields,\n defaults=defaults,module=module)\n nm_tpl.__annotations__=nm_tpl.__new__.__annotations__=types\n return nm_tpl\n \n \n \n_prohibited=frozenset({'__new__','__init__','__slots__','__getnewargs__',\n'_fields','_field_defaults',\n'_make','_replace','_asdict','_source'})\n\n_special=frozenset({'__module__','__name__','__annotations__'})\n\n\nclass NamedTupleMeta(type):\n def __new__(cls,typename,bases,ns):\n assert _NamedTuple in bases\n for base in bases:\n if base is not _NamedTuple and base is not Generic:\n raise TypeError(\n 'can only inherit from a NamedTuple type and Generic')\n bases=tuple(tuple if base is _NamedTuple else base for base in bases)\n types=ns.get('__annotations__',{})\n default_names=[]\n for field_name in types:\n if field_name in ns:\n default_names.append(field_name)\n elif default_names:\n raise TypeError(f\"Non-default namedtuple field {field_name} \"\n f\"cannot follow default field\"\n f\"{'s'if len(default_names)>1 else ''} \"\n f\"{', '.join(default_names)}\")\n nm_tpl=_make_nmtuple(typename,types.items(),\n defaults=[ns[n]for n in default_names],\n module=ns['__module__'])\n nm_tpl.__bases__=bases\n if Generic in bases:\n class_getitem=_generic_class_getitem\n nm_tpl.__class_getitem__=classmethod(class_getitem)\n \n for key in ns:\n if key in _prohibited:\n raise AttributeError(\"Cannot overwrite NamedTuple attribute \"+key)\n elif key not in _special and key not in nm_tpl._fields:\n setattr(nm_tpl,key,ns[key])\n if Generic in bases:\n nm_tpl.__init_subclass__()\n return nm_tpl\n \n \ndef NamedTuple(typename,fields=None,/,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if fields is None:\n fields=kwargs.items()\n elif kwargs:\n raise TypeError(\"Either list of fields or keywords\"\n \" can be provided to NamedTuple, not both\")\n nt=_make_nmtuple(typename,fields,module=_caller())\n nt.__orig_bases__=(NamedTuple,)\n return nt\n \n_NamedTuple=type.__new__(NamedTupleMeta,'NamedTuple',(),{})\n\ndef _namedtuple_mro_entries(bases):\n assert NamedTuple in bases\n return(_NamedTuple,)\n \nNamedTuple.__mro_entries__=_namedtuple_mro_entries\n\n\nclass _TypedDictMeta(type):\n def __new__(cls,name,bases,ns,total=True):\n ''\n\n\n\n\n\n \n for base in bases:\n if type(base)is not _TypedDictMeta and base is not Generic:\n raise TypeError('cannot inherit from both a TypedDict type '\n 'and a non-TypedDict base class')\n \n if any(issubclass(b,Generic)for b in bases):\n generic_base=(Generic,)\n else:\n generic_base=()\n \n tp_dict=type.__new__(_TypedDictMeta,name,(*generic_base,dict),ns)\n \n if not hasattr(tp_dict,'__orig_bases__'):\n tp_dict.__orig_bases__=bases\n \n annotations={}\n own_annotations=ns.get('__annotations__',{})\n msg=\"TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type\"\n own_annotations={\n n:_type_check(tp,msg,module=tp_dict.__module__)\n for n,tp in own_annotations.items()\n }\n required_keys=set()\n optional_keys=set()\n \n for base in bases:\n annotations.update(base.__dict__.get('__annotations__',{}))\n required_keys.update(base.__dict__.get('__required_keys__',()))\n optional_keys.update(base.__dict__.get('__optional_keys__',()))\n \n annotations.update(own_annotations)\n for annotation_key,annotation_type in own_annotations.items():\n annotation_origin=get_origin(annotation_type)\n if annotation_origin is Annotated:\n annotation_args=get_args(annotation_type)\n if annotation_args:\n annotation_type=annotation_args[0]\n annotation_origin=get_origin(annotation_type)\n \n if annotation_origin is Required:\n required_keys.add(annotation_key)\n elif annotation_origin is NotRequired:\n optional_keys.add(annotation_key)\n elif total:\n required_keys.add(annotation_key)\n else:\n optional_keys.add(annotation_key)\n \n tp_dict.__annotations__=annotations\n tp_dict.__required_keys__=frozenset(required_keys)\n tp_dict.__optional_keys__=frozenset(optional_keys)\n if not hasattr(tp_dict,'__total__'):\n tp_dict.__total__=total\n return tp_dict\n \n __call__=dict\n \n def __subclasscheck__(cls,other):\n \n raise TypeError('TypedDict does not support instance and class checks')\n \n __instancecheck__=__subclasscheck__\n \n \ndef TypedDict(typename,fields=None,/,*,total=True,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if fields is None:\n fields=kwargs\n elif kwargs:\n raise TypeError(\"TypedDict takes either a dict or keyword arguments,\"\n \" but not both\")\n if kwargs:\n warnings.warn(\n \"The kwargs-based syntax for TypedDict definitions is deprecated \"\n \"in Python 3.11, will be removed in Python 3.13, and may not be \"\n \"understood by third-party type checkers.\",\n DeprecationWarning,\n stacklevel=2,\n )\n \n ns={'__annotations__':dict(fields)}\n module=_caller()\n if module is not None:\n \n ns['__module__']=module\n \n td=_TypedDictMeta(typename,(),ns,total=total)\n td.__orig_bases__=(TypedDict,)\n return td\n \n_TypedDict=type.__new__(_TypedDictMeta,'TypedDict',(),{})\nTypedDict.__mro_entries__=lambda bases:(_TypedDict,)\n\n\n@_SpecialForm\ndef Required(self,parameters):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n item=_type_check(parameters,f'{self._name} accepts only a single type.')\n return _GenericAlias(self,(item,))\n \n \n@_SpecialForm\ndef NotRequired(self,parameters):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n item=_type_check(parameters,f'{self._name} accepts only a single type.')\n return _GenericAlias(self,(item,))\n \n \nclass NewType:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __call__=_idfunc\n \n def __init__(self,name,tp):\n self.__qualname__=name\n if '.'in name:\n name=name.rpartition('.')[-1]\n self.__name__=name\n self.__supertype__=tp\n def_mod=_caller()\n if def_mod !='typing':\n self.__module__=def_mod\n \n def __mro_entries__(self,bases):\n \n \n superclass_name=self.__name__\n \n class Dummy:\n def __init_subclass__(cls):\n subclass_name=cls.__name__\n raise TypeError(\n f\"Cannot subclass an instance of NewType. Perhaps you were looking for: \"\n f\"`{subclass_name} = NewType({subclass_name !r}, {superclass_name})`\"\n )\n \n return(Dummy,)\n \n def __repr__(self):\n return f'{self.__module__}.{self.__qualname__}'\n \n def __reduce__(self):\n return self.__qualname__\n \n def __or__(self,other):\n return Union[self,other]\n \n def __ror__(self,other):\n return Union[other,self]\n \n \n \nText=str\n\n\n\nTYPE_CHECKING=False\n\n\nclass IO(Generic[AnyStr]):\n ''\n\n\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n @property\n @abstractmethod\n def mode(self)->str:\n pass\n \n @property\n @abstractmethod\n def name(self)->str:\n pass\n \n @abstractmethod\n def close(self)->None:\n pass\n \n @property\n @abstractmethod\n def closed(self)->bool:\n pass\n \n @abstractmethod\n def fileno(self)->int:\n pass\n \n @abstractmethod\n def flush(self)->None:\n pass\n \n @abstractmethod\n def isatty(self)->bool:\n pass\n \n @abstractmethod\n def read(self,n:int=-1)->AnyStr:\n pass\n \n @abstractmethod\n def readable(self)->bool:\n pass\n \n @abstractmethod\n def readline(self,limit:int=-1)->AnyStr:\n pass\n \n @abstractmethod\n def readlines(self,hint:int=-1)->List[AnyStr]:\n pass\n \n @abstractmethod\n def seek(self,offset:int,whence:int=0)->int:\n pass\n \n @abstractmethod\n def seekable(self)->bool:\n pass\n \n @abstractmethod\n def tell(self)->int:\n pass\n \n @abstractmethod\n def truncate(self,size:int=None)->int:\n pass\n \n @abstractmethod\n def writable(self)->bool:\n pass\n \n @abstractmethod\n def write(self,s:AnyStr)->int:\n pass\n \n @abstractmethod\n def writelines(self,lines:List[AnyStr])->None:\n pass\n \n @abstractmethod\n def __enter__(self)->'IO[AnyStr]':\n pass\n \n @abstractmethod\n def __exit__(self,type,value,traceback)->None:\n pass\n \n \nclass BinaryIO(IO[bytes]):\n ''\n \n __slots__=()\n \n @abstractmethod\n def write(self,s:Union[bytes,bytearray])->int:\n pass\n \n @abstractmethod\n def __enter__(self)->'BinaryIO':\n pass\n \n \nclass TextIO(IO[str]):\n ''\n \n __slots__=()\n \n @property\n @abstractmethod\n def buffer(self)->BinaryIO:\n pass\n \n @property\n @abstractmethod\n def encoding(self)->str:\n pass\n \n @property\n @abstractmethod\n def errors(self)->Optional[str]:\n pass\n \n @property\n @abstractmethod\n def line_buffering(self)->bool:\n pass\n \n @property\n @abstractmethod\n def newlines(self)->Any:\n pass\n \n @abstractmethod\n def __enter__(self)->'TextIO':\n pass\n \n \nclass _DeprecatedType(type):\n def __getattribute__(cls,name):\n if name not in(\"__dict__\",\"__module__\")and name in cls.__dict__:\n warnings.warn(\n f\"{cls.__name__} is deprecated, import directly \"\n f\"from typing instead. {cls.__name__} will be removed \"\n \"in Python 3.12.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return super().__getattribute__(name)\n \n \nclass io(metaclass=_DeprecatedType):\n ''\n \n __all__=['IO','TextIO','BinaryIO']\n IO=IO\n TextIO=TextIO\n BinaryIO=BinaryIO\n \n \nio.__name__=__name__+'.io'\nsys.modules[io.__name__]=io\n\nPattern=_alias(stdlib_re.Pattern,1)\nMatch=_alias(stdlib_re.Match,1)\n\nclass re(metaclass=_DeprecatedType):\n ''\n \n __all__=['Pattern','Match']\n Pattern=Pattern\n Match=Match\n \n \nre.__name__=__name__+'.re'\nsys.modules[re.__name__]=re\n\n\ndef reveal_type[T](obj:T,/)->T:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n print(f\"Runtime type is {type(obj).__name__ !r}\",file=sys.stderr)\n return obj\n \n \nclass _IdentityCallable(Protocol):\n def __call__[T](self,arg:T,/)->T:\n ...\n \n \ndef dataclass_transform(\n*,\neq_default:bool=True,\norder_default:bool=False,\nkw_only_default:bool=False,\nfrozen_default:bool=False,\nfield_specifiers:tuple[type[Any]|Callable[...,Any],...]=(),\n**kwargs:Any,\n)->_IdentityCallable:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def decorator(cls_or_fn):\n cls_or_fn.__dataclass_transform__={\n \"eq_default\":eq_default,\n \"order_default\":order_default,\n \"kw_only_default\":kw_only_default,\n \"frozen_default\":frozen_default,\n \"field_specifiers\":field_specifiers,\n \"kwargs\":kwargs,\n }\n return cls_or_fn\n return decorator\n \n \ntype _Func=Callable[...,Any]\n\n\ndef override[F:_Func](method:F,/)->F:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n method.__override__=True\n except(AttributeError,TypeError):\n \n \n \n pass\n return method\n", ["_typing", "abc", "collections", "collections.abc", "contextlib", "copyreg", "functools", "inspect", "operator", "re", "sys", "types", "warnings"]], "uu": [".py", "#! /usr/bin/env python3\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"\"Implementation of the UUencode and UUdecode functions.\n\nencode(in_file, out_file [,name, mode], *, backtick=False)\ndecode(in_file [, out_file, mode, quiet])\n\"\"\"\n\nimport binascii\nimport os\nimport sys\nimport warnings\n\nwarnings._deprecated(__name__,remove=(3,13))\n\n__all__=[\"Error\",\"encode\",\"decode\"]\n\nclass Error(Exception):\n pass\n \ndef encode(in_file,out_file,name=None,mode=None,*,backtick=False):\n ''\n \n \n \n opened_files=[]\n try:\n if in_file =='-':\n in_file=sys.stdin.buffer\n elif isinstance(in_file,str):\n if name is None:\n name=os.path.basename(in_file)\n if mode is None:\n try:\n mode=os.stat(in_file).st_mode\n except AttributeError:\n pass\n in_file=open(in_file,'rb')\n opened_files.append(in_file)\n \n \n \n if out_file =='-':\n out_file=sys.stdout.buffer\n elif isinstance(out_file,str):\n out_file=open(out_file,'wb')\n opened_files.append(out_file)\n \n \n \n if name is None:\n name='-'\n if mode is None:\n mode=0o666\n \n \n \n \n name=name.replace('\\n','\\\\n')\n name=name.replace('\\r','\\\\r')\n \n \n \n \n out_file.write(('begin %o %s\\n'%((mode&0o777),name)).encode(\"ascii\"))\n data=in_file.read(45)\n while len(data)>0:\n out_file.write(binascii.b2a_uu(data,backtick=backtick))\n data=in_file.read(45)\n if backtick:\n out_file.write(b'`\\nend\\n')\n else:\n out_file.write(b' \\nend\\n')\n finally:\n for f in opened_files:\n f.close()\n \n \ndef decode(in_file,out_file=None,mode=None,quiet=False):\n ''\n \n \n \n opened_files=[]\n if in_file =='-':\n in_file=sys.stdin.buffer\n elif isinstance(in_file,str):\n in_file=open(in_file,'rb')\n opened_files.append(in_file)\n \n try:\n \n \n \n while True:\n hdr=in_file.readline()\n if not hdr:\n raise Error('No valid begin line found in input file')\n if not hdr.startswith(b'begin'):\n continue\n hdrfields=hdr.split(b' ',2)\n if len(hdrfields)==3 and hdrfields[0]==b'begin':\n try:\n int(hdrfields[1],8)\n break\n except ValueError:\n pass\n if out_file is None:\n \n out_file=hdrfields[2].rstrip(b' \\t\\r\\n\\f').decode(\"ascii\")\n if os.path.exists(out_file):\n raise Error(f'Cannot overwrite existing file: {out_file}')\n if(out_file.startswith(os.sep)or\n f'..{os.sep}'in out_file or(\n os.altsep and\n (out_file.startswith(os.altsep)or\n f'..{os.altsep}'in out_file))\n ):\n raise Error(f'Refusing to write to {out_file} due to directory traversal')\n if mode is None:\n mode=int(hdrfields[1],8)\n \n \n \n if out_file =='-':\n out_file=sys.stdout.buffer\n elif isinstance(out_file,str):\n fp=open(out_file,'wb')\n os.chmod(out_file,mode)\n out_file=fp\n opened_files.append(out_file)\n \n \n \n s=in_file.readline()\n while s and s.strip(b' \\t\\r\\n\\f')!=b'end':\n try:\n data=binascii.a2b_uu(s)\n except binascii.Error as v:\n \n nbytes=(((s[0]-32)&63)*4+5)//3\n data=binascii.a2b_uu(s[:nbytes])\n if not quiet:\n sys.stderr.write(\"Warning: %s\\n\"%v)\n out_file.write(data)\n s=in_file.readline()\n if not s:\n raise Error('Truncated input file')\n finally:\n for f in opened_files:\n f.close()\n \ndef test():\n ''\n \n import optparse\n parser=optparse.OptionParser(usage='usage: %prog [-d] [-t] [input [output]]')\n parser.add_option('-d','--decode',dest='decode',help='Decode (instead of encode)?',default=False,action='store_true')\n parser.add_option('-t','--text',dest='text',help='data is text, encoded format unix-compatible text?',default=False,action='store_true')\n \n (options,args)=parser.parse_args()\n if len(args)>2:\n parser.error('incorrect number of arguments')\n sys.exit(1)\n \n \n input=sys.stdin.buffer\n output=sys.stdout.buffer\n if len(args)>0:\n input=args[0]\n if len(args)>1:\n output=args[1]\n \n if options.decode:\n if options.text:\n if isinstance(output,str):\n output=open(output,'wb')\n else:\n print(sys.argv[0],': cannot do -t to stdout')\n sys.exit(1)\n decode(input,output)\n else:\n if options.text:\n if isinstance(input,str):\n input=open(input,'rb')\n else:\n print(sys.argv[0],': cannot do -t from stdin')\n sys.exit(1)\n encode(input,output)\n \nif __name__ =='__main__':\n test()\n", ["binascii", "optparse", "os", "sys", "warnings"]], "uuid": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport os\nimport sys\n\nfrom enum import Enum,_simple_enum\n\n\n__author__='Ka-Ping Yee '\n\n\nif sys.platform in('win32','darwin','emscripten','wasi'):\n _AIX=_LINUX=False\nelse:\n import platform\n _platform_system=platform.system()\n _AIX=_platform_system =='AIX'\n _LINUX=_platform_system =='Linux'\n \n_MAC_DELIM=b':'\n_MAC_OMITS_LEADING_ZEROES=False\nif _AIX:\n _MAC_DELIM=b'.'\n _MAC_OMITS_LEADING_ZEROES=True\n \nRESERVED_NCS,RFC_4122,RESERVED_MICROSOFT,RESERVED_FUTURE=[\n'reserved for NCS compatibility','specified in RFC 4122',\n'reserved for Microsoft compatibility','reserved for future definition']\n\nint_=int\nbytes_=bytes\n\n\n@_simple_enum(Enum)\nclass SafeUUID:\n safe=0\n unsafe=-1\n unknown=None\n \n \nclass UUID:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('int','is_safe','__weakref__')\n \n def __init__(self,hex=None,bytes=None,bytes_le=None,fields=None,\n int=None,version=None,\n *,is_safe=SafeUUID.unknown):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if[hex,bytes,bytes_le,fields,int].count(None)!=4:\n raise TypeError('one of the hex, bytes, bytes_le, fields, '\n 'or int arguments must be given')\n if hex is not None:\n hex=hex.replace('urn:','').replace('uuid:','')\n hex=hex.strip('{}').replace('-','')\n if len(hex)!=32:\n raise ValueError('badly formed hexadecimal UUID string')\n int=int_(hex,16)\n if bytes_le is not None:\n if len(bytes_le)!=16:\n raise ValueError('bytes_le is not a 16-char string')\n bytes=(bytes_le[4 -1::-1]+bytes_le[6 -1:4 -1:-1]+\n bytes_le[8 -1:6 -1:-1]+bytes_le[8:])\n if bytes is not None:\n if len(bytes)!=16:\n raise ValueError('bytes is not a 16-char string')\n assert isinstance(bytes,bytes_),repr(bytes)\n int=int_.from_bytes(bytes)\n if fields is not None:\n if len(fields)!=6:\n raise ValueError('fields is not a 6-tuple')\n (time_low,time_mid,time_hi_version,\n clock_seq_hi_variant,clock_seq_low,node)=fields\n if not 0 <=time_low <1 <<32:\n raise ValueError('field 1 out of range (need a 32-bit value)')\n if not 0 <=time_mid <1 <<16:\n raise ValueError('field 2 out of range (need a 16-bit value)')\n if not 0 <=time_hi_version <1 <<16:\n raise ValueError('field 3 out of range (need a 16-bit value)')\n if not 0 <=clock_seq_hi_variant <1 <<8:\n raise ValueError('field 4 out of range (need an 8-bit value)')\n if not 0 <=clock_seq_low <1 <<8:\n raise ValueError('field 5 out of range (need an 8-bit value)')\n if not 0 <=node <1 <<48:\n raise ValueError('field 6 out of range (need a 48-bit value)')\n clock_seq=(clock_seq_hi_variant <<8)|clock_seq_low\n int=((time_low <<96)|(time_mid <<80)|\n (time_hi_version <<64)|(clock_seq <<48)|node)\n if int is not None:\n if not 0 <=int <1 <<128:\n raise ValueError('int is out of range (need a 128-bit value)')\n if version is not None:\n if not 1 <=version <=5:\n raise ValueError('illegal version number')\n \n int &=~(0xc000 <<48)\n int |=0x8000 <<48\n \n int &=~(0xf000 <<64)\n int |=version <<76\n object.__setattr__(self,'int',int)\n object.__setattr__(self,'is_safe',is_safe)\n \n def __getstate__(self):\n d={'int':self.int}\n if self.is_safe !=SafeUUID.unknown:\n \n \n d['is_safe']=self.is_safe.value\n return d\n \n def __setstate__(self,state):\n object.__setattr__(self,'int',state['int'])\n \n object.__setattr__(self,'is_safe',\n SafeUUID(state['is_safe'])\n if 'is_safe'in state else SafeUUID.unknown)\n \n def __eq__(self,other):\n if isinstance(other,UUID):\n return self.int ==other.int\n return NotImplemented\n \n \n \n \n def __lt__(self,other):\n if isinstance(other,UUID):\n return self.int other.int\n return NotImplemented\n \n def __le__(self,other):\n if isinstance(other,UUID):\n return self.int <=other.int\n return NotImplemented\n \n def __ge__(self,other):\n if isinstance(other,UUID):\n return self.int >=other.int\n return NotImplemented\n \n def __hash__(self):\n return hash(self.int)\n \n def __int__(self):\n return self.int\n \n def __repr__(self):\n return '%s(%r)'%(self.__class__.__name__,str(self))\n \n def __setattr__(self,name,value):\n raise TypeError('UUID objects are immutable')\n \n def __str__(self):\n hex='%032x'%self.int\n return '%s-%s-%s-%s-%s'%(\n hex[:8],hex[8:12],hex[12:16],hex[16:20],hex[20:])\n \n @property\n def bytes(self):\n return self.int.to_bytes(16)\n \n @property\n def bytes_le(self):\n bytes=self.bytes\n return(bytes[4 -1::-1]+bytes[6 -1:4 -1:-1]+bytes[8 -1:6 -1:-1]+\n bytes[8:])\n \n @property\n def fields(self):\n return(self.time_low,self.time_mid,self.time_hi_version,\n self.clock_seq_hi_variant,self.clock_seq_low,self.node)\n \n @property\n def time_low(self):\n return self.int >>96\n \n @property\n def time_mid(self):\n return(self.int >>80)&0xffff\n \n @property\n def time_hi_version(self):\n return(self.int >>64)&0xffff\n \n @property\n def clock_seq_hi_variant(self):\n return(self.int >>56)&0xff\n \n @property\n def clock_seq_low(self):\n return(self.int >>48)&0xff\n \n @property\n def time(self):\n return(((self.time_hi_version&0x0fff)<<48)|\n (self.time_mid <<32)|self.time_low)\n \n @property\n def clock_seq(self):\n return(((self.clock_seq_hi_variant&0x3f)<<8)|\n self.clock_seq_low)\n \n @property\n def node(self):\n return self.int&0xffffffffffff\n \n @property\n def hex(self):\n return '%032x'%self.int\n \n @property\n def urn(self):\n return 'urn:uuid:'+str(self)\n \n @property\n def variant(self):\n if not self.int&(0x8000 <<48):\n return RESERVED_NCS\n elif not self.int&(0x4000 <<48):\n return RFC_4122\n elif not self.int&(0x2000 <<48):\n return RESERVED_MICROSOFT\n else:\n return RESERVED_FUTURE\n \n @property\n def version(self):\n \n if self.variant ==RFC_4122:\n return int((self.int >>76)&0xf)\n \n \ndef _get_command_stdout(command,*args):\n import io,os,shutil,subprocess\n \n try:\n path_dirs=os.environ.get('PATH',os.defpath).split(os.pathsep)\n path_dirs.extend(['/sbin','/usr/sbin'])\n executable=shutil.which(command,path=os.pathsep.join(path_dirs))\n if executable is None:\n return None\n \n \n \n env=dict(os.environ)\n env['LC_ALL']='C'\n \n if args !=('',):\n command=(executable,*args)\n else:\n command=(executable,)\n proc=subprocess.Popen(command,\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n env=env)\n if not proc:\n return None\n stdout,stderr=proc.communicate()\n return io.BytesIO(stdout)\n except(OSError,subprocess.SubprocessError):\n return None\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \ndef _is_universal(mac):\n return not(mac&(1 <<41))\n \n \ndef _find_mac_near_keyword(command,args,keywords,get_word_index):\n ''\n\n\n\n\n\n\n \n stdout=_get_command_stdout(command,args)\n if stdout is None:\n return None\n \n first_local_mac=None\n for line in stdout:\n words=line.lower().rstrip().split()\n for i in range(len(words)):\n if words[i]in keywords:\n try:\n word=words[get_word_index(i)]\n mac=int(word.replace(_MAC_DELIM,b''),16)\n except(ValueError,IndexError):\n \n \n \n \n \n pass\n else:\n if _is_universal(mac):\n return mac\n first_local_mac=first_local_mac or mac\n return first_local_mac or None\n \n \ndef _parse_mac(word):\n\n\n\n\n\n\n parts=word.split(_MAC_DELIM)\n if len(parts)!=6:\n return\n if _MAC_OMITS_LEADING_ZEROES:\n \n \n \n \n if not all(1 <=len(part)<=2 for part in parts):\n return\n hexstr=b''.join(part.rjust(2,b'0')for part in parts)\n else:\n if not all(len(part)==2 for part in parts):\n return\n hexstr=b''.join(parts)\n try:\n return int(hexstr,16)\n except ValueError:\n return\n \n \ndef _find_mac_under_heading(command,args,heading):\n ''\n\n\n\n\n \n stdout=_get_command_stdout(command,args)\n if stdout is None:\n return None\n \n keywords=stdout.readline().rstrip().split()\n try:\n column_index=keywords.index(heading)\n except ValueError:\n return None\n \n first_local_mac=None\n for line in stdout:\n words=line.rstrip().split()\n try:\n word=words[column_index]\n except IndexError:\n continue\n \n mac=_parse_mac(word)\n if mac is None:\n continue\n if _is_universal(mac):\n return mac\n if first_local_mac is None:\n first_local_mac=mac\n \n return first_local_mac\n \n \n \n \ndef _ifconfig_getnode():\n ''\n \n keywords=(b'hwaddr',b'ether',b'address:',b'lladdr')\n for args in('','-a','-av'):\n mac=_find_mac_near_keyword('ifconfig',args,keywords,lambda i:i+1)\n if mac:\n return mac\n return None\n \ndef _ip_getnode():\n ''\n \n mac=_find_mac_near_keyword('ip','link',[b'link/ether'],lambda i:i+1)\n if mac:\n return mac\n return None\n \ndef _arp_getnode():\n ''\n import os,socket\n if not hasattr(socket,\"gethostbyname\"):\n return None\n try:\n ip_addr=socket.gethostbyname(socket.gethostname())\n except OSError:\n return None\n \n \n mac=_find_mac_near_keyword('arp','-an',[os.fsencode(ip_addr)],lambda i:-1)\n if mac:\n return mac\n \n \n mac=_find_mac_near_keyword('arp','-an',[os.fsencode(ip_addr)],lambda i:i+1)\n if mac:\n return mac\n \n \n mac=_find_mac_near_keyword('arp','-an',[os.fsencode('(%s)'%ip_addr)],\n lambda i:i+2)\n \n if mac:\n return mac\n return None\n \ndef _lanscan_getnode():\n ''\n \n return _find_mac_near_keyword('lanscan','-ai',[b'lan0'],lambda i:0)\n \ndef _netstat_getnode():\n ''\n \n return _find_mac_under_heading('netstat','-ian',b'Address')\n \ndef _ipconfig_getnode():\n ''\n \n return _windll_getnode()\n \ndef _netbios_getnode():\n ''\n \n return _windll_getnode()\n \n \n \ntry:\n import _uuid\n _generate_time_safe=getattr(_uuid,\"generate_time_safe\",None)\n _UuidCreate=getattr(_uuid,\"UuidCreate\",None)\n _has_uuid_generate_time_safe=_uuid.has_uuid_generate_time_safe\nexcept ImportError:\n _uuid=None\n _generate_time_safe=None\n _UuidCreate=None\n _has_uuid_generate_time_safe=None\n \n \ndef _load_system_functions():\n ''\n \n \ndef _unix_getnode():\n ''\n if _generate_time_safe:\n uuid_time,_=_generate_time_safe()\n return UUID(bytes=uuid_time).node\n \ndef _windll_getnode():\n ''\n if _UuidCreate:\n uuid_bytes=_UuidCreate()\n return UUID(bytes_le=uuid_bytes).node\n \ndef _random_getnode():\n ''\n \n \n \n \n \n \n \n \n \n \n import random\n return random.getrandbits(48)|(1 <<40)\n \n \n \n \n \n \n \n \nif _LINUX:\n _OS_GETTERS=[_ip_getnode,_ifconfig_getnode]\nelif sys.platform =='darwin':\n _OS_GETTERS=[_ifconfig_getnode,_arp_getnode,_netstat_getnode]\nelif sys.platform =='win32':\n\n _OS_GETTERS=[]\nelif _AIX:\n _OS_GETTERS=[_netstat_getnode]\nelse:\n _OS_GETTERS=[_ifconfig_getnode,_ip_getnode,_arp_getnode,\n _netstat_getnode,_lanscan_getnode]\nif os.name =='posix':\n _GETTERS=[_unix_getnode]+_OS_GETTERS\nelif os.name =='nt':\n _GETTERS=[_windll_getnode]+_OS_GETTERS\nelse:\n _GETTERS=_OS_GETTERS\n \n_node=None\n\ndef getnode():\n ''\n\n\n\n\n\n \n global _node\n if _node is not None:\n return _node\n \n for getter in _GETTERS+[_random_getnode]:\n try:\n _node=getter()\n except:\n continue\n if(_node is not None)and(0 <=_node <(1 <<48)):\n return _node\n assert False,'_random_getnode() returned invalid value: {}'.format(_node)\n \n \n_last_timestamp=None\n\ndef uuid1(node=None,clock_seq=None):\n ''\n\n\n \n \n \n \n if _generate_time_safe is not None and node is clock_seq is None:\n uuid_time,safely_generated=_generate_time_safe()\n try:\n is_safe=SafeUUID(safely_generated)\n except ValueError:\n is_safe=SafeUUID.unknown\n return UUID(bytes=uuid_time,is_safe=is_safe)\n \n global _last_timestamp\n import time\n nanoseconds=time.time_ns()\n \n \n timestamp=nanoseconds //100+0x01b21dd213814000\n if _last_timestamp is not None and timestamp <=_last_timestamp:\n timestamp=_last_timestamp+1\n _last_timestamp=timestamp\n if clock_seq is None:\n import random\n clock_seq=random.getrandbits(14)\n time_low=timestamp&0xffffffff\n time_mid=(timestamp >>32)&0xffff\n time_hi_version=(timestamp >>48)&0x0fff\n clock_seq_low=clock_seq&0xff\n clock_seq_hi_variant=(clock_seq >>8)&0x3f\n if node is None:\n node=getnode()\n return UUID(fields=(time_low,time_mid,time_hi_version,\n clock_seq_hi_variant,clock_seq_low,node),version=1)\n \ndef uuid3(namespace,name):\n ''\n if isinstance(name,str):\n name=bytes(name,\"utf-8\")\n from hashlib import md5\n digest=md5(\n namespace.bytes+name,\n usedforsecurity=False\n ).digest()\n return UUID(bytes=digest[:16],version=3)\n \ndef uuid4():\n ''\n return UUID(bytes=os.urandom(16),version=4)\n \ndef uuid5(namespace,name):\n ''\n if isinstance(name,str):\n name=bytes(name,\"utf-8\")\n from hashlib import sha1\n hash=sha1(namespace.bytes+name).digest()\n return UUID(bytes=hash[:16],version=5)\n \n \ndef main():\n ''\n uuid_funcs={\n \"uuid1\":uuid1,\n \"uuid3\":uuid3,\n \"uuid4\":uuid4,\n \"uuid5\":uuid5\n }\n uuid_namespace_funcs=(\"uuid3\",\"uuid5\")\n namespaces={\n \"@dns\":NAMESPACE_DNS,\n \"@url\":NAMESPACE_URL,\n \"@oid\":NAMESPACE_OID,\n \"@x500\":NAMESPACE_X500\n }\n \n import argparse\n parser=argparse.ArgumentParser(\n description=\"Generates a uuid using the selected uuid function.\")\n parser.add_argument(\"-u\",\"--uuid\",choices=uuid_funcs.keys(),default=\"uuid4\",\n help=\"The function to use to generate the uuid. \"\n \"By default uuid4 function is used.\")\n parser.add_argument(\"-n\",\"--namespace\",\n help=\"The namespace is a UUID, or '@ns' where 'ns' is a \"\n \"well-known predefined UUID addressed by namespace name. \"\n \"Such as @dns, @url, @oid, and @x500. \"\n \"Only required for uuid3/uuid5 functions.\")\n parser.add_argument(\"-N\",\"--name\",\n help=\"The name used as part of generating the uuid. \"\n \"Only required for uuid3/uuid5 functions.\")\n \n args=parser.parse_args()\n uuid_func=uuid_funcs[args.uuid]\n namespace=args.namespace\n name=args.name\n \n if args.uuid in uuid_namespace_funcs:\n if not namespace or not name:\n parser.error(\n \"Incorrect number of arguments. \"\n f\"{args.uuid} requires a namespace and a name. \"\n \"Run 'python -m uuid -h' for more information.\"\n )\n namespace=namespaces[namespace]if namespace in namespaces else UUID(namespace)\n print(uuid_func(namespace,name))\n else:\n print(uuid_func())\n \n \n \n \nNAMESPACE_DNS=UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_URL=UUID('6ba7b811-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_OID=UUID('6ba7b812-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_X500=UUID('6ba7b814-9dad-11d1-80b4-00c04fd430c8')\n\nif __name__ ==\"__main__\":\n main()\n", ["_uuid", "argparse", "enum", "hashlib", "io", "os", "platform", "random", "shutil", "socket", "subprocess", "sys", "time"]], "VFS_import": [".py", "import os\nimport sys\nfrom browser import doc\n\n\n\n\n\n\nVFS=dict(JSObject(__BRYTHON__.py_VFS))\nclass VFSModuleFinder:\n def __init__(self,path_entry):\n print(\"in VFSModuleFinder\")\n if path_entry.startswith('/libs')or path_entry.startswith('/Lib'):\n self.path_entry=path_entry\n else :\n raise ImportError()\n \n def __str__(self):\n return '<%s for \"%s\">'%(self.__class__.__name__,self.path_entry)\n \n def find_module(self,fullname,path=None ):\n path=path or self.path_entry\n \n for _ext in ['js','pyj','py']:\n _filepath=os.path.join(self.path_entry,'%s.%s'%(fullname,_ext))\n if _filepath in VFS:\n print(\"module found at %s:%s\"%(_filepath,fullname))\n return VFSModuleLoader(_filepath,fullname)\n \n print('module %s not found'%fullname)\n raise ImportError()\n return None\n \nclass VFSModuleLoader:\n ''\n \n def __init__(self,filepath,name):\n self._filepath=filepath\n self._name=name\n \n def get_source(self):\n if self._filepath in VFS:\n return JSObject(readFromVFS(self._filepath))\n \n raise ImportError('could not find source for %s'%fullname)\n \n def is_package(self):\n return '.'in self._name\n \n def load_module(self):\n if self._name in sys.modules:\n \n mod=sys.modules[self._name]\n return mod\n \n _src=self.get_source()\n if self._filepath.endswith('.js'):\n mod=JSObject(import_js_module(_src,self._filepath,self._name))\n elif self._filepath.endswith('.py'):\n mod=JSObject(import_py_module(_src,self._filepath,self._name))\n elif self._filepath.endswith('.pyj'):\n mod=JSObject(import_pyj_module(_src,self._filepath,self._name))\n else :\n raise ImportError('Invalid Module: %s'%self._filepath)\n \n \n mod.__file__=self._filepath\n mod.__name__=self._name\n mod.__path__=os.path.abspath(self._filepath)\n mod.__loader__=self\n mod.__package__='.'.join(self._name.split('.')[:-1])\n \n if self.is_package():\n print('adding path for package')\n \n \n mod.__path__=[self.path_entry]\n else :\n print('imported as regular module')\n \n print('creating a new module object for \"%s\"'%self._name)\n sys.modules.setdefault(self._name,mod)\n JSObject(__BRYTHON__.imported)[self._name]=mod\n \n return mod\n \nJSObject(__BRYTHON__.path_hooks.insert(0,VFSModuleFinder))\n", ["browser", "os", "sys"]], "warnings": [".py", "''\n\nimport sys\n\n\n__all__=[\"warn\",\"warn_explicit\",\"showwarning\",\n\"formatwarning\",\"filterwarnings\",\"simplefilter\",\n\"resetwarnings\",\"catch_warnings\"]\n\ndef showwarning(message,category,filename,lineno,file=None,line=None):\n ''\n msg=WarningMessage(message,category,filename,lineno,file,line)\n _showwarnmsg_impl(msg)\n \ndef formatwarning(message,category,filename,lineno,line=None):\n ''\n msg=WarningMessage(message,category,filename,lineno,None,line)\n return _formatwarnmsg_impl(msg)\n \ndef _showwarnmsg_impl(msg):\n file=msg.file\n if file is None:\n file=sys.stderr\n if file is None:\n \n \n return\n text=_formatwarnmsg(msg)\n try:\n file.write(text)\n except OSError:\n \n pass\n \ndef _formatwarnmsg_impl(msg):\n category=msg.category.__name__\n s=f\"{msg.filename}:{msg.lineno}: {category}: {msg.message}\\n\"\n \n if msg.line is None:\n try:\n import linecache\n line=linecache.getline(msg.filename,msg.lineno)\n except Exception:\n \n \n line=None\n linecache=None\n else:\n line=msg.line\n if line:\n line=line.strip()\n s +=\" %s\\n\"%line\n \n if msg.source is not None:\n try:\n import tracemalloc\n \n \n except Exception:\n \n tracing=True\n tb=None\n else:\n tracing=tracemalloc.is_tracing()\n try:\n tb=tracemalloc.get_object_traceback(msg.source)\n except Exception:\n \n \n tb=None\n \n if tb is not None:\n s +='Object allocated at (most recent call last):\\n'\n for frame in tb:\n s +=(' File \"%s\", lineno %s\\n'\n %(frame.filename,frame.lineno))\n \n try:\n if linecache is not None:\n line=linecache.getline(frame.filename,frame.lineno)\n else:\n line=None\n except Exception:\n line=None\n if line:\n line=line.strip()\n s +=' %s\\n'%line\n elif not tracing:\n s +=(f'{category}: Enable tracemalloc to get the object '\n f'allocation traceback\\n')\n return s\n \n \n_showwarning_orig=showwarning\n\ndef _showwarnmsg(msg):\n ''\n try:\n sw=showwarning\n except NameError:\n pass\n else:\n if sw is not _showwarning_orig:\n \n if not callable(sw):\n raise TypeError(\"warnings.showwarning() must be set to a \"\n \"function or method\")\n \n sw(msg.message,msg.category,msg.filename,msg.lineno,\n msg.file,msg.line)\n return\n _showwarnmsg_impl(msg)\n \n \n_formatwarning_orig=formatwarning\n\ndef _formatwarnmsg(msg):\n ''\n try:\n fw=formatwarning\n except NameError:\n pass\n else:\n if fw is not _formatwarning_orig:\n \n return fw(msg.message,msg.category,\n msg.filename,msg.lineno,msg.line)\n return _formatwarnmsg_impl(msg)\n \ndef filterwarnings(action,message=\"\",category=Warning,module=\"\",lineno=0,\nappend=False):\n ''\n\n\n\n\n\n\n\n\n \n assert action in(\"error\",\"ignore\",\"always\",\"default\",\"module\",\n \"once\"),\"invalid action: %r\"%(action,)\n assert isinstance(message,str),\"message must be a string\"\n assert isinstance(category,type),\"category must be a class\"\n assert issubclass(category,Warning),\"category must be a Warning subclass\"\n assert isinstance(module,str),\"module must be a string\"\n assert isinstance(lineno,int)and lineno >=0,\\\n \"lineno must be an int >= 0\"\n \n if message or module:\n import re\n \n if message:\n message=re.compile(message,re.I)\n else:\n message=None\n if module:\n module=re.compile(module)\n else:\n module=None\n \n _add_filter(action,message,category,module,lineno,append=append)\n \ndef simplefilter(action,category=Warning,lineno=0,append=False):\n ''\n\n\n\n\n\n\n\n \n assert action in(\"error\",\"ignore\",\"always\",\"default\",\"module\",\n \"once\"),\"invalid action: %r\"%(action,)\n assert isinstance(lineno,int)and lineno >=0,\\\n \"lineno must be an int >= 0\"\n _add_filter(action,None,category,None,lineno,append=append)\n \ndef _add_filter(*item,append):\n\n\n if not append:\n try:\n filters.remove(item)\n except ValueError:\n pass\n filters.insert(0,item)\n else:\n if item not in filters:\n filters.append(item)\n _filters_mutated()\n \ndef resetwarnings():\n ''\n filters[:]=[]\n _filters_mutated()\n \nclass _OptionError(Exception):\n ''\n pass\n \n \ndef _processoptions(args):\n for arg in args:\n try:\n _setoption(arg)\n except _OptionError as msg:\n print(\"Invalid -W option ignored:\",msg,file=sys.stderr)\n \n \ndef _setoption(arg):\n parts=arg.split(':')\n if len(parts)>5:\n raise _OptionError(\"too many fields (max 5): %r\"%(arg,))\n while len(parts)<5:\n parts.append('')\n action,message,category,module,lineno=[s.strip()\n for s in parts]\n action=_getaction(action)\n category=_getcategory(category)\n if message or module:\n import re\n if message:\n message=re.escape(message)\n if module:\n module=re.escape(module)+r'\\Z'\n if lineno:\n try:\n lineno=int(lineno)\n if lineno <0:\n raise ValueError\n except(ValueError,OverflowError):\n raise _OptionError(\"invalid lineno %r\"%(lineno,))from None\n else:\n lineno=0\n filterwarnings(action,message,category,module,lineno)\n \n \ndef _getaction(action):\n if not action:\n return \"default\"\n if action ==\"all\":return \"always\"\n for a in('default','always','ignore','module','once','error'):\n if a.startswith(action):\n return a\n raise _OptionError(\"invalid action: %r\"%(action,))\n \n \ndef _getcategory(category):\n if not category:\n return Warning\n if '.'not in category:\n import builtins as m\n klass=category\n else:\n module,_,klass=category.rpartition('.')\n try:\n m=__import__(module,None,None,[klass])\n except ImportError:\n raise _OptionError(\"invalid module name: %r\"%(module,))from None\n try:\n cat=getattr(m,klass)\n except AttributeError:\n raise _OptionError(\"unknown warning category: %r\"%(category,))from None\n if not issubclass(cat,Warning):\n raise _OptionError(\"invalid warning category: %r\"%(category,))\n return cat\n \n \ndef _is_internal_filename(filename):\n return 'importlib'in filename and '_bootstrap'in filename\n \n \ndef _is_filename_to_skip(filename,skip_file_prefixes):\n return any(filename.startswith(prefix)for prefix in skip_file_prefixes)\n \n \ndef _is_internal_frame(frame):\n ''\n return _is_internal_filename(frame.f_code.co_filename)\n \n \ndef _next_external_frame(frame,skip_file_prefixes):\n ''\n frame=frame.f_back\n while frame is not None and(\n _is_internal_filename(filename :=frame.f_code.co_filename)or\n _is_filename_to_skip(filename,skip_file_prefixes)):\n frame=frame.f_back\n return frame\n \n \n \ndef warn(message,category=None,stacklevel=1,source=None,\n*,skip_file_prefixes=()):\n ''\n \n if isinstance(message,Warning):\n category=message.__class__\n \n if category is None:\n category=UserWarning\n if not(isinstance(category,type)and issubclass(category,Warning)):\n raise TypeError(\"category must be a Warning subclass, \"\n \"not '{:s}'\".format(type(category).__name__))\n if not isinstance(skip_file_prefixes,tuple):\n \n raise TypeError('skip_file_prefixes must be a tuple of strs.')\n if skip_file_prefixes:\n stacklevel=max(2,stacklevel)\n \n try:\n if stacklevel <=1 or _is_internal_frame(sys._getframe(1)):\n \n \n frame=sys._getframe(stacklevel)\n else:\n frame=sys._getframe(1)\n \n for x in range(stacklevel -1):\n frame=_next_external_frame(frame,skip_file_prefixes)\n if frame is None:\n raise ValueError\n except ValueError:\n globals=sys.__dict__\n filename=\"sys\"\n lineno=1\n else:\n globals=frame.f_globals\n filename=frame.f_code.co_filename\n lineno=frame.f_lineno\n if '__name__'in globals:\n module=globals['__name__']\n else:\n module=\"\"\n registry=globals.setdefault(\"__warningregistry__\",{})\n warn_explicit(message,category,filename,lineno,module,registry,\n globals,source)\n \ndef warn_explicit(message,category,filename,lineno,\nmodule=None,registry=None,module_globals=None,\nsource=None):\n lineno=int(lineno)\n if module is None:\n module=filename or \"\"\n if module[-3:].lower()==\".py\":\n module=module[:-3]\n if registry is None:\n registry={}\n if registry.get('version',0)!=_filters_version:\n registry.clear()\n registry['version']=_filters_version\n if isinstance(message,Warning):\n text=str(message)\n category=message.__class__\n else:\n text=message\n message=category(message)\n key=(text,category,lineno)\n \n if registry.get(key):\n return\n \n for item in filters:\n action,msg,cat,mod,ln=item\n if((msg is None or msg.match(text))and\n issubclass(category,cat)and\n (mod is None or mod.match(module))and\n (ln ==0 or lineno ==ln)):\n break\n else:\n action=defaultaction\n \n if action ==\"ignore\":\n return\n \n \n \n import linecache\n linecache.getlines(filename,module_globals)\n \n if action ==\"error\":\n raise message\n \n if action ==\"once\":\n registry[key]=1\n oncekey=(text,category)\n if onceregistry.get(oncekey):\n return\n onceregistry[oncekey]=1\n elif action ==\"always\":\n pass\n elif action ==\"module\":\n registry[key]=1\n altkey=(text,category,0)\n if registry.get(altkey):\n return\n registry[altkey]=1\n elif action ==\"default\":\n registry[key]=1\n else:\n \n raise RuntimeError(\n \"Unrecognized action (%r) in warnings.filters:\\n %s\"%\n (action,item))\n \n msg=WarningMessage(message,category,filename,lineno,source)\n _showwarnmsg(msg)\n \n \nclass WarningMessage(object):\n\n _WARNING_DETAILS=(\"message\",\"category\",\"filename\",\"lineno\",\"file\",\n \"line\",\"source\")\n \n def __init__(self,message,category,filename,lineno,file=None,\n line=None,source=None):\n self.message=message\n self.category=category\n self.filename=filename\n self.lineno=lineno\n self.file=file\n self.line=line\n self.source=source\n self._category_name=category.__name__ if category else None\n \n def __str__(self):\n return(\"{message : %r, category : %r, filename : %r, lineno : %s, \"\n \"line : %r}\"%(self.message,self._category_name,\n self.filename,self.lineno,self.line))\n \n \nclass catch_warnings(object):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,*,record=False,module=None,\n action=None,category=Warning,lineno=0,append=False):\n ''\n\n\n\n\n\n \n self._record=record\n self._module=sys.modules['warnings']if module is None else module\n self._entered=False\n if action is None:\n self._filter=None\n else:\n self._filter=(action,category,lineno,append)\n \n def __repr__(self):\n args=[]\n if self._record:\n args.append(\"record=True\")\n if self._module is not sys.modules['warnings']:\n args.append(\"module=%r\"%self._module)\n name=type(self).__name__\n return \"%s(%s)\"%(name,\", \".join(args))\n \n def __enter__(self):\n if self._entered:\n raise RuntimeError(\"Cannot enter %r twice\"%self)\n self._entered=True\n self._filters=self._module.filters\n self._module.filters=self._filters[:]\n self._module._filters_mutated()\n self._showwarning=self._module.showwarning\n self._showwarnmsg_impl=self._module._showwarnmsg_impl\n if self._filter is not None:\n simplefilter(*self._filter)\n if self._record:\n log=[]\n self._module._showwarnmsg_impl=log.append\n \n \n self._module.showwarning=self._module._showwarning_orig\n return log\n else:\n return None\n \n def __exit__(self,*exc_info):\n if not self._entered:\n raise RuntimeError(\"Cannot exit %r without entering first\"%self)\n self._module.filters=self._filters\n self._module._filters_mutated()\n self._module.showwarning=self._showwarning\n self._module._showwarnmsg_impl=self._showwarnmsg_impl\n \n \n_DEPRECATED_MSG=\"{name!r} is deprecated and slated for removal in Python {remove}\"\n\ndef _deprecated(name,message=_DEPRECATED_MSG,*,remove,_version=sys.version_info):\n ''\n\n\n\n\n\n\n\n \n remove_formatted=f\"{remove[0]}.{remove[1]}\"\n if(_version[:2]>remove)or(_version[:2]==remove and _version[3]!=\"alpha\"):\n msg=f\"{name !r} was slated for removal after Python {remove_formatted} alpha\"\n raise RuntimeError(msg)\n else:\n msg=message.format(name=name,remove=remove_formatted)\n warn(msg,DeprecationWarning,stacklevel=3)\n \n \n \ndef _warn_unawaited_coroutine(coro):\n msg_lines=[\n f\"coroutine '{coro.__qualname__}' was never awaited\\n\"\n ]\n if coro.cr_origin is not None:\n import linecache,traceback\n def extract():\n for filename,lineno,funcname in reversed(coro.cr_origin):\n line=linecache.getline(filename,lineno)\n yield(filename,lineno,funcname,line)\n msg_lines.append(\"Coroutine created at (most recent call last)\\n\")\n msg_lines +=traceback.format_list(list(extract()))\n msg=\"\".join(msg_lines).rstrip(\"\\n\")\n \n \n \n \n \n \n warn(msg,category=RuntimeWarning,stacklevel=2,source=coro)\n \n \n \n \n \n \n \n \n \n \ntry:\n from _warnings import(filters,_defaultaction,_onceregistry,\n warn,warn_explicit,_filters_mutated)\n defaultaction=_defaultaction\n onceregistry=_onceregistry\n _warnings_defaults=True\nexcept ImportError:\n filters=[]\n defaultaction=\"default\"\n onceregistry={}\n \n _filters_version=1\n \n def _filters_mutated():\n global _filters_version\n _filters_version +=1\n \n _warnings_defaults=False\n \n \n \n_processoptions(sys.warnoptions)\nif not _warnings_defaults:\n\n if not hasattr(sys,'gettotalrefcount'):\n filterwarnings(\"default\",category=DeprecationWarning,\n module=\"__main__\",append=1)\n simplefilter(\"ignore\",category=DeprecationWarning,append=1)\n simplefilter(\"ignore\",category=PendingDeprecationWarning,append=1)\n simplefilter(\"ignore\",category=ImportWarning,append=1)\n simplefilter(\"ignore\",category=ResourceWarning,append=1)\n \ndel _warnings_defaults\n", ["_warnings", "builtins", "linecache", "re", "sys", "traceback", "tracemalloc"]], "weakref": [".py", "''\n\n\n\n\n\n\n\n\n\n\nfrom _weakref import (\ngetweakrefcount,\ngetweakrefs,\nref,\nproxy,\nCallableProxyType,\nProxyType,\nReferenceType,\n_remove_dead_weakref)\n\nfrom _weakrefset import WeakSet,_IterationGuard\n\nimport _collections_abc\nimport sys\nimport itertools\n\nProxyTypes=(ProxyType,CallableProxyType)\n\n__all__=[\"ref\",\"proxy\",\"getweakrefcount\",\"getweakrefs\",\n\"WeakKeyDictionary\",\"ReferenceType\",\"ProxyType\",\n\"CallableProxyType\",\"ProxyTypes\",\"WeakValueDictionary\",\n\"WeakSet\",\"WeakMethod\",\"finalize\"]\n\n\n_collections_abc.MutableSet.register(WeakSet)\n\nclass WeakMethod(ref):\n ''\n\n\n \n \n __slots__=\"_func_ref\",\"_meth_type\",\"_alive\",\"__weakref__\"\n \n def __new__(cls,meth,callback=None ):\n try :\n obj=meth.__self__\n func=meth.__func__\n except AttributeError:\n raise TypeError(\"argument should be a bound method, not {}\"\n .format(type(meth)))from None\n def _cb(arg):\n \n \n self=self_wr()\n if self._alive:\n self._alive=False\n if callback is not None :\n callback(self)\n self=ref.__new__(cls,obj,_cb)\n self._func_ref=ref(func,_cb)\n self._meth_type=type(meth)\n self._alive=True\n self_wr=ref(self)\n return self\n \n def __call__(self):\n obj=super().__call__()\n func=self._func_ref()\n if obj is None or func is None :\n return None\n return self._meth_type(func,obj)\n \n def __eq__(self,other):\n if isinstance(other,WeakMethod):\n if not self._alive or not other._alive:\n return self is other\n return ref.__eq__(self,other)and self._func_ref ==other._func_ref\n return NotImplemented\n \n def __ne__(self,other):\n if isinstance(other,WeakMethod):\n if not self._alive or not other._alive:\n return self is not other\n return ref.__ne__(self,other)or self._func_ref !=other._func_ref\n return NotImplemented\n \n __hash__=ref.__hash__\n \n \nclass WeakValueDictionary(_collections_abc.MutableMapping):\n ''\n\n\n\n \n \n \n \n \n \n \n def __init__(self,other=(),/,**kw):\n def remove(wr,selfref=ref(self),_atomic_removal=_remove_dead_weakref):\n self=selfref()\n if self is not None :\n if self._iterating:\n self._pending_removals.append(wr.key)\n else :\n \n \n _atomic_removal(self.data,wr.key)\n self._remove=remove\n \n self._pending_removals=[]\n self._iterating=set()\n self.data={}\n self.update(other,**kw)\n \n def _commit_removals(self,_atomic_removal=_remove_dead_weakref):\n pop=self._pending_removals.pop\n d=self.data\n \n \n while True :\n try :\n key=pop()\n except IndexError:\n return\n _atomic_removal(d,key)\n \n def __getitem__(self,key):\n if self._pending_removals:\n self._commit_removals()\n o=self.data[key]()\n if o is None :\n raise KeyError(key)\n else :\n return o\n \n def __delitem__(self,key):\n if self._pending_removals:\n self._commit_removals()\n del self.data[key]\n \n def __len__(self):\n if self._pending_removals:\n self._commit_removals()\n return len(self.data)\n \n def __contains__(self,key):\n if self._pending_removals:\n self._commit_removals()\n try :\n o=self.data[key]()\n except KeyError:\n return False\n return o is not None\n \n def __repr__(self):\n return \"<%s at %#x>\"%(self.__class__.__name__,id(self))\n \n def __setitem__(self,key,value):\n if self._pending_removals:\n self._commit_removals()\n self.data[key]=KeyedRef(value,self._remove,key)\n \n def copy(self):\n if self._pending_removals:\n self._commit_removals()\n new=WeakValueDictionary()\n with _IterationGuard(self):\n for key,wr in self.data.items():\n o=wr()\n if o is not None :\n new[key]=o\n return new\n \n __copy__=copy\n \n def __deepcopy__(self,memo):\n from copy import deepcopy\n if self._pending_removals:\n self._commit_removals()\n new=self.__class__()\n with _IterationGuard(self):\n for key,wr in self.data.items():\n o=wr()\n if o is not None :\n new[deepcopy(key,memo)]=o\n return new\n \n def get(self,key,default=None ):\n if self._pending_removals:\n self._commit_removals()\n try :\n wr=self.data[key]\n except KeyError:\n return default\n else :\n o=wr()\n if o is None :\n \n return default\n else :\n return o\n \n def items(self):\n if self._pending_removals:\n self._commit_removals()\n with _IterationGuard(self):\n for k,wr in self.data.items():\n v=wr()\n if v is not None :\n yield k,v\n \n def keys(self):\n if self._pending_removals:\n self._commit_removals()\n with _IterationGuard(self):\n for k,wr in self.data.items():\n if wr()is not None :\n yield k\n \n __iter__=keys\n \n def itervaluerefs(self):\n ''\n\n\n\n\n\n\n\n \n if self._pending_removals:\n self._commit_removals()\n with _IterationGuard(self):\n yield from self.data.values()\n \n def values(self):\n if self._pending_removals:\n self._commit_removals()\n with _IterationGuard(self):\n for wr in self.data.values():\n obj=wr()\n if obj is not None :\n yield obj\n \n def popitem(self):\n if self._pending_removals:\n self._commit_removals()\n while True :\n key,wr=self.data.popitem()\n o=wr()\n if o is not None :\n return key,o\n \n def pop(self,key,*args):\n if self._pending_removals:\n self._commit_removals()\n try :\n o=self.data.pop(key)()\n except KeyError:\n o=None\n if o is None :\n if args:\n return args[0]\n else :\n raise KeyError(key)\n else :\n return o\n \n def setdefault(self,key,default=None ):\n try :\n o=self.data[key]()\n except KeyError:\n o=None\n if o is None :\n if self._pending_removals:\n self._commit_removals()\n self.data[key]=KeyedRef(default,self._remove,key)\n return default\n else :\n return o\n \n def update(self,other=None ,/,**kwargs):\n if self._pending_removals:\n self._commit_removals()\n d=self.data\n if other is not None :\n if not hasattr(other,\"items\"):\n other=dict(other)\n for key,o in other.items():\n d[key]=KeyedRef(o,self._remove,key)\n for key,o in kwargs.items():\n d[key]=KeyedRef(o,self._remove,key)\n \n def valuerefs(self):\n ''\n\n\n\n\n\n\n\n \n if self._pending_removals:\n self._commit_removals()\n return list(self.data.values())\n \n def __ior__(self,other):\n self.update(other)\n return self\n \n def __or__(self,other):\n if isinstance(other,_collections_abc.Mapping):\n c=self.copy()\n c.update(other)\n return c\n return NotImplemented\n \n def __ror__(self,other):\n if isinstance(other,_collections_abc.Mapping):\n c=self.__class__()\n c.update(other)\n c.update(self)\n return c\n return NotImplemented\n \n \nclass KeyedRef(ref):\n ''\n\n\n\n\n\n\n \n \n __slots__=\"key\",\n \n def __new__(type,ob,callback,key):\n self=ref.__new__(type,ob,callback)\n self.key=key\n return self\n \n def __init__(self,ob,callback,key):\n super().__init__(ob,callback)\n \n \nclass WeakKeyDictionary(_collections_abc.MutableMapping):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,dict=None ):\n self.data={}\n def remove(k,selfref=ref(self)):\n self=selfref()\n if self is not None :\n if self._iterating:\n self._pending_removals.append(k)\n else :\n try :\n del self.data[k]\n except KeyError:\n pass\n self._remove=remove\n \n self._pending_removals=[]\n self._iterating=set()\n self._dirty_len=False\n if dict is not None :\n self.update(dict)\n \n def _commit_removals(self):\n \n \n \n \n pop=self._pending_removals.pop\n d=self.data\n while True :\n try :\n key=pop()\n except IndexError:\n return\n \n try :\n del d[key]\n except KeyError:\n pass\n \n def _scrub_removals(self):\n d=self.data\n self._pending_removals=[k for k in self._pending_removals if k in d]\n self._dirty_len=False\n \n def __delitem__(self,key):\n self._dirty_len=True\n del self.data[ref(key)]\n \n def __getitem__(self,key):\n return self.data[ref(key)]\n \n def __len__(self):\n if self._dirty_len and self._pending_removals:\n \n \n self._scrub_removals()\n return len(self.data)-len(self._pending_removals)\n \n def __repr__(self):\n return \"<%s at %#x>\"%(self.__class__.__name__,id(self))\n \n def __setitem__(self,key,value):\n self.data[ref(key,self._remove)]=value\n \n def copy(self):\n new=WeakKeyDictionary()\n with _IterationGuard(self):\n for key,value in self.data.items():\n o=key()\n if o is not None :\n new[o]=value\n return new\n \n __copy__=copy\n \n def __deepcopy__(self,memo):\n from copy import deepcopy\n new=self.__class__()\n with _IterationGuard(self):\n for key,value in self.data.items():\n o=key()\n if o is not None :\n new[o]=deepcopy(value,memo)\n return new\n \n def get(self,key,default=None ):\n return self.data.get(ref(key),default)\n \n def __contains__(self,key):\n try :\n wr=ref(key)\n except TypeError:\n return False\n return wr in self.data\n \n def items(self):\n with _IterationGuard(self):\n for wr,value in self.data.items():\n key=wr()\n if key is not None :\n yield key,value\n \n def keys(self):\n with _IterationGuard(self):\n for wr in self.data:\n obj=wr()\n if obj is not None :\n yield obj\n \n __iter__=keys\n \n def values(self):\n with _IterationGuard(self):\n for wr,value in self.data.items():\n if wr()is not None :\n yield value\n \n def keyrefs(self):\n ''\n\n\n\n\n\n\n\n \n return list(self.data)\n \n def popitem(self):\n self._dirty_len=True\n while True :\n key,value=self.data.popitem()\n o=key()\n if o is not None :\n return o,value\n \n def pop(self,key,*args):\n self._dirty_len=True\n return self.data.pop(ref(key),*args)\n \n def setdefault(self,key,default=None ):\n return self.data.setdefault(ref(key,self._remove),default)\n \n def update(self,dict=None ,/,**kwargs):\n d=self.data\n if dict is not None :\n if not hasattr(dict,\"items\"):\n dict=type({})(dict)\n for key,value in dict.items():\n d[ref(key,self._remove)]=value\n if len(kwargs):\n self.update(kwargs)\n \n def __ior__(self,other):\n self.update(other)\n return self\n \n def __or__(self,other):\n if isinstance(other,_collections_abc.Mapping):\n c=self.copy()\n c.update(other)\n return c\n return NotImplemented\n \n def __ror__(self,other):\n if isinstance(other,_collections_abc.Mapping):\n c=self.__class__()\n c.update(other)\n c.update(self)\n return c\n return NotImplemented\n \n \nclass finalize:\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n __slots__=()\n _registry={}\n _shutdown=False\n _index_iter=itertools.count()\n _dirty=False\n _registered_with_atexit=False\n \n class _Info:\n __slots__=(\"weakref\",\"func\",\"args\",\"kwargs\",\"atexit\",\"index\")\n \n def __init__(self,obj,func,/,*args,**kwargs):\n if not self._registered_with_atexit:\n \n \n import atexit\n atexit.register(self._exitfunc)\n finalize._registered_with_atexit=True\n info=self._Info()\n info.weakref=ref(obj,self)\n info.func=func\n info.args=args\n info.kwargs=kwargs or None\n info.atexit=True\n info.index=next(self._index_iter)\n self._registry[self]=info\n finalize._dirty=True\n \n def __call__(self,_=None ):\n ''\n \n info=self._registry.pop(self,None )\n if info and not self._shutdown:\n return info.func(*info.args,**(info.kwargs or {}))\n \n def detach(self):\n ''\n \n info=self._registry.get(self)\n obj=info and info.weakref()\n if obj is not None and self._registry.pop(self,None ):\n return (obj,info.func,info.args,info.kwargs or {})\n \n def peek(self):\n ''\n \n info=self._registry.get(self)\n obj=info and info.weakref()\n if obj is not None :\n return (obj,info.func,info.args,info.kwargs or {})\n \n @property\n def alive(self):\n ''\n return self in self._registry\n \n @property\n def atexit(self):\n ''\n info=self._registry.get(self)\n return bool(info)and info.atexit\n \n @atexit.setter\n def atexit(self,value):\n info=self._registry.get(self)\n if info:\n info.atexit=bool(value)\n \n def __repr__(self):\n info=self._registry.get(self)\n obj=info and info.weakref()\n if obj is None :\n return '<%s object at %#x; dead>'%(type(self).__name__,id(self))\n else :\n return '<%s object at %#x; for %r at %#x>'%\\\n (type(self).__name__,id(self),type(obj).__name__,id(obj))\n \n @classmethod\n def _select_for_exit(cls):\n \n L=[(f,i)for (f,i)in cls._registry.items()if i.atexit]\n L.sort(key=lambda item:item[1].index)\n return [f for (f,i)in L]\n \n @classmethod\n def _exitfunc(cls):\n \n \n \n reenable_gc=False\n try :\n if cls._registry:\n import gc\n if gc.isenabled():\n reenable_gc=True\n gc.disable()\n pending=None\n while True :\n if pending is None or finalize._dirty:\n pending=cls._select_for_exit()\n finalize._dirty=False\n if not pending:\n break\n f=pending.pop()\n try :\n \n \n \n \n f()\n except Exception:\n sys.excepthook(*sys.exc_info())\n assert f not in cls._registry\n finally :\n \n finalize._shutdown=True\n if reenable_gc:\n gc.enable()\n", ["_collections_abc", "_weakref", "_weakrefset", "atexit", "copy", "gc", "itertools", "sys"]], "webbrowser": [".py", "\n\nfrom browser import window\n\ndef open(url,new=0,autoraise=True ):\n window.open(url)\n \ndef open_new(url):\n return window.open(url,\"_blank\")\n \ndef open_new_tab(url):\n return open(url)\n \n", ["browser"]], "zipfile": [".py", "''\n\n\n\n\nimport binascii\nimport importlib.util\nimport io\nimport itertools\nimport os\nimport posixpath\nimport shutil\nimport stat\nimport struct\nimport sys\nimport threading\nimport time\nimport contextlib\nimport pathlib\n\ntry :\n import zlib\n crc32=zlib.crc32\nexcept ImportError:\n zlib=None\n crc32=binascii.crc32\n \ntry :\n import bz2\nexcept ImportError:\n bz2=None\n \ntry :\n import lzma\nexcept ImportError:\n lzma=None\n \n__all__=[\"BadZipFile\",\"BadZipfile\",\"error\",\n\"ZIP_STORED\",\"ZIP_DEFLATED\",\"ZIP_BZIP2\",\"ZIP_LZMA\",\n\"is_zipfile\",\"ZipInfo\",\"ZipFile\",\"PyZipFile\",\"LargeZipFile\",\n\"Path\"]\n\nclass BadZipFile(Exception):\n pass\n \n \nclass LargeZipFile(Exception):\n ''\n\n\n \n \nerror=BadZipfile=BadZipFile\n\n\nZIP64_LIMIT=(1 <<31)-1\nZIP_FILECOUNT_LIMIT=(1 <<16)-1\nZIP_MAX_COMMENT=(1 <<16)-1\n\n\nZIP_STORED=0\nZIP_DEFLATED=8\nZIP_BZIP2=12\nZIP_LZMA=14\n\n\nDEFAULT_VERSION=20\nZIP64_VERSION=45\nBZIP2_VERSION=46\nLZMA_VERSION=63\n\nMAX_EXTRACT_VERSION=63\n\n\n\n\n\n\n\n\n\nstructEndArchive=b\"<4s4H2LH\"\nstringEndArchive=b\"PK\\005\\006\"\nsizeEndCentDir=struct.calcsize(structEndArchive)\n\n_ECD_SIGNATURE=0\n_ECD_DISK_NUMBER=1\n_ECD_DISK_START=2\n_ECD_ENTRIES_THIS_DISK=3\n_ECD_ENTRIES_TOTAL=4\n_ECD_SIZE=5\n_ECD_OFFSET=6\n_ECD_COMMENT_SIZE=7\n\n\n_ECD_COMMENT=8\n_ECD_LOCATION=9\n\n\n\nstructCentralDir=\"<4s4B4HL2L5H2L\"\nstringCentralDir=b\"PK\\001\\002\"\nsizeCentralDir=struct.calcsize(structCentralDir)\n\n\n_CD_SIGNATURE=0\n_CD_CREATE_VERSION=1\n_CD_CREATE_SYSTEM=2\n_CD_EXTRACT_VERSION=3\n_CD_EXTRACT_SYSTEM=4\n_CD_FLAG_BITS=5\n_CD_COMPRESS_TYPE=6\n_CD_TIME=7\n_CD_DATE=8\n_CD_CRC=9\n_CD_COMPRESSED_SIZE=10\n_CD_UNCOMPRESSED_SIZE=11\n_CD_FILENAME_LENGTH=12\n_CD_EXTRA_FIELD_LENGTH=13\n_CD_COMMENT_LENGTH=14\n_CD_DISK_NUMBER_START=15\n_CD_INTERNAL_FILE_ATTRIBUTES=16\n_CD_EXTERNAL_FILE_ATTRIBUTES=17\n_CD_LOCAL_HEADER_OFFSET=18\n\n\n\n_MASK_ENCRYPTED=1 <<0\n\n_MASK_COMPRESS_OPTION_1=1 <<1\n\n\n\n\n_MASK_USE_DATA_DESCRIPTOR=1 <<3\n\n\n_MASK_COMPRESSED_PATCH=1 <<5\n_MASK_STRONG_ENCRYPTION=1 <<6\n\n\n\n\n_MASK_UTF_FILENAME=1 <<11\n\n\n\n\n\n\n\n\n\nstructFileHeader=\"<4s2B4HL2L2H\"\nstringFileHeader=b\"PK\\003\\004\"\nsizeFileHeader=struct.calcsize(structFileHeader)\n\n_FH_SIGNATURE=0\n_FH_EXTRACT_VERSION=1\n_FH_EXTRACT_SYSTEM=2\n_FH_GENERAL_PURPOSE_FLAG_BITS=3\n_FH_COMPRESSION_METHOD=4\n_FH_LAST_MOD_TIME=5\n_FH_LAST_MOD_DATE=6\n_FH_CRC=7\n_FH_COMPRESSED_SIZE=8\n_FH_UNCOMPRESSED_SIZE=9\n_FH_FILENAME_LENGTH=10\n_FH_EXTRA_FIELD_LENGTH=11\n\n\nstructEndArchive64Locator=\"<4sLQL\"\nstringEndArchive64Locator=b\"PK\\x06\\x07\"\nsizeEndCentDir64Locator=struct.calcsize(structEndArchive64Locator)\n\n\n\nstructEndArchive64=\"<4sQ2H2L4Q\"\nstringEndArchive64=b\"PK\\x06\\x06\"\nsizeEndCentDir64=struct.calcsize(structEndArchive64)\n\n_CD64_SIGNATURE=0\n_CD64_DIRECTORY_RECSIZE=1\n_CD64_CREATE_VERSION=2\n_CD64_EXTRACT_VERSION=3\n_CD64_DISK_NUMBER=4\n_CD64_DISK_NUMBER_START=5\n_CD64_NUMBER_ENTRIES_THIS_DISK=6\n_CD64_NUMBER_ENTRIES_TOTAL=7\n_CD64_DIRECTORY_SIZE=8\n_CD64_OFFSET_START_CENTDIR=9\n\n_DD_SIGNATURE=0x08074b50\n\n_EXTRA_FIELD_STRUCT=struct.Struct('1:\n raise BadZipFile(\"zipfiles that span multiple disks are not supported\")\n \n \n fpin.seek(offset -sizeEndCentDir64Locator -sizeEndCentDir64,2)\n data=fpin.read(sizeEndCentDir64)\n if len(data)!=sizeEndCentDir64:\n return endrec\n sig,sz,create_version,read_version,disk_num,disk_dir,\\\n dircount,dircount2,dirsize,diroffset=\\\n struct.unpack(structEndArchive64,data)\n if sig !=stringEndArchive64:\n return endrec\n \n \n endrec[_ECD_SIGNATURE]=sig\n endrec[_ECD_DISK_NUMBER]=disk_num\n endrec[_ECD_DISK_START]=disk_dir\n endrec[_ECD_ENTRIES_THIS_DISK]=dircount\n endrec[_ECD_ENTRIES_TOTAL]=dircount2\n endrec[_ECD_SIZE]=dirsize\n endrec[_ECD_OFFSET]=diroffset\n return endrec\n \n \ndef _EndRecData(fpin):\n ''\n\n\n \n \n \n fpin.seek(0,2)\n filesize=fpin.tell()\n \n \n \n \n try :\n fpin.seek(-sizeEndCentDir,2)\n except OSError:\n return None\n data=fpin.read()\n if (len(data)==sizeEndCentDir and\n data[0:4]==stringEndArchive and\n data[-2:]==b\"\\000\\000\"):\n \n endrec=struct.unpack(structEndArchive,data)\n endrec=list(endrec)\n \n \n endrec.append(b\"\")\n endrec.append(filesize -sizeEndCentDir)\n \n \n return _EndRecData64(fpin,-sizeEndCentDir,endrec)\n \n \n \n \n \n \n maxCommentStart=max(filesize -(1 <<16)-sizeEndCentDir,0)\n fpin.seek(maxCommentStart,0)\n data=fpin.read()\n start=data.rfind(stringEndArchive)\n if start >=0:\n \n recData=data[start:start+sizeEndCentDir]\n if len(recData)!=sizeEndCentDir:\n \n return None\n endrec=list(struct.unpack(structEndArchive,recData))\n commentSize=endrec[_ECD_COMMENT_SIZE]\n comment=data[start+sizeEndCentDir:start+sizeEndCentDir+commentSize]\n endrec.append(comment)\n endrec.append(maxCommentStart+start)\n \n \n return _EndRecData64(fpin,maxCommentStart+start -filesize,\n endrec)\n \n \n return None\n \n \nclass ZipInfo(object):\n ''\n \n __slots__=(\n 'orig_filename',\n 'filename',\n 'date_time',\n 'compress_type',\n '_compresslevel',\n 'comment',\n 'extra',\n 'create_system',\n 'create_version',\n 'extract_version',\n 'reserved',\n 'flag_bits',\n 'volume',\n 'internal_attr',\n 'external_attr',\n 'header_offset',\n 'CRC',\n 'compress_size',\n 'file_size',\n '_raw_time',\n )\n \n def __init__(self,filename=\"NoName\",date_time=(1980,1,1,0,0,0)):\n self.orig_filename=filename\n \n \n \n null_byte=filename.find(chr(0))\n if null_byte >=0:\n filename=filename[0:null_byte]\n \n \n \n if os.sep !=\"/\"and os.sep in filename:\n filename=filename.replace(os.sep,\"/\")\n \n self.filename=filename\n self.date_time=date_time\n \n if date_time[0]<1980:\n raise ValueError('ZIP does not support timestamps before 1980')\n \n \n self.compress_type=ZIP_STORED\n self._compresslevel=None\n self.comment=b\"\"\n self.extra=b\"\"\n if sys.platform =='win32':\n self.create_system=0\n else :\n \n self.create_system=3\n self.create_version=DEFAULT_VERSION\n self.extract_version=DEFAULT_VERSION\n self.reserved=0\n self.flag_bits=0\n self.volume=0\n self.internal_attr=0\n self.external_attr=0\n self.compress_size=0\n self.file_size=0\n \n \n \n \n def __repr__(self):\n result=['<%s filename=%r'%(self.__class__.__name__,self.filename)]\n if self.compress_type !=ZIP_STORED:\n result.append(' compress_type=%s'%\n compressor_names.get(self.compress_type,\n self.compress_type))\n hi=self.external_attr >>16\n lo=self.external_attr&0xFFFF\n if hi:\n result.append(' filemode=%r'%stat.filemode(hi))\n if lo:\n result.append(' external_attr=%#x'%lo)\n isdir=self.is_dir()\n if not isdir or self.file_size:\n result.append(' file_size=%r'%self.file_size)\n if ((not isdir or self.compress_size)and\n (self.compress_type !=ZIP_STORED or\n self.file_size !=self.compress_size)):\n result.append(' compress_size=%r'%self.compress_size)\n result.append('>')\n return ''.join(result)\n \n def FileHeader(self,zip64=None ):\n ''\n dt=self.date_time\n dosdate=(dt[0]-1980)<<9 |dt[1]<<5 |dt[2]\n dostime=dt[3]<<11 |dt[4]<<5 |(dt[5]//2)\n if self.flag_bits&_MASK_USE_DATA_DESCRIPTOR:\n \n CRC=compress_size=file_size=0\n else :\n CRC=self.CRC\n compress_size=self.compress_size\n file_size=self.file_size\n \n extra=self.extra\n \n min_version=0\n if zip64 is None :\n zip64=file_size >ZIP64_LIMIT or compress_size >ZIP64_LIMIT\n if zip64:\n fmt='ZIP64_LIMIT or compress_size >ZIP64_LIMIT:\n if not zip64:\n raise LargeZipFile(\"Filesize would require ZIP64 extensions\")\n \n \n file_size=0xffffffff\n compress_size=0xffffffff\n min_version=ZIP64_VERSION\n \n if self.compress_type ==ZIP_BZIP2:\n min_version=max(BZIP2_VERSION,min_version)\n elif self.compress_type ==ZIP_LZMA:\n min_version=max(LZMA_VERSION,min_version)\n \n self.extract_version=max(min_version,self.extract_version)\n self.create_version=max(min_version,self.create_version)\n filename,flag_bits=self._encodeFilenameFlags()\n header=struct.pack(structFileHeader,stringFileHeader,\n self.extract_version,self.reserved,flag_bits,\n self.compress_type,dostime,dosdate,CRC,\n compress_size,file_size,\n len(filename),len(extra))\n return header+filename+extra\n \n def _encodeFilenameFlags(self):\n try :\n return self.filename.encode('ascii'),self.flag_bits\n except UnicodeEncodeError:\n return self.filename.encode('utf-8'),self.flag_bits |_MASK_UTF_FILENAME\n \n def _decodeExtra(self):\n \n extra=self.extra\n unpack=struct.unpack\n while len(extra)>=4:\n tp,ln=unpack('len(extra):\n raise BadZipFile(\"Corrupt extra field %04x (size=%d)\"%(tp,ln))\n if tp ==0x0001:\n data=extra[4:ln+4]\n \n try :\n if self.file_size in (0xFFFF_FFFF_FFFF_FFFF,0xFFFF_FFFF):\n field=\"File size\"\n self.file_size,=unpack('2107:\n date_time=(2107,12,31,23,59,59)\n \n if arcname is None :\n arcname=filename\n arcname=os.path.normpath(os.path.splitdrive(arcname)[1])\n while arcname[0]in (os.sep,os.altsep):\n arcname=arcname[1:]\n if isdir:\n arcname +='/'\n zinfo=cls(arcname,date_time)\n zinfo.external_attr=(st.st_mode&0xFFFF)<<16\n if isdir:\n zinfo.file_size=0\n zinfo.external_attr |=0x10\n else :\n zinfo.file_size=st.st_size\n \n return zinfo\n \n def is_dir(self):\n ''\n return self.filename[-1]=='/'\n \n \n \n \n \n \n_crctable=None\ndef _gen_crc(crc):\n for j in range(8):\n if crc&1:\n crc=(crc >>1)^0xEDB88320\n else :\n crc >>=1\n return crc\n \n \n \n \n \n \n \n \n \ndef _ZipDecrypter(pwd):\n key0=305419896\n key1=591751049\n key2=878082192\n \n global _crctable\n if _crctable is None :\n _crctable=list(map(_gen_crc,range(256)))\n crctable=_crctable\n \n def crc32(ch,crc):\n ''\n return (crc >>8)^crctable[(crc ^ch)&0xFF]\n \n def update_keys(c):\n nonlocal key0,key1,key2\n key0=crc32(c,key0)\n key1=(key1+(key0&0xFF))&0xFFFFFFFF\n key1=(key1 *134775813+1)&0xFFFFFFFF\n key2=crc32(key1 >>24,key2)\n \n for p in pwd:\n update_keys(p)\n \n def decrypter(data):\n ''\n result=bytearray()\n append=result.append\n for c in data:\n k=key2 |2\n c ^=((k *(k ^1))>>8)&0xFF\n update_keys(c)\n append(c)\n return bytes(result)\n \n return decrypter\n \n \nclass LZMACompressor:\n\n def __init__(self):\n self._comp=None\n \n def _init(self):\n props=lzma._encode_filter_properties({'id':lzma.FILTER_LZMA1})\n self._comp=lzma.LZMACompressor(lzma.FORMAT_RAW,filters=[\n lzma._decode_filter_properties(lzma.FILTER_LZMA1,props)\n ])\n return struct.pack('>8)&0xff\n else :\n \n check_byte=(zipinfo.CRC >>24)&0xff\n h=self._init_decrypter()\n if h !=check_byte:\n raise RuntimeError(\"Bad password for file %r\"%zipinfo.orig_filename)\n \n \n def _init_decrypter(self):\n self._decrypter=_ZipDecrypter(self._pwd)\n \n \n \n \n \n header=self._fileobj.read(12)\n self._compress_left -=12\n return self._decrypter(header)[11]\n \n def __repr__(self):\n result=['<%s.%s'%(self.__class__.__module__,\n self.__class__.__qualname__)]\n if not self.closed:\n result.append(' name=%r mode=%r'%(self.name,self.mode))\n if self._compress_type !=ZIP_STORED:\n result.append(' compress_type=%s'%\n compressor_names.get(self._compress_type,\n self._compress_type))\n else :\n result.append(' [closed]')\n result.append('>')\n return ''.join(result)\n \n def readline(self,limit=-1):\n ''\n\n\n \n \n if limit <0:\n \n i=self._readbuffer.find(b'\\n',self._offset)+1\n if i >0:\n line=self._readbuffer[self._offset:i]\n self._offset=i\n return line\n \n return io.BufferedIOBase.readline(self,limit)\n \n def peek(self,n=1):\n ''\n if n >len(self._readbuffer)-self._offset:\n chunk=self.read(n)\n if len(chunk)>self._offset:\n self._readbuffer=chunk+self._readbuffer[self._offset:]\n self._offset=0\n else :\n self._offset -=len(chunk)\n \n \n return self._readbuffer[self._offset:self._offset+512]\n \n def readable(self):\n if self.closed:\n raise ValueError(\"I/O operation on closed file.\")\n return True\n \n def read(self,n=-1):\n ''\n\n \n if self.closed:\n raise ValueError(\"read from closed file.\")\n if n is None or n <0:\n buf=self._readbuffer[self._offset:]\n self._readbuffer=b''\n self._offset=0\n while not self._eof:\n buf +=self._read1(self.MAX_N)\n return buf\n \n end=n+self._offset\n if end 0 and not self._eof:\n data=self._read1(n)\n if n 0:\n while not self._eof:\n data=self._read1(n)\n if n len(data):\n data +=self._read2(n -len(data))\n else :\n data=self._read2(n)\n \n if self._compress_type ==ZIP_STORED:\n self._eof=self._compress_left <=0\n elif self._compress_type ==ZIP_DEFLATED:\n n=max(n,self.MIN_READ_SIZE)\n data=self._decompressor.decompress(data,n)\n self._eof=(self._decompressor.eof or\n self._compress_left <=0 and\n not self._decompressor.unconsumed_tail)\n if self._eof:\n data +=self._decompressor.flush()\n else :\n data=self._decompressor.decompress(data)\n self._eof=self._decompressor.eof or self._compress_left <=0\n \n data=data[:self._left]\n self._left -=len(data)\n if self._left <=0:\n self._eof=True\n self._update_crc(data)\n return data\n \n def _read2(self,n):\n if self._compress_left <=0:\n return b''\n \n n=max(n,self.MIN_READ_SIZE)\n n=min(n,self._compress_left)\n \n data=self._fileobj.read(n)\n self._compress_left -=len(data)\n if not data:\n raise EOFError\n \n if self._decrypter is not None :\n data=self._decrypter(data)\n return data\n \n def close(self):\n try :\n if self._close_fileobj:\n self._fileobj.close()\n finally :\n super().close()\n \n def seekable(self):\n if self.closed:\n raise ValueError(\"I/O operation on closed file.\")\n return self._seekable\n \n def seek(self,offset,whence=0):\n if self.closed:\n raise ValueError(\"seek on closed file.\")\n if not self._seekable:\n raise io.UnsupportedOperation(\"underlying stream is not seekable\")\n curr_pos=self.tell()\n if whence ==0:\n new_pos=offset\n elif whence ==1:\n new_pos=curr_pos+offset\n elif whence ==2:\n new_pos=self._orig_file_size+offset\n else :\n raise ValueError(\"whence must be os.SEEK_SET (0), \"\n \"os.SEEK_CUR (1), or os.SEEK_END (2)\")\n \n if new_pos >self._orig_file_size:\n new_pos=self._orig_file_size\n \n if new_pos <0:\n new_pos=0\n \n read_offset=new_pos -curr_pos\n buff_offset=read_offset+self._offset\n \n if buff_offset >=0 and buff_offset 0:\n read_len=min(self.MAX_SEEK_READ,read_offset)\n self.read(read_len)\n read_offset -=read_len\n \n return self.tell()\n \n def tell(self):\n if self.closed:\n raise ValueError(\"tell on closed file.\")\n if not self._seekable:\n raise io.UnsupportedOperation(\"underlying stream is not seekable\")\n filepos=self._orig_file_size -self._left -len(self._readbuffer)+self._offset\n return filepos\n \n \nclass _ZipWriteFile(io.BufferedIOBase):\n def __init__(self,zf,zinfo,zip64):\n self._zinfo=zinfo\n self._zip64=zip64\n self._zipfile=zf\n self._compressor=_get_compressor(zinfo.compress_type,\n zinfo._compresslevel)\n self._file_size=0\n self._compress_size=0\n self._crc=0\n \n @property\n def _fileobj(self):\n return self._zipfile.fp\n \n def writable(self):\n return True\n \n def write(self,data):\n if self.closed:\n raise ValueError('I/O operation on closed file.')\n \n \n if isinstance(data,(bytes,bytearray)):\n nbytes=len(data)\n else :\n data=memoryview(data)\n nbytes=data.nbytes\n self._file_size +=nbytes\n \n self._crc=crc32(data,self._crc)\n if self._compressor:\n data=self._compressor.compress(data)\n self._compress_size +=len(data)\n self._fileobj.write(data)\n return nbytes\n \n def close(self):\n if self.closed:\n return\n try :\n super().close()\n \n if self._compressor:\n buf=self._compressor.flush()\n self._compress_size +=len(buf)\n self._fileobj.write(buf)\n self._zinfo.compress_size=self._compress_size\n else :\n self._zinfo.compress_size=self._file_size\n self._zinfo.CRC=self._crc\n self._zinfo.file_size=self._file_size\n \n \n if self._zinfo.flag_bits&_MASK_USE_DATA_DESCRIPTOR:\n \n fmt='ZIP64_LIMIT:\n raise RuntimeError(\n 'File size unexpectedly exceeded ZIP64 limit')\n if self._compress_size >ZIP64_LIMIT:\n raise RuntimeError(\n 'Compressed size unexpectedly exceeded ZIP64 limit')\n \n \n \n \n self._zipfile.start_dir=self._fileobj.tell()\n self._fileobj.seek(self._zinfo.header_offset)\n self._fileobj.write(self._zinfo.FileHeader(self._zip64))\n self._fileobj.seek(self._zipfile.start_dir)\n \n \n self._zipfile.filelist.append(self._zinfo)\n self._zipfile.NameToInfo[self._zinfo.filename]=self._zinfo\n finally :\n self._zipfile._writing=False\n \n \n \nclass ZipFile:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n fp=None\n _windows_illegal_name_trans_table=None\n \n def __init__(self,file,mode=\"r\",compression=ZIP_STORED,allowZip64=True ,\n compresslevel=None ,*,strict_timestamps=True ,metadata_encoding=None ):\n ''\n \n if mode not in ('r','w','x','a'):\n raise ValueError(\"ZipFile requires mode 'r', 'w', 'x', or 'a'\")\n \n _check_compression(compression)\n \n self._allowZip64=allowZip64\n self._didModify=False\n self.debug=0\n self.NameToInfo={}\n self.filelist=[]\n self.compression=compression\n self.compresslevel=compresslevel\n self.mode=mode\n self.pwd=None\n self._comment=b''\n self._strict_timestamps=strict_timestamps\n self.metadata_encoding=metadata_encoding\n \n \n if self.metadata_encoding and mode !='r':\n raise ValueError(\n \"metadata_encoding is only supported for reading files\")\n \n \n if isinstance(file,os.PathLike):\n file=os.fspath(file)\n if isinstance(file,str):\n \n self._filePassed=0\n self.filename=file\n modeDict={'r':'rb','w':'w+b','x':'x+b','a':'r+b',\n 'r+b':'w+b','w+b':'wb','x+b':'xb'}\n filemode=modeDict[mode]\n while True :\n try :\n self.fp=io.open(file,filemode)\n except OSError:\n if filemode in modeDict:\n filemode=modeDict[filemode]\n continue\n raise\n break\n else :\n self._filePassed=1\n self.fp=file\n self.filename=getattr(file,'name',None )\n self._fileRefCnt=1\n self._lock=threading.RLock()\n self._seekable=True\n self._writing=False\n \n try :\n if mode =='r':\n self._RealGetContents()\n elif mode in ('w','x'):\n \n \n self._didModify=True\n try :\n self.start_dir=self.fp.tell()\n except (AttributeError,OSError):\n self.fp=_Tellable(self.fp)\n self.start_dir=0\n self._seekable=False\n else :\n \n try :\n self.fp.seek(self.start_dir)\n except (AttributeError,OSError):\n self._seekable=False\n elif mode =='a':\n try :\n \n self._RealGetContents()\n \n self.fp.seek(self.start_dir)\n except BadZipFile:\n \n self.fp.seek(0,2)\n \n \n \n self._didModify=True\n self.start_dir=self.fp.tell()\n else :\n raise ValueError(\"Mode must be 'r', 'w', 'x', or 'a'\")\n except :\n fp=self.fp\n self.fp=None\n self._fpclose(fp)\n raise\n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,traceback):\n self.close()\n \n def __repr__(self):\n result=['<%s.%s'%(self.__class__.__module__,\n self.__class__.__qualname__)]\n if self.fp is not None :\n if self._filePassed:\n result.append(' file=%r'%self.fp)\n elif self.filename is not None :\n result.append(' filename=%r'%self.filename)\n result.append(' mode=%r'%self.mode)\n else :\n result.append(' [closed]')\n result.append('>')\n return ''.join(result)\n \n def _RealGetContents(self):\n ''\n fp=self.fp\n try :\n endrec=_EndRecData(fp)\n except OSError:\n raise BadZipFile(\"File is not a zip file\")\n if not endrec:\n raise BadZipFile(\"File is not a zip file\")\n if self.debug >1:\n print(endrec)\n size_cd=endrec[_ECD_SIZE]\n offset_cd=endrec[_ECD_OFFSET]\n self._comment=endrec[_ECD_COMMENT]\n \n \n concat=endrec[_ECD_LOCATION]-size_cd -offset_cd\n if endrec[_ECD_SIGNATURE]==stringEndArchive64:\n \n concat -=(sizeEndCentDir64+sizeEndCentDir64Locator)\n \n if self.debug >2:\n inferred=concat+offset_cd\n print(\"given, inferred, offset\",offset_cd,inferred,concat)\n \n self.start_dir=offset_cd+concat\n if self.start_dir <0:\n raise BadZipFile(\"Bad offset for central directory\")\n fp.seek(self.start_dir,0)\n data=fp.read(size_cd)\n fp=io.BytesIO(data)\n total=0\n while total 2:\n print(centdir)\n filename=fp.read(centdir[_CD_FILENAME_LENGTH])\n flags=centdir[_CD_FLAG_BITS]\n if flags&_MASK_UTF_FILENAME:\n \n filename=filename.decode('utf-8')\n else :\n \n filename=filename.decode(self.metadata_encoding or 'cp437')\n \n x=ZipInfo(filename)\n x.extra=fp.read(centdir[_CD_EXTRA_FIELD_LENGTH])\n x.comment=fp.read(centdir[_CD_COMMENT_LENGTH])\n x.header_offset=centdir[_CD_LOCAL_HEADER_OFFSET]\n (x.create_version,x.create_system,x.extract_version,x.reserved,\n x.flag_bits,x.compress_type,t,d,\n x.CRC,x.compress_size,x.file_size)=centdir[1:12]\n if x.extract_version >MAX_EXTRACT_VERSION:\n raise NotImplementedError(\"zip file version %.1f\"%\n (x.extract_version /10))\n x.volume,x.internal_attr,x.external_attr=centdir[15:18]\n \n x._raw_time=t\n x.date_time=((d >>9)+1980,(d >>5)&0xF,d&0x1F,\n t >>11,(t >>5)&0x3F,(t&0x1F)*2)\n \n x._decodeExtra()\n x.header_offset=x.header_offset+concat\n self.filelist.append(x)\n self.NameToInfo[x.filename]=x\n \n \n total=(total+sizeCentralDir+centdir[_CD_FILENAME_LENGTH]\n +centdir[_CD_EXTRA_FIELD_LENGTH]\n +centdir[_CD_COMMENT_LENGTH])\n \n if self.debug >2:\n print(\"total\",total)\n \n \n def namelist(self):\n ''\n return [data.filename for data in self.filelist]\n \n def infolist(self):\n ''\n \n return self.filelist\n \n def printdir(self,file=None ):\n ''\n print(\"%-46s %19s %12s\"%(\"File Name\",\"Modified \",\"Size\"),\n file=file)\n for zinfo in self.filelist:\n date=\"%d-%02d-%02d %02d:%02d:%02d\"%zinfo.date_time[:6]\n print(\"%-46s %s %12d\"%(zinfo.filename,date,zinfo.file_size),\n file=file)\n \n def testzip(self):\n ''\n chunk_size=2 **20\n for zinfo in self.filelist:\n try :\n \n \n with self.open(zinfo.filename,\"r\")as f:\n while f.read(chunk_size):\n pass\n except BadZipFile:\n return zinfo.filename\n \n def getinfo(self,name):\n ''\n info=self.NameToInfo.get(name)\n if info is None :\n raise KeyError(\n 'There is no item named %r in the archive'%name)\n \n return info\n \n def setpassword(self,pwd):\n ''\n if pwd and not isinstance(pwd,bytes):\n raise TypeError(\"pwd: expected bytes, got %s\"%type(pwd).__name__)\n if pwd:\n self.pwd=pwd\n else :\n self.pwd=None\n \n @property\n def comment(self):\n ''\n return self._comment\n \n @comment.setter\n def comment(self,comment):\n if not isinstance(comment,bytes):\n raise TypeError(\"comment: expected bytes, got %s\"%type(comment).__name__)\n \n if len(comment)>ZIP_MAX_COMMENT:\n import warnings\n warnings.warn('Archive comment is too long; truncating to %d bytes'\n %ZIP_MAX_COMMENT,stacklevel=2)\n comment=comment[:ZIP_MAX_COMMENT]\n self._comment=comment\n self._didModify=True\n \n def read(self,name,pwd=None ):\n ''\n with self.open(name,\"r\",pwd)as fp:\n return fp.read()\n \n def open(self,name,mode=\"r\",pwd=None ,*,force_zip64=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if mode not in {\"r\",\"w\"}:\n raise ValueError('open() requires mode \"r\" or \"w\"')\n if pwd and (mode ==\"w\"):\n raise ValueError(\"pwd is only supported for reading files\")\n if not self.fp:\n raise ValueError(\n \"Attempt to use ZIP archive that was already closed\")\n \n \n if isinstance(name,ZipInfo):\n \n zinfo=name\n elif mode =='w':\n zinfo=ZipInfo(name)\n zinfo.compress_type=self.compression\n zinfo._compresslevel=self.compresslevel\n else :\n \n zinfo=self.getinfo(name)\n \n if mode =='w':\n return self._open_to_write(zinfo,force_zip64=force_zip64)\n \n if self._writing:\n raise ValueError(\"Can't read from the ZIP file while there \"\n \"is an open writing handle on it. \"\n \"Close the writing handle before trying to read.\")\n \n \n self._fileRefCnt +=1\n zef_file=_SharedFile(self.fp,zinfo.header_offset,\n self._fpclose,self._lock,lambda :self._writing)\n try :\n \n fheader=zef_file.read(sizeFileHeader)\n if len(fheader)!=sizeFileHeader:\n raise BadZipFile(\"Truncated file header\")\n fheader=struct.unpack(structFileHeader,fheader)\n if fheader[_FH_SIGNATURE]!=stringFileHeader:\n raise BadZipFile(\"Bad magic number for file header\")\n \n fname=zef_file.read(fheader[_FH_FILENAME_LENGTH])\n if fheader[_FH_EXTRA_FIELD_LENGTH]:\n zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])\n \n if zinfo.flag_bits&_MASK_COMPRESSED_PATCH:\n \n raise NotImplementedError(\"compressed patched data (flag bit 5)\")\n \n if zinfo.flag_bits&_MASK_STRONG_ENCRYPTION:\n \n raise NotImplementedError(\"strong encryption (flag bit 6)\")\n \n if fheader[_FH_GENERAL_PURPOSE_FLAG_BITS]&_MASK_UTF_FILENAME:\n \n fname_str=fname.decode(\"utf-8\")\n else :\n fname_str=fname.decode(self.metadata_encoding or \"cp437\")\n \n if fname_str !=zinfo.orig_filename:\n raise BadZipFile(\n 'File name in directory %r and header %r differ.'\n %(zinfo.orig_filename,fname))\n \n \n is_encrypted=zinfo.flag_bits&_MASK_ENCRYPTED\n if is_encrypted:\n if not pwd:\n pwd=self.pwd\n if pwd and not isinstance(pwd,bytes):\n raise TypeError(\"pwd: expected bytes, got %s\"%type(pwd).__name__)\n if not pwd:\n raise RuntimeError(\"File %r is encrypted, password \"\n \"required for extraction\"%name)\n else :\n pwd=None\n \n return ZipExtFile(zef_file,mode,zinfo,pwd,True )\n except :\n zef_file.close()\n raise\n \n def _open_to_write(self,zinfo,force_zip64=False ):\n if force_zip64 and not self._allowZip64:\n raise ValueError(\n \"force_zip64 is True, but allowZip64 was False when opening \"\n \"the ZIP file.\"\n )\n if self._writing:\n raise ValueError(\"Can't write to the ZIP file while there is \"\n \"another write handle open on it. \"\n \"Close the first handle before opening another.\")\n \n \n zinfo.compress_size=0\n zinfo.CRC=0\n \n zinfo.flag_bits=0x00\n if zinfo.compress_type ==ZIP_LZMA:\n \n zinfo.flag_bits |=_MASK_COMPRESS_OPTION_1\n if not self._seekable:\n zinfo.flag_bits |=_MASK_USE_DATA_DESCRIPTOR\n \n if not zinfo.external_attr:\n zinfo.external_attr=0o600 <<16\n \n \n zip64=self._allowZip64 and\\\n (force_zip64 or zinfo.file_size *1.05 >ZIP64_LIMIT)\n \n if self._seekable:\n self.fp.seek(self.start_dir)\n zinfo.header_offset=self.fp.tell()\n \n self._writecheck(zinfo)\n self._didModify=True\n \n self.fp.write(zinfo.FileHeader(zip64))\n \n self._writing=True\n return _ZipWriteFile(self,zinfo,zip64)\n \n def extract(self,member,path=None ,pwd=None ):\n ''\n\n\n\n \n if path is None :\n path=os.getcwd()\n else :\n path=os.fspath(path)\n \n return self._extract_member(member,path,pwd)\n \n def extractall(self,path=None ,members=None ,pwd=None ):\n ''\n\n\n\n \n if members is None :\n members=self.namelist()\n \n if path is None :\n path=os.getcwd()\n else :\n path=os.fspath(path)\n \n for zipinfo in members:\n self._extract_member(zipinfo,path,pwd)\n \n @classmethod\n def _sanitize_windows_name(cls,arcname,pathsep):\n ''\n table=cls._windows_illegal_name_trans_table\n if not table:\n illegal=':<>|\"?*'\n table=str.maketrans(illegal,'_'*len(illegal))\n cls._windows_illegal_name_trans_table=table\n arcname=arcname.translate(table)\n \n arcname=(x.rstrip('.')for x in arcname.split(pathsep))\n \n arcname=pathsep.join(x for x in arcname if x)\n return arcname\n \n def _extract_member(self,member,targetpath,pwd):\n ''\n\n \n if not isinstance(member,ZipInfo):\n member=self.getinfo(member)\n \n \n \n arcname=member.filename.replace('/',os.path.sep)\n \n if os.path.altsep:\n arcname=arcname.replace(os.path.altsep,os.path.sep)\n \n \n arcname=os.path.splitdrive(arcname)[1]\n invalid_path_parts=('',os.path.curdir,os.path.pardir)\n arcname=os.path.sep.join(x for x in arcname.split(os.path.sep)\n if x not in invalid_path_parts)\n if os.path.sep =='\\\\':\n \n arcname=self._sanitize_windows_name(arcname,os.path.sep)\n \n targetpath=os.path.join(targetpath,arcname)\n targetpath=os.path.normpath(targetpath)\n \n \n upperdirs=os.path.dirname(targetpath)\n if upperdirs and not os.path.exists(upperdirs):\n os.makedirs(upperdirs)\n \n if member.is_dir():\n if not os.path.isdir(targetpath):\n os.mkdir(targetpath)\n return targetpath\n \n with self.open(member,pwd=pwd)as source,\\\n open(targetpath,\"wb\")as target:\n shutil.copyfileobj(source,target)\n \n return targetpath\n \n def _writecheck(self,zinfo):\n ''\n if zinfo.filename in self.NameToInfo:\n import warnings\n warnings.warn('Duplicate name: %r'%zinfo.filename,stacklevel=3)\n if self.mode not in ('w','x','a'):\n raise ValueError(\"write() requires mode 'w', 'x', or 'a'\")\n if not self.fp:\n raise ValueError(\n \"Attempt to write ZIP archive that was already closed\")\n _check_compression(zinfo.compress_type)\n if not self._allowZip64:\n requires_zip64=None\n if len(self.filelist)>=ZIP_FILECOUNT_LIMIT:\n requires_zip64=\"Files count\"\n elif zinfo.file_size >ZIP64_LIMIT:\n requires_zip64=\"Filesize\"\n elif zinfo.header_offset >ZIP64_LIMIT:\n requires_zip64=\"Zipfile size\"\n if requires_zip64:\n raise LargeZipFile(requires_zip64+\n \" would require ZIP64 extensions\")\n \n def write(self,filename,arcname=None ,\n compress_type=None ,compresslevel=None ):\n ''\n \n if not self.fp:\n raise ValueError(\n \"Attempt to write to ZIP archive that was already closed\")\n if self._writing:\n raise ValueError(\n \"Can't write to ZIP archive while an open writing handle exists\"\n )\n \n zinfo=ZipInfo.from_file(filename,arcname,\n strict_timestamps=self._strict_timestamps)\n \n if zinfo.is_dir():\n zinfo.compress_size=0\n zinfo.CRC=0\n self.mkdir(zinfo)\n else :\n if compress_type is not None :\n zinfo.compress_type=compress_type\n else :\n zinfo.compress_type=self.compression\n \n if compresslevel is not None :\n zinfo._compresslevel=compresslevel\n else :\n zinfo._compresslevel=self.compresslevel\n \n with open(filename,\"rb\")as src,self.open(zinfo,'w')as dest:\n shutil.copyfileobj(src,dest,1024 *8)\n \n def writestr(self,zinfo_or_arcname,data,\n compress_type=None ,compresslevel=None ):\n ''\n\n\n\n \n if isinstance(data,str):\n data=data.encode(\"utf-8\")\n if not isinstance(zinfo_or_arcname,ZipInfo):\n zinfo=ZipInfo(filename=zinfo_or_arcname,\n date_time=time.localtime(time.time())[:6])\n zinfo.compress_type=self.compression\n zinfo._compresslevel=self.compresslevel\n if zinfo.filename[-1]=='/':\n zinfo.external_attr=0o40775 <<16\n zinfo.external_attr |=0x10\n else :\n zinfo.external_attr=0o600 <<16\n else :\n zinfo=zinfo_or_arcname\n \n if not self.fp:\n raise ValueError(\n \"Attempt to write to ZIP archive that was already closed\")\n if self._writing:\n raise ValueError(\n \"Can't write to ZIP archive while an open writing handle exists.\"\n )\n \n if compress_type is not None :\n zinfo.compress_type=compress_type\n \n if compresslevel is not None :\n zinfo._compresslevel=compresslevel\n \n zinfo.file_size=len(data)\n with self._lock:\n with self.open(zinfo,mode='w')as dest:\n dest.write(data)\n \n def mkdir(self,zinfo_or_directory_name,mode=511):\n ''\n if isinstance(zinfo_or_directory_name,ZipInfo):\n zinfo=zinfo_or_directory_name\n if not zinfo.is_dir():\n raise ValueError(\"The given ZipInfo does not describe a directory\")\n elif isinstance(zinfo_or_directory_name,str):\n directory_name=zinfo_or_directory_name\n if not directory_name.endswith(\"/\"):\n directory_name +=\"/\"\n zinfo=ZipInfo(directory_name)\n zinfo.compress_size=0\n zinfo.CRC=0\n zinfo.external_attr=((0o40000 |mode)&0xFFFF)<<16\n zinfo.file_size=0\n zinfo.external_attr |=0x10\n else :\n raise TypeError(\"Expected type str or ZipInfo\")\n \n with self._lock:\n if self._seekable:\n self.fp.seek(self.start_dir)\n zinfo.header_offset=self.fp.tell()\n if zinfo.compress_type ==ZIP_LZMA:\n \n zinfo.flag_bits |=_MASK_COMPRESS_OPTION_1\n \n self._writecheck(zinfo)\n self._didModify=True\n \n self.filelist.append(zinfo)\n self.NameToInfo[zinfo.filename]=zinfo\n self.fp.write(zinfo.FileHeader(False ))\n self.start_dir=self.fp.tell()\n \n def __del__(self):\n ''\n self.close()\n \n def close(self):\n ''\n \n if self.fp is None :\n return\n \n if self._writing:\n raise ValueError(\"Can't close the ZIP file while there is \"\n \"an open writing handle on it. \"\n \"Close the writing handle before closing the zip.\")\n \n try :\n if self.mode in ('w','x','a')and self._didModify:\n with self._lock:\n if self._seekable:\n self.fp.seek(self.start_dir)\n self._write_end_record()\n finally :\n fp=self.fp\n self.fp=None\n self._fpclose(fp)\n \n def _write_end_record(self):\n for zinfo in self.filelist:\n dt=zinfo.date_time\n dosdate=(dt[0]-1980)<<9 |dt[1]<<5 |dt[2]\n dostime=dt[3]<<11 |dt[4]<<5 |(dt[5]//2)\n extra=[]\n if zinfo.file_size >ZIP64_LIMIT\\\n or zinfo.compress_size >ZIP64_LIMIT:\n extra.append(zinfo.file_size)\n extra.append(zinfo.compress_size)\n file_size=0xffffffff\n compress_size=0xffffffff\n else :\n file_size=zinfo.file_size\n compress_size=zinfo.compress_size\n \n if zinfo.header_offset >ZIP64_LIMIT:\n extra.append(zinfo.header_offset)\n header_offset=0xffffffff\n else :\n header_offset=zinfo.header_offset\n \n extra_data=zinfo.extra\n min_version=0\n if extra:\n \n extra_data=_strip_extra(extra_data,(1,))\n extra_data=struct.pack(\n 'ZIP_FILECOUNT_LIMIT:\n requires_zip64=\"Files count\"\n elif centDirOffset >ZIP64_LIMIT:\n requires_zip64=\"Central directory offset\"\n elif centDirSize >ZIP64_LIMIT:\n requires_zip64=\"Central directory size\"\n if requires_zip64:\n \n if not self._allowZip64:\n raise LargeZipFile(requires_zip64+\n \" would require ZIP64 extensions\")\n zip64endrec=struct.pack(\n structEndArchive64,stringEndArchive64,\n 44,45,45,0,0,centDirCount,centDirCount,\n centDirSize,centDirOffset)\n self.fp.write(zip64endrec)\n \n zip64locrec=struct.pack(\n structEndArchive64Locator,\n stringEndArchive64Locator,0,pos2,1)\n self.fp.write(zip64locrec)\n centDirCount=min(centDirCount,0xFFFF)\n centDirSize=min(centDirSize,0xFFFFFFFF)\n centDirOffset=min(centDirOffset,0xFFFFFFFF)\n \n endrec=struct.pack(structEndArchive,stringEndArchive,\n 0,0,centDirCount,centDirCount,\n centDirSize,centDirOffset,len(self._comment))\n self.fp.write(endrec)\n self.fp.write(self._comment)\n if self.mode ==\"a\":\n self.fp.truncate()\n self.fp.flush()\n \n def _fpclose(self,fp):\n assert self._fileRefCnt >0\n self._fileRefCnt -=1\n if not self._fileRefCnt and not self._filePassed:\n fp.close()\n \n \nclass PyZipFile(ZipFile):\n ''\n \n def __init__(self,file,mode=\"r\",compression=ZIP_STORED,\n allowZip64=True ,optimize=-1):\n ZipFile.__init__(self,file,mode=mode,compression=compression,\n allowZip64=allowZip64)\n self._optimize=optimize\n \n def writepy(self,pathname,basename=\"\",filterfunc=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n pathname=os.fspath(pathname)\n if filterfunc and not filterfunc(pathname):\n if self.debug:\n label='path'if os.path.isdir(pathname)else 'file'\n print('%s %r skipped by filterfunc'%(label,pathname))\n return\n dir,name=os.path.split(pathname)\n if os.path.isdir(pathname):\n initname=os.path.join(pathname,\"__init__.py\")\n if os.path.isfile(initname):\n \n if basename:\n basename=\"%s/%s\"%(basename,name)\n else :\n basename=name\n if self.debug:\n print(\"Adding package in\",pathname,\"as\",basename)\n fname,arcname=self._get_codename(initname[0:-3],basename)\n if self.debug:\n print(\"Adding\",arcname)\n self.write(fname,arcname)\n dirlist=sorted(os.listdir(pathname))\n dirlist.remove(\"__init__.py\")\n \n for filename in dirlist:\n path=os.path.join(pathname,filename)\n root,ext=os.path.splitext(filename)\n if os.path.isdir(path):\n if os.path.isfile(os.path.join(path,\"__init__.py\")):\n \n self.writepy(path,basename,\n filterfunc=filterfunc)\n elif ext ==\".py\":\n if filterfunc and not filterfunc(path):\n if self.debug:\n print('file %r skipped by filterfunc'%path)\n continue\n fname,arcname=self._get_codename(path[0:-3],\n basename)\n if self.debug:\n print(\"Adding\",arcname)\n self.write(fname,arcname)\n else :\n \n if self.debug:\n print(\"Adding files from directory\",pathname)\n for filename in sorted(os.listdir(pathname)):\n path=os.path.join(pathname,filename)\n root,ext=os.path.splitext(filename)\n if ext ==\".py\":\n if filterfunc and not filterfunc(path):\n if self.debug:\n print('file %r skipped by filterfunc'%path)\n continue\n fname,arcname=self._get_codename(path[0:-3],\n basename)\n if self.debug:\n print(\"Adding\",arcname)\n self.write(fname,arcname)\n else :\n if pathname[-3:]!=\".py\":\n raise RuntimeError(\n 'Files added with writepy() must end with \".py\"')\n fname,arcname=self._get_codename(pathname[0:-3],basename)\n if self.debug:\n print(\"Adding file\",arcname)\n self.write(fname,arcname)\n \n def _get_codename(self,pathname,basename):\n ''\n\n\n\n\n \n def _compile(file,optimize=-1):\n import py_compile\n if self.debug:\n print(\"Compiling\",file)\n try :\n py_compile.compile(file,doraise=True ,optimize=optimize)\n except py_compile.PyCompileError as err:\n print(err.msg)\n return False\n return True\n \n file_py=pathname+\".py\"\n file_pyc=pathname+\".pyc\"\n pycache_opt0=importlib.util.cache_from_source(file_py,optimization='')\n pycache_opt1=importlib.util.cache_from_source(file_py,optimization=1)\n pycache_opt2=importlib.util.cache_from_source(file_py,optimization=2)\n if self._optimize ==-1:\n \n if (os.path.isfile(file_pyc)and\n os.stat(file_pyc).st_mtime >=os.stat(file_py).st_mtime):\n \n arcname=fname=file_pyc\n elif (os.path.isfile(pycache_opt0)and\n os.stat(pycache_opt0).st_mtime >=os.stat(file_py).st_mtime):\n \n \n fname=pycache_opt0\n arcname=file_pyc\n elif (os.path.isfile(pycache_opt1)and\n os.stat(pycache_opt1).st_mtime >=os.stat(file_py).st_mtime):\n \n \n fname=pycache_opt1\n arcname=file_pyc\n elif (os.path.isfile(pycache_opt2)and\n os.stat(pycache_opt2).st_mtime >=os.stat(file_py).st_mtime):\n \n \n fname=pycache_opt2\n arcname=file_pyc\n else :\n \n if _compile(file_py):\n if sys.flags.optimize ==0:\n fname=pycache_opt0\n elif sys.flags.optimize ==1:\n fname=pycache_opt1\n else :\n fname=pycache_opt2\n arcname=file_pyc\n else :\n fname=arcname=file_py\n else :\n \n if self._optimize ==0:\n fname=pycache_opt0\n arcname=file_pyc\n else :\n arcname=file_pyc\n if self._optimize ==1:\n fname=pycache_opt1\n elif self._optimize ==2:\n fname=pycache_opt2\n else :\n msg=\"invalid value for 'optimize': {!r}\".format(self._optimize)\n raise ValueError(msg)\n if not (os.path.isfile(fname)and\n os.stat(fname).st_mtime >=os.stat(file_py).st_mtime):\n if not _compile(file_py,optimize=self._optimize):\n fname=arcname=file_py\n archivename=os.path.split(arcname)[1]\n if basename:\n archivename=\"%s/%s\"%(basename,archivename)\n return (fname,archivename)\n \n \ndef _parents(path):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return itertools.islice(_ancestry(path),1,None )\n \n \ndef _ancestry(path):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n path=path.rstrip(posixpath.sep)\n while path and path !=posixpath.sep:\n yield path\n path,tail=posixpath.split(path)\n \n \n_dedupe=dict.fromkeys\n''\n\n\ndef _difference(minuend,subtrahend):\n ''\n\n\n \n return itertools.filterfalse(set(subtrahend).__contains__,minuend)\n \n \nclass CompleteDirs(ZipFile):\n ''\n\n\n \n \n @staticmethod\n def _implied_dirs(names):\n parents=itertools.chain.from_iterable(map(_parents,names))\n as_dirs=(p+posixpath.sep for p in parents)\n return _dedupe(_difference(as_dirs,names))\n \n def namelist(self):\n names=super(CompleteDirs,self).namelist()\n return names+list(self._implied_dirs(names))\n \n def _name_set(self):\n return set(self.namelist())\n \n def resolve_dir(self,name):\n ''\n\n\n \n names=self._name_set()\n dirname=name+'/'\n dir_match=name not in names and dirname in names\n return dirname if dir_match else name\n \n @classmethod\n def make(cls,source):\n ''\n\n\n \n if isinstance(source,CompleteDirs):\n return source\n \n if not isinstance(source,ZipFile):\n return cls(source)\n \n \n if 'r'not in source.mode:\n cls=CompleteDirs\n \n source.__class__=cls\n return source\n \n \nclass FastLookup(CompleteDirs):\n ''\n\n\n \n \n def namelist(self):\n with contextlib.suppress(AttributeError):\n return self.__names\n self.__names=super(FastLookup,self).namelist()\n return self.__names\n \n def _name_set(self):\n with contextlib.suppress(AttributeError):\n return self.__lookup\n self.__lookup=super(FastLookup,self)._name_set()\n return self.__lookup\n \n \nclass Path:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __repr=\"{self.__class__.__name__}({self.root.filename!r}, {self.at!r})\"\n \n def __init__(self,root,at=\"\"):\n ''\n\n\n\n\n\n\n\n \n self.root=FastLookup.make(root)\n self.at=at\n \n def open(self,mode='r',*args,pwd=None ,**kwargs):\n ''\n\n\n\n \n if self.is_dir():\n raise IsADirectoryError(self)\n zip_mode=mode[0]\n if not self.exists()and zip_mode =='r':\n raise FileNotFoundError(self)\n stream=self.root.open(self.at,zip_mode,pwd=pwd)\n if 'b'in mode:\n if args or kwargs:\n raise ValueError(\"encoding args invalid for binary operation\")\n return stream\n else :\n kwargs[\"encoding\"]=io.text_encoding(kwargs.get(\"encoding\"))\n return io.TextIOWrapper(stream,*args,**kwargs)\n \n @property\n def name(self):\n return pathlib.Path(self.at).name or self.filename.name\n \n @property\n def suffix(self):\n return pathlib.Path(self.at).suffix or self.filename.suffix\n \n @property\n def suffixes(self):\n return pathlib.Path(self.at).suffixes or self.filename.suffixes\n \n @property\n def stem(self):\n return pathlib.Path(self.at).stem or self.filename.stem\n \n @property\n def filename(self):\n return pathlib.Path(self.root.filename).joinpath(self.at)\n \n def read_text(self,*args,**kwargs):\n kwargs[\"encoding\"]=io.text_encoding(kwargs.get(\"encoding\"))\n with self.open('r',*args,**kwargs)as strm:\n return strm.read()\n \n def read_bytes(self):\n with self.open('rb')as strm:\n return strm.read()\n \n def _is_child(self,path):\n return posixpath.dirname(path.at.rstrip(\"/\"))==self.at.rstrip(\"/\")\n \n def _next(self,at):\n return self.__class__(self.root,at)\n \n def is_dir(self):\n return not self.at or self.at.endswith(\"/\")\n \n def is_file(self):\n return self.exists()and not self.is_dir()\n \n def exists(self):\n return self.at in self.root._name_set()\n \n def iterdir(self):\n if not self.is_dir():\n raise ValueError(\"Can't listdir a file\")\n subs=map(self._next,self.root.namelist())\n return filter(self._is_child,subs)\n \n def __str__(self):\n return posixpath.join(self.root.filename,self.at)\n \n def __repr__(self):\n return self.__repr.format(self=self)\n \n def joinpath(self,*other):\n next=posixpath.join(self.at,*other)\n return self._next(self.root.resolve_dir(next))\n \n __truediv__=joinpath\n \n @property\n def parent(self):\n if not self.at:\n return self.filename.parent\n parent_at=posixpath.dirname(self.at.rstrip('/'))\n if parent_at:\n parent_at +='/'\n return self._next(parent_at)\n \n \ndef main(args=None ):\n import argparse\n \n description='A simple command-line interface for zipfile module.'\n parser=argparse.ArgumentParser(description=description)\n group=parser.add_mutually_exclusive_group(required=True )\n group.add_argument('-l','--list',metavar='',\n help='Show listing of a zipfile')\n group.add_argument('-e','--extract',nargs=2,\n metavar=('',''),\n help='Extract zipfile into target dir')\n group.add_argument('-c','--create',nargs='+',\n metavar=('',''),\n help='Create zipfile from sources')\n group.add_argument('-t','--test',metavar='',\n help='Test if a zipfile is valid')\n parser.add_argument('--metadata-encoding',metavar='',\n help='Specify encoding of member names for -l, -e and -t')\n args=parser.parse_args(args)\n \n encoding=args.metadata_encoding\n \n if args.test is not None :\n src=args.test\n with ZipFile(src,'r',metadata_encoding=encoding)as zf:\n badfile=zf.testzip()\n if badfile:\n print(\"The following enclosed file is corrupted: {!r}\".format(badfile))\n print(\"Done testing\")\n \n elif args.list is not None :\n src=args.list\n with ZipFile(src,'r',metadata_encoding=encoding)as zf:\n zf.printdir()\n \n elif args.extract is not None :\n src,curdir=args.extract\n with ZipFile(src,'r',metadata_encoding=encoding)as zf:\n zf.extractall(curdir)\n \n elif args.create is not None :\n if encoding:\n print(\"Non-conforming encodings not supported with -c.\",\n file=sys.stderr)\n sys.exit(1)\n \n zip_name=args.create.pop(0)\n files=args.create\n \n def addToZip(zf,path,zippath):\n if os.path.isfile(path):\n zf.write(path,zippath,ZIP_DEFLATED)\n elif os.path.isdir(path):\n if zippath:\n zf.write(path,zippath)\n for nm in sorted(os.listdir(path)):\n addToZip(zf,\n os.path.join(path,nm),os.path.join(zippath,nm))\n \n \n with ZipFile(zip_name,'w')as zf:\n for path in files:\n zippath=os.path.basename(path)\n if not zippath:\n zippath=os.path.basename(os.path.dirname(path))\n if zippath in ('',os.curdir,os.pardir):\n zippath=''\n addToZip(zf,path,zippath)\n \n \nif __name__ ==\"__main__\":\n main()\n", ["argparse", "binascii", "bz2", "contextlib", "importlib.util", "io", "itertools", "lzma", "os", "pathlib", "posixpath", "py_compile", "shutil", "stat", "struct", "sys", "threading", "time", "warnings", "zlib"]], "zipimport": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport _frozen_importlib_external as _bootstrap_external\nfrom _frozen_importlib_external import _unpack_uint16,_unpack_uint32\nimport _frozen_importlib as _bootstrap\nimport _imp\nimport _io\nimport marshal\nimport sys\nimport time\nimport _warnings\n\n__all__=['ZipImportError','zipimporter']\n\n\npath_sep=_bootstrap_external.path_sep\nalt_path_sep=_bootstrap_external.path_separators[1:]\n\n\nclass ZipImportError(ImportError):\n pass\n \n \n_zip_directory_cache={}\n\n_module_type=type(sys)\n\nEND_CENTRAL_DIR_SIZE=22\nSTRING_END_ARCHIVE=b'PK\\x05\\x06'\nMAX_COMMENT_LEN=(1 <<16)-1\n\nclass zipimporter(_bootstrap_external._LoaderBasics):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n def __init__(self,path):\n if not isinstance(path,str):\n raise TypeError(f\"expected str, not {type(path)!r}\")\n if not path:\n raise ZipImportError('archive path is empty',path=path)\n if alt_path_sep:\n path=path.replace(alt_path_sep,path_sep)\n \n prefix=[]\n while True:\n try:\n st=_bootstrap_external._path_stat(path)\n except(OSError,ValueError):\n \n \n dirname,basename=_bootstrap_external._path_split(path)\n if dirname ==path:\n raise ZipImportError('not a Zip file',path=path)\n path=dirname\n prefix.append(basename)\n else:\n \n if(st.st_mode&0o170000)!=0o100000:\n \n raise ZipImportError('not a Zip file',path=path)\n break\n \n try:\n files=_zip_directory_cache[path]\n except KeyError:\n files=_read_directory(path)\n _zip_directory_cache[path]=files\n self._files=files\n self.archive=path\n \n self.prefix=_bootstrap_external._path_join(*prefix[::-1])\n if self.prefix:\n self.prefix +=path_sep\n \n \n def find_spec(self,fullname,target=None):\n ''\n\n\n \n module_info=_get_module_info(self,fullname)\n if module_info is not None:\n return _bootstrap.spec_from_loader(fullname,self,is_package=module_info)\n else:\n \n \n \n \n \n modpath=_get_module_path(self,fullname)\n if _is_dir(self,modpath):\n \n \n \n path=f'{self.archive}{path_sep}{modpath}'\n spec=_bootstrap.ModuleSpec(name=fullname,loader=None,\n is_package=True)\n spec.submodule_search_locations.append(path)\n return spec\n else:\n return None\n \n def get_code(self,fullname):\n ''\n\n\n\n \n code,ispackage,modpath=_get_module_code(self,fullname)\n return code\n \n \n def get_data(self,pathname):\n ''\n\n\n\n \n if alt_path_sep:\n pathname=pathname.replace(alt_path_sep,path_sep)\n \n key=pathname\n if pathname.startswith(self.archive+path_sep):\n key=pathname[len(self.archive+path_sep):]\n \n try:\n toc_entry=self._files[key]\n except KeyError:\n raise OSError(0,'',key)\n return _get_data(self.archive,toc_entry)\n \n \n \n def get_filename(self,fullname):\n ''\n\n\n\n \n \n \n code,ispackage,modpath=_get_module_code(self,fullname)\n return modpath\n \n \n def get_source(self,fullname):\n ''\n\n\n\n\n \n mi=_get_module_info(self,fullname)\n if mi is None:\n raise ZipImportError(f\"can't find module {fullname !r}\",name=fullname)\n \n path=_get_module_path(self,fullname)\n if mi:\n fullpath=_bootstrap_external._path_join(path,'__init__.py')\n else:\n fullpath=f'{path}.py'\n \n try:\n toc_entry=self._files[fullpath]\n except KeyError:\n \n return None\n return _get_data(self.archive,toc_entry).decode()\n \n \n \n def is_package(self,fullname):\n ''\n\n\n\n \n mi=_get_module_info(self,fullname)\n if mi is None:\n raise ZipImportError(f\"can't find module {fullname !r}\",name=fullname)\n return mi\n \n \n \n def load_module(self,fullname):\n ''\n\n\n\n\n\n\n \n msg=(\"zipimport.zipimporter.load_module() is deprecated and slated for \"\n \"removal in Python 3.12; use exec_module() instead\")\n _warnings.warn(msg,DeprecationWarning)\n code,ispackage,modpath=_get_module_code(self,fullname)\n mod=sys.modules.get(fullname)\n if mod is None or not isinstance(mod,_module_type):\n mod=_module_type(fullname)\n sys.modules[fullname]=mod\n mod.__loader__=self\n \n try:\n if ispackage:\n \n \n path=_get_module_path(self,fullname)\n fullpath=_bootstrap_external._path_join(self.archive,path)\n mod.__path__=[fullpath]\n \n if not hasattr(mod,'__builtins__'):\n mod.__builtins__=__builtins__\n _bootstrap_external._fix_up_module(mod.__dict__,fullname,modpath)\n exec(code,mod.__dict__)\n except:\n del sys.modules[fullname]\n raise\n \n try:\n mod=sys.modules[fullname]\n except KeyError:\n raise ImportError(f'Loaded module {fullname !r} not found in sys.modules')\n _bootstrap._verbose_message('import {} # loaded from Zip {}',fullname,modpath)\n return mod\n \n \n def get_resource_reader(self,fullname):\n ''\n\n\n\n \n try:\n if not self.is_package(fullname):\n return None\n except ZipImportError:\n return None\n from importlib.readers import ZipReader\n return ZipReader(self,fullname)\n \n \n def invalidate_caches(self):\n ''\n try:\n self._files=_read_directory(self.archive)\n _zip_directory_cache[self.archive]=self._files\n except ZipImportError:\n _zip_directory_cache.pop(self.archive,None)\n self._files={}\n \n \n def __repr__(self):\n return f''\n \n \n \n \n \n \n \n_zip_searchorder=(\n(path_sep+'__init__.pyc',True,True),\n(path_sep+'__init__.py',False,True),\n('.pyc',True,False),\n('.py',False,False),\n)\n\n\n\ndef _get_module_path(self,fullname):\n return self.prefix+fullname.rpartition('.')[2]\n \n \ndef _is_dir(self,path):\n\n\n\n dirpath=path+path_sep\n \n return dirpath in self._files\n \n \ndef _get_module_info(self,fullname):\n path=_get_module_path(self,fullname)\n for suffix,isbytecode,ispackage in _zip_searchorder:\n fullpath=path+suffix\n if fullpath in self._files:\n return ispackage\n return None\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \ndef _read_directory(archive):\n try:\n fp=_io.open_code(archive)\n except OSError:\n raise ZipImportError(f\"can't open Zip file: {archive !r}\",path=archive)\n \n with fp:\n \n \n \n start_offset=fp.tell()\n try:\n try:\n fp.seek(-END_CENTRAL_DIR_SIZE,2)\n header_position=fp.tell()\n buffer=fp.read(END_CENTRAL_DIR_SIZE)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n if len(buffer)!=END_CENTRAL_DIR_SIZE:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n if buffer[:4]!=STRING_END_ARCHIVE:\n \n \n try:\n fp.seek(0,2)\n file_size=fp.tell()\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",\n path=archive)\n max_comment_start=max(file_size -MAX_COMMENT_LEN -\n END_CENTRAL_DIR_SIZE,0)\n try:\n fp.seek(max_comment_start)\n data=fp.read()\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",\n path=archive)\n pos=data.rfind(STRING_END_ARCHIVE)\n if pos <0:\n raise ZipImportError(f'not a Zip file: {archive !r}',\n path=archive)\n buffer=data[pos:pos+END_CENTRAL_DIR_SIZE]\n if len(buffer)!=END_CENTRAL_DIR_SIZE:\n raise ZipImportError(f\"corrupt Zip file: {archive !r}\",\n path=archive)\n header_position=file_size -len(data)+pos\n \n header_size=_unpack_uint32(buffer[12:16])\n header_offset=_unpack_uint32(buffer[16:20])\n if header_position header_offset:\n raise ZipImportError(f'bad local header offset: {archive !r}',path=archive)\n file_offset +=arc_offset\n \n try:\n name=fp.read(name_size)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n if len(name)!=name_size:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n \n \n \n try:\n if len(fp.read(header_size -name_size))!=header_size -name_size:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n \n if flags&0x800:\n \n name=name.decode()\n else:\n \n try:\n name=name.decode('ascii')\n except UnicodeDecodeError:\n name=name.decode('latin1').translate(cp437_table)\n \n name=name.replace('/',path_sep)\n path=_bootstrap_external._path_join(archive,name)\n t=(path,compress,data_size,file_size,file_offset,time,date,crc)\n files[name]=t\n count +=1\n finally:\n fp.seek(start_offset)\n _bootstrap._verbose_message('zipimport: found {} names in {!r}',count,archive)\n return files\n \n \n \n \n \n \n \ncp437_table=(\n\n'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f'\n'\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f'\n' !\"#$%&\\'()*+,-./'\n'0123456789:;<=>?'\n'@ABCDEFGHIJKLMNO'\n'PQRSTUVWXYZ[\\\\]^_'\n'`abcdefghijklmno'\n'pqrstuvwxyz{|}~\\x7f'\n\n'\\xc7\\xfc\\xe9\\xe2\\xe4\\xe0\\xe5\\xe7'\n'\\xea\\xeb\\xe8\\xef\\xee\\xec\\xc4\\xc5'\n'\\xc9\\xe6\\xc6\\xf4\\xf6\\xf2\\xfb\\xf9'\n'\\xff\\xd6\\xdc\\xa2\\xa3\\xa5\\u20a7\\u0192'\n'\\xe1\\xed\\xf3\\xfa\\xf1\\xd1\\xaa\\xba'\n'\\xbf\\u2310\\xac\\xbd\\xbc\\xa1\\xab\\xbb'\n'\\u2591\\u2592\\u2593\\u2502\\u2524\\u2561\\u2562\\u2556'\n'\\u2555\\u2563\\u2551\\u2557\\u255d\\u255c\\u255b\\u2510'\n'\\u2514\\u2534\\u252c\\u251c\\u2500\\u253c\\u255e\\u255f'\n'\\u255a\\u2554\\u2569\\u2566\\u2560\\u2550\\u256c\\u2567'\n'\\u2568\\u2564\\u2565\\u2559\\u2558\\u2552\\u2553\\u256b'\n'\\u256a\\u2518\\u250c\\u2588\\u2584\\u258c\\u2590\\u2580'\n'\\u03b1\\xdf\\u0393\\u03c0\\u03a3\\u03c3\\xb5\\u03c4'\n'\\u03a6\\u0398\\u03a9\\u03b4\\u221e\\u03c6\\u03b5\\u2229'\n'\\u2261\\xb1\\u2265\\u2264\\u2320\\u2321\\xf7\\u2248'\n'\\xb0\\u2219\\xb7\\u221a\\u207f\\xb2\\u25a0\\xa0'\n)\n\n_importing_zlib=False\n\n\n\n\ndef _get_decompress_func():\n global _importing_zlib\n if _importing_zlib:\n \n \n _bootstrap._verbose_message('zipimport: zlib UNAVAILABLE')\n raise ZipImportError(\"can't decompress data; zlib not available\")\n \n _importing_zlib=True\n try:\n from zlib import decompress\n except Exception:\n _bootstrap._verbose_message('zipimport: zlib UNAVAILABLE')\n raise ZipImportError(\"can't decompress data; zlib not available\")\n finally:\n _importing_zlib=False\n \n _bootstrap._verbose_message('zipimport: zlib available')\n return decompress\n \n \ndef _get_data(archive,toc_entry):\n datapath,compress,data_size,file_size,file_offset,time,date,crc=toc_entry\n if data_size <0:\n raise ZipImportError('negative data size')\n \n with _io.open_code(archive)as fp:\n \n try:\n fp.seek(file_offset)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n buffer=fp.read(30)\n if len(buffer)!=30:\n raise EOFError('EOF read where not expected')\n \n if buffer[:4]!=b'PK\\x03\\x04':\n \n raise ZipImportError(f'bad local file header: {archive !r}',path=archive)\n \n name_size=_unpack_uint16(buffer[26:28])\n extra_size=_unpack_uint16(buffer[28:30])\n header_size=30+name_size+extra_size\n file_offset +=header_size\n try:\n fp.seek(file_offset)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n raw_data=fp.read(data_size)\n if len(raw_data)!=data_size:\n raise OSError(\"zipimport: can't read data\")\n \n if compress ==0:\n \n return raw_data\n \n \n try:\n decompress=_get_decompress_func()\n except Exception:\n raise ZipImportError(\"can't decompress data; zlib not available\")\n return decompress(raw_data,-15)\n \n \n \n \n \ndef _eq_mtime(t1,t2):\n\n return abs(t1 -t2)<=1\n \n \n \n \n \ndef _unmarshal_code(self,pathname,fullpath,fullname,data):\n exc_details={\n 'name':fullname,\n 'path':fullpath,\n }\n \n flags=_bootstrap_external._classify_pyc(data,fullname,exc_details)\n \n hash_based=flags&0b1 !=0\n if hash_based:\n check_source=flags&0b10 !=0\n if(_imp.check_hash_based_pycs !='never'and\n (check_source or _imp.check_hash_based_pycs =='always')):\n source_bytes=_get_pyc_source(self,fullpath)\n if source_bytes is not None:\n source_hash=_imp.source_hash(\n _bootstrap_external._RAW_MAGIC_NUMBER,\n source_bytes,\n )\n \n _bootstrap_external._validate_hash_pyc(\n data,source_hash,fullname,exc_details)\n else:\n source_mtime,source_size=\\\n _get_mtime_and_size_of_source(self,fullpath)\n \n if source_mtime:\n \n \n if(not _eq_mtime(_unpack_uint32(data[8:12]),source_mtime)or\n _unpack_uint32(data[12:16])!=source_size):\n _bootstrap._verbose_message(\n f'bytecode is stale for {fullname !r}')\n return None\n \n code=marshal.loads(data[16:])\n if not isinstance(code,_code_type):\n raise TypeError(f'compiled module {pathname !r} is not a code object')\n return code\n \n_code_type=type(_unmarshal_code.__code__)\n\n\n\n\ndef _normalize_line_endings(source):\n source=source.replace(b'\\r\\n',b'\\n')\n source=source.replace(b'\\r',b'\\n')\n return source\n \n \n \ndef _compile_source(pathname,source):\n source=_normalize_line_endings(source)\n return compile(source,pathname,'exec',dont_inherit=True)\n \n \n \ndef _parse_dostime(d,t):\n return time.mktime((\n (d >>9)+1980,\n (d >>5)&0xF,\n d&0x1F,\n t >>11,\n (t >>5)&0x3F,\n (t&0x1F)*2,\n -1,-1,-1))\n \n \n \n \ndef _get_mtime_and_size_of_source(self,path):\n try:\n \n assert path[-1:]in('c','o')\n path=path[:-1]\n toc_entry=self._files[path]\n \n \n time=toc_entry[5]\n date=toc_entry[6]\n uncompressed_size=toc_entry[3]\n return _parse_dostime(date,time),uncompressed_size\n except(KeyError,IndexError,TypeError):\n return 0,0\n \n \n \n \n \ndef _get_pyc_source(self,path):\n\n assert path[-1:]in('c','o')\n path=path[:-1]\n \n try:\n toc_entry=self._files[path]\n except KeyError:\n return None\n else:\n return _get_data(self.archive,toc_entry)\n \n \n \n \ndef _get_module_code(self,fullname):\n path=_get_module_path(self,fullname)\n import_error=None\n for suffix,isbytecode,ispackage in _zip_searchorder:\n fullpath=path+suffix\n _bootstrap._verbose_message('trying {}{}{}',self.archive,path_sep,fullpath,verbosity=2)\n try:\n toc_entry=self._files[fullpath]\n except KeyError:\n pass\n else:\n modpath=toc_entry[0]\n data=_get_data(self.archive,toc_entry)\n code=None\n if isbytecode:\n try:\n code=_unmarshal_code(self,modpath,fullpath,fullname,data)\n except ImportError as exc:\n import_error=exc\n else:\n code=_compile_source(modpath,data)\n if code is None:\n \n \n continue\n modpath=toc_entry[0]\n return code,ispackage,modpath\n else:\n if import_error:\n msg=f\"module load failed: {import_error}\"\n raise ZipImportError(msg,name=fullname)from import_error\n else:\n raise ZipImportError(f\"can't find module {fullname !r}\",name=fullname)\n", ["_frozen_importlib", "_frozen_importlib_external", "_imp", "_io", "_warnings", "importlib.readers", "marshal", "sys", "time", "zlib"]], "zlib": [".py", "from _zlib_utils import lz_generator,crc32\n\nDEFLATED=8\nDEF_BUF_SIZE=16384\nDEF_MEM_LEVEL=8\nMAX_WBITS=15\nZLIB_RUNTIME_VERSION='1.2.11'\nZLIB_VERSION='1.2.11'\nZ_BEST_COMPRESSION=9\nZ_BEST_SPEED=1\nZ_BLOCK=5\nZ_DEFAULT_COMPRESSION=-1\nZ_DEFAULT_STRATEGY=0\nZ_FILTERED=1\nZ_FINISH=4\nZ_FIXED=4\nZ_FULL_FLUSH=3\nZ_HUFFMAN_ONLY=2\nZ_NO_COMPRESSION=0\nZ_NO_FLUSH=0\nZ_PARTIAL_FLUSH=1\nZ_RLE=3\nZ_SYNC_FLUSH=2\nZ_TREES=6\n\nclass BitIO:\n\n def __init__(self,bytestream=b''):\n self.bytestream=bytearray(bytestream)\n self.bytenum=0\n self.bitnum=0\n \n @property\n def pos(self):\n return self.bytenum *8+self.bitnum\n \n def read(self,nb,order=\"lsf\",trace=False ):\n result=0\n coef=1 if order ==\"lsf\"else 2 **(nb -1)\n for _ in range(nb):\n if self.bitnum ==8:\n if self.bytenum ==len(self.bytestream)-1:\n return None\n self.bytenum +=1\n self.bitnum=0\n mask=2 **self.bitnum\n if trace:\n print(\"byte\",self.bytenum,\"bitnum\",self.bitnum,\n \"bit\",int(bool(mask&self.bytestream[self.bytenum])))\n result +=coef *bool(mask&self.bytestream[self.bytenum])\n self.bitnum +=1\n if order ==\"lsf\":\n coef *=2\n else :\n coef //=2\n return result\n \n def move(self,nb):\n if nb ==0:\n return\n elif nb >0:\n bitpos=self.bitnum+nb\n while bitpos >7:\n self.bytenum +=1\n if self.bytenum ==len(self.bytestream):\n raise Exception(\"can't move {} bits\".format(nb))\n bitpos -=8\n self.bitnum=bitpos\n else :\n bitpos=self.bitnum+nb\n while bitpos <0:\n self.bytenum -=1\n if self.bytenum ==-1:\n raise Exception(\"can't move {} bits\".format(nb))\n bitpos +=8\n self.bitnum=bitpos\n \n def show(self):\n res=\"\"\n for x in self.bytestream:\n s=str(bin(x))[2:]\n s=\"0\"*(8 -len(s))+s\n res +=s+\" \"\n return res\n \n def write(self,*bits):\n for bit in bits:\n if not self.bytestream:\n self.bytestream.append(0)\n byte=self.bytestream[self.bytenum]\n if self.bitnum ==8:\n if self.bytenum ==len(self.bytestream)-1:\n byte=0\n self.bytestream +=bytes([byte])\n self.bytenum +=1\n self.bitnum=0\n mask=2 **self.bitnum\n if bit:\n byte |=mask\n else :\n byte &=~mask\n self.bytestream[self.bytenum]=byte\n self.bitnum +=1\n \n def write_int(self,value,nb,order=\"lsf\"):\n ''\n if value >=2 **nb:\n raise ValueError(\"can't write value on {} bits\".format(nb))\n bits=[]\n while value:\n bits.append(value&1)\n value >>=1\n \n bits=bits+[0]*(nb -len(bits))\n if order !=\"lsf\":\n bits.reverse()\n assert len(bits)==nb\n self.write(*bits)\n \nclass Error(Exception):\n pass\n \n \nclass ResizeError(Exception):\n pass\n \n \nclass Node:\n\n def __init__(self,char=None ,weight=0,level=0):\n self.char=char\n self.is_leaf=char is not None\n self.level=level\n self.weight=weight\n \n def add(self,children):\n self.children=children\n for child in self.children:\n child.parent=self\n child.level=self.level+1\n \n \nclass Tree:\n\n def __init__(self,root):\n self.root=root\n \n def length(self):\n self.root.level=0\n node=self.root\n nb_levels=0\n def set_level(node):\n nonlocal nb_levels\n for child in node.children:\n child.level=node.level+1\n nb_levels=max(nb_levels,child.level)\n if not child.is_leaf:\n set_level(child)\n set_level(self.root)\n return nb_levels\n \n def reduce_tree(self):\n ''\n\n\n \n currentlen=self.length()\n deepest=self.nodes_at(currentlen)\n deepest_leaves=[node for node in deepest if node.is_leaf]\n rightmost_leaf=deepest_leaves[-1]\n sibling=rightmost_leaf.parent.children[0]\n \n \n parent=rightmost_leaf.parent\n grand_parent=parent.parent\n rank=grand_parent.children.index(parent)\n children=grand_parent.children\n children[rank]=rightmost_leaf\n grand_parent.add(children)\n \n \n up_level=rightmost_leaf.level -2\n while up_level >0:\n nodes=self.nodes_at(up_level)\n leaf_nodes=[node for node in nodes if node.is_leaf]\n if leaf_nodes:\n leftmost_leaf=leaf_nodes[0]\n \n parent=leftmost_leaf.parent\n rank=parent.children.index(leftmost_leaf)\n new_node=Node()\n new_node.level=leftmost_leaf.level\n children=[sibling,leftmost_leaf]\n new_node.add(children)\n parent.children[rank]=new_node\n new_node.parent=parent\n break\n else :\n up_level -=1\n if up_level ==0:\n raise ResizeError\n \n def nodes_at(self,level,top=None ):\n ''\n res=[]\n if top is None :\n top=self.root\n if top.level ==level:\n res=[top]\n elif not top.is_leaf:\n for child in top.children:\n res +=self.nodes_at(level,child)\n return res\n \n def reduce(self,maxlevels):\n ''\n while self.length()>maxlevels:\n self.reduce_tree()\n \n def codes(self,node=None ,code=''):\n ''\n \n if node is None :\n self.dic={}\n node=self.root\n if node.is_leaf:\n self.dic[node.char]=code\n else :\n for i,child in enumerate(node.children):\n self.codes(child,code+str(i))\n return self.dic\n \n \ndef codelengths_from_frequencies(freqs):\n ''\n\n\n\n \n freqs=sorted(freqs.items(),\n key=lambda item:(item[1],-item[0]),reverse=True )\n nodes=[Node(char=key,weight=value)for (key,value)in freqs]\n while len(nodes)>1:\n right,left=nodes.pop(),nodes.pop()\n node=Node(weight=right.weight+left.weight)\n node.add([left,right])\n if not nodes:\n nodes.append(node)\n else :\n pos=0\n while pos node.weight:\n pos +=1\n nodes.insert(pos,node)\n \n top=nodes[0]\n tree=Tree(top)\n tree.reduce(15)\n \n codes=tree.codes()\n \n code_items=list(codes.items())\n code_items.sort(key=lambda item:(len(item[1]),item[0]))\n return [(car,len(value))for car,value in code_items]\n \ndef normalized(codelengths):\n car,codelength=codelengths[0]\n value=0\n codes={car:\"0\"*codelength}\n \n for (newcar,nbits)in codelengths[1:]:\n value +=1\n bvalue=str(bin(value))[2:]\n bvalue=\"0\"*(codelength -len(bvalue))+bvalue\n if nbits >codelength:\n codelength=nbits\n bvalue +=\"0\"*(codelength -len(bvalue))\n value=int(bvalue,2)\n assert len(bvalue)==nbits\n codes[newcar]=bvalue\n \n return codes\n \ndef make_tree(node,codes):\n if not hasattr(node,\"parent\"):\n node.code=''\n children=[]\n for bit in '01':\n next_code=node.code+bit\n if next_code in codes:\n child=Node(char=codes[next_code])\n else :\n child=Node()\n child.code=next_code\n children.append(child)\n node.add(children)\n for child in children:\n if not child.is_leaf:\n make_tree(child,codes)\n \ndef decompresser(codelengths):\n lengths=list(codelengths.items())\n \n lengths=[x for x in lengths if x[1]>0]\n lengths.sort(key=lambda item:(item[1],item[0]))\n codes=normalized(lengths)\n codes={value:key for key,value in codes.items()}\n root=Node()\n make_tree(root,codes)\n return {\"root\":root,\"codes\":codes}\n \ndef tree_from_codelengths(codelengths):\n return decompresser(codelengths)[\"root\"]\n \nclass error(Exception):\n pass\n \n \nfixed_codelengths={}\nfor car in range(144):\n fixed_codelengths[car]=8\nfor car in range(144,256):\n fixed_codelengths[car]=9\nfor car in range(256,280):\n fixed_codelengths[car]=7\nfor car in range(280,288):\n fixed_codelengths[car]=8\n \nfixed_decomp=decompresser(fixed_codelengths)\nfixed_lit_len_tree=fixed_decomp[\"root\"]\nfixed_lit_len_codes={value:key\nfor (key,value)in fixed_decomp[\"codes\"].items()}\n\ndef cl_encode(lengths):\n ''\n \n dic={char:len(code)for (char,code)in lengths.items()}\n items=[dic.get(i,0)for i in range(max(dic)+1)]\n pos=0\n while pos 3:\n yield (16,3)\n nb -=3\n yield (16,nb)\n pos +=repeat+1\n \ndef read_codelengths(reader,root,num):\n ''\n\n \n node=root\n lengths=[]\n nb=0\n while len(lengths)256:\n \n if child.char <265:\n length=child.char -254\n elif child.char <269:\n length=11+2 *(child.char -265)+reader.read(1)\n elif child.char <273:\n length=19+4 *(child.char -269)+reader.read(2)\n elif child.char <277:\n length=35+8 *(child.char -273)+reader.read(3)\n elif child.char <281:\n length=67+16 *(child.char -277)+reader.read(4)\n elif child.char <285:\n length=131+31 *(child.char -281)+reader.read(5)\n elif child.char ==285:\n length=258\n return (\"length\",length)\n else :\n node=child\n \ndef adler32(source):\n a=1\n b=0\n for byte in source:\n a +=byte\n a %=65521\n b +=a\n b %=65521\n return a,b\n \n \ndef compress_dynamic(out,source,store,lit_len_count,distance_count):\n\n lit_len_count[256]=1\n \n \n \n \n \n \n lit_len_codes=normalized(codelengths_from_frequencies(lit_len_count))\n HLIT=1+max(lit_len_codes)-257\n \n \n \n \n \n \n coded_lit_len=list(cl_encode(lit_len_codes))\n \n \n distance_codes=normalized(codelengths_from_frequencies(distance_count))\n HDIST=max(distance_codes)\n coded_distance=list(cl_encode(distance_codes))\n \n \n codelengths_count={}\n for coded in coded_lit_len,coded_distance:\n for item in coded:\n length=item[0]if isinstance(item,tuple)else item\n codelengths_count[length]=codelengths_count.get(length,0)+1\n \n \n codelengths_codes=normalized(\n codelengths_from_frequencies(codelengths_count))\n codelengths_dict={char:len(value)\n for (char,value)in codelengths_codes.items()}\n \n alphabet=(16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,\n 15)\n \n \n codelengths_list=[codelengths_dict.get(car,0)for car in alphabet]\n \n while codelengths_list[-1]==0:\n codelengths_list.pop()\n HCLEN=len(codelengths_list)-4\n \n out.write(0,1)\n \n out.write_int(HLIT,5)\n out.write_int(HDIST,5)\n out.write_int(HCLEN,4)\n \n \n for length,car in zip(codelengths_list,alphabet):\n out.write_int(length,3)\n \n \n for item in coded_lit_len+coded_distance:\n if isinstance(item,tuple):\n length,extra=item\n code=codelengths_codes[length]\n value,nbits=int(code,2),len(code)\n out.write_int(value,nbits,order=\"msf\")\n if length ==16:\n out.write_int(extra,2)\n elif length ==17:\n out.write_int(extra,3)\n elif length ==18:\n out.write_int(extra,7)\n else :\n code=codelengths_codes[item]\n value,nbits=int(code,2),len(code)\n out.write_int(value,nbits,order=\"msf\")\n \n \n for item in store:\n if isinstance(item,tuple):\n length,extra_length,distance,extra_distance=item\n \n code=lit_len_codes[length]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \n value,nb=extra_length\n if nb:\n out.write_int(value,nb)\n \n code=distance_codes[distance]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \n value,nb=extra_distance\n if nb:\n out.write_int(value,nb)\n else :\n literal=item\n code=lit_len_codes[item]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \ndef compress_fixed(out,source,items):\n ''\n out.write(1,0)\n \n for item in items:\n if isinstance(item,tuple):\n length,extra_length,distance,extra_distance=item\n \n code=fixed_lit_len_codes[length]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \n value,nb=extra_length\n if nb:\n out.write_int(value,nb)\n \n out.write_int(distance,5,order=\"msf\")\n \n value,nb=extra_distance\n if nb:\n out.write_int(value,nb)\n else :\n literal=item\n code=fixed_lit_len_codes[item]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \ndef compress(data,/,level=-1,wbits=MAX_WBITS):\n\n window_size=32 *1024\n \n \n out=BitIO()\n \n \n out.write_int(8,4)\n size=window_size >>8\n nb=0\n while size >1:\n size >>=1\n nb +=1\n out.write_int(nb,4)\n out.write_int(0x9c,8)\n header=out.bytestream\n compressor=_Compressor(level)\n payload=compressor.compress(data)+compressor.flush()\n a,b=adler32(data)\n checksum=divmod(b,256)+divmod(a,256)\n return header+payload+bytes(checksum)\n \ndef convert32bits(n):\n result=[]\n for _ in range(4):\n n,rest=divmod(n,256)\n result.append(rest)\n return result\n \nclass _Compressor:\n\n def __init__(self,level=-1,method=DEFLATED,wbits=MAX_WBITS,\n memLevel=DEF_MEM_LEVEL,strategy=Z_DEFAULT_STRATEGY,\n zdict=None ):\n self.level=level\n self.method=method\n self.wbits=wbits\n self.window_size=32 *1024\n self.memLevel=memLevel\n self.strategy=strategy\n self.zdict=zdict\n self._flushed=False\n \n def compress(self,source):\n \n \n lit_len_count={}\n \n \n distance_count={}\n \n store=[]\n replaced=0\n nb_tuples=0\n \n for item in lz_generator(source,self.window_size):\n if isinstance(item,tuple):\n nb_tuples +=1\n length,distance=item\n replaced +=length\n \n \n length_code,*extra_length=length_to_code(length)\n \n lit_len_count[length_code]=lit_len_count.get(length_code,0)+1\n \n \n \n distance_code,*extra_dist=distance_to_code(distance)\n \n distance_count[distance_code]=\\\n distance_count.get(distance_code,0)+1\n \n \n store.append((length_code,extra_length,distance_code,\n extra_dist))\n else :\n literal=item\n lit_len_count[literal]=lit_len_count.get(literal,0)+1\n store.append(literal)\n \n store.append(256)\n \n \n \n \n score=replaced -100 -(nb_tuples *20 //8)\n \n \n out=BitIO()\n \n out.write(1)\n \n if score <0:\n compress_fixed(out,source,store)\n else :\n compress_dynamic(out,source,store,lit_len_count,distance_count)\n \n \n while out.bitnum !=8:\n out.write(0)\n \n self._compressed=bytes(out.bytestream)\n \n return b''\n \n def flush(self,mode=Z_FINISH):\n if self._flushed:\n raise Error('inconsistent flush state')\n self._flushed=True\n return self._compressed\n \n \ndef compressobj(level=-1,method=DEFLATED,wbits=MAX_WBITS,\nmemLevel=DEF_MEM_LEVEL,strategy=Z_DEFAULT_STRATEGY,\nzdict=None ):\n return _Compressor(level,method,wbits,memLevel,strategy,zdict)\n \n \ndef decompress(data,/,wbits=MAX_WBITS,bufsize=DEF_BUF_SIZE):\n if wbits >0:\n decompressor=_Decompressor(wbits,bufsize)\n source=BitIO(data)\n assert source.read(4)==8\n nb=source.read(4)\n window_size=2 **(nb+8)\n assert source.read(8)==0x9c\n checksum=data[-4:]\n a=256 *checksum[2]+checksum[3]\n b=256 *checksum[0]+checksum[1]\n assert a,b ==adler32(data)\n return decompressor.decompress(data[2:-4])\n else :\n decompressor=_Decompressor(-wbits,bufsize)\n return decompressor.decompress(data)\n \nclass _Decompressor:\n\n def __init__(self,wbits=MAX_WBITS,bufsize=DEF_BUF_SIZE,zdict=None ):\n self.wbits=wbits\n self.bufsize=bufsize\n self.zdict=zdict\n self.eof=False\n self.unconsumed_tail=b''\n self.unused_data=b''\n \n def decompress(self,data,max_length=0):\n self.data=data\n if data ==b'':\n return data\n \n reader=self._reader=BitIO(data)\n \n result=bytearray()\n \n while True :\n BFINAL=reader.read(1)\n \n BTYPE=reader.read(2)\n \n if BTYPE ==0b01:\n \n \n root=fixed_lit_len_tree\n \n while True :\n \n _type,value=read_literal_or_length(reader,root)\n if _type =='eob':\n break\n elif _type =='literal':\n result.append(value)\n elif _type =='length':\n length=value\n \n dist_code=reader.read(5,\"msf\")\n if dist_code <3:\n distance=dist_code+1\n else :\n nb=(dist_code //2)-1\n extra=reader.read(nb)\n half,delta=divmod(dist_code,2)\n distance=(1+(2 **half)+\n delta *(2 **(half -1))+extra)\n for _ in range(length):\n result.append(result[-distance])\n \n node=root\n else :\n node=child\n elif BTYPE ==0b10:\n \n \n \n lit_len_tree,distance_tree=dynamic_trees(reader)\n \n while True :\n \n _type,value=read_literal_or_length(reader,lit_len_tree)\n if _type =='eob':\n break\n elif _type =='literal':\n result.append(value)\n elif _type =='length':\n \n length=value\n distance=read_distance(reader,distance_tree)\n for _ in range(length):\n result.append(result[-distance])\n \n if BFINAL:\n rank=reader.bytenum\n self.unused_data=bytes(data[rank+1:])\n self.eof=True\n return bytes(result)\n \ndef decompressobj(wbits=MAX_WBITS,zdict=None ):\n return _Decompressor(wbits,zdict)\n", ["_zlib_utils"]], "_codecs": [".py", "\ndef ascii_decode(*args,**kw):\n pass\n \ndef ascii_encode(*args,**kw):\n pass\n \ndef charbuffer_encode(*args,**kw):\n pass\n \ndef charmap_build(decoding_table):\n return {car:i for (i,car)in enumerate(decoding_table)}\n \ndef charmap_decode(input,errors,decoding_table):\n res=''\n for car in input:\n code=decoding_table[car]\n if code is None :\n raise UnicodeDecodeError(input)\n res +=code\n return res,len(input)\n \ndef charmap_encode(input,errors,encoding_table):\n t=[]\n for car in input:\n code=encoding_table.get(car)\n if code is None :\n raise UnicodeEncodeError(input)\n t.append(code)\n return bytes(t),len(input)\n \ndef decode(obj,encoding=\"utf-8\",errors=\"strict\"):\n ''\n\n\n\n\n\n \n return __BRYTHON__.decode(obj,encoding,errors)\n \ndef encode(obj,encoding=\"utf-8\",errors=\"strict\"):\n ''\n\n\n\n\n\n \n return __BRYTHON__.encode(obj,encoding,errors)\n \ndef escape_decode(*args,**kw):\n pass\n \ndef escape_encode(*args,**kw):\n pass\n \ndef latin_1_decode(*args,**kw):\n pass\n \ndef latin_1_encode(*args,**kw):\n pass\n \ndef lookup(encoding):\n ''\n\n \n if encoding in ('utf-8','utf_8'):\n from browser import console\n import encodings.utf_8\n return encodings.utf_8.getregentry()\n \n LookupError(encoding)\n \ndef lookup_error(*args,**kw):\n ''\n\n \n pass\n \ndef mbcs_decode(*args,**kw):\n pass\n \ndef mbcs_encode(*args,**kw):\n pass\n \ndef raw_unicode_escape_decode(*args,**kw):\n pass\n \ndef raw_unicode_escape_encode(*args,**kw):\n pass\n \ndef readbuffer_encode(*args,**kw):\n pass\n \ndef register(*args,**kw):\n ''\n\n\n\n \n pass\n \ndef register_error(*args,**kw):\n ''\n\n\n\n\n \n pass\n \ndef unicode_escape_decode(*args,**kw):\n pass\n \ndef unicode_escape_encode(*args,**kw):\n pass\n \ndef unicode_internal_decode(*args,**kw):\n pass\n \ndef unicode_internal_encode(*args,**kw):\n pass\n \ndef utf_16_be_decode(*args,**kw):\n pass\n \ndef utf_16_be_encode(*args,**kw):\n pass\n \ndef utf_16_decode(*args,**kw):\n pass\n \ndef utf_16_encode(*args,**kw):\n pass\n \ndef utf_16_ex_decode(*args,**kw):\n pass\n \ndef utf_16_le_decode(*args,**kw):\n pass\n \ndef utf_16_le_encode(*args,**kw):\n pass\n \ndef utf_32_be_decode(*args,**kw):\n pass\n \ndef utf_32_be_encode(*args,**kw):\n pass\n \ndef utf_32_decode(*args,**kw):\n pass\n \ndef utf_32_encode(*args,**kw):\n pass\n \ndef utf_32_ex_decode(*args,**kw):\n pass\n \ndef utf_32_le_decode(*args,**kw):\n pass\n \ndef utf_32_le_encode(*args,**kw):\n pass\n \ndef utf_7_decode(*args,**kw):\n pass\n \ndef utf_7_encode(*args,**kw):\n pass\n \ndef utf_8_decode(decoder,bytes_obj,errors,*args):\n return (bytes_obj.decode(\"utf-8\"),len(bytes_obj))\n \ndef utf_8_encode(*args,**kw):\n input=args[0]\n if len(args)==2:\n errors=args[1]\n else :\n errors=kw.get('errors','strict')\n \n \n return (bytes(input,'utf-8'),len(input))\n", ["browser", "encodings.utf_8"]], "_codecs_jp": [".py", "from encoding_cp932 import encoding_table,decoding_table\n\n\n\nclass Codec:\n\n def encode(self,input,errors='strict'):\n b=[]\n for pos,car in enumerate(input):\n cp=ord(car)\n try :\n code=encoding_table[cp]\n high=((code >>8)&0xff)\n low=code&0xff\n if high:\n b.append(high)\n b.append(low)\n except IndexError:\n raise UnicodeEncodeError(pos)\n return [bytes(b),len(input)]\n \n def decode(self,input,errors='strict'):\n i=0\n string=''\n while i self.maxlen:\n self.popleft()\n \n def appendleft(self,x):\n self.state +=1\n self.leftndx -=1\n if self.leftndx ==-1:\n newblock=[None ]*BLOCKSIZ\n self.left[LFTLNK]=newblock\n newblock[RGTLNK]=self.left\n self.left=newblock\n self.leftndx=n -1\n self.length +=1\n self.left[self.leftndx]=x\n if self.maxlen is not None and self.length >self.maxlen:\n self.pop()\n \n def extend(self,iterable):\n if iterable is self:\n iterable=list(iterable)\n for elem in iterable:\n self.append(elem)\n \n def extendleft(self,iterable):\n if iterable is self:\n iterable=list(iterable)\n for elem in iterable:\n self.appendleft(elem)\n \n def pop(self):\n if self.left is self.right and self.leftndx >self.rightndx:\n \n raise IndexError(\"pop from an empty deque\")\n x=self.right[self.rightndx]\n self.right[self.rightndx]=None\n self.length -=1\n self.rightndx -=1\n self.state +=1\n if self.rightndx ==-1:\n prevblock=self.right[LFTLNK]\n if prevblock is None :\n \n self.rightndx=n //2\n self.leftndx=n //2+1\n else :\n prevblock[RGTLNK]=None\n self.right[LFTLNK]=None\n self.right=prevblock\n self.rightndx=n -1\n return x\n \n def popleft(self):\n if self.left is self.right and self.leftndx >self.rightndx:\n \n raise IndexError(\"pop from an empty deque\")\n x=self.left[self.leftndx]\n self.left[self.leftndx]=None\n self.length -=1\n self.leftndx +=1\n self.state +=1\n if self.leftndx ==n:\n prevblock=self.left[RGTLNK]\n if prevblock is None :\n \n self.rightndx=n //2\n self.leftndx=n //2+1\n else :\n prevblock[LFTLNK]=None\n self.left[RGTLNK]=None\n self.left=prevblock\n self.leftndx=0\n return x\n \n def count(self,value):\n c=0\n for item in self:\n if item ==value:\n c +=1\n return c\n \n def remove(self,value):\n \n for i in range(len(self)):\n if self[i]==value:\n del self[i]\n return\n raise ValueError(\"deque.remove(x): x not in deque\")\n \n def rotate(self,n=1):\n length=len(self)\n if length ==0:\n return\n halflen=(length+1)>>1\n if n >halflen or n <-halflen:\n n %=length\n if n >halflen:\n n -=length\n elif n <-halflen:\n n +=length\n while n >0:\n self.appendleft(self.pop())\n n -=1\n while n <0:\n self.append(self.popleft())\n n +=1\n \n def reverse(self):\n ''\n leftblock=self.left\n rightblock=self.right\n leftindex=self.leftndx\n rightindex=self.rightndx\n for i in range(self.length //2):\n \n assert leftblock !=rightblock or leftindex =0:\n block=self.left\n while block:\n l,r=0,n\n if block is self.left:\n l=self.leftndx\n if block is self.right:\n r=self.rightndx+1\n span=r -l\n if index =negative_span:\n return block,r+index\n index -=negative_span\n block=block[LFTLNK]\n raise IndexError(\"deque index out of range\")\n \n def __getitem__(self,index):\n block,index=self.__getref(index)\n return block[index]\n \n def __setitem__(self,index,value):\n block,index=self.__getref(index)\n block[index]=value\n \n def __delitem__(self,index):\n length=len(self)\n if index >=0:\n if index >=length:\n raise IndexError(\"deque index out of range\")\n self.rotate(-index)\n self.popleft()\n self.rotate(index)\n else :\n \n index=index ^(2 **31)\n if index >=length:\n raise IndexError(\"deque index out of range\")\n self.rotate(index)\n self.pop()\n self.rotate(-index)\n \n def __reduce_ex__(self,proto):\n return type(self),(list(self),self.maxlen)\n \n def __hash__(self):\n \n raise TypeError(\"deque objects are unhashable\")\n \n def __copy__(self):\n return self.__class__(self,self.maxlen)\n \n \n def __eq__(self,other):\n if isinstance(other,deque):\n return list(self)==list(other)\n else :\n return NotImplemented\n \n def __ne__(self,other):\n if isinstance(other,deque):\n return list(self)!=list(other)\n else :\n return NotImplemented\n \n def __lt__(self,other):\n if isinstance(other,deque):\n return list(self)list(other)\n else :\n return NotImplemented\n \n def __ge__(self,other):\n if isinstance(other,deque):\n return list(self)>=list(other)\n else :\n return NotImplemented\n \n def __iadd__(self,other):\n self.extend(other)\n return self\n \n \nclass deque_iterator(object):\n\n def __init__(self,deq,itergen):\n self.counter=len(deq)\n def giveup():\n self.counter=0\n \n raise RuntimeError(\"deque mutated during iteration\")\n self._gen=itergen(deq.state,giveup)\n \n def __next__(self):\n res=self._gen.__next__()\n self.counter -=1\n return res\n \n def __iter__(self):\n return self\n \nclass defaultdict(dict):\n\n def __init__(self,*args,**kwds):\n if len(args)>0:\n default_factory=args[0]\n args=args[1:]\n if not callable(default_factory)and default_factory is not None :\n raise TypeError(\"first argument must be callable\")\n else :\n default_factory=None\n dict.__init__(self,*args,**kwds)\n self.default_factory=default_factory\n self.update(*args,**kwds)\n super(defaultdict,self).__init__(*args,**kwds)\n \n def __missing__(self,key):\n \n if self.default_factory is None :\n raise KeyError(key)\n self[key]=value=self.default_factory()\n return value\n \n def __repr__(self,recurse=set()):\n if id(self)in recurse:\n return \"defaultdict(...)\"\n try :\n recurse.add(id(self))\n return \"defaultdict(%s, %s)\"%(repr(self.default_factory),super(defaultdict,self).__repr__())\n finally :\n recurse.remove(id(self))\n \n def copy(self):\n return type(self)(self.default_factory,self)\n \n def __copy__(self):\n return self.copy()\n \n def __reduce__(self):\n \n \n \n \n \n \n \n \n \n \n \n return (type(self),(self.default_factory,),None ,None ,self.items())\n \nfrom operator import itemgetter as _itemgetter\nfrom keyword import iskeyword as _iskeyword\nimport sys as _sys\n\ndef namedtuple(typename,field_names,verbose=False ,rename=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n if isinstance(field_names,str):\n field_names=field_names.replace(',',' ').split()\n field_names=tuple(map(str,field_names))\n if rename:\n names=list(field_names)\n seen=set()\n for i,name in enumerate(names):\n if (not min(c.isalnum()or c =='_'for c in name)or _iskeyword(name)\n or not name or name[0].isdigit()or name.startswith('_')\n or name in seen):\n names[i]='_%d'%i\n seen.add(name)\n field_names=tuple(names)\n for name in (typename,)+field_names:\n if not min(c.isalnum()or c =='_'for c in name):\n raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r'%name)\n if _iskeyword(name):\n raise ValueError('Type names and field names cannot be a keyword: %r'%name)\n if name[0].isdigit():\n raise ValueError('Type names and field names cannot start with a number: %r'%name)\n seen_names=set()\n for name in field_names:\n if name.startswith('_')and not rename:\n raise ValueError('Field names cannot start with an underscore: %r'%name)\n if name in seen_names:\n raise ValueError('Encountered duplicate field name: %r'%name)\n seen_names.add(name)\n \n \n numfields=len(field_names)\n argtxt=repr(field_names).replace(\"'\",\"\")[1:-1]\n reprtxt=', '.join('%s=%%r'%name for name in field_names)\n \n template='''class %(typename)s(tuple):\n '%(typename)s(%(argtxt)s)' \\n\n __slots__ = () \\n\n _fields = %(field_names)r \\n\n def __new__(_cls, %(argtxt)s):\n return tuple.__new__(_cls, (%(argtxt)s)) \\n\n @classmethod\n def _make(cls, iterable, new=tuple.__new__, len=len):\n 'Make a new %(typename)s object from a sequence or iterable'\n result = new(cls, iterable)\n if len(result) != %(numfields)d:\n raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result))\n return result \\n\n def __repr__(self):\n return '%(typename)s(%(reprtxt)s)' %% self \\n\n def _asdict(self):\n 'Return a new dict which maps field names to their values'\n return dict(zip(self._fields, self)) \\n\n def _replace(_self, **kwds):\n 'Return a new %(typename)s object replacing specified fields with new values'\n result = _self._make(map(kwds.pop, %(field_names)r, _self))\n if kwds:\n raise ValueError('Got unexpected field names: %%r' %% kwds.keys())\n return result \\n\n def __getnewargs__(self):\n return tuple(self) \\n\\n'''%locals()\n for i,name in enumerate(field_names):\n template +=' %s = _property(_itemgetter(%d))\\n'%(name,i)\n \n if verbose:\n print(template)\n \n \n namespace=dict(_itemgetter=_itemgetter,__name__='namedtuple_%s'%typename,\n _property=property,_tuple=tuple)\n try :\n exec(template,namespace)\n except SyntaxError as e:\n raise SyntaxError(e.message+':\\n'+template)\n result=namespace[typename]\n \n \n \n \n \n try :\n result.__module__=_sys._getframe(1).f_globals.get('__name__','__main__')\n except (AttributeError,ValueError):\n pass\n \n return result\n \nif __name__ =='__main__':\n Point=namedtuple('Point',['x','y'])\n p=Point(11,y=22)\n print(p[0]+p[1])\n x,y=p\n print(x,y)\n print(p.x+p.y)\n print(p)\n", ["keyword", "operator", "sys"]], "_collections_abc": [".py", "\n\n\n\"\"\"Abstract Base Classes (ABCs) for collections, according to PEP 3119.\n\nUnit tests are in test_collections.\n\"\"\"\n\nfrom abc import ABCMeta,abstractmethod\nimport sys\n\nGenericAlias=type(list[int])\nEllipsisType=type(...)\ndef _f():pass\nFunctionType=type(_f)\ndel _f\n\n__all__=[\"Awaitable\",\"Coroutine\",\n\"AsyncIterable\",\"AsyncIterator\",\"AsyncGenerator\",\n\"Hashable\",\"Iterable\",\"Iterator\",\"Generator\",\"Reversible\",\n\"Sized\",\"Container\",\"Callable\",\"Collection\",\n\"Set\",\"MutableSet\",\n\"Mapping\",\"MutableMapping\",\n\"MappingView\",\"KeysView\",\"ItemsView\",\"ValuesView\",\n\"Sequence\",\"MutableSequence\",\n\"ByteString\",\n]\n\n\n\n\n\n__name__=\"collections.abc\"\n\n\n\n\n\n\n\n\nbytes_iterator=type(iter(b''))\nbytearray_iterator=type(iter(bytearray()))\n\ndict_keyiterator=type(iter({}.keys()))\ndict_valueiterator=type(iter({}.values()))\ndict_itemiterator=type(iter({}.items()))\nlist_iterator=type(iter([]))\nlist_reverseiterator=type(iter(reversed([])))\nrange_iterator=type(iter(range(0)))\nlongrange_iterator=type(iter(range(1 <<1000)))\nset_iterator=type(iter(set()))\nstr_iterator=type(iter(\"\"))\ntuple_iterator=type(iter(()))\nzip_iterator=type(iter(zip()))\n\ndict_keys=type({}.keys())\ndict_values=type({}.values())\ndict_items=type({}.items())\n\nmappingproxy=type(type.__dict__)\ngenerator=type((lambda :(yield ))())\n\nasync def _coro():pass\n_coro=_coro()\ncoroutine=type(_coro)\n_coro.close()\ndel _coro\n\nasync def _ag():yield\n_ag=_ag()\nasync_generator=type(_ag)\ndel _ag\n\n\n\n\ndef _check_methods(C,*methods):\n mro=C.__mro__\n for method in methods:\n for B in mro:\n if method in B.__dict__:\n if B.__dict__[method]is None :\n return NotImplemented\n break\n else :\n return NotImplemented\n return True\n \nclass Hashable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __hash__(self):\n return 0\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Hashable:\n return _check_methods(C,\"__hash__\")\n return NotImplemented\n \n \nclass Awaitable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __await__(self):\n yield\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Awaitable:\n return _check_methods(C,\"__await__\")\n return NotImplemented\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass Coroutine(Awaitable):\n\n __slots__=()\n \n @abstractmethod\n def send(self,value):\n ''\n\n \n raise StopIteration\n \n @abstractmethod\n def throw(self,typ,val=None ,tb=None ):\n ''\n\n \n if val is None :\n if tb is None :\n raise typ\n val=typ()\n if tb is not None :\n val=val.with_traceback(tb)\n raise val\n \n def close(self):\n ''\n \n try :\n self.throw(GeneratorExit)\n except (GeneratorExit,StopIteration):\n pass\n else :\n raise RuntimeError(\"coroutine ignored GeneratorExit\")\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Coroutine:\n return _check_methods(C,'__await__','send','throw','close')\n return NotImplemented\n \n \nCoroutine.register(coroutine)\n\n\nclass AsyncIterable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __aiter__(self):\n return AsyncIterator()\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is AsyncIterable:\n return _check_methods(C,\"__aiter__\")\n return NotImplemented\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass AsyncIterator(AsyncIterable):\n\n __slots__=()\n \n @abstractmethod\n async def __anext__(self):\n ''\n raise StopAsyncIteration\n \n def __aiter__(self):\n return self\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is AsyncIterator:\n return _check_methods(C,\"__anext__\",\"__aiter__\")\n return NotImplemented\n \n \nclass AsyncGenerator(AsyncIterator):\n\n __slots__=()\n \n async def __anext__(self):\n ''\n\n \n return await self.asend(None )\n \n @abstractmethod\n async def asend(self,value):\n ''\n\n \n raise StopAsyncIteration\n \n @abstractmethod\n async def athrow(self,typ,val=None ,tb=None ):\n ''\n\n \n if val is None :\n if tb is None :\n raise typ\n val=typ()\n if tb is not None :\n val=val.with_traceback(tb)\n raise val\n \n async def aclose(self):\n ''\n \n try :\n await self.athrow(GeneratorExit)\n except (GeneratorExit,StopAsyncIteration):\n pass\n else :\n raise RuntimeError(\"asynchronous generator ignored GeneratorExit\")\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is AsyncGenerator:\n return _check_methods(C,'__aiter__','__anext__',\n 'asend','athrow','aclose')\n return NotImplemented\n \n \nAsyncGenerator.register(async_generator)\n\n\nclass Iterable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __iter__(self):\n while False :\n yield None\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Iterable:\n return _check_methods(C,\"__iter__\")\n return NotImplemented\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass Iterator(Iterable):\n\n __slots__=()\n \n @abstractmethod\n def __next__(self):\n ''\n raise StopIteration\n \n def __iter__(self):\n return self\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Iterator:\n return _check_methods(C,'__iter__','__next__')\n return NotImplemented\n \n \nIterator.register(bytes_iterator)\nIterator.register(bytearray_iterator)\n\nIterator.register(dict_keyiterator)\nIterator.register(dict_valueiterator)\nIterator.register(dict_itemiterator)\nIterator.register(list_iterator)\nIterator.register(list_reverseiterator)\nIterator.register(range_iterator)\nIterator.register(longrange_iterator)\nIterator.register(set_iterator)\nIterator.register(str_iterator)\nIterator.register(tuple_iterator)\nIterator.register(zip_iterator)\n\n\nclass Reversible(Iterable):\n\n __slots__=()\n \n @abstractmethod\n def __reversed__(self):\n while False :\n yield None\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Reversible:\n return _check_methods(C,\"__reversed__\",\"__iter__\")\n return NotImplemented\n \n \nclass Generator(Iterator):\n\n __slots__=()\n \n def __next__(self):\n ''\n\n \n return self.send(None )\n \n @abstractmethod\n def send(self,value):\n ''\n\n \n raise StopIteration\n \n @abstractmethod\n def throw(self,typ,val=None ,tb=None ):\n ''\n\n \n if val is None :\n if tb is None :\n raise typ\n val=typ()\n if tb is not None :\n val=val.with_traceback(tb)\n raise val\n \n def close(self):\n ''\n \n try :\n self.throw(GeneratorExit)\n except (GeneratorExit,StopIteration):\n pass\n else :\n raise RuntimeError(\"generator ignored GeneratorExit\")\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Generator:\n return _check_methods(C,'__iter__','__next__',\n 'send','throw','close')\n return NotImplemented\n \n \nGenerator.register(generator)\n\n\nclass Sized(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __len__(self):\n return 0\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Sized:\n return _check_methods(C,\"__len__\")\n return NotImplemented\n \n \nclass Container(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __contains__(self,x):\n return False\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Container:\n return _check_methods(C,\"__contains__\")\n return NotImplemented\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass Collection(Sized,Iterable,Container):\n\n __slots__=()\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Collection:\n return _check_methods(C,\"__len__\",\"__iter__\",\"__contains__\")\n return NotImplemented\n \n \nclass _CallableGenericAlias(GenericAlias):\n ''\n\n\n\n\n\n\n \n \n __slots__=()\n \n def __new__(cls,origin,args):\n return cls.__create_ga(origin,args)\n \n @classmethod\n def __create_ga(cls,origin,args):\n if not isinstance(args,tuple)or len(args)!=2:\n raise TypeError(\n \"Callable must be used as Callable[[arg, ...], result].\")\n t_args,t_result=args\n if isinstance(t_args,(list,tuple)):\n ga_args=tuple(t_args)+(t_result,)\n \n \n \n else :\n ga_args=args\n return super().__new__(cls,origin,ga_args)\n \n @property\n def __parameters__(self):\n params=[]\n for arg in self.__args__:\n \n if hasattr(arg,\"__parameters__\")and isinstance(arg.__parameters__,tuple):\n params.extend(arg.__parameters__)\n else :\n if _is_typevarlike(arg):\n params.append(arg)\n return tuple(dict.fromkeys(params))\n \n def __repr__(self):\n if _has_special_args(self.__args__):\n return super().__repr__()\n return (f'collections.abc.Callable'\n f'[[{\", \".join([_type_repr(a) for a in self.__args__[:-1]])}], '\n f'{_type_repr(self.__args__[-1])}]')\n \n def __reduce__(self):\n args=self.__args__\n if not _has_special_args(args):\n args=list(args[:-1]),args[-1]\n return _CallableGenericAlias,(Callable,args)\n \n def __getitem__(self,item):\n \n \n \n \n \n \n \n param_len=len(self.__parameters__)\n if param_len ==0:\n raise TypeError(f'{self} is not a generic class')\n if (param_len ==1\n and isinstance(item,(tuple,list))\n and len(item)>1)or not isinstance(item,tuple):\n item=(item,)\n item_len=len(item)\n if item_len !=param_len:\n raise TypeError(f'Too {\"many\" if item_len > param_len else \"few\"}'\n f' arguments for {self};'\n f' actual {item_len}, expected {param_len}')\n subst=dict(zip(self.__parameters__,item))\n new_args=[]\n for arg in self.__args__:\n if _is_typevarlike(arg):\n arg=subst[arg]\n \n elif hasattr(arg,'__parameters__')and isinstance(arg.__parameters__,tuple):\n subparams=arg.__parameters__\n if subparams:\n subargs=tuple(subst[x]for x in subparams)\n arg=arg[subargs]\n new_args.append(arg)\n \n \n if not isinstance(new_args[0],(tuple,list)):\n t_result=new_args[-1]\n t_args=new_args[:-1]\n new_args=(t_args,t_result)\n return _CallableGenericAlias(Callable,tuple(new_args))\n \ndef _is_typevarlike(arg):\n obj=type(arg)\n \n return (obj.__module__ =='typing'\n and obj.__name__ in {'ParamSpec','TypeVar'})\n \ndef _has_special_args(args):\n ''\n\n \n if len(args)!=2:\n return False\n obj=args[0]\n if obj is Ellipsis:\n return True\n obj=type(obj)\n names=('ParamSpec','_ConcatenateGenericAlias')\n return obj.__module__ =='typing'and any(obj.__name__ ==name for name in names)\n \n \ndef _type_repr(obj):\n ''\n\n\n\n \n if isinstance(obj,GenericAlias):\n return repr(obj)\n if isinstance(obj,type):\n if obj.__module__ =='builtins':\n return obj.__qualname__\n return f'{obj.__module__}.{obj.__qualname__}'\n if obj is Ellipsis:\n return '...'\n if isinstance(obj,FunctionType):\n return obj.__name__\n return repr(obj)\n \n \nclass Callable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __call__(self,*args,**kwds):\n return False\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Callable:\n return _check_methods(C,\"__call__\")\n return NotImplemented\n \n __class_getitem__=classmethod(_CallableGenericAlias)\n \n \n \n \n \nclass Set(Collection):\n ''\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n def __le__(self,other):\n if not isinstance(other,Set):\n return NotImplemented\n if len(self)>len(other):\n return False\n for elem in self:\n if elem not in other:\n return False\n return True\n \n def __lt__(self,other):\n if not isinstance(other,Set):\n return NotImplemented\n return len(self)len(other)and self.__ge__(other)\n \n def __ge__(self,other):\n if not isinstance(other,Set):\n return NotImplemented\n if len(self)>11)^(h >>25)\n h=h *69069+907133923\n h &=MASK\n if h >MAX:\n h -=MASK+1\n if h ==-1:\n h=590923713\n return h\n \n \nSet.register(frozenset)\n\n\nclass MutableSet(Set):\n ''\n\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def add(self,value):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def discard(self,value):\n ''\n raise NotImplementedError\n \n def remove(self,value):\n ''\n if value not in self:\n raise KeyError(value)\n self.discard(value)\n \n def pop(self):\n ''\n it=iter(self)\n try :\n value=next(it)\n except StopIteration:\n raise KeyError from None\n self.discard(value)\n return value\n \n def clear(self):\n ''\n try :\n while True :\n self.pop()\n except KeyError:\n pass\n \n def __ior__(self,it):\n for value in it:\n self.add(value)\n return self\n \n def __iand__(self,it):\n for value in (self -it):\n self.discard(value)\n return self\n \n def __ixor__(self,it):\n if it is self:\n self.clear()\n else :\n if not isinstance(it,Set):\n it=self._from_iterable(it)\n for value in it:\n if value in self:\n self.discard(value)\n else :\n self.add(value)\n return self\n \n def __isub__(self,it):\n if it is self:\n self.clear()\n else :\n for value in it:\n self.discard(value)\n return self\n \n \nMutableSet.register(set)\n\n\n\n\nclass Mapping(Collection):\n ''\n\n\n\n\n \n \n __slots__=()\n \n \n __abc_tpflags__=1 <<6\n \n @abstractmethod\n def __getitem__(self,key):\n raise KeyError\n \n def get(self,key,default=None ):\n ''\n try :\n return self[key]\n except KeyError:\n return default\n \n def __contains__(self,key):\n try :\n self[key]\n except KeyError:\n return False\n else :\n return True\n \n def keys(self):\n ''\n return KeysView(self)\n \n def items(self):\n ''\n return ItemsView(self)\n \n def values(self):\n ''\n return ValuesView(self)\n \n def __eq__(self,other):\n if not isinstance(other,Mapping):\n return NotImplemented\n return dict(self.items())==dict(other.items())\n \n __reversed__=None\n \nMapping.register(mappingproxy)\n\n\nclass MappingView(Sized):\n\n __slots__='_mapping',\n \n def __init__(self,mapping):\n self._mapping=mapping\n \n def __len__(self):\n return len(self._mapping)\n \n def __repr__(self):\n return '{0.__class__.__name__}({0._mapping!r})'.format(self)\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass KeysView(MappingView,Set):\n\n __slots__=()\n \n @classmethod\n def _from_iterable(self,it):\n return set(it)\n \n def __contains__(self,key):\n return key in self._mapping\n \n def __iter__(self):\n yield from self._mapping\n \n \nKeysView.register(dict_keys)\n\n\nclass ItemsView(MappingView,Set):\n\n __slots__=()\n \n @classmethod\n def _from_iterable(self,it):\n return set(it)\n \n def __contains__(self,item):\n key,value=item\n try :\n v=self._mapping[key]\n except KeyError:\n return False\n else :\n return v is value or v ==value\n \n def __iter__(self):\n for key in self._mapping:\n yield (key,self._mapping[key])\n \n \nItemsView.register(dict_items)\n\n\nclass ValuesView(MappingView,Collection):\n\n __slots__=()\n \n def __contains__(self,value):\n for key in self._mapping:\n v=self._mapping[key]\n if v is value or v ==value:\n return True\n return False\n \n def __iter__(self):\n for key in self._mapping:\n yield self._mapping[key]\n \n \nValuesView.register(dict_values)\n\n\nclass MutableMapping(Mapping):\n ''\n\n\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def __setitem__(self,key,value):\n raise KeyError\n \n @abstractmethod\n def __delitem__(self,key):\n raise KeyError\n \n __marker=object()\n \n def pop(self,key,default=__marker):\n ''\n\n \n try :\n value=self[key]\n except KeyError:\n if default is self.__marker:\n raise\n return default\n else :\n del self[key]\n return value\n \n def popitem(self):\n ''\n\n \n try :\n key=next(iter(self))\n except StopIteration:\n raise KeyError from None\n value=self[key]\n del self[key]\n return key,value\n \n def clear(self):\n ''\n try :\n while True :\n self.popitem()\n except KeyError:\n pass\n \n def update(self,other=(),/,**kwds):\n ''\n\n\n\n \n if isinstance(other,Mapping):\n for key in other:\n self[key]=other[key]\n elif hasattr(other,\"keys\"):\n for key in other.keys():\n self[key]=other[key]\n else :\n for key,value in other:\n self[key]=value\n for key,value in kwds.items():\n self[key]=value\n \n def setdefault(self,key,default=None ):\n ''\n try :\n return self[key]\n except KeyError:\n self[key]=default\n return default\n \n \nMutableMapping.register(dict)\n\n\n\n\nclass Sequence(Reversible,Collection):\n ''\n\n\n\n \n \n __slots__=()\n \n \n __abc_tpflags__=1 <<5\n \n @abstractmethod\n def __getitem__(self,index):\n raise IndexError\n \n def __iter__(self):\n i=0\n try :\n while True :\n v=self[i]\n yield v\n i +=1\n except IndexError:\n return\n \n def __contains__(self,value):\n for v in self:\n if v is value or v ==value:\n return True\n return False\n \n def __reversed__(self):\n for i in reversed(range(len(self))):\n yield self[i]\n \n def index(self,value,start=0,stop=None ):\n ''\n\n\n\n\n \n if start is not None and start <0:\n start=max(len(self)+start,0)\n if stop is not None and stop <0:\n stop +=len(self)\n \n i=start\n while stop is None or i 0:\n data=self.read(min(io.DEFAULT_BUFFER_SIZE,offset))\n if not data:\n break\n offset -=len(data)\n \n return self._pos\n \n def tell(self):\n ''\n return self._pos\n", ["io", "sys"]], "_contextvars": [".py", "''\n\n\nclass Context(object):\n\n __contains__=\"\"\n \n copy=\"\"\n \n def get(self,*args):\n pass\n \n items=\"\"\n \n keys=\"\"\n \n run=\"\"\n \n values=\"\"\n \nclass ContextVar:\n\n def __init__(self,name,**kw):\n ''\n self.name=name\n if \"default\"in kw:\n self.default=kw[\"default\"]\n \n def get(self,*args):\n if hasattr(self,\"value\"):\n return self.value\n elif len(args)==1:\n return args[0]\n elif hasattr(self,\"default\"):\n return self.default\n raise LookupError(self.name)\n \n def reset(self,token):\n if token.old_value ==Token.MISSING:\n del self.value\n else :\n self.value=token.old_value\n \n def set(self,value):\n self.value=value\n return Token(self)\n \nclass Token(object):\n\n MISSING=\"\"\n \n def __init__(self,contextvar):\n self.var=contextvar\n try :\n self.old_value=contextvar.get()\n except LookupError:\n self.old_value=Token.MISSING\n \ndef copy_context(*args,**kw):\n pass\n", []], "_csv": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__version__=\"1.0\"\n\nQUOTE_MINIMAL,QUOTE_ALL,QUOTE_NONNUMERIC,QUOTE_NONE,QUOTE_STRINGS,QUOTE_NOTNULL=range(6)\n_dialects={}\n_field_limit=128 *1024\n\nclass Error(Exception):\n pass\n \nclass Dialect(object):\n ''\n\n \n \n __slots__=[\"_delimiter\",\"_doublequote\",\"_escapechar\",\n \"_lineterminator\",\"_quotechar\",\"_quoting\",\n \"_skipinitialspace\",\"_strict\"]\n \n def __new__(cls,dialect,**kwargs):\n \n for name in kwargs:\n if '_'+name not in Dialect.__slots__:\n raise TypeError(\"unexpected keyword argument '%s'\"%\n (name,))\n \n if dialect is not None:\n if isinstance(dialect,str):\n dialect=get_dialect(dialect)\n \n \n if(isinstance(dialect,Dialect)\n and all(value is None for value in kwargs.values())):\n return dialect\n \n self=object.__new__(cls)\n \n \n def set_char(x):\n if x is None:\n return None\n if isinstance(x,str)and len(x)<=1:\n return x\n raise TypeError(\"%r must be a 1-character string\"%(name,))\n def set_str(x):\n if isinstance(x,str):\n return x\n raise TypeError(\"%r must be a string\"%(name,))\n def set_quoting(x):\n if x in range(4):\n return x\n raise TypeError(\"bad 'quoting' value\")\n \n attributes={\"delimiter\":(',',set_char),\n \"doublequote\":(True,bool),\n \"escapechar\":(None,set_char),\n \"lineterminator\":(\"\\r\\n\",set_str),\n \"quotechar\":('\"',set_char),\n \"quoting\":(QUOTE_MINIMAL,set_quoting),\n \"skipinitialspace\":(False,bool),\n \"strict\":(False,bool),\n }\n \n \n notset=object()\n for name in Dialect.__slots__:\n name=name[1:]\n value=notset\n if name in kwargs:\n value=kwargs[name]\n elif dialect is not None:\n value=getattr(dialect,name,notset)\n \n \n if value is notset:\n value=attributes[name][0]\n if name =='quoting'and not self.quotechar:\n value=QUOTE_NONE\n else:\n converter=attributes[name][1]\n if converter:\n value=converter(value)\n \n setattr(self,'_'+name,value)\n \n if not self.delimiter:\n raise TypeError(\"delimiter must be set\")\n \n if self.quoting !=QUOTE_NONE and not self.quotechar:\n raise TypeError(\"quotechar must be set if quoting enabled\")\n \n if not self.lineterminator:\n raise TypeError(\"lineterminator must be set\")\n \n return self\n \n delimiter=property(lambda self:self._delimiter)\n doublequote=property(lambda self:self._doublequote)\n escapechar=property(lambda self:self._escapechar)\n lineterminator=property(lambda self:self._lineterminator)\n quotechar=property(lambda self:self._quotechar)\n quoting=property(lambda self:self._quoting)\n skipinitialspace=property(lambda self:self._skipinitialspace)\n strict=property(lambda self:self._strict)\n \n \ndef _call_dialect(dialect_inst,kwargs):\n return Dialect(dialect_inst,**kwargs)\n \ndef register_dialect(name,dialect=None,**kwargs):\n ''\n \n if not isinstance(name,str):\n raise TypeError(\"dialect name must be a string or unicode\")\n \n dialect=_call_dialect(dialect,kwargs)\n _dialects[name]=dialect\n \ndef unregister_dialect(name):\n ''\n \n try:\n del _dialects[name]\n except KeyError:\n raise Error(\"unknown dialect\")\n \ndef get_dialect(name):\n ''\n \n try:\n return _dialects[name]\n except KeyError:\n raise Error(\"unknown dialect\")\n \ndef list_dialects():\n ''\n \n return list(_dialects)\n \nclass Reader(object):\n ''\n\n\n \n \n \n (START_RECORD,START_FIELD,ESCAPED_CHAR,IN_FIELD,\n IN_QUOTED_FIELD,ESCAPE_IN_QUOTED_FIELD,QUOTE_IN_QUOTED_FIELD,\n EAT_CRNL)=range(8)\n \n def __init__(self,iterator,dialect=None,**kwargs):\n self.dialect=_call_dialect(dialect,kwargs)\n \n \n \n self._delimiter=self.dialect.delimiter if self.dialect.delimiter else '\\0'\n self._quotechar=self.dialect.quotechar if self.dialect.quotechar else '\\0'\n self._escapechar=self.dialect.escapechar if self.dialect.escapechar else '\\0'\n self._doublequote=self.dialect.doublequote\n self._quoting=self.dialect.quoting\n self._skipinitialspace=self.dialect.skipinitialspace\n self._strict=self.dialect.strict\n \n self.input_iter=iter(iterator)\n self.line_num=0\n \n self._parse_reset()\n \n def _parse_reset(self):\n self.field=''\n self.fields=[]\n self.state=self.START_RECORD\n self.numeric_field=False\n \n def __iter__(self):\n return self\n \n def __next__(self):\n self._parse_reset()\n while True:\n try:\n line=next(self.input_iter)\n except StopIteration:\n \n if len(self.field)>0:\n raise Error(\"newline inside string\")\n raise\n \n self.line_num +=1\n \n if '\\0'in line:\n raise Error(\"line contains NULL byte\")\n self._parse_process_char(line)\n self._parse_eol()\n \n if self.state ==self.START_RECORD:\n break\n \n fields=self.fields\n self.fields=[]\n return fields\n \n def _parse_process_char(self,line):\n pos=0\n while pos pos:\n self._parse_add_str(line[pos:pos2])\n pos=pos2\n self._parse_save_field()\n self.state=self.EAT_CRNL\n break\n elif line[pos2]==self._escapechar[0]:\n \n if pos2 >pos:\n self._parse_add_str(line[pos:pos2])\n pos=pos2\n self.state=self.ESCAPED_CHAR\n break\n elif line[pos2]==self._delimiter[0]:\n \n if pos2 >pos:\n self._parse_add_str(line[pos:pos2])\n pos=pos2\n self._parse_save_field()\n self.state=self.START_FIELD\n break\n \n pos2 +=1\n else:\n if pos2 >pos:\n self._parse_add_str(line[pos:pos2])\n pos=pos2\n continue\n \n elif self.state ==self.START_RECORD:\n if line[pos]=='\\n'or line[pos]=='\\r':\n self.state=self.EAT_CRNL\n else:\n self.state=self.START_FIELD\n \n continue\n \n elif self.state ==self.START_FIELD:\n if line[pos]=='\\n'or line[pos]=='\\r':\n \n self._parse_save_field()\n self.state=self.EAT_CRNL\n elif(line[pos]==self._quotechar[0]\n and self._quoting !=QUOTE_NONE):\n \n self.state=self.IN_QUOTED_FIELD\n elif line[pos]==self._escapechar[0]:\n \n self.state=self.ESCAPED_CHAR\n elif self._skipinitialspace and line[pos]==' ':\n \n pass\n elif line[pos]==self._delimiter[0]:\n \n self._parse_save_field()\n else:\n \n if self._quoting ==QUOTE_NONNUMERIC:\n self.numeric_field=True\n self.state=self.IN_FIELD\n continue\n \n elif self.state ==self.ESCAPED_CHAR:\n self._parse_add_char(line[pos])\n self.state=self.IN_FIELD\n \n elif self.state ==self.IN_QUOTED_FIELD:\n if line[pos]==self._escapechar:\n \n self.state=self.ESCAPE_IN_QUOTED_FIELD\n elif(line[pos]==self._quotechar\n and self._quoting !=QUOTE_NONE):\n if self._doublequote:\n \n self.state=self.QUOTE_IN_QUOTED_FIELD\n else:\n \n self.state=self.IN_FIELD\n else:\n \n self._parse_add_char(line[pos])\n \n elif self.state ==self.ESCAPE_IN_QUOTED_FIELD:\n self._parse_add_char(line[pos])\n self.state=self.IN_QUOTED_FIELD\n \n elif self.state ==self.QUOTE_IN_QUOTED_FIELD:\n \n if(line[pos]==self._quotechar\n and self._quoting !=QUOTE_NONE):\n \n self._parse_add_char(line[pos])\n self.state=self.IN_QUOTED_FIELD\n elif line[pos]==self._delimiter[0]:\n \n self._parse_save_field()\n self.state=self.START_FIELD\n elif line[pos]=='\\r'or line[pos]=='\\n':\n \n self._parse_save_field()\n self.state=self.EAT_CRNL\n elif not self._strict:\n self._parse_add_char(line[pos])\n self.state=self.IN_FIELD\n else:\n raise Error(\"'%c' expected after '%c'\"%\n (self._delimiter,self._quotechar))\n \n elif self.state ==self.EAT_CRNL:\n if line[pos]=='\\r'or line[pos]=='\\n':\n pass\n else:\n raise Error(\"new-line character seen in unquoted field - \"\n \"do you need to open the file \"\n \"in universal-newline mode?\")\n \n else:\n raise RuntimeError(\"unknown state: %r\"%(self.state,))\n \n pos +=1\n \n def _parse_eol(self):\n if self.state ==self.EAT_CRNL:\n self.state=self.START_RECORD\n elif self.state ==self.START_RECORD:\n \n pass\n elif self.state ==self.IN_FIELD:\n \n \n self._parse_save_field()\n self.state=self.START_RECORD\n elif self.state ==self.START_FIELD:\n \n self._parse_save_field()\n self.state=self.START_RECORD\n elif self.state ==self.ESCAPED_CHAR:\n self._parse_add_char('\\n')\n self.state=self.IN_FIELD\n elif self.state ==self.IN_QUOTED_FIELD:\n pass\n elif self.state ==self.ESCAPE_IN_QUOTED_FIELD:\n self._parse_add_char('\\n')\n self.state=self.IN_QUOTED_FIELD\n elif self.state ==self.QUOTE_IN_QUOTED_FIELD:\n \n self._parse_save_field()\n self.state=self.START_RECORD\n else:\n raise RuntimeError(\"unknown state: %r\"%(self.state,))\n \n def _parse_save_field(self):\n field,self.field=self.field,''\n if self.numeric_field:\n self.numeric_field=False\n field=float(field)\n self.fields.append(field)\n \n def _parse_add_char(self,c):\n if len(self.field)+1 >_field_limit:\n raise Error(\"field larget than field limit (%d)\"%(_field_limit))\n self.field +=c\n \n def _parse_add_str(self,s):\n if len(self.field)+len(s)>_field_limit:\n raise Error(\"field larget than field limit (%d)\"%(_field_limit))\n self.field +=s\n \n \nclass Writer(object):\n ''\n\n\n \n \n def __init__(self,file,dialect=None,**kwargs):\n if not(hasattr(file,'write')and callable(file.write)):\n raise TypeError(\"argument 1 must have a 'write' method\")\n self.writeline=file.write\n self.dialect=_call_dialect(dialect,kwargs)\n \n def _join_reset(self):\n self.rec=[]\n self.num_fields=0\n \n def _join_append(self,field,quoted,quote_empty):\n dialect=self.dialect\n \n if self.num_fields >0:\n self.rec.append(dialect.delimiter)\n \n if dialect.quoting ==QUOTE_NONE:\n need_escape=tuple(dialect.lineterminator)+(\n dialect.escapechar,\n dialect.delimiter,dialect.quotechar)\n \n else:\n for c in tuple(dialect.lineterminator)+(\n dialect.delimiter,dialect.escapechar):\n if c and c in field:\n quoted=True\n \n need_escape=()\n if dialect.quotechar in field:\n if dialect.doublequote:\n field=field.replace(dialect.quotechar,\n dialect.quotechar *2)\n quoted=True\n else:\n need_escape=(dialect.quotechar,)\n \n \n for c in need_escape:\n if c and c in field:\n if not dialect.escapechar:\n raise Error(\"need to escape, but no escapechar set\")\n field=field.replace(c,dialect.escapechar+c)\n \n \n if field ==''and quote_empty:\n if dialect.quoting ==QUOTE_NONE:\n raise Error(\"single empty field record must be quoted\")\n quoted=1\n \n if quoted:\n field=dialect.quotechar+field+dialect.quotechar\n \n self.rec.append(field)\n self.num_fields +=1\n \n \n \n def writerow(self,row):\n dialect=self.dialect\n try:\n rowlen=len(row)\n except TypeError:\n raise Error(\"sequence expected\")\n \n \n self._join_reset()\n \n for field in row:\n quoted=False\n if dialect.quoting ==QUOTE_NONNUMERIC:\n try:\n float(field)\n except:\n quoted=True\n \n \n elif dialect.quoting ==QUOTE_ALL:\n quoted=True\n \n if field is None:\n self._join_append(\"\",quoted,rowlen ==1)\n else:\n self._join_append(str(field),quoted,rowlen ==1)\n \n \n self.rec.append(dialect.lineterminator)\n \n self.writeline(''.join(self.rec))\n \n def writerows(self,rows):\n for row in rows:\n self.writerow(row)\n \ndef reader(*args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n return Reader(*args,**kwargs)\n \ndef writer(*args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n return Writer(*args,**kwargs)\n \n \nundefined=object()\ndef field_size_limit(limit=undefined):\n ''\n\n\n\n \n \n global _field_limit\n old_limit=_field_limit\n \n if limit is not undefined:\n if not isinstance(limit,(int,long)):\n raise TypeError(\"int expected, got %s\"%\n (limit.__class__.__name__,))\n _field_limit=limit\n \n return old_limit\n", []], "_dummy_thread": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['error','start_new_thread','exit','get_ident','allocate_lock',\n'interrupt_main','LockType','RLock']\n\n\nTIMEOUT_MAX=2 **31\n\n\n\n\n\n\nerror=RuntimeError\n\ndef start_new_thread(function,args,kwargs={}):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if type(args)!=type(tuple()):\n raise TypeError(\"2nd arg must be a tuple\")\n if type(kwargs)!=type(dict()):\n raise TypeError(\"3rd arg must be a dict\")\n global _main\n _main=False\n try :\n function(*args,**kwargs)\n except SystemExit:\n pass\n except :\n import traceback\n traceback.print_exc()\n _main=True\n global _interrupt\n if _interrupt:\n _interrupt=False\n raise KeyboardInterrupt\n \ndef exit():\n ''\n raise SystemExit\n \ndef get_ident():\n ''\n\n\n\n\n \n return 1\n \ndef allocate_lock():\n ''\n return LockType()\n \ndef stack_size(size=None ):\n ''\n if size is not None :\n raise error(\"setting thread stack size not supported\")\n return 0\n \ndef _set_sentinel():\n ''\n return LockType()\n \nclass LockType(object):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self):\n self.locked_status=False\n \n def acquire(self,waitflag=None ,timeout=-1):\n ''\n\n\n\n\n\n\n\n\n \n if waitflag is None or waitflag:\n self.locked_status=True\n return True\n else :\n if not self.locked_status:\n self.locked_status=True\n return True\n else :\n if timeout >0:\n import time\n time.sleep(timeout)\n return False\n \n __enter__=acquire\n \n def __exit__(self,typ,val,tb):\n self.release()\n \n def release(self):\n ''\n \n \n if not self.locked_status:\n raise error\n self.locked_status=False\n return True\n \n def locked(self):\n return self.locked_status\n \n def __repr__(self):\n return \"<%s %s.%s object at %s>\"%(\n \"locked\"if self.locked_status else \"unlocked\",\n self.__class__.__module__,\n self.__class__.__qualname__,\n hex(id(self))\n )\n \n \nclass RLock(LockType):\n ''\n\n\n\n\n\n \n def __init__(self):\n super().__init__()\n self._levels=0\n \n def acquire(self,waitflag=None ,timeout=-1):\n ''\n \n locked=super().acquire(waitflag,timeout)\n if locked:\n self._levels +=1\n return locked\n \n def release(self):\n ''\n \n if self._levels ==0:\n raise error\n if self._levels ==1:\n super().release()\n self._levels -=1\n \n \n_interrupt=False\n\n_main=True\n\ndef interrupt_main():\n ''\n \n if _main:\n raise KeyboardInterrupt\n else :\n global _interrupt\n _interrupt=True\n", ["time", "traceback"]], "_frozen_importlib": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n_bootstrap_external=None\n_thread=None\nimport _weakref\n\nimport _imp\nimport sys\n\ndef _wrap(new,old):\n ''\n for replace in ['__module__','__name__','__qualname__','__doc__']:\n if hasattr(old,replace):\n setattr(new,replace,getattr(old,replace))\n new.__dict__.update(old.__dict__)\n \n \ndef _new_module(name):\n return type(sys)(name)\n \n \n \n \n \n \n_module_locks={}\n\n_blocking_on={}\n\n\nclass _DeadlockError(RuntimeError):\n pass\n \n \nclass _ModuleLock:\n ''\n\n\n \n \n def __init__(self,name):\n self.lock=_thread.allocate_lock()\n self.wakeup=_thread.allocate_lock()\n self.name=name\n self.owner=None\n self.count=0\n self.waiters=0\n \n def has_deadlock(self):\n \n me=_thread.get_ident()\n tid=self.owner\n while True :\n lock=_blocking_on.get(tid)\n if lock is None :\n return False\n tid=lock.owner\n if tid ==me:\n return True\n \n def acquire(self):\n ''\n\n\n\n \n tid=_thread.get_ident()\n _blocking_on[tid]=self\n try :\n while True :\n with self.lock:\n if self.count ==0 or self.owner ==tid:\n self.owner=tid\n self.count +=1\n return True\n if self.has_deadlock():\n raise _DeadlockError('deadlock detected by %r'%self)\n if self.wakeup.acquire(False ):\n self.waiters +=1\n \n self.wakeup.acquire()\n self.wakeup.release()\n finally :\n del _blocking_on[tid]\n \n def release(self):\n tid=_thread.get_ident()\n with self.lock:\n if self.owner !=tid:\n raise RuntimeError('cannot release un-acquired lock')\n assert self.count >0\n self.count -=1\n if self.count ==0:\n self.owner=None\n if self.waiters:\n self.waiters -=1\n self.wakeup.release()\n \n def __repr__(self):\n return '_ModuleLock({!r}) at {}'.format(self.name,id(self))\n \n \nclass _DummyModuleLock:\n ''\n \n \n def __init__(self,name):\n self.name=name\n self.count=0\n \n def acquire(self):\n self.count +=1\n return True\n \n def release(self):\n if self.count ==0:\n raise RuntimeError('cannot release un-acquired lock')\n self.count -=1\n \n def __repr__(self):\n return '_DummyModuleLock({!r}) at {}'.format(self.name,id(self))\n \n \nclass _ModuleLockManager:\n\n def __init__(self,name):\n self._name=name\n self._lock=None\n \n def __enter__(self):\n self._lock=_get_module_lock(self._name)\n self._lock.acquire()\n \n def __exit__(self,*args,**kwargs):\n self._lock.release()\n \n \n \n \ndef _get_module_lock(name):\n ''\n\n\n \n \n _imp.acquire_lock()\n try :\n try :\n lock=_module_locks[name]()\n except KeyError:\n lock=None\n \n if lock is None :\n if _thread is None :\n lock=_DummyModuleLock(name)\n else :\n lock=_ModuleLock(name)\n \n def cb(ref,name=name):\n _imp.acquire_lock()\n try :\n \n \n \n if _module_locks.get(name)is ref:\n del _module_locks[name]\n finally :\n _imp.release_lock()\n \n _module_locks[name]=_weakref.ref(lock,cb)\n finally :\n _imp.release_lock()\n \n return lock\n \n \ndef _lock_unlock_module(name):\n ''\n\n\n\n \n lock=_get_module_lock(name)\n try :\n lock.acquire()\n except _DeadlockError:\n \n \n pass\n else :\n lock.release()\n \n \ndef _call_with_frames_removed(f,*args,**kwds):\n ''\n\n\n\n\n\n \n return f(*args,**kwds)\n \n \ndef _verbose_message(message,*args,verbosity=1):\n ''\n if sys.flags.verbose >=verbosity:\n if not message.startswith(('#','import ')):\n message='# '+message\n print(message.format(*args),file=sys.stderr)\n \n \ndef _requires_builtin(fxn):\n ''\n def _requires_builtin_wrapper(self,fullname):\n if fullname not in sys.builtin_module_names:\n raise ImportError('{!r} is not a built-in module'.format(fullname),\n name=fullname)\n return fxn(self,fullname)\n _wrap(_requires_builtin_wrapper,fxn)\n return _requires_builtin_wrapper\n \n \ndef _requires_frozen(fxn):\n ''\n def _requires_frozen_wrapper(self,fullname):\n if not _imp.is_frozen(fullname):\n raise ImportError('{!r} is not a frozen module'.format(fullname),\n name=fullname)\n return fxn(self,fullname)\n _wrap(_requires_frozen_wrapper,fxn)\n return _requires_frozen_wrapper\n \n \n \ndef _load_module_shim(self,fullname):\n ''\n\n\n\n \n spec=spec_from_loader(fullname,self)\n if fullname in sys.modules:\n module=sys.modules[fullname]\n _exec(spec,module)\n return sys.modules[fullname]\n else :\n return _load(spec)\n \n \n \ndef _module_repr(module):\n\n loader=getattr(module,'__loader__',None )\n if hasattr(loader,'module_repr'):\n \n \n \n try :\n return loader.module_repr(module)\n except Exception:\n pass\n try :\n spec=module.__spec__\n except AttributeError:\n pass\n else :\n if spec is not None :\n return _module_repr_from_spec(spec)\n \n \n \n try :\n name=module.__name__\n except AttributeError:\n name='?'\n try :\n filename=module.__file__\n except AttributeError:\n if loader is None :\n return ''.format(name)\n else :\n return ''.format(name,loader)\n else :\n return ''.format(name,filename)\n \n \nclass _installed_safely:\n\n def __init__(self,module):\n self._module=module\n self._spec=module.__spec__\n \n def __enter__(self):\n \n \n \n self._spec._initializing=True\n sys.modules[self._spec.name]=self._module\n \n def __exit__(self,*args):\n try :\n spec=self._spec\n if any(arg is not None for arg in args):\n try :\n del sys.modules[spec.name]\n except KeyError:\n pass\n else :\n _verbose_message('import {!r} # {!r}',spec.name,spec.loader)\n finally :\n self._spec._initializing=False\n \n \nclass ModuleSpec:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,name,loader,*,origin=None ,loader_state=None ,\n is_package=None ):\n self.name=name\n self.loader=loader\n self.origin=origin\n self.loader_state=loader_state\n self.submodule_search_locations=[]if is_package else None\n \n \n self._set_fileattr=False\n self._cached=None\n \n def __repr__(self):\n args=['name={!r}'.format(self.name),\n 'loader={!r}'.format(self.loader)]\n if self.origin is not None :\n args.append('origin={!r}'.format(self.origin))\n if self.submodule_search_locations is not None :\n args.append('submodule_search_locations={}'\n .format(self.submodule_search_locations))\n return '{}({})'.format(self.__class__.__name__,', '.join(args))\n \n def __eq__(self,other):\n smsl=self.submodule_search_locations\n try :\n return (self.name ==other.name and\n self.loader ==other.loader and\n self.origin ==other.origin and\n smsl ==other.submodule_search_locations and\n self.cached ==other.cached and\n self.has_location ==other.has_location)\n except AttributeError:\n return False\n \n @property\n def cached(self):\n if self._cached is None :\n if self.origin is not None and self._set_fileattr:\n if _bootstrap_external is None :\n raise NotImplementedError\n self._cached=_bootstrap_external._get_cached(self.origin)\n return self._cached\n \n @cached.setter\n def cached(self,cached):\n self._cached=cached\n \n @property\n def parent(self):\n ''\n if self.submodule_search_locations is None :\n return self.name.rpartition('.')[0]\n else :\n return self.name\n \n @property\n def has_location(self):\n return self._set_fileattr\n \n @has_location.setter\n def has_location(self,value):\n self._set_fileattr=bool(value)\n \n \ndef spec_from_loader(name,loader,*,origin=None ,is_package=None ):\n ''\n if hasattr(loader,'get_filename'):\n if _bootstrap_external is None :\n raise NotImplementedError\n spec_from_file_location=_bootstrap_external.spec_from_file_location\n \n if is_package is None :\n return spec_from_file_location(name,loader=loader)\n search=[]if is_package else None\n return spec_from_file_location(name,loader=loader,\n submodule_search_locations=search)\n \n if is_package is None :\n if hasattr(loader,'is_package'):\n try :\n is_package=loader.is_package(name)\n except ImportError:\n is_package=None\n else :\n \n is_package=False\n \n return ModuleSpec(name,loader,origin=origin,is_package=is_package)\n \n \ndef _spec_from_module(module,loader=None ,origin=None ):\n\n try :\n spec=module.__spec__\n except AttributeError:\n pass\n else :\n if spec is not None :\n return spec\n \n name=module.__name__\n if loader is None :\n try :\n loader=module.__loader__\n except AttributeError:\n \n pass\n try :\n location=module.__file__\n except AttributeError:\n location=None\n if origin is None :\n if location is None :\n try :\n origin=loader._ORIGIN\n except AttributeError:\n origin=None\n else :\n origin=location\n try :\n cached=module.__cached__\n except AttributeError:\n cached=None\n try :\n submodule_search_locations=list(module.__path__)\n except AttributeError:\n submodule_search_locations=None\n \n spec=ModuleSpec(name,loader,origin=origin)\n spec._set_fileattr=False if location is None else True\n spec.cached=cached\n spec.submodule_search_locations=submodule_search_locations\n return spec\n \n \ndef _init_module_attrs(spec,module,*,override=False ):\n\n\n\n if (override or getattr(module,'__name__',None )is None ):\n try :\n module.__name__=spec.name\n except AttributeError:\n pass\n \n if override or getattr(module,'__loader__',None )is None :\n loader=spec.loader\n if loader is None :\n \n if spec.submodule_search_locations is not None :\n if _bootstrap_external is None :\n raise NotImplementedError\n _NamespaceLoader=_bootstrap_external._NamespaceLoader\n \n loader=_NamespaceLoader.__new__(_NamespaceLoader)\n loader._path=spec.submodule_search_locations\n spec.loader=loader\n \n \n \n \n \n \n \n \n \n \n module.__file__=None\n try :\n module.__loader__=loader\n except AttributeError:\n pass\n \n if override or getattr(module,'__package__',None )is None :\n try :\n module.__package__=spec.parent\n except AttributeError:\n pass\n \n try :\n module.__spec__=spec\n except AttributeError:\n pass\n \n if override or getattr(module,'__path__',None )is None :\n if spec.submodule_search_locations is not None :\n try :\n module.__path__=spec.submodule_search_locations\n except AttributeError:\n pass\n \n if spec.has_location:\n if override or getattr(module,'__file__',None )is None :\n try :\n module.__file__=spec.origin\n except AttributeError:\n pass\n \n if override or getattr(module,'__cached__',None )is None :\n if spec.cached is not None :\n try :\n module.__cached__=spec.cached\n except AttributeError:\n pass\n return module\n \n \ndef module_from_spec(spec):\n ''\n \n module=None\n if hasattr(spec.loader,'create_module'):\n \n \n module=spec.loader.create_module(spec)\n elif hasattr(spec.loader,'exec_module'):\n raise ImportError('loaders that define exec_module() '\n 'must also define create_module()')\n if module is None :\n module=_new_module(spec.name)\n _init_module_attrs(spec,module)\n return module\n \n \ndef _module_repr_from_spec(spec):\n ''\n \n name='?'if spec.name is None else spec.name\n if spec.origin is None :\n if spec.loader is None :\n return ''.format(name)\n else :\n return ''.format(name,spec.loader)\n else :\n if spec.has_location:\n return ''.format(name,spec.origin)\n else :\n return ''.format(spec.name,spec.origin)\n \n \n \ndef _exec(spec,module):\n ''\n name=spec.name\n with _ModuleLockManager(name):\n if sys.modules.get(name)is not module:\n msg='module {!r} not in sys.modules'.format(name)\n raise ImportError(msg,name=name)\n if spec.loader is None :\n if spec.submodule_search_locations is None :\n raise ImportError('missing loader',name=spec.name)\n \n _init_module_attrs(spec,module,override=True )\n return module\n _init_module_attrs(spec,module,override=True )\n if not hasattr(spec.loader,'exec_module'):\n \n \n \n spec.loader.load_module(name)\n else :\n spec.loader.exec_module(module)\n return sys.modules[name]\n \n \ndef _load_backward_compatible(spec):\n\n\n\n spec.loader.load_module(spec.name)\n \n module=sys.modules[spec.name]\n if getattr(module,'__loader__',None )is None :\n try :\n module.__loader__=spec.loader\n except AttributeError:\n pass\n if getattr(module,'__package__',None )is None :\n try :\n \n \n \n module.__package__=module.__name__\n if not hasattr(module,'__path__'):\n module.__package__=spec.name.rpartition('.')[0]\n except AttributeError:\n pass\n if getattr(module,'__spec__',None )is None :\n try :\n module.__spec__=spec\n except AttributeError:\n pass\n return module\n \ndef _load_unlocked(spec):\n\n if spec.loader is not None :\n \n if not hasattr(spec.loader,'exec_module'):\n return _load_backward_compatible(spec)\n \n module=module_from_spec(spec)\n with _installed_safely(module):\n if spec.loader is None :\n if spec.submodule_search_locations is None :\n raise ImportError('missing loader',name=spec.name)\n \n else :\n spec.loader.exec_module(module)\n \n \n \n \n return sys.modules[spec.name]\n \n \n \ndef _load(spec):\n ''\n\n\n\n\n\n\n \n with _ModuleLockManager(spec.name):\n return _load_unlocked(spec)\n \n \n \n \nclass BuiltinImporter:\n\n ''\n\n\n\n\n \n \n @staticmethod\n def module_repr(module):\n ''\n\n\n\n \n return ''.format(module.__name__)\n \n @classmethod\n def find_spec(cls,fullname,path=None ,target=None ):\n if path is not None :\n return None\n if _imp.is_builtin(fullname):\n return spec_from_loader(fullname,cls,origin='built-in')\n else :\n return None\n \n @classmethod\n def find_module(cls,fullname,path=None ):\n ''\n\n\n\n\n\n \n spec=cls.find_spec(fullname,path)\n return spec.loader if spec is not None else None\n \n @classmethod\n def create_module(self,spec):\n ''\n if spec.name not in sys.builtin_module_names:\n raise ImportError('{!r} is not a built-in module'.format(spec.name),\n name=spec.name)\n return _call_with_frames_removed(_imp.create_builtin,spec)\n \n @classmethod\n def exec_module(self,module):\n ''\n _call_with_frames_removed(_imp.exec_builtin,module)\n \n @classmethod\n @_requires_builtin\n def get_code(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_builtin\n def get_source(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_builtin\n def is_package(cls,fullname):\n ''\n return False\n \n load_module=classmethod(_load_module_shim)\n \n \nclass FrozenImporter:\n\n ''\n\n\n\n\n \n \n @staticmethod\n def module_repr(m):\n ''\n\n\n\n \n return ''.format(m.__name__)\n \n @classmethod\n def find_spec(cls,fullname,path=None ,target=None ):\n if _imp.is_frozen(fullname):\n return spec_from_loader(fullname,cls,origin='frozen')\n else :\n return None\n \n @classmethod\n def find_module(cls,fullname,path=None ):\n ''\n\n\n\n \n return cls if _imp.is_frozen(fullname)else None\n \n @classmethod\n def create_module(cls,spec):\n ''\n \n @staticmethod\n def exec_module(module):\n name=module.__spec__.name\n if not _imp.is_frozen(name):\n raise ImportError('{!r} is not a frozen module'.format(name),\n name=name)\n code=_call_with_frames_removed(_imp.get_frozen_object,name)\n exec(code,module.__dict__)\n \n @classmethod\n def load_module(cls,fullname):\n ''\n\n\n\n \n return _load_module_shim(cls,fullname)\n \n @classmethod\n @_requires_frozen\n def get_code(cls,fullname):\n ''\n return _imp.get_frozen_object(fullname)\n \n @classmethod\n @_requires_frozen\n def get_source(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_frozen\n def is_package(cls,fullname):\n ''\n return _imp.is_frozen_package(fullname)\n \n \n \n \nclass _ImportLockContext:\n\n ''\n \n def __enter__(self):\n ''\n _imp.acquire_lock()\n \n def __exit__(self,exc_type,exc_value,exc_traceback):\n ''\n _imp.release_lock()\n \n \ndef _resolve_name(name,package,level):\n ''\n bits=package.rsplit('.',level -1)\n if len(bits)= 0')\n if level >0:\n if not isinstance(package,str):\n raise TypeError('__package__ not set to a string')\n elif not package:\n raise ImportError('attempted relative import with no known parent '\n 'package')\n if not name and level ==0:\n raise ValueError('Empty module name')\n \n \n_ERR_MSG_PREFIX='No module named '\n_ERR_MSG=_ERR_MSG_PREFIX+'{!r}'\n\ndef _find_and_load_unlocked(name,import_):\n path=None\n parent=name.rpartition('.')[0]\n if parent:\n if parent not in sys.modules:\n _call_with_frames_removed(import_,parent)\n \n if name in sys.modules:\n return sys.modules[name]\n parent_module=sys.modules[parent]\n try :\n path=parent_module.__path__\n except AttributeError:\n msg=(_ERR_MSG+'; {!r} is not a package').format(name,parent)\n raise ModuleNotFoundError(msg,name=name)from None\n spec=_find_spec(name,path)\n if spec is None :\n raise ModuleNotFoundError(_ERR_MSG.format(name),name=name)\n else :\n module=_load_unlocked(spec)\n if parent:\n \n parent_module=sys.modules[parent]\n setattr(parent_module,name.rpartition('.')[2],module)\n return module\n \n \n_NEEDS_LOADING=object()\n\n\ndef _find_and_load(name,import_):\n ''\n with _ModuleLockManager(name):\n module=sys.modules.get(name,_NEEDS_LOADING)\n if module is _NEEDS_LOADING:\n return _find_and_load_unlocked(name,import_)\n \n if module is None :\n message=('import of {} halted; '\n 'None in sys.modules'.format(name))\n raise ModuleNotFoundError(message,name=name)\n \n _lock_unlock_module(name)\n return module\n \n \ndef _gcd_import(name,package=None ,level=0):\n ''\n\n\n\n\n\n\n \n _sanity_check(name,package,level)\n if level >0:\n name=_resolve_name(name,package,level)\n return _find_and_load(name,_gcd_import)\n \n \ndef _handle_fromlist(module,fromlist,import_,*,recursive=False ):\n ''\n\n\n\n\n\n \n \n \n if hasattr(module,'__path__'):\n for x in fromlist:\n if not isinstance(x,str):\n if recursive:\n where=module.__name__+'.__all__'\n else :\n where=\"``from list''\"\n raise TypeError(f\"Item in {where} must be str, \"\n f\"not {type(x).__name__}\")\n elif x =='*':\n if not recursive and hasattr(module,'__all__'):\n _handle_fromlist(module,module.__all__,import_,\n recursive=True )\n elif not hasattr(module,x):\n from_name='{}.{}'.format(module.__name__,x)\n try :\n _call_with_frames_removed(import_,from_name)\n except ModuleNotFoundError as exc:\n \n \n \n if (exc.name ==from_name and\n sys.modules.get(from_name,_NEEDS_LOADING)is not None ):\n continue\n raise\n return module\n \n \ndef _calc___package__(globals):\n ''\n\n\n\n\n \n package=globals.get('__package__')\n spec=globals.get('__spec__')\n if package is not None :\n if spec is not None and package !=spec.parent:\n _warnings.warn(\"__package__ != __spec__.parent \"\n f\"({package!r} != {spec.parent!r})\",\n ImportWarning,stacklevel=3)\n return package\n elif spec is not None :\n return spec.parent\n else :\n _warnings.warn(\"can't resolve package from __spec__ or __package__, \"\n \"falling back on __name__ and __path__\",\n ImportWarning,stacklevel=3)\n package=globals['__name__']\n if '__path__'not in globals:\n package=package.rpartition('.')[0]\n return package\n \n \ndef __import__(name,globals=None ,locals=None ,fromlist=(),level=0):\n ''\n\n\n\n\n\n\n\n\n \n if level ==0:\n module=_gcd_import(name)\n else :\n globals_=globals if globals is not None else {}\n package=_calc___package__(globals_)\n module=_gcd_import(name,package,level)\n if not fromlist:\n \n \n if level ==0:\n return _gcd_import(name.partition('.')[0])\n elif not name:\n return module\n else :\n \n \n cut_off=len(name)-len(name.partition('.')[0])\n \n \n return sys.modules[module.__name__[:len(module.__name__)-cut_off]]\n else :\n return _handle_fromlist(module,fromlist,_gcd_import)\n \n \ndef _builtin_from_name(name):\n spec=BuiltinImporter.find_spec(name)\n if spec is None :\n raise ImportError('no built-in module named '+name)\n return _load_unlocked(spec)\n \n \nmodule_type=type(sys)\nfor name,module in sys.modules.items():\n if isinstance(module,module_type):\n if name in sys.builtin_module_names:\n loader=BuiltinImporter\n elif _imp.is_frozen(name):\n loader=FrozenImporter\n else :\n continue\n spec=_spec_from_module(module,loader)\n _init_module_attrs(spec,module)\n \n \nself_module=sys.modules[__name__]\n\n\nfor builtin_name in ('_warnings',):\n if builtin_name not in sys.modules:\n builtin_module=_builtin_from_name(builtin_name)\n else :\n builtin_module=sys.modules[builtin_name]\n setattr(self_module,builtin_name,builtin_module)\n \n \ndef _install(sys_module,_imp_module):\n ''\n _setup(sys_module,_imp_module)\n \n sys.meta_path.append(BuiltinImporter)\n sys.meta_path.append(FrozenImporter)\n \n \ndef _install_external_importers():\n ''\n global _bootstrap_external\n import _frozen_importlib_external\n _bootstrap_external=_frozen_importlib_external\n _frozen_importlib_external._install(sys.modules[__name__])\n \n", ["_frozen_importlib_external", "_imp", "_weakref", "sys"]], "_functools": [".py", "from reprlib import recursive_repr\n\nclass partial:\n ''\n\n \n \n __slots__=\"func\",\"args\",\"keywords\",\"__dict__\",\"__weakref__\"\n \n def __new__(*args,**keywords):\n if not args:\n raise TypeError(\"descriptor '__new__' of partial needs an argument\")\n if len(args)<2:\n raise TypeError(\"type 'partial' takes at least one argument\")\n cls,func,*args=args\n if not callable(func):\n raise TypeError(\"the first argument must be callable\")\n args=tuple(args)\n \n if hasattr(func,\"func\")and isinstance(func.args,tuple):\n args=func.args+args\n tmpkw=func.keywords.copy()\n tmpkw.update(keywords)\n keywords=tmpkw\n del tmpkw\n func=func.func\n \n self=super(partial,cls).__new__(cls)\n \n self.func=func\n self.args=args\n self.keywords=keywords\n return self\n \n def __call__(*args,**keywords):\n if not args:\n raise TypeError(\"descriptor '__call__' of partial needs an argument\")\n self,*args=args\n newkeywords=self.keywords.copy()\n newkeywords.update(keywords)\n return self.func(*self.args,*args,**newkeywords)\n \n @recursive_repr()\n def __repr__(self):\n qualname=type(self).__qualname__\n args=[repr(self.func)]\n args.extend(repr(x)for x in self.args)\n args.extend(f\"{k}={v!r}\"for (k,v)in self.keywords.items())\n if type(self).__module__ ==\"functools\":\n return f\"functools.{qualname}({', '.join(args)})\"\n return f\"{qualname}({', '.join(args)})\"\n \n def __reduce__(self):\n return type(self),(self.func,),(self.func,self.args,\n self.keywords or None ,self.__dict__ or None )\n \n def __setstate__(self,state):\n if not isinstance(state,tuple):\n raise TypeError(\"argument to __setstate__ must be a tuple\")\n if len(state)!=4:\n raise TypeError(f\"expected 4 items in state, got {len(state)}\")\n func,args,kwds,namespace=state\n if (not callable(func)or not isinstance(args,tuple)or\n (kwds is not None and not isinstance(kwds,dict))or\n (namespace is not None and not isinstance(namespace,dict))):\n raise TypeError(\"invalid partial state\")\n \n args=tuple(args)\n if kwds is None :\n kwds={}\n elif type(kwds)is not dict:\n kwds=dict(kwds)\n if namespace is None :\n namespace={}\n \n self.__dict__=namespace\n self.func=func\n self.args=args\n self.keywords=kwds\n \ndef reduce(func,iterable,initializer=None ):\n args=iter(iterable)\n if initializer is not None :\n res=initializer\n else :\n res=next(args)\n while True :\n try :\n res=func(res,next(args))\n except StopIteration:\n return res\n", ["reprlib"]], "_imp": [".py", "''\nimport sys\n\ndef _fix_co_filename(*args,**kw):\n ''\n\n\n\n \n pass\n \ndef acquire_lock(*args,**kw):\n ''\n\n \n pass\n \ncheck_hash_based_pycs=\"\"\"default\"\"\"\n\ndef create_builtin(spec):\n ''\n return __import__(spec.name)\n \ndef create_dynamic(*args,**kw):\n ''\n pass\n \ndef exec_builtin(*args,**kw):\n ''\n pass\n \ndef exec_dynamic(*args,**kw):\n ''\n pass\n \ndef extension_suffixes(*args,**kw):\n ''\n return []\n \ndef get_frozen_object(*args,**kw):\n ''\n pass\n \ndef init_frozen(*args,**kw):\n ''\n pass\n \ndef is_builtin(module_name):\n\n return module_name in __BRYTHON__.builtin_module_names\n \ndef is_frozen(*args,**kw):\n ''\n return False\n \ndef is_frozen_package(*args,**kw):\n ''\n pass\n \ndef lock_held(*args,**kw):\n ''\n \n return False\n \ndef release_lock(*args,**kw):\n ''\n \n pass\n \ndef source_hash(*args,**kw):\n pass\n", ["sys"]], "_io": [".py", "''\n\n\n\nimport os\nimport abc\nimport codecs\nimport errno\n\ntry :\n from _thread import allocate_lock as Lock\nexcept ImportError:\n from _dummy_thread import allocate_lock as Lock\n \n \nfrom _io_classes import *\nimport _io_classes\n_IOBase=_io_classes._IOBase\n_RawIOBase=_io_classes._RawIOBase\n_BufferedIOBase=_io_classes._BufferedIOBase\n_TextIOBase=_io_classes._TextIOBase\n\nSEEK_SET=0\nSEEK_CUR=1\nSEEK_END=2\n\nvalid_seek_flags={0,1,2}\nif hasattr(os,'SEEK_HOLE'):\n valid_seek_flags.add(os.SEEK_HOLE)\n valid_seek_flags.add(os.SEEK_DATA)\n \n \nDEFAULT_BUFFER_SIZE=8 *1024\n\n\n\n\n\n\nBlockingIOError=BlockingIOError\n\n\ndef __open(file,mode=\"r\",buffering=-1,encoding=None ,errors=None ,\nnewline=None ,closefd=True ,opener=None ):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not isinstance(file,(str,bytes,int)):\n raise TypeError(\"invalid file: %r\"%file)\n if not isinstance(mode,str):\n raise TypeError(\"invalid mode: %r\"%mode)\n if not isinstance(buffering,int):\n raise TypeError(\"invalid buffering: %r\"%buffering)\n if encoding is not None and not isinstance(encoding,str):\n raise TypeError(\"invalid encoding: %r\"%encoding)\n if errors is not None and not isinstance(errors,str):\n raise TypeError(\"invalid errors: %r\"%errors)\n modes=set(mode)\n if modes -set(\"axrwb+tU\")or len(mode)>len(modes):\n raise ValueError(\"invalid mode: %r\"%mode)\n creating=\"x\"in modes\n reading=\"r\"in modes\n writing=\"w\"in modes\n appending=\"a\"in modes\n updating=\"+\"in modes\n text=\"t\"in modes\n binary=\"b\"in modes\n if \"U\"in modes:\n if creating or writing or appending:\n raise ValueError(\"can't use U and writing mode at once\")\n reading=True\n if text and binary:\n raise ValueError(\"can't have text and binary mode at once\")\n if creating+reading+writing+appending >1:\n raise ValueError(\"can't have read/write/append mode at once\")\n if not (creating or reading or writing or appending):\n raise ValueError(\"must have exactly one of read/write/append mode\")\n if binary and encoding is not None :\n raise ValueError(\"binary mode doesn't take an encoding argument\")\n if binary and errors is not None :\n raise ValueError(\"binary mode doesn't take an errors argument\")\n if binary and newline is not None :\n raise ValueError(\"binary mode doesn't take a newline argument\")\n raw=FileIO(file,\n (creating and \"x\"or \"\")+\n (reading and \"r\"or \"\")+\n (writing and \"w\"or \"\")+\n (appending and \"a\"or \"\")+\n (updating and \"+\"or \"\"),\n closefd,opener=opener)\n line_buffering=False\n if buffering ==1 or buffering <0 and raw.isatty():\n buffering=-1\n line_buffering=True\n if buffering <0:\n buffering=DEFAULT_BUFFER_SIZE\n try :\n bs=os.fstat(raw.fileno()).st_blksize\n except (os.error,AttributeError):\n pass\n else :\n if bs >1:\n buffering=bs\n if buffering <0:\n raise ValueError(\"invalid buffering size\")\n if buffering ==0:\n if binary:\n return raw\n raise ValueError(\"can't have unbuffered text I/O\")\n if updating:\n buffer=BufferedRandom(raw,buffering)\n elif creating or writing or appending:\n buffer=BufferedWriter(raw,buffering)\n elif reading:\n buffer=BufferedReader(raw,buffering)\n else :\n raise ValueError(\"unknown mode: %r\"%mode)\n if binary:\n return buffer\n text=TextIOWrapper(buffer,encoding,errors,newline,line_buffering)\n text.mode=mode\n return text\n \nopen=__open\n\ndef open_code(file):\n return __builtins__.open(file,encoding=\"utf-8\")\n \ndef text_encoding(encoding,stacklevel=2):\n if encoding is None :\n return \"locale\"\n return encoding\n \nclass DocDescriptor:\n ''\n \n def __get__(self,obj,typ):\n return (\n \"open(file, mode='r', buffering=-1, encoding=None, \"\n \"errors=None, newline=None, closefd=True)\\n\\n\"+\n open.__doc__)\n \nclass OpenWrapper:\n ''\n\n\n\n\n\n \n __doc__=DocDescriptor()\n \n def __new__(cls,*args,**kwargs):\n return open(*args,**kwargs)\n \n \n \n \nclass UnsupportedOperation(ValueError,IOError):\n pass\n \n", ["_dummy_thread", "_io_classes", "_thread", "abc", "codecs", "errno", "os"]], "_markupbase": [".py", "''\n\n\n\n\n\n\nimport re\n\n_declname_match=re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\\s*').match\n_declstringlit_match=re.compile(r'(\\'[^\\']*\\'|\"[^\"]*\")\\s*').match\n_commentclose=re.compile(r'--\\s*>')\n_markedsectionclose=re.compile(r']\\s*]\\s*>')\n\n\n\n\n_msmarkedsectionclose=re.compile(r']\\s*>')\n\ndel re\n\n\nclass ParserBase:\n ''\n \n \n def __init__(self):\n if self.__class__ is ParserBase:\n raise RuntimeError(\n \"_markupbase.ParserBase must be subclassed\")\n \n def reset(self):\n self.lineno=1\n self.offset=0\n \n def getpos(self):\n ''\n return self.lineno,self.offset\n \n \n \n \n \n def updatepos(self,i,j):\n if i >=j:\n return j\n rawdata=self.rawdata\n nlines=rawdata.count(\"\\n\",i,j)\n if nlines:\n self.lineno=self.lineno+nlines\n pos=rawdata.rindex(\"\\n\",i,j)\n self.offset=j -(pos+1)\n else :\n self.offset=self.offset+j -i\n return j\n \n _decl_otherchars=''\n \n \n def parse_declaration(self,i):\n \n \n \n \n \n \n \n \n \n \n rawdata=self.rawdata\n j=i+2\n assert rawdata[i:j]==\"\":\n \n return j+1\n if rawdata[j:j+1]in (\"-\",\"\"):\n \n \n return -1\n \n n=len(rawdata)\n if rawdata[j:j+2]=='--':\n \n return self.parse_comment(i)\n elif rawdata[j]=='[':\n \n \n \n \n return self.parse_marked_section(i)\n else :\n decltype,j=self._scan_name(j,i)\n if j <0:\n return j\n if decltype ==\"doctype\":\n self._decl_otherchars=''\n while j \":\n \n data=rawdata[i+2:j]\n if decltype ==\"doctype\":\n self.handle_decl(data)\n else :\n \n \n \n \n self.unknown_decl(data)\n return j+1\n if c in \"\\\"'\":\n m=_declstringlit_match(rawdata,j)\n if not m:\n return -1\n j=m.end()\n elif c in \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\":\n name,j=self._scan_name(j,i)\n elif c in self._decl_otherchars:\n j=j+1\n elif c ==\"[\":\n \n if decltype ==\"doctype\":\n j=self._parse_doctype_subset(j+1,i)\n elif decltype in {\"attlist\",\"linktype\",\"link\",\"element\"}:\n \n \n \n \n raise AssertionError(\"unsupported '[' char in %s declaration\"%decltype)\n else :\n raise AssertionError(\"unexpected '[' char in declaration\")\n else :\n raise AssertionError(\"unexpected %r char in declaration\"%rawdata[j])\n if j <0:\n return j\n return -1\n \n \n \n def parse_marked_section(self,i,report=1):\n rawdata=self.rawdata\n assert rawdata[i:i+3]=='n:\n \n return -1\n if rawdata[j:j+4]==\"\n \n \"\"\"%(self.OutputString(attrs).replace('\"',r'\\\"'))\n \n def OutputString(self,attrs=None ):\n \n \n result=[]\n append=result.append\n \n \n append(\"%s=%s\"%(self.key,self.coded_value))\n \n \n if attrs is None :\n attrs=self._reserved\n items=sorted(self.items())\n for key,value in items:\n if value ==\"\":\n continue\n if key not in attrs:\n continue\n if key ==\"expires\"and isinstance(value,int):\n append(\"%s=%s\"%(self._reserved[key],_getdate(value)))\n elif key ==\"max-age\"and isinstance(value,int):\n append(\"%s=%d\"%(self._reserved[key],value))\n elif key ==\"secure\":\n append(str(self._reserved[key]))\n elif key ==\"httponly\":\n append(str(self._reserved[key]))\n else :\n append(\"%s=%s\"%(self._reserved[key],value))\n \n \n return _semispacejoin(result)\n \n \n \n \n \n \n \n \n \n \n \n_LegalCharsPatt=r\"[\\w\\d!#%&'~_`><@,:/\\$\\*\\+\\-\\.\\^\\|\\)\\(\\?\\}\\{\\=]\"\n_CookiePattern=re.compile(r\"\"\"\n (?x) # This is a verbose pattern\n (?P # Start of group 'key'\n \"\"\"+_LegalCharsPatt+r\"\"\"+? # Any word of at least one letter\n ) # End of group 'key'\n ( # Optional group: there may not be a value.\n \\s*=\\s* # Equal Sign\n (?P # Start of group 'val'\n \"(?:[^\\\\\"]|\\\\.)*\" # Any doublequoted string\n | # or\n \\w{3},\\s[\\w\\d\\s-]{9,11}\\s[\\d:]{8}\\sGMT # Special case for \"expires\" attr\n | # or\n \"\"\"+_LegalCharsPatt+r\"\"\"* # Any word or empty string\n ) # End of group 'val'\n )? # End of optional value group\n \\s* # Any number of spaces.\n (\\s+|;|$) # Ending either at space, semicolon, or EOS.\n \"\"\",re.ASCII)\n\n\n\n\n\nclass BaseCookie(dict):\n ''\n \n def value_decode(self,val):\n ''\n\n\n\n\n \n return val,val\n \n def value_encode(self,val):\n ''\n\n\n\n \n strval=str(val)\n return strval,strval\n \n def __init__(self,input=None ):\n if input:\n self.load(input)\n \n def __set(self,key,real_value,coded_value):\n ''\n M=self.get(key,Morsel())\n M.set(key,real_value,coded_value)\n dict.__setitem__(self,key,M)\n \n def __setitem__(self,key,value):\n ''\n rval,cval=self.value_encode(value)\n self.__set(key,rval,cval)\n \n def output(self,attrs=None ,header=\"Set-Cookie:\",sep=\"\\015\\012\"):\n ''\n result=[]\n items=sorted(self.items())\n for key,value in items:\n result.append(value.output(attrs,header))\n return sep.join(result)\n \n __str__=output\n \n def __repr__(self):\n l=[]\n items=sorted(self.items())\n for key,value in items:\n l.append('%s=%s'%(key,repr(value.value)))\n return '<%s: %s>'%(self.__class__.__name__,_spacejoin(l))\n \n def js_output(self,attrs=None ):\n ''\n result=[]\n items=sorted(self.items())\n for key,value in items:\n result.append(value.js_output(attrs))\n return _nulljoin(result)\n \n def load(self,rawdata):\n ''\n\n\n\n \n if isinstance(rawdata,str):\n self.__parse_string(rawdata)\n else :\n \n for key,value in rawdata.items():\n self[key]=value\n return\n \n def __parse_string(self,str,patt=_CookiePattern):\n i=0\n n=len(str)\n M=None\n \n while 0 <=i 0\n self.count -=1\n if self.count ==0:\n self.owner=None\n if self.waiters:\n self.waiters -=1\n self.wakeup.release()\n \n def __repr__(self):\n return '_ModuleLock({!r}) at {}'.format(self.name,id(self))\n \n \nclass _DummyModuleLock:\n ''\n \n \n def __init__(self,name):\n self.name=name\n self.count=0\n \n def acquire(self):\n self.count +=1\n return True\n \n def release(self):\n if self.count ==0:\n raise RuntimeError('cannot release un-acquired lock')\n self.count -=1\n \n def __repr__(self):\n return '_DummyModuleLock({!r}) at {}'.format(self.name,id(self))\n \n \nclass _ModuleLockManager:\n\n def __init__(self,name):\n self._name=name\n self._lock=None\n \n def __enter__(self):\n self._lock=_get_module_lock(self._name)\n self._lock.acquire()\n \n def __exit__(self,*args,**kwargs):\n self._lock.release()\n \n \n \n \ndef _get_module_lock(name):\n ''\n\n\n \n \n _imp.acquire_lock()\n try :\n try :\n lock=_module_locks[name]()\n except KeyError:\n lock=None\n \n if lock is None :\n if _thread is None :\n lock=_DummyModuleLock(name)\n else :\n lock=_ModuleLock(name)\n \n def cb(ref,name=name):\n _imp.acquire_lock()\n try :\n \n \n \n if _module_locks.get(name)is ref:\n del _module_locks[name]\n finally :\n _imp.release_lock()\n \n _module_locks[name]=_weakref.ref(lock,cb)\n finally :\n _imp.release_lock()\n \n return lock\n \n \ndef _lock_unlock_module(name):\n ''\n\n\n\n \n lock=_get_module_lock(name)\n try :\n lock.acquire()\n except _DeadlockError:\n \n \n pass\n else :\n lock.release()\n \n \ndef _call_with_frames_removed(f,*args,**kwds):\n ''\n\n\n\n\n\n \n return f(*args,**kwds)\n \n \ndef _verbose_message(message,*args,verbosity=1):\n ''\n if sys.flags.verbose >=verbosity:\n if not message.startswith(('#','import ')):\n message='# '+message\n print(message.format(*args),file=sys.stderr)\n \n \ndef _requires_builtin(fxn):\n ''\n def _requires_builtin_wrapper(self,fullname):\n if fullname not in sys.builtin_module_names:\n raise ImportError('{!r} is not a built-in module'.format(fullname),\n name=fullname)\n return fxn(self,fullname)\n _wrap(_requires_builtin_wrapper,fxn)\n return _requires_builtin_wrapper\n \n \ndef _requires_frozen(fxn):\n ''\n def _requires_frozen_wrapper(self,fullname):\n if not _imp.is_frozen(fullname):\n raise ImportError('{!r} is not a frozen module'.format(fullname),\n name=fullname)\n return fxn(self,fullname)\n _wrap(_requires_frozen_wrapper,fxn)\n return _requires_frozen_wrapper\n \n \n \ndef _load_module_shim(self,fullname):\n ''\n\n\n\n \n spec=spec_from_loader(fullname,self)\n if fullname in sys.modules:\n module=sys.modules[fullname]\n _exec(spec,module)\n return sys.modules[fullname]\n else :\n return _load(spec)\n \n \n \ndef _module_repr(module):\n\n loader=getattr(module,'__loader__',None )\n if hasattr(loader,'module_repr'):\n \n \n \n try :\n return loader.module_repr(module)\n except Exception:\n pass\n try :\n spec=module.__spec__\n except AttributeError:\n pass\n else :\n if spec is not None :\n return _module_repr_from_spec(spec)\n \n \n \n try :\n name=module.__name__\n except AttributeError:\n name='?'\n try :\n filename=module.__file__\n except AttributeError:\n if loader is None :\n return ''.format(name)\n else :\n return ''.format(name,loader)\n else :\n return ''.format(name,filename)\n \n \nclass _installed_safely:\n\n def __init__(self,module):\n self._module=module\n self._spec=module.__spec__\n \n def __enter__(self):\n \n \n \n self._spec._initializing=True\n sys.modules[self._spec.name]=self._module\n \n def __exit__(self,*args):\n try :\n spec=self._spec\n if any(arg is not None for arg in args):\n try :\n del sys.modules[spec.name]\n except KeyError:\n pass\n else :\n _verbose_message('import {!r} # {!r}',spec.name,spec.loader)\n finally :\n self._spec._initializing=False\n \n \nclass ModuleSpec:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,name,loader,*,origin=None ,loader_state=None ,\n is_package=None ):\n self.name=name\n self.loader=loader\n self.origin=origin\n self.loader_state=loader_state\n self.submodule_search_locations=[]if is_package else None\n \n \n self._set_fileattr=False\n self._cached=None\n \n def __repr__(self):\n args=['name={!r}'.format(self.name),\n 'loader={!r}'.format(self.loader)]\n if self.origin is not None :\n args.append('origin={!r}'.format(self.origin))\n if self.submodule_search_locations is not None :\n args.append('submodule_search_locations={}'\n .format(self.submodule_search_locations))\n return '{}({})'.format(self.__class__.__name__,', '.join(args))\n \n def __eq__(self,other):\n smsl=self.submodule_search_locations\n try :\n return (self.name ==other.name and\n self.loader ==other.loader and\n self.origin ==other.origin and\n smsl ==other.submodule_search_locations and\n self.cached ==other.cached and\n self.has_location ==other.has_location)\n except AttributeError:\n return False\n \n @property\n def cached(self):\n if self._cached is None :\n if self.origin is not None and self._set_fileattr:\n if _bootstrap_external is None :\n raise NotImplementedError\n self._cached=_bootstrap_external._get_cached(self.origin)\n return self._cached\n \n @cached.setter\n def cached(self,cached):\n self._cached=cached\n \n @property\n def parent(self):\n ''\n if self.submodule_search_locations is None :\n return self.name.rpartition('.')[0]\n else :\n return self.name\n \n @property\n def has_location(self):\n return self._set_fileattr\n \n @has_location.setter\n def has_location(self,value):\n self._set_fileattr=bool(value)\n \n \ndef spec_from_loader(name,loader,*,origin=None ,is_package=None ):\n ''\n if hasattr(loader,'get_filename'):\n if _bootstrap_external is None :\n raise NotImplementedError\n spec_from_file_location=_bootstrap_external.spec_from_file_location\n \n if is_package is None :\n return spec_from_file_location(name,loader=loader)\n search=[]if is_package else None\n return spec_from_file_location(name,loader=loader,\n submodule_search_locations=search)\n \n if is_package is None :\n if hasattr(loader,'is_package'):\n try :\n is_package=loader.is_package(name)\n except ImportError:\n is_package=None\n else :\n \n is_package=False\n \n return ModuleSpec(name,loader,origin=origin,is_package=is_package)\n \n \ndef _spec_from_module(module,loader=None ,origin=None ):\n\n try :\n spec=module.__spec__\n except AttributeError:\n pass\n else :\n if spec is not None :\n return spec\n \n name=module.__name__\n if loader is None :\n try :\n loader=module.__loader__\n except AttributeError:\n \n pass\n try :\n location=module.__file__\n except AttributeError:\n location=None\n if origin is None :\n if location is None :\n try :\n origin=loader._ORIGIN\n except AttributeError:\n origin=None\n else :\n origin=location\n try :\n cached=module.__cached__\n except AttributeError:\n cached=None\n try :\n submodule_search_locations=list(module.__path__)\n except AttributeError:\n submodule_search_locations=None\n \n spec=ModuleSpec(name,loader,origin=origin)\n spec._set_fileattr=False if location is None else True\n spec.cached=cached\n spec.submodule_search_locations=submodule_search_locations\n return spec\n \n \ndef _init_module_attrs(spec,module,*,override=False ):\n\n\n\n if (override or getattr(module,'__name__',None )is None ):\n try :\n module.__name__=spec.name\n except AttributeError:\n pass\n \n if override or getattr(module,'__loader__',None )is None :\n loader=spec.loader\n if loader is None :\n \n if spec.submodule_search_locations is not None :\n if _bootstrap_external is None :\n raise NotImplementedError\n _NamespaceLoader=_bootstrap_external._NamespaceLoader\n \n loader=_NamespaceLoader.__new__(_NamespaceLoader)\n loader._path=spec.submodule_search_locations\n spec.loader=loader\n \n \n \n \n \n \n \n \n \n \n module.__file__=None\n try :\n module.__loader__=loader\n except AttributeError:\n pass\n \n if override or getattr(module,'__package__',None )is None :\n try :\n module.__package__=spec.parent\n except AttributeError:\n pass\n \n try :\n module.__spec__=spec\n except AttributeError:\n pass\n \n if override or getattr(module,'__path__',None )is None :\n if spec.submodule_search_locations is not None :\n try :\n module.__path__=spec.submodule_search_locations\n except AttributeError:\n pass\n \n if spec.has_location:\n if override or getattr(module,'__file__',None )is None :\n try :\n module.__file__=spec.origin\n except AttributeError:\n pass\n \n if override or getattr(module,'__cached__',None )is None :\n if spec.cached is not None :\n try :\n module.__cached__=spec.cached\n except AttributeError:\n pass\n return module\n \n \ndef module_from_spec(spec):\n ''\n \n module=None\n if hasattr(spec.loader,'create_module'):\n \n \n module=spec.loader.create_module(spec)\n elif hasattr(spec.loader,'exec_module'):\n raise ImportError('loaders that define exec_module() '\n 'must also define create_module()')\n if module is None :\n module=_new_module(spec.name)\n _init_module_attrs(spec,module)\n return module\n \n \ndef _module_repr_from_spec(spec):\n ''\n \n name='?'if spec.name is None else spec.name\n if spec.origin is None :\n if spec.loader is None :\n return ''.format(name)\n else :\n return ''.format(name,spec.loader)\n else :\n if spec.has_location:\n return ''.format(name,spec.origin)\n else :\n return ''.format(spec.name,spec.origin)\n \n \n \ndef _exec(spec,module):\n ''\n name=spec.name\n with _ModuleLockManager(name):\n if sys.modules.get(name)is not module:\n msg='module {!r} not in sys.modules'.format(name)\n raise ImportError(msg,name=name)\n if spec.loader is None :\n if spec.submodule_search_locations is None :\n raise ImportError('missing loader',name=spec.name)\n \n _init_module_attrs(spec,module,override=True )\n return module\n _init_module_attrs(spec,module,override=True )\n if not hasattr(spec.loader,'exec_module'):\n \n \n \n spec.loader.load_module(name)\n else :\n spec.loader.exec_module(module)\n return sys.modules[name]\n \n \ndef _load_backward_compatible(spec):\n\n\n\n spec.loader.load_module(spec.name)\n \n module=sys.modules[spec.name]\n if getattr(module,'__loader__',None )is None :\n try :\n module.__loader__=spec.loader\n except AttributeError:\n pass\n if getattr(module,'__package__',None )is None :\n try :\n \n \n \n module.__package__=module.__name__\n if not hasattr(module,'__path__'):\n module.__package__=spec.name.rpartition('.')[0]\n except AttributeError:\n pass\n if getattr(module,'__spec__',None )is None :\n try :\n module.__spec__=spec\n except AttributeError:\n pass\n return module\n \ndef _load_unlocked(spec):\n\n if spec.loader is not None :\n \n if not hasattr(spec.loader,'exec_module'):\n return _load_backward_compatible(spec)\n \n module=module_from_spec(spec)\n with _installed_safely(module):\n if spec.loader is None :\n if spec.submodule_search_locations is None :\n raise ImportError('missing loader',name=spec.name)\n \n else :\n spec.loader.exec_module(module)\n \n \n \n \n return sys.modules[spec.name]\n \n \n \ndef _load(spec):\n ''\n\n\n\n\n\n\n \n with _ModuleLockManager(spec.name):\n return _load_unlocked(spec)\n \n \n \n \nclass BuiltinImporter:\n\n ''\n\n\n\n\n \n \n @staticmethod\n def module_repr(module):\n ''\n\n\n\n \n return ''.format(module.__name__)\n \n @classmethod\n def find_spec(cls,fullname,path=None ,target=None ):\n if path is not None :\n return None\n if _imp.is_builtin(fullname):\n return spec_from_loader(fullname,cls,origin='built-in')\n else :\n return None\n \n @classmethod\n def find_module(cls,fullname,path=None ):\n ''\n\n\n\n\n\n \n spec=cls.find_spec(fullname,path)\n return spec.loader if spec is not None else None\n \n @classmethod\n def create_module(self,spec):\n ''\n if spec.name not in sys.builtin_module_names:\n raise ImportError('{!r} is not a built-in module'.format(spec.name),\n name=spec.name)\n return _call_with_frames_removed(_imp.create_builtin,spec)\n \n @classmethod\n def exec_module(self,module):\n ''\n _call_with_frames_removed(_imp.exec_builtin,module)\n \n @classmethod\n @_requires_builtin\n def get_code(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_builtin\n def get_source(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_builtin\n def is_package(cls,fullname):\n ''\n return False\n \n load_module=classmethod(_load_module_shim)\n \n \nclass FrozenImporter:\n\n ''\n\n\n\n\n \n \n @staticmethod\n def module_repr(m):\n ''\n\n\n\n \n return ''.format(m.__name__)\n \n @classmethod\n def find_spec(cls,fullname,path=None ,target=None ):\n if _imp.is_frozen(fullname):\n return spec_from_loader(fullname,cls,origin='frozen')\n else :\n return None\n \n @classmethod\n def find_module(cls,fullname,path=None ):\n ''\n\n\n\n \n return cls if _imp.is_frozen(fullname)else None\n \n @classmethod\n def create_module(cls,spec):\n ''\n \n @staticmethod\n def exec_module(module):\n name=module.__spec__.name\n if not _imp.is_frozen(name):\n raise ImportError('{!r} is not a frozen module'.format(name),\n name=name)\n code=_call_with_frames_removed(_imp.get_frozen_object,name)\n exec(code,module.__dict__)\n \n @classmethod\n def load_module(cls,fullname):\n ''\n\n\n\n \n return _load_module_shim(cls,fullname)\n \n @classmethod\n @_requires_frozen\n def get_code(cls,fullname):\n ''\n return _imp.get_frozen_object(fullname)\n \n @classmethod\n @_requires_frozen\n def get_source(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_frozen\n def is_package(cls,fullname):\n ''\n return _imp.is_frozen_package(fullname)\n \n \n \n \nclass _ImportLockContext:\n\n ''\n \n def __enter__(self):\n ''\n _imp.acquire_lock()\n \n def __exit__(self,exc_type,exc_value,exc_traceback):\n ''\n _imp.release_lock()\n \n \ndef _resolve_name(name,package,level):\n ''\n bits=package.rsplit('.',level -1)\n if len(bits)= 0')\n if level >0:\n if not isinstance(package,str):\n raise TypeError('__package__ not set to a string')\n elif not package:\n raise ImportError('attempted relative import with no known parent '\n 'package')\n if not name and level ==0:\n raise ValueError('Empty module name')\n \n \n_ERR_MSG_PREFIX='No module named '\n_ERR_MSG=_ERR_MSG_PREFIX+'{!r}'\n\ndef _find_and_load_unlocked(name,import_):\n path=None\n parent=name.rpartition('.')[0]\n if parent:\n if parent not in sys.modules:\n _call_with_frames_removed(import_,parent)\n \n if name in sys.modules:\n return sys.modules[name]\n parent_module=sys.modules[parent]\n try :\n path=parent_module.__path__\n except AttributeError:\n msg=(_ERR_MSG+'; {!r} is not a package').format(name,parent)\n raise ModuleNotFoundError(msg,name=name)from None\n spec=_find_spec(name,path)\n if spec is None :\n raise ModuleNotFoundError(_ERR_MSG.format(name),name=name)\n else :\n module=_load_unlocked(spec)\n if parent:\n \n parent_module=sys.modules[parent]\n setattr(parent_module,name.rpartition('.')[2],module)\n return module\n \n \n_NEEDS_LOADING=object()\n\n\ndef _find_and_load(name,import_):\n ''\n with _ModuleLockManager(name):\n module=sys.modules.get(name,_NEEDS_LOADING)\n if module is _NEEDS_LOADING:\n return _find_and_load_unlocked(name,import_)\n \n if module is None :\n message=('import of {} halted; '\n 'None in sys.modules'.format(name))\n raise ModuleNotFoundError(message,name=name)\n \n _lock_unlock_module(name)\n return module\n \n \ndef _gcd_import(name,package=None ,level=0):\n ''\n\n\n\n\n\n\n \n _sanity_check(name,package,level)\n if level >0:\n name=_resolve_name(name,package,level)\n return _find_and_load(name,_gcd_import)\n \n \ndef _handle_fromlist(module,fromlist,import_,*,recursive=False ):\n ''\n\n\n\n\n\n \n \n \n if hasattr(module,'__path__'):\n for x in fromlist:\n if not isinstance(x,str):\n if recursive:\n where=module.__name__+'.__all__'\n else :\n where=\"``from list''\"\n raise TypeError(f\"Item in {where} must be str, \"\n f\"not {type(x).__name__}\")\n elif x =='*':\n if not recursive and hasattr(module,'__all__'):\n _handle_fromlist(module,module.__all__,import_,\n recursive=True )\n elif not hasattr(module,x):\n from_name='{}.{}'.format(module.__name__,x)\n try :\n _call_with_frames_removed(import_,from_name)\n except ModuleNotFoundError as exc:\n \n \n \n if (exc.name ==from_name and\n sys.modules.get(from_name,_NEEDS_LOADING)is not None ):\n continue\n raise\n return module\n \n \ndef _calc___package__(globals):\n ''\n\n\n\n\n \n package=globals.get('__package__')\n spec=globals.get('__spec__')\n if package is not None :\n if spec is not None and package !=spec.parent:\n _warnings.warn(\"__package__ != __spec__.parent \"\n f\"({package!r} != {spec.parent!r})\",\n ImportWarning,stacklevel=3)\n return package\n elif spec is not None :\n return spec.parent\n else :\n _warnings.warn(\"can't resolve package from __spec__ or __package__, \"\n \"falling back on __name__ and __path__\",\n ImportWarning,stacklevel=3)\n package=globals['__name__']\n if '__path__'not in globals:\n package=package.rpartition('.')[0]\n return package\n \n \ndef __import__(name,globals=None ,locals=None ,fromlist=(),level=0):\n ''\n\n\n\n\n\n\n\n\n \n if level ==0:\n module=_gcd_import(name)\n else :\n globals_=globals if globals is not None else {}\n package=_calc___package__(globals_)\n module=_gcd_import(name,package,level)\n if not fromlist:\n \n \n if level ==0:\n return _gcd_import(name.partition('.')[0])\n elif not name:\n return module\n else :\n \n \n cut_off=len(name)-len(name.partition('.')[0])\n \n \n return sys.modules[module.__name__[:len(module.__name__)-cut_off]]\n else :\n return _handle_fromlist(module,fromlist,_gcd_import)\n \n \ndef _builtin_from_name(name):\n spec=BuiltinImporter.find_spec(name)\n if spec is None :\n raise ImportError('no built-in module named '+name)\n return _load_unlocked(spec)\n \n \ndef _setup(sys_module,_imp_module):\n ''\n\n\n\n\n\n \n global _imp,sys\n _imp=_imp_module\n sys=sys_module\n \n \n module_type=type(sys)\n for name,module in sys.modules.items():\n if isinstance(module,module_type):\n if name in sys.builtin_module_names:\n loader=BuiltinImporter\n elif _imp.is_frozen(name):\n loader=FrozenImporter\n else :\n continue\n spec=_spec_from_module(module,loader)\n _init_module_attrs(spec,module)\n \n \n self_module=sys.modules[__name__]\n \n \n for builtin_name in ('_warnings',):\n if builtin_name not in sys.modules:\n builtin_module=_builtin_from_name(builtin_name)\n else :\n builtin_module=sys.modules[builtin_name]\n setattr(self_module,builtin_name,builtin_module)\n \n \ndef _install(sys_module,_imp_module):\n ''\n _setup(sys_module,_imp_module)\n \n sys.meta_path.append(BuiltinImporter)\n sys.meta_path.append(FrozenImporter)\n \n \ndef _install_external_importers():\n ''\n global _bootstrap_external\n import _frozen_importlib_external\n _bootstrap_external=_frozen_importlib_external\n _frozen_importlib_external._install(sys.modules[__name__])\n", ["_frozen_importlib_external", "_weakref"]], "importlib._bootstrap_external": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n_bootstrap=None\n\n\nimport _imp\nimport _io\nimport sys\nimport _warnings\nimport marshal\n\n\n_MS_WINDOWS=(sys.platform =='win32')\nif _MS_WINDOWS:\n import nt as _os\n import winreg\nelse:\n import posix as _os\n \n \nif _MS_WINDOWS:\n path_separators=['\\\\','/']\nelse:\n path_separators=['/']\n \nassert all(len(sep)==1 for sep in path_separators)\npath_sep=path_separators[0]\npath_sep_tuple=tuple(path_separators)\npath_separators=''.join(path_separators)\n_pathseps_with_colon={f':{s}'for s in path_separators}\n\n\n\n_CASE_INSENSITIVE_PLATFORMS_STR_KEY='win',\n_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY='cygwin','darwin'\n_CASE_INSENSITIVE_PLATFORMS=(_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY\n+_CASE_INSENSITIVE_PLATFORMS_STR_KEY)\n\n\ndef _make_relax_case():\n if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS):\n if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS_STR_KEY):\n key='PYTHONCASEOK'\n else:\n key=b'PYTHONCASEOK'\n \n def _relax_case():\n ''\n return not sys.flags.ignore_environment and key in _os.environ\n else:\n def _relax_case():\n ''\n return False\n return _relax_case\n \n_relax_case=_make_relax_case()\n\n\ndef _pack_uint32(x):\n ''\n return(int(x)&0xFFFFFFFF).to_bytes(4,'little')\n \n \ndef _unpack_uint32(data):\n ''\n assert len(data)==4\n return int.from_bytes(data,'little')\n \ndef _unpack_uint16(data):\n ''\n assert len(data)==2\n return int.from_bytes(data,'little')\n \n \nif _MS_WINDOWS:\n def _path_join(*path_parts):\n ''\n if not path_parts:\n return \"\"\n if len(path_parts)==1:\n return path_parts[0]\n root=\"\"\n path=[]\n for new_root,tail in map(_os._path_splitroot,path_parts):\n if new_root.startswith(path_sep_tuple)or new_root.endswith(path_sep_tuple):\n root=new_root.rstrip(path_separators)or root\n path=[path_sep+tail]\n elif new_root.endswith(':'):\n if root.casefold()!=new_root.casefold():\n \n \n root=new_root\n path=[tail]\n else:\n path.append(tail)\n else:\n root=new_root or root\n path.append(tail)\n path=[p.rstrip(path_separators)for p in path if p]\n if len(path)==1 and not path[0]:\n \n return root+path_sep\n return root+path_sep.join(path)\n \nelse:\n def _path_join(*path_parts):\n ''\n return path_sep.join([part.rstrip(path_separators)\n for part in path_parts if part])\n \n \ndef _path_split(path):\n ''\n i=max(path.rfind(p)for p in path_separators)\n if i <0:\n return '',path\n return path[:i],path[i+1:]\n \n \ndef _path_stat(path):\n ''\n\n\n\n\n \n return _os.stat(path)\n \n \ndef _path_is_mode_type(path,mode):\n ''\n try:\n stat_info=_path_stat(path)\n except OSError:\n return False\n return(stat_info.st_mode&0o170000)==mode\n \n \ndef _path_isfile(path):\n ''\n return _path_is_mode_type(path,0o100000)\n \n \ndef _path_isdir(path):\n ''\n if not path:\n path=_os.getcwd()\n return _path_is_mode_type(path,0o040000)\n \n \nif _MS_WINDOWS:\n def _path_isabs(path):\n ''\n if not path:\n return False\n root=_os._path_splitroot(path)[0].replace('/','\\\\')\n return len(root)>1 and(root.startswith('\\\\\\\\')or root.endswith('\\\\'))\n \nelse:\n def _path_isabs(path):\n ''\n return path.startswith(path_separators)\n \n \ndef _path_abspath(path):\n ''\n if not _path_isabs(path):\n for sep in path_separators:\n path=path.removeprefix(f\".{sep}\")\n return _path_join(_os.getcwd(),path)\n else:\n return path\n \n \ndef _write_atomic(path,data,mode=0o666):\n ''\n\n \n \n path_tmp=f'{path}.{id(path)}'\n fd=_os.open(path_tmp,\n _os.O_EXCL |_os.O_CREAT |_os.O_WRONLY,mode&0o666)\n try:\n \n \n with _io.FileIO(fd,'wb')as file:\n file.write(data)\n _os.replace(path_tmp,path)\n except OSError:\n try:\n _os.unlink(path_tmp)\n except OSError:\n pass\n raise\n \n \n_code_type=type(_write_atomic.__code__)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nMAGIC_NUMBER=(3531).to_bytes(2,'little')+b'\\r\\n'\n\n_RAW_MAGIC_NUMBER=int.from_bytes(MAGIC_NUMBER,'little')\n\n_PYCACHE='__pycache__'\n_OPT='opt-'\n\nSOURCE_SUFFIXES=['.py']\nif _MS_WINDOWS:\n SOURCE_SUFFIXES.append('.pyw')\n \nEXTENSION_SUFFIXES=_imp.extension_suffixes()\n\nBYTECODE_SUFFIXES=['.pyc']\n\nDEBUG_BYTECODE_SUFFIXES=OPTIMIZED_BYTECODE_SUFFIXES=BYTECODE_SUFFIXES\n\ndef cache_from_source(path,debug_override=None,*,optimization=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if debug_override is not None:\n _warnings.warn('the debug_override parameter is deprecated; use '\n \"'optimization' instead\",DeprecationWarning)\n if optimization is not None:\n message='debug_override or optimization must be set to None'\n raise TypeError(message)\n optimization=''if debug_override else 1\n path=_os.fspath(path)\n head,tail=_path_split(path)\n base,sep,rest=tail.rpartition('.')\n tag=sys.implementation.cache_tag\n if tag is None:\n raise NotImplementedError('sys.implementation.cache_tag is None')\n almost_filename=''.join([(base if base else rest),sep,tag])\n if optimization is None:\n if sys.flags.optimize ==0:\n optimization=''\n else:\n optimization=sys.flags.optimize\n optimization=str(optimization)\n if optimization !='':\n if not optimization.isalnum():\n raise ValueError(f'{optimization !r} is not alphanumeric')\n almost_filename=f'{almost_filename}.{_OPT}{optimization}'\n filename=almost_filename+BYTECODE_SUFFIXES[0]\n if sys.pycache_prefix is not None:\n \n \n \n \n \n \n \n \n head=_path_abspath(head)\n \n \n \n \n if head[1]==':'and head[0]not in path_separators:\n head=head[2:]\n \n \n \n return _path_join(\n sys.pycache_prefix,\n head.lstrip(path_separators),\n filename,\n )\n return _path_join(head,_PYCACHE,filename)\n \n \ndef source_from_cache(path):\n ''\n\n\n\n\n\n\n \n if sys.implementation.cache_tag is None:\n raise NotImplementedError('sys.implementation.cache_tag is None')\n path=_os.fspath(path)\n head,pycache_filename=_path_split(path)\n found_in_pycache_prefix=False\n if sys.pycache_prefix is not None:\n stripped_path=sys.pycache_prefix.rstrip(path_separators)\n if head.startswith(stripped_path+path_sep):\n head=head[len(stripped_path):]\n found_in_pycache_prefix=True\n if not found_in_pycache_prefix:\n head,pycache=_path_split(head)\n if pycache !=_PYCACHE:\n raise ValueError(f'{_PYCACHE} not bottom-level directory in '\n f'{path !r}')\n dot_count=pycache_filename.count('.')\n if dot_count not in{2,3}:\n raise ValueError(f'expected only 2 or 3 dots in {pycache_filename !r}')\n elif dot_count ==3:\n optimization=pycache_filename.rsplit('.',2)[-2]\n if not optimization.startswith(_OPT):\n raise ValueError(\"optimization portion of filename does not start \"\n f\"with {_OPT !r}\")\n opt_level=optimization[len(_OPT):]\n if not opt_level.isalnum():\n raise ValueError(f\"optimization level {optimization !r} is not an \"\n \"alphanumeric value\")\n base_filename=pycache_filename.partition('.')[0]\n return _path_join(head,base_filename+SOURCE_SUFFIXES[0])\n \n \ndef _get_sourcefile(bytecode_path):\n ''\n\n\n\n\n \n if len(bytecode_path)==0:\n return None\n rest,_,extension=bytecode_path.rpartition('.')\n if not rest or extension.lower()[-3:-1]!='py':\n return bytecode_path\n try:\n source_path=source_from_cache(bytecode_path)\n except(NotImplementedError,ValueError):\n source_path=bytecode_path[:-1]\n return source_path if _path_isfile(source_path)else bytecode_path\n \n \ndef _get_cached(filename):\n if filename.endswith(tuple(SOURCE_SUFFIXES)):\n try:\n return cache_from_source(filename)\n except NotImplementedError:\n pass\n elif filename.endswith(tuple(BYTECODE_SUFFIXES)):\n return filename\n else:\n return None\n \n \ndef _calc_mode(path):\n ''\n try:\n mode=_path_stat(path).st_mode\n except OSError:\n mode=0o666\n \n \n mode |=0o200\n return mode\n \n \ndef _check_name(method):\n ''\n\n\n\n\n\n \n def _check_name_wrapper(self,name=None,*args,**kwargs):\n if name is None:\n name=self.name\n elif self.name !=name:\n raise ImportError('loader for %s cannot handle %s'%\n (self.name,name),name=name)\n return method(self,name,*args,**kwargs)\n \n \n \n if _bootstrap is not None:\n _wrap=_bootstrap._wrap\n else:\n def _wrap(new,old):\n for replace in['__module__','__name__','__qualname__','__doc__']:\n if hasattr(old,replace):\n setattr(new,replace,getattr(old,replace))\n new.__dict__.update(old.__dict__)\n \n _wrap(_check_name_wrapper,method)\n return _check_name_wrapper\n \n \ndef _classify_pyc(data,name,exc_details):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n magic=data[:4]\n if magic !=MAGIC_NUMBER:\n message=f'bad magic number in {name !r}: {magic !r}'\n _bootstrap._verbose_message('{}',message)\n raise ImportError(message,**exc_details)\n if len(data)<16:\n message=f'reached EOF while reading pyc header of {name !r}'\n _bootstrap._verbose_message('{}',message)\n raise EOFError(message)\n flags=_unpack_uint32(data[4:8])\n \n if flags&~0b11:\n message=f'invalid flags {flags !r} in {name !r}'\n raise ImportError(message,**exc_details)\n return flags\n \n \ndef _validate_timestamp_pyc(data,source_mtime,source_size,name,\nexc_details):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if _unpack_uint32(data[8:12])!=(source_mtime&0xFFFFFFFF):\n message=f'bytecode is stale for {name !r}'\n _bootstrap._verbose_message('{}',message)\n raise ImportError(message,**exc_details)\n if(source_size is not None and\n _unpack_uint32(data[12:16])!=(source_size&0xFFFFFFFF)):\n raise ImportError(f'bytecode is stale for {name !r}',**exc_details)\n \n \ndef _validate_hash_pyc(data,source_hash,name,exc_details):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if data[8:16]!=source_hash:\n raise ImportError(\n f'hash in bytecode doesn\\'t match hash of source {name !r}',\n **exc_details,\n )\n \n \ndef _compile_bytecode(data,name=None,bytecode_path=None,source_path=None):\n ''\n code=marshal.loads(data)\n if isinstance(code,_code_type):\n _bootstrap._verbose_message('code object from {!r}',bytecode_path)\n if source_path is not None:\n _imp._fix_co_filename(code,source_path)\n return code\n else:\n raise ImportError(f'Non-code object in {bytecode_path !r}',\n name=name,path=bytecode_path)\n \n \ndef _code_to_timestamp_pyc(code,mtime=0,source_size=0):\n ''\n data=bytearray(MAGIC_NUMBER)\n data.extend(_pack_uint32(0))\n data.extend(_pack_uint32(mtime))\n data.extend(_pack_uint32(source_size))\n data.extend(marshal.dumps(code))\n return data\n \n \ndef _code_to_hash_pyc(code,source_hash,checked=True):\n ''\n data=bytearray(MAGIC_NUMBER)\n flags=0b1 |checked <<1\n data.extend(_pack_uint32(flags))\n assert len(source_hash)==8\n data.extend(source_hash)\n data.extend(marshal.dumps(code))\n return data\n \n \ndef decode_source(source_bytes):\n ''\n\n\n \n import tokenize\n source_bytes_readline=_io.BytesIO(source_bytes).readline\n encoding=tokenize.detect_encoding(source_bytes_readline)\n newline_decoder=_io.IncrementalNewlineDecoder(None,True)\n return newline_decoder.decode(source_bytes.decode(encoding[0]))\n \n \n \n \n_POPULATE=object()\n\n\ndef spec_from_file_location(name,location=None,*,loader=None,\nsubmodule_search_locations=_POPULATE):\n ''\n\n\n\n\n\n\n\n\n \n if location is None:\n \n \n \n location=''\n if hasattr(loader,'get_filename'):\n \n try:\n location=loader.get_filename(name)\n except ImportError:\n pass\n else:\n location=_os.fspath(location)\n try:\n location=_path_abspath(location)\n except OSError:\n pass\n \n \n \n \n \n \n \n spec=_bootstrap.ModuleSpec(name,loader,origin=location)\n spec._set_fileattr=True\n \n \n if loader is None:\n for loader_class,suffixes in _get_supported_file_loaders():\n if location.endswith(tuple(suffixes)):\n loader=loader_class(name,location)\n spec.loader=loader\n break\n else:\n return None\n \n \n if submodule_search_locations is _POPULATE:\n \n if hasattr(loader,'is_package'):\n try:\n is_package=loader.is_package(name)\n except ImportError:\n pass\n else:\n if is_package:\n spec.submodule_search_locations=[]\n else:\n spec.submodule_search_locations=submodule_search_locations\n if spec.submodule_search_locations ==[]:\n if location:\n dirname=_path_split(location)[0]\n spec.submodule_search_locations.append(dirname)\n \n return spec\n \n \ndef _bless_my_loader(module_globals):\n ''\n\n\n \n \n \n \n \n \n \n \n if not isinstance(module_globals,dict):\n return None\n \n missing=object()\n loader=module_globals.get('__loader__',None)\n spec=module_globals.get('__spec__',missing)\n \n if loader is None:\n if spec is missing:\n \n \n return None\n elif spec is None:\n raise ValueError('Module globals is missing a __spec__.loader')\n \n spec_loader=getattr(spec,'loader',missing)\n \n if spec_loader in(missing,None):\n if loader is None:\n exc=AttributeError if spec_loader is missing else ValueError\n raise exc('Module globals is missing a __spec__.loader')\n _warnings.warn(\n 'Module globals is missing a __spec__.loader',\n DeprecationWarning)\n spec_loader=loader\n \n assert spec_loader is not None\n if loader is not None and loader !=spec_loader:\n _warnings.warn(\n 'Module globals; __loader__ != __spec__.loader',\n DeprecationWarning)\n return loader\n \n return spec_loader\n \n \n \n \nclass WindowsRegistryFinder:\n\n ''\n \n REGISTRY_KEY=(\n 'Software\\\\Python\\\\PythonCore\\\\{sys_version}'\n '\\\\Modules\\\\{fullname}')\n REGISTRY_KEY_DEBUG=(\n 'Software\\\\Python\\\\PythonCore\\\\{sys_version}'\n '\\\\Modules\\\\{fullname}\\\\Debug')\n DEBUG_BUILD=(_MS_WINDOWS and '_d.pyd'in EXTENSION_SUFFIXES)\n \n @staticmethod\n def _open_registry(key):\n try:\n return winreg.OpenKey(winreg.HKEY_CURRENT_USER,key)\n except OSError:\n return winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,key)\n \n @classmethod\n def _search_registry(cls,fullname):\n if cls.DEBUG_BUILD:\n registry_key=cls.REGISTRY_KEY_DEBUG\n else:\n registry_key=cls.REGISTRY_KEY\n key=registry_key.format(fullname=fullname,\n sys_version='%d.%d'%sys.version_info[:2])\n try:\n with cls._open_registry(key)as hkey:\n filepath=winreg.QueryValue(hkey,'')\n except OSError:\n return None\n return filepath\n \n @classmethod\n def find_spec(cls,fullname,path=None,target=None):\n filepath=cls._search_registry(fullname)\n if filepath is None:\n return None\n try:\n _path_stat(filepath)\n except OSError:\n return None\n for loader,suffixes in _get_supported_file_loaders():\n if filepath.endswith(tuple(suffixes)):\n spec=_bootstrap.spec_from_loader(fullname,\n loader(fullname,filepath),\n origin=filepath)\n return spec\n \n \nclass _LoaderBasics:\n\n ''\n \n \n def is_package(self,fullname):\n ''\n \n filename=_path_split(self.get_filename(fullname))[1]\n filename_base=filename.rsplit('.',1)[0]\n tail_name=fullname.rpartition('.')[2]\n return filename_base =='__init__'and tail_name !='__init__'\n \n def create_module(self,spec):\n ''\n \n def exec_module(self,module):\n ''\n code=self.get_code(module.__name__)\n if code is None:\n raise ImportError(f'cannot load module {module.__name__ !r} when '\n 'get_code() returns None')\n _bootstrap._call_with_frames_removed(exec,code,module.__dict__)\n \n def load_module(self,fullname):\n ''\n \n return _bootstrap._load_module_shim(self,fullname)\n \n \nclass SourceLoader(_LoaderBasics):\n\n def path_mtime(self,path):\n ''\n\n\n\n \n raise OSError\n \n def path_stats(self,path):\n ''\n\n\n\n\n\n\n\n\n\n \n return{'mtime':self.path_mtime(path)}\n \n def _cache_bytecode(self,source_path,cache_path,data):\n ''\n\n\n\n\n \n \n return self.set_data(cache_path,data)\n \n def set_data(self,path,data):\n ''\n\n\n \n \n \n def get_source(self,fullname):\n ''\n path=self.get_filename(fullname)\n try:\n source_bytes=self.get_data(path)\n except OSError as exc:\n raise ImportError('source not available through get_data()',\n name=fullname)from exc\n return decode_source(source_bytes)\n \n def source_to_code(self,data,path,*,_optimize=-1):\n ''\n\n\n \n return _bootstrap._call_with_frames_removed(compile,data,path,'exec',\n dont_inherit=True,optimize=_optimize)\n \n def get_code(self,fullname):\n ''\n\n\n\n\n \n source_path=self.get_filename(fullname)\n source_mtime=None\n source_bytes=None\n source_hash=None\n hash_based=False\n check_source=True\n try:\n bytecode_path=cache_from_source(source_path)\n except NotImplementedError:\n bytecode_path=None\n else:\n try:\n st=self.path_stats(source_path)\n except OSError:\n pass\n else:\n source_mtime=int(st['mtime'])\n try:\n data=self.get_data(bytecode_path)\n except OSError:\n pass\n else:\n exc_details={\n 'name':fullname,\n 'path':bytecode_path,\n }\n try:\n flags=_classify_pyc(data,fullname,exc_details)\n bytes_data=memoryview(data)[16:]\n hash_based=flags&0b1 !=0\n if hash_based:\n check_source=flags&0b10 !=0\n if(_imp.check_hash_based_pycs !='never'and\n (check_source or\n _imp.check_hash_based_pycs =='always')):\n source_bytes=self.get_data(source_path)\n source_hash=_imp.source_hash(\n _RAW_MAGIC_NUMBER,\n source_bytes,\n )\n _validate_hash_pyc(data,source_hash,fullname,\n exc_details)\n else:\n _validate_timestamp_pyc(\n data,\n source_mtime,\n st['size'],\n fullname,\n exc_details,\n )\n except(ImportError,EOFError):\n pass\n else:\n _bootstrap._verbose_message('{} matches {}',bytecode_path,\n source_path)\n return _compile_bytecode(bytes_data,name=fullname,\n bytecode_path=bytecode_path,\n source_path=source_path)\n if source_bytes is None:\n source_bytes=self.get_data(source_path)\n code_object=self.source_to_code(source_bytes,source_path)\n _bootstrap._verbose_message('code object from {}',source_path)\n if(not sys.dont_write_bytecode and bytecode_path is not None and\n source_mtime is not None):\n if hash_based:\n if source_hash is None:\n source_hash=_imp.source_hash(_RAW_MAGIC_NUMBER,\n source_bytes)\n data=_code_to_hash_pyc(code_object,source_hash,check_source)\n else:\n data=_code_to_timestamp_pyc(code_object,source_mtime,\n len(source_bytes))\n try:\n self._cache_bytecode(source_path,bytecode_path,data)\n except NotImplementedError:\n pass\n return code_object\n \n \nclass FileLoader:\n\n ''\n \n \n def __init__(self,fullname,path):\n ''\n \n self.name=fullname\n self.path=path\n \n def __eq__(self,other):\n return(self.__class__ ==other.__class__ and\n self.__dict__ ==other.__dict__)\n \n def __hash__(self):\n return hash(self.name)^hash(self.path)\n \n @_check_name\n def load_module(self,fullname):\n ''\n\n\n\n \n \n \n \n return super(FileLoader,self).load_module(fullname)\n \n @_check_name\n def get_filename(self,fullname):\n ''\n return self.path\n \n def get_data(self,path):\n ''\n if isinstance(self,(SourceLoader,ExtensionFileLoader)):\n with _io.open_code(str(path))as file:\n return file.read()\n else:\n with _io.FileIO(path,'r')as file:\n return file.read()\n \n @_check_name\n def get_resource_reader(self,module):\n from importlib.readers import FileReader\n return FileReader(self)\n \n \nclass SourceFileLoader(FileLoader,SourceLoader):\n\n ''\n \n def path_stats(self,path):\n ''\n st=_path_stat(path)\n return{'mtime':st.st_mtime,'size':st.st_size}\n \n def _cache_bytecode(self,source_path,bytecode_path,data):\n \n mode=_calc_mode(source_path)\n return self.set_data(bytecode_path,data,_mode=mode)\n \n def set_data(self,path,data,*,_mode=0o666):\n ''\n parent,filename=_path_split(path)\n path_parts=[]\n \n while parent and not _path_isdir(parent):\n parent,part=_path_split(parent)\n path_parts.append(part)\n \n for part in reversed(path_parts):\n parent=_path_join(parent,part)\n try:\n _os.mkdir(parent)\n except FileExistsError:\n \n continue\n except OSError as exc:\n \n \n _bootstrap._verbose_message('could not create {!r}: {!r}',\n parent,exc)\n return\n try:\n _write_atomic(path,data,_mode)\n _bootstrap._verbose_message('created {!r}',path)\n except OSError as exc:\n \n _bootstrap._verbose_message('could not create {!r}: {!r}',path,\n exc)\n \n \nclass SourcelessFileLoader(FileLoader,_LoaderBasics):\n\n ''\n \n def get_code(self,fullname):\n path=self.get_filename(fullname)\n data=self.get_data(path)\n \n \n exc_details={\n 'name':fullname,\n 'path':path,\n }\n _classify_pyc(data,fullname,exc_details)\n return _compile_bytecode(\n memoryview(data)[16:],\n name=fullname,\n bytecode_path=path,\n )\n \n def get_source(self,fullname):\n ''\n return None\n \n \nclass ExtensionFileLoader(FileLoader,_LoaderBasics):\n\n ''\n\n\n\n \n \n def __init__(self,name,path):\n self.name=name\n self.path=path\n \n def __eq__(self,other):\n return(self.__class__ ==other.__class__ and\n self.__dict__ ==other.__dict__)\n \n def __hash__(self):\n return hash(self.name)^hash(self.path)\n \n def create_module(self,spec):\n ''\n module=_bootstrap._call_with_frames_removed(\n _imp.create_dynamic,spec)\n _bootstrap._verbose_message('extension module {!r} loaded from {!r}',\n spec.name,self.path)\n return module\n \n def exec_module(self,module):\n ''\n _bootstrap._call_with_frames_removed(_imp.exec_dynamic,module)\n _bootstrap._verbose_message('extension module {!r} executed from {!r}',\n self.name,self.path)\n \n def is_package(self,fullname):\n ''\n file_name=_path_split(self.path)[1]\n return any(file_name =='__init__'+suffix\n for suffix in EXTENSION_SUFFIXES)\n \n def get_code(self,fullname):\n ''\n return None\n \n def get_source(self,fullname):\n ''\n return None\n \n @_check_name\n def get_filename(self,fullname):\n ''\n return self.path\n \n \nclass _NamespacePath:\n ''\n\n\n\n \n \n \n \n _epoch=0\n \n def __init__(self,name,path,path_finder):\n self._name=name\n self._path=path\n self._last_parent_path=tuple(self._get_parent_path())\n self._last_epoch=self._epoch\n self._path_finder=path_finder\n \n def _find_parent_path_names(self):\n ''\n parent,dot,me=self._name.rpartition('.')\n if dot =='':\n \n return 'sys','path'\n \n \n return parent,'__path__'\n \n def _get_parent_path(self):\n parent_module_name,path_attr_name=self._find_parent_path_names()\n return getattr(sys.modules[parent_module_name],path_attr_name)\n \n def _recalculate(self):\n \n parent_path=tuple(self._get_parent_path())\n if parent_path !=self._last_parent_path or self._epoch !=self._last_epoch:\n spec=self._path_finder(self._name,parent_path)\n \n \n if spec is not None and spec.loader is None:\n if spec.submodule_search_locations:\n self._path=spec.submodule_search_locations\n self._last_parent_path=parent_path\n self._last_epoch=self._epoch\n return self._path\n \n def __iter__(self):\n return iter(self._recalculate())\n \n def __getitem__(self,index):\n return self._recalculate()[index]\n \n def __setitem__(self,index,path):\n self._path[index]=path\n \n def __len__(self):\n return len(self._recalculate())\n \n def __repr__(self):\n return f'_NamespacePath({self._path !r})'\n \n def __contains__(self,item):\n return item in self._recalculate()\n \n def append(self,item):\n self._path.append(item)\n \n \n \n \n \nclass NamespaceLoader:\n def __init__(self,name,path,path_finder):\n self._path=_NamespacePath(name,path,path_finder)\n \n def is_package(self,fullname):\n return True\n \n def get_source(self,fullname):\n return ''\n \n def get_code(self,fullname):\n return compile('','','exec',dont_inherit=True)\n \n def create_module(self,spec):\n ''\n \n def exec_module(self,module):\n pass\n \n def load_module(self,fullname):\n ''\n\n\n\n \n \n _bootstrap._verbose_message('namespace module loaded with path {!r}',\n self._path)\n \n return _bootstrap._load_module_shim(self,fullname)\n \n def get_resource_reader(self,module):\n from importlib.readers import NamespaceReader\n return NamespaceReader(self._path)\n \n \n \n_NamespaceLoader=NamespaceLoader\n\n\n\n\nclass PathFinder:\n\n ''\n \n @staticmethod\n def invalidate_caches():\n ''\n \n for name,finder in list(sys.path_importer_cache.items()):\n \n \n if finder is None or not _path_isabs(name):\n del sys.path_importer_cache[name]\n elif hasattr(finder,'invalidate_caches'):\n finder.invalidate_caches()\n \n \n _NamespacePath._epoch +=1\n \n @staticmethod\n def _path_hooks(path):\n ''\n if sys.path_hooks is not None and not sys.path_hooks:\n _warnings.warn('sys.path_hooks is empty',ImportWarning)\n for hook in sys.path_hooks:\n try:\n return hook(path)\n except ImportError:\n continue\n else:\n return None\n \n @classmethod\n def _path_importer_cache(cls,path):\n ''\n\n\n\n\n \n if path =='':\n try:\n path=_os.getcwd()\n except FileNotFoundError:\n \n \n return None\n try:\n finder=sys.path_importer_cache[path]\n except KeyError:\n finder=cls._path_hooks(path)\n sys.path_importer_cache[path]=finder\n return finder\n \n @classmethod\n def _get_spec(cls,fullname,path,target=None):\n ''\n \n \n namespace_path=[]\n for entry in path:\n if not isinstance(entry,str):\n continue\n finder=cls._path_importer_cache(entry)\n if finder is not None:\n spec=finder.find_spec(fullname,target)\n if spec is None:\n continue\n if spec.loader is not None:\n return spec\n portions=spec.submodule_search_locations\n if portions is None:\n raise ImportError('spec missing loader')\n \n \n \n \n namespace_path.extend(portions)\n else:\n spec=_bootstrap.ModuleSpec(fullname,None)\n spec.submodule_search_locations=namespace_path\n return spec\n \n @classmethod\n def find_spec(cls,fullname,path=None,target=None):\n ''\n\n\n \n if path is None:\n path=sys.path\n spec=cls._get_spec(fullname,path,target)\n if spec is None:\n return None\n elif spec.loader is None:\n namespace_path=spec.submodule_search_locations\n if namespace_path:\n \n \n spec.origin=None\n spec.submodule_search_locations=_NamespacePath(fullname,namespace_path,cls._get_spec)\n return spec\n else:\n return None\n else:\n return spec\n \n @staticmethod\n def find_distributions(*args,**kwargs):\n ''\n\n\n\n\n\n\n \n from importlib.metadata import MetadataPathFinder\n return MetadataPathFinder.find_distributions(*args,**kwargs)\n \n \nclass FileFinder:\n\n ''\n\n\n\n\n \n \n def __init__(self,path,*loader_details):\n ''\n\n \n loaders=[]\n for loader,suffixes in loader_details:\n loaders.extend((suffix,loader)for suffix in suffixes)\n self._loaders=loaders\n \n if not path or path =='.':\n self.path=_os.getcwd()\n else:\n self.path=_path_abspath(path)\n self._path_mtime=-1\n self._path_cache=set()\n self._relaxed_path_cache=set()\n \n def invalidate_caches(self):\n ''\n self._path_mtime=-1\n \n def _get_spec(self,loader_class,fullname,path,smsl,target):\n loader=loader_class(fullname,path)\n return spec_from_file_location(fullname,path,loader=loader,\n submodule_search_locations=smsl)\n \n def find_spec(self,fullname,target=None):\n ''\n\n\n \n is_namespace=False\n tail_module=fullname.rpartition('.')[2]\n try:\n mtime=_path_stat(self.path or _os.getcwd()).st_mtime\n except OSError:\n mtime=-1\n if mtime !=self._path_mtime:\n self._fill_cache()\n self._path_mtime=mtime\n \n if _relax_case():\n cache=self._relaxed_path_cache\n cache_module=tail_module.lower()\n else:\n cache=self._path_cache\n cache_module=tail_module\n \n if cache_module in cache:\n base_path=_path_join(self.path,tail_module)\n for suffix,loader_class in self._loaders:\n init_filename='__init__'+suffix\n full_path=_path_join(base_path,init_filename)\n if _path_isfile(full_path):\n return self._get_spec(loader_class,fullname,full_path,[base_path],target)\n else:\n \n \n is_namespace=_path_isdir(base_path)\n \n for suffix,loader_class in self._loaders:\n try:\n full_path=_path_join(self.path,tail_module+suffix)\n except ValueError:\n return None\n _bootstrap._verbose_message('trying {}',full_path,verbosity=2)\n if cache_module+suffix in cache:\n if _path_isfile(full_path):\n return self._get_spec(loader_class,fullname,full_path,\n None,target)\n if is_namespace:\n _bootstrap._verbose_message('possible namespace for {}',base_path)\n spec=_bootstrap.ModuleSpec(fullname,None)\n spec.submodule_search_locations=[base_path]\n return spec\n return None\n \n def _fill_cache(self):\n ''\n path=self.path\n try:\n contents=_os.listdir(path or _os.getcwd())\n except(FileNotFoundError,PermissionError,NotADirectoryError):\n \n \n contents=[]\n \n \n if not sys.platform.startswith('win'):\n self._path_cache=set(contents)\n else:\n \n \n \n \n \n lower_suffix_contents=set()\n for item in contents:\n name,dot,suffix=item.partition('.')\n if dot:\n new_name=f'{name}.{suffix.lower()}'\n else:\n new_name=name\n lower_suffix_contents.add(new_name)\n self._path_cache=lower_suffix_contents\n if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS):\n self._relaxed_path_cache={fn.lower()for fn in contents}\n \n @classmethod\n def path_hook(cls,*loader_details):\n ''\n\n\n\n\n\n\n \n def path_hook_for_FileFinder(path):\n ''\n if not _path_isdir(path):\n raise ImportError('only directories are supported',path=path)\n return cls(path,*loader_details)\n \n return path_hook_for_FileFinder\n \n def __repr__(self):\n return f'FileFinder({self.path !r})'\n \n \n \n \ndef _fix_up_module(ns,name,pathname,cpathname=None):\n\n loader=ns.get('__loader__')\n spec=ns.get('__spec__')\n if not loader:\n if spec:\n loader=spec.loader\n elif pathname ==cpathname:\n loader=SourcelessFileLoader(name,pathname)\n else:\n loader=SourceFileLoader(name,pathname)\n if not spec:\n spec=spec_from_file_location(name,pathname,loader=loader)\n if cpathname:\n spec.cached=_path_abspath(cpathname)\n try:\n ns['__spec__']=spec\n ns['__loader__']=loader\n ns['__file__']=pathname\n ns['__cached__']=cpathname\n except Exception:\n \n pass\n \n \ndef _get_supported_file_loaders():\n ''\n\n\n \n extensions=ExtensionFileLoader,_imp.extension_suffixes()\n source=SourceFileLoader,SOURCE_SUFFIXES\n bytecode=SourcelessFileLoader,BYTECODE_SUFFIXES\n return[extensions,source,bytecode]\n \n \ndef _set_bootstrap_module(_bootstrap_module):\n global _bootstrap\n _bootstrap=_bootstrap_module\n \n \ndef _install(_bootstrap_module):\n ''\n _set_bootstrap_module(_bootstrap_module)\n supported_loaders=_get_supported_file_loaders()\n sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)])\n sys.meta_path.append(PathFinder)\n", ["_imp", "_io", "_warnings", "importlib.metadata", "importlib.readers", "marshal", "nt", "posix", "sys", "tokenize", "winreg"]], "importlib": [".py", "''\n__all__=['__import__','import_module','invalidate_caches','reload']\n\n\n\n\n\n\n\n\n\nimport _imp\nimport sys\n\ntry:\n import _frozen_importlib as _bootstrap\nexcept ImportError:\n from. import _bootstrap\n _bootstrap._setup(sys,_imp)\nelse:\n\n\n _bootstrap.__name__='importlib._bootstrap'\n _bootstrap.__package__='importlib'\n try:\n _bootstrap.__file__=__file__.replace('__init__.py','_bootstrap.py')\n except NameError:\n \n \n pass\n sys.modules['importlib._bootstrap']=_bootstrap\n \ntry:\n import _frozen_importlib_external as _bootstrap_external\nexcept ImportError:\n from. import _bootstrap_external\n _bootstrap_external._set_bootstrap_module(_bootstrap)\n _bootstrap._bootstrap_external=_bootstrap_external\nelse:\n _bootstrap_external.__name__='importlib._bootstrap_external'\n _bootstrap_external.__package__='importlib'\n try:\n _bootstrap_external.__file__=__file__.replace('__init__.py','_bootstrap_external.py')\n except NameError:\n \n \n pass\n sys.modules['importlib._bootstrap_external']=_bootstrap_external\n \n \n_pack_uint32=_bootstrap_external._pack_uint32\n_unpack_uint32=_bootstrap_external._unpack_uint32\n\n\n\n\nimport warnings\n\n\n\n\nfrom._bootstrap import __import__\n\n\ndef invalidate_caches():\n ''\n \n for finder in sys.meta_path:\n if hasattr(finder,'invalidate_caches'):\n finder.invalidate_caches()\n \n \ndef import_module(name,package=None):\n ''\n\n\n\n\n\n \n level=0\n if name.startswith('.'):\n if not package:\n raise TypeError(\"the 'package' argument is required to perform a \"\n f\"relative import for {name !r}\")\n for character in name:\n if character !='.':\n break\n level +=1\n return _bootstrap._gcd_import(name[level:],package,level)\n \n \n_RELOADING={}\n\n\ndef reload(module):\n ''\n\n\n\n \n try:\n name=module.__spec__.name\n except AttributeError:\n try:\n name=module.__name__\n except AttributeError:\n raise TypeError(\"reload() argument must be a module\")\n \n if sys.modules.get(name)is not module:\n raise ImportError(f\"module {name} not in sys.modules\",name=name)\n if name in _RELOADING:\n return _RELOADING[name]\n _RELOADING[name]=module\n try:\n parent_name=name.rpartition('.')[0]\n if parent_name:\n try:\n parent=sys.modules[parent_name]\n except KeyError:\n raise ImportError(f\"parent {parent_name !r} not in sys.modules\",\n name=parent_name)from None\n else:\n pkgpath=parent.__path__\n else:\n pkgpath=None\n target=module\n spec=module.__spec__=_bootstrap._find_spec(name,pkgpath,target)\n if spec is None:\n raise ModuleNotFoundError(f\"spec not found for the module {name !r}\",name=name)\n _bootstrap._exec(spec,module)\n \n return sys.modules[name]\n finally:\n try:\n del _RELOADING[name]\n except KeyError:\n pass\n", ["_frozen_importlib", "_frozen_importlib_external", "_imp", "importlib", "importlib._bootstrap", "importlib._bootstrap_external", "sys", "warnings"], 1], "importlib.metadata._adapters": [".py", "import re\nimport textwrap\nimport email.message\n\nfrom ._text import FoldedCase\n\n\nclass Message(email.message.Message):\n multiple_use_keys=set(\n map(\n FoldedCase,\n [\n 'Classifier',\n 'Obsoletes-Dist',\n 'Platform',\n 'Project-URL',\n 'Provides-Dist',\n 'Provides-Extra',\n 'Requires-Dist',\n 'Requires-External',\n 'Supported-Platform',\n 'Dynamic',\n ],\n )\n )\n ''\n\n \n \n def __new__(cls,orig:email.message.Message):\n res=super().__new__(cls)\n vars(res).update(vars(orig))\n return res\n \n def __init__(self,*args,**kwargs):\n self._headers=self._repair_headers()\n \n \n def __iter__(self):\n return super().__iter__()\n \n def _repair_headers(self):\n def redent(value):\n ''\n if not value or '\\n'not in value:\n return value\n return textwrap.dedent(' '*8+value)\n \n headers=[(key,redent(value))for key,value in vars(self)['_headers']]\n if self._payload:\n headers.append(('Description',self.get_payload()))\n return headers\n \n @property\n def json(self):\n ''\n\n\n \n \n def transform(key):\n value=self.get_all(key)if key in self.multiple_use_keys else self[key]\n if key =='Keywords':\n value=re.split(r'\\s+',value)\n tk=key.lower().replace('-','_')\n return tk,value\n \n return dict(map(transform,map(FoldedCase,self)))\n", ["email.message", "importlib.metadata._text", "re", "textwrap"]], "importlib.metadata._collections": [".py", "import collections\n\n\n\nclass FreezableDefaultDict(collections.defaultdict):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __missing__(self,key):\n return getattr(self,'_frozen',super().__missing__)(key)\n \n def freeze(self):\n self._frozen=lambda key:self.default_factory()\n \n \nclass Pair(collections.namedtuple('Pair','name value')):\n @classmethod\n def parse(cls,text):\n return cls(*map(str.strip,text.split(\"=\",1)))\n", ["collections"]], "importlib.metadata._functools": [".py", "import types\nimport functools\n\n\n\ndef method_cache(method,cache_wrapper=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n cache_wrapper=cache_wrapper or functools.lru_cache()\n \n def wrapper(self,*args,**kwargs):\n \n bound_method=types.MethodType(method,self)\n cached_method=cache_wrapper(bound_method)\n setattr(self,method.__name__,cached_method)\n return cached_method(*args,**kwargs)\n \n \n wrapper.cache_clear=lambda :None\n \n return wrapper\n \n \n \ndef pass_none(func):\n ''\n\n\n\n\n\n\n \n \n @functools.wraps(func)\n def wrapper(param,*args,**kwargs):\n if param is not None :\n return func(param,*args,**kwargs)\n \n return wrapper\n", ["functools", "types"]], "importlib.metadata._itertools": [".py", "from itertools import filterfalse\n\n\ndef unique_everseen(iterable,key=None ):\n ''\n \n \n seen=set()\n seen_add=seen.add\n if key is None :\n for element in filterfalse(seen.__contains__,iterable):\n seen_add(element)\n yield element\n else :\n for element in iterable:\n k=key(element)\n if k not in seen:\n seen_add(k)\n yield element\n \n \n \ndef always_iterable(obj,base_type=(str,bytes)):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if obj is None :\n return iter(())\n \n if (base_type is not None )and isinstance(obj,base_type):\n return iter((obj,))\n \n try :\n return iter(obj)\n except TypeError:\n return iter((obj,))\n", ["itertools"]], "importlib.metadata._meta": [".py", "from typing import Any,Dict,Iterator,List,Protocol,TypeVar,Union\n\n\n_T=TypeVar(\"_T\")\n\n\nclass PackageMetadata(Protocol):\n def __len__(self)->int:\n ...\n \n def __contains__(self,item:str)->bool:\n ...\n \n def __getitem__(self,key:str)->str:\n ...\n \n def __iter__(self)->Iterator[str]:\n ...\n \n def get_all(self,name:str,failobj:_T=...)->Union[List[Any],_T]:\n ''\n\n \n \n @property\n def json(self)->Dict[str,Union[str,List[str]]]:\n ''\n\n \n \n \nclass SimplePath(Protocol):\n ''\n\n \n \n def joinpath(self)->'SimplePath':\n ...\n \n def __truediv__(self)->'SimplePath':\n ...\n \n def parent(self)->'SimplePath':\n ...\n \n def read_text(self)->str:\n ...\n", ["typing"]], "importlib.metadata._text": [".py", "import re\n\nfrom ._functools import method_cache\n\n\n\nclass FoldedCase(str):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __lt__(self,other):\n return self.lower()other.lower()\n \n def __eq__(self,other):\n return self.lower()==other.lower()\n \n def __ne__(self,other):\n return self.lower()!=other.lower()\n \n def __hash__(self):\n return hash(self.lower())\n \n def __contains__(self,other):\n return super().lower().__contains__(other.lower())\n \n def in_(self,other):\n ''\n return self in FoldedCase(other)\n \n \n @method_cache\n def lower(self):\n return super().lower()\n \n def index(self,sub):\n return self.lower().index(sub.lower())\n \n def split(self,splitter=' ',maxsplit=0):\n pattern=re.compile(re.escape(splitter),re.I)\n return pattern.split(self,maxsplit)\n", ["importlib.metadata._functools", "re"]], "importlib.metadata": [".py", "import os\nimport re\nimport abc\nimport csv\nimport sys\nimport email\nimport pathlib\nimport zipfile\nimport operator\nimport textwrap\nimport warnings\nimport functools\nimport itertools\nimport posixpath\nimport collections\n\nfrom . import _adapters,_meta\nfrom ._collections import FreezableDefaultDict,Pair\nfrom ._functools import method_cache,pass_none\nfrom ._itertools import always_iterable,unique_everseen\nfrom ._meta import PackageMetadata,SimplePath\n\nfrom contextlib import suppress\nfrom importlib import import_module\nfrom importlib.abc import MetaPathFinder\nfrom itertools import starmap\nfrom typing import List,Mapping,Optional,Union\n\n\n__all__=[\n'Distribution',\n'DistributionFinder',\n'PackageMetadata',\n'PackageNotFoundError',\n'distribution',\n'distributions',\n'entry_points',\n'files',\n'metadata',\n'packages_distributions',\n'requires',\n'version',\n]\n\n\nclass PackageNotFoundError(ModuleNotFoundError):\n ''\n \n def __str__(self):\n return f\"No package metadata was found for {self.name}\"\n \n @property\n def name(self):\n (name,)=self.args\n return name\n \n \nclass Sectioned:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n _sample=textwrap.dedent(\n \"\"\"\n [sec1]\n # comments ignored\n a = 1\n b = 2\n\n [sec2]\n a = 2\n \"\"\"\n ).lstrip()\n \n @classmethod\n def section_pairs(cls,text):\n return (\n section._replace(value=Pair.parse(section.value))\n for section in cls.read(text,filter_=cls.valid)\n if section.name is not None\n )\n \n @staticmethod\n def read(text,filter_=None ):\n lines=filter(filter_,map(str.strip,text.splitlines()))\n name=None\n for value in lines:\n section_match=value.startswith('[')and value.endswith(']')\n if section_match:\n name=value.strip('[]')\n continue\n yield Pair(name,value)\n \n @staticmethod\n def valid(line):\n return line and not line.startswith('#')\n \n \nclass DeprecatedTuple:\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n _warn=functools.partial(\n warnings.warn,\n \"EntryPoint tuple interface is deprecated. Access members by name.\",\n DeprecationWarning,\n stacklevel=2,\n )\n \n def __getitem__(self,item):\n self._warn()\n return self._key()[item]\n \n \nclass EntryPoint(DeprecatedTuple):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n pattern=re.compile(\n r'(?P[\\w.]+)\\s*'\n r'(:\\s*(?P[\\w.]+)\\s*)?'\n r'((?P\\[.*\\])\\s*)?$'\n )\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n name:str\n value:str\n group:str\n \n dist:Optional['Distribution']=None\n \n def __init__(self,name,value,group):\n vars(self).update(name=name,value=value,group=group)\n \n def load(self):\n ''\n\n\n \n match=self.pattern.match(self.value)\n module=import_module(match.group('module'))\n attrs=filter(None ,(match.group('attr')or '').split('.'))\n return functools.reduce(getattr,attrs,module)\n \n @property\n def module(self):\n match=self.pattern.match(self.value)\n return match.group('module')\n \n @property\n def attr(self):\n match=self.pattern.match(self.value)\n return match.group('attr')\n \n @property\n def extras(self):\n match=self.pattern.match(self.value)\n return re.findall(r'\\w+',match.group('extras')or '')\n \n def _for(self,dist):\n vars(self).update(dist=dist)\n return self\n \n def __iter__(self):\n ''\n\n \n msg=(\n \"Construction of dict of EntryPoints is deprecated in \"\n \"favor of EntryPoints.\"\n )\n warnings.warn(msg,DeprecationWarning)\n return iter((self.name,self))\n \n def matches(self,**params):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n attrs=(getattr(self,param)for param in params)\n return all(map(operator.eq,params.values(),attrs))\n \n def _key(self):\n return self.name,self.value,self.group\n \n def __lt__(self,other):\n return self._key()'\n \n \nclass Distribution:\n ''\n \n @abc.abstractmethod\n def read_text(self,filename):\n ''\n\n\n\n \n \n @abc.abstractmethod\n def locate_file(self,path):\n ''\n\n\n \n \n @classmethod\n def from_name(cls,name:str):\n ''\n\n\n\n\n\n\n\n \n if not name:\n raise ValueError(\"A distribution name is required.\")\n try :\n return next(cls.discover(name=name))\n except StopIteration:\n raise PackageNotFoundError(name)\n \n @classmethod\n def discover(cls,**kwargs):\n ''\n\n\n\n\n\n\n \n context=kwargs.pop('context',None )\n if context and kwargs:\n raise ValueError(\"cannot accept context and kwargs\")\n context=context or DistributionFinder.Context(**kwargs)\n return itertools.chain.from_iterable(\n resolver(context)for resolver in cls._discover_resolvers()\n )\n \n @staticmethod\n def at(path):\n ''\n\n\n\n \n return PathDistribution(pathlib.Path(path))\n \n @staticmethod\n def _discover_resolvers():\n ''\n declared=(\n getattr(finder,'find_distributions',None )for finder in sys.meta_path\n )\n return filter(None ,declared)\n \n @property\n def metadata(self)->_meta.PackageMetadata:\n ''\n\n\n\n \n text=(\n self.read_text('METADATA')\n or self.read_text('PKG-INFO')\n \n \n \n or self.read_text('')\n )\n return _adapters.Message(email.message_from_string(text))\n \n @property\n def name(self):\n ''\n return self.metadata['Name']\n \n @property\n def _normalized_name(self):\n ''\n return Prepared.normalize(self.name)\n \n @property\n def version(self):\n ''\n return self.metadata['Version']\n \n @property\n def entry_points(self):\n return EntryPoints._from_text_for(self.read_text('entry_points.txt'),self)\n \n @property\n def files(self):\n ''\n\n\n\n\n\n\n\n \n \n def make_file(name,hash=None ,size_str=None ):\n result=PackagePath(name)\n result.hash=FileHash(hash)if hash else None\n result.size=int(size_str)if size_str else None\n result.dist=self\n return result\n \n @pass_none\n def make_files(lines):\n return list(starmap(make_file,csv.reader(lines)))\n \n return make_files(self._read_files_distinfo()or self._read_files_egginfo())\n \n def _read_files_distinfo(self):\n ''\n\n \n text=self.read_text('RECORD')\n return text and text.splitlines()\n \n def _read_files_egginfo(self):\n ''\n\n\n \n text=self.read_text('SOURCES.txt')\n return text and map('\"{}\"'.format,text.splitlines())\n \n @property\n def requires(self):\n ''\n reqs=self._read_dist_info_reqs()or self._read_egg_info_reqs()\n return reqs and list(reqs)\n \n def _read_dist_info_reqs(self):\n return self.metadata.get_all('Requires-Dist')\n \n def _read_egg_info_reqs(self):\n source=self.read_text('requires.txt')\n return pass_none(self._deps_from_requires_text)(source)\n \n @classmethod\n def _deps_from_requires_text(cls,source):\n return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source))\n \n @staticmethod\n def _convert_egg_info_reqs_to_simple_reqs(sections):\n ''\n\n\n\n\n\n\n\n \n \n def make_condition(name):\n return name and f'extra == \"{name}\"'\n \n def quoted_marker(section):\n section=section or ''\n extra,sep,markers=section.partition(':')\n if extra and markers:\n markers=f'({markers})'\n conditions=list(filter(None ,[markers,make_condition(extra)]))\n return '; '+' and '.join(conditions)if conditions else ''\n \n def url_req_space(req):\n ''\n\n\n \n \n return ' '*('@'in req)\n \n for section in sections:\n space=url_req_space(section.value)\n yield section.value+space+quoted_marker(section.name)\n \n \nclass DistributionFinder(MetaPathFinder):\n ''\n\n \n \n class Context:\n ''\n\n\n\n\n\n\n\n\n \n \n name=None\n ''\n\n\n \n \n def __init__(self,**kwargs):\n vars(self).update(kwargs)\n \n @property\n def path(self):\n ''\n\n\n\n\n\n \n return vars(self).get('path',sys.path)\n \n @abc.abstractmethod\n def find_distributions(self,context=Context()):\n ''\n\n\n\n\n\n \n \n \nclass FastPath:\n ''\n\n\n\n\n\n \n \n @functools.lru_cache()\n def __new__(cls,root):\n return super().__new__(cls)\n \n def __init__(self,root):\n self.root=root\n \n def joinpath(self,child):\n return pathlib.Path(self.root,child)\n \n def children(self):\n with suppress(Exception):\n return os.listdir(self.root or '.')\n with suppress(Exception):\n return self.zip_children()\n return []\n \n def zip_children(self):\n zip_path=zipfile.Path(self.root)\n names=zip_path.root.namelist()\n self.joinpath=zip_path.joinpath\n \n return dict.fromkeys(child.split(posixpath.sep,1)[0]for child in names)\n \n def search(self,name):\n return self.lookup(self.mtime).search(name)\n \n @property\n def mtime(self):\n with suppress(OSError):\n return os.stat(self.root).st_mtime\n self.lookup.cache_clear()\n \n @method_cache\n def lookup(self,mtime):\n return Lookup(self)\n \n \nclass Lookup:\n def __init__(self,path:FastPath):\n base=os.path.basename(path.root).lower()\n base_is_egg=base.endswith(\".egg\")\n self.infos=FreezableDefaultDict(list)\n self.eggs=FreezableDefaultDict(list)\n \n for child in path.children():\n low=child.lower()\n if low.endswith((\".dist-info\",\".egg-info\")):\n \n name=low.rpartition(\".\")[0].partition(\"-\")[0]\n normalized=Prepared.normalize(name)\n self.infos[normalized].append(path.joinpath(child))\n elif base_is_egg and low ==\"egg-info\":\n name=base.rpartition(\".\")[0].partition(\"-\")[0]\n legacy_normalized=Prepared.legacy_normalize(name)\n self.eggs[legacy_normalized].append(path.joinpath(child))\n \n self.infos.freeze()\n self.eggs.freeze()\n \n def search(self,prepared):\n infos=(\n self.infos[prepared.normalized]\n if prepared\n else itertools.chain.from_iterable(self.infos.values())\n )\n eggs=(\n self.eggs[prepared.legacy_normalized]\n if prepared\n else itertools.chain.from_iterable(self.eggs.values())\n )\n return itertools.chain(infos,eggs)\n \n \nclass Prepared:\n ''\n\n \n \n normalized=None\n legacy_normalized=None\n \n def __init__(self,name):\n self.name=name\n if name is None :\n return\n self.normalized=self.normalize(name)\n self.legacy_normalized=self.legacy_normalize(name)\n \n @staticmethod\n def normalize(name):\n ''\n\n \n return re.sub(r\"[-_.]+\",\"-\",name).lower().replace('-','_')\n \n @staticmethod\n def legacy_normalize(name):\n ''\n\n\n \n return name.lower().replace('-','_')\n \n def __bool__(self):\n return bool(self.name)\n \n \nclass MetadataPathFinder(DistributionFinder):\n @classmethod\n def find_distributions(cls,context=DistributionFinder.Context()):\n ''\n\n\n\n\n\n\n \n found=cls._search_paths(context.name,context.path)\n return map(PathDistribution,found)\n \n @classmethod\n def _search_paths(cls,name,paths):\n ''\n prepared=Prepared(name)\n return itertools.chain.from_iterable(\n path.search(prepared)for path in map(FastPath,paths)\n )\n \n def invalidate_caches(cls):\n FastPath.__new__.cache_clear()\n \n \nclass PathDistribution(Distribution):\n def __init__(self,path:SimplePath):\n ''\n\n\n \n self._path=path\n \n def read_text(self,filename):\n with suppress(\n FileNotFoundError,\n IsADirectoryError,\n KeyError,\n NotADirectoryError,\n PermissionError,\n ):\n return self._path.joinpath(filename).read_text(encoding='utf-8')\n \n read_text.__doc__=Distribution.read_text.__doc__\n \n def locate_file(self,path):\n return self._path.parent /path\n \n @property\n def _normalized_name(self):\n ''\n\n\n \n stem=os.path.basename(str(self._path))\n return (\n pass_none(Prepared.normalize)(self._name_from_stem(stem))\n or super()._normalized_name\n )\n \n @staticmethod\n def _name_from_stem(stem):\n ''\n\n\n\n\n\n\n\n \n filename,ext=os.path.splitext(stem)\n if ext not in ('.dist-info','.egg-info'):\n return\n name,sep,rest=filename.partition('-')\n return name\n \n \ndef distribution(distribution_name):\n ''\n\n\n\n \n return Distribution.from_name(distribution_name)\n \n \ndef distributions(**kwargs):\n ''\n\n\n \n return Distribution.discover(**kwargs)\n \n \ndef metadata(distribution_name)->_meta.PackageMetadata:\n ''\n\n\n\n \n return Distribution.from_name(distribution_name).metadata\n \n \ndef version(distribution_name):\n ''\n\n\n\n\n \n return distribution(distribution_name).version\n \n \n_unique=functools.partial(\nunique_everseen,\nkey=operator.attrgetter('_normalized_name'),\n)\n''\n\n\n\n\ndef entry_points(**params)->Union[EntryPoints,SelectableGroups]:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n eps=itertools.chain.from_iterable(\n dist.entry_points for dist in _unique(distributions())\n )\n return SelectableGroups.load(eps).select(**params)\n \n \ndef files(distribution_name):\n ''\n\n\n\n \n return distribution(distribution_name).files\n \n \ndef requires(distribution_name):\n ''\n\n\n\n\n \n return distribution(distribution_name).requires\n \n \ndef packages_distributions()->Mapping[str,List[str]]:\n ''\n\n\n\n\n\n\n\n \n pkg_to_dist=collections.defaultdict(list)\n for dist in distributions():\n for pkg in _top_level_declared(dist)or _top_level_inferred(dist):\n pkg_to_dist[pkg].append(dist.metadata['Name'])\n return dict(pkg_to_dist)\n \n \ndef _top_level_declared(dist):\n return (dist.read_text('top_level.txt')or '').split()\n \n \ndef _top_level_inferred(dist):\n return {\n f.parts[0]if len(f.parts)>1 else f.with_suffix('').name\n for f in always_iterable(dist.files)\n if f.suffix ==\".py\"\n }\n", ["abc", "collections", "contextlib", "csv", "email", "functools", "importlib", "importlib.abc", "importlib.metadata", "importlib.metadata._adapters", "importlib.metadata._collections", "importlib.metadata._functools", "importlib.metadata._itertools", "importlib.metadata._meta", "itertools", "operator", "os", "pathlib", "posixpath", "re", "sys", "textwrap", "typing", "warnings", "zipfile"], 1], "importlib.resources.abc": [".py", "import abc\nimport io\nimport os\nfrom typing import Any,BinaryIO,Iterable,Iterator,NoReturn,Text,Optional\nfrom typing import runtime_checkable,Protocol\nfrom typing import Union\n\n\nStrPath=Union[str,os.PathLike[str]]\n\n__all__=[\"ResourceReader\",\"Traversable\",\"TraversableResources\"]\n\n\nclass ResourceReader(metaclass=abc.ABCMeta):\n ''\n \n @abc.abstractmethod\n def open_resource(self,resource:Text)->BinaryIO:\n ''\n\n\n\n \n \n \n \n raise FileNotFoundError\n \n @abc.abstractmethod\n def resource_path(self,resource:Text)->Text:\n ''\n\n\n\n\n \n \n \n \n raise FileNotFoundError\n \n @abc.abstractmethod\n def is_resource(self,path:Text)->bool:\n ''\n\n\n \n raise FileNotFoundError\n \n @abc.abstractmethod\n def contents(self)->Iterable[str]:\n ''\n raise FileNotFoundError\n \n \n@runtime_checkable\nclass Traversable(Protocol):\n ''\n\n\n\n\n\n \n \n @abc.abstractmethod\n def iterdir(self)->Iterator[\"Traversable\"]:\n ''\n\n \n \n def read_bytes(self)->bytes:\n ''\n\n \n with self.open('rb')as strm:\n return strm.read()\n \n def read_text(self,encoding:Optional[str]=None )->str:\n ''\n\n \n with self.open(encoding=encoding)as strm:\n return strm.read()\n \n @abc.abstractmethod\n def is_dir(self)->bool:\n ''\n\n \n \n @abc.abstractmethod\n def is_file(self)->bool:\n ''\n\n \n \n @abc.abstractmethod\n def joinpath(self,*descendants:StrPath)->\"Traversable\":\n ''\n\n\n\n\n\n \n \n def __truediv__(self,child:StrPath)->\"Traversable\":\n ''\n\n \n return self.joinpath(child)\n \n @abc.abstractmethod\n def open(self,mode='r',*args,**kwargs):\n ''\n\n\n\n\n\n \n \n @abc.abstractproperty\n def name(self)->str:\n ''\n\n \n \n \nclass TraversableResources(ResourceReader):\n ''\n\n\n \n \n @abc.abstractmethod\n def files(self)->\"Traversable\":\n ''\n \n def open_resource(self,resource:StrPath)->io.BufferedReader:\n return self.files().joinpath(resource).open('rb')\n \n def resource_path(self,resource:Any)->NoReturn:\n raise FileNotFoundError(resource)\n \n def is_resource(self,path:StrPath)->bool:\n return self.files().joinpath(path).is_file()\n \n def contents(self)->Iterator[str]:\n return (item.name for item in self.files().iterdir())\n", ["abc", "io", "os", "typing"]], "importlib.resources.readers": [".py", "import collections\nimport operator\nimport pathlib\nimport zipfile\n\nfrom . import abc\n\nfrom ._itertools import unique_everseen\n\n\ndef remove_duplicates(items):\n return iter(collections.OrderedDict.fromkeys(items))\n \n \nclass FileReader(abc.TraversableResources):\n def __init__(self,loader):\n self.path=pathlib.Path(loader.path).parent\n \n def resource_path(self,resource):\n ''\n\n\n\n \n return str(self.path.joinpath(resource))\n \n def files(self):\n return self.path\n \n \nclass ZipReader(abc.TraversableResources):\n def __init__(self,loader,module):\n _,_,name=module.rpartition('.')\n self.prefix=loader.prefix.replace('\\\\','/')+name+'/'\n self.archive=loader.archive\n \n def open_resource(self,resource):\n try :\n return super().open_resource(resource)\n except KeyError as exc:\n raise FileNotFoundError(exc.args[0])\n \n def is_resource(self,path):\n \n \n target=self.files().joinpath(path)\n return target.is_file()and target.exists()\n \n def files(self):\n return zipfile.Path(self.archive,self.prefix)\n \n \nclass MultiplexedPath(abc.Traversable):\n ''\n\n\n\n\n \n \n def __init__(self,*paths):\n self._paths=list(map(pathlib.Path,remove_duplicates(paths)))\n if not self._paths:\n message='MultiplexedPath must contain at least one path'\n raise FileNotFoundError(message)\n if not all(path.is_dir()for path in self._paths):\n raise NotADirectoryError('MultiplexedPath only supports directories')\n \n def iterdir(self):\n files=(file for path in self._paths for file in path.iterdir())\n return unique_everseen(files,key=operator.attrgetter('name'))\n \n def read_bytes(self):\n raise FileNotFoundError(f'{self} is not a file')\n \n def read_text(self,*args,**kwargs):\n raise FileNotFoundError(f'{self} is not a file')\n \n def is_dir(self):\n return True\n \n def is_file(self):\n return False\n \n def joinpath(self,child):\n \n for file in self.iterdir():\n if file.name ==child:\n return file\n \n return self._paths[0]/child\n \n __truediv__=joinpath\n \n def open(self,*args,**kwargs):\n raise FileNotFoundError(f'{self} is not a file')\n \n @property\n def name(self):\n return self._paths[0].name\n \n def __repr__(self):\n paths=', '.join(f\"'{path}'\"for path in self._paths)\n return f'MultiplexedPath({paths})'\n \n \nclass NamespaceReader(abc.TraversableResources):\n def __init__(self,namespace_path):\n if 'NamespacePath'not in str(namespace_path):\n raise ValueError('Invalid path')\n self.path=MultiplexedPath(*list(namespace_path))\n \n def resource_path(self,resource):\n ''\n\n\n\n \n return str(self.path.joinpath(resource))\n \n def files(self):\n return self.path\n", ["collections", "importlib.resources", "importlib.resources._itertools", "importlib.resources.abc", "operator", "pathlib", "zipfile"]], "importlib.resources.simple": [".py", "''\n\n\n\nimport abc\nimport io\nimport itertools\nfrom typing import BinaryIO,List\n\nfrom .abc import Traversable,TraversableResources\n\n\nclass SimpleReader(abc.ABC):\n ''\n\n\n \n \n @abc.abstractproperty\n def package(self):\n \n ''\n\n \n \n @abc.abstractmethod\n def children(self):\n \n ''\n\n\n \n \n @abc.abstractmethod\n def resources(self):\n \n ''\n\n \n \n @abc.abstractmethod\n def open_binary(self,resource):\n \n ''\n\n \n \n @property\n def name(self):\n return self.package.split('.')[-1]\n \n \nclass ResourceHandle(Traversable):\n ''\n\n \n \n def __init__(self,parent,name):\n \n self.parent=parent\n self.name=name\n \n def is_file(self):\n return True\n \n def is_dir(self):\n return False\n \n def open(self,mode='r',*args,**kwargs):\n stream=self.parent.reader.open_binary(self.name)\n if 'b'not in mode:\n stream=io.TextIOWrapper(*args,**kwargs)\n return stream\n \n def joinpath(self,name):\n raise RuntimeError(\"Cannot traverse into a resource\")\n \n \nclass ResourceContainer(Traversable):\n ''\n\n \n \n def __init__(self,reader):\n \n self.reader=reader\n \n def is_dir(self):\n return True\n \n def is_file(self):\n return False\n \n def iterdir(self):\n files=(ResourceHandle(self,name)for name in self.reader.resources)\n dirs=map(ResourceContainer,self.reader.children())\n return itertools.chain(files,dirs)\n \n def open(self,*args,**kwargs):\n raise IsADirectoryError()\n \n @staticmethod\n def _flatten(compound_names):\n for name in compound_names:\n yield from name.split('/')\n \n def joinpath(self,*descendants):\n if not descendants:\n return self\n names=self._flatten(descendants)\n target=next(names)\n return next(\n traversable for traversable in self.iterdir()if traversable.name ==target\n ).joinpath(*names)\n \n \nclass TraversableReader(TraversableResources,SimpleReader):\n ''\n\n\n\n \n \n def files(self):\n return ResourceContainer(self)\n", ["abc", "importlib.resources.abc", "io", "itertools", "typing"]], "importlib.resources._adapters": [".py", "from contextlib import suppress\nfrom io import TextIOWrapper\n\nfrom . import abc\n\n\nclass SpecLoaderAdapter:\n ''\n\n \n \n def __init__(self,spec,adapter=lambda spec:spec.loader):\n self.spec=spec\n self.loader=adapter(spec)\n \n def __getattr__(self,name):\n return getattr(self.spec,name)\n \n \nclass TraversableResourcesLoader:\n ''\n\n \n \n def __init__(self,spec):\n self.spec=spec\n \n def get_resource_reader(self,name):\n return CompatibilityFiles(self.spec)._native()\n \n \ndef _io_wrapper(file,mode='r',*args,**kwargs):\n if mode =='r':\n return TextIOWrapper(file,*args,**kwargs)\n elif mode =='rb':\n return file\n raise ValueError(\n \"Invalid mode value '{}', only 'r' and 'rb' are supported\".format(mode)\n )\n \n \nclass CompatibilityFiles:\n ''\n\n\n \n \n class SpecPath(abc.Traversable):\n ''\n\n\n \n \n def __init__(self,spec,reader):\n self._spec=spec\n self._reader=reader\n \n def iterdir(self):\n if not self._reader:\n return iter(())\n return iter(\n CompatibilityFiles.ChildPath(self._reader,path)\n for path in self._reader.contents()\n )\n \n def is_file(self):\n return False\n \n is_dir=is_file\n \n def joinpath(self,other):\n if not self._reader:\n return CompatibilityFiles.OrphanPath(other)\n return CompatibilityFiles.ChildPath(self._reader,other)\n \n @property\n def name(self):\n return self._spec.name\n \n def open(self,mode='r',*args,**kwargs):\n return _io_wrapper(self._reader.open_resource(None ),mode,*args,**kwargs)\n \n class ChildPath(abc.Traversable):\n ''\n\n\n \n \n def __init__(self,reader,name):\n self._reader=reader\n self._name=name\n \n def iterdir(self):\n return iter(())\n \n def is_file(self):\n return self._reader.is_resource(self.name)\n \n def is_dir(self):\n return not self.is_file()\n \n def joinpath(self,other):\n return CompatibilityFiles.OrphanPath(self.name,other)\n \n @property\n def name(self):\n return self._name\n \n def open(self,mode='r',*args,**kwargs):\n return _io_wrapper(\n self._reader.open_resource(self.name),mode,*args,**kwargs\n )\n \n class OrphanPath(abc.Traversable):\n ''\n\n\n \n \n def __init__(self,*path_parts):\n if len(path_parts)<1:\n raise ValueError('Need at least one path part to construct a path')\n self._path=path_parts\n \n def iterdir(self):\n return iter(())\n \n def is_file(self):\n return False\n \n is_dir=is_file\n \n def joinpath(self,other):\n return CompatibilityFiles.OrphanPath(*self._path,other)\n \n @property\n def name(self):\n return self._path[-1]\n \n def open(self,mode='r',*args,**kwargs):\n raise FileNotFoundError(\"Can't open orphan path\")\n \n def __init__(self,spec):\n self.spec=spec\n \n @property\n def _reader(self):\n with suppress(AttributeError):\n return self.spec.loader.get_resource_reader(self.spec.name)\n \n def _native(self):\n ''\n\n \n reader=self._reader\n return reader if hasattr(reader,'files')else self\n \n def __getattr__(self,attr):\n return getattr(self._reader,attr)\n \n def files(self):\n return CompatibilityFiles.SpecPath(self.spec,self._reader)\n \n \ndef wrap_spec(package):\n ''\n\n\n \n return SpecLoaderAdapter(package.__spec__,TraversableResourcesLoader)\n", ["contextlib", "importlib.resources", "importlib.resources.abc", "io"]], "importlib.resources._common": [".py", "import os\nimport pathlib\nimport tempfile\nimport functools\nimport contextlib\nimport types\nimport importlib\n\nfrom typing import Union,Optional\nfrom .abc import ResourceReader,Traversable\n\nfrom ._adapters import wrap_spec\n\nPackage=Union[types.ModuleType,str]\n\n\ndef files(package):\n\n ''\n\n \n return from_package(get_package(package))\n \n \ndef get_resource_reader(package):\n\n ''\n\n \n \n \n \n \n \n spec=package.__spec__\n reader=getattr(spec.loader,'get_resource_reader',None )\n if reader is None :\n return None\n return reader(spec.name)\n \n \ndef resolve(cand):\n\n return cand if isinstance(cand,types.ModuleType)else importlib.import_module(cand)\n \n \ndef get_package(package):\n\n ''\n\n\n \n resolved=resolve(package)\n if wrap_spec(resolved).submodule_search_locations is None :\n raise TypeError(f'{package !r} is not a package')\n return resolved\n \n \ndef from_package(package):\n ''\n\n\n \n spec=wrap_spec(package)\n reader=spec.loader.get_resource_reader(spec.name)\n return reader.files()\n \n \n@contextlib.contextmanager\ndef _tempfile(reader,suffix='',\n\n\n*,_os_remove=os.remove):\n\n\n\n fd,raw_path=tempfile.mkstemp(suffix=suffix)\n try :\n try :\n os.write(fd,reader())\n finally :\n os.close(fd)\n del reader\n yield pathlib.Path(raw_path)\n finally :\n try :\n _os_remove(raw_path)\n except FileNotFoundError:\n pass\n \n \n@functools.singledispatch\ndef as_file(path):\n ''\n\n\n \n return _tempfile(path.read_bytes,suffix=path.name)\n \n \n@as_file.register(pathlib.Path)\n@contextlib.contextmanager\ndef _(path):\n ''\n\n \n yield path\n", ["contextlib", "functools", "importlib", "importlib.resources._adapters", "importlib.resources.abc", "os", "pathlib", "tempfile", "types", "typing"]], "importlib.resources._itertools": [".py", "from itertools import filterfalse\n\nfrom typing import (\nCallable,\nIterable,\nIterator,\nOptional,\nSet,\nTypeVar,\nUnion,\n)\n\n\n_T=TypeVar('_T')\n_U=TypeVar('_U')\n\n\ndef unique_everseen(\niterable:Iterable[_T],key:Optional[Callable[[_T],_U]]=None\n)->Iterator[_T]:\n ''\n \n \n seen:Set[Union[_T,_U]]=set()\n seen_add=seen.add\n if key is None :\n for element in filterfalse(seen.__contains__,iterable):\n seen_add(element)\n yield element\n else :\n for element in iterable:\n k=key(element)\n if k not in seen:\n seen_add(k)\n yield element\n", ["itertools", "typing"]], "importlib.resources._legacy": [".py", "import functools\nimport os\nimport pathlib\nimport types\nimport warnings\n\nfrom typing import Union,Iterable,ContextManager,BinaryIO,TextIO,Any\n\nfrom . import _common\n\nPackage=Union[types.ModuleType,str]\nResource=str\n\n\ndef deprecated(func):\n @functools.wraps(func)\n def wrapper(*args,**kwargs):\n warnings.warn(\n f\"{func.__name__} is deprecated. Use files() instead. \"\n \"Refer to https://importlib-resources.readthedocs.io\"\n \"/en/latest/using.html#migrating-from-legacy for migration advice.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return func(*args,**kwargs)\n \n return wrapper\n \n \ndef normalize_path(path):\n\n ''\n\n\n \n str_path=str(path)\n parent,file_name=os.path.split(str_path)\n if parent:\n raise ValueError(f'{path !r} must be only a file name')\n return file_name\n \n \n@deprecated\ndef open_binary(package:Package,resource:Resource)->BinaryIO:\n ''\n return (_common.files(package)/normalize_path(resource)).open('rb')\n \n \n@deprecated\ndef read_binary(package:Package,resource:Resource)->bytes:\n ''\n return (_common.files(package)/normalize_path(resource)).read_bytes()\n \n \n@deprecated\ndef open_text(\npackage:Package,\nresource:Resource,\nencoding:str='utf-8',\nerrors:str='strict',\n)->TextIO:\n ''\n return (_common.files(package)/normalize_path(resource)).open(\n 'r',encoding=encoding,errors=errors\n )\n \n \n@deprecated\ndef read_text(\npackage:Package,\nresource:Resource,\nencoding:str='utf-8',\nerrors:str='strict',\n)->str:\n ''\n\n\n\n \n with open_text(package,resource,encoding,errors)as fp:\n return fp.read()\n \n \n@deprecated\ndef contents(package:Package)->Iterable[str]:\n ''\n\n\n\n\n \n return [path.name for path in _common.files(package).iterdir()]\n \n \n@deprecated\ndef is_resource(package:Package,name:str)->bool:\n ''\n\n\n \n resource=normalize_path(name)\n return any(\n traversable.name ==resource and traversable.is_file()\n for traversable in _common.files(package).iterdir()\n )\n \n \n@deprecated\ndef path(\npackage:Package,\nresource:Resource,\n)->ContextManager[pathlib.Path]:\n ''\n\n\n\n\n\n\n \n return _common.as_file(_common.files(package)/normalize_path(resource))\n", ["functools", "importlib.resources", "importlib.resources._common", "os", "pathlib", "types", "typing", "warnings"]], "importlib.resources": [".py", "''\n\nfrom ._common import (\nas_file,\nfiles,\nPackage,\n)\n\nfrom ._legacy import (\ncontents,\nopen_binary,\nread_binary,\nopen_text,\nread_text,\nis_resource,\npath,\nResource,\n)\n\nfrom .abc import ResourceReader\n\n\n__all__=[\n'Package',\n'Resource',\n'ResourceReader',\n'as_file',\n'contents',\n'files',\n'is_resource',\n'open_binary',\n'open_text',\n'path',\n'read_binary',\n'read_text',\n]\n", ["importlib.resources._common", "importlib.resources._legacy", "importlib.resources.abc"], 1], "json.encoder": [".py", "''\n\nimport re\n\ntry :\n from _json import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii=None\ntry :\n from _json import encode_basestring as c_encode_basestring\nexcept ImportError:\n c_encode_basestring=None\ntry :\n from _json import make_encoder as c_make_encoder\nexcept ImportError:\n c_make_encoder=None\n \nESCAPE=re.compile(r'[\\x00-\\x1f\\\\\"\\b\\f\\n\\r\\t]')\nESCAPE_ASCII=re.compile(r'([\\\\\"]|[^\\ -~])')\nHAS_UTF8=re.compile(b'[\\x80-\\xff]')\nESCAPE_DCT={\n'\\\\':'\\\\\\\\',\n'\"':'\\\\\"',\n'\\b':'\\\\b',\n'\\f':'\\\\f',\n'\\n':'\\\\n',\n'\\r':'\\\\r',\n'\\t':'\\\\t',\n}\nfor i in range(0x20):\n ESCAPE_DCT.setdefault(chr(i),'\\\\u{0:04x}'.format(i))\n \ndel i\n\nINFINITY=float('inf')\n\ndef py_encode_basestring(s):\n ''\n\n \n def replace(match):\n return ESCAPE_DCT[match.group(0)]\n return '\"'+ESCAPE.sub(replace,s)+'\"'\n \n \nencode_basestring=(c_encode_basestring or py_encode_basestring)\n\n\ndef py_encode_basestring_ascii(s):\n ''\n\n \n def replace(match):\n s=match.group(0)\n try :\n return ESCAPE_DCT[s]\n except KeyError:\n n=ord(s)\n if n <0x10000:\n return '\\\\u{0:04x}'.format(n)\n \n else :\n \n n -=0x10000\n s1=0xd800 |((n >>10)&0x3ff)\n s2=0xdc00 |(n&0x3ff)\n return '\\\\u{0:04x}\\\\u{1:04x}'.format(s1,s2)\n return '\"'+ESCAPE_ASCII.sub(replace,s)+'\"'\n \n \nencode_basestring_ascii=(\nc_encode_basestring_ascii or py_encode_basestring_ascii)\n\nclass JSONEncoder(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n item_separator=', '\n key_separator=': '\n def __init__(self,*,skipkeys=False ,ensure_ascii=True ,\n check_circular=True ,allow_nan=True ,sort_keys=False ,\n indent=None ,separators=None ,default=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n self.skipkeys=skipkeys\n self.ensure_ascii=ensure_ascii\n self.check_circular=check_circular\n self.allow_nan=allow_nan\n self.sort_keys=sort_keys\n self.indent=indent\n if separators is not None :\n self.item_separator,self.key_separator=separators\n elif indent is not None :\n self.item_separator=','\n if default is not None :\n self.default=default\n \n def default(self,o):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise TypeError(f'Object of type {o.__class__.__name__} '\n f'is not JSON serializable')\n \n def encode(self,o):\n ''\n\n\n\n\n\n \n \n if isinstance(o,str):\n if self.ensure_ascii:\n return encode_basestring_ascii(o)\n else :\n return encode_basestring(o)\n \n \n \n chunks=self.iterencode(o,_one_shot=True )\n if not isinstance(chunks,(list,tuple)):\n chunks=list(chunks)\n return ''.join(chunks)\n \n def iterencode(self,o,_one_shot=False ):\n ''\n\n\n\n\n\n\n\n \n if self.check_circular:\n markers={}\n else :\n markers=None\n if self.ensure_ascii:\n _encoder=encode_basestring_ascii\n else :\n _encoder=encode_basestring\n \n def floatstr(o,allow_nan=self.allow_nan,\n _repr=float.__repr__,_inf=INFINITY,_neginf=-INFINITY):\n \n \n \n \n if o !=o:\n text='NaN'\n elif o ==_inf:\n text='Infinity'\n elif o ==_neginf:\n text='-Infinity'\n else :\n return _repr(o)\n \n if not allow_nan:\n raise ValueError(\n \"Out of range float values are not JSON compliant: \"+\n repr(o))\n \n return text\n \n \n if (_one_shot and c_make_encoder is not None\n and self.indent is None ):\n _iterencode=c_make_encoder(\n markers,self.default,_encoder,self.indent,\n self.key_separator,self.item_separator,self.sort_keys,\n self.skipkeys,self.allow_nan)\n else :\n _iterencode=_make_iterencode(\n markers,self.default,_encoder,self.indent,floatstr,\n self.key_separator,self.item_separator,self.sort_keys,\n self.skipkeys,_one_shot)\n return _iterencode(o,0)\n \ndef _make_iterencode(markers,_default,_encoder,_indent,_floatstr,\n_key_separator,_item_separator,_sort_keys,_skipkeys,_one_shot,\n\nValueError=ValueError,\ndict=dict,\nfloat=float,\nid=id,\nint=int,\nisinstance=isinstance,\nlist=list,\nstr=str,\ntuple=tuple,\n_intstr=int.__repr__,\n):\n\n if _indent is not None and not isinstance(_indent,str):\n _indent=' '*_indent\n \n def _iterencode_list(lst,_current_indent_level):\n if not lst:\n yield '[]'\n return\n if markers is not None :\n markerid=id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid]=lst\n buf='['\n if _indent is not None :\n _current_indent_level +=1\n newline_indent='\\n'+_indent *_current_indent_level\n separator=_item_separator+newline_indent\n buf +=newline_indent\n else :\n newline_indent=None\n separator=_item_separator\n first=True\n for value in lst:\n if first:\n first=False\n else :\n buf=separator\n if isinstance(value,str):\n yield buf+_encoder(value)\n elif value is None :\n yield buf+'null'\n elif value is True :\n yield buf+'true'\n elif value is False :\n yield buf+'false'\n elif isinstance(value,int):\n \n \n \n yield buf+_intstr(value)\n elif isinstance(value,float):\n \n yield buf+_floatstr(value)\n else :\n yield buf\n if isinstance(value,(list,tuple)):\n chunks=_iterencode_list(value,_current_indent_level)\n elif isinstance(value,dict):\n chunks=_iterencode_dict(value,_current_indent_level)\n else :\n chunks=_iterencode(value,_current_indent_level)\n yield from chunks\n if newline_indent is not None :\n _current_indent_level -=1\n yield '\\n'+_indent *_current_indent_level\n yield ']'\n if markers is not None :\n del markers[markerid]\n \n def _iterencode_dict(dct,_current_indent_level):\n if not dct:\n yield '{}'\n return\n if markers is not None :\n markerid=id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid]=dct\n yield '{'\n if _indent is not None :\n _current_indent_level +=1\n newline_indent='\\n'+_indent *_current_indent_level\n item_separator=_item_separator+newline_indent\n yield newline_indent\n else :\n newline_indent=None\n item_separator=_item_separator\n first=True\n if _sort_keys:\n items=sorted(dct.items())\n else :\n items=dct.items()\n for key,value in items:\n if isinstance(key,str):\n pass\n \n \n elif isinstance(key,float):\n \n key=_floatstr(key)\n elif key is True :\n key='true'\n elif key is False :\n key='false'\n elif key is None :\n key='null'\n elif isinstance(key,int):\n \n key=_intstr(key)\n elif _skipkeys:\n continue\n else :\n raise TypeError(f'keys must be str, int, float, bool or None, '\n f'not {key.__class__.__name__}')\n if first:\n first=False\n else :\n yield item_separator\n yield _encoder(key)\n yield _key_separator\n if isinstance(value,str):\n yield _encoder(value)\n elif value is None :\n yield 'null'\n elif value is True :\n yield 'true'\n elif value is False :\n yield 'false'\n elif isinstance(value,int):\n \n yield _intstr(value)\n elif isinstance(value,float):\n \n yield _floatstr(value)\n else :\n if isinstance(value,(list,tuple)):\n chunks=_iterencode_list(value,_current_indent_level)\n elif isinstance(value,dict):\n chunks=_iterencode_dict(value,_current_indent_level)\n else :\n chunks=_iterencode(value,_current_indent_level)\n yield from chunks\n if newline_indent is not None :\n _current_indent_level -=1\n yield '\\n'+_indent *_current_indent_level\n yield '}'\n if markers is not None :\n del markers[markerid]\n \n def _iterencode(o,_current_indent_level):\n if isinstance(o,str):\n yield _encoder(o)\n elif o is None :\n yield 'null'\n elif o is True :\n yield 'true'\n elif o is False :\n yield 'false'\n elif isinstance(o,int):\n \n yield _intstr(o)\n elif isinstance(o,float):\n \n yield _floatstr(o)\n elif isinstance(o,(list,tuple)):\n yield from _iterencode_list(o,_current_indent_level)\n elif isinstance(o,dict):\n yield from _iterencode_dict(o,_current_indent_level)\n else :\n if markers is not None :\n markerid=id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid]=o\n o=_default(o)\n yield from _iterencode(o,_current_indent_level)\n if markers is not None :\n del markers[markerid]\n return _iterencode\n", ["_json", "re"]], "json": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__version__='2.0.9'\n__all__=[\n'dump','dumps','load','loads',\n'JSONDecoder','JSONDecodeError','JSONEncoder',\n]\n\n__author__='Bob Ippolito '\n\n\n\n\n\nclass codecs:\n\n BOM_UTF8=b'\\xef\\xbb\\xbf'\n BOM_LE=BOM_UTF16_LE=b'\\xff\\xfe'\n BOM_BE=BOM_UTF16_BE=b'\\xfe\\xff'\n BOM_UTF32_LE=b'\\xff\\xfe\\x00\\x00'\n BOM_UTF32_BE=b'\\x00\\x00\\xfe\\xff'\n \n \nimport _json\nfrom .encoder import JSONEncoder\n\nJSONDecoder=_json.JSONDecoder\n\nclass decoder:\n JSONDecoder=_json.JSONDecoder\n \nclass JSONDecodeError(ValueError):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,msg,doc,pos):\n lineno=doc.count('\\n',0,pos)+1\n colno=pos -doc.rfind('\\n',0,pos)\n errmsg='%s: line %d column %d (char %d)'%(msg,lineno,colno,pos)\n ValueError.__init__(self,errmsg)\n self.msg=msg\n self.doc=doc\n self.pos=pos\n self.lineno=lineno\n self.colno=colno\n \n def __reduce__(self):\n return self.__class__,(self.msg,self.doc,self.pos)\n \ndef dump(obj,fp,**kw):\n fp.write(dumps(obj,**kw))\n \ndef dumps(obj,*,skipkeys=False ,ensure_ascii=True ,check_circular=True ,\nallow_nan=True ,cls=None ,indent=None ,separators=None ,\ndefault=None ,sort_keys=False ,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if cls is None :\n return _json.dumps(obj,1,**kw)\n return cls(\n skipkeys=skipkeys,ensure_ascii=ensure_ascii,\n check_circular=check_circular,allow_nan=allow_nan,indent=indent,\n separators=separators,default=default,sort_keys=sort_keys,\n **kw).encode(obj)\n \ndef detect_encoding(b):\n bstartswith=b.startswith\n if bstartswith((codecs.BOM_UTF32_BE,codecs.BOM_UTF32_LE)):\n return 'utf-32'\n if bstartswith((codecs.BOM_UTF16_BE,codecs.BOM_UTF16_LE)):\n return 'utf-16'\n if bstartswith(codecs.BOM_UTF8):\n return 'utf-8-sig'\n \n if len(b)>=4:\n if not b[0]:\n \n \n return 'utf-16-be'if b[1]else 'utf-32-be'\n if not b[1]:\n \n \n \n return 'utf-16-le'if b[2]or b[3]else 'utf-32-le'\n elif len(b)==2:\n if not b[0]:\n \n return 'utf-16-be'\n if not b[1]:\n \n return 'utf-16-le'\n \n return 'utf-8'\n \n \ndef load(fp,*,cls=None ,object_hook=None ,parse_float=None ,\nparse_int=None ,parse_constant=None ,object_pairs_hook=None ,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return loads(fp.read(),\n cls=cls,object_hook=object_hook,\n parse_float=parse_float,parse_int=parse_int,\n parse_constant=parse_constant,object_pairs_hook=object_pairs_hook,**kw)\n \n \ndef loads(s,*,cls=None ,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(s,str):\n if s.startswith('\\ufeff'):\n raise JSONDecodeError(\"Unexpected UTF-8 BOM (decode using utf-8-sig)\",\n s,0)\n else :\n if not isinstance(s,(bytes,bytearray)):\n raise TypeError(f'the JSON object must be str, bytes or bytearray, '\n f'not {s.__class__.__name__}')\n s=s.decode(detect_encoding(s),'surrogatepass')\n \n \n if \"encoding\"in kw:\n import warnings\n warnings.warn(\n \"'encoding' is ignored and deprecated. It will be removed in Python 3.9\",\n DeprecationWarning,\n stacklevel=2\n )\n del kw['encoding']\n \n if cls is None :\n \n \n return _json.loads(s,**kw)\n if object_hook is not None :\n kw['object_hook']=object_hook\n if object_pairs_hook is not None :\n kw['object_pairs_hook']=object_pairs_hook\n if parse_float is not None :\n kw['parse_float']=parse_float\n if parse_int is not None :\n kw['parse_int']=parse_int\n if parse_constant is not None :\n kw['parse_constant']=parse_constant\n return cls(**kw).decode(s)\n", ["_json", "json.encoder", "warnings"], 1], "logging.brython_handlers": [".py", "import logging\n\nfrom browser.ajax import ajax\n\n\nclass XMLHTTPHandler(logging.Handler):\n ''\n\n\n \n def __init__(self,url,method=\"GET\"):\n ''\n\n\n \n logging.Handler.__init__(self)\n method=method.upper()\n if method not in [\"GET\",\"POST\"]:\n raise ValueError(\"method must be GET or POST\")\n self.url=url\n self.method=method\n \n def mapLogRecord(self,record):\n ''\n\n\n\n \n return record.__dict__\n \n def emit(self,record):\n ''\n\n\n\n \n try :\n req=ajax.open(self.method,self.url,sync=False )\n req.send(self.mapLogRecord(record))\n except :\n self.handleError(record)\n", ["browser.ajax", "logging"]], "logging.config": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"\"\nConfiguration functions for the logging package for Python. The core package\nis based on PEP 282 and comments thereto in comp.lang.python, and influenced\nby Apache's log4j system.\n\nCopyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.\n\nTo use, simply 'import logging' and log away!\n\"\"\"\n\nimport errno\nimport functools\nimport io\nimport logging\nimport logging.handlers\nimport os\nimport queue\nimport re\nimport struct\nimport threading\nimport traceback\n\nfrom socketserver import ThreadingTCPServer,StreamRequestHandler\n\n\nDEFAULT_LOGGING_CONFIG_PORT=9030\n\nRESET_ERROR=errno.ECONNRESET\n\n\n\n\n\n\n_listener=None\n\ndef fileConfig(fname,defaults=None,disable_existing_loggers=True,encoding=None):\n ''\n\n\n\n\n\n\n \n import configparser\n \n if isinstance(fname,str):\n if not os.path.exists(fname):\n raise FileNotFoundError(f\"{fname} doesn't exist\")\n elif not os.path.getsize(fname):\n raise RuntimeError(f'{fname} is an empty file')\n \n if isinstance(fname,configparser.RawConfigParser):\n cp=fname\n else:\n try:\n cp=configparser.ConfigParser(defaults)\n if hasattr(fname,'readline'):\n cp.read_file(fname)\n else:\n encoding=io.text_encoding(encoding)\n cp.read(fname,encoding=encoding)\n except configparser.ParsingError as e:\n raise RuntimeError(f'{fname} is invalid: {e}')\n \n formatters=_create_formatters(cp)\n \n \n logging._acquireLock()\n try:\n _clearExistingHandlers()\n \n \n handlers=_install_handlers(cp,formatters)\n _install_loggers(cp,handlers,disable_existing_loggers)\n finally:\n logging._releaseLock()\n \n \ndef _resolve(name):\n ''\n name=name.split('.')\n used=name.pop(0)\n found=__import__(used)\n for n in name:\n used=used+'.'+n\n try:\n found=getattr(found,n)\n except AttributeError:\n __import__(used)\n found=getattr(found,n)\n return found\n \ndef _strip_spaces(alist):\n return map(str.strip,alist)\n \ndef _create_formatters(cp):\n ''\n flist=cp[\"formatters\"][\"keys\"]\n if not len(flist):\n return{}\n flist=flist.split(\",\")\n flist=_strip_spaces(flist)\n formatters={}\n for form in flist:\n sectname=\"formatter_%s\"%form\n fs=cp.get(sectname,\"format\",raw=True,fallback=None)\n dfs=cp.get(sectname,\"datefmt\",raw=True,fallback=None)\n stl=cp.get(sectname,\"style\",raw=True,fallback='%')\n defaults=cp.get(sectname,\"defaults\",raw=True,fallback=None)\n \n c=logging.Formatter\n class_name=cp[sectname].get(\"class\")\n if class_name:\n c=_resolve(class_name)\n \n if defaults is not None:\n defaults=eval(defaults,vars(logging))\n f=c(fs,dfs,stl,defaults=defaults)\n else:\n f=c(fs,dfs,stl)\n formatters[form]=f\n return formatters\n \n \ndef _install_handlers(cp,formatters):\n ''\n hlist=cp[\"handlers\"][\"keys\"]\n if not len(hlist):\n return{}\n hlist=hlist.split(\",\")\n hlist=_strip_spaces(hlist)\n handlers={}\n fixups=[]\n for hand in hlist:\n section=cp[\"handler_%s\"%hand]\n klass=section[\"class\"]\n fmt=section.get(\"formatter\",\"\")\n try:\n klass=eval(klass,vars(logging))\n except(AttributeError,NameError):\n klass=_resolve(klass)\n args=section.get(\"args\",'()')\n args=eval(args,vars(logging))\n kwargs=section.get(\"kwargs\",'{}')\n kwargs=eval(kwargs,vars(logging))\n h=klass(*args,**kwargs)\n h.name=hand\n if \"level\"in section:\n level=section[\"level\"]\n h.setLevel(level)\n if len(fmt):\n h.setFormatter(formatters[fmt])\n if issubclass(klass,logging.handlers.MemoryHandler):\n target=section.get(\"target\",\"\")\n if len(target):\n fixups.append((h,target))\n handlers[hand]=h\n \n for h,t in fixups:\n h.setTarget(handlers[t])\n return handlers\n \ndef _handle_existing_loggers(existing,child_loggers,disable_existing):\n ''\n\n\n\n\n\n\n\n\n \n root=logging.root\n for log in existing:\n logger=root.manager.loggerDict[log]\n if log in child_loggers:\n if not isinstance(logger,logging.PlaceHolder):\n logger.setLevel(logging.NOTSET)\n logger.handlers=[]\n logger.propagate=True\n else:\n logger.disabled=disable_existing\n \ndef _install_loggers(cp,handlers,disable_existing):\n ''\n \n \n llist=cp[\"loggers\"][\"keys\"]\n llist=llist.split(\",\")\n llist=list(_strip_spaces(llist))\n llist.remove(\"root\")\n section=cp[\"logger_root\"]\n root=logging.root\n log=root\n if \"level\"in section:\n level=section[\"level\"]\n log.setLevel(level)\n for h in root.handlers[:]:\n root.removeHandler(h)\n hlist=section[\"handlers\"]\n if len(hlist):\n hlist=hlist.split(\",\")\n hlist=_strip_spaces(hlist)\n for hand in hlist:\n log.addHandler(handlers[hand])\n \n \n \n \n \n \n \n \n \n \n existing=list(root.manager.loggerDict.keys())\n \n \n \n \n existing.sort()\n \n \n child_loggers=[]\n \n for log in llist:\n section=cp[\"logger_%s\"%log]\n qn=section[\"qualname\"]\n propagate=section.getint(\"propagate\",fallback=1)\n logger=logging.getLogger(qn)\n if qn in existing:\n i=existing.index(qn)+1\n prefixed=qn+\".\"\n pflen=len(prefixed)\n num_existing=len(existing)\n while i [a-z]+)://(?P.*)$')\n \n WORD_PATTERN=re.compile(r'^\\s*(\\w+)\\s*')\n DOT_PATTERN=re.compile(r'^\\.\\s*(\\w+)\\s*')\n INDEX_PATTERN=re.compile(r'^\\[\\s*(\\w+)\\s*\\]\\s*')\n DIGIT_PATTERN=re.compile(r'^\\d+$')\n \n value_converters={\n 'ext':'ext_convert',\n 'cfg':'cfg_convert',\n }\n \n \n importer=staticmethod(__import__)\n \n def __init__(self,config):\n self.config=ConvertingDict(config)\n self.config.configurator=self\n \n def resolve(self,s):\n ''\n\n\n \n name=s.split('.')\n used=name.pop(0)\n try:\n found=self.importer(used)\n for frag in name:\n used +='.'+frag\n try:\n found=getattr(found,frag)\n except AttributeError:\n self.importer(used)\n found=getattr(found,frag)\n return found\n except ImportError as e:\n v=ValueError('Cannot resolve %r: %s'%(s,e))\n raise v from e\n \n def ext_convert(self,value):\n ''\n return self.resolve(value)\n \n def cfg_convert(self,value):\n ''\n rest=value\n m=self.WORD_PATTERN.match(rest)\n if m is None:\n raise ValueError(\"Unable to convert %r\"%value)\n else:\n rest=rest[m.end():]\n d=self.config[m.groups()[0]]\n \n while rest:\n m=self.DOT_PATTERN.match(rest)\n if m:\n d=d[m.groups()[0]]\n else:\n m=self.INDEX_PATTERN.match(rest)\n if m:\n idx=m.groups()[0]\n if not self.DIGIT_PATTERN.match(idx):\n d=d[idx]\n else:\n try:\n n=int(idx)\n d=d[n]\n except TypeError:\n d=d[idx]\n if m:\n rest=rest[m.end():]\n else:\n raise ValueError('Unable to convert '\n '%r at %r'%(value,rest))\n \n return d\n \n def convert(self,value):\n ''\n\n\n\n \n if not isinstance(value,ConvertingDict)and isinstance(value,dict):\n value=ConvertingDict(value)\n value.configurator=self\n elif not isinstance(value,ConvertingList)and isinstance(value,list):\n value=ConvertingList(value)\n value.configurator=self\n elif not isinstance(value,ConvertingTuple)and\\\n isinstance(value,tuple)and not hasattr(value,'_fields'):\n value=ConvertingTuple(value)\n value.configurator=self\n elif isinstance(value,str):\n m=self.CONVERT_PATTERN.match(value)\n if m:\n d=m.groupdict()\n prefix=d['prefix']\n converter=self.value_converters.get(prefix,None)\n if converter:\n suffix=d['suffix']\n converter=getattr(self,converter)\n value=converter(suffix)\n return value\n \n def configure_custom(self,config):\n ''\n c=config.pop('()')\n if not callable(c):\n c=self.resolve(c)\n props=config.pop('.',None)\n \n kwargs={k:config[k]for k in config if valid_ident(k)}\n result=c(**kwargs)\n if props:\n for name,value in props.items():\n setattr(result,name,value)\n return result\n \n def as_tuple(self,value):\n ''\n if isinstance(value,list):\n value=tuple(value)\n return value\n \nclass DictConfigurator(BaseConfigurator):\n ''\n\n\n \n \n def configure(self):\n ''\n \n config=self.config\n if 'version'not in config:\n raise ValueError(\"dictionary doesn't specify a version\")\n if config['version']!=1:\n raise ValueError(\"Unsupported version: %s\"%config['version'])\n incremental=config.pop('incremental',False)\n EMPTY_DICT={}\n logging._acquireLock()\n try:\n if incremental:\n handlers=config.get('handlers',EMPTY_DICT)\n for name in handlers:\n if name not in logging._handlers:\n raise ValueError('No handler found with '\n 'name %r'%name)\n else:\n try:\n handler=logging._handlers[name]\n handler_config=handlers[name]\n level=handler_config.get('level',None)\n if level:\n handler.setLevel(logging._checkLevel(level))\n except Exception as e:\n raise ValueError('Unable to configure handler '\n '%r'%name)from e\n loggers=config.get('loggers',EMPTY_DICT)\n for name in loggers:\n try:\n self.configure_logger(name,loggers[name],True)\n except Exception as e:\n raise ValueError('Unable to configure logger '\n '%r'%name)from e\n root=config.get('root',None)\n if root:\n try:\n self.configure_root(root,True)\n except Exception as e:\n raise ValueError('Unable to configure root '\n 'logger')from e\n else:\n disable_existing=config.pop('disable_existing_loggers',True)\n \n _clearExistingHandlers()\n \n \n formatters=config.get('formatters',EMPTY_DICT)\n for name in formatters:\n try:\n formatters[name]=self.configure_formatter(\n formatters[name])\n except Exception as e:\n raise ValueError('Unable to configure '\n 'formatter %r'%name)from e\n \n filters=config.get('filters',EMPTY_DICT)\n for name in filters:\n try:\n filters[name]=self.configure_filter(filters[name])\n except Exception as e:\n raise ValueError('Unable to configure '\n 'filter %r'%name)from e\n \n \n \n \n handlers=config.get('handlers',EMPTY_DICT)\n deferred=[]\n for name in sorted(handlers):\n try:\n handler=self.configure_handler(handlers[name])\n handler.name=name\n handlers[name]=handler\n except Exception as e:\n if ' not configured yet'in str(e.__cause__):\n deferred.append(name)\n else:\n raise ValueError('Unable to configure handler '\n '%r'%name)from e\n \n \n for name in deferred:\n try:\n handler=self.configure_handler(handlers[name])\n handler.name=name\n handlers[name]=handler\n except Exception as e:\n raise ValueError('Unable to configure handler '\n '%r'%name)from e\n \n \n \n \n \n \n \n \n \n \n \n root=logging.root\n existing=list(root.manager.loggerDict.keys())\n \n \n \n \n existing.sort()\n \n \n child_loggers=[]\n \n loggers=config.get('loggers',EMPTY_DICT)\n for name in loggers:\n if name in existing:\n i=existing.index(name)+1\n prefixed=name+\".\"\n pflen=len(prefixed)\n num_existing=len(existing)\n while i L\",chunk)[0]\n chunk=self.connection.recv(slen)\n while len(chunk)0:\n mode='a'\n if \"b\"not in mode:\n encoding=io.text_encoding(encoding)\n BaseRotatingHandler.__init__(self,filename,mode,encoding=encoding,\n delay=delay,errors=errors)\n self.maxBytes=maxBytes\n self.backupCount=backupCount\n \n def doRollover(self):\n ''\n\n \n if self.stream:\n self.stream.close()\n self.stream=None\n if self.backupCount >0:\n for i in range(self.backupCount -1,0,-1):\n sfn=self.rotation_filename(\"%s.%d\"%(self.baseFilename,i))\n dfn=self.rotation_filename(\"%s.%d\"%(self.baseFilename,\n i+1))\n if os.path.exists(sfn):\n if os.path.exists(dfn):\n os.remove(dfn)\n os.rename(sfn,dfn)\n dfn=self.rotation_filename(self.baseFilename+\".1\")\n if os.path.exists(dfn):\n os.remove(dfn)\n self.rotate(self.baseFilename,dfn)\n if not self.delay:\n self.stream=self._open()\n \n def shouldRollover(self,record):\n ''\n\n\n\n\n \n \n if os.path.exists(self.baseFilename)and not os.path.isfile(self.baseFilename):\n return False\n if self.stream is None :\n self.stream=self._open()\n if self.maxBytes >0:\n msg=\"%s\\n\"%self.format(record)\n self.stream.seek(0,2)\n if self.stream.tell()+len(msg)>=self.maxBytes:\n return True\n return False\n \nclass TimedRotatingFileHandler(BaseRotatingHandler):\n ''\n\n\n\n\n\n \n def __init__(self,filename,when='h',interval=1,backupCount=0,\n encoding=None ,delay=False ,utc=False ,atTime=None ,\n errors=None ):\n encoding=io.text_encoding(encoding)\n BaseRotatingHandler.__init__(self,filename,'a',encoding=encoding,\n delay=delay,errors=errors)\n self.when=when.upper()\n self.backupCount=backupCount\n self.utc=utc\n self.atTime=atTime\n \n \n \n \n \n \n \n \n \n \n \n \n if self.when =='S':\n self.interval=1\n self.suffix=\"%Y-%m-%d_%H-%M-%S\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}(\\.\\w+)?$\"\n elif self.when =='M':\n self.interval=60\n self.suffix=\"%Y-%m-%d_%H-%M\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}(\\.\\w+)?$\"\n elif self.when =='H':\n self.interval=60 *60\n self.suffix=\"%Y-%m-%d_%H\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}_\\d{2}(\\.\\w+)?$\"\n elif self.when =='D'or self.when =='MIDNIGHT':\n self.interval=60 *60 *24\n self.suffix=\"%Y-%m-%d\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}(\\.\\w+)?$\"\n elif self.when.startswith('W'):\n self.interval=60 *60 *24 *7\n if len(self.when)!=2:\n raise ValueError(\"You must specify a day for weekly rollover from 0 to 6 (0 is Monday): %s\"%self.when)\n if self.when[1]<'0'or self.when[1]>'6':\n raise ValueError(\"Invalid day specified for weekly rollover: %s\"%self.when)\n self.dayOfWeek=int(self.when[1])\n self.suffix=\"%Y-%m-%d\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}(\\.\\w+)?$\"\n else :\n raise ValueError(\"Invalid rollover interval specified: %s\"%self.when)\n \n self.extMatch=re.compile(self.extMatch,re.ASCII)\n self.interval=self.interval *interval\n \n \n filename=self.baseFilename\n if os.path.exists(filename):\n t=os.stat(filename)[ST_MTIME]\n else :\n t=int(time.time())\n self.rolloverAt=self.computeRollover(t)\n \n def computeRollover(self,currentTime):\n ''\n\n \n result=currentTime+self.interval\n \n \n \n \n \n \n \n if self.when =='MIDNIGHT'or self.when.startswith('W'):\n \n if self.utc:\n t=time.gmtime(currentTime)\n else :\n t=time.localtime(currentTime)\n currentHour=t[3]\n currentMinute=t[4]\n currentSecond=t[5]\n currentDay=t[6]\n \n if self.atTime is None :\n rotate_ts=_MIDNIGHT\n else :\n rotate_ts=((self.atTime.hour *60+self.atTime.minute)*60+\n self.atTime.second)\n \n r=rotate_ts -((currentHour *60+currentMinute)*60+\n currentSecond)\n if r <0:\n \n \n \n r +=_MIDNIGHT\n currentDay=(currentDay+1)%7\n result=currentTime+r\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if self.when.startswith('W'):\n day=currentDay\n if day !=self.dayOfWeek:\n if day =self.rolloverAt:\n \n if os.path.exists(self.baseFilename)and not os.path.isfile(self.baseFilename):\n \n \n self.rolloverAt=self.computeRollover(t)\n return False\n \n return True\n return False\n \n def getFilesToDelete(self):\n ''\n\n\n\n \n dirName,baseName=os.path.split(self.baseFilename)\n fileNames=os.listdir(dirName)\n result=[]\n \n n,e=os.path.splitext(baseName)\n prefix=n+'.'\n plen=len(prefix)\n for fileName in fileNames:\n if self.namer is None :\n \n if not fileName.startswith(baseName):\n continue\n else :\n \n \n \n if (not fileName.startswith(baseName)and fileName.endswith(e)and\n len(fileName)>(plen+1)and not fileName[plen+1].isdigit()):\n continue\n \n if fileName[:plen]==prefix:\n suffix=fileName[plen:]\n \n \n parts=suffix.split('.')\n for part in parts:\n if self.extMatch.match(part):\n result.append(os.path.join(dirName,fileName))\n break\n if len(result)0:\n for s in self.getFilesToDelete():\n os.remove(s)\n if not self.delay:\n self.stream=self._open()\n newRolloverAt=self.computeRollover(currentTime)\n while newRolloverAt <=currentTime:\n newRolloverAt=newRolloverAt+self.interval\n \n if (self.when =='MIDNIGHT'or self.when.startswith('W'))and not self.utc:\n dstAtRollover=time.localtime(newRolloverAt)[-1]\n if dstNow !=dstAtRollover:\n if not dstNow:\n addend=-3600\n else :\n addend=3600\n newRolloverAt +=addend\n self.rolloverAt=newRolloverAt\n \nclass WatchedFileHandler(logging.FileHandler):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,filename,mode='a',encoding=None ,delay=False ,\n errors=None ):\n if \"b\"not in mode:\n encoding=io.text_encoding(encoding)\n logging.FileHandler.__init__(self,filename,mode=mode,\n encoding=encoding,delay=delay,\n errors=errors)\n self.dev,self.ino=-1,-1\n self._statstream()\n \n def _statstream(self):\n if self.stream:\n sres=os.fstat(self.stream.fileno())\n self.dev,self.ino=sres[ST_DEV],sres[ST_INO]\n \n def reopenIfNeeded(self):\n ''\n\n\n\n\n\n \n \n \n \n \n try :\n \n sres=os.stat(self.baseFilename)\n except FileNotFoundError:\n sres=None\n \n if not sres or sres[ST_DEV]!=self.dev or sres[ST_INO]!=self.ino:\n if self.stream is not None :\n \n self.stream.flush()\n self.stream.close()\n self.stream=None\n \n self.stream=self._open()\n self._statstream()\n \n def emit(self,record):\n ''\n\n\n\n\n \n self.reopenIfNeeded()\n logging.FileHandler.emit(self,record)\n \n \nclass SocketHandler(logging.Handler):\n ''\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,host,port):\n ''\n\n\n\n\n\n \n logging.Handler.__init__(self)\n self.host=host\n self.port=port\n if port is None :\n self.address=host\n else :\n self.address=(host,port)\n self.sock=None\n self.closeOnError=False\n self.retryTime=None\n \n \n \n self.retryStart=1.0\n self.retryMax=30.0\n self.retryFactor=2.0\n \n def makeSocket(self,timeout=1):\n ''\n\n\n \n if self.port is not None :\n result=socket.create_connection(self.address,timeout=timeout)\n else :\n result=socket.socket(socket.AF_UNIX,socket.SOCK_STREAM)\n result.settimeout(timeout)\n try :\n result.connect(self.address)\n except OSError:\n result.close()\n raise\n return result\n \n def createSocket(self):\n ''\n\n\n\n \n now=time.time()\n \n \n \n if self.retryTime is None :\n attempt=True\n else :\n attempt=(now >=self.retryTime)\n if attempt:\n try :\n self.sock=self.makeSocket()\n self.retryTime=None\n except OSError:\n \n if self.retryTime is None :\n self.retryPeriod=self.retryStart\n else :\n self.retryPeriod=self.retryPeriod *self.retryFactor\n if self.retryPeriod >self.retryMax:\n self.retryPeriod=self.retryMax\n self.retryTime=now+self.retryPeriod\n \n def send(self,s):\n ''\n\n\n\n\n \n if self.sock is None :\n self.createSocket()\n \n \n \n if self.sock:\n try :\n self.sock.sendall(s)\n except OSError:\n self.sock.close()\n self.sock=None\n \n def makePickle(self,record):\n ''\n\n\n \n ei=record.exc_info\n if ei:\n \n dummy=self.format(record)\n \n \n \n d=dict(record.__dict__)\n d['msg']=record.getMessage()\n d['args']=None\n d['exc_info']=None\n \n d.pop('message',None )\n s=pickle.dumps(d,1)\n slen=struct.pack(\">L\",len(s))\n return slen+s\n \n def handleError(self,record):\n ''\n\n\n\n\n\n \n if self.closeOnError and self.sock:\n self.sock.close()\n self.sock=None\n else :\n logging.Handler.handleError(self,record)\n \n def emit(self,record):\n ''\n\n\n\n\n\n\n \n try :\n s=self.makePickle(record)\n self.send(s)\n except Exception:\n self.handleError(record)\n \n def close(self):\n ''\n\n \n self.acquire()\n try :\n sock=self.sock\n if sock:\n self.sock=None\n sock.close()\n logging.Handler.close(self)\n finally :\n self.release()\n \nclass DatagramHandler(SocketHandler):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,host,port):\n ''\n\n \n SocketHandler.__init__(self,host,port)\n self.closeOnError=False\n \n def makeSocket(self):\n ''\n\n\n \n if self.port is None :\n family=socket.AF_UNIX\n else :\n family=socket.AF_INET\n s=socket.socket(family,socket.SOCK_DGRAM)\n return s\n \n def send(self,s):\n ''\n\n\n\n\n\n \n if self.sock is None :\n self.createSocket()\n self.sock.sendto(s,self.address)\n \nclass SysLogHandler(logging.Handler):\n ''\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n LOG_EMERG=0\n LOG_ALERT=1\n LOG_CRIT=2\n LOG_ERR=3\n LOG_WARNING=4\n LOG_NOTICE=5\n LOG_INFO=6\n LOG_DEBUG=7\n \n \n LOG_KERN=0\n LOG_USER=1\n LOG_MAIL=2\n LOG_DAEMON=3\n LOG_AUTH=4\n LOG_SYSLOG=5\n LOG_LPR=6\n LOG_NEWS=7\n LOG_UUCP=8\n LOG_CRON=9\n LOG_AUTHPRIV=10\n LOG_FTP=11\n LOG_NTP=12\n LOG_SECURITY=13\n LOG_CONSOLE=14\n LOG_SOLCRON=15\n \n \n LOG_LOCAL0=16\n LOG_LOCAL1=17\n LOG_LOCAL2=18\n LOG_LOCAL3=19\n LOG_LOCAL4=20\n LOG_LOCAL5=21\n LOG_LOCAL6=22\n LOG_LOCAL7=23\n \n priority_names={\n \"alert\":LOG_ALERT,\n \"crit\":LOG_CRIT,\n \"critical\":LOG_CRIT,\n \"debug\":LOG_DEBUG,\n \"emerg\":LOG_EMERG,\n \"err\":LOG_ERR,\n \"error\":LOG_ERR,\n \"info\":LOG_INFO,\n \"notice\":LOG_NOTICE,\n \"panic\":LOG_EMERG,\n \"warn\":LOG_WARNING,\n \"warning\":LOG_WARNING,\n }\n \n facility_names={\n \"auth\":LOG_AUTH,\n \"authpriv\":LOG_AUTHPRIV,\n \"console\":LOG_CONSOLE,\n \"cron\":LOG_CRON,\n \"daemon\":LOG_DAEMON,\n \"ftp\":LOG_FTP,\n \"kern\":LOG_KERN,\n \"lpr\":LOG_LPR,\n \"mail\":LOG_MAIL,\n \"news\":LOG_NEWS,\n \"ntp\":LOG_NTP,\n \"security\":LOG_SECURITY,\n \"solaris-cron\":LOG_SOLCRON,\n \"syslog\":LOG_SYSLOG,\n \"user\":LOG_USER,\n \"uucp\":LOG_UUCP,\n \"local0\":LOG_LOCAL0,\n \"local1\":LOG_LOCAL1,\n \"local2\":LOG_LOCAL2,\n \"local3\":LOG_LOCAL3,\n \"local4\":LOG_LOCAL4,\n \"local5\":LOG_LOCAL5,\n \"local6\":LOG_LOCAL6,\n \"local7\":LOG_LOCAL7,\n }\n \n \n \n \n \n priority_map={\n \"DEBUG\":\"debug\",\n \"INFO\":\"info\",\n \"WARNING\":\"warning\",\n \"ERROR\":\"error\",\n \"CRITICAL\":\"critical\"\n }\n \n def __init__(self,address=('localhost',SYSLOG_UDP_PORT),\n facility=LOG_USER,socktype=None ):\n ''\n\n\n\n\n\n\n\n\n\n \n logging.Handler.__init__(self)\n \n self.address=address\n self.facility=facility\n self.socktype=socktype\n self.socket=None\n self.createSocket()\n \n def _connect_unixsocket(self,address):\n use_socktype=self.socktype\n if use_socktype is None :\n use_socktype=socket.SOCK_DGRAM\n self.socket=socket.socket(socket.AF_UNIX,use_socktype)\n try :\n self.socket.connect(address)\n \n self.socktype=use_socktype\n except OSError:\n self.socket.close()\n if self.socktype is not None :\n \n raise\n use_socktype=socket.SOCK_STREAM\n self.socket=socket.socket(socket.AF_UNIX,use_socktype)\n try :\n self.socket.connect(address)\n \n self.socktype=use_socktype\n except OSError:\n self.socket.close()\n raise\n \n def createSocket(self):\n address=self.address\n socktype=self.socktype\n \n if isinstance(address,str):\n self.unixsocket=True\n \n \n \n \n try :\n self._connect_unixsocket(address)\n except OSError:\n pass\n else :\n self.unixsocket=False\n if socktype is None :\n socktype=socket.SOCK_DGRAM\n host,port=address\n ress=socket.getaddrinfo(host,port,0,socktype)\n if not ress:\n raise OSError(\"getaddrinfo returns an empty list\")\n for res in ress:\n af,socktype,proto,_,sa=res\n err=sock=None\n try :\n sock=socket.socket(af,socktype,proto)\n if socktype ==socket.SOCK_STREAM:\n sock.connect(sa)\n break\n except OSError as exc:\n err=exc\n if sock is not None :\n sock.close()\n if err is not None :\n raise err\n self.socket=sock\n self.socktype=socktype\n \n def encodePriority(self,facility,priority):\n ''\n\n\n\n\n \n if isinstance(facility,str):\n facility=self.facility_names[facility]\n if isinstance(priority,str):\n priority=self.priority_names[priority]\n return (facility <<3)|priority\n \n def close(self):\n ''\n\n \n self.acquire()\n try :\n sock=self.socket\n if sock:\n self.socket=None\n sock.close()\n logging.Handler.close(self)\n finally :\n self.release()\n \n def mapPriority(self,levelName):\n ''\n\n\n\n\n\n \n return self.priority_map.get(levelName,\"warning\")\n \n ident=''\n append_nul=True\n \n def emit(self,record):\n ''\n\n\n\n\n \n try :\n msg=self.format(record)\n if self.ident:\n msg=self.ident+msg\n if self.append_nul:\n msg +='\\000'\n \n \n \n prio='<%d>'%self.encodePriority(self.facility,\n self.mapPriority(record.levelname))\n prio=prio.encode('utf-8')\n \n msg=msg.encode('utf-8')\n msg=prio+msg\n \n if not self.socket:\n self.createSocket()\n \n if self.unixsocket:\n try :\n self.socket.send(msg)\n except OSError:\n self.socket.close()\n self._connect_unixsocket(self.address)\n self.socket.send(msg)\n elif self.socktype ==socket.SOCK_DGRAM:\n self.socket.sendto(msg,self.address)\n else :\n self.socket.sendall(msg)\n except Exception:\n self.handleError(record)\n \nclass SMTPHandler(logging.Handler):\n ''\n\n \n def __init__(self,mailhost,fromaddr,toaddrs,subject,\n credentials=None ,secure=None ,timeout=5.0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n logging.Handler.__init__(self)\n if isinstance(mailhost,(list,tuple)):\n self.mailhost,self.mailport=mailhost\n else :\n self.mailhost,self.mailport=mailhost,None\n if isinstance(credentials,(list,tuple)):\n self.username,self.password=credentials\n else :\n self.username=None\n self.fromaddr=fromaddr\n if isinstance(toaddrs,str):\n toaddrs=[toaddrs]\n self.toaddrs=toaddrs\n self.subject=subject\n self.secure=secure\n self.timeout=timeout\n \n def getSubject(self,record):\n ''\n\n\n\n\n \n return self.subject\n \n def emit(self,record):\n ''\n\n\n\n \n try :\n import smtplib\n from email.message import EmailMessage\n import email.utils\n \n port=self.mailport\n if not port:\n port=smtplib.SMTP_PORT\n smtp=smtplib.SMTP(self.mailhost,port,timeout=self.timeout)\n msg=EmailMessage()\n msg['From']=self.fromaddr\n msg['To']=','.join(self.toaddrs)\n msg['Subject']=self.getSubject(record)\n msg['Date']=email.utils.localtime()\n msg.set_content(self.format(record))\n if self.username:\n if self.secure is not None :\n smtp.ehlo()\n smtp.starttls(*self.secure)\n smtp.ehlo()\n smtp.login(self.username,self.password)\n smtp.send_message(msg)\n smtp.quit()\n except Exception:\n self.handleError(record)\n \nclass NTEventLogHandler(logging.Handler):\n ''\n\n\n\n\n\n\n\n \n def __init__(self,appname,dllname=None ,logtype=\"Application\"):\n logging.Handler.__init__(self)\n try :\n import win32evtlogutil,win32evtlog\n self.appname=appname\n self._welu=win32evtlogutil\n if not dllname:\n dllname=os.path.split(self._welu.__file__)\n dllname=os.path.split(dllname[0])\n dllname=os.path.join(dllname[0],r'win32service.pyd')\n self.dllname=dllname\n self.logtype=logtype\n \n \n \n try :\n self._welu.AddSourceToRegistry(appname,dllname,logtype)\n except Exception as e:\n \n \n if getattr(e,'winerror',None )!=5:\n raise\n self.deftype=win32evtlog.EVENTLOG_ERROR_TYPE\n self.typemap={\n logging.DEBUG:win32evtlog.EVENTLOG_INFORMATION_TYPE,\n logging.INFO:win32evtlog.EVENTLOG_INFORMATION_TYPE,\n logging.WARNING:win32evtlog.EVENTLOG_WARNING_TYPE,\n logging.ERROR:win32evtlog.EVENTLOG_ERROR_TYPE,\n logging.CRITICAL:win32evtlog.EVENTLOG_ERROR_TYPE,\n }\n except ImportError:\n print(\"The Python Win32 extensions for NT (service, event \"\\\n \"logging) appear not to be available.\")\n self._welu=None\n \n def getMessageID(self,record):\n ''\n\n\n\n\n\n \n return 1\n \n def getEventCategory(self,record):\n ''\n\n\n\n\n \n return 0\n \n def getEventType(self,record):\n ''\n\n\n\n\n\n\n\n\n \n return self.typemap.get(record.levelno,self.deftype)\n \n def emit(self,record):\n ''\n\n\n\n\n \n if self._welu:\n try :\n id=self.getMessageID(record)\n cat=self.getEventCategory(record)\n type=self.getEventType(record)\n msg=self.format(record)\n self._welu.ReportEvent(self.appname,id,cat,type,[msg])\n except Exception:\n self.handleError(record)\n \n def close(self):\n ''\n\n\n\n\n\n\n\n \n \n logging.Handler.close(self)\n \nclass HTTPHandler(logging.Handler):\n ''\n\n\n \n def __init__(self,host,url,method=\"GET\",secure=False ,credentials=None ,\n context=None ):\n ''\n\n\n \n logging.Handler.__init__(self)\n method=method.upper()\n if method not in [\"GET\",\"POST\"]:\n raise ValueError(\"method must be GET or POST\")\n if not secure and context is not None :\n raise ValueError(\"context parameter only makes sense \"\n \"with secure=True\")\n self.host=host\n self.url=url\n self.method=method\n self.secure=secure\n self.credentials=credentials\n self.context=context\n \n def mapLogRecord(self,record):\n ''\n\n\n\n \n return record.__dict__\n \n def getConnection(self,host,secure):\n ''\n\n\n\n\n \n import http.client\n if secure:\n connection=http.client.HTTPSConnection(host,context=self.context)\n else :\n connection=http.client.HTTPConnection(host)\n return connection\n \n def emit(self,record):\n ''\n\n\n\n \n try :\n import urllib.parse\n host=self.host\n h=self.getConnection(host,self.secure)\n url=self.url\n data=urllib.parse.urlencode(self.mapLogRecord(record))\n if self.method ==\"GET\":\n if (url.find('?')>=0):\n sep='&'\n else :\n sep='?'\n url=url+\"%c%s\"%(sep,data)\n h.putrequest(self.method,url)\n \n \n i=host.find(\":\")\n if i >=0:\n host=host[:i]\n \n \n \n if self.method ==\"POST\":\n h.putheader(\"Content-type\",\n \"application/x-www-form-urlencoded\")\n h.putheader(\"Content-length\",str(len(data)))\n if self.credentials:\n import base64\n s=('%s:%s'%self.credentials).encode('utf-8')\n s='Basic '+base64.b64encode(s).strip().decode('ascii')\n h.putheader('Authorization',s)\n h.endheaders()\n if self.method ==\"POST\":\n h.send(data.encode('utf-8'))\n h.getresponse()\n except Exception:\n self.handleError(record)\n \nclass BufferingHandler(logging.Handler):\n ''\n\n\n\n \n def __init__(self,capacity):\n ''\n\n \n logging.Handler.__init__(self)\n self.capacity=capacity\n self.buffer=[]\n \n def shouldFlush(self,record):\n ''\n\n\n\n\n \n return (len(self.buffer)>=self.capacity)\n \n def emit(self,record):\n ''\n\n\n\n\n \n self.buffer.append(record)\n if self.shouldFlush(record):\n self.flush()\n \n def flush(self):\n ''\n\n\n\n \n self.acquire()\n try :\n self.buffer.clear()\n finally :\n self.release()\n \n def close(self):\n ''\n\n\n\n \n try :\n self.flush()\n finally :\n logging.Handler.close(self)\n \nclass MemoryHandler(BufferingHandler):\n ''\n\n\n\n \n def __init__(self,capacity,flushLevel=logging.ERROR,target=None ,\n flushOnClose=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n \n BufferingHandler.__init__(self,capacity)\n self.flushLevel=flushLevel\n self.target=target\n \n self.flushOnClose=flushOnClose\n \n def shouldFlush(self,record):\n ''\n\n \n return (len(self.buffer)>=self.capacity)or\\\n (record.levelno >=self.flushLevel)\n \n def setTarget(self,target):\n ''\n\n \n self.acquire()\n try :\n self.target=target\n finally :\n self.release()\n \n def flush(self):\n ''\n\n\n\n\n\n \n self.acquire()\n try :\n if self.target:\n for record in self.buffer:\n self.target.handle(record)\n self.buffer.clear()\n finally :\n self.release()\n \n def close(self):\n ''\n\n\n \n try :\n if self.flushOnClose:\n self.flush()\n finally :\n self.acquire()\n try :\n self.target=None\n BufferingHandler.close(self)\n finally :\n self.release()\n \n \nclass QueueHandler(logging.Handler):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,queue):\n ''\n\n \n logging.Handler.__init__(self)\n self.queue=queue\n \n def enqueue(self,record):\n ''\n\n\n\n\n\n \n self.queue.put_nowait(record)\n \n def prepare(self,record):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n msg=self.format(record)\n \n record=copy.copy(record)\n record.message=msg\n record.msg=msg\n record.args=None\n record.exc_info=None\n record.exc_text=None\n record.stack_info=None\n return record\n \n def emit(self,record):\n ''\n\n\n\n \n try :\n self.enqueue(self.prepare(record))\n except Exception:\n self.handleError(record)\n \n \nclass QueueListener(object):\n ''\n\n\n\n \n _sentinel=None\n \n def __init__(self,queue,*handlers,respect_handler_level=False ):\n ''\n\n\n \n self.queue=queue\n self.handlers=handlers\n self._thread=None\n self.respect_handler_level=respect_handler_level\n \n def dequeue(self,block):\n ''\n\n\n\n\n \n return self.queue.get(block)\n \n def start(self):\n ''\n\n\n\n\n \n self._thread=t=threading.Thread(target=self._monitor)\n t.daemon=True\n t.start()\n \n def prepare(self,record):\n ''\n\n\n\n\n\n \n return record\n \n def handle(self,record):\n ''\n\n\n\n\n \n record=self.prepare(record)\n for handler in self.handlers:\n if not self.respect_handler_level:\n process=True\n else :\n process=record.levelno >=handler.level\n if process:\n handler.handle(record)\n \n def _monitor(self):\n ''\n\n\n\n\n\n \n q=self.queue\n has_task_done=hasattr(q,'task_done')\n while True :\n try :\n record=self.dequeue(True )\n if record is self._sentinel:\n if has_task_done:\n q.task_done()\n break\n self.handle(record)\n if has_task_done:\n q.task_done()\n except queue.Empty:\n break\n \n def enqueue_sentinel(self):\n ''\n\n\n\n\n\n \n self.queue.put_nowait(self._sentinel)\n \n def stop(self):\n ''\n\n\n\n\n\n \n self.enqueue_sentinel()\n self._thread.join()\n self._thread=None\n", ["base64", "copy", "email.message", "email.utils", "http.client", "io", "logging", "os", "pickle", "queue", "re", "smtplib", "socket", "stat", "struct", "threading", "time", "urllib.parse", "win32evtlog", "win32evtlogutil"]], "logging": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"\"\nLogging package for Python. Based on PEP 282 and comments thereto in\ncomp.lang.python.\n\nCopyright (C) 2001-2019 Vinay Sajip. All Rights Reserved.\n\nTo use, simply 'import logging' and log away!\n\"\"\"\n\nimport sys,os,time,io,re,traceback,warnings,weakref,collections.abc\n\nfrom string import Template\nfrom string import Formatter as StrFormatter\n\n\n__all__=['BASIC_FORMAT','BufferingFormatter','CRITICAL','DEBUG','ERROR',\n'FATAL','FileHandler','Filter','Formatter','Handler','INFO',\n'LogRecord','Logger','LoggerAdapter','NOTSET','NullHandler',\n'StreamHandler','WARN','WARNING','addLevelName','basicConfig',\n'captureWarnings','critical','debug','disable','error',\n'exception','fatal','getLevelName','getLogger','getLoggerClass',\n'info','log','makeLogRecord','setLoggerClass','shutdown',\n'warn','warning','getLogRecordFactory','setLogRecordFactory',\n'lastResort','raiseExceptions']\n\nimport threading\n\n__author__=\"Vinay Sajip \"\n__status__=\"production\"\n\n__version__=\"0.5.1.2\"\n__date__=\"07 February 2010\"\n\n\n\n\n\n\n\n\n_startTime=time.time()\n\n\n\n\n\nraiseExceptions=True\n\n\n\n\nlogThreads=True\n\n\n\n\nlogMultiprocessing=True\n\n\n\n\nlogProcesses=True\n\n\n\n\n\n\n\n\n\n\n\n\nCRITICAL=50\nFATAL=CRITICAL\nERROR=40\nWARNING=30\nWARN=WARNING\nINFO=20\nDEBUG=10\nNOTSET=0\n\n_levelToName={\nCRITICAL:'CRITICAL',\nERROR:'ERROR',\nWARNING:'WARNING',\nINFO:'INFO',\nDEBUG:'DEBUG',\nNOTSET:'NOTSET',\n}\n_nameToLevel={\n'CRITICAL':CRITICAL,\n'FATAL':FATAL,\n'ERROR':ERROR,\n'WARN':WARNING,\n'WARNING':WARNING,\n'INFO':INFO,\n'DEBUG':DEBUG,\n'NOTSET':NOTSET,\n}\n\ndef getLevelName(level):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n result=_levelToName.get(level)\n if result is not None :\n return result\n result=_nameToLevel.get(level)\n if result is not None :\n return result\n return \"Level %s\"%level\n \ndef addLevelName(level,levelName):\n ''\n\n\n\n \n _acquireLock()\n try :\n _levelToName[level]=levelName\n _nameToLevel[levelName]=level\n finally :\n _releaseLock()\n \nif hasattr(sys,'_getframe'):\n currentframe=lambda :sys._getframe(3)\nelse :\n def currentframe():\n ''\n try :\n raise Exception\n except Exception:\n return sys.exc_info()[2].tb_frame.f_back\n \n \n \n \n \n \n \n \n \n \n \n \n \n_srcfile=os.path.normcase(addLevelName.__code__.co_filename)\n\n\n\n\n\n\n\n\n\n\n\ndef _checkLevel(level):\n if isinstance(level,int):\n rv=level\n elif str(level)==level:\n if level not in _nameToLevel:\n raise ValueError(\"Unknown level: %r\"%level)\n rv=_nameToLevel[level]\n else :\n raise TypeError(\"Level not an integer or a valid string: %r\"%level)\n return rv\n \n \n \n \n \n \n \n \n \n \n \n \n \n_lock=threading.RLock()\n\ndef _acquireLock():\n ''\n\n\n\n \n if _lock:\n _lock.acquire()\n \ndef _releaseLock():\n ''\n\n \n if _lock:\n _lock.release()\n \n \n \n \nif not hasattr(os,'register_at_fork'):\n def _register_at_fork_reinit_lock(instance):\n pass\nelse :\n\n\n\n _at_fork_reinit_lock_weakset=weakref.WeakSet()\n \n def _register_at_fork_reinit_lock(instance):\n _acquireLock()\n try :\n _at_fork_reinit_lock_weakset.add(instance)\n finally :\n _releaseLock()\n \n def _after_at_fork_child_reinit_locks():\n for handler in _at_fork_reinit_lock_weakset:\n handler._at_fork_reinit()\n \n \n \n _lock._at_fork_reinit()\n \n os.register_at_fork(before=_acquireLock,\n after_in_child=_after_at_fork_child_reinit_locks,\n after_in_parent=_releaseLock)\n \n \n \n \n \n \nclass LogRecord(object):\n ''\n\n\n\n\n\n\n\n\n\n \n def __init__(self,name,level,pathname,lineno,\n msg,args,exc_info,func=None ,sinfo=None ,**kwargs):\n ''\n\n \n ct=time.time()\n self.name=name\n self.msg=msg\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if (args and len(args)==1 and isinstance(args[0],collections.abc.Mapping)\n and args[0]):\n args=args[0]\n self.args=args\n self.levelname=getLevelName(level)\n self.levelno=level\n self.pathname=pathname\n try :\n self.filename=os.path.basename(pathname)\n self.module=os.path.splitext(self.filename)[0]\n except (TypeError,ValueError,AttributeError):\n self.filename=pathname\n self.module=\"Unknown module\"\n self.exc_info=exc_info\n self.exc_text=None\n self.stack_info=sinfo\n self.lineno=lineno\n self.funcName=func\n self.created=ct\n self.msecs=(ct -int(ct))*1000\n self.relativeCreated=(self.created -_startTime)*1000\n if logThreads:\n self.thread=threading.get_ident()\n self.threadName=threading.current_thread().name\n else :\n self.thread=None\n self.threadName=None\n if not logMultiprocessing:\n self.processName=None\n else :\n self.processName='MainProcess'\n mp=sys.modules.get('multiprocessing')\n if mp is not None :\n \n \n \n \n try :\n self.processName=mp.current_process().name\n except Exception:\n pass\n if logProcesses and hasattr(os,'getpid'):\n self.process=os.getpid()\n else :\n self.process=None\n \n def __repr__(self):\n return ''%(self.name,self.levelno,\n self.pathname,self.lineno,self.msg)\n \n def getMessage(self):\n ''\n\n\n\n\n \n msg=str(self.msg)\n if self.args:\n msg=msg %self.args\n return msg\n \n \n \n \n_logRecordFactory=LogRecord\n\ndef setLogRecordFactory(factory):\n ''\n\n\n\n\n \n global _logRecordFactory\n _logRecordFactory=factory\n \ndef getLogRecordFactory():\n ''\n\n \n \n return _logRecordFactory\n \ndef makeLogRecord(dict):\n ''\n\n\n\n\n \n rv=_logRecordFactory(None ,None ,\"\",0,\"\",(),None ,None )\n rv.__dict__.update(dict)\n return rv\n \n \n \n \n \n_str_formatter=StrFormatter()\ndel StrFormatter\n\n\nclass PercentStyle(object):\n\n default_format='%(message)s'\n asctime_format='%(asctime)s'\n asctime_search='%(asctime)'\n validation_pattern=re.compile(r'%\\(\\w+\\)[#0+ -]*(\\*|\\d+)?(\\.(\\*|\\d+))?[diouxefgcrsa%]',re.I)\n \n def __init__(self,fmt):\n self._fmt=fmt or self.default_format\n \n def usesTime(self):\n return self._fmt.find(self.asctime_search)>=0\n \n def validate(self):\n ''\n if not self.validation_pattern.search(self._fmt):\n raise ValueError(\"Invalid format '%s' for '%s' style\"%(self._fmt,self.default_format[0]))\n \n def _format(self,record):\n return self._fmt %record.__dict__\n \n def format(self,record):\n try :\n return self._format(record)\n except KeyError as e:\n raise ValueError('Formatting field not found in record: %s'%e)\n \n \nclass StrFormatStyle(PercentStyle):\n default_format='{message}'\n asctime_format='{asctime}'\n asctime_search='{asctime'\n \n fmt_spec=re.compile(r'^(.?[<>=^])?[+ -]?#?0?(\\d+|{\\w+})?[,_]?(\\.(\\d+|{\\w+}))?[bcdefgnosx%]?$',re.I)\n field_spec=re.compile(r'^(\\d+|\\w+)(\\.\\w+|\\[[^]]+\\])*$')\n \n def _format(self,record):\n return self._fmt.format(**record.__dict__)\n \n def validate(self):\n ''\n fields=set()\n try :\n for _,fieldname,spec,conversion in _str_formatter.parse(self._fmt):\n if fieldname:\n if not self.field_spec.match(fieldname):\n raise ValueError('invalid field name/expression: %r'%fieldname)\n fields.add(fieldname)\n if conversion and conversion not in 'rsa':\n raise ValueError('invalid conversion: %r'%conversion)\n if spec and not self.fmt_spec.match(spec):\n raise ValueError('bad specifier: %r'%spec)\n except ValueError as e:\n raise ValueError('invalid format: %s'%e)\n if not fields:\n raise ValueError('invalid format: no fields')\n \n \nclass StringTemplateStyle(PercentStyle):\n default_format='${message}'\n asctime_format='${asctime}'\n asctime_search='${asctime}'\n \n def __init__(self,fmt):\n self._fmt=fmt or self.default_format\n self._tpl=Template(self._fmt)\n \n def usesTime(self):\n fmt=self._fmt\n return fmt.find('$asctime')>=0 or fmt.find(self.asctime_format)>=0\n \n def validate(self):\n pattern=Template.pattern\n fields=set()\n for m in pattern.finditer(self._fmt):\n d=m.groupdict()\n if d['named']:\n fields.add(d['named'])\n elif d['braced']:\n fields.add(d['braced'])\n elif m.group(0)=='$':\n raise ValueError('invalid format: bare \\'$\\' not allowed')\n if not fields:\n raise ValueError('invalid format: no fields')\n \n def _format(self,record):\n return self._tpl.substitute(**record.__dict__)\n \n \nBASIC_FORMAT=\"%(levelname)s:%(name)s:%(message)s\"\n\n_STYLES={\n'%':(PercentStyle,BASIC_FORMAT),\n'{':(StrFormatStyle,'{levelname}:{name}:{message}'),\n'$':(StringTemplateStyle,'${levelname}:${name}:${message}'),\n}\n\nclass Formatter(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n converter=time.localtime\n \n def __init__(self,fmt=None ,datefmt=None ,style='%',validate=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if style not in _STYLES:\n raise ValueError('Style must be one of: %s'%','.join(\n _STYLES.keys()))\n self._style=_STYLES[style][0](fmt)\n if validate:\n self._style.validate()\n \n self._fmt=self._style._fmt\n self.datefmt=datefmt\n \n default_time_format='%Y-%m-%d %H:%M:%S'\n default_msec_format='%s,%03d'\n \n def formatTime(self,record,datefmt=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n ct=self.converter(record.created)\n if datefmt:\n s=time.strftime(datefmt,ct)\n else :\n s=time.strftime(self.default_time_format,ct)\n if self.default_msec_format:\n s=self.default_msec_format %(s,record.msecs)\n return s\n \n def formatException(self,ei):\n ''\n\n\n\n\n \n sio=io.StringIO()\n tb=ei[2]\n \n \n \n traceback.print_exception(ei[0],ei[1],tb,None ,sio)\n s=sio.getvalue()\n sio.close()\n if s[-1:]==\"\\n\":\n s=s[:-1]\n return s\n \n def usesTime(self):\n ''\n\n \n return self._style.usesTime()\n \n def formatMessage(self,record):\n return self._style.format(record)\n \n def formatStack(self,stack_info):\n ''\n\n\n\n\n\n\n\n\n \n return stack_info\n \n def format(self,record):\n ''\n\n\n\n\n\n\n\n\n\n\n \n record.message=record.getMessage()\n if self.usesTime():\n record.asctime=self.formatTime(record,self.datefmt)\n s=self.formatMessage(record)\n if record.exc_info:\n \n \n if not record.exc_text:\n record.exc_text=self.formatException(record.exc_info)\n if record.exc_text:\n if s[-1:]!=\"\\n\":\n s=s+\"\\n\"\n s=s+record.exc_text\n if record.stack_info:\n if s[-1:]!=\"\\n\":\n s=s+\"\\n\"\n s=s+self.formatStack(record.stack_info)\n return s\n \n \n \n \n_defaultFormatter=Formatter()\n\nclass BufferingFormatter(object):\n ''\n\n \n def __init__(self,linefmt=None ):\n ''\n\n\n \n if linefmt:\n self.linefmt=linefmt\n else :\n self.linefmt=_defaultFormatter\n \n def formatHeader(self,records):\n ''\n\n \n return \"\"\n \n def formatFooter(self,records):\n ''\n\n \n return \"\"\n \n def format(self,records):\n ''\n\n \n rv=\"\"\n if len(records)>0:\n rv=rv+self.formatHeader(records)\n for record in records:\n rv=rv+self.linefmt.format(record)\n rv=rv+self.formatFooter(records)\n return rv\n \n \n \n \n \nclass Filter(object):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,name=''):\n ''\n\n\n\n\n\n \n self.name=name\n self.nlen=len(name)\n \n def filter(self,record):\n ''\n\n\n\n\n \n if self.nlen ==0:\n return True\n elif self.name ==record.name:\n return True\n elif record.name.find(self.name,0,self.nlen)!=0:\n return False\n return (record.name[self.nlen]==\".\")\n \nclass Filterer(object):\n ''\n\n\n \n def __init__(self):\n ''\n\n \n self.filters=[]\n \n def addFilter(self,filter):\n ''\n\n \n if not (filter in self.filters):\n self.filters.append(filter)\n \n def removeFilter(self,filter):\n ''\n\n \n if filter in self.filters:\n self.filters.remove(filter)\n \n def filter(self,record):\n ''\n\n\n\n\n\n\n\n\n\n \n rv=True\n for f in self.filters:\n if hasattr(f,'filter'):\n result=f.filter(record)\n else :\n result=f(record)\n if not result:\n rv=False\n break\n return rv\n \n \n \n \n \n_handlers=weakref.WeakValueDictionary()\n_handlerList=[]\n\ndef _removeHandlerRef(wr):\n ''\n\n \n \n \n \n \n acquire,release,handlers=_acquireLock,_releaseLock,_handlerList\n if acquire and release and handlers:\n acquire()\n try :\n if wr in handlers:\n handlers.remove(wr)\n finally :\n release()\n \ndef _addHandlerRef(handler):\n ''\n\n \n _acquireLock()\n try :\n _handlerList.append(weakref.ref(handler,_removeHandlerRef))\n finally :\n _releaseLock()\n \nclass Handler(Filterer):\n ''\n\n\n\n\n\n\n \n def __init__(self,level=NOTSET):\n ''\n\n\n \n Filterer.__init__(self)\n self._name=None\n self.level=_checkLevel(level)\n self.formatter=None\n \n _addHandlerRef(self)\n self.createLock()\n \n def get_name(self):\n return self._name\n \n def set_name(self,name):\n _acquireLock()\n try :\n if self._name in _handlers:\n del _handlers[self._name]\n self._name=name\n if name:\n _handlers[name]=self\n finally :\n _releaseLock()\n \n name=property(get_name,set_name)\n \n def createLock(self):\n ''\n\n \n self.lock=threading.RLock()\n _register_at_fork_reinit_lock(self)\n \n def _at_fork_reinit(self):\n self.lock._at_fork_reinit()\n \n def acquire(self):\n ''\n\n \n if self.lock:\n self.lock.acquire()\n \n def release(self):\n ''\n\n \n if self.lock:\n self.lock.release()\n \n def setLevel(self,level):\n ''\n\n \n self.level=_checkLevel(level)\n \n def format(self,record):\n ''\n\n\n\n\n \n if self.formatter:\n fmt=self.formatter\n else :\n fmt=_defaultFormatter\n return fmt.format(record)\n \n def emit(self,record):\n ''\n\n\n\n\n \n raise NotImplementedError('emit must be implemented '\n 'by Handler subclasses')\n \n def handle(self,record):\n ''\n\n\n\n\n\n\n \n rv=self.filter(record)\n if rv:\n self.acquire()\n try :\n self.emit(record)\n finally :\n self.release()\n return rv\n \n def setFormatter(self,fmt):\n ''\n\n \n self.formatter=fmt\n \n def flush(self):\n ''\n\n\n\n\n \n pass\n \n def close(self):\n ''\n\n\n\n\n\n\n \n \n _acquireLock()\n try :\n if self._name and self._name in _handlers:\n del _handlers[self._name]\n finally :\n _releaseLock()\n \n def handleError(self,record):\n ''\n\n\n\n\n\n\n\n\n\n \n if raiseExceptions and sys.stderr:\n t,v,tb=sys.exc_info()\n try :\n sys.stderr.write('--- Logging error ---\\n')\n traceback.print_exception(t,v,tb,None ,sys.stderr)\n sys.stderr.write('Call stack:\\n')\n \n \n frame=tb.tb_frame\n while (frame and os.path.dirname(frame.f_code.co_filename)==\n __path__[0]):\n frame=frame.f_back\n if frame:\n traceback.print_stack(frame,file=sys.stderr)\n else :\n \n sys.stderr.write('Logged from file %s, line %s\\n'%(\n record.filename,record.lineno))\n \n try :\n sys.stderr.write('Message: %r\\n'\n 'Arguments: %s\\n'%(record.msg,\n record.args))\n except RecursionError:\n raise\n except Exception:\n sys.stderr.write('Unable to print the message and arguments'\n ' - possible formatting error.\\nUse the'\n ' traceback above to help find the error.\\n'\n )\n except OSError:\n pass\n finally :\n del t,v,tb\n \n def __repr__(self):\n level=getLevelName(self.level)\n return '<%s (%s)>'%(self.__class__.__name__,level)\n \nclass StreamHandler(Handler):\n ''\n\n\n\n \n \n terminator='\\n'\n \n def __init__(self,stream=None ):\n ''\n\n\n\n \n Handler.__init__(self)\n if stream is None :\n stream=sys.stderr\n self.stream=stream\n \n def flush(self):\n ''\n\n \n self.acquire()\n try :\n if self.stream and hasattr(self.stream,\"flush\"):\n self.stream.flush()\n finally :\n self.release()\n \n def emit(self,record):\n ''\n\n\n\n\n\n\n\n\n \n try :\n msg=self.format(record)\n stream=self.stream\n \n stream.write(msg+self.terminator)\n self.flush()\n except RecursionError:\n raise\n except Exception:\n self.handleError(record)\n \n def setStream(self,stream):\n ''\n\n\n\n\n\n \n if stream is self.stream:\n result=None\n else :\n result=self.stream\n self.acquire()\n try :\n self.flush()\n self.stream=stream\n finally :\n self.release()\n return result\n \n def __repr__(self):\n level=getLevelName(self.level)\n name=getattr(self.stream,'name','')\n \n name=str(name)\n if name:\n name +=' '\n return '<%s %s(%s)>'%(self.__class__.__name__,name,level)\n \n \nclass FileHandler(StreamHandler):\n ''\n\n \n def __init__(self,filename,mode='a',encoding=None ,delay=False ,errors=None ):\n ''\n\n \n \n filename=os.fspath(filename)\n \n \n self.baseFilename=os.path.abspath(filename)\n self.mode=mode\n self.encoding=encoding\n self.errors=errors\n self.delay=delay\n if delay:\n \n \n Handler.__init__(self)\n self.stream=None\n else :\n StreamHandler.__init__(self,self._open())\n \n def close(self):\n ''\n\n \n self.acquire()\n try :\n try :\n if self.stream:\n try :\n self.flush()\n finally :\n stream=self.stream\n self.stream=None\n if hasattr(stream,\"close\"):\n stream.close()\n finally :\n \n \n StreamHandler.close(self)\n finally :\n self.release()\n \n def _open(self):\n ''\n\n\n \n return open(self.baseFilename,self.mode,encoding=self.encoding,\n errors=self.errors)\n \n def emit(self,record):\n ''\n\n\n\n\n \n if self.stream is None :\n self.stream=self._open()\n StreamHandler.emit(self,record)\n \n def __repr__(self):\n level=getLevelName(self.level)\n return '<%s %s (%s)>'%(self.__class__.__name__,self.baseFilename,level)\n \n \nclass _StderrHandler(StreamHandler):\n ''\n\n\n\n \n def __init__(self,level=NOTSET):\n ''\n\n \n Handler.__init__(self,level)\n \n @property\n def stream(self):\n return sys.stderr\n \n \n_defaultLastResort=_StderrHandler(WARNING)\nlastResort=_defaultLastResort\n\n\n\n\n\nclass PlaceHolder(object):\n ''\n\n\n\n \n def __init__(self,alogger):\n ''\n\n \n self.loggerMap={alogger:None }\n \n def append(self,alogger):\n ''\n\n \n if alogger not in self.loggerMap:\n self.loggerMap[alogger]=None\n \n \n \n \n \ndef setLoggerClass(klass):\n ''\n\n\n\n \n if klass !=Logger:\n if not issubclass(klass,Logger):\n raise TypeError(\"logger not derived from logging.Logger: \"\n +klass.__name__)\n global _loggerClass\n _loggerClass=klass\n \ndef getLoggerClass():\n ''\n\n \n return _loggerClass\n \nclass Manager(object):\n ''\n\n\n \n def __init__(self,rootnode):\n ''\n\n \n self.root=rootnode\n self.disable=0\n self.emittedNoHandlerWarning=False\n self.loggerDict={}\n self.loggerClass=None\n self.logRecordFactory=None\n \n def getLogger(self,name):\n ''\n\n\n\n\n\n\n\n\n \n rv=None\n if not isinstance(name,str):\n raise TypeError('A logger name must be a string')\n _acquireLock()\n try :\n if name in self.loggerDict:\n rv=self.loggerDict[name]\n if isinstance(rv,PlaceHolder):\n ph=rv\n rv=(self.loggerClass or _loggerClass)(name)\n rv.manager=self\n self.loggerDict[name]=rv\n self._fixupChildren(ph,rv)\n self._fixupParents(rv)\n else :\n rv=(self.loggerClass or _loggerClass)(name)\n rv.manager=self\n self.loggerDict[name]=rv\n self._fixupParents(rv)\n finally :\n _releaseLock()\n return rv\n \n def setLoggerClass(self,klass):\n ''\n\n \n if klass !=Logger:\n if not issubclass(klass,Logger):\n raise TypeError(\"logger not derived from logging.Logger: \"\n +klass.__name__)\n self.loggerClass=klass\n \n def setLogRecordFactory(self,factory):\n ''\n\n\n \n self.logRecordFactory=factory\n \n def _fixupParents(self,alogger):\n ''\n\n\n \n name=alogger.name\n i=name.rfind(\".\")\n rv=None\n while (i >0)and not rv:\n substr=name[:i]\n if substr not in self.loggerDict:\n self.loggerDict[substr]=PlaceHolder(alogger)\n else :\n obj=self.loggerDict[substr]\n if isinstance(obj,Logger):\n rv=obj\n else :\n assert isinstance(obj,PlaceHolder)\n obj.append(alogger)\n i=name.rfind(\".\",0,i -1)\n if not rv:\n rv=self.root\n alogger.parent=rv\n \n def _fixupChildren(self,ph,alogger):\n ''\n\n\n \n name=alogger.name\n namelen=len(name)\n for c in ph.loggerMap.keys():\n \n if c.parent.name[:namelen]!=name:\n alogger.parent=c.parent\n c.parent=alogger\n \n def _clear_cache(self):\n ''\n\n\n \n \n _acquireLock()\n for logger in self.loggerDict.values():\n if isinstance(logger,Logger):\n logger._cache.clear()\n self.root._cache.clear()\n _releaseLock()\n \n \n \n \n \nclass Logger(Filterer):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,name,level=NOTSET):\n ''\n\n \n Filterer.__init__(self)\n self.name=name\n self.level=_checkLevel(level)\n self.parent=None\n self.propagate=True\n self.handlers=[]\n self.disabled=False\n self._cache={}\n \n def setLevel(self,level):\n ''\n\n \n self.level=_checkLevel(level)\n self.manager._clear_cache()\n \n def debug(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(DEBUG):\n self._log(DEBUG,msg,args,**kwargs)\n \n def info(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(INFO):\n self._log(INFO,msg,args,**kwargs)\n \n def warning(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(WARNING):\n self._log(WARNING,msg,args,**kwargs)\n \n def warn(self,msg,*args,**kwargs):\n warnings.warn(\"The 'warn' method is deprecated, \"\n \"use 'warning' instead\",DeprecationWarning,2)\n self.warning(msg,*args,**kwargs)\n \n def error(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(ERROR):\n self._log(ERROR,msg,args,**kwargs)\n \n def exception(self,msg,*args,exc_info=True ,**kwargs):\n ''\n\n \n self.error(msg,*args,exc_info=exc_info,**kwargs)\n \n def critical(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(CRITICAL):\n self._log(CRITICAL,msg,args,**kwargs)\n \n fatal=critical\n \n def log(self,level,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if not isinstance(level,int):\n if raiseExceptions:\n raise TypeError(\"level must be an integer\")\n else :\n return\n if self.isEnabledFor(level):\n self._log(level,msg,args,**kwargs)\n \n def findCaller(self,stack_info=False ,stacklevel=1):\n ''\n\n\n \n f=currentframe()\n \n \n if f is not None :\n f=f.f_back\n orig_f=f\n while f and stacklevel >1:\n f=f.f_back\n stacklevel -=1\n if not f:\n f=orig_f\n rv=\"(unknown file)\",0,\"(unknown function)\",None\n while hasattr(f,\"f_code\"):\n co=f.f_code\n filename=os.path.normcase(co.co_filename)\n if filename ==_srcfile:\n f=f.f_back\n continue\n sinfo=None\n if stack_info:\n sio=io.StringIO()\n sio.write('Stack (most recent call last):\\n')\n traceback.print_stack(f,file=sio)\n sinfo=sio.getvalue()\n if sinfo[-1]=='\\n':\n sinfo=sinfo[:-1]\n sio.close()\n rv=(co.co_filename,f.f_lineno,co.co_name,sinfo)\n break\n return rv\n \n def makeRecord(self,name,level,fn,lno,msg,args,exc_info,\n func=None ,extra=None ,sinfo=None ):\n ''\n\n\n \n rv=_logRecordFactory(name,level,fn,lno,msg,args,exc_info,func,\n sinfo)\n if extra is not None :\n for key in extra:\n if (key in [\"message\",\"asctime\"])or (key in rv.__dict__):\n raise KeyError(\"Attempt to overwrite %r in LogRecord\"%key)\n rv.__dict__[key]=extra[key]\n return rv\n \n def _log(self,level,msg,args,exc_info=None ,extra=None ,stack_info=False ,\n stacklevel=1):\n ''\n\n\n \n sinfo=None\n if _srcfile:\n \n \n \n try :\n fn,lno,func,sinfo=self.findCaller(stack_info,stacklevel)\n except ValueError:\n fn,lno,func=\"(unknown file)\",0,\"(unknown function)\"\n else :\n fn,lno,func=\"(unknown file)\",0,\"(unknown function)\"\n if exc_info:\n if isinstance(exc_info,BaseException):\n exc_info=(type(exc_info),exc_info,exc_info.__traceback__)\n elif not isinstance(exc_info,tuple):\n exc_info=sys.exc_info()\n record=self.makeRecord(self.name,level,fn,lno,msg,args,\n exc_info,func,extra,sinfo)\n self.handle(record)\n \n def handle(self,record):\n ''\n\n\n\n\n \n if (not self.disabled)and self.filter(record):\n self.callHandlers(record)\n \n def addHandler(self,hdlr):\n ''\n\n \n _acquireLock()\n try :\n if not (hdlr in self.handlers):\n self.handlers.append(hdlr)\n finally :\n _releaseLock()\n \n def removeHandler(self,hdlr):\n ''\n\n \n _acquireLock()\n try :\n if hdlr in self.handlers:\n self.handlers.remove(hdlr)\n finally :\n _releaseLock()\n \n def hasHandlers(self):\n ''\n\n\n\n\n\n\n\n \n c=self\n rv=False\n while c:\n if c.handlers:\n rv=True\n break\n if not c.propagate:\n break\n else :\n c=c.parent\n return rv\n \n def callHandlers(self,record):\n ''\n\n\n\n\n\n\n\n \n c=self\n found=0\n while c:\n for hdlr in c.handlers:\n found=found+1\n if record.levelno >=hdlr.level:\n hdlr.handle(record)\n if not c.propagate:\n c=None\n else :\n c=c.parent\n if (found ==0):\n if lastResort:\n if record.levelno >=lastResort.level:\n lastResort.handle(record)\n elif raiseExceptions and not self.manager.emittedNoHandlerWarning:\n sys.stderr.write(\"No handlers could be found for logger\"\n \" \\\"%s\\\"\\n\"%self.name)\n self.manager.emittedNoHandlerWarning=True\n \n def getEffectiveLevel(self):\n ''\n\n\n\n\n \n logger=self\n while logger:\n if logger.level:\n return logger.level\n logger=logger.parent\n return NOTSET\n \n def isEnabledFor(self,level):\n ''\n\n \n if self.disabled:\n return False\n \n try :\n return self._cache[level]\n except KeyError:\n _acquireLock()\n try :\n if self.manager.disable >=level:\n is_enabled=self._cache[level]=False\n else :\n is_enabled=self._cache[level]=(\n level >=self.getEffectiveLevel()\n )\n finally :\n _releaseLock()\n return is_enabled\n \n def getChild(self,suffix):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self.root is not self:\n suffix='.'.join((self.name,suffix))\n return self.manager.getLogger(suffix)\n \n def __repr__(self):\n level=getLevelName(self.getEffectiveLevel())\n return '<%s %s (%s)>'%(self.__class__.__name__,self.name,level)\n \n def __reduce__(self):\n \n \n if getLogger(self.name)is not self:\n import pickle\n raise pickle.PicklingError('logger cannot be pickled')\n return getLogger,(self.name,)\n \n \nclass RootLogger(Logger):\n ''\n\n\n\n \n def __init__(self,level):\n ''\n\n \n Logger.__init__(self,\"root\",level)\n \n def __reduce__(self):\n return getLogger,()\n \n_loggerClass=Logger\n\nclass LoggerAdapter(object):\n ''\n\n\n \n \n def __init__(self,logger,extra):\n ''\n\n\n\n\n\n\n\n\n \n self.logger=logger\n self.extra=extra\n \n def process(self,msg,kwargs):\n ''\n\n\n\n\n\n\n\n \n kwargs[\"extra\"]=self.extra\n return msg,kwargs\n \n \n \n \n def debug(self,msg,*args,**kwargs):\n ''\n\n \n self.log(DEBUG,msg,*args,**kwargs)\n \n def info(self,msg,*args,**kwargs):\n ''\n\n \n self.log(INFO,msg,*args,**kwargs)\n \n def warning(self,msg,*args,**kwargs):\n ''\n\n \n self.log(WARNING,msg,*args,**kwargs)\n \n def warn(self,msg,*args,**kwargs):\n warnings.warn(\"The 'warn' method is deprecated, \"\n \"use 'warning' instead\",DeprecationWarning,2)\n self.warning(msg,*args,**kwargs)\n \n def error(self,msg,*args,**kwargs):\n ''\n\n \n self.log(ERROR,msg,*args,**kwargs)\n \n def exception(self,msg,*args,exc_info=True ,**kwargs):\n ''\n\n \n self.log(ERROR,msg,*args,exc_info=exc_info,**kwargs)\n \n def critical(self,msg,*args,**kwargs):\n ''\n\n \n self.log(CRITICAL,msg,*args,**kwargs)\n \n def log(self,level,msg,*args,**kwargs):\n ''\n\n\n \n if self.isEnabledFor(level):\n msg,kwargs=self.process(msg,kwargs)\n self.logger.log(level,msg,*args,**kwargs)\n \n def isEnabledFor(self,level):\n ''\n\n \n return self.logger.isEnabledFor(level)\n \n def setLevel(self,level):\n ''\n\n \n self.logger.setLevel(level)\n \n def getEffectiveLevel(self):\n ''\n\n \n return self.logger.getEffectiveLevel()\n \n def hasHandlers(self):\n ''\n\n \n return self.logger.hasHandlers()\n \n def _log(self,level,msg,args,exc_info=None ,extra=None ,stack_info=False ):\n ''\n\n \n return self.logger._log(\n level,\n msg,\n args,\n exc_info=exc_info,\n extra=extra,\n stack_info=stack_info,\n )\n \n @property\n def manager(self):\n return self.logger.manager\n \n @manager.setter\n def manager(self,value):\n self.logger.manager=value\n \n @property\n def name(self):\n return self.logger.name\n \n def __repr__(self):\n logger=self.logger\n level=getLevelName(logger.getEffectiveLevel())\n return '<%s %s (%s)>'%(self.__class__.__name__,logger.name,level)\n \nroot=RootLogger(WARNING)\nLogger.root=root\nLogger.manager=Manager(Logger.root)\n\n\n\n\n\ndef basicConfig(**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n _acquireLock()\n try :\n force=kwargs.pop('force',False )\n encoding=kwargs.pop('encoding',None )\n errors=kwargs.pop('errors','backslashreplace')\n if force:\n for h in root.handlers[:]:\n root.removeHandler(h)\n h.close()\n if len(root.handlers)==0:\n handlers=kwargs.pop(\"handlers\",None )\n if handlers is None :\n if \"stream\"in kwargs and \"filename\"in kwargs:\n raise ValueError(\"'stream' and 'filename' should not be \"\n \"specified together\")\n else :\n if \"stream\"in kwargs or \"filename\"in kwargs:\n raise ValueError(\"'stream' or 'filename' should not be \"\n \"specified together with 'handlers'\")\n if handlers is None :\n filename=kwargs.pop(\"filename\",None )\n mode=kwargs.pop(\"filemode\",'a')\n if filename:\n if 'b'in mode:\n errors=None\n h=FileHandler(filename,mode,\n encoding=encoding,errors=errors)\n else :\n stream=kwargs.pop(\"stream\",None )\n h=StreamHandler(stream)\n handlers=[h]\n dfs=kwargs.pop(\"datefmt\",None )\n style=kwargs.pop(\"style\",'%')\n if style not in _STYLES:\n raise ValueError('Style must be one of: %s'%','.join(\n _STYLES.keys()))\n fs=kwargs.pop(\"format\",_STYLES[style][1])\n fmt=Formatter(fs,dfs,style)\n for h in handlers:\n if h.formatter is None :\n h.setFormatter(fmt)\n root.addHandler(h)\n level=kwargs.pop(\"level\",None )\n if level is not None :\n root.setLevel(level)\n if kwargs:\n keys=', '.join(kwargs.keys())\n raise ValueError('Unrecognised argument(s): %s'%keys)\n finally :\n _releaseLock()\n \n \n \n \n \n \ndef getLogger(name=None ):\n ''\n\n\n\n \n if not name or isinstance(name,str)and name ==root.name:\n return root\n return Logger.manager.getLogger(name)\n \ndef critical(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.critical(msg,*args,**kwargs)\n \nfatal=critical\n\ndef error(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.error(msg,*args,**kwargs)\n \ndef exception(msg,*args,exc_info=True ,**kwargs):\n ''\n\n\n\n \n error(msg,*args,exc_info=exc_info,**kwargs)\n \ndef warning(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.warning(msg,*args,**kwargs)\n \ndef warn(msg,*args,**kwargs):\n warnings.warn(\"The 'warn' function is deprecated, \"\n \"use 'warning' instead\",DeprecationWarning,2)\n warning(msg,*args,**kwargs)\n \ndef info(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.info(msg,*args,**kwargs)\n \ndef debug(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.debug(msg,*args,**kwargs)\n \ndef log(level,msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.log(level,msg,*args,**kwargs)\n \ndef disable(level=CRITICAL):\n ''\n\n \n root.manager.disable=level\n root.manager._clear_cache()\n \ndef shutdown(handlerList=_handlerList):\n ''\n\n\n\n\n \n for wr in reversed(handlerList[:]):\n \n \n try :\n h=wr()\n if h:\n try :\n h.acquire()\n h.flush()\n h.close()\n except (OSError,ValueError):\n \n \n \n \n pass\n finally :\n h.release()\n except :\n if raiseExceptions:\n raise\n \n \n \nimport atexit\natexit.register(shutdown)\n\n\n\nclass NullHandler(Handler):\n ''\n\n\n\n\n\n\n\n \n def handle(self,record):\n ''\n \n def emit(self,record):\n ''\n \n def createLock(self):\n self.lock=None\n \n def _at_fork_reinit(self):\n pass\n \n \n \n_warnings_showwarning=None\n\ndef _showwarning(message,category,filename,lineno,file=None ,line=None ):\n ''\n\n\n\n\n\n \n if file is not None :\n if _warnings_showwarning is not None :\n _warnings_showwarning(message,category,filename,lineno,file,line)\n else :\n s=warnings.formatwarning(message,category,filename,lineno,line)\n logger=getLogger(\"py.warnings\")\n if not logger.handlers:\n logger.addHandler(NullHandler())\n logger.warning(\"%s\",s)\n \ndef captureWarnings(capture):\n ''\n\n\n\n \n global _warnings_showwarning\n if capture:\n if _warnings_showwarning is None :\n _warnings_showwarning=warnings.showwarning\n warnings.showwarning=_showwarning\n else :\n if _warnings_showwarning is not None :\n warnings.showwarning=_warnings_showwarning\n _warnings_showwarning=None\n", ["atexit", "collections.abc", "io", "os", "pickle", "re", "string", "sys", "threading", "time", "traceback", "warnings", "weakref"], 1], "multiprocessing.connection": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['Client','Listener','Pipe']\n\nfrom queue import Queue\n\n\nfamilies=[None ]\n\n\nclass Listener(object):\n\n def __init__(self,address=None ,family=None ,backlog=1):\n self._backlog_queue=Queue(backlog)\n \n def accept(self):\n return Connection(*self._backlog_queue.get())\n \n def close(self):\n self._backlog_queue=None\n \n address=property(lambda self:self._backlog_queue)\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,exc_tb):\n self.close()\n \n \ndef Client(address):\n _in,_out=Queue(),Queue()\n address.put((_out,_in))\n return Connection(_in,_out)\n \n \ndef Pipe(duplex=True ):\n a,b=Queue(),Queue()\n return Connection(a,b),Connection(b,a)\n \n \nclass Connection(object):\n\n def __init__(self,_in,_out):\n self._out=_out\n self._in=_in\n self.send=self.send_bytes=_out.put\n self.recv=self.recv_bytes=_in.get\n \n def poll(self,timeout=0.0):\n if self._in.qsize()>0:\n return True\n if timeout <=0.0:\n return False\n self._in.not_empty.acquire()\n self._in.not_empty.wait(timeout)\n self._in.not_empty.release()\n return self._in.qsize()>0\n \n def close(self):\n pass\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,exc_tb):\n self.close()\n", ["queue"]], "multiprocessing.pool": [".py", "\n\n\n\n\n\n\n\n\n__all__=['Pool']\n\n\n\n\n\nimport threading\nimport queue\nimport itertools\nimport collections\nimport time\n\nfrom multiprocessing import Process,cpu_count,TimeoutError\nfrom multiprocessing.util import Finalize,debug\n\n\n\n\n\nRUN=0\nCLOSE=1\nTERMINATE=2\n\n\n\n\n\njob_counter=itertools.count()\n\ndef mapstar(args):\n return list(map(*args))\n \ndef starmapstar(args):\n return list(itertools.starmap(args[0],args[1]))\n \n \n \n \n \nclass MaybeEncodingError(Exception):\n ''\n \n \n def __init__(self,exc,value):\n self.exc=repr(exc)\n self.value=repr(value)\n super(MaybeEncodingError,self).__init__(self.exc,self.value)\n \n def __str__(self):\n return \"Error sending result: '%s'. Reason: '%s'\"%(self.value,\n self.exc)\n \n def __repr__(self):\n return \"\"%str(self)\n \n \ndef worker(inqueue,outqueue,initializer=None ,initargs=(),maxtasks=None ):\n assert maxtasks is None or (type(maxtasks)==int and maxtasks >0)\n put=outqueue.put\n get=inqueue.get\n if hasattr(inqueue,'_writer'):\n inqueue._writer.close()\n outqueue._reader.close()\n \n if initializer is not None :\n initializer(*initargs)\n \n completed=0\n while maxtasks is None or (maxtasks and completed 1\n task_batches=Pool._get_tasks(func,iterable,chunksize)\n result=IMapIterator(self._cache)\n self._taskqueue.put((((result._job,i,mapstar,(x,),{})\n for i,x in enumerate(task_batches)),result._set_length))\n return (item for chunk in result for item in chunk)\n \n def imap_unordered(self,func,iterable,chunksize=1):\n ''\n\n \n if self._state !=RUN:\n raise ValueError(\"Pool not running\")\n if chunksize ==1:\n result=IMapUnorderedIterator(self._cache)\n self._taskqueue.put((((result._job,i,func,(x,),{})\n for i,x in enumerate(iterable)),result._set_length))\n return result\n else :\n assert chunksize >1\n task_batches=Pool._get_tasks(func,iterable,chunksize)\n result=IMapUnorderedIterator(self._cache)\n self._taskqueue.put((((result._job,i,mapstar,(x,),{})\n for i,x in enumerate(task_batches)),result._set_length))\n return (item for chunk in result for item in chunk)\n \n def apply_async(self,func,args=(),kwds={},callback=None ,\n error_callback=None ):\n ''\n\n \n if self._state !=RUN:\n raise ValueError(\"Pool not running\")\n result=ApplyResult(self._cache,callback,error_callback)\n self._taskqueue.put(([(result._job,None ,func,args,kwds)],None ))\n return result\n \n def map_async(self,func,iterable,chunksize=None ,callback=None ,\n error_callback=None ):\n ''\n\n \n return self._map_async(func,iterable,mapstar,chunksize,callback,\n error_callback)\n \n def _map_async(self,func,iterable,mapper,chunksize=None ,callback=None ,\n error_callback=None ):\n ''\n\n \n if self._state !=RUN:\n raise ValueError(\"Pool not running\")\n if not hasattr(iterable,'__len__'):\n iterable=list(iterable)\n \n if chunksize is None :\n chunksize,extra=divmod(len(iterable),len(self._pool)*4)\n if extra:\n chunksize +=1\n if len(iterable)==0:\n chunksize=0\n \n task_batches=Pool._get_tasks(func,iterable,chunksize)\n result=MapResult(self._cache,chunksize,len(iterable),callback,\n error_callback=error_callback)\n self._taskqueue.put((((result._job,i,mapper,(x,),{})\n for i,x in enumerate(task_batches)),None ))\n return result\n \n @staticmethod\n def _handle_workers(pool):\n thread=threading.current_thread()\n \n \n \n while thread._state ==RUN or (pool._cache and thread._state !=TERMINATE):\n pool._maintain_pool()\n time.sleep(0.1)\n \n pool._taskqueue.put(None )\n debug('worker handler exiting')\n \n @staticmethod\n def _handle_tasks(taskqueue,put,outqueue,pool):\n thread=threading.current_thread()\n \n for taskseq,set_length in iter(taskqueue.get,None ):\n i=-1\n for i,task in enumerate(taskseq):\n if thread._state:\n debug('task handler found thread._state != RUN')\n break\n try :\n put(task)\n except IOError:\n debug('could not put task on queue')\n break\n else :\n if set_length:\n debug('doing set_length()')\n set_length(i+1)\n continue\n break\n else :\n debug('task handler got sentinel')\n \n \n try :\n \n debug('task handler sending sentinel to result handler')\n outqueue.put(None )\n \n \n debug('task handler sending sentinel to workers')\n for p in pool:\n put(None )\n except IOError:\n debug('task handler got IOError when sending sentinels')\n \n debug('task handler exiting')\n \n @staticmethod\n def _handle_results(outqueue,get,cache):\n thread=threading.current_thread()\n \n while 1:\n try :\n task=get()\n except (IOError,EOFError):\n debug('result handler got EOFError/IOError -- exiting')\n return\n \n if thread._state:\n assert thread._state ==TERMINATE\n debug('result handler found thread._state=TERMINATE')\n break\n \n if task is None :\n debug('result handler got sentinel')\n break\n \n job,i,obj=task\n try :\n cache[job]._set(i,obj)\n except KeyError:\n pass\n \n while cache and thread._state !=TERMINATE:\n try :\n task=get()\n except (IOError,EOFError):\n debug('result handler got EOFError/IOError -- exiting')\n return\n \n if task is None :\n debug('result handler ignoring extra sentinel')\n continue\n job,i,obj=task\n try :\n cache[job]._set(i,obj)\n except KeyError:\n pass\n \n if hasattr(outqueue,'_reader'):\n debug('ensuring that outqueue is not full')\n \n \n \n try :\n for i in range(10):\n if not outqueue._reader.poll():\n break\n get()\n except (IOError,EOFError):\n pass\n \n debug('result handler exiting: len(cache)=%s, thread._state=%s',\n len(cache),thread._state)\n \n @staticmethod\n def _get_tasks(func,it,size):\n it=iter(it)\n while 1:\n x=tuple(itertools.islice(it,size))\n if not x:\n return\n yield (func,x)\n \n def __reduce__(self):\n raise NotImplementedError(\n 'pool objects cannot be passed between processes or pickled'\n )\n \n def close(self):\n debug('closing pool')\n if self._state ==RUN:\n self._state=CLOSE\n self._worker_handler._state=CLOSE\n \n def terminate(self):\n debug('terminating pool')\n self._state=TERMINATE\n self._worker_handler._state=TERMINATE\n self._terminate()\n \n def join(self):\n debug('joining pool')\n assert self._state in (CLOSE,TERMINATE)\n self._worker_handler.join()\n self._task_handler.join()\n self._result_handler.join()\n for p in self._pool:\n p.join()\n \n @staticmethod\n def _help_stuff_finish(inqueue,task_handler,size):\n \n debug('removing tasks from inqueue until task handler finished')\n inqueue._rlock.acquire()\n while task_handler.is_alive()and inqueue._reader.poll():\n inqueue._reader.recv()\n time.sleep(0)\n \n @classmethod\n def _terminate_pool(cls,taskqueue,inqueue,outqueue,pool,\n worker_handler,task_handler,result_handler,cache):\n \n debug('finalizing pool')\n \n worker_handler._state=TERMINATE\n task_handler._state=TERMINATE\n \n debug('helping task handler/workers to finish')\n cls._help_stuff_finish(inqueue,task_handler,len(pool))\n \n assert result_handler.is_alive()or len(cache)==0\n \n result_handler._state=TERMINATE\n outqueue.put(None )\n \n \n \n debug('joining worker handler')\n if threading.current_thread()is not worker_handler:\n worker_handler.join()\n \n \n if pool and hasattr(pool[0],'terminate'):\n debug('terminating workers')\n for p in pool:\n if p.exitcode is None :\n p.terminate()\n \n debug('joining task handler')\n if threading.current_thread()is not task_handler:\n task_handler.join()\n \n debug('joining result handler')\n if threading.current_thread()is not result_handler:\n result_handler.join()\n \n if pool and hasattr(pool[0],'terminate'):\n debug('joining pool workers')\n for p in pool:\n if p.is_alive():\n \n debug('cleaning up worker %d'%p.pid)\n p.join()\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_val,exc_tb):\n self.terminate()\n \n \n \n \n \nclass ApplyResult(object):\n\n def __init__(self,cache,callback,error_callback):\n self._event=threading.Event()\n self._job=next(job_counter)\n self._cache=cache\n self._callback=callback\n self._error_callback=error_callback\n cache[self._job]=self\n \n def ready(self):\n return self._event.is_set()\n \n def successful(self):\n assert self.ready()\n return self._success\n \n def wait(self,timeout=None ):\n self._event.wait(timeout)\n \n def get(self,timeout=None ):\n self.wait(timeout)\n if not self.ready():\n raise TimeoutError\n if self._success:\n return self._value\n else :\n raise self._value\n \n def _set(self,i,obj):\n self._success,self._value=obj\n if self._callback and self._success:\n self._callback(self._value)\n if self._error_callback and not self._success:\n self._error_callback(self._value)\n self._event.set()\n del self._cache[self._job]\n \nAsyncResult=ApplyResult\n\n\n\n\n\nclass MapResult(ApplyResult):\n\n def __init__(self,cache,chunksize,length,callback,error_callback):\n ApplyResult.__init__(self,cache,callback,\n error_callback=error_callback)\n self._success=True\n self._value=[None ]*length\n self._chunksize=chunksize\n if chunksize <=0:\n self._number_left=0\n self._event.set()\n del cache[self._job]\n else :\n self._number_left=length //chunksize+bool(length %chunksize)\n \n def _set(self,i,success_result):\n success,result=success_result\n if success:\n self._value[i *self._chunksize:(i+1)*self._chunksize]=result\n self._number_left -=1\n if self._number_left ==0:\n if self._callback:\n self._callback(self._value)\n del self._cache[self._job]\n self._event.set()\n else :\n self._success=False\n self._value=result\n if self._error_callback:\n self._error_callback(self._value)\n del self._cache[self._job]\n self._event.set()\n \n \n \n \n \nclass IMapIterator(object):\n\n def __init__(self,cache):\n self._cond=threading.Condition(threading.Lock())\n self._job=next(job_counter)\n self._cache=cache\n self._items=collections.deque()\n self._index=0\n self._length=None\n self._unsorted={}\n cache[self._job]=self\n \n def __iter__(self):\n return self\n \n def next(self,timeout=None ):\n self._cond.acquire()\n try :\n try :\n item=self._items.popleft()\n except IndexError:\n if self._index ==self._length:\n raise StopIteration\n self._cond.wait(timeout)\n try :\n item=self._items.popleft()\n except IndexError:\n if self._index ==self._length:\n raise StopIteration\n raise TimeoutError\n finally :\n self._cond.release()\n \n success,value=item\n if success:\n return value\n raise value\n \n __next__=next\n \n def _set(self,i,obj):\n self._cond.acquire()\n try :\n if self._index ==i:\n self._items.append(obj)\n self._index +=1\n while self._index in self._unsorted:\n obj=self._unsorted.pop(self._index)\n self._items.append(obj)\n self._index +=1\n self._cond.notify()\n else :\n self._unsorted[i]=obj\n \n if self._index ==self._length:\n del self._cache[self._job]\n finally :\n self._cond.release()\n \n def _set_length(self,length):\n self._cond.acquire()\n try :\n self._length=length\n if self._index ==self._length:\n self._cond.notify()\n del self._cache[self._job]\n finally :\n self._cond.release()\n \n \n \n \n \nclass IMapUnorderedIterator(IMapIterator):\n\n def _set(self,i,obj):\n self._cond.acquire()\n try :\n self._items.append(obj)\n self._index +=1\n self._cond.notify()\n if self._index ==self._length:\n del self._cache[self._job]\n finally :\n self._cond.release()\n \n \n \n \n \nclass ThreadPool(Pool):\n\n from .dummy import Process\n \n def __init__(self,processes=None ,initializer=None ,initargs=()):\n Pool.__init__(self,processes,initializer,initargs)\n \n def _setup_queues(self):\n self._inqueue=queue.Queue()\n self._outqueue=queue.Queue()\n self._quick_put=self._inqueue.put\n self._quick_get=self._outqueue.get\n \n @staticmethod\n def _help_stuff_finish(inqueue,task_handler,size):\n \n inqueue.not_empty.acquire()\n try :\n inqueue.queue.clear()\n inqueue.queue.extend([None ]*size)\n inqueue.not_empty.notify_all()\n finally :\n inqueue.not_empty.release()\n", ["collections", "itertools", "multiprocessing", "multiprocessing.Process", "multiprocessing.dummy", "multiprocessing.queues", "multiprocessing.util", "queue", "threading", "time"]], "multiprocessing.process": [".py", "\n\n\n\n\n\n\n\n\n__all__=['Process','current_process','active_children']\n\n\n\n\n\nimport os\nimport sys\nimport signal\nimport itertools\nfrom _weakrefset import WeakSet\n\n\nfrom _multiprocessing import Process\n\n\n\n\ntry :\n ORIGINAL_DIR=os.path.abspath(os.getcwd())\nexcept OSError:\n ORIGINAL_DIR=None\n \n \n \n \n \ndef current_process():\n ''\n\n \n return _current_process\n \ndef active_children():\n ''\n\n \n _cleanup()\n return list(_current_process._children)\n \n \n \n \n \ndef _cleanup():\n\n for p in list(_current_process._children):\n if p._popen.poll()is not None :\n _current_process._children.discard(p)\n \n \n \n \n \n \n \n \n \n \n \n \nclass AuthenticationString(bytes):\n def __reduce__(self):\n from .forking import Popen\n if not Popen.thread_is_spawning():\n raise TypeError(\n 'Pickling an AuthenticationString object is '\n 'disallowed for security reasons'\n )\n return AuthenticationString,(bytes(self),)\n \n \n \n \n \nclass _MainProcess(Process):\n\n def __init__(self):\n self._identity=()\n self._daemonic=False\n self._name='MainProcess'\n self._parent_pid=None\n self._popen=None\n self._counter=itertools.count(1)\n self._children=set()\n self._authkey=AuthenticationString(os.urandom(32))\n self._tempdir=None\n \n_current_process=_MainProcess()\ndel _MainProcess\n\n\n\n\n\n_exitcode_to_name={}\n\nfor name,signum in list(signal.__dict__.items()):\n if name[:3]=='SIG'and '_'not in name:\n _exitcode_to_name[-signum]=name\n \n \n_dangling=WeakSet()\n", ["_multiprocessing", "_weakrefset", "itertools", "multiprocessing.forking", "os", "signal", "sys"]], "multiprocessing.util": [".py", "\n\n\n\n\n\n\n\n\nimport sys\nimport functools\nimport os\nimport itertools\nimport weakref\nimport atexit\nimport threading\n\nfrom subprocess import _args_from_interpreter_flags\n\nfrom multiprocessing.process import current_process,active_children\n\n__all__=[\n'sub_debug','debug','info','sub_warning','get_logger',\n'log_to_stderr','get_temp_dir','register_after_fork',\n'is_exiting','Finalize','ForkAwareThreadLock','ForkAwareLocal',\n'SUBDEBUG','SUBWARNING',\n]\n\n\n\n\n\nNOTSET=0\nSUBDEBUG=5\nDEBUG=10\nINFO=20\nSUBWARNING=25\n\nLOGGER_NAME='multiprocessing'\nDEFAULT_LOGGING_FORMAT='[%(levelname)s/%(processName)s] %(message)s'\n\n_logger=None\n_log_to_stderr=False\n\ndef sub_debug(msg,*args):\n if _logger:\n _logger.log(SUBDEBUG,msg,*args)\n \ndef debug(msg,*args):\n if _logger:\n _logger.log(DEBUG,msg,*args)\n \ndef info(msg,*args):\n if _logger:\n _logger.log(INFO,msg,*args)\n \ndef sub_warning(msg,*args):\n if _logger:\n _logger.log(SUBWARNING,msg,*args)\n \ndef get_logger():\n ''\n\n \n global _logger\n import logging\n \n logging._acquireLock()\n try :\n if not _logger:\n \n _logger=logging.getLogger(LOGGER_NAME)\n _logger.propagate=0\n logging.addLevelName(SUBDEBUG,'SUBDEBUG')\n logging.addLevelName(SUBWARNING,'SUBWARNING')\n \n \n if hasattr(atexit,'unregister'):\n atexit.unregister(_exit_function)\n atexit.register(_exit_function)\n else :\n atexit._exithandlers.remove((_exit_function,(),{}))\n atexit._exithandlers.append((_exit_function,(),{}))\n \n finally :\n logging._releaseLock()\n \n return _logger\n \ndef log_to_stderr(level=None ):\n ''\n\n \n global _log_to_stderr\n import logging\n \n logger=get_logger()\n formatter=logging.Formatter(DEFAULT_LOGGING_FORMAT)\n handler=logging.StreamHandler()\n handler.setFormatter(formatter)\n logger.addHandler(handler)\n \n if level:\n logger.setLevel(level)\n _log_to_stderr=True\n return _logger\n \n \n \n \n \ndef get_temp_dir():\n\n if current_process()._tempdir is None :\n import shutil,tempfile\n tempdir=tempfile.mkdtemp(prefix='pymp-')\n info('created temp directory %s',tempdir)\n Finalize(None ,shutil.rmtree,args=[tempdir],exitpriority=-100)\n current_process()._tempdir=tempdir\n return current_process()._tempdir\n \n \n \n \n \n_afterfork_registry=weakref.WeakValueDictionary()\n_afterfork_counter=itertools.count()\n\ndef _run_after_forkers():\n items=list(_afterfork_registry.items())\n items.sort()\n for (index,ident,func),obj in items:\n try :\n func(obj)\n except Exception as e:\n info('after forker raised exception %s',e)\n \ndef register_after_fork(obj,func):\n _afterfork_registry[(next(_afterfork_counter),id(obj),func)]=obj\n \n \n \n \n \n_finalizer_registry={}\n_finalizer_counter=itertools.count()\n\n\nclass Finalize(object):\n ''\n\n \n def __init__(self,obj,callback,args=(),kwargs=None ,exitpriority=None ):\n assert exitpriority is None or type(exitpriority)is int\n \n if obj is not None :\n self._weakref=weakref.ref(obj,self)\n else :\n assert exitpriority is not None\n \n self._callback=callback\n self._args=args\n self._kwargs=kwargs or {}\n self._key=(exitpriority,next(_finalizer_counter))\n self._pid=os.getpid()\n \n _finalizer_registry[self._key]=self\n \n def __call__(self,wr=None ,\n \n \n _finalizer_registry=_finalizer_registry,\n sub_debug=sub_debug,getpid=os.getpid):\n ''\n\n \n try :\n del _finalizer_registry[self._key]\n except KeyError:\n sub_debug('finalizer no longer registered')\n else :\n if self._pid !=getpid():\n sub_debug('finalizer ignored because different process')\n res=None\n else :\n sub_debug('finalizer calling %s with args %s and kwargs %s',\n self._callback,self._args,self._kwargs)\n res=self._callback(*self._args,**self._kwargs)\n self._weakref=self._callback=self._args=\\\n self._kwargs=self._key=None\n return res\n \n def cancel(self):\n ''\n\n \n try :\n del _finalizer_registry[self._key]\n except KeyError:\n pass\n else :\n self._weakref=self._callback=self._args=\\\n self._kwargs=self._key=None\n \n def still_active(self):\n ''\n\n \n return self._key in _finalizer_registry\n \n def __repr__(self):\n try :\n obj=self._weakref()\n except (AttributeError,TypeError):\n obj=None\n \n if obj is None :\n return ''\n \n x=''\n \n \ndef _run_finalizers(minpriority=None ):\n ''\n\n\n\n\n \n if _finalizer_registry is None :\n \n \n \n return\n \n if minpriority is None :\n f=lambda p:p[0][0]is not None\n else :\n f=lambda p:p[0][0]is not None and p[0][0]>=minpriority\n \n items=[x for x in list(_finalizer_registry.items())if f(x)]\n items.sort(reverse=True )\n \n for key,finalizer in items:\n sub_debug('calling %s',finalizer)\n try :\n finalizer()\n except Exception:\n import traceback\n traceback.print_exc()\n \n if minpriority is None :\n _finalizer_registry.clear()\n \n \n \n \n \ndef is_exiting():\n ''\n\n \n return _exiting or _exiting is None\n \n_exiting=False\n\ndef _exit_function(info=info,debug=debug,_run_finalizers=_run_finalizers,\nactive_children=active_children,\ncurrent_process=current_process):\n\n\n\n\n global _exiting\n \n if not _exiting:\n _exiting=True\n \n info('process shutting down')\n debug('running all \"atexit\" finalizers with priority >= 0')\n _run_finalizers(0)\n \n if current_process()is not None :\n \n \n \n \n \n \n \n \n \n \n \n \n \n for p in active_children():\n if p._daemonic:\n info('calling terminate() for daemon %s',p.name)\n p._popen.terminate()\n \n for p in active_children():\n info('calling join() for process %s',p.name)\n p.join()\n \n debug('running the remaining \"atexit\" finalizers')\n _run_finalizers()\n \natexit.register(_exit_function)\n\n\n\n\n\nclass ForkAwareThreadLock(object):\n def __init__(self):\n self._reset()\n register_after_fork(self,ForkAwareThreadLock._reset)\n \n def _reset(self):\n self._lock=threading.Lock()\n self.acquire=self._lock.acquire\n self.release=self._lock.release\n \nclass ForkAwareLocal(threading.local):\n def __init__(self):\n register_after_fork(self,lambda obj:obj.__dict__.clear())\n def __reduce__(self):\n return type(self),()\n", ["atexit", "functools", "itertools", "logging", "multiprocessing.process", "os", "shutil", "subprocess", "sys", "tempfile", "threading", "traceback", "weakref"]], "multiprocessing": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__version__='0.70a1'\n\n__all__=[\n'Process','current_process','active_children','freeze_support',\n'Manager','Pipe','cpu_count','log_to_stderr','get_logger',\n'allow_connection_pickling','BufferTooShort','TimeoutError',\n'Lock','RLock','Semaphore','BoundedSemaphore','Condition',\n'Event','Barrier','Queue','SimpleQueue','JoinableQueue','Pool',\n'Value','Array','RawValue','RawArray','SUBDEBUG','SUBWARNING',\n]\n\n__author__='R. Oudkerk (r.m.oudkerk@gmail.com)'\n\n\n\n\n\nimport os\nimport sys\n\nfrom multiprocessing.process import Process,current_process,active_children\nfrom multiprocessing.util import SUBDEBUG,SUBWARNING\n\n\n\n\n\nclass ProcessError(Exception):\n pass\n \nclass BufferTooShort(ProcessError):\n pass\n \nclass TimeoutError(ProcessError):\n pass\n \nclass AuthenticationError(ProcessError):\n pass\n \nimport _multiprocessing\n\n\n\n\n\ndef Manager():\n ''\n\n\n\n\n \n from multiprocessing.managers import SyncManager\n m=SyncManager()\n m.start()\n return m\n \n \n \n \n \n \n \n \n \ndef cpu_count():\n ''\n\n \n if sys.platform =='win32':\n try :\n num=int(os.environ['NUMBER_OF_PROCESSORS'])\n except (ValueError,KeyError):\n num=0\n elif 'bsd'in sys.platform or sys.platform =='darwin':\n comm='/sbin/sysctl -n hw.ncpu'\n if sys.platform =='darwin':\n comm='/usr'+comm\n try :\n with os.popen(comm)as p:\n num=int(p.read())\n except ValueError:\n num=0\n else :\n try :\n num=os.sysconf('SC_NPROCESSORS_ONLN')\n except (ValueError,OSError,AttributeError):\n num=0\n \n if num >=1:\n return num\n else :\n raise NotImplementedError('cannot determine number of cpus')\n \ndef freeze_support():\n ''\n\n\n \n if sys.platform =='win32'and getattr(sys,'frozen',False ):\n from multiprocessing.forking import freeze_support\n freeze_support()\n \ndef get_logger():\n ''\n\n \n from multiprocessing.util import get_logger\n return get_logger()\n \ndef log_to_stderr(level=None ):\n ''\n\n \n from multiprocessing.util import log_to_stderr\n return log_to_stderr(level)\n \n \n \n \n \n \n \n \n \n \n \n \n \n \ndef Lock():\n ''\n\n \n from multiprocessing.synchronize import Lock\n return Lock()\n \ndef RLock():\n ''\n\n \n from multiprocessing.synchronize import RLock\n return RLock()\n \ndef Condition(lock=None ):\n ''\n\n \n from multiprocessing.synchronize import Condition\n return Condition(lock)\n \ndef Semaphore(value=1):\n ''\n\n \n from multiprocessing.synchronize import Semaphore\n return Semaphore(value)\n \ndef BoundedSemaphore(value=1):\n ''\n\n \n from multiprocessing.synchronize import BoundedSemaphore\n return BoundedSemaphore(value)\n \ndef Event():\n ''\n\n \n from multiprocessing.synchronize import Event\n return Event()\n \ndef Barrier(parties,action=None ,timeout=None ):\n ''\n\n \n from multiprocessing.synchronize import Barrier\n return Barrier(parties,action,timeout)\n \ndef Queue(maxsize=0):\n ''\n\n \n from multiprocessing.queues import Queue\n return Queue(maxsize)\n \ndef JoinableQueue(maxsize=0):\n ''\n\n \n from multiprocessing.queues import JoinableQueue\n return JoinableQueue(maxsize)\n \ndef SimpleQueue():\n ''\n\n \n from multiprocessing.queues import SimpleQueue\n return SimpleQueue()\n \ndef Pool(processes=None ,initializer=None ,initargs=(),maxtasksperchild=None ):\n ''\n\n \n from multiprocessing.pool import Pool\n return Pool(processes,initializer,initargs,maxtasksperchild)\n \ndef RawValue(typecode_or_type,*args):\n ''\n\n \n from multiprocessing.sharedctypes import RawValue\n return RawValue(typecode_or_type,*args)\n \ndef RawArray(typecode_or_type,size_or_initializer):\n ''\n\n \n from multiprocessing.sharedctypes import RawArray\n return RawArray(typecode_or_type,size_or_initializer)\n \ndef Value(typecode_or_type,*args,lock=True ):\n ''\n\n \n from multiprocessing.sharedctypes import Value\n return Value(typecode_or_type,*args,lock=lock)\n \ndef Array(typecode_or_type,size_or_initializer,*,lock=True ):\n ''\n\n \n from multiprocessing.sharedctypes import Array\n return Array(typecode_or_type,size_or_initializer,lock=lock)\n \n \n \n \n \nif sys.platform =='win32':\n\n def set_executable(executable):\n ''\n\n\n\n \n from multiprocessing.forking import set_executable\n set_executable(executable)\n \n __all__ +=['set_executable']\n", ["_multiprocessing", "multiprocessing.forking", "multiprocessing.managers", "multiprocessing.pool", "multiprocessing.process", "multiprocessing.queues", "multiprocessing.sharedctypes", "multiprocessing.synchronize", "multiprocessing.util", "os", "sys"], 1], "multiprocessing.dummy.connection": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['Client','Listener','Pipe']\n\nfrom queue import Queue\n\n\nfamilies=[None ]\n\n\nclass Listener(object):\n\n def __init__(self,address=None ,family=None ,backlog=1):\n self._backlog_queue=Queue(backlog)\n \n def accept(self):\n return Connection(*self._backlog_queue.get())\n \n def close(self):\n self._backlog_queue=None\n \n address=property(lambda self:self._backlog_queue)\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,exc_tb):\n self.close()\n \n \ndef Client(address):\n _in,_out=Queue(),Queue()\n address.put((_out,_in))\n return Connection(_in,_out)\n \n \ndef Pipe(duplex=True ):\n a,b=Queue(),Queue()\n return Connection(a,b),Connection(b,a)\n \n \nclass Connection(object):\n\n def __init__(self,_in,_out):\n self._out=_out\n self._in=_in\n self.send=self.send_bytes=_out.put\n self.recv=self.recv_bytes=_in.get\n \n def poll(self,timeout=0.0):\n if self._in.qsize()>0:\n return True\n if timeout <=0.0:\n return False\n self._in.not_empty.acquire()\n self._in.not_empty.wait(timeout)\n self._in.not_empty.release()\n return self._in.qsize()>0\n \n def close(self):\n pass\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,exc_tb):\n self.close()\n", ["queue"]], "multiprocessing.dummy": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\n'Process','current_process','active_children','freeze_support',\n'Lock','RLock','Semaphore','BoundedSemaphore','Condition',\n'Event','Barrier','Queue','Manager','Pipe','Pool','JoinableQueue'\n]\n\n\n\n\n\nimport threading\nimport sys\nimport weakref\n\n\n\nfrom multiprocessing.dummy.connection import Pipe\nfrom threading import Lock,RLock,Semaphore,BoundedSemaphore\nfrom threading import Event,Condition,Barrier\nfrom queue import Queue\n\n\n\n\n\nclass DummyProcess(threading.Thread):\n\n def __init__(self,group=None ,target=None ,name=None ,args=(),kwargs={}):\n threading.Thread.__init__(self,group,target,name,args,kwargs)\n self._pid=None\n self._children=weakref.WeakKeyDictionary()\n self._start_called=False\n self._parent=current_process()\n \n def start(self):\n assert self._parent is current_process()\n self._start_called=True\n if hasattr(self._parent,'_children'):\n self._parent._children[self]=None\n threading.Thread.start(self)\n \n @property\n def exitcode(self):\n if self._start_called and not self.is_alive():\n return 0\n else :\n return None\n \n \n \n \n \nProcess=DummyProcess\ncurrent_process=threading.current_thread\ncurrent_process()._children=weakref.WeakKeyDictionary()\n\ndef active_children():\n children=current_process()._children\n for p in list(children):\n if not p.is_alive():\n children.pop(p,None )\n return list(children)\n \ndef freeze_support():\n pass\n \n \n \n \n \nclass Namespace(object):\n def __init__(self,**kwds):\n self.__dict__.update(kwds)\n def __repr__(self):\n items=list(self.__dict__.items())\n temp=[]\n for name,value in items:\n if not name.startswith('_'):\n temp.append('%s=%r'%(name,value))\n temp.sort()\n return 'Namespace(%s)'%str.join(', ',temp)\n \ndict=dict\nlist=list\n\n\n\n\n\nclass Value(object):\n def __init__(self,typecode,value,lock=True ):\n self._typecode=typecode\n self._value=value\n def _get(self):\n return self._value\n def _set(self,value):\n self._value=value\n value=property(_get,_set)\n def __repr__(self):\n return '<%r(%r, %r)>'%(type(self).__name__,self._typecode,self._value)\n \ndef Manager():\n return sys.modules[__name__]\n \ndef shutdown():\n pass\n \ndef Pool(processes=None ,initializer=None ,initargs=()):\n from multiprocessing.pool import ThreadPool\n return ThreadPool(processes,initializer,initargs)\n \nJoinableQueue=Queue\n", ["multiprocessing.dummy.connection", "multiprocessing.pool", "queue", "sys", "threading", "weakref"], 1], "pydoc_data.topics": [".py", "\n\ntopics={'assert':'The \"assert\" statement\\n'\n'**********************\\n'\n'\\n'\n'Assert statements are a convenient way to insert debugging '\n'assertions\\n'\n'into a program:\\n'\n'\\n'\n' assert_stmt ::= \"assert\" expression [\",\" expression]\\n'\n'\\n'\n'The simple form, \"assert expression\", is equivalent to\\n'\n'\\n'\n' if __debug__:\\n'\n' if not expression: raise AssertionError\\n'\n'\\n'\n'The extended form, \"assert expression1, expression2\", is '\n'equivalent to\\n'\n'\\n'\n' if __debug__:\\n'\n' if not expression1: raise AssertionError(expression2)\\n'\n'\\n'\n'These equivalences assume that \"__debug__\" and \"AssertionError\" '\n'refer\\n'\n'to the built-in variables with those names. In the current\\n'\n'implementation, the built-in variable \"__debug__\" is \"True\" under\\n'\n'normal circumstances, \"False\" when optimization is requested '\n'(command\\n'\n'line option \"-O\"). The current code generator emits no code for '\n'an\\n'\n'assert statement when optimization is requested at compile time. '\n'Note\\n'\n'that it is unnecessary to include the source code for the '\n'expression\\n'\n'that failed in the error message; it will be displayed as part of '\n'the\\n'\n'stack trace.\\n'\n'\\n'\n'Assignments to \"__debug__\" are illegal. The value for the '\n'built-in\\n'\n'variable is determined when the interpreter starts.\\n',\n'assignment':'Assignment statements\\n'\n'*********************\\n'\n'\\n'\n'Assignment statements are used to (re)bind names to values and '\n'to\\n'\n'modify attributes or items of mutable objects:\\n'\n'\\n'\n' assignment_stmt ::= (target_list \"=\")+ (starred_expression '\n'| yield_expression)\\n'\n' target_list ::= target (\",\" target)* [\",\"]\\n'\n' target ::= identifier\\n'\n' | \"(\" [target_list] \")\"\\n'\n' | \"[\" [target_list] \"]\"\\n'\n' | attributeref\\n'\n' | subscription\\n'\n' | slicing\\n'\n' | \"*\" target\\n'\n'\\n'\n'(See section Primaries for the syntax definitions for '\n'*attributeref*,\\n'\n'*subscription*, and *slicing*.)\\n'\n'\\n'\n'An assignment statement evaluates the expression list '\n'(remember that\\n'\n'this can be a single expression or a comma-separated list, the '\n'latter\\n'\n'yielding a tuple) and assigns the single resulting object to '\n'each of\\n'\n'the target lists, from left to right.\\n'\n'\\n'\n'Assignment is defined recursively depending on the form of the '\n'target\\n'\n'(list). When a target is part of a mutable object (an '\n'attribute\\n'\n'reference, subscription or slicing), the mutable object must\\n'\n'ultimately perform the assignment and decide about its '\n'validity, and\\n'\n'may raise an exception if the assignment is unacceptable. The '\n'rules\\n'\n'observed by various types and the exceptions raised are given '\n'with the\\n'\n'definition of the object types (see section The standard type\\n'\n'hierarchy).\\n'\n'\\n'\n'Assignment of an object to a target list, optionally enclosed '\n'in\\n'\n'parentheses or square brackets, is recursively defined as '\n'follows.\\n'\n'\\n'\n'* If the target list is a single target with no trailing '\n'comma,\\n'\n' optionally in parentheses, the object is assigned to that '\n'target.\\n'\n'\\n'\n'* Else: The object must be an iterable with the same number of '\n'items\\n'\n' as there are targets in the target list, and the items are '\n'assigned,\\n'\n' from left to right, to the corresponding targets.\\n'\n'\\n'\n' * If the target list contains one target prefixed with an '\n'asterisk,\\n'\n' called a \u201cstarred\u201d target: The object must be an iterable '\n'with at\\n'\n' least as many items as there are targets in the target '\n'list, minus\\n'\n' one. The first items of the iterable are assigned, from '\n'left to\\n'\n' right, to the targets before the starred target. The '\n'final items\\n'\n' of the iterable are assigned to the targets after the '\n'starred\\n'\n' target. A list of the remaining items in the iterable is '\n'then\\n'\n' assigned to the starred target (the list can be empty).\\n'\n'\\n'\n' * Else: The object must be an iterable with the same number '\n'of items\\n'\n' as there are targets in the target list, and the items '\n'are\\n'\n' assigned, from left to right, to the corresponding '\n'targets.\\n'\n'\\n'\n'Assignment of an object to a single target is recursively '\n'defined as\\n'\n'follows.\\n'\n'\\n'\n'* If the target is an identifier (name):\\n'\n'\\n'\n' * If the name does not occur in a \"global\" or \"nonlocal\" '\n'statement\\n'\n' in the current code block: the name is bound to the object '\n'in the\\n'\n' current local namespace.\\n'\n'\\n'\n' * Otherwise: the name is bound to the object in the global '\n'namespace\\n'\n' or the outer namespace determined by \"nonlocal\", '\n'respectively.\\n'\n'\\n'\n' The name is rebound if it was already bound. This may cause '\n'the\\n'\n' reference count for the object previously bound to the name '\n'to reach\\n'\n' zero, causing the object to be deallocated and its '\n'destructor (if it\\n'\n' has one) to be called.\\n'\n'\\n'\n'* If the target is an attribute reference: The primary '\n'expression in\\n'\n' the reference is evaluated. It should yield an object with\\n'\n' assignable attributes; if this is not the case, \"TypeError\" '\n'is\\n'\n' raised. That object is then asked to assign the assigned '\n'object to\\n'\n' the given attribute; if it cannot perform the assignment, it '\n'raises\\n'\n' an exception (usually but not necessarily '\n'\"AttributeError\").\\n'\n'\\n'\n' Note: If the object is a class instance and the attribute '\n'reference\\n'\n' occurs on both sides of the assignment operator, the '\n'right-hand side\\n'\n' expression, \"a.x\" can access either an instance attribute or '\n'(if no\\n'\n' instance attribute exists) a class attribute. The left-hand '\n'side\\n'\n' target \"a.x\" is always set as an instance attribute, '\n'creating it if\\n'\n' necessary. Thus, the two occurrences of \"a.x\" do not '\n'necessarily\\n'\n' refer to the same attribute: if the right-hand side '\n'expression\\n'\n' refers to a class attribute, the left-hand side creates a '\n'new\\n'\n' instance attribute as the target of the assignment:\\n'\n'\\n'\n' class Cls:\\n'\n' x = 3 # class variable\\n'\n' inst = Cls()\\n'\n' inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x '\n'as 3\\n'\n'\\n'\n' This description does not necessarily apply to descriptor\\n'\n' attributes, such as properties created with \"property()\".\\n'\n'\\n'\n'* If the target is a subscription: The primary expression in '\n'the\\n'\n' reference is evaluated. It should yield either a mutable '\n'sequence\\n'\n' object (such as a list) or a mapping object (such as a '\n'dictionary).\\n'\n' Next, the subscript expression is evaluated.\\n'\n'\\n'\n' If the primary is a mutable sequence object (such as a '\n'list), the\\n'\n' subscript must yield an integer. If it is negative, the '\n'sequence\u2019s\\n'\n' length is added to it. The resulting value must be a '\n'nonnegative\\n'\n' integer less than the sequence\u2019s length, and the sequence is '\n'asked\\n'\n' to assign the assigned object to its item with that index. '\n'If the\\n'\n' index is out of range, \"IndexError\" is raised (assignment to '\n'a\\n'\n' subscripted sequence cannot add new items to a list).\\n'\n'\\n'\n' If the primary is a mapping object (such as a dictionary), '\n'the\\n'\n' subscript must have a type compatible with the mapping\u2019s key '\n'type,\\n'\n' and the mapping is then asked to create a key/datum pair '\n'which maps\\n'\n' the subscript to the assigned object. This can either '\n'replace an\\n'\n' existing key/value pair with the same key value, or insert a '\n'new\\n'\n' key/value pair (if no key with the same value existed).\\n'\n'\\n'\n' For user-defined objects, the \"__setitem__()\" method is '\n'called with\\n'\n' appropriate arguments.\\n'\n'\\n'\n'* If the target is a slicing: The primary expression in the '\n'reference\\n'\n' is evaluated. It should yield a mutable sequence object '\n'(such as a\\n'\n' list). The assigned object should be a sequence object of '\n'the same\\n'\n' type. Next, the lower and upper bound expressions are '\n'evaluated,\\n'\n' insofar they are present; defaults are zero and the '\n'sequence\u2019s\\n'\n' length. The bounds should evaluate to integers. If either '\n'bound is\\n'\n' negative, the sequence\u2019s length is added to it. The '\n'resulting\\n'\n' bounds are clipped to lie between zero and the sequence\u2019s '\n'length,\\n'\n' inclusive. Finally, the sequence object is asked to replace '\n'the\\n'\n' slice with the items of the assigned sequence. The length '\n'of the\\n'\n' slice may be different from the length of the assigned '\n'sequence,\\n'\n' thus changing the length of the target sequence, if the '\n'target\\n'\n' sequence allows it.\\n'\n'\\n'\n'**CPython implementation detail:** In the current '\n'implementation, the\\n'\n'syntax for targets is taken to be the same as for expressions, '\n'and\\n'\n'invalid syntax is rejected during the code generation phase, '\n'causing\\n'\n'less detailed error messages.\\n'\n'\\n'\n'Although the definition of assignment implies that overlaps '\n'between\\n'\n'the left-hand side and the right-hand side are \u2018simultaneous\u2019 '\n'(for\\n'\n'example \"a, b = b, a\" swaps two variables), overlaps *within* '\n'the\\n'\n'collection of assigned-to variables occur left-to-right, '\n'sometimes\\n'\n'resulting in confusion. For instance, the following program '\n'prints\\n'\n'\"[0, 2]\":\\n'\n'\\n'\n' x = [0, 1]\\n'\n' i = 0\\n'\n' i, x[i] = 1, 2 # i is updated, then x[i] is '\n'updated\\n'\n' print(x)\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3132** - Extended Iterable Unpacking\\n'\n' The specification for the \"*target\" feature.\\n'\n'\\n'\n'\\n'\n'Augmented assignment statements\\n'\n'===============================\\n'\n'\\n'\n'Augmented assignment is the combination, in a single '\n'statement, of a\\n'\n'binary operation and an assignment statement:\\n'\n'\\n'\n' augmented_assignment_stmt ::= augtarget augop '\n'(expression_list | yield_expression)\\n'\n' augtarget ::= identifier | attributeref | '\n'subscription | slicing\\n'\n' augop ::= \"+=\" | \"-=\" | \"*=\" | \"@=\" | '\n'\"/=\" | \"//=\" | \"%=\" | \"**=\"\\n'\n' | \">>=\" | \"<<=\" | \"&=\" | \"^=\" | \"|=\"\\n'\n'\\n'\n'(See section Primaries for the syntax definitions of the last '\n'three\\n'\n'symbols.)\\n'\n'\\n'\n'An augmented assignment evaluates the target (which, unlike '\n'normal\\n'\n'assignment statements, cannot be an unpacking) and the '\n'expression\\n'\n'list, performs the binary operation specific to the type of '\n'assignment\\n'\n'on the two operands, and assigns the result to the original '\n'target.\\n'\n'The target is only evaluated once.\\n'\n'\\n'\n'An augmented assignment expression like \"x += 1\" can be '\n'rewritten as\\n'\n'\"x = x + 1\" to achieve a similar, but not exactly equal '\n'effect. In the\\n'\n'augmented version, \"x\" is only evaluated once. Also, when '\n'possible,\\n'\n'the actual operation is performed *in-place*, meaning that '\n'rather than\\n'\n'creating a new object and assigning that to the target, the '\n'old object\\n'\n'is modified instead.\\n'\n'\\n'\n'Unlike normal assignments, augmented assignments evaluate the '\n'left-\\n'\n'hand side *before* evaluating the right-hand side. For '\n'example, \"a[i]\\n'\n'+= f(x)\" first looks-up \"a[i]\", then it evaluates \"f(x)\" and '\n'performs\\n'\n'the addition, and lastly, it writes the result back to '\n'\"a[i]\".\\n'\n'\\n'\n'With the exception of assigning to tuples and multiple targets '\n'in a\\n'\n'single statement, the assignment done by augmented assignment\\n'\n'statements is handled the same way as normal assignments. '\n'Similarly,\\n'\n'with the exception of the possible *in-place* behavior, the '\n'binary\\n'\n'operation performed by augmented assignment is the same as the '\n'normal\\n'\n'binary operations.\\n'\n'\\n'\n'For targets which are attribute references, the same caveat '\n'about\\n'\n'class and instance attributes applies as for regular '\n'assignments.\\n'\n'\\n'\n'\\n'\n'Annotated assignment statements\\n'\n'===============================\\n'\n'\\n'\n'*Annotation* assignment is the combination, in a single '\n'statement, of\\n'\n'a variable or attribute annotation and an optional assignment\\n'\n'statement:\\n'\n'\\n'\n' annotated_assignment_stmt ::= augtarget \":\" expression\\n'\n' [\"=\" (starred_expression | '\n'yield_expression)]\\n'\n'\\n'\n'The difference from normal Assignment statements is that only '\n'single\\n'\n'target is allowed.\\n'\n'\\n'\n'For simple names as assignment targets, if in class or module '\n'scope,\\n'\n'the annotations are evaluated and stored in a special class or '\n'module\\n'\n'attribute \"__annotations__\" that is a dictionary mapping from '\n'variable\\n'\n'names (mangled if private) to evaluated annotations. This '\n'attribute is\\n'\n'writable and is automatically created at the start of class or '\n'module\\n'\n'body execution, if annotations are found statically.\\n'\n'\\n'\n'For expressions as assignment targets, the annotations are '\n'evaluated\\n'\n'if in class or module scope, but not stored.\\n'\n'\\n'\n'If a name is annotated in a function scope, then this name is '\n'local\\n'\n'for that scope. Annotations are never evaluated and stored in '\n'function\\n'\n'scopes.\\n'\n'\\n'\n'If the right hand side is present, an annotated assignment '\n'performs\\n'\n'the actual assignment before evaluating annotations (where\\n'\n'applicable). If the right hand side is not present for an '\n'expression\\n'\n'target, then the interpreter evaluates the target except for '\n'the last\\n'\n'\"__setitem__()\" or \"__setattr__()\" call.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 526** - Syntax for Variable Annotations\\n'\n' The proposal that added syntax for annotating the types '\n'of\\n'\n' variables (including class variables and instance '\n'variables),\\n'\n' instead of expressing them through comments.\\n'\n'\\n'\n' **PEP 484** - Type hints\\n'\n' The proposal that added the \"typing\" module to provide a '\n'standard\\n'\n' syntax for type annotations that can be used in static '\n'analysis\\n'\n' tools and IDEs.\\n'\n'\\n'\n'Changed in version 3.8: Now annotated assignments allow same\\n'\n'expressions in the right hand side as the regular '\n'assignments.\\n'\n'Previously, some expressions (like un-parenthesized tuple '\n'expressions)\\n'\n'caused a syntax error.\\n',\n'async':'Coroutines\\n'\n'**********\\n'\n'\\n'\n'New in version 3.5.\\n'\n'\\n'\n'\\n'\n'Coroutine function definition\\n'\n'=============================\\n'\n'\\n'\n' async_funcdef ::= [decorators] \"async\" \"def\" funcname \"(\" '\n'[parameter_list] \")\"\\n'\n' [\"->\" expression] \":\" suite\\n'\n'\\n'\n'Execution of Python coroutines can be suspended and resumed at '\n'many\\n'\n'points (see *coroutine*). \"await\" expressions, \"async for\" and '\n'\"async\\n'\n'with\" can only be used in the body of a coroutine function.\\n'\n'\\n'\n'Functions defined with \"async def\" syntax are always coroutine\\n'\n'functions, even if they do not contain \"await\" or \"async\" '\n'keywords.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use a \"yield from\" expression inside the '\n'body\\n'\n'of a coroutine function.\\n'\n'\\n'\n'An example of a coroutine function:\\n'\n'\\n'\n' async def func(param1, param2):\\n'\n' do_stuff()\\n'\n' await some_coroutine()\\n'\n'\\n'\n'Changed in version 3.7: \"await\" and \"async\" are now keywords;\\n'\n'previously they were only treated as such inside the body of a\\n'\n'coroutine function.\\n'\n'\\n'\n'\\n'\n'The \"async for\" statement\\n'\n'=========================\\n'\n'\\n'\n' async_for_stmt ::= \"async\" for_stmt\\n'\n'\\n'\n'An *asynchronous iterable* provides an \"__aiter__\" method that\\n'\n'directly returns an *asynchronous iterator*, which can call\\n'\n'asynchronous code in its \"__anext__\" method.\\n'\n'\\n'\n'The \"async for\" statement allows convenient iteration over\\n'\n'asynchronous iterables.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' async for TARGET in ITER:\\n'\n' SUITE\\n'\n' else:\\n'\n' SUITE2\\n'\n'\\n'\n'Is semantically equivalent to:\\n'\n'\\n'\n' iter = (ITER)\\n'\n' iter = type(iter).__aiter__(iter)\\n'\n' running = True\\n'\n'\\n'\n' while running:\\n'\n' try:\\n'\n' TARGET = await type(iter).__anext__(iter)\\n'\n' except StopAsyncIteration:\\n'\n' running = False\\n'\n' else:\\n'\n' SUITE\\n'\n' else:\\n'\n' SUITE2\\n'\n'\\n'\n'See also \"__aiter__()\" and \"__anext__()\" for details.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use an \"async for\" statement outside the '\n'body\\n'\n'of a coroutine function.\\n'\n'\\n'\n'\\n'\n'The \"async with\" statement\\n'\n'==========================\\n'\n'\\n'\n' async_with_stmt ::= \"async\" with_stmt\\n'\n'\\n'\n'An *asynchronous context manager* is a *context manager* that is '\n'able\\n'\n'to suspend execution in its *enter* and *exit* methods.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' async with EXPRESSION as TARGET:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' manager = (EXPRESSION)\\n'\n' aenter = type(manager).__aenter__\\n'\n' aexit = type(manager).__aexit__\\n'\n' value = await aenter(manager)\\n'\n' hit_except = False\\n'\n'\\n'\n' try:\\n'\n' TARGET = value\\n'\n' SUITE\\n'\n' except:\\n'\n' hit_except = True\\n'\n' if not await aexit(manager, *sys.exc_info()):\\n'\n' raise\\n'\n' finally:\\n'\n' if not hit_except:\\n'\n' await aexit(manager, None, None, None)\\n'\n'\\n'\n'See also \"__aenter__()\" and \"__aexit__()\" for details.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use an \"async with\" statement outside the\\n'\n'body of a coroutine function.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 492** - Coroutines with async and await syntax\\n'\n' The proposal that made coroutines a proper standalone concept '\n'in\\n'\n' Python, and added supporting syntax.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] The exception is propagated to the invocation stack unless '\n'there\\n'\n' is a \"finally\" clause which happens to raise another '\n'exception.\\n'\n' That new exception causes the old one to be lost.\\n'\n'\\n'\n'[2] In pattern matching, a sequence is defined as one of the\\n'\n' following:\\n'\n'\\n'\n' * a class that inherits from \"collections.abc.Sequence\"\\n'\n'\\n'\n' * a Python class that has been registered as\\n'\n' \"collections.abc.Sequence\"\\n'\n'\\n'\n' * a builtin class that has its (CPython) '\n'\"Py_TPFLAGS_SEQUENCE\"\\n'\n' bit set\\n'\n'\\n'\n' * a class that inherits from any of the above\\n'\n'\\n'\n' The following standard library classes are sequences:\\n'\n'\\n'\n' * \"array.array\"\\n'\n'\\n'\n' * \"collections.deque\"\\n'\n'\\n'\n' * \"list\"\\n'\n'\\n'\n' * \"memoryview\"\\n'\n'\\n'\n' * \"range\"\\n'\n'\\n'\n' * \"tuple\"\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' Subject values of type \"str\", \"bytes\", and \"bytearray\" do '\n'not\\n'\n' match sequence patterns.\\n'\n'\\n'\n'[3] In pattern matching, a mapping is defined as one of the '\n'following:\\n'\n'\\n'\n' * a class that inherits from \"collections.abc.Mapping\"\\n'\n'\\n'\n' * a Python class that has been registered as\\n'\n' \"collections.abc.Mapping\"\\n'\n'\\n'\n' * a builtin class that has its (CPython) '\n'\"Py_TPFLAGS_MAPPING\"\\n'\n' bit set\\n'\n'\\n'\n' * a class that inherits from any of the above\\n'\n'\\n'\n' The standard library classes \"dict\" and '\n'\"types.MappingProxyType\"\\n'\n' are mappings.\\n'\n'\\n'\n'[4] A string literal appearing as the first statement in the '\n'function\\n'\n' body is transformed into the function\u2019s \"__doc__\" attribute '\n'and\\n'\n' therefore the function\u2019s *docstring*.\\n'\n'\\n'\n'[5] A string literal appearing as the first statement in the class\\n'\n' body is transformed into the namespace\u2019s \"__doc__\" item and\\n'\n' therefore the class\u2019s *docstring*.\\n',\n'atom-identifiers':'Identifiers (Names)\\n'\n'*******************\\n'\n'\\n'\n'An identifier occurring as an atom is a name. See '\n'section Identifiers\\n'\n'and keywords for lexical definition and section Naming '\n'and binding for\\n'\n'documentation of naming and binding.\\n'\n'\\n'\n'When the name is bound to an object, evaluation of the '\n'atom yields\\n'\n'that object. When a name is not bound, an attempt to '\n'evaluate it\\n'\n'raises a \"NameError\" exception.\\n'\n'\\n'\n'**Private name mangling:** When an identifier that '\n'textually occurs in\\n'\n'a class definition begins with two or more underscore '\n'characters and\\n'\n'does not end in two or more underscores, it is '\n'considered a *private\\n'\n'name* of that class. Private names are transformed to a '\n'longer form\\n'\n'before code is generated for them. The transformation '\n'inserts the\\n'\n'class name, with leading underscores removed and a '\n'single underscore\\n'\n'inserted, in front of the name. For example, the '\n'identifier \"__spam\"\\n'\n'occurring in a class named \"Ham\" will be transformed to '\n'\"_Ham__spam\".\\n'\n'This transformation is independent of the syntactical '\n'context in which\\n'\n'the identifier is used. If the transformed name is '\n'extremely long\\n'\n'(longer than 255 characters), implementation defined '\n'truncation may\\n'\n'happen. If the class name consists only of underscores, '\n'no\\n'\n'transformation is done.\\n',\n'atom-literals':'Literals\\n'\n'********\\n'\n'\\n'\n'Python supports string and bytes literals and various '\n'numeric\\n'\n'literals:\\n'\n'\\n'\n' literal ::= stringliteral | bytesliteral\\n'\n' | integer | floatnumber | imagnumber\\n'\n'\\n'\n'Evaluation of a literal yields an object of the given type '\n'(string,\\n'\n'bytes, integer, floating point number, complex number) with '\n'the given\\n'\n'value. The value may be approximated in the case of '\n'floating point\\n'\n'and imaginary (complex) literals. See section Literals for '\n'details.\\n'\n'\\n'\n'All literals correspond to immutable data types, and hence '\n'the\\n'\n'object\u2019s identity is less important than its value. '\n'Multiple\\n'\n'evaluations of literals with the same value (either the '\n'same\\n'\n'occurrence in the program text or a different occurrence) '\n'may obtain\\n'\n'the same object or a different object with the same '\n'value.\\n',\n'attribute-access':'Customizing attribute access\\n'\n'****************************\\n'\n'\\n'\n'The following methods can be defined to customize the '\n'meaning of\\n'\n'attribute access (use of, assignment to, or deletion of '\n'\"x.name\") for\\n'\n'class instances.\\n'\n'\\n'\n'object.__getattr__(self, name)\\n'\n'\\n'\n' Called when the default attribute access fails with '\n'an\\n'\n' \"AttributeError\" (either \"__getattribute__()\" raises '\n'an\\n'\n' \"AttributeError\" because *name* is not an instance '\n'attribute or an\\n'\n' attribute in the class tree for \"self\"; or '\n'\"__get__()\" of a *name*\\n'\n' property raises \"AttributeError\"). This method '\n'should either\\n'\n' return the (computed) attribute value or raise an '\n'\"AttributeError\"\\n'\n' exception.\\n'\n'\\n'\n' Note that if the attribute is found through the '\n'normal mechanism,\\n'\n' \"__getattr__()\" is not called. (This is an '\n'intentional asymmetry\\n'\n' between \"__getattr__()\" and \"__setattr__()\".) This is '\n'done both for\\n'\n' efficiency reasons and because otherwise '\n'\"__getattr__()\" would have\\n'\n' no way to access other attributes of the instance. '\n'Note that at\\n'\n' least for instance variables, you can fake total '\n'control by not\\n'\n' inserting any values in the instance attribute '\n'dictionary (but\\n'\n' instead inserting them in another object). See the\\n'\n' \"__getattribute__()\" method below for a way to '\n'actually get total\\n'\n' control over attribute access.\\n'\n'\\n'\n'object.__getattribute__(self, name)\\n'\n'\\n'\n' Called unconditionally to implement attribute '\n'accesses for\\n'\n' instances of the class. If the class also defines '\n'\"__getattr__()\",\\n'\n' the latter will not be called unless '\n'\"__getattribute__()\" either\\n'\n' calls it explicitly or raises an \"AttributeError\". '\n'This method\\n'\n' should return the (computed) attribute value or raise '\n'an\\n'\n' \"AttributeError\" exception. In order to avoid '\n'infinite recursion in\\n'\n' this method, its implementation should always call '\n'the base class\\n'\n' method with the same name to access any attributes it '\n'needs, for\\n'\n' example, \"object.__getattribute__(self, name)\".\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' This method may still be bypassed when looking up '\n'special methods\\n'\n' as the result of implicit invocation via language '\n'syntax or\\n'\n' built-in functions. See Special method lookup.\\n'\n'\\n'\n' For certain sensitive attribute accesses, raises an '\n'auditing event\\n'\n' \"object.__getattr__\" with arguments \"obj\" and '\n'\"name\".\\n'\n'\\n'\n'object.__setattr__(self, name, value)\\n'\n'\\n'\n' Called when an attribute assignment is attempted. '\n'This is called\\n'\n' instead of the normal mechanism (i.e. store the value '\n'in the\\n'\n' instance dictionary). *name* is the attribute name, '\n'*value* is the\\n'\n' value to be assigned to it.\\n'\n'\\n'\n' If \"__setattr__()\" wants to assign to an instance '\n'attribute, it\\n'\n' should call the base class method with the same name, '\n'for example,\\n'\n' \"object.__setattr__(self, name, value)\".\\n'\n'\\n'\n' For certain sensitive attribute assignments, raises '\n'an auditing\\n'\n' event \"object.__setattr__\" with arguments \"obj\", '\n'\"name\", \"value\".\\n'\n'\\n'\n'object.__delattr__(self, name)\\n'\n'\\n'\n' Like \"__setattr__()\" but for attribute deletion '\n'instead of\\n'\n' assignment. This should only be implemented if \"del '\n'obj.name\" is\\n'\n' meaningful for the object.\\n'\n'\\n'\n' For certain sensitive attribute deletions, raises an '\n'auditing event\\n'\n' \"object.__delattr__\" with arguments \"obj\" and '\n'\"name\".\\n'\n'\\n'\n'object.__dir__(self)\\n'\n'\\n'\n' Called when \"dir()\" is called on the object. A '\n'sequence must be\\n'\n' returned. \"dir()\" converts the returned sequence to a '\n'list and\\n'\n' sorts it.\\n'\n'\\n'\n'\\n'\n'Customizing module attribute access\\n'\n'===================================\\n'\n'\\n'\n'Special names \"__getattr__\" and \"__dir__\" can be also '\n'used to\\n'\n'customize access to module attributes. The \"__getattr__\" '\n'function at\\n'\n'the module level should accept one argument which is the '\n'name of an\\n'\n'attribute and return the computed value or raise an '\n'\"AttributeError\".\\n'\n'If an attribute is not found on a module object through '\n'the normal\\n'\n'lookup, i.e. \"object.__getattribute__()\", then '\n'\"__getattr__\" is\\n'\n'searched in the module \"__dict__\" before raising an '\n'\"AttributeError\".\\n'\n'If found, it is called with the attribute name and the '\n'result is\\n'\n'returned.\\n'\n'\\n'\n'The \"__dir__\" function should accept no arguments, and '\n'return a\\n'\n'sequence of strings that represents the names accessible '\n'on module. If\\n'\n'present, this function overrides the standard \"dir()\" '\n'search on a\\n'\n'module.\\n'\n'\\n'\n'For a more fine grained customization of the module '\n'behavior (setting\\n'\n'attributes, properties, etc.), one can set the '\n'\"__class__\" attribute\\n'\n'of a module object to a subclass of \"types.ModuleType\". '\n'For example:\\n'\n'\\n'\n' import sys\\n'\n' from types import ModuleType\\n'\n'\\n'\n' class VerboseModule(ModuleType):\\n'\n' def __repr__(self):\\n'\n\" return f'Verbose {self.__name__}'\\n\"\n'\\n'\n' def __setattr__(self, attr, value):\\n'\n\" print(f'Setting {attr}...')\\n\"\n' super().__setattr__(attr, value)\\n'\n'\\n'\n' sys.modules[__name__].__class__ = VerboseModule\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Defining module \"__getattr__\" and setting module '\n'\"__class__\" only\\n'\n' affect lookups made using the attribute access syntax '\n'\u2013 directly\\n'\n' accessing the module globals (whether by code within '\n'the module, or\\n'\n' via a reference to the module\u2019s globals dictionary) is '\n'unaffected.\\n'\n'\\n'\n'Changed in version 3.5: \"__class__\" module attribute is '\n'now writable.\\n'\n'\\n'\n'New in version 3.7: \"__getattr__\" and \"__dir__\" module '\n'attributes.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 562** - Module __getattr__ and __dir__\\n'\n' Describes the \"__getattr__\" and \"__dir__\" functions '\n'on modules.\\n'\n'\\n'\n'\\n'\n'Implementing Descriptors\\n'\n'========================\\n'\n'\\n'\n'The following methods only apply when an instance of the '\n'class\\n'\n'containing the method (a so-called *descriptor* class) '\n'appears in an\\n'\n'*owner* class (the descriptor must be in either the '\n'owner\u2019s class\\n'\n'dictionary or in the class dictionary for one of its '\n'parents). In the\\n'\n'examples below, \u201cthe attribute\u201d refers to the attribute '\n'whose name is\\n'\n'the key of the property in the owner class\u2019 \"__dict__\".\\n'\n'\\n'\n'object.__get__(self, instance, owner=None)\\n'\n'\\n'\n' Called to get the attribute of the owner class (class '\n'attribute\\n'\n' access) or of an instance of that class (instance '\n'attribute\\n'\n' access). The optional *owner* argument is the owner '\n'class, while\\n'\n' *instance* is the instance that the attribute was '\n'accessed through,\\n'\n' or \"None\" when the attribute is accessed through the '\n'*owner*.\\n'\n'\\n'\n' This method should return the computed attribute '\n'value or raise an\\n'\n' \"AttributeError\" exception.\\n'\n'\\n'\n' **PEP 252** specifies that \"__get__()\" is callable '\n'with one or two\\n'\n' arguments. Python\u2019s own built-in descriptors support '\n'this\\n'\n' specification; however, it is likely that some '\n'third-party tools\\n'\n' have descriptors that require both arguments. '\n'Python\u2019s own\\n'\n' \"__getattribute__()\" implementation always passes in '\n'both arguments\\n'\n' whether they are required or not.\\n'\n'\\n'\n'object.__set__(self, instance, value)\\n'\n'\\n'\n' Called to set the attribute on an instance *instance* '\n'of the owner\\n'\n' class to a new value, *value*.\\n'\n'\\n'\n' Note, adding \"__set__()\" or \"__delete__()\" changes '\n'the kind of\\n'\n' descriptor to a \u201cdata descriptor\u201d. See Invoking '\n'Descriptors for\\n'\n' more details.\\n'\n'\\n'\n'object.__delete__(self, instance)\\n'\n'\\n'\n' Called to delete the attribute on an instance '\n'*instance* of the\\n'\n' owner class.\\n'\n'\\n'\n'object.__set_name__(self, owner, name)\\n'\n'\\n'\n' Called at the time the owning class *owner* is '\n'created. The\\n'\n' descriptor has been assigned to *name*.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"__set_name__()\" is only called implicitly as part '\n'of the \"type\"\\n'\n' constructor, so it will need to be called '\n'explicitly with the\\n'\n' appropriate parameters when a descriptor is added '\n'to a class\\n'\n' after initial creation:\\n'\n'\\n'\n' class A:\\n'\n' pass\\n'\n' descr = custom_descriptor()\\n'\n' A.attr = descr\\n'\n\" descr.__set_name__(A, 'attr')\\n\"\n'\\n'\n' See Creating the class object for more details.\\n'\n'\\n'\n' New in version 3.6.\\n'\n'\\n'\n'The attribute \"__objclass__\" is interpreted by the '\n'\"inspect\" module as\\n'\n'specifying the class where this object was defined '\n'(setting this\\n'\n'appropriately can assist in runtime introspection of '\n'dynamic class\\n'\n'attributes). For callables, it may indicate that an '\n'instance of the\\n'\n'given type (or a subclass) is expected or required as '\n'the first\\n'\n'positional argument (for example, CPython sets this '\n'attribute for\\n'\n'unbound methods that are implemented in C).\\n'\n'\\n'\n'\\n'\n'Invoking Descriptors\\n'\n'====================\\n'\n'\\n'\n'In general, a descriptor is an object attribute with '\n'\u201cbinding\\n'\n'behavior\u201d, one whose attribute access has been '\n'overridden by methods\\n'\n'in the descriptor protocol: \"__get__()\", \"__set__()\", '\n'and\\n'\n'\"__delete__()\". If any of those methods are defined for '\n'an object, it\\n'\n'is said to be a descriptor.\\n'\n'\\n'\n'The default behavior for attribute access is to get, '\n'set, or delete\\n'\n'the attribute from an object\u2019s dictionary. For instance, '\n'\"a.x\" has a\\n'\n'lookup chain starting with \"a.__dict__[\\'x\\']\", then\\n'\n'\"type(a).__dict__[\\'x\\']\", and continuing through the '\n'base classes of\\n'\n'\"type(a)\" excluding metaclasses.\\n'\n'\\n'\n'However, if the looked-up value is an object defining '\n'one of the\\n'\n'descriptor methods, then Python may override the default '\n'behavior and\\n'\n'invoke the descriptor method instead. Where this occurs '\n'in the\\n'\n'precedence chain depends on which descriptor methods '\n'were defined and\\n'\n'how they were called.\\n'\n'\\n'\n'The starting point for descriptor invocation is a '\n'binding, \"a.x\". How\\n'\n'the arguments are assembled depends on \"a\":\\n'\n'\\n'\n'Direct Call\\n'\n' The simplest and least common call is when user code '\n'directly\\n'\n' invokes a descriptor method: \"x.__get__(a)\".\\n'\n'\\n'\n'Instance Binding\\n'\n' If binding to an object instance, \"a.x\" is '\n'transformed into the\\n'\n' call: \"type(a).__dict__[\\'x\\'].__get__(a, type(a))\".\\n'\n'\\n'\n'Class Binding\\n'\n' If binding to a class, \"A.x\" is transformed into the '\n'call:\\n'\n' \"A.__dict__[\\'x\\'].__get__(None, A)\".\\n'\n'\\n'\n'Super Binding\\n'\n' If \"a\" is an instance of \"super\", then the binding '\n'\"super(B,\\n'\n' obj).m()\" searches \"obj.__class__.__mro__\" for the '\n'base class \"A\"\\n'\n' immediately preceding \"B\" and then invokes the '\n'descriptor with the\\n'\n' call: \"A.__dict__[\\'m\\'].__get__(obj, '\n'obj.__class__)\".\\n'\n'\\n'\n'For instance bindings, the precedence of descriptor '\n'invocation depends\\n'\n'on which descriptor methods are defined. A descriptor '\n'can define any\\n'\n'combination of \"__get__()\", \"__set__()\" and '\n'\"__delete__()\". If it\\n'\n'does not define \"__get__()\", then accessing the '\n'attribute will return\\n'\n'the descriptor object itself unless there is a value in '\n'the object\u2019s\\n'\n'instance dictionary. If the descriptor defines '\n'\"__set__()\" and/or\\n'\n'\"__delete__()\", it is a data descriptor; if it defines '\n'neither, it is\\n'\n'a non-data descriptor. Normally, data descriptors '\n'define both\\n'\n'\"__get__()\" and \"__set__()\", while non-data descriptors '\n'have just the\\n'\n'\"__get__()\" method. Data descriptors with \"__get__()\" '\n'and \"__set__()\"\\n'\n'(and/or \"__delete__()\") defined always override a '\n'redefinition in an\\n'\n'instance dictionary. In contrast, non-data descriptors '\n'can be\\n'\n'overridden by instances.\\n'\n'\\n'\n'Python methods (including \"staticmethod()\" and '\n'\"classmethod()\") are\\n'\n'implemented as non-data descriptors. Accordingly, '\n'instances can\\n'\n'redefine and override methods. This allows individual '\n'instances to\\n'\n'acquire behaviors that differ from other instances of '\n'the same class.\\n'\n'\\n'\n'The \"property()\" function is implemented as a data '\n'descriptor.\\n'\n'Accordingly, instances cannot override the behavior of a '\n'property.\\n'\n'\\n'\n'\\n'\n'__slots__\\n'\n'=========\\n'\n'\\n'\n'*__slots__* allow us to explicitly declare data members '\n'(like\\n'\n'properties) and deny the creation of *__dict__* and '\n'*__weakref__*\\n'\n'(unless explicitly declared in *__slots__* or available '\n'in a parent.)\\n'\n'\\n'\n'The space saved over using *__dict__* can be '\n'significant. Attribute\\n'\n'lookup speed can be significantly improved as well.\\n'\n'\\n'\n'object.__slots__\\n'\n'\\n'\n' This class variable can be assigned a string, '\n'iterable, or sequence\\n'\n' of strings with variable names used by instances. '\n'*__slots__*\\n'\n' reserves space for the declared variables and '\n'prevents the\\n'\n' automatic creation of *__dict__* and *__weakref__* '\n'for each\\n'\n' instance.\\n'\n'\\n'\n'\\n'\n'Notes on using *__slots__*\\n'\n'--------------------------\\n'\n'\\n'\n'* When inheriting from a class without *__slots__*, the '\n'*__dict__* and\\n'\n' *__weakref__* attribute of the instances will always '\n'be accessible.\\n'\n'\\n'\n'* Without a *__dict__* variable, instances cannot be '\n'assigned new\\n'\n' variables not listed in the *__slots__* definition. '\n'Attempts to\\n'\n' assign to an unlisted variable name raises '\n'\"AttributeError\". If\\n'\n' dynamic assignment of new variables is desired, then '\n'add\\n'\n' \"\\'__dict__\\'\" to the sequence of strings in the '\n'*__slots__*\\n'\n' declaration.\\n'\n'\\n'\n'* Without a *__weakref__* variable for each instance, '\n'classes defining\\n'\n' *__slots__* do not support weak references to its '\n'instances. If weak\\n'\n' reference support is needed, then add '\n'\"\\'__weakref__\\'\" to the\\n'\n' sequence of strings in the *__slots__* declaration.\\n'\n'\\n'\n'* *__slots__* are implemented at the class level by '\n'creating\\n'\n' descriptors (Implementing Descriptors) for each '\n'variable name. As a\\n'\n' result, class attributes cannot be used to set default '\n'values for\\n'\n' instance variables defined by *__slots__*; otherwise, '\n'the class\\n'\n' attribute would overwrite the descriptor assignment.\\n'\n'\\n'\n'* The action of a *__slots__* declaration is not limited '\n'to the class\\n'\n' where it is defined. *__slots__* declared in parents '\n'are available\\n'\n' in child classes. However, child subclasses will get a '\n'*__dict__*\\n'\n' and *__weakref__* unless they also define *__slots__* '\n'(which should\\n'\n' only contain names of any *additional* slots).\\n'\n'\\n'\n'* If a class defines a slot also defined in a base '\n'class, the instance\\n'\n' variable defined by the base class slot is '\n'inaccessible (except by\\n'\n' retrieving its descriptor directly from the base '\n'class). This\\n'\n' renders the meaning of the program undefined. In the '\n'future, a\\n'\n' check may be added to prevent this.\\n'\n'\\n'\n'* Nonempty *__slots__* does not work for classes derived '\n'from\\n'\n' \u201cvariable-length\u201d built-in types such as \"int\", '\n'\"bytes\" and \"tuple\".\\n'\n'\\n'\n'* Any non-string iterable may be assigned to '\n'*__slots__*. Mappings may\\n'\n' also be used; however, in the future, special meaning '\n'may be\\n'\n' assigned to the values corresponding to each key.\\n'\n'\\n'\n'* *__class__* assignment works only if both classes have '\n'the same\\n'\n' *__slots__*.\\n'\n'\\n'\n'* Multiple inheritance with multiple slotted parent '\n'classes can be\\n'\n' used, but only one parent is allowed to have '\n'attributes created by\\n'\n' slots (the other bases must have empty slot layouts) - '\n'violations\\n'\n' raise \"TypeError\".\\n'\n'\\n'\n'* If an iterator is used for *__slots__* then a '\n'descriptor is created\\n'\n' for each of the iterator\u2019s values. However, the '\n'*__slots__*\\n'\n' attribute will be an empty iterator.\\n',\n'attribute-references':'Attribute references\\n'\n'********************\\n'\n'\\n'\n'An attribute reference is a primary followed by a '\n'period and a name:\\n'\n'\\n'\n' attributeref ::= primary \".\" identifier\\n'\n'\\n'\n'The primary must evaluate to an object of a type '\n'that supports\\n'\n'attribute references, which most objects do. This '\n'object is then\\n'\n'asked to produce the attribute whose name is the '\n'identifier. This\\n'\n'production can be customized by overriding the '\n'\"__getattr__()\" method.\\n'\n'If this attribute is not available, the exception '\n'\"AttributeError\" is\\n'\n'raised. Otherwise, the type and value of the object '\n'produced is\\n'\n'determined by the object. Multiple evaluations of '\n'the same attribute\\n'\n'reference may yield different objects.\\n',\n'augassign':'Augmented assignment statements\\n'\n'*******************************\\n'\n'\\n'\n'Augmented assignment is the combination, in a single statement, '\n'of a\\n'\n'binary operation and an assignment statement:\\n'\n'\\n'\n' augmented_assignment_stmt ::= augtarget augop '\n'(expression_list | yield_expression)\\n'\n' augtarget ::= identifier | attributeref | '\n'subscription | slicing\\n'\n' augop ::= \"+=\" | \"-=\" | \"*=\" | \"@=\" | '\n'\"/=\" | \"//=\" | \"%=\" | \"**=\"\\n'\n' | \">>=\" | \"<<=\" | \"&=\" | \"^=\" | \"|=\"\\n'\n'\\n'\n'(See section Primaries for the syntax definitions of the last '\n'three\\n'\n'symbols.)\\n'\n'\\n'\n'An augmented assignment evaluates the target (which, unlike '\n'normal\\n'\n'assignment statements, cannot be an unpacking) and the '\n'expression\\n'\n'list, performs the binary operation specific to the type of '\n'assignment\\n'\n'on the two operands, and assigns the result to the original '\n'target.\\n'\n'The target is only evaluated once.\\n'\n'\\n'\n'An augmented assignment expression like \"x += 1\" can be '\n'rewritten as\\n'\n'\"x = x + 1\" to achieve a similar, but not exactly equal effect. '\n'In the\\n'\n'augmented version, \"x\" is only evaluated once. Also, when '\n'possible,\\n'\n'the actual operation is performed *in-place*, meaning that '\n'rather than\\n'\n'creating a new object and assigning that to the target, the old '\n'object\\n'\n'is modified instead.\\n'\n'\\n'\n'Unlike normal assignments, augmented assignments evaluate the '\n'left-\\n'\n'hand side *before* evaluating the right-hand side. For '\n'example, \"a[i]\\n'\n'+= f(x)\" first looks-up \"a[i]\", then it evaluates \"f(x)\" and '\n'performs\\n'\n'the addition, and lastly, it writes the result back to \"a[i]\".\\n'\n'\\n'\n'With the exception of assigning to tuples and multiple targets '\n'in a\\n'\n'single statement, the assignment done by augmented assignment\\n'\n'statements is handled the same way as normal assignments. '\n'Similarly,\\n'\n'with the exception of the possible *in-place* behavior, the '\n'binary\\n'\n'operation performed by augmented assignment is the same as the '\n'normal\\n'\n'binary operations.\\n'\n'\\n'\n'For targets which are attribute references, the same caveat '\n'about\\n'\n'class and instance attributes applies as for regular '\n'assignments.\\n',\n'await':'Await expression\\n'\n'****************\\n'\n'\\n'\n'Suspend the execution of *coroutine* on an *awaitable* object. Can\\n'\n'only be used inside a *coroutine function*.\\n'\n'\\n'\n' await_expr ::= \"await\" primary\\n'\n'\\n'\n'New in version 3.5.\\n',\n'binary':'Binary arithmetic operations\\n'\n'****************************\\n'\n'\\n'\n'The binary arithmetic operations have the conventional priority\\n'\n'levels. Note that some of these operations also apply to certain '\n'non-\\n'\n'numeric types. Apart from the power operator, there are only two\\n'\n'levels, one for multiplicative operators and one for additive\\n'\n'operators:\\n'\n'\\n'\n' m_expr ::= u_expr | m_expr \"*\" u_expr | m_expr \"@\" m_expr |\\n'\n' m_expr \"//\" u_expr | m_expr \"/\" u_expr |\\n'\n' m_expr \"%\" u_expr\\n'\n' a_expr ::= m_expr | a_expr \"+\" m_expr | a_expr \"-\" m_expr\\n'\n'\\n'\n'The \"*\" (multiplication) operator yields the product of its '\n'arguments.\\n'\n'The arguments must either both be numbers, or one argument must be '\n'an\\n'\n'integer and the other must be a sequence. In the former case, the\\n'\n'numbers are converted to a common type and then multiplied '\n'together.\\n'\n'In the latter case, sequence repetition is performed; a negative\\n'\n'repetition factor yields an empty sequence.\\n'\n'\\n'\n'This operation can be customized using the special \"__mul__()\" '\n'and\\n'\n'\"__rmul__()\" methods.\\n'\n'\\n'\n'The \"@\" (at) operator is intended to be used for matrix\\n'\n'multiplication. No builtin Python types implement this operator.\\n'\n'\\n'\n'New in version 3.5.\\n'\n'\\n'\n'The \"/\" (division) and \"//\" (floor division) operators yield the\\n'\n'quotient of their arguments. The numeric arguments are first\\n'\n'converted to a common type. Division of integers yields a float, '\n'while\\n'\n'floor division of integers results in an integer; the result is '\n'that\\n'\n'of mathematical division with the \u2018floor\u2019 function applied to the\\n'\n'result. Division by zero raises the \"ZeroDivisionError\" '\n'exception.\\n'\n'\\n'\n'This operation can be customized using the special \"__div__()\" '\n'and\\n'\n'\"__floordiv__()\" methods.\\n'\n'\\n'\n'The \"%\" (modulo) operator yields the remainder from the division '\n'of\\n'\n'the first argument by the second. The numeric arguments are '\n'first\\n'\n'converted to a common type. A zero right argument raises the\\n'\n'\"ZeroDivisionError\" exception. The arguments may be floating '\n'point\\n'\n'numbers, e.g., \"3.14%0.7\" equals \"0.34\" (since \"3.14\" equals '\n'\"4*0.7 +\\n'\n'0.34\".) The modulo operator always yields a result with the same '\n'sign\\n'\n'as its second operand (or zero); the absolute value of the result '\n'is\\n'\n'strictly smaller than the absolute value of the second operand '\n'[1].\\n'\n'\\n'\n'The floor division and modulo operators are connected by the '\n'following\\n'\n'identity: \"x == (x//y)*y + (x%y)\". Floor division and modulo are '\n'also\\n'\n'connected with the built-in function \"divmod()\": \"divmod(x, y) ==\\n'\n'(x//y, x%y)\". [2].\\n'\n'\\n'\n'In addition to performing the modulo operation on numbers, the '\n'\"%\"\\n'\n'operator is also overloaded by string objects to perform '\n'old-style\\n'\n'string formatting (also known as interpolation). The syntax for\\n'\n'string formatting is described in the Python Library Reference,\\n'\n'section printf-style String Formatting.\\n'\n'\\n'\n'The *modulo* operation can be customized using the special '\n'\"__mod__()\"\\n'\n'method.\\n'\n'\\n'\n'The floor division operator, the modulo operator, and the '\n'\"divmod()\"\\n'\n'function are not defined for complex numbers. Instead, convert to '\n'a\\n'\n'floating point number using the \"abs()\" function if appropriate.\\n'\n'\\n'\n'The \"+\" (addition) operator yields the sum of its arguments. The\\n'\n'arguments must either both be numbers or both be sequences of the '\n'same\\n'\n'type. In the former case, the numbers are converted to a common '\n'type\\n'\n'and then added together. In the latter case, the sequences are\\n'\n'concatenated.\\n'\n'\\n'\n'This operation can be customized using the special \"__add__()\" '\n'and\\n'\n'\"__radd__()\" methods.\\n'\n'\\n'\n'The \"-\" (subtraction) operator yields the difference of its '\n'arguments.\\n'\n'The numeric arguments are first converted to a common type.\\n'\n'\\n'\n'This operation can be customized using the special \"__sub__()\" '\n'method.\\n',\n'bitwise':'Binary bitwise operations\\n'\n'*************************\\n'\n'\\n'\n'Each of the three bitwise operations has a different priority '\n'level:\\n'\n'\\n'\n' and_expr ::= shift_expr | and_expr \"&\" shift_expr\\n'\n' xor_expr ::= and_expr | xor_expr \"^\" and_expr\\n'\n' or_expr ::= xor_expr | or_expr \"|\" xor_expr\\n'\n'\\n'\n'The \"&\" operator yields the bitwise AND of its arguments, which '\n'must\\n'\n'be integers or one of them must be a custom object overriding\\n'\n'\"__and__()\" or \"__rand__()\" special methods.\\n'\n'\\n'\n'The \"^\" operator yields the bitwise XOR (exclusive OR) of its\\n'\n'arguments, which must be integers or one of them must be a '\n'custom\\n'\n'object overriding \"__xor__()\" or \"__rxor__()\" special methods.\\n'\n'\\n'\n'The \"|\" operator yields the bitwise (inclusive) OR of its '\n'arguments,\\n'\n'which must be integers or one of them must be a custom object\\n'\n'overriding \"__or__()\" or \"__ror__()\" special methods.\\n',\n'bltin-code-objects':'Code Objects\\n'\n'************\\n'\n'\\n'\n'Code objects are used by the implementation to '\n'represent \u201cpseudo-\\n'\n'compiled\u201d executable Python code such as a function '\n'body. They differ\\n'\n'from function objects because they don\u2019t contain a '\n'reference to their\\n'\n'global execution environment. Code objects are '\n'returned by the built-\\n'\n'in \"compile()\" function and can be extracted from '\n'function objects\\n'\n'through their \"__code__\" attribute. See also the '\n'\"code\" module.\\n'\n'\\n'\n'Accessing \"__code__\" raises an auditing event '\n'\"object.__getattr__\"\\n'\n'with arguments \"obj\" and \"\"__code__\"\".\\n'\n'\\n'\n'A code object can be executed or evaluated by passing '\n'it (instead of a\\n'\n'source string) to the \"exec()\" or \"eval()\" built-in '\n'functions.\\n'\n'\\n'\n'See The standard type hierarchy for more '\n'information.\\n',\n'bltin-ellipsis-object':'The Ellipsis Object\\n'\n'*******************\\n'\n'\\n'\n'This object is commonly used by slicing (see '\n'Slicings). It supports\\n'\n'no special operations. There is exactly one '\n'ellipsis object, named\\n'\n'\"Ellipsis\" (a built-in name). \"type(Ellipsis)()\" '\n'produces the\\n'\n'\"Ellipsis\" singleton.\\n'\n'\\n'\n'It is written as \"Ellipsis\" or \"...\".\\n',\n'bltin-null-object':'The Null Object\\n'\n'***************\\n'\n'\\n'\n'This object is returned by functions that don\u2019t '\n'explicitly return a\\n'\n'value. It supports no special operations. There is '\n'exactly one null\\n'\n'object, named \"None\" (a built-in name). \"type(None)()\" '\n'produces the\\n'\n'same singleton.\\n'\n'\\n'\n'It is written as \"None\".\\n',\n'bltin-type-objects':'Type Objects\\n'\n'************\\n'\n'\\n'\n'Type objects represent the various object types. An '\n'object\u2019s type is\\n'\n'accessed by the built-in function \"type()\". There are '\n'no special\\n'\n'operations on types. The standard module \"types\" '\n'defines names for\\n'\n'all standard built-in types.\\n'\n'\\n'\n'Types are written like this: \"\".\\n',\n'booleans':'Boolean operations\\n'\n'******************\\n'\n'\\n'\n' or_test ::= and_test | or_test \"or\" and_test\\n'\n' and_test ::= not_test | and_test \"and\" not_test\\n'\n' not_test ::= comparison | \"not\" not_test\\n'\n'\\n'\n'In the context of Boolean operations, and also when expressions '\n'are\\n'\n'used by control flow statements, the following values are '\n'interpreted\\n'\n'as false: \"False\", \"None\", numeric zero of all types, and empty\\n'\n'strings and containers (including strings, tuples, lists,\\n'\n'dictionaries, sets and frozensets). All other values are '\n'interpreted\\n'\n'as true. User-defined objects can customize their truth value '\n'by\\n'\n'providing a \"__bool__()\" method.\\n'\n'\\n'\n'The operator \"not\" yields \"True\" if its argument is false, '\n'\"False\"\\n'\n'otherwise.\\n'\n'\\n'\n'The expression \"x and y\" first evaluates *x*; if *x* is false, '\n'its\\n'\n'value is returned; otherwise, *y* is evaluated and the resulting '\n'value\\n'\n'is returned.\\n'\n'\\n'\n'The expression \"x or y\" first evaluates *x*; if *x* is true, its '\n'value\\n'\n'is returned; otherwise, *y* is evaluated and the resulting value '\n'is\\n'\n'returned.\\n'\n'\\n'\n'Note that neither \"and\" nor \"or\" restrict the value and type '\n'they\\n'\n'return to \"False\" and \"True\", but rather return the last '\n'evaluated\\n'\n'argument. This is sometimes useful, e.g., if \"s\" is a string '\n'that\\n'\n'should be replaced by a default value if it is empty, the '\n'expression\\n'\n'\"s or \\'foo\\'\" yields the desired value. Because \"not\" has to '\n'create a\\n'\n'new value, it returns a boolean value regardless of the type of '\n'its\\n'\n'argument (for example, \"not \\'foo\\'\" produces \"False\" rather '\n'than \"\\'\\'\".)\\n',\n'break':'The \"break\" statement\\n'\n'*********************\\n'\n'\\n'\n' break_stmt ::= \"break\"\\n'\n'\\n'\n'\"break\" may only occur syntactically nested in a \"for\" or \"while\"\\n'\n'loop, but not nested in a function or class definition within that\\n'\n'loop.\\n'\n'\\n'\n'It terminates the nearest enclosing loop, skipping the optional '\n'\"else\"\\n'\n'clause if the loop has one.\\n'\n'\\n'\n'If a \"for\" loop is terminated by \"break\", the loop control target\\n'\n'keeps its current value.\\n'\n'\\n'\n'When \"break\" passes control out of a \"try\" statement with a '\n'\"finally\"\\n'\n'clause, that \"finally\" clause is executed before really leaving '\n'the\\n'\n'loop.\\n',\n'callable-types':'Emulating callable objects\\n'\n'**************************\\n'\n'\\n'\n'object.__call__(self[, args...])\\n'\n'\\n'\n' Called when the instance is \u201ccalled\u201d as a function; if '\n'this method\\n'\n' is defined, \"x(arg1, arg2, ...)\" roughly translates to\\n'\n' \"type(x).__call__(x, arg1, ...)\".\\n',\n'calls':'Calls\\n'\n'*****\\n'\n'\\n'\n'A call calls a callable object (e.g., a *function*) with a '\n'possibly\\n'\n'empty series of *arguments*:\\n'\n'\\n'\n' call ::= primary \"(\" [argument_list [\",\"] | '\n'comprehension] \")\"\\n'\n' argument_list ::= positional_arguments [\",\" '\n'starred_and_keywords]\\n'\n' [\",\" keywords_arguments]\\n'\n' | starred_and_keywords [\",\" '\n'keywords_arguments]\\n'\n' | keywords_arguments\\n'\n' positional_arguments ::= positional_item (\",\" positional_item)*\\n'\n' positional_item ::= assignment_expression | \"*\" expression\\n'\n' starred_and_keywords ::= (\"*\" expression | keyword_item)\\n'\n' (\",\" \"*\" expression | \",\" '\n'keyword_item)*\\n'\n' keywords_arguments ::= (keyword_item | \"**\" expression)\\n'\n' (\",\" keyword_item | \",\" \"**\" '\n'expression)*\\n'\n' keyword_item ::= identifier \"=\" expression\\n'\n'\\n'\n'An optional trailing comma may be present after the positional and\\n'\n'keyword arguments but does not affect the semantics.\\n'\n'\\n'\n'The primary must evaluate to a callable object (user-defined\\n'\n'functions, built-in functions, methods of built-in objects, class\\n'\n'objects, methods of class instances, and all objects having a\\n'\n'\"__call__()\" method are callable). All argument expressions are\\n'\n'evaluated before the call is attempted. Please refer to section\\n'\n'Function definitions for the syntax of formal *parameter* lists.\\n'\n'\\n'\n'If keyword arguments are present, they are first converted to\\n'\n'positional arguments, as follows. First, a list of unfilled slots '\n'is\\n'\n'created for the formal parameters. If there are N positional\\n'\n'arguments, they are placed in the first N slots. Next, for each\\n'\n'keyword argument, the identifier is used to determine the\\n'\n'corresponding slot (if the identifier is the same as the first '\n'formal\\n'\n'parameter name, the first slot is used, and so on). If the slot '\n'is\\n'\n'already filled, a \"TypeError\" exception is raised. Otherwise, the\\n'\n'value of the argument is placed in the slot, filling it (even if '\n'the\\n'\n'expression is \"None\", it fills the slot). When all arguments have\\n'\n'been processed, the slots that are still unfilled are filled with '\n'the\\n'\n'corresponding default value from the function definition. '\n'(Default\\n'\n'values are calculated, once, when the function is defined; thus, a\\n'\n'mutable object such as a list or dictionary used as default value '\n'will\\n'\n'be shared by all calls that don\u2019t specify an argument value for '\n'the\\n'\n'corresponding slot; this should usually be avoided.) If there are '\n'any\\n'\n'unfilled slots for which no default value is specified, a '\n'\"TypeError\"\\n'\n'exception is raised. Otherwise, the list of filled slots is used '\n'as\\n'\n'the argument list for the call.\\n'\n'\\n'\n'**CPython implementation detail:** An implementation may provide\\n'\n'built-in functions whose positional parameters do not have names, '\n'even\\n'\n'if they are \u2018named\u2019 for the purpose of documentation, and which\\n'\n'therefore cannot be supplied by keyword. In CPython, this is the '\n'case\\n'\n'for functions implemented in C that use \"PyArg_ParseTuple()\" to '\n'parse\\n'\n'their arguments.\\n'\n'\\n'\n'If there are more positional arguments than there are formal '\n'parameter\\n'\n'slots, a \"TypeError\" exception is raised, unless a formal '\n'parameter\\n'\n'using the syntax \"*identifier\" is present; in this case, that '\n'formal\\n'\n'parameter receives a tuple containing the excess positional '\n'arguments\\n'\n'(or an empty tuple if there were no excess positional arguments).\\n'\n'\\n'\n'If any keyword argument does not correspond to a formal parameter\\n'\n'name, a \"TypeError\" exception is raised, unless a formal parameter\\n'\n'using the syntax \"**identifier\" is present; in this case, that '\n'formal\\n'\n'parameter receives a dictionary containing the excess keyword\\n'\n'arguments (using the keywords as keys and the argument values as\\n'\n'corresponding values), or a (new) empty dictionary if there were '\n'no\\n'\n'excess keyword arguments.\\n'\n'\\n'\n'If the syntax \"*expression\" appears in the function call, '\n'\"expression\"\\n'\n'must evaluate to an *iterable*. Elements from these iterables are\\n'\n'treated as if they were additional positional arguments. For the '\n'call\\n'\n'\"f(x1, x2, *y, x3, x4)\", if *y* evaluates to a sequence *y1*, \u2026, '\n'*yM*,\\n'\n'this is equivalent to a call with M+4 positional arguments *x1*, '\n'*x2*,\\n'\n'*y1*, \u2026, *yM*, *x3*, *x4*.\\n'\n'\\n'\n'A consequence of this is that although the \"*expression\" syntax '\n'may\\n'\n'appear *after* explicit keyword arguments, it is processed '\n'*before*\\n'\n'the keyword arguments (and any \"**expression\" arguments \u2013 see '\n'below).\\n'\n'So:\\n'\n'\\n'\n' >>> def f(a, b):\\n'\n' ... print(a, b)\\n'\n' ...\\n'\n' >>> f(b=1, *(2,))\\n'\n' 2 1\\n'\n' >>> f(a=1, *(2,))\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n\" TypeError: f() got multiple values for keyword argument 'a'\\n\"\n' >>> f(1, *(2,))\\n'\n' 1 2\\n'\n'\\n'\n'It is unusual for both keyword arguments and the \"*expression\" '\n'syntax\\n'\n'to be used in the same call, so in practice this confusion does '\n'not\\n'\n'arise.\\n'\n'\\n'\n'If the syntax \"**expression\" appears in the function call,\\n'\n'\"expression\" must evaluate to a *mapping*, the contents of which '\n'are\\n'\n'treated as additional keyword arguments. If a keyword is already\\n'\n'present (as an explicit keyword argument, or from another '\n'unpacking),\\n'\n'a \"TypeError\" exception is raised.\\n'\n'\\n'\n'Formal parameters using the syntax \"*identifier\" or \"**identifier\"\\n'\n'cannot be used as positional argument slots or as keyword argument\\n'\n'names.\\n'\n'\\n'\n'Changed in version 3.5: Function calls accept any number of \"*\" '\n'and\\n'\n'\"**\" unpackings, positional arguments may follow iterable '\n'unpackings\\n'\n'(\"*\"), and keyword arguments may follow dictionary unpackings '\n'(\"**\").\\n'\n'Originally proposed by **PEP 448**.\\n'\n'\\n'\n'A call always returns some value, possibly \"None\", unless it raises '\n'an\\n'\n'exception. How this value is computed depends on the type of the\\n'\n'callable object.\\n'\n'\\n'\n'If it is\u2014\\n'\n'\\n'\n'a user-defined function:\\n'\n' The code block for the function is executed, passing it the\\n'\n' argument list. The first thing the code block will do is bind '\n'the\\n'\n' formal parameters to the arguments; this is described in '\n'section\\n'\n' Function definitions. When the code block executes a \"return\"\\n'\n' statement, this specifies the return value of the function '\n'call.\\n'\n'\\n'\n'a built-in function or method:\\n'\n' The result is up to the interpreter; see Built-in Functions for '\n'the\\n'\n' descriptions of built-in functions and methods.\\n'\n'\\n'\n'a class object:\\n'\n' A new instance of that class is returned.\\n'\n'\\n'\n'a class instance method:\\n'\n' The corresponding user-defined function is called, with an '\n'argument\\n'\n' list that is one longer than the argument list of the call: the\\n'\n' instance becomes the first argument.\\n'\n'\\n'\n'a class instance:\\n'\n' The class must define a \"__call__()\" method; the effect is then '\n'the\\n'\n' same as if that method was called.\\n',\n'class':'Class definitions\\n'\n'*****************\\n'\n'\\n'\n'A class definition defines a class object (see section The '\n'standard\\n'\n'type hierarchy):\\n'\n'\\n'\n' classdef ::= [decorators] \"class\" classname [inheritance] \":\" '\n'suite\\n'\n' inheritance ::= \"(\" [argument_list] \")\"\\n'\n' classname ::= identifier\\n'\n'\\n'\n'A class definition is an executable statement. The inheritance '\n'list\\n'\n'usually gives a list of base classes (see Metaclasses for more\\n'\n'advanced uses), so each item in the list should evaluate to a '\n'class\\n'\n'object which allows subclassing. Classes without an inheritance '\n'list\\n'\n'inherit, by default, from the base class \"object\"; hence,\\n'\n'\\n'\n' class Foo:\\n'\n' pass\\n'\n'\\n'\n'is equivalent to\\n'\n'\\n'\n' class Foo(object):\\n'\n' pass\\n'\n'\\n'\n'The class\u2019s suite is then executed in a new execution frame (see\\n'\n'Naming and binding), using a newly created local namespace and the\\n'\n'original global namespace. (Usually, the suite contains mostly\\n'\n'function definitions.) When the class\u2019s suite finishes execution, '\n'its\\n'\n'execution frame is discarded but its local namespace is saved. [5] '\n'A\\n'\n'class object is then created using the inheritance list for the '\n'base\\n'\n'classes and the saved local namespace for the attribute '\n'dictionary.\\n'\n'The class name is bound to this class object in the original local\\n'\n'namespace.\\n'\n'\\n'\n'The order in which attributes are defined in the class body is\\n'\n'preserved in the new class\u2019s \"__dict__\". Note that this is '\n'reliable\\n'\n'only right after the class is created and only for classes that '\n'were\\n'\n'defined using the definition syntax.\\n'\n'\\n'\n'Class creation can be customized heavily using metaclasses.\\n'\n'\\n'\n'Classes can also be decorated: just like when decorating '\n'functions,\\n'\n'\\n'\n' @f1(arg)\\n'\n' @f2\\n'\n' class Foo: pass\\n'\n'\\n'\n'is roughly equivalent to\\n'\n'\\n'\n' class Foo: pass\\n'\n' Foo = f1(arg)(f2(Foo))\\n'\n'\\n'\n'The evaluation rules for the decorator expressions are the same as '\n'for\\n'\n'function decorators. The result is then bound to the class name.\\n'\n'\\n'\n'Changed in version 3.9: Classes may be decorated with any valid\\n'\n'\"assignment_expression\". Previously, the grammar was much more\\n'\n'restrictive; see **PEP 614** for details.\\n'\n'\\n'\n'**Programmer\u2019s note:** Variables defined in the class definition '\n'are\\n'\n'class attributes; they are shared by instances. Instance '\n'attributes\\n'\n'can be set in a method with \"self.name = value\". Both class and\\n'\n'instance attributes are accessible through the notation '\n'\u201c\"self.name\"\u201d,\\n'\n'and an instance attribute hides a class attribute with the same '\n'name\\n'\n'when accessed in this way. Class attributes can be used as '\n'defaults\\n'\n'for instance attributes, but using mutable values there can lead '\n'to\\n'\n'unexpected results. Descriptors can be used to create instance\\n'\n'variables with different implementation details.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3115** - Metaclasses in Python 3000\\n'\n' The proposal that changed the declaration of metaclasses to '\n'the\\n'\n' current syntax, and the semantics for how classes with\\n'\n' metaclasses are constructed.\\n'\n'\\n'\n' **PEP 3129** - Class Decorators\\n'\n' The proposal that added class decorators. Function and '\n'method\\n'\n' decorators were introduced in **PEP 318**.\\n',\n'comparisons':'Comparisons\\n'\n'***********\\n'\n'\\n'\n'Unlike C, all comparison operations in Python have the same '\n'priority,\\n'\n'which is lower than that of any arithmetic, shifting or '\n'bitwise\\n'\n'operation. Also unlike C, expressions like \"a < b < c\" have '\n'the\\n'\n'interpretation that is conventional in mathematics:\\n'\n'\\n'\n' comparison ::= or_expr (comp_operator or_expr)*\\n'\n' comp_operator ::= \"<\" | \">\" | \"==\" | \">=\" | \"<=\" | \"!=\"\\n'\n' | \"is\" [\"not\"] | [\"not\"] \"in\"\\n'\n'\\n'\n'Comparisons yield boolean values: \"True\" or \"False\". Custom '\n'*rich\\n'\n'comparison methods* may return non-boolean values. In this '\n'case Python\\n'\n'will call \"bool()\" on such value in boolean contexts.\\n'\n'\\n'\n'Comparisons can be chained arbitrarily, e.g., \"x < y <= z\" '\n'is\\n'\n'equivalent to \"x < y and y <= z\", except that \"y\" is '\n'evaluated only\\n'\n'once (but in both cases \"z\" is not evaluated at all when \"x < '\n'y\" is\\n'\n'found to be false).\\n'\n'\\n'\n'Formally, if *a*, *b*, *c*, \u2026, *y*, *z* are expressions and '\n'*op1*,\\n'\n'*op2*, \u2026, *opN* are comparison operators, then \"a op1 b op2 c '\n'... y\\n'\n'opN z\" is equivalent to \"a op1 b and b op2 c and ... y opN '\n'z\", except\\n'\n'that each expression is evaluated at most once.\\n'\n'\\n'\n'Note that \"a op1 b op2 c\" doesn\u2019t imply any kind of '\n'comparison between\\n'\n'*a* and *c*, so that, e.g., \"x < y > z\" is perfectly legal '\n'(though\\n'\n'perhaps not pretty).\\n'\n'\\n'\n'\\n'\n'Value comparisons\\n'\n'=================\\n'\n'\\n'\n'The operators \"<\", \">\", \"==\", \">=\", \"<=\", and \"!=\" compare '\n'the values\\n'\n'of two objects. The objects do not need to have the same '\n'type.\\n'\n'\\n'\n'Chapter Objects, values and types states that objects have a '\n'value (in\\n'\n'addition to type and identity). The value of an object is a '\n'rather\\n'\n'abstract notion in Python: For example, there is no canonical '\n'access\\n'\n'method for an object\u2019s value. Also, there is no requirement '\n'that the\\n'\n'value of an object should be constructed in a particular way, '\n'e.g.\\n'\n'comprised of all its data attributes. Comparison operators '\n'implement a\\n'\n'particular notion of what the value of an object is. One can '\n'think of\\n'\n'them as defining the value of an object indirectly, by means '\n'of their\\n'\n'comparison implementation.\\n'\n'\\n'\n'Because all types are (direct or indirect) subtypes of '\n'\"object\", they\\n'\n'inherit the default comparison behavior from \"object\". Types '\n'can\\n'\n'customize their comparison behavior by implementing *rich '\n'comparison\\n'\n'methods* like \"__lt__()\", described in Basic customization.\\n'\n'\\n'\n'The default behavior for equality comparison (\"==\" and \"!=\") '\n'is based\\n'\n'on the identity of the objects. Hence, equality comparison '\n'of\\n'\n'instances with the same identity results in equality, and '\n'equality\\n'\n'comparison of instances with different identities results in\\n'\n'inequality. A motivation for this default behavior is the '\n'desire that\\n'\n'all objects should be reflexive (i.e. \"x is y\" implies \"x == '\n'y\").\\n'\n'\\n'\n'A default order comparison (\"<\", \">\", \"<=\", and \">=\") is not '\n'provided;\\n'\n'an attempt raises \"TypeError\". A motivation for this default '\n'behavior\\n'\n'is the lack of a similar invariant as for equality.\\n'\n'\\n'\n'The behavior of the default equality comparison, that '\n'instances with\\n'\n'different identities are always unequal, may be in contrast '\n'to what\\n'\n'types will need that have a sensible definition of object '\n'value and\\n'\n'value-based equality. Such types will need to customize '\n'their\\n'\n'comparison behavior, and in fact, a number of built-in types '\n'have done\\n'\n'that.\\n'\n'\\n'\n'The following list describes the comparison behavior of the '\n'most\\n'\n'important built-in types.\\n'\n'\\n'\n'* Numbers of built-in numeric types (Numeric Types \u2014 int, '\n'float,\\n'\n' complex) and of the standard library types '\n'\"fractions.Fraction\" and\\n'\n' \"decimal.Decimal\" can be compared within and across their '\n'types,\\n'\n' with the restriction that complex numbers do not support '\n'order\\n'\n' comparison. Within the limits of the types involved, they '\n'compare\\n'\n' mathematically (algorithmically) correct without loss of '\n'precision.\\n'\n'\\n'\n' The not-a-number values \"float(\\'NaN\\')\" and '\n'\"decimal.Decimal(\\'NaN\\')\"\\n'\n' are special. Any ordered comparison of a number to a '\n'not-a-number\\n'\n' value is false. A counter-intuitive implication is that '\n'not-a-number\\n'\n' values are not equal to themselves. For example, if \"x =\\n'\n' float(\\'NaN\\')\", \"3 < x\", \"x < 3\" and \"x == x\" are all '\n'false, while \"x\\n'\n' != x\" is true. This behavior is compliant with IEEE 754.\\n'\n'\\n'\n'* \"None\" and \"NotImplemented\" are singletons. **PEP 8** '\n'advises that\\n'\n' comparisons for singletons should always be done with \"is\" '\n'or \"is\\n'\n' not\", never the equality operators.\\n'\n'\\n'\n'* Binary sequences (instances of \"bytes\" or \"bytearray\") can '\n'be\\n'\n' compared within and across their types. They compare\\n'\n' lexicographically using the numeric values of their '\n'elements.\\n'\n'\\n'\n'* Strings (instances of \"str\") compare lexicographically '\n'using the\\n'\n' numerical Unicode code points (the result of the built-in '\n'function\\n'\n' \"ord()\") of their characters. [3]\\n'\n'\\n'\n' Strings and binary sequences cannot be directly compared.\\n'\n'\\n'\n'* Sequences (instances of \"tuple\", \"list\", or \"range\") can be '\n'compared\\n'\n' only within each of their types, with the restriction that '\n'ranges do\\n'\n' not support order comparison. Equality comparison across '\n'these\\n'\n' types results in inequality, and ordering comparison across '\n'these\\n'\n' types raises \"TypeError\".\\n'\n'\\n'\n' Sequences compare lexicographically using comparison of\\n'\n' corresponding elements. The built-in containers typically '\n'assume\\n'\n' identical objects are equal to themselves. That lets them '\n'bypass\\n'\n' equality tests for identical objects to improve performance '\n'and to\\n'\n' maintain their internal invariants.\\n'\n'\\n'\n' Lexicographical comparison between built-in collections '\n'works as\\n'\n' follows:\\n'\n'\\n'\n' * For two collections to compare equal, they must be of the '\n'same\\n'\n' type, have the same length, and each pair of '\n'corresponding\\n'\n' elements must compare equal (for example, \"[1,2] == '\n'(1,2)\" is\\n'\n' false because the type is not the same).\\n'\n'\\n'\n' * Collections that support order comparison are ordered the '\n'same as\\n'\n' their first unequal elements (for example, \"[1,2,x] <= '\n'[1,2,y]\"\\n'\n' has the same value as \"x <= y\"). If a corresponding '\n'element does\\n'\n' not exist, the shorter collection is ordered first (for '\n'example,\\n'\n' \"[1,2] < [1,2,3]\" is true).\\n'\n'\\n'\n'* Mappings (instances of \"dict\") compare equal if and only if '\n'they\\n'\n' have equal *(key, value)* pairs. Equality comparison of the '\n'keys and\\n'\n' values enforces reflexivity.\\n'\n'\\n'\n' Order comparisons (\"<\", \">\", \"<=\", and \">=\") raise '\n'\"TypeError\".\\n'\n'\\n'\n'* Sets (instances of \"set\" or \"frozenset\") can be compared '\n'within and\\n'\n' across their types.\\n'\n'\\n'\n' They define order comparison operators to mean subset and '\n'superset\\n'\n' tests. Those relations do not define total orderings (for '\n'example,\\n'\n' the two sets \"{1,2}\" and \"{2,3}\" are not equal, nor subsets '\n'of one\\n'\n' another, nor supersets of one another). Accordingly, sets '\n'are not\\n'\n' appropriate arguments for functions which depend on total '\n'ordering\\n'\n' (for example, \"min()\", \"max()\", and \"sorted()\" produce '\n'undefined\\n'\n' results given a list of sets as inputs).\\n'\n'\\n'\n' Comparison of sets enforces reflexivity of its elements.\\n'\n'\\n'\n'* Most other built-in types have no comparison methods '\n'implemented, so\\n'\n' they inherit the default comparison behavior.\\n'\n'\\n'\n'User-defined classes that customize their comparison behavior '\n'should\\n'\n'follow some consistency rules, if possible:\\n'\n'\\n'\n'* Equality comparison should be reflexive. In other words, '\n'identical\\n'\n' objects should compare equal:\\n'\n'\\n'\n' \"x is y\" implies \"x == y\"\\n'\n'\\n'\n'* Comparison should be symmetric. In other words, the '\n'following\\n'\n' expressions should have the same result:\\n'\n'\\n'\n' \"x == y\" and \"y == x\"\\n'\n'\\n'\n' \"x != y\" and \"y != x\"\\n'\n'\\n'\n' \"x < y\" and \"y > x\"\\n'\n'\\n'\n' \"x <= y\" and \"y >= x\"\\n'\n'\\n'\n'* Comparison should be transitive. The following '\n'(non-exhaustive)\\n'\n' examples illustrate that:\\n'\n'\\n'\n' \"x > y and y > z\" implies \"x > z\"\\n'\n'\\n'\n' \"x < y and y <= z\" implies \"x < z\"\\n'\n'\\n'\n'* Inverse comparison should result in the boolean negation. '\n'In other\\n'\n' words, the following expressions should have the same '\n'result:\\n'\n'\\n'\n' \"x == y\" and \"not x != y\"\\n'\n'\\n'\n' \"x < y\" and \"not x >= y\" (for total ordering)\\n'\n'\\n'\n' \"x > y\" and \"not x <= y\" (for total ordering)\\n'\n'\\n'\n' The last two expressions apply to totally ordered '\n'collections (e.g.\\n'\n' to sequences, but not to sets or mappings). See also the\\n'\n' \"total_ordering()\" decorator.\\n'\n'\\n'\n'* The \"hash()\" result should be consistent with equality. '\n'Objects that\\n'\n' are equal should either have the same hash value, or be '\n'marked as\\n'\n' unhashable.\\n'\n'\\n'\n'Python does not enforce these consistency rules. In fact, '\n'the\\n'\n'not-a-number values are an example for not following these '\n'rules.\\n'\n'\\n'\n'\\n'\n'Membership test operations\\n'\n'==========================\\n'\n'\\n'\n'The operators \"in\" and \"not in\" test for membership. \"x in '\n's\"\\n'\n'evaluates to \"True\" if *x* is a member of *s*, and \"False\" '\n'otherwise.\\n'\n'\"x not in s\" returns the negation of \"x in s\". All built-in '\n'sequences\\n'\n'and set types support this as well as dictionary, for which '\n'\"in\" tests\\n'\n'whether the dictionary has a given key. For container types '\n'such as\\n'\n'list, tuple, set, frozenset, dict, or collections.deque, the\\n'\n'expression \"x in y\" is equivalent to \"any(x is e or x == e '\n'for e in\\n'\n'y)\".\\n'\n'\\n'\n'For the string and bytes types, \"x in y\" is \"True\" if and '\n'only if *x*\\n'\n'is a substring of *y*. An equivalent test is \"y.find(x) != '\n'-1\".\\n'\n'Empty strings are always considered to be a substring of any '\n'other\\n'\n'string, so \"\"\" in \"abc\"\" will return \"True\".\\n'\n'\\n'\n'For user-defined classes which define the \"__contains__()\" '\n'method, \"x\\n'\n'in y\" returns \"True\" if \"y.__contains__(x)\" returns a true '\n'value, and\\n'\n'\"False\" otherwise.\\n'\n'\\n'\n'For user-defined classes which do not define \"__contains__()\" '\n'but do\\n'\n'define \"__iter__()\", \"x in y\" is \"True\" if some value \"z\", '\n'for which\\n'\n'the expression \"x is z or x == z\" is true, is produced while '\n'iterating\\n'\n'over \"y\". If an exception is raised during the iteration, it '\n'is as if\\n'\n'\"in\" raised that exception.\\n'\n'\\n'\n'Lastly, the old-style iteration protocol is tried: if a class '\n'defines\\n'\n'\"__getitem__()\", \"x in y\" is \"True\" if and only if there is a '\n'non-\\n'\n'negative integer index *i* such that \"x is y[i] or x == '\n'y[i]\", and no\\n'\n'lower integer index raises the \"IndexError\" exception. (If '\n'any other\\n'\n'exception is raised, it is as if \"in\" raised that '\n'exception).\\n'\n'\\n'\n'The operator \"not in\" is defined to have the inverse truth '\n'value of\\n'\n'\"in\".\\n'\n'\\n'\n'\\n'\n'Identity comparisons\\n'\n'====================\\n'\n'\\n'\n'The operators \"is\" and \"is not\" test for an object\u2019s '\n'identity: \"x is\\n'\n'y\" is true if and only if *x* and *y* are the same object. '\n'An\\n'\n'Object\u2019s identity is determined using the \"id()\" function. '\n'\"x is not\\n'\n'y\" yields the inverse truth value. [4]\\n',\n'compound':'Compound statements\\n'\n'*******************\\n'\n'\\n'\n'Compound statements contain (groups of) other statements; they '\n'affect\\n'\n'or control the execution of those other statements in some way. '\n'In\\n'\n'general, compound statements span multiple lines, although in '\n'simple\\n'\n'incarnations a whole compound statement may be contained in one '\n'line.\\n'\n'\\n'\n'The \"if\", \"while\" and \"for\" statements implement traditional '\n'control\\n'\n'flow constructs. \"try\" specifies exception handlers and/or '\n'cleanup\\n'\n'code for a group of statements, while the \"with\" statement '\n'allows the\\n'\n'execution of initialization and finalization code around a block '\n'of\\n'\n'code. Function and class definitions are also syntactically '\n'compound\\n'\n'statements.\\n'\n'\\n'\n'A compound statement consists of one or more \u2018clauses.\u2019 A '\n'clause\\n'\n'consists of a header and a \u2018suite.\u2019 The clause headers of a\\n'\n'particular compound statement are all at the same indentation '\n'level.\\n'\n'Each clause header begins with a uniquely identifying keyword '\n'and ends\\n'\n'with a colon. A suite is a group of statements controlled by a\\n'\n'clause. A suite can be one or more semicolon-separated simple\\n'\n'statements on the same line as the header, following the '\n'header\u2019s\\n'\n'colon, or it can be one or more indented statements on '\n'subsequent\\n'\n'lines. Only the latter form of a suite can contain nested '\n'compound\\n'\n'statements; the following is illegal, mostly because it wouldn\u2019t '\n'be\\n'\n'clear to which \"if\" clause a following \"else\" clause would '\n'belong:\\n'\n'\\n'\n' if test1: if test2: print(x)\\n'\n'\\n'\n'Also note that the semicolon binds tighter than the colon in '\n'this\\n'\n'context, so that in the following example, either all or none of '\n'the\\n'\n'\"print()\" calls are executed:\\n'\n'\\n'\n' if x < y < z: print(x); print(y); print(z)\\n'\n'\\n'\n'Summarizing:\\n'\n'\\n'\n' compound_stmt ::= if_stmt\\n'\n' | while_stmt\\n'\n' | for_stmt\\n'\n' | try_stmt\\n'\n' | with_stmt\\n'\n' | match_stmt\\n'\n' | funcdef\\n'\n' | classdef\\n'\n' | async_with_stmt\\n'\n' | async_for_stmt\\n'\n' | async_funcdef\\n'\n' suite ::= stmt_list NEWLINE | NEWLINE INDENT '\n'statement+ DEDENT\\n'\n' statement ::= stmt_list NEWLINE | compound_stmt\\n'\n' stmt_list ::= simple_stmt (\";\" simple_stmt)* [\";\"]\\n'\n'\\n'\n'Note that statements always end in a \"NEWLINE\" possibly followed '\n'by a\\n'\n'\"DEDENT\". Also note that optional continuation clauses always '\n'begin\\n'\n'with a keyword that cannot start a statement, thus there are no\\n'\n'ambiguities (the \u2018dangling \"else\"\u2019 problem is solved in Python '\n'by\\n'\n'requiring nested \"if\" statements to be indented).\\n'\n'\\n'\n'The formatting of the grammar rules in the following sections '\n'places\\n'\n'each clause on a separate line for clarity.\\n'\n'\\n'\n'\\n'\n'The \"if\" statement\\n'\n'==================\\n'\n'\\n'\n'The \"if\" statement is used for conditional execution:\\n'\n'\\n'\n' if_stmt ::= \"if\" assignment_expression \":\" suite\\n'\n' (\"elif\" assignment_expression \":\" suite)*\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'It selects exactly one of the suites by evaluating the '\n'expressions one\\n'\n'by one until one is found to be true (see section Boolean '\n'operations\\n'\n'for the definition of true and false); then that suite is '\n'executed\\n'\n'(and no other part of the \"if\" statement is executed or '\n'evaluated).\\n'\n'If all expressions are false, the suite of the \"else\" clause, '\n'if\\n'\n'present, is executed.\\n'\n'\\n'\n'\\n'\n'The \"while\" statement\\n'\n'=====================\\n'\n'\\n'\n'The \"while\" statement is used for repeated execution as long as '\n'an\\n'\n'expression is true:\\n'\n'\\n'\n' while_stmt ::= \"while\" assignment_expression \":\" suite\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'This repeatedly tests the expression and, if it is true, '\n'executes the\\n'\n'first suite; if the expression is false (which may be the first '\n'time\\n'\n'it is tested) the suite of the \"else\" clause, if present, is '\n'executed\\n'\n'and the loop terminates.\\n'\n'\\n'\n'A \"break\" statement executed in the first suite terminates the '\n'loop\\n'\n'without executing the \"else\" clause\u2019s suite. A \"continue\" '\n'statement\\n'\n'executed in the first suite skips the rest of the suite and goes '\n'back\\n'\n'to testing the expression.\\n'\n'\\n'\n'\\n'\n'The \"for\" statement\\n'\n'===================\\n'\n'\\n'\n'The \"for\" statement is used to iterate over the elements of a '\n'sequence\\n'\n'(such as a string, tuple or list) or other iterable object:\\n'\n'\\n'\n' for_stmt ::= \"for\" target_list \"in\" expression_list \":\" '\n'suite\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'The expression list is evaluated once; it should yield an '\n'iterable\\n'\n'object. An iterator is created for the result of the\\n'\n'\"expression_list\". The suite is then executed once for each '\n'item\\n'\n'provided by the iterator, in the order returned by the '\n'iterator. Each\\n'\n'item in turn is assigned to the target list using the standard '\n'rules\\n'\n'for assignments (see Assignment statements), and then the suite '\n'is\\n'\n'executed. When the items are exhausted (which is immediately '\n'when the\\n'\n'sequence is empty or an iterator raises a \"StopIteration\" '\n'exception),\\n'\n'the suite in the \"else\" clause, if present, is executed, and the '\n'loop\\n'\n'terminates.\\n'\n'\\n'\n'A \"break\" statement executed in the first suite terminates the '\n'loop\\n'\n'without executing the \"else\" clause\u2019s suite. A \"continue\" '\n'statement\\n'\n'executed in the first suite skips the rest of the suite and '\n'continues\\n'\n'with the next item, or with the \"else\" clause if there is no '\n'next\\n'\n'item.\\n'\n'\\n'\n'The for-loop makes assignments to the variables in the target '\n'list.\\n'\n'This overwrites all previous assignments to those variables '\n'including\\n'\n'those made in the suite of the for-loop:\\n'\n'\\n'\n' for i in range(10):\\n'\n' print(i)\\n'\n' i = 5 # this will not affect the for-loop\\n'\n' # because i will be overwritten with '\n'the next\\n'\n' # index in the range\\n'\n'\\n'\n'Names in the target list are not deleted when the loop is '\n'finished,\\n'\n'but if the sequence is empty, they will not have been assigned '\n'to at\\n'\n'all by the loop. Hint: the built-in function \"range()\" returns '\n'an\\n'\n'iterator of integers suitable to emulate the effect of Pascal\u2019s '\n'\"for i\\n'\n':= a to b do\"; e.g., \"list(range(3))\" returns the list \"[0, 1, '\n'2]\".\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' There is a subtlety when the sequence is being modified by the '\n'loop\\n'\n' (this can only occur for mutable sequences, e.g. lists). An\\n'\n' internal counter is used to keep track of which item is used '\n'next,\\n'\n' and this is incremented on each iteration. When this counter '\n'has\\n'\n' reached the length of the sequence the loop terminates. This '\n'means\\n'\n' that if the suite deletes the current (or a previous) item '\n'from the\\n'\n' sequence, the next item will be skipped (since it gets the '\n'index of\\n'\n' the current item which has already been treated). Likewise, '\n'if the\\n'\n' suite inserts an item in the sequence before the current item, '\n'the\\n'\n' current item will be treated again the next time through the '\n'loop.\\n'\n' This can lead to nasty bugs that can be avoided by making a\\n'\n' temporary copy using a slice of the whole sequence, e.g.,\\n'\n'\\n'\n' for x in a[:]:\\n'\n' if x < 0: a.remove(x)\\n'\n'\\n'\n'\\n'\n'The \"try\" statement\\n'\n'===================\\n'\n'\\n'\n'The \"try\" statement specifies exception handlers and/or cleanup '\n'code\\n'\n'for a group of statements:\\n'\n'\\n'\n' try_stmt ::= try1_stmt | try2_stmt\\n'\n' try1_stmt ::= \"try\" \":\" suite\\n'\n' (\"except\" [expression [\"as\" identifier]] \":\" '\n'suite)+\\n'\n' [\"else\" \":\" suite]\\n'\n' [\"finally\" \":\" suite]\\n'\n' try2_stmt ::= \"try\" \":\" suite\\n'\n' \"finally\" \":\" suite\\n'\n'\\n'\n'The \"except\" clause(s) specify one or more exception handlers. '\n'When no\\n'\n'exception occurs in the \"try\" clause, no exception handler is\\n'\n'executed. When an exception occurs in the \"try\" suite, a search '\n'for an\\n'\n'exception handler is started. This search inspects the except '\n'clauses\\n'\n'in turn until one is found that matches the exception. An '\n'expression-\\n'\n'less except clause, if present, must be last; it matches any\\n'\n'exception. For an except clause with an expression, that '\n'expression\\n'\n'is evaluated, and the clause matches the exception if the '\n'resulting\\n'\n'object is \u201ccompatible\u201d with the exception. An object is '\n'compatible\\n'\n'with an exception if it is the class or a base class of the '\n'exception\\n'\n'object, or a tuple containing an item that is the class or a '\n'base\\n'\n'class of the exception object.\\n'\n'\\n'\n'If no except clause matches the exception, the search for an '\n'exception\\n'\n'handler continues in the surrounding code and on the invocation '\n'stack.\\n'\n'[1]\\n'\n'\\n'\n'If the evaluation of an expression in the header of an except '\n'clause\\n'\n'raises an exception, the original search for a handler is '\n'canceled and\\n'\n'a search starts for the new exception in the surrounding code '\n'and on\\n'\n'the call stack (it is treated as if the entire \"try\" statement '\n'raised\\n'\n'the exception).\\n'\n'\\n'\n'When a matching except clause is found, the exception is '\n'assigned to\\n'\n'the target specified after the \"as\" keyword in that except '\n'clause, if\\n'\n'present, and the except clause\u2019s suite is executed. All except\\n'\n'clauses must have an executable block. When the end of this '\n'block is\\n'\n'reached, execution continues normally after the entire try '\n'statement.\\n'\n'(This means that if two nested handlers exist for the same '\n'exception,\\n'\n'and the exception occurs in the try clause of the inner handler, '\n'the\\n'\n'outer handler will not handle the exception.)\\n'\n'\\n'\n'When an exception has been assigned using \"as target\", it is '\n'cleared\\n'\n'at the end of the except clause. This is as if\\n'\n'\\n'\n' except E as N:\\n'\n' foo\\n'\n'\\n'\n'was translated to\\n'\n'\\n'\n' except E as N:\\n'\n' try:\\n'\n' foo\\n'\n' finally:\\n'\n' del N\\n'\n'\\n'\n'This means the exception must be assigned to a different name to '\n'be\\n'\n'able to refer to it after the except clause. Exceptions are '\n'cleared\\n'\n'because with the traceback attached to them, they form a '\n'reference\\n'\n'cycle with the stack frame, keeping all locals in that frame '\n'alive\\n'\n'until the next garbage collection occurs.\\n'\n'\\n'\n'Before an except clause\u2019s suite is executed, details about the\\n'\n'exception are stored in the \"sys\" module and can be accessed '\n'via\\n'\n'\"sys.exc_info()\". \"sys.exc_info()\" returns a 3-tuple consisting '\n'of the\\n'\n'exception class, the exception instance and a traceback object '\n'(see\\n'\n'section The standard type hierarchy) identifying the point in '\n'the\\n'\n'program where the exception occurred. The details about the '\n'exception\\n'\n'accessed via \"sys.exc_info()\" are restored to their previous '\n'values\\n'\n'when leaving an exception handler:\\n'\n'\\n'\n' >>> print(sys.exc_info())\\n'\n' (None, None, None)\\n'\n' >>> try:\\n'\n' ... raise TypeError\\n'\n' ... except:\\n'\n' ... print(sys.exc_info())\\n'\n' ... try:\\n'\n' ... raise ValueError\\n'\n' ... except:\\n'\n' ... print(sys.exc_info())\\n'\n' ... print(sys.exc_info())\\n'\n' ...\\n'\n\" (, TypeError(), )\\n'\n\" (, ValueError(), )\\n'\n\" (, TypeError(), )\\n'\n' >>> print(sys.exc_info())\\n'\n' (None, None, None)\\n'\n'\\n'\n'The optional \"else\" clause is executed if the control flow '\n'leaves the\\n'\n'\"try\" suite, no exception was raised, and no \"return\", '\n'\"continue\", or\\n'\n'\"break\" statement was executed. Exceptions in the \"else\" clause '\n'are\\n'\n'not handled by the preceding \"except\" clauses.\\n'\n'\\n'\n'If \"finally\" is present, it specifies a \u2018cleanup\u2019 handler. The '\n'\"try\"\\n'\n'clause is executed, including any \"except\" and \"else\" clauses. '\n'If an\\n'\n'exception occurs in any of the clauses and is not handled, the\\n'\n'exception is temporarily saved. The \"finally\" clause is '\n'executed. If\\n'\n'there is a saved exception it is re-raised at the end of the '\n'\"finally\"\\n'\n'clause. If the \"finally\" clause raises another exception, the '\n'saved\\n'\n'exception is set as the context of the new exception. If the '\n'\"finally\"\\n'\n'clause executes a \"return\", \"break\" or \"continue\" statement, the '\n'saved\\n'\n'exception is discarded:\\n'\n'\\n'\n' >>> def f():\\n'\n' ... try:\\n'\n' ... 1/0\\n'\n' ... finally:\\n'\n' ... return 42\\n'\n' ...\\n'\n' >>> f()\\n'\n' 42\\n'\n'\\n'\n'The exception information is not available to the program '\n'during\\n'\n'execution of the \"finally\" clause.\\n'\n'\\n'\n'When a \"return\", \"break\" or \"continue\" statement is executed in '\n'the\\n'\n'\"try\" suite of a \"try\"\u2026\"finally\" statement, the \"finally\" clause '\n'is\\n'\n'also executed \u2018on the way out.\u2019\\n'\n'\\n'\n'The return value of a function is determined by the last '\n'\"return\"\\n'\n'statement executed. Since the \"finally\" clause always executes, '\n'a\\n'\n'\"return\" statement executed in the \"finally\" clause will always '\n'be the\\n'\n'last one executed:\\n'\n'\\n'\n' >>> def foo():\\n'\n' ... try:\\n'\n\" ... return 'try'\\n\"\n' ... finally:\\n'\n\" ... return 'finally'\\n\"\n' ...\\n'\n' >>> foo()\\n'\n\" 'finally'\\n\"\n'\\n'\n'Additional information on exceptions can be found in section\\n'\n'Exceptions, and information on using the \"raise\" statement to '\n'generate\\n'\n'exceptions may be found in section The raise statement.\\n'\n'\\n'\n'Changed in version 3.8: Prior to Python 3.8, a \"continue\" '\n'statement\\n'\n'was illegal in the \"finally\" clause due to a problem with the\\n'\n'implementation.\\n'\n'\\n'\n'\\n'\n'The \"with\" statement\\n'\n'====================\\n'\n'\\n'\n'The \"with\" statement is used to wrap the execution of a block '\n'with\\n'\n'methods defined by a context manager (see section With '\n'Statement\\n'\n'Context Managers). This allows common \"try\"\u2026\"except\"\u2026\"finally\" '\n'usage\\n'\n'patterns to be encapsulated for convenient reuse.\\n'\n'\\n'\n' with_stmt ::= \"with\" ( \"(\" with_stmt_contents \",\"? '\n'\")\" | with_stmt_contents ) \":\" suite\\n'\n' with_stmt_contents ::= with_item (\",\" with_item)*\\n'\n' with_item ::= expression [\"as\" target]\\n'\n'\\n'\n'The execution of the \"with\" statement with one \u201citem\u201d proceeds '\n'as\\n'\n'follows:\\n'\n'\\n'\n'1. The context expression (the expression given in the '\n'\"with_item\") is\\n'\n' evaluated to obtain a context manager.\\n'\n'\\n'\n'2. The context manager\u2019s \"__enter__()\" is loaded for later use.\\n'\n'\\n'\n'3. The context manager\u2019s \"__exit__()\" is loaded for later use.\\n'\n'\\n'\n'4. The context manager\u2019s \"__enter__()\" method is invoked.\\n'\n'\\n'\n'5. If a target was included in the \"with\" statement, the return '\n'value\\n'\n' from \"__enter__()\" is assigned to it.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The \"with\" statement guarantees that if the \"__enter__()\" '\n'method\\n'\n' returns without an error, then \"__exit__()\" will always be\\n'\n' called. Thus, if an error occurs during the assignment to '\n'the\\n'\n' target list, it will be treated the same as an error '\n'occurring\\n'\n' within the suite would be. See step 6 below.\\n'\n'\\n'\n'6. The suite is executed.\\n'\n'\\n'\n'7. The context manager\u2019s \"__exit__()\" method is invoked. If an\\n'\n' exception caused the suite to be exited, its type, value, '\n'and\\n'\n' traceback are passed as arguments to \"__exit__()\". Otherwise, '\n'three\\n'\n' \"None\" arguments are supplied.\\n'\n'\\n'\n' If the suite was exited due to an exception, and the return '\n'value\\n'\n' from the \"__exit__()\" method was false, the exception is '\n'reraised.\\n'\n' If the return value was true, the exception is suppressed, '\n'and\\n'\n' execution continues with the statement following the \"with\"\\n'\n' statement.\\n'\n'\\n'\n' If the suite was exited for any reason other than an '\n'exception, the\\n'\n' return value from \"__exit__()\" is ignored, and execution '\n'proceeds\\n'\n' at the normal location for the kind of exit that was taken.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' with EXPRESSION as TARGET:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' manager = (EXPRESSION)\\n'\n' enter = type(manager).__enter__\\n'\n' exit = type(manager).__exit__\\n'\n' value = enter(manager)\\n'\n' hit_except = False\\n'\n'\\n'\n' try:\\n'\n' TARGET = value\\n'\n' SUITE\\n'\n' except:\\n'\n' hit_except = True\\n'\n' if not exit(manager, *sys.exc_info()):\\n'\n' raise\\n'\n' finally:\\n'\n' if not hit_except:\\n'\n' exit(manager, None, None, None)\\n'\n'\\n'\n'With more than one item, the context managers are processed as '\n'if\\n'\n'multiple \"with\" statements were nested:\\n'\n'\\n'\n' with A() as a, B() as b:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' with A() as a:\\n'\n' with B() as b:\\n'\n' SUITE\\n'\n'\\n'\n'You can also write multi-item context managers in multiple lines '\n'if\\n'\n'the items are surrounded by parentheses. For example:\\n'\n'\\n'\n' with (\\n'\n' A() as a,\\n'\n' B() as b,\\n'\n' ):\\n'\n' SUITE\\n'\n'\\n'\n'Changed in version 3.1: Support for multiple context '\n'expressions.\\n'\n'\\n'\n'Changed in version 3.10: Support for using grouping parentheses '\n'to\\n'\n'break the statement in multiple lines.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 343** - The \u201cwith\u201d statement\\n'\n' The specification, background, and examples for the Python '\n'\"with\"\\n'\n' statement.\\n'\n'\\n'\n'\\n'\n'The \"match\" statement\\n'\n'=====================\\n'\n'\\n'\n'New in version 3.10.\\n'\n'\\n'\n'The match statement is used for pattern matching. Syntax:\\n'\n'\\n'\n' match_stmt ::= \\'match\\' subject_expr \":\" NEWLINE INDENT '\n'case_block+ DEDENT\\n'\n' subject_expr ::= star_named_expression \",\" '\n'star_named_expressions?\\n'\n' | named_expression\\n'\n' case_block ::= \\'case\\' patterns [guard] \":\" block\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' This section uses single quotes to denote soft keywords.\\n'\n'\\n'\n'Pattern matching takes a pattern as input (following \"case\") and '\n'a\\n'\n'subject value (following \"match\"). The pattern (which may '\n'contain\\n'\n'subpatterns) is matched against the subject value. The outcomes '\n'are:\\n'\n'\\n'\n'* A match success or failure (also termed a pattern success or\\n'\n' failure).\\n'\n'\\n'\n'* Possible binding of matched values to a name. The '\n'prerequisites for\\n'\n' this are further discussed below.\\n'\n'\\n'\n'The \"match\" and \"case\" keywords are soft keywords.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' * **PEP 634** \u2013 Structural Pattern Matching: Specification\\n'\n'\\n'\n' * **PEP 636** \u2013 Structural Pattern Matching: Tutorial\\n'\n'\\n'\n'\\n'\n'Overview\\n'\n'--------\\n'\n'\\n'\n'Here\u2019s an overview of the logical flow of a match statement:\\n'\n'\\n'\n'1. The subject expression \"subject_expr\" is evaluated and a '\n'resulting\\n'\n' subject value obtained. If the subject expression contains a '\n'comma,\\n'\n' a tuple is constructed using the standard rules.\\n'\n'\\n'\n'2. Each pattern in a \"case_block\" is attempted to match with '\n'the\\n'\n' subject value. The specific rules for success or failure are\\n'\n' described below. The match attempt can also bind some or all '\n'of the\\n'\n' standalone names within the pattern. The precise pattern '\n'binding\\n'\n' rules vary per pattern type and are specified below. **Name\\n'\n' bindings made during a successful pattern match outlive the\\n'\n' executed block and can be used after the match statement**.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' During failed pattern matches, some subpatterns may '\n'succeed.\\n'\n' Do not rely on bindings being made for a failed match.\\n'\n' Conversely, do not rely on variables remaining unchanged '\n'after\\n'\n' a failed match. The exact behavior is dependent on\\n'\n' implementation and may vary. This is an intentional '\n'decision\\n'\n' made to allow different implementations to add '\n'optimizations.\\n'\n'\\n'\n'3. If the pattern succeeds, the corresponding guard (if present) '\n'is\\n'\n' evaluated. In this case all name bindings are guaranteed to '\n'have\\n'\n' happened.\\n'\n'\\n'\n' * If the guard evaluates as truthy or missing, the \"block\" '\n'inside\\n'\n' \"case_block\" is executed.\\n'\n'\\n'\n' * Otherwise, the next \"case_block\" is attempted as described '\n'above.\\n'\n'\\n'\n' * If there are no further case blocks, the match statement '\n'is\\n'\n' completed.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Users should generally never rely on a pattern being '\n'evaluated.\\n'\n' Depending on implementation, the interpreter may cache values '\n'or use\\n'\n' other optimizations which skip repeated evaluations.\\n'\n'\\n'\n'A sample match statement:\\n'\n'\\n'\n' >>> flag = False\\n'\n' >>> match (100, 200):\\n'\n' ... case (100, 300): # Mismatch: 200 != 300\\n'\n\" ... print('Case 1')\\n\"\n' ... case (100, 200) if flag: # Successful match, but '\n'guard fails\\n'\n\" ... print('Case 2')\\n\"\n' ... case (100, y): # Matches and binds y to 200\\n'\n\" ... print(f'Case 3, y: {y}')\\n\"\n' ... case _: # Pattern not attempted\\n'\n\" ... print('Case 4, I match anything!')\\n\"\n' ...\\n'\n' Case 3, y: 200\\n'\n'\\n'\n'In this case, \"if flag\" is a guard. Read more about that in the '\n'next\\n'\n'section.\\n'\n'\\n'\n'\\n'\n'Guards\\n'\n'------\\n'\n'\\n'\n' guard ::= \"if\" named_expression\\n'\n'\\n'\n'A \"guard\" (which is part of the \"case\") must succeed for code '\n'inside\\n'\n'the \"case\" block to execute. It takes the form: \"if\" followed '\n'by an\\n'\n'expression.\\n'\n'\\n'\n'The logical flow of a \"case\" block with a \"guard\" follows:\\n'\n'\\n'\n'1. Check that the pattern in the \"case\" block succeeded. If '\n'the\\n'\n' pattern failed, the \"guard\" is not evaluated and the next '\n'\"case\"\\n'\n' block is checked.\\n'\n'\\n'\n'2. If the pattern succeeded, evaluate the \"guard\".\\n'\n'\\n'\n' * If the \"guard\" condition evaluates to \u201ctruthy\u201d, the case '\n'block is\\n'\n' selected.\\n'\n'\\n'\n' * If the \"guard\" condition evaluates to \u201cfalsy\u201d, the case '\n'block is\\n'\n' not selected.\\n'\n'\\n'\n' * If the \"guard\" raises an exception during evaluation, the\\n'\n' exception bubbles up.\\n'\n'\\n'\n'Guards are allowed to have side effects as they are '\n'expressions.\\n'\n'Guard evaluation must proceed from the first to the last case '\n'block,\\n'\n'one at a time, skipping case blocks whose pattern(s) don\u2019t all\\n'\n'succeed. (I.e., guard evaluation must happen in order.) Guard\\n'\n'evaluation must stop once a case block is selected.\\n'\n'\\n'\n'\\n'\n'Irrefutable Case Blocks\\n'\n'-----------------------\\n'\n'\\n'\n'An irrefutable case block is a match-all case block. A match\\n'\n'statement may have at most one irrefutable case block, and it '\n'must be\\n'\n'last.\\n'\n'\\n'\n'A case block is considered irrefutable if it has no guard and '\n'its\\n'\n'pattern is irrefutable. A pattern is considered irrefutable if '\n'we can\\n'\n'prove from its syntax alone that it will always succeed. Only '\n'the\\n'\n'following patterns are irrefutable:\\n'\n'\\n'\n'* AS Patterns whose left-hand side is irrefutable\\n'\n'\\n'\n'* OR Patterns containing at least one irrefutable pattern\\n'\n'\\n'\n'* Capture Patterns\\n'\n'\\n'\n'* Wildcard Patterns\\n'\n'\\n'\n'* parenthesized irrefutable patterns\\n'\n'\\n'\n'\\n'\n'Patterns\\n'\n'--------\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' This section uses grammar notations beyond standard EBNF:\\n'\n'\\n'\n' * the notation \"SEP.RULE+\" is shorthand for \"RULE (SEP '\n'RULE)*\"\\n'\n'\\n'\n' * the notation \"!RULE\" is shorthand for a negative lookahead\\n'\n' assertion\\n'\n'\\n'\n'The top-level syntax for \"patterns\" is:\\n'\n'\\n'\n' patterns ::= open_sequence_pattern | pattern\\n'\n' pattern ::= as_pattern | or_pattern\\n'\n' closed_pattern ::= | literal_pattern\\n'\n' | capture_pattern\\n'\n' | wildcard_pattern\\n'\n' | value_pattern\\n'\n' | group_pattern\\n'\n' | sequence_pattern\\n'\n' | mapping_pattern\\n'\n' | class_pattern\\n'\n'\\n'\n'The descriptions below will include a description \u201cin simple '\n'terms\u201d of\\n'\n'what a pattern does for illustration purposes (credits to '\n'Raymond\\n'\n'Hettinger for a document that inspired most of the '\n'descriptions). Note\\n'\n'that these descriptions are purely for illustration purposes and '\n'**may\\n'\n'not** reflect the underlying implementation. Furthermore, they '\n'do not\\n'\n'cover all valid forms.\\n'\n'\\n'\n'\\n'\n'OR Patterns\\n'\n'~~~~~~~~~~~\\n'\n'\\n'\n'An OR pattern is two or more patterns separated by vertical bars '\n'\"|\".\\n'\n'Syntax:\\n'\n'\\n'\n' or_pattern ::= \"|\".closed_pattern+\\n'\n'\\n'\n'Only the final subpattern may be irrefutable, and each '\n'subpattern must\\n'\n'bind the same set of names to avoid ambiguity.\\n'\n'\\n'\n'An OR pattern matches each of its subpatterns in turn to the '\n'subject\\n'\n'value, until one succeeds. The OR pattern is then considered\\n'\n'successful. Otherwise, if none of the subpatterns succeed, the '\n'OR\\n'\n'pattern fails.\\n'\n'\\n'\n'In simple terms, \"P1 | P2 | ...\" will try to match \"P1\", if it '\n'fails\\n'\n'it will try to match \"P2\", succeeding immediately if any '\n'succeeds,\\n'\n'failing otherwise.\\n'\n'\\n'\n'\\n'\n'AS Patterns\\n'\n'~~~~~~~~~~~\\n'\n'\\n'\n'An AS pattern matches an OR pattern on the left of the \"as\" '\n'keyword\\n'\n'against a subject. Syntax:\\n'\n'\\n'\n' as_pattern ::= or_pattern \"as\" capture_pattern\\n'\n'\\n'\n'If the OR pattern fails, the AS pattern fails. Otherwise, the '\n'AS\\n'\n'pattern binds the subject to the name on the right of the as '\n'keyword\\n'\n'and succeeds. \"capture_pattern\" cannot be a a \"_\".\\n'\n'\\n'\n'In simple terms \"P as NAME\" will match with \"P\", and on success '\n'it\\n'\n'will set \"NAME = \".\\n'\n'\\n'\n'\\n'\n'Literal Patterns\\n'\n'~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A literal pattern corresponds to most literals in Python. '\n'Syntax:\\n'\n'\\n'\n' literal_pattern ::= signed_number\\n'\n' | signed_number \"+\" NUMBER\\n'\n' | signed_number \"-\" NUMBER\\n'\n' | strings\\n'\n' | \"None\"\\n'\n' | \"True\"\\n'\n' | \"False\"\\n'\n' | signed_number: NUMBER | \"-\" NUMBER\\n'\n'\\n'\n'The rule \"strings\" and the token \"NUMBER\" are defined in the '\n'standard\\n'\n'Python grammar. Triple-quoted strings are supported. Raw '\n'strings and\\n'\n'byte strings are supported. Formatted string literals are not\\n'\n'supported.\\n'\n'\\n'\n'The forms \"signed_number \\'+\\' NUMBER\" and \"signed_number \\'-\\' '\n'NUMBER\"\\n'\n'are for expressing complex numbers; they require a real number '\n'on the\\n'\n'left and an imaginary number on the right. E.g. \"3 + 4j\".\\n'\n'\\n'\n'In simple terms, \"LITERAL\" will succeed only if \" ==\\n'\n'LITERAL\". For the singletons \"None\", \"True\" and \"False\", the '\n'\"is\"\\n'\n'operator is used.\\n'\n'\\n'\n'\\n'\n'Capture Patterns\\n'\n'~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A capture pattern binds the subject value to a name. Syntax:\\n'\n'\\n'\n\" capture_pattern ::= !'_' NAME\\n\"\n'\\n'\n'A single underscore \"_\" is not a capture pattern (this is what '\n'\"!\\'_\\'\"\\n'\n'expresses). It is instead treated as a \"wildcard_pattern\".\\n'\n'\\n'\n'In a given pattern, a given name can only be bound once. E.g. '\n'\"case\\n'\n'x, x: ...\" is invalid while \"case [x] | x: ...\" is allowed.\\n'\n'\\n'\n'Capture patterns always succeed. The binding follows scoping '\n'rules\\n'\n'established by the assignment expression operator in **PEP '\n'572**; the\\n'\n'name becomes a local variable in the closest containing function '\n'scope\\n'\n'unless there\u2019s an applicable \"global\" or \"nonlocal\" statement.\\n'\n'\\n'\n'In simple terms \"NAME\" will always succeed and it will set \"NAME '\n'=\\n'\n'\".\\n'\n'\\n'\n'\\n'\n'Wildcard Patterns\\n'\n'~~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A wildcard pattern always succeeds (matches anything) and binds '\n'no\\n'\n'name. Syntax:\\n'\n'\\n'\n\" wildcard_pattern ::= '_'\\n\"\n'\\n'\n'\"_\" is a soft keyword within any pattern, but only within '\n'patterns.\\n'\n'It is an identifier, as usual, even within \"match\" subject\\n'\n'expressions, \"guard\"s, and \"case\" blocks.\\n'\n'\\n'\n'In simple terms, \"_\" will always succeed.\\n'\n'\\n'\n'\\n'\n'Value Patterns\\n'\n'~~~~~~~~~~~~~~\\n'\n'\\n'\n'A value pattern represents a named value in Python. Syntax:\\n'\n'\\n'\n' value_pattern ::= attr\\n'\n' attr ::= name_or_attr \".\" NAME\\n'\n' name_or_attr ::= attr | NAME\\n'\n'\\n'\n'The dotted name in the pattern is looked up using standard '\n'Python name\\n'\n'resolution rules. The pattern succeeds if the value found '\n'compares\\n'\n'equal to the subject value (using the \"==\" equality operator).\\n'\n'\\n'\n'In simple terms \"NAME1.NAME2\" will succeed only if \" '\n'==\\n'\n'NAME1.NAME2\"\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' If the same value occurs multiple times in the same match '\n'statement,\\n'\n' the interpreter may cache the first value found and reuse it '\n'rather\\n'\n' than repeat the same lookup. This cache is strictly tied to a '\n'given\\n'\n' execution of a given match statement.\\n'\n'\\n'\n'\\n'\n'Group Patterns\\n'\n'~~~~~~~~~~~~~~\\n'\n'\\n'\n'A group pattern allows users to add parentheses around patterns '\n'to\\n'\n'emphasize the intended grouping. Otherwise, it has no '\n'additional\\n'\n'syntax. Syntax:\\n'\n'\\n'\n' group_pattern ::= \"(\" pattern \")\"\\n'\n'\\n'\n'In simple terms \"(P)\" has the same effect as \"P\".\\n'\n'\\n'\n'\\n'\n'Sequence Patterns\\n'\n'~~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A sequence pattern contains several subpatterns to be matched '\n'against\\n'\n'sequence elements. The syntax is similar to the unpacking of a '\n'list or\\n'\n'tuple.\\n'\n'\\n'\n' sequence_pattern ::= \"[\" [maybe_sequence_pattern] \"]\"\\n'\n' | \"(\" [open_sequence_pattern] \")\"\\n'\n' open_sequence_pattern ::= maybe_star_pattern \",\" '\n'[maybe_sequence_pattern]\\n'\n' maybe_sequence_pattern ::= \",\".maybe_star_pattern+ \",\"?\\n'\n' maybe_star_pattern ::= star_pattern | pattern\\n'\n' star_pattern ::= \"*\" (capture_pattern | '\n'wildcard_pattern)\\n'\n'\\n'\n'There is no difference if parentheses or square brackets are '\n'used for\\n'\n'sequence patterns (i.e. \"(...)\" vs \"[...]\" ).\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' A single pattern enclosed in parentheses without a trailing '\n'comma\\n'\n' (e.g. \"(3 | 4)\") is a group pattern. While a single pattern '\n'enclosed\\n'\n' in square brackets (e.g. \"[3 | 4]\") is still a sequence '\n'pattern.\\n'\n'\\n'\n'At most one star subpattern may be in a sequence pattern. The '\n'star\\n'\n'subpattern may occur in any position. If no star subpattern is\\n'\n'present, the sequence pattern is a fixed-length sequence '\n'pattern;\\n'\n'otherwise it is a variable-length sequence pattern.\\n'\n'\\n'\n'The following is the logical flow for matching a sequence '\n'pattern\\n'\n'against a subject value:\\n'\n'\\n'\n'1. If the subject value is not a sequence [2], the sequence '\n'pattern\\n'\n' fails.\\n'\n'\\n'\n'2. If the subject value is an instance of \"str\", \"bytes\" or\\n'\n' \"bytearray\" the sequence pattern fails.\\n'\n'\\n'\n'3. The subsequent steps depend on whether the sequence pattern '\n'is\\n'\n' fixed or variable-length.\\n'\n'\\n'\n' If the sequence pattern is fixed-length:\\n'\n'\\n'\n' 1. If the length of the subject sequence is not equal to the '\n'number\\n'\n' of subpatterns, the sequence pattern fails\\n'\n'\\n'\n' 2. Subpatterns in the sequence pattern are matched to their\\n'\n' corresponding items in the subject sequence from left to '\n'right.\\n'\n' Matching stops as soon as a subpattern fails. If all\\n'\n' subpatterns succeed in matching their corresponding item, '\n'the\\n'\n' sequence pattern succeeds.\\n'\n'\\n'\n' Otherwise, if the sequence pattern is variable-length:\\n'\n'\\n'\n' 1. If the length of the subject sequence is less than the '\n'number of\\n'\n' non-star subpatterns, the sequence pattern fails.\\n'\n'\\n'\n' 2. The leading non-star subpatterns are matched to their\\n'\n' corresponding items as for fixed-length sequences.\\n'\n'\\n'\n' 3. If the previous step succeeds, the star subpattern matches '\n'a\\n'\n' list formed of the remaining subject items, excluding the\\n'\n' remaining items corresponding to non-star subpatterns '\n'following\\n'\n' the star subpattern.\\n'\n'\\n'\n' 4. Remaining non-star subpatterns are matched to their\\n'\n' corresponding subject items, as for a fixed-length '\n'sequence.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The length of the subject sequence is obtained via \"len()\" '\n'(i.e.\\n'\n' via the \"__len__()\" protocol). This length may be cached '\n'by the\\n'\n' interpreter in a similar manner as value patterns.\\n'\n'\\n'\n'In simple terms \"[P1, P2, P3,\" \u2026 \", P]\" matches only if all '\n'the\\n'\n'following happens:\\n'\n'\\n'\n'* check \"\" is a sequence\\n'\n'\\n'\n'* \"len(subject) == \"\\n'\n'\\n'\n'* \"P1\" matches \"[0]\" (note that this match can also '\n'bind\\n'\n' names)\\n'\n'\\n'\n'* \"P2\" matches \"[1]\" (note that this match can also '\n'bind\\n'\n' names)\\n'\n'\\n'\n'* \u2026 and so on for the corresponding pattern/element.\\n'\n'\\n'\n'\\n'\n'Mapping Patterns\\n'\n'~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A mapping pattern contains one or more key-value patterns. The '\n'syntax\\n'\n'is similar to the construction of a dictionary. Syntax:\\n'\n'\\n'\n' mapping_pattern ::= \"{\" [items_pattern] \"}\"\\n'\n' items_pattern ::= \",\".key_value_pattern+ \",\"?\\n'\n' key_value_pattern ::= (literal_pattern | value_pattern) \":\" '\n'pattern\\n'\n' | double_star_pattern\\n'\n' double_star_pattern ::= \"**\" capture_pattern\\n'\n'\\n'\n'At most one double star pattern may be in a mapping pattern. '\n'The\\n'\n'double star pattern must be the last subpattern in the mapping\\n'\n'pattern.\\n'\n'\\n'\n'Duplicate keys in mapping patterns are disallowed. Duplicate '\n'literal\\n'\n'keys will raise a \"SyntaxError\". Two keys that otherwise have '\n'the same\\n'\n'value will raise a \"ValueError\" at runtime.\\n'\n'\\n'\n'The following is the logical flow for matching a mapping '\n'pattern\\n'\n'against a subject value:\\n'\n'\\n'\n'1. If the subject value is not a mapping [3],the mapping '\n'pattern\\n'\n' fails.\\n'\n'\\n'\n'2. If every key given in the mapping pattern is present in the '\n'subject\\n'\n' mapping, and the pattern for each key matches the '\n'corresponding\\n'\n' item of the subject mapping, the mapping pattern succeeds.\\n'\n'\\n'\n'3. If duplicate keys are detected in the mapping pattern, the '\n'pattern\\n'\n' is considered invalid. A \"SyntaxError\" is raised for '\n'duplicate\\n'\n' literal values; or a \"ValueError\" for named keys of the same '\n'value.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Key-value pairs are matched using the two-argument form of '\n'the\\n'\n' mapping subject\u2019s \"get()\" method. Matched key-value pairs '\n'must\\n'\n' already be present in the mapping, and not created on-the-fly '\n'via\\n'\n' \"__missing__()\" or \"__getitem__()\".\\n'\n'\\n'\n'In simple terms \"{KEY1: P1, KEY2: P2, ... }\" matches only if all '\n'the\\n'\n'following happens:\\n'\n'\\n'\n'* check \"\" is a mapping\\n'\n'\\n'\n'* \"KEY1 in \"\\n'\n'\\n'\n'* \"P1\" matches \"[KEY1]\"\\n'\n'\\n'\n'* \u2026 and so on for the corresponding KEY/pattern pair.\\n'\n'\\n'\n'\\n'\n'Class Patterns\\n'\n'~~~~~~~~~~~~~~\\n'\n'\\n'\n'A class pattern represents a class and its positional and '\n'keyword\\n'\n'arguments (if any). Syntax:\\n'\n'\\n'\n' class_pattern ::= name_or_attr \"(\" [pattern_arguments '\n'\",\"?] \")\"\\n'\n' pattern_arguments ::= positional_patterns [\",\" '\n'keyword_patterns]\\n'\n' | keyword_patterns\\n'\n' positional_patterns ::= \",\".pattern+\\n'\n' keyword_patterns ::= \",\".keyword_pattern+\\n'\n' keyword_pattern ::= NAME \"=\" pattern\\n'\n'\\n'\n'The same keyword should not be repeated in class patterns.\\n'\n'\\n'\n'The following is the logical flow for matching a mapping '\n'pattern\\n'\n'against a subject value:\\n'\n'\\n'\n'1. If \"name_or_attr\" is not an instance of the builtin \"type\" , '\n'raise\\n'\n' \"TypeError\".\\n'\n'\\n'\n'2. If the subject value is not an instance of \"name_or_attr\" '\n'(tested\\n'\n' via \"isinstance()\"), the class pattern fails.\\n'\n'\\n'\n'3. If no pattern arguments are present, the pattern succeeds.\\n'\n' Otherwise, the subsequent steps depend on whether keyword or\\n'\n' positional argument patterns are present.\\n'\n'\\n'\n' For a number of built-in types (specified below), a single\\n'\n' positional subpattern is accepted which will match the '\n'entire\\n'\n' subject; for these types keyword patterns also work as for '\n'other\\n'\n' types.\\n'\n'\\n'\n' If only keyword patterns are present, they are processed as\\n'\n' follows, one by one:\\n'\n'\\n'\n' I. The keyword is looked up as an attribute on the subject.\\n'\n'\\n'\n' * If this raises an exception other than \"AttributeError\", '\n'the\\n'\n' exception bubbles up.\\n'\n'\\n'\n' * If this raises \"AttributeError\", the class pattern has '\n'failed.\\n'\n'\\n'\n' * Else, the subpattern associated with the keyword pattern '\n'is\\n'\n' matched against the subject\u2019s attribute value. If this '\n'fails,\\n'\n' the class pattern fails; if this succeeds, the match '\n'proceeds\\n'\n' to the next keyword.\\n'\n'\\n'\n' II. If all keyword patterns succeed, the class pattern '\n'succeeds.\\n'\n'\\n'\n' If any positional patterns are present, they are converted '\n'to\\n'\n' keyword patterns using the \"__match_args__\" attribute on the '\n'class\\n'\n' \"name_or_attr\" before matching:\\n'\n'\\n'\n' I. The equivalent of \"getattr(cls, \"__match_args__\", ()))\" '\n'is\\n'\n' called.\\n'\n'\\n'\n' * If this raises an exception, the exception bubbles up.\\n'\n'\\n'\n' * If the returned value is not a tuple, the conversion '\n'fails and\\n'\n' \"TypeError\" is raised.\\n'\n'\\n'\n' * If there are more positional patterns than\\n'\n' \"len(cls.__match_args__)\", \"TypeError\" is raised.\\n'\n'\\n'\n' * Otherwise, positional pattern \"i\" is converted to a '\n'keyword\\n'\n' pattern using \"__match_args__[i]\" as the keyword.\\n'\n' \"__match_args__[i]\" must be a string; if not \"TypeError\" '\n'is\\n'\n' raised.\\n'\n'\\n'\n' * If there are duplicate keywords, \"TypeError\" is raised.\\n'\n'\\n'\n' See also:\\n'\n'\\n'\n' Customizing positional arguments in class pattern '\n'matching\\n'\n'\\n'\n' II. Once all positional patterns have been converted to '\n'keyword\\n'\n' patterns,\\n'\n' the match proceeds as if there were only keyword '\n'patterns.\\n'\n'\\n'\n' For the following built-in types the handling of positional\\n'\n' subpatterns is different:\\n'\n'\\n'\n' * \"bool\"\\n'\n'\\n'\n' * \"bytearray\"\\n'\n'\\n'\n' * \"bytes\"\\n'\n'\\n'\n' * \"dict\"\\n'\n'\\n'\n' * \"float\"\\n'\n'\\n'\n' * \"frozenset\"\\n'\n'\\n'\n' * \"int\"\\n'\n'\\n'\n' * \"list\"\\n'\n'\\n'\n' * \"set\"\\n'\n'\\n'\n' * \"str\"\\n'\n'\\n'\n' * \"tuple\"\\n'\n'\\n'\n' These classes accept a single positional argument, and the '\n'pattern\\n'\n' there is matched against the whole object rather than an '\n'attribute.\\n'\n' For example \"int(0|1)\" matches the value \"0\", but not the '\n'values\\n'\n' \"0.0\" or \"False\".\\n'\n'\\n'\n'In simple terms \"CLS(P1, attr=P2)\" matches only if the '\n'following\\n'\n'happens:\\n'\n'\\n'\n'* \"isinstance(, CLS)\"\\n'\n'\\n'\n'* convert \"P1\" to a keyword pattern using \"CLS.__match_args__\"\\n'\n'\\n'\n'* For each keyword argument \"attr=P2\":\\n'\n' * \"hasattr(, \"attr\")\"\\n'\n'\\n'\n' * \"P2\" matches \".attr\"\\n'\n'\\n'\n'* \u2026 and so on for the corresponding keyword argument/pattern '\n'pair.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' * **PEP 634** \u2013 Structural Pattern Matching: Specification\\n'\n'\\n'\n' * **PEP 636** \u2013 Structural Pattern Matching: Tutorial\\n'\n'\\n'\n'\\n'\n'Function definitions\\n'\n'====================\\n'\n'\\n'\n'A function definition defines a user-defined function object '\n'(see\\n'\n'section The standard type hierarchy):\\n'\n'\\n'\n' funcdef ::= [decorators] \"def\" funcname \"(\" '\n'[parameter_list] \")\"\\n'\n' [\"->\" expression] \":\" suite\\n'\n' decorators ::= decorator+\\n'\n' decorator ::= \"@\" assignment_expression '\n'NEWLINE\\n'\n' parameter_list ::= defparameter (\",\" '\n'defparameter)* \",\" \"/\" [\",\" [parameter_list_no_posonly]]\\n'\n' | parameter_list_no_posonly\\n'\n' parameter_list_no_posonly ::= defparameter (\",\" '\n'defparameter)* [\",\" [parameter_list_starargs]]\\n'\n' | parameter_list_starargs\\n'\n' parameter_list_starargs ::= \"*\" [parameter] (\",\" '\n'defparameter)* [\",\" [\"**\" parameter [\",\"]]]\\n'\n' | \"**\" parameter [\",\"]\\n'\n' parameter ::= identifier [\":\" expression]\\n'\n' defparameter ::= parameter [\"=\" expression]\\n'\n' funcname ::= identifier\\n'\n'\\n'\n'A function definition is an executable statement. Its execution '\n'binds\\n'\n'the function name in the current local namespace to a function '\n'object\\n'\n'(a wrapper around the executable code for the function). This\\n'\n'function object contains a reference to the current global '\n'namespace\\n'\n'as the global namespace to be used when the function is called.\\n'\n'\\n'\n'The function definition does not execute the function body; this '\n'gets\\n'\n'executed only when the function is called. [4]\\n'\n'\\n'\n'A function definition may be wrapped by one or more *decorator*\\n'\n'expressions. Decorator expressions are evaluated when the '\n'function is\\n'\n'defined, in the scope that contains the function definition. '\n'The\\n'\n'result must be a callable, which is invoked with the function '\n'object\\n'\n'as the only argument. The returned value is bound to the '\n'function name\\n'\n'instead of the function object. Multiple decorators are applied '\n'in\\n'\n'nested fashion. For example, the following code\\n'\n'\\n'\n' @f1(arg)\\n'\n' @f2\\n'\n' def func(): pass\\n'\n'\\n'\n'is roughly equivalent to\\n'\n'\\n'\n' def func(): pass\\n'\n' func = f1(arg)(f2(func))\\n'\n'\\n'\n'except that the original function is not temporarily bound to '\n'the name\\n'\n'\"func\".\\n'\n'\\n'\n'Changed in version 3.9: Functions may be decorated with any '\n'valid\\n'\n'\"assignment_expression\". Previously, the grammar was much more\\n'\n'restrictive; see **PEP 614** for details.\\n'\n'\\n'\n'When one or more *parameters* have the form *parameter* \"=\"\\n'\n'*expression*, the function is said to have \u201cdefault parameter '\n'values.\u201d\\n'\n'For a parameter with a default value, the corresponding '\n'*argument* may\\n'\n'be omitted from a call, in which case the parameter\u2019s default '\n'value is\\n'\n'substituted. If a parameter has a default value, all following\\n'\n'parameters up until the \u201c\"*\"\u201d must also have a default value \u2014 '\n'this is\\n'\n'a syntactic restriction that is not expressed by the grammar.\\n'\n'\\n'\n'**Default parameter values are evaluated from left to right when '\n'the\\n'\n'function definition is executed.** This means that the '\n'expression is\\n'\n'evaluated once, when the function is defined, and that the same '\n'\u201cpre-\\n'\n'computed\u201d value is used for each call. This is especially '\n'important\\n'\n'to understand when a default parameter value is a mutable '\n'object, such\\n'\n'as a list or a dictionary: if the function modifies the object '\n'(e.g.\\n'\n'by appending an item to a list), the default parameter value is '\n'in\\n'\n'effect modified. This is generally not what was intended. A '\n'way\\n'\n'around this is to use \"None\" as the default, and explicitly test '\n'for\\n'\n'it in the body of the function, e.g.:\\n'\n'\\n'\n' def whats_on_the_telly(penguin=None):\\n'\n' if penguin is None:\\n'\n' penguin = []\\n'\n' penguin.append(\"property of the zoo\")\\n'\n' return penguin\\n'\n'\\n'\n'Function call semantics are described in more detail in section '\n'Calls.\\n'\n'A function call always assigns values to all parameters '\n'mentioned in\\n'\n'the parameter list, either from positional arguments, from '\n'keyword\\n'\n'arguments, or from default values. If the form \u201c\"*identifier\"\u201d '\n'is\\n'\n'present, it is initialized to a tuple receiving any excess '\n'positional\\n'\n'parameters, defaulting to the empty tuple. If the form\\n'\n'\u201c\"**identifier\"\u201d is present, it is initialized to a new ordered\\n'\n'mapping receiving any excess keyword arguments, defaulting to a '\n'new\\n'\n'empty mapping of the same type. Parameters after \u201c\"*\"\u201d or\\n'\n'\u201c\"*identifier\"\u201d are keyword-only parameters and may only be '\n'passed by\\n'\n'keyword arguments. Parameters before \u201c\"/\"\u201d are positional-only\\n'\n'parameters and may only be passed by positional arguments.\\n'\n'\\n'\n'Changed in version 3.8: The \"/\" function parameter syntax may be '\n'used\\n'\n'to indicate positional-only parameters. See **PEP 570** for '\n'details.\\n'\n'\\n'\n'Parameters may have an *annotation* of the form \u201c\": '\n'expression\"\u201d\\n'\n'following the parameter name. Any parameter may have an '\n'annotation,\\n'\n'even those of the form \"*identifier\" or \"**identifier\". '\n'Functions may\\n'\n'have \u201creturn\u201d annotation of the form \u201c\"-> expression\"\u201d after '\n'the\\n'\n'parameter list. These annotations can be any valid Python '\n'expression.\\n'\n'The presence of annotations does not change the semantics of a\\n'\n'function. The annotation values are available as values of a\\n'\n'dictionary keyed by the parameters\u2019 names in the '\n'\"__annotations__\"\\n'\n'attribute of the function object. If the \"annotations\" import '\n'from\\n'\n'\"__future__\" is used, annotations are preserved as strings at '\n'runtime\\n'\n'which enables postponed evaluation. Otherwise, they are '\n'evaluated\\n'\n'when the function definition is executed. In this case '\n'annotations\\n'\n'may be evaluated in a different order than they appear in the '\n'source\\n'\n'code.\\n'\n'\\n'\n'It is also possible to create anonymous functions (functions not '\n'bound\\n'\n'to a name), for immediate use in expressions. This uses lambda\\n'\n'expressions, described in section Lambdas. Note that the '\n'lambda\\n'\n'expression is merely a shorthand for a simplified function '\n'definition;\\n'\n'a function defined in a \u201c\"def\"\u201d statement can be passed around '\n'or\\n'\n'assigned to another name just like a function defined by a '\n'lambda\\n'\n'expression. The \u201c\"def\"\u201d form is actually more powerful since '\n'it\\n'\n'allows the execution of multiple statements and annotations.\\n'\n'\\n'\n'**Programmer\u2019s note:** Functions are first-class objects. A '\n'\u201c\"def\"\u201d\\n'\n'statement executed inside a function definition defines a local\\n'\n'function that can be returned or passed around. Free variables '\n'used\\n'\n'in the nested function can access the local variables of the '\n'function\\n'\n'containing the def. See section Naming and binding for '\n'details.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3107** - Function Annotations\\n'\n' The original specification for function annotations.\\n'\n'\\n'\n' **PEP 484** - Type Hints\\n'\n' Definition of a standard meaning for annotations: type '\n'hints.\\n'\n'\\n'\n' **PEP 526** - Syntax for Variable Annotations\\n'\n' Ability to type hint variable declarations, including '\n'class\\n'\n' variables and instance variables\\n'\n'\\n'\n' **PEP 563** - Postponed Evaluation of Annotations\\n'\n' Support for forward references within annotations by '\n'preserving\\n'\n' annotations in a string form at runtime instead of eager\\n'\n' evaluation.\\n'\n'\\n'\n'\\n'\n'Class definitions\\n'\n'=================\\n'\n'\\n'\n'A class definition defines a class object (see section The '\n'standard\\n'\n'type hierarchy):\\n'\n'\\n'\n' classdef ::= [decorators] \"class\" classname [inheritance] '\n'\":\" suite\\n'\n' inheritance ::= \"(\" [argument_list] \")\"\\n'\n' classname ::= identifier\\n'\n'\\n'\n'A class definition is an executable statement. The inheritance '\n'list\\n'\n'usually gives a list of base classes (see Metaclasses for more\\n'\n'advanced uses), so each item in the list should evaluate to a '\n'class\\n'\n'object which allows subclassing. Classes without an inheritance '\n'list\\n'\n'inherit, by default, from the base class \"object\"; hence,\\n'\n'\\n'\n' class Foo:\\n'\n' pass\\n'\n'\\n'\n'is equivalent to\\n'\n'\\n'\n' class Foo(object):\\n'\n' pass\\n'\n'\\n'\n'The class\u2019s suite is then executed in a new execution frame '\n'(see\\n'\n'Naming and binding), using a newly created local namespace and '\n'the\\n'\n'original global namespace. (Usually, the suite contains mostly\\n'\n'function definitions.) When the class\u2019s suite finishes '\n'execution, its\\n'\n'execution frame is discarded but its local namespace is saved. '\n'[5] A\\n'\n'class object is then created using the inheritance list for the '\n'base\\n'\n'classes and the saved local namespace for the attribute '\n'dictionary.\\n'\n'The class name is bound to this class object in the original '\n'local\\n'\n'namespace.\\n'\n'\\n'\n'The order in which attributes are defined in the class body is\\n'\n'preserved in the new class\u2019s \"__dict__\". Note that this is '\n'reliable\\n'\n'only right after the class is created and only for classes that '\n'were\\n'\n'defined using the definition syntax.\\n'\n'\\n'\n'Class creation can be customized heavily using metaclasses.\\n'\n'\\n'\n'Classes can also be decorated: just like when decorating '\n'functions,\\n'\n'\\n'\n' @f1(arg)\\n'\n' @f2\\n'\n' class Foo: pass\\n'\n'\\n'\n'is roughly equivalent to\\n'\n'\\n'\n' class Foo: pass\\n'\n' Foo = f1(arg)(f2(Foo))\\n'\n'\\n'\n'The evaluation rules for the decorator expressions are the same '\n'as for\\n'\n'function decorators. The result is then bound to the class '\n'name.\\n'\n'\\n'\n'Changed in version 3.9: Classes may be decorated with any valid\\n'\n'\"assignment_expression\". Previously, the grammar was much more\\n'\n'restrictive; see **PEP 614** for details.\\n'\n'\\n'\n'**Programmer\u2019s note:** Variables defined in the class definition '\n'are\\n'\n'class attributes; they are shared by instances. Instance '\n'attributes\\n'\n'can be set in a method with \"self.name = value\". Both class '\n'and\\n'\n'instance attributes are accessible through the notation '\n'\u201c\"self.name\"\u201d,\\n'\n'and an instance attribute hides a class attribute with the same '\n'name\\n'\n'when accessed in this way. Class attributes can be used as '\n'defaults\\n'\n'for instance attributes, but using mutable values there can lead '\n'to\\n'\n'unexpected results. Descriptors can be used to create instance\\n'\n'variables with different implementation details.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3115** - Metaclasses in Python 3000\\n'\n' The proposal that changed the declaration of metaclasses to '\n'the\\n'\n' current syntax, and the semantics for how classes with\\n'\n' metaclasses are constructed.\\n'\n'\\n'\n' **PEP 3129** - Class Decorators\\n'\n' The proposal that added class decorators. Function and '\n'method\\n'\n' decorators were introduced in **PEP 318**.\\n'\n'\\n'\n'\\n'\n'Coroutines\\n'\n'==========\\n'\n'\\n'\n'New in version 3.5.\\n'\n'\\n'\n'\\n'\n'Coroutine function definition\\n'\n'-----------------------------\\n'\n'\\n'\n' async_funcdef ::= [decorators] \"async\" \"def\" funcname \"(\" '\n'[parameter_list] \")\"\\n'\n' [\"->\" expression] \":\" suite\\n'\n'\\n'\n'Execution of Python coroutines can be suspended and resumed at '\n'many\\n'\n'points (see *coroutine*). \"await\" expressions, \"async for\" and '\n'\"async\\n'\n'with\" can only be used in the body of a coroutine function.\\n'\n'\\n'\n'Functions defined with \"async def\" syntax are always coroutine\\n'\n'functions, even if they do not contain \"await\" or \"async\" '\n'keywords.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use a \"yield from\" expression inside '\n'the body\\n'\n'of a coroutine function.\\n'\n'\\n'\n'An example of a coroutine function:\\n'\n'\\n'\n' async def func(param1, param2):\\n'\n' do_stuff()\\n'\n' await some_coroutine()\\n'\n'\\n'\n'Changed in version 3.7: \"await\" and \"async\" are now keywords;\\n'\n'previously they were only treated as such inside the body of a\\n'\n'coroutine function.\\n'\n'\\n'\n'\\n'\n'The \"async for\" statement\\n'\n'-------------------------\\n'\n'\\n'\n' async_for_stmt ::= \"async\" for_stmt\\n'\n'\\n'\n'An *asynchronous iterable* provides an \"__aiter__\" method that\\n'\n'directly returns an *asynchronous iterator*, which can call\\n'\n'asynchronous code in its \"__anext__\" method.\\n'\n'\\n'\n'The \"async for\" statement allows convenient iteration over\\n'\n'asynchronous iterables.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' async for TARGET in ITER:\\n'\n' SUITE\\n'\n' else:\\n'\n' SUITE2\\n'\n'\\n'\n'Is semantically equivalent to:\\n'\n'\\n'\n' iter = (ITER)\\n'\n' iter = type(iter).__aiter__(iter)\\n'\n' running = True\\n'\n'\\n'\n' while running:\\n'\n' try:\\n'\n' TARGET = await type(iter).__anext__(iter)\\n'\n' except StopAsyncIteration:\\n'\n' running = False\\n'\n' else:\\n'\n' SUITE\\n'\n' else:\\n'\n' SUITE2\\n'\n'\\n'\n'See also \"__aiter__()\" and \"__anext__()\" for details.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use an \"async for\" statement outside '\n'the body\\n'\n'of a coroutine function.\\n'\n'\\n'\n'\\n'\n'The \"async with\" statement\\n'\n'--------------------------\\n'\n'\\n'\n' async_with_stmt ::= \"async\" with_stmt\\n'\n'\\n'\n'An *asynchronous context manager* is a *context manager* that is '\n'able\\n'\n'to suspend execution in its *enter* and *exit* methods.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' async with EXPRESSION as TARGET:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' manager = (EXPRESSION)\\n'\n' aenter = type(manager).__aenter__\\n'\n' aexit = type(manager).__aexit__\\n'\n' value = await aenter(manager)\\n'\n' hit_except = False\\n'\n'\\n'\n' try:\\n'\n' TARGET = value\\n'\n' SUITE\\n'\n' except:\\n'\n' hit_except = True\\n'\n' if not await aexit(manager, *sys.exc_info()):\\n'\n' raise\\n'\n' finally:\\n'\n' if not hit_except:\\n'\n' await aexit(manager, None, None, None)\\n'\n'\\n'\n'See also \"__aenter__()\" and \"__aexit__()\" for details.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use an \"async with\" statement outside '\n'the\\n'\n'body of a coroutine function.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 492** - Coroutines with async and await syntax\\n'\n' The proposal that made coroutines a proper standalone '\n'concept in\\n'\n' Python, and added supporting syntax.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] The exception is propagated to the invocation stack unless '\n'there\\n'\n' is a \"finally\" clause which happens to raise another '\n'exception.\\n'\n' That new exception causes the old one to be lost.\\n'\n'\\n'\n'[2] In pattern matching, a sequence is defined as one of the\\n'\n' following:\\n'\n'\\n'\n' * a class that inherits from \"collections.abc.Sequence\"\\n'\n'\\n'\n' * a Python class that has been registered as\\n'\n' \"collections.abc.Sequence\"\\n'\n'\\n'\n' * a builtin class that has its (CPython) '\n'\"Py_TPFLAGS_SEQUENCE\"\\n'\n' bit set\\n'\n'\\n'\n' * a class that inherits from any of the above\\n'\n'\\n'\n' The following standard library classes are sequences:\\n'\n'\\n'\n' * \"array.array\"\\n'\n'\\n'\n' * \"collections.deque\"\\n'\n'\\n'\n' * \"list\"\\n'\n'\\n'\n' * \"memoryview\"\\n'\n'\\n'\n' * \"range\"\\n'\n'\\n'\n' * \"tuple\"\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' Subject values of type \"str\", \"bytes\", and \"bytearray\" do '\n'not\\n'\n' match sequence patterns.\\n'\n'\\n'\n'[3] In pattern matching, a mapping is defined as one of the '\n'following:\\n'\n'\\n'\n' * a class that inherits from \"collections.abc.Mapping\"\\n'\n'\\n'\n' * a Python class that has been registered as\\n'\n' \"collections.abc.Mapping\"\\n'\n'\\n'\n' * a builtin class that has its (CPython) '\n'\"Py_TPFLAGS_MAPPING\"\\n'\n' bit set\\n'\n'\\n'\n' * a class that inherits from any of the above\\n'\n'\\n'\n' The standard library classes \"dict\" and '\n'\"types.MappingProxyType\"\\n'\n' are mappings.\\n'\n'\\n'\n'[4] A string literal appearing as the first statement in the '\n'function\\n'\n' body is transformed into the function\u2019s \"__doc__\" attribute '\n'and\\n'\n' therefore the function\u2019s *docstring*.\\n'\n'\\n'\n'[5] A string literal appearing as the first statement in the '\n'class\\n'\n' body is transformed into the namespace\u2019s \"__doc__\" item and\\n'\n' therefore the class\u2019s *docstring*.\\n',\n'context-managers':'With Statement Context Managers\\n'\n'*******************************\\n'\n'\\n'\n'A *context manager* is an object that defines the '\n'runtime context to\\n'\n'be established when executing a \"with\" statement. The '\n'context manager\\n'\n'handles the entry into, and the exit from, the desired '\n'runtime context\\n'\n'for the execution of the block of code. Context '\n'managers are normally\\n'\n'invoked using the \"with\" statement (described in section '\n'The with\\n'\n'statement), but can also be used by directly invoking '\n'their methods.\\n'\n'\\n'\n'Typical uses of context managers include saving and '\n'restoring various\\n'\n'kinds of global state, locking and unlocking resources, '\n'closing opened\\n'\n'files, etc.\\n'\n'\\n'\n'For more information on context managers, see Context '\n'Manager Types.\\n'\n'\\n'\n'object.__enter__(self)\\n'\n'\\n'\n' Enter the runtime context related to this object. The '\n'\"with\"\\n'\n' statement will bind this method\u2019s return value to the '\n'target(s)\\n'\n' specified in the \"as\" clause of the statement, if '\n'any.\\n'\n'\\n'\n'object.__exit__(self, exc_type, exc_value, traceback)\\n'\n'\\n'\n' Exit the runtime context related to this object. The '\n'parameters\\n'\n' describe the exception that caused the context to be '\n'exited. If the\\n'\n' context was exited without an exception, all three '\n'arguments will\\n'\n' be \"None\".\\n'\n'\\n'\n' If an exception is supplied, and the method wishes to '\n'suppress the\\n'\n' exception (i.e., prevent it from being propagated), '\n'it should\\n'\n' return a true value. Otherwise, the exception will be '\n'processed\\n'\n' normally upon exit from this method.\\n'\n'\\n'\n' Note that \"__exit__()\" methods should not reraise the '\n'passed-in\\n'\n' exception; this is the caller\u2019s responsibility.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 343** - The \u201cwith\u201d statement\\n'\n' The specification, background, and examples for the '\n'Python \"with\"\\n'\n' statement.\\n',\n'continue':'The \"continue\" statement\\n'\n'************************\\n'\n'\\n'\n' continue_stmt ::= \"continue\"\\n'\n'\\n'\n'\"continue\" may only occur syntactically nested in a \"for\" or '\n'\"while\"\\n'\n'loop, but not nested in a function or class definition within '\n'that\\n'\n'loop. It continues with the next cycle of the nearest enclosing '\n'loop.\\n'\n'\\n'\n'When \"continue\" passes control out of a \"try\" statement with a\\n'\n'\"finally\" clause, that \"finally\" clause is executed before '\n'really\\n'\n'starting the next loop cycle.\\n',\n'conversions':'Arithmetic conversions\\n'\n'**********************\\n'\n'\\n'\n'When a description of an arithmetic operator below uses the '\n'phrase\\n'\n'\u201cthe numeric arguments are converted to a common type\u201d, this '\n'means\\n'\n'that the operator implementation for built-in types works as '\n'follows:\\n'\n'\\n'\n'* If either argument is a complex number, the other is '\n'converted to\\n'\n' complex;\\n'\n'\\n'\n'* otherwise, if either argument is a floating point number, '\n'the other\\n'\n' is converted to floating point;\\n'\n'\\n'\n'* otherwise, both must be integers and no conversion is '\n'necessary.\\n'\n'\\n'\n'Some additional rules apply for certain operators (e.g., a '\n'string as a\\n'\n'left argument to the \u2018%\u2019 operator). Extensions must define '\n'their own\\n'\n'conversion behavior.\\n',\n'customization':'Basic customization\\n'\n'*******************\\n'\n'\\n'\n'object.__new__(cls[, ...])\\n'\n'\\n'\n' Called to create a new instance of class *cls*. '\n'\"__new__()\" is a\\n'\n' static method (special-cased so you need not declare it '\n'as such)\\n'\n' that takes the class of which an instance was requested '\n'as its\\n'\n' first argument. The remaining arguments are those '\n'passed to the\\n'\n' object constructor expression (the call to the class). '\n'The return\\n'\n' value of \"__new__()\" should be the new object instance '\n'(usually an\\n'\n' instance of *cls*).\\n'\n'\\n'\n' Typical implementations create a new instance of the '\n'class by\\n'\n' invoking the superclass\u2019s \"__new__()\" method using\\n'\n' \"super().__new__(cls[, ...])\" with appropriate arguments '\n'and then\\n'\n' modifying the newly-created instance as necessary before '\n'returning\\n'\n' it.\\n'\n'\\n'\n' If \"__new__()\" is invoked during object construction and '\n'it returns\\n'\n' an instance or subclass of *cls*, then the new '\n'instance\u2019s\\n'\n' \"__init__()\" method will be invoked like '\n'\"__init__(self[, ...])\",\\n'\n' where *self* is the new instance and the remaining '\n'arguments are\\n'\n' the same as were passed to the object constructor.\\n'\n'\\n'\n' If \"__new__()\" does not return an instance of *cls*, '\n'then the new\\n'\n' instance\u2019s \"__init__()\" method will not be invoked.\\n'\n'\\n'\n' \"__new__()\" is intended mainly to allow subclasses of '\n'immutable\\n'\n' types (like int, str, or tuple) to customize instance '\n'creation. It\\n'\n' is also commonly overridden in custom metaclasses in '\n'order to\\n'\n' customize class creation.\\n'\n'\\n'\n'object.__init__(self[, ...])\\n'\n'\\n'\n' Called after the instance has been created (by '\n'\"__new__()\"), but\\n'\n' before it is returned to the caller. The arguments are '\n'those\\n'\n' passed to the class constructor expression. If a base '\n'class has an\\n'\n' \"__init__()\" method, the derived class\u2019s \"__init__()\" '\n'method, if\\n'\n' any, must explicitly call it to ensure proper '\n'initialization of the\\n'\n' base class part of the instance; for example:\\n'\n' \"super().__init__([args...])\".\\n'\n'\\n'\n' Because \"__new__()\" and \"__init__()\" work together in '\n'constructing\\n'\n' objects (\"__new__()\" to create it, and \"__init__()\" to '\n'customize\\n'\n' it), no non-\"None\" value may be returned by '\n'\"__init__()\"; doing so\\n'\n' will cause a \"TypeError\" to be raised at runtime.\\n'\n'\\n'\n'object.__del__(self)\\n'\n'\\n'\n' Called when the instance is about to be destroyed. This '\n'is also\\n'\n' called a finalizer or (improperly) a destructor. If a '\n'base class\\n'\n' has a \"__del__()\" method, the derived class\u2019s '\n'\"__del__()\" method,\\n'\n' if any, must explicitly call it to ensure proper '\n'deletion of the\\n'\n' base class part of the instance.\\n'\n'\\n'\n' It is possible (though not recommended!) for the '\n'\"__del__()\" method\\n'\n' to postpone destruction of the instance by creating a '\n'new reference\\n'\n' to it. This is called object *resurrection*. It is\\n'\n' implementation-dependent whether \"__del__()\" is called a '\n'second\\n'\n' time when a resurrected object is about to be destroyed; '\n'the\\n'\n' current *CPython* implementation only calls it once.\\n'\n'\\n'\n' It is not guaranteed that \"__del__()\" methods are called '\n'for\\n'\n' objects that still exist when the interpreter exits.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"del x\" doesn\u2019t directly call \"x.__del__()\" \u2014 the '\n'former\\n'\n' decrements the reference count for \"x\" by one, and the '\n'latter is\\n'\n' only called when \"x\"\u2019s reference count reaches zero.\\n'\n'\\n'\n' **CPython implementation detail:** It is possible for a '\n'reference\\n'\n' cycle to prevent the reference count of an object from '\n'going to\\n'\n' zero. In this case, the cycle will be later detected '\n'and deleted\\n'\n' by the *cyclic garbage collector*. A common cause of '\n'reference\\n'\n' cycles is when an exception has been caught in a local '\n'variable.\\n'\n' The frame\u2019s locals then reference the exception, which '\n'references\\n'\n' its own traceback, which references the locals of all '\n'frames caught\\n'\n' in the traceback.\\n'\n'\\n'\n' See also: Documentation for the \"gc\" module.\\n'\n'\\n'\n' Warning:\\n'\n'\\n'\n' Due to the precarious circumstances under which '\n'\"__del__()\"\\n'\n' methods are invoked, exceptions that occur during '\n'their execution\\n'\n' are ignored, and a warning is printed to \"sys.stderr\" '\n'instead.\\n'\n' In particular:\\n'\n'\\n'\n' * \"__del__()\" can be invoked when arbitrary code is '\n'being\\n'\n' executed, including from any arbitrary thread. If '\n'\"__del__()\"\\n'\n' needs to take a lock or invoke any other blocking '\n'resource, it\\n'\n' may deadlock as the resource may already be taken by '\n'the code\\n'\n' that gets interrupted to execute \"__del__()\".\\n'\n'\\n'\n' * \"__del__()\" can be executed during interpreter '\n'shutdown. As a\\n'\n' consequence, the global variables it needs to access '\n'(including\\n'\n' other modules) may already have been deleted or set '\n'to \"None\".\\n'\n' Python guarantees that globals whose name begins '\n'with a single\\n'\n' underscore are deleted from their module before '\n'other globals\\n'\n' are deleted; if no other references to such globals '\n'exist, this\\n'\n' may help in assuring that imported modules are still '\n'available\\n'\n' at the time when the \"__del__()\" method is called.\\n'\n'\\n'\n'object.__repr__(self)\\n'\n'\\n'\n' Called by the \"repr()\" built-in function to compute the '\n'\u201cofficial\u201d\\n'\n' string representation of an object. If at all possible, '\n'this\\n'\n' should look like a valid Python expression that could be '\n'used to\\n'\n' recreate an object with the same value (given an '\n'appropriate\\n'\n' environment). If this is not possible, a string of the '\n'form\\n'\n' \"<...some useful description...>\" should be returned. '\n'The return\\n'\n' value must be a string object. If a class defines '\n'\"__repr__()\" but\\n'\n' not \"__str__()\", then \"__repr__()\" is also used when an '\n'\u201cinformal\u201d\\n'\n' string representation of instances of that class is '\n'required.\\n'\n'\\n'\n' This is typically used for debugging, so it is important '\n'that the\\n'\n' representation is information-rich and unambiguous.\\n'\n'\\n'\n'object.__str__(self)\\n'\n'\\n'\n' Called by \"str(object)\" and the built-in functions '\n'\"format()\" and\\n'\n' \"print()\" to compute the \u201cinformal\u201d or nicely printable '\n'string\\n'\n' representation of an object. The return value must be a '\n'string\\n'\n' object.\\n'\n'\\n'\n' This method differs from \"object.__repr__()\" in that '\n'there is no\\n'\n' expectation that \"__str__()\" return a valid Python '\n'expression: a\\n'\n' more convenient or concise representation can be used.\\n'\n'\\n'\n' The default implementation defined by the built-in type '\n'\"object\"\\n'\n' calls \"object.__repr__()\".\\n'\n'\\n'\n'object.__bytes__(self)\\n'\n'\\n'\n' Called by bytes to compute a byte-string representation '\n'of an\\n'\n' object. This should return a \"bytes\" object.\\n'\n'\\n'\n'object.__format__(self, format_spec)\\n'\n'\\n'\n' Called by the \"format()\" built-in function, and by '\n'extension,\\n'\n' evaluation of formatted string literals and the '\n'\"str.format()\"\\n'\n' method, to produce a \u201cformatted\u201d string representation '\n'of an\\n'\n' object. The *format_spec* argument is a string that '\n'contains a\\n'\n' description of the formatting options desired. The '\n'interpretation\\n'\n' of the *format_spec* argument is up to the type '\n'implementing\\n'\n' \"__format__()\", however most classes will either '\n'delegate\\n'\n' formatting to one of the built-in types, or use a '\n'similar\\n'\n' formatting option syntax.\\n'\n'\\n'\n' See Format Specification Mini-Language for a description '\n'of the\\n'\n' standard formatting syntax.\\n'\n'\\n'\n' The return value must be a string object.\\n'\n'\\n'\n' Changed in version 3.4: The __format__ method of '\n'\"object\" itself\\n'\n' raises a \"TypeError\" if passed any non-empty string.\\n'\n'\\n'\n' Changed in version 3.7: \"object.__format__(x, \\'\\')\" is '\n'now\\n'\n' equivalent to \"str(x)\" rather than \"format(str(x), '\n'\\'\\')\".\\n'\n'\\n'\n'object.__lt__(self, other)\\n'\n'object.__le__(self, other)\\n'\n'object.__eq__(self, other)\\n'\n'object.__ne__(self, other)\\n'\n'object.__gt__(self, other)\\n'\n'object.__ge__(self, other)\\n'\n'\\n'\n' These are the so-called \u201crich comparison\u201d methods. The\\n'\n' correspondence between operator symbols and method names '\n'is as\\n'\n' follows: \"xy\" calls\\n'\n' \"x.__gt__(y)\", and \"x>=y\" calls \"x.__ge__(y)\".\\n'\n'\\n'\n' A rich comparison method may return the singleton '\n'\"NotImplemented\"\\n'\n' if it does not implement the operation for a given pair '\n'of\\n'\n' arguments. By convention, \"False\" and \"True\" are '\n'returned for a\\n'\n' successful comparison. However, these methods can return '\n'any value,\\n'\n' so if the comparison operator is used in a Boolean '\n'context (e.g.,\\n'\n' in the condition of an \"if\" statement), Python will call '\n'\"bool()\"\\n'\n' on the value to determine if the result is true or '\n'false.\\n'\n'\\n'\n' By default, \"object\" implements \"__eq__()\" by using '\n'\"is\", returning\\n'\n' \"NotImplemented\" in the case of a false comparison: '\n'\"True if x is y\\n'\n' else NotImplemented\". For \"__ne__()\", by default it '\n'delegates to\\n'\n' \"__eq__()\" and inverts the result unless it is '\n'\"NotImplemented\".\\n'\n' There are no other implied relationships among the '\n'comparison\\n'\n' operators or default implementations; for example, the '\n'truth of\\n'\n' \"(x.__hash__\".\\n'\n'\\n'\n' If a class that does not override \"__eq__()\" wishes to '\n'suppress\\n'\n' hash support, it should include \"__hash__ = None\" in the '\n'class\\n'\n' definition. A class which defines its own \"__hash__()\" '\n'that\\n'\n' explicitly raises a \"TypeError\" would be incorrectly '\n'identified as\\n'\n' hashable by an \"isinstance(obj, '\n'collections.abc.Hashable)\" call.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' By default, the \"__hash__()\" values of str and bytes '\n'objects are\\n'\n' \u201csalted\u201d with an unpredictable random value. Although '\n'they\\n'\n' remain constant within an individual Python process, '\n'they are not\\n'\n' predictable between repeated invocations of '\n'Python.This is\\n'\n' intended to provide protection against a '\n'denial-of-service caused\\n'\n' by carefully-chosen inputs that exploit the worst '\n'case\\n'\n' performance of a dict insertion, O(n^2) complexity. '\n'See\\n'\n' http://www.ocert.org/advisories/ocert-2011-003.html '\n'for\\n'\n' details.Changing hash values affects the iteration '\n'order of sets.\\n'\n' Python has never made guarantees about this ordering '\n'(and it\\n'\n' typically varies between 32-bit and 64-bit builds).See '\n'also\\n'\n' \"PYTHONHASHSEED\".\\n'\n'\\n'\n' Changed in version 3.3: Hash randomization is enabled by '\n'default.\\n'\n'\\n'\n'object.__bool__(self)\\n'\n'\\n'\n' Called to implement truth value testing and the built-in '\n'operation\\n'\n' \"bool()\"; should return \"False\" or \"True\". When this '\n'method is not\\n'\n' defined, \"__len__()\" is called, if it is defined, and '\n'the object is\\n'\n' considered true if its result is nonzero. If a class '\n'defines\\n'\n' neither \"__len__()\" nor \"__bool__()\", all its instances '\n'are\\n'\n' considered true.\\n',\n'debugger':'\"pdb\" \u2014 The Python Debugger\\n'\n'***************************\\n'\n'\\n'\n'**Source code:** Lib/pdb.py\\n'\n'\\n'\n'======================================================================\\n'\n'\\n'\n'The module \"pdb\" defines an interactive source code debugger '\n'for\\n'\n'Python programs. It supports setting (conditional) breakpoints '\n'and\\n'\n'single stepping at the source line level, inspection of stack '\n'frames,\\n'\n'source code listing, and evaluation of arbitrary Python code in '\n'the\\n'\n'context of any stack frame. It also supports post-mortem '\n'debugging\\n'\n'and can be called under program control.\\n'\n'\\n'\n'The debugger is extensible \u2013 it is actually defined as the '\n'class\\n'\n'\"Pdb\". This is currently undocumented but easily understood by '\n'reading\\n'\n'the source. The extension interface uses the modules \"bdb\" and '\n'\"cmd\".\\n'\n'\\n'\n'The debugger\u2019s prompt is \"(Pdb)\". Typical usage to run a program '\n'under\\n'\n'control of the debugger is:\\n'\n'\\n'\n' >>> import pdb\\n'\n' >>> import mymodule\\n'\n\" >>> pdb.run('mymodule.test()')\\n\"\n' > (0)?()\\n'\n' (Pdb) continue\\n'\n' > (1)?()\\n'\n' (Pdb) continue\\n'\n\" NameError: 'spam'\\n\"\n' > (1)?()\\n'\n' (Pdb)\\n'\n'\\n'\n'Changed in version 3.3: Tab-completion via the \"readline\" module '\n'is\\n'\n'available for commands and command arguments, e.g. the current '\n'global\\n'\n'and local names are offered as arguments of the \"p\" command.\\n'\n'\\n'\n'\"pdb.py\" can also be invoked as a script to debug other '\n'scripts. For\\n'\n'example:\\n'\n'\\n'\n' python3 -m pdb myscript.py\\n'\n'\\n'\n'When invoked as a script, pdb will automatically enter '\n'post-mortem\\n'\n'debugging if the program being debugged exits abnormally. After '\n'post-\\n'\n'mortem debugging (or after normal exit of the program), pdb '\n'will\\n'\n'restart the program. Automatic restarting preserves pdb\u2019s state '\n'(such\\n'\n'as breakpoints) and in most cases is more useful than quitting '\n'the\\n'\n'debugger upon program\u2019s exit.\\n'\n'\\n'\n'New in version 3.2: \"pdb.py\" now accepts a \"-c\" option that '\n'executes\\n'\n'commands as if given in a \".pdbrc\" file, see Debugger Commands.\\n'\n'\\n'\n'New in version 3.7: \"pdb.py\" now accepts a \"-m\" option that '\n'execute\\n'\n'modules similar to the way \"python3 -m\" does. As with a script, '\n'the\\n'\n'debugger will pause execution just before the first line of the\\n'\n'module.\\n'\n'\\n'\n'The typical usage to break into the debugger from a running '\n'program is\\n'\n'to insert\\n'\n'\\n'\n' import pdb; pdb.set_trace()\\n'\n'\\n'\n'at the location you want to break into the debugger. You can '\n'then\\n'\n'step through the code following this statement, and continue '\n'running\\n'\n'without the debugger using the \"continue\" command.\\n'\n'\\n'\n'New in version 3.7: The built-in \"breakpoint()\", when called '\n'with\\n'\n'defaults, can be used instead of \"import pdb; pdb.set_trace()\".\\n'\n'\\n'\n'The typical usage to inspect a crashed program is:\\n'\n'\\n'\n' >>> import pdb\\n'\n' >>> import mymodule\\n'\n' >>> mymodule.test()\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n' File \"./mymodule.py\", line 4, in test\\n'\n' test2()\\n'\n' File \"./mymodule.py\", line 3, in test2\\n'\n' print(spam)\\n'\n' NameError: spam\\n'\n' >>> pdb.pm()\\n'\n' > ./mymodule.py(3)test2()\\n'\n' -> print(spam)\\n'\n' (Pdb)\\n'\n'\\n'\n'The module defines the following functions; each enters the '\n'debugger\\n'\n'in a slightly different way:\\n'\n'\\n'\n'pdb.run(statement, globals=None, locals=None)\\n'\n'\\n'\n' Execute the *statement* (given as a string or a code object) '\n'under\\n'\n' debugger control. The debugger prompt appears before any '\n'code is\\n'\n' executed; you can set breakpoints and type \"continue\", or you '\n'can\\n'\n' step through the statement using \"step\" or \"next\" (all these\\n'\n' commands are explained below). The optional *globals* and '\n'*locals*\\n'\n' arguments specify the environment in which the code is '\n'executed; by\\n'\n' default the dictionary of the module \"__main__\" is used. '\n'(See the\\n'\n' explanation of the built-in \"exec()\" or \"eval()\" functions.)\\n'\n'\\n'\n'pdb.runeval(expression, globals=None, locals=None)\\n'\n'\\n'\n' Evaluate the *expression* (given as a string or a code '\n'object)\\n'\n' under debugger control. When \"runeval()\" returns, it returns '\n'the\\n'\n' value of the expression. Otherwise this function is similar '\n'to\\n'\n' \"run()\".\\n'\n'\\n'\n'pdb.runcall(function, *args, **kwds)\\n'\n'\\n'\n' Call the *function* (a function or method object, not a '\n'string)\\n'\n' with the given arguments. When \"runcall()\" returns, it '\n'returns\\n'\n' whatever the function call returned. The debugger prompt '\n'appears\\n'\n' as soon as the function is entered.\\n'\n'\\n'\n'pdb.set_trace(*, header=None)\\n'\n'\\n'\n' Enter the debugger at the calling stack frame. This is '\n'useful to\\n'\n' hard-code a breakpoint at a given point in a program, even if '\n'the\\n'\n' code is not otherwise being debugged (e.g. when an assertion\\n'\n' fails). If given, *header* is printed to the console just '\n'before\\n'\n' debugging begins.\\n'\n'\\n'\n' Changed in version 3.7: The keyword-only argument *header*.\\n'\n'\\n'\n'pdb.post_mortem(traceback=None)\\n'\n'\\n'\n' Enter post-mortem debugging of the given *traceback* object. '\n'If no\\n'\n' *traceback* is given, it uses the one of the exception that '\n'is\\n'\n' currently being handled (an exception must be being handled '\n'if the\\n'\n' default is to be used).\\n'\n'\\n'\n'pdb.pm()\\n'\n'\\n'\n' Enter post-mortem debugging of the traceback found in\\n'\n' \"sys.last_traceback\".\\n'\n'\\n'\n'The \"run*\" functions and \"set_trace()\" are aliases for '\n'instantiating\\n'\n'the \"Pdb\" class and calling the method of the same name. If you '\n'want\\n'\n'to access further features, you have to do this yourself:\\n'\n'\\n'\n\"class pdb.Pdb(completekey='tab', stdin=None, stdout=None, \"\n'skip=None, nosigint=False, readrc=True)\\n'\n'\\n'\n' \"Pdb\" is the debugger class.\\n'\n'\\n'\n' The *completekey*, *stdin* and *stdout* arguments are passed '\n'to the\\n'\n' underlying \"cmd.Cmd\" class; see the description there.\\n'\n'\\n'\n' The *skip* argument, if given, must be an iterable of '\n'glob-style\\n'\n' module name patterns. The debugger will not step into frames '\n'that\\n'\n' originate in a module that matches one of these patterns. '\n'[1]\\n'\n'\\n'\n' By default, Pdb sets a handler for the SIGINT signal (which '\n'is sent\\n'\n' when the user presses \"Ctrl-C\" on the console) when you give '\n'a\\n'\n' \"continue\" command. This allows you to break into the '\n'debugger\\n'\n' again by pressing \"Ctrl-C\". If you want Pdb not to touch '\n'the\\n'\n' SIGINT handler, set *nosigint* to true.\\n'\n'\\n'\n' The *readrc* argument defaults to true and controls whether '\n'Pdb\\n'\n' will load .pdbrc files from the filesystem.\\n'\n'\\n'\n' Example call to enable tracing with *skip*:\\n'\n'\\n'\n\" import pdb; pdb.Pdb(skip=['django.*']).set_trace()\\n\"\n'\\n'\n' Raises an auditing event \"pdb.Pdb\" with no arguments.\\n'\n'\\n'\n' New in version 3.1: The *skip* argument.\\n'\n'\\n'\n' New in version 3.2: The *nosigint* argument. Previously, a '\n'SIGINT\\n'\n' handler was never set by Pdb.\\n'\n'\\n'\n' Changed in version 3.6: The *readrc* argument.\\n'\n'\\n'\n' run(statement, globals=None, locals=None)\\n'\n' runeval(expression, globals=None, locals=None)\\n'\n' runcall(function, *args, **kwds)\\n'\n' set_trace()\\n'\n'\\n'\n' See the documentation for the functions explained above.\\n'\n'\\n'\n'\\n'\n'Debugger Commands\\n'\n'=================\\n'\n'\\n'\n'The commands recognized by the debugger are listed below. Most\\n'\n'commands can be abbreviated to one or two letters as indicated; '\n'e.g.\\n'\n'\"h(elp)\" means that either \"h\" or \"help\" can be used to enter '\n'the help\\n'\n'command (but not \"he\" or \"hel\", nor \"H\" or \"Help\" or \"HELP\").\\n'\n'Arguments to commands must be separated by whitespace (spaces '\n'or\\n'\n'tabs). Optional arguments are enclosed in square brackets '\n'(\"[]\") in\\n'\n'the command syntax; the square brackets must not be typed.\\n'\n'Alternatives in the command syntax are separated by a vertical '\n'bar\\n'\n'(\"|\").\\n'\n'\\n'\n'Entering a blank line repeats the last command entered. '\n'Exception: if\\n'\n'the last command was a \"list\" command, the next 11 lines are '\n'listed.\\n'\n'\\n'\n'Commands that the debugger doesn\u2019t recognize are assumed to be '\n'Python\\n'\n'statements and are executed in the context of the program being\\n'\n'debugged. Python statements can also be prefixed with an '\n'exclamation\\n'\n'point (\"!\"). This is a powerful way to inspect the program '\n'being\\n'\n'debugged; it is even possible to change a variable or call a '\n'function.\\n'\n'When an exception occurs in such a statement, the exception name '\n'is\\n'\n'printed but the debugger\u2019s state is not changed.\\n'\n'\\n'\n'The debugger supports aliases. Aliases can have parameters '\n'which\\n'\n'allows one a certain level of adaptability to the context under\\n'\n'examination.\\n'\n'\\n'\n'Multiple commands may be entered on a single line, separated by '\n'\";;\".\\n'\n'(A single \";\" is not used as it is the separator for multiple '\n'commands\\n'\n'in a line that is passed to the Python parser.) No intelligence '\n'is\\n'\n'applied to separating the commands; the input is split at the '\n'first\\n'\n'\";;\" pair, even if it is in the middle of a quoted string.\\n'\n'\\n'\n'If a file \".pdbrc\" exists in the user\u2019s home directory or in '\n'the\\n'\n'current directory, it is read in and executed as if it had been '\n'typed\\n'\n'at the debugger prompt. This is particularly useful for '\n'aliases. If\\n'\n'both files exist, the one in the home directory is read first '\n'and\\n'\n'aliases defined there can be overridden by the local file.\\n'\n'\\n'\n'Changed in version 3.2: \".pdbrc\" can now contain commands that\\n'\n'continue debugging, such as \"continue\" or \"next\". Previously, '\n'these\\n'\n'commands had no effect.\\n'\n'\\n'\n'h(elp) [command]\\n'\n'\\n'\n' Without argument, print the list of available commands. With '\n'a\\n'\n' *command* as argument, print help about that command. \"help '\n'pdb\"\\n'\n' displays the full documentation (the docstring of the \"pdb\"\\n'\n' module). Since the *command* argument must be an identifier, '\n'\"help\\n'\n' exec\" must be entered to get help on the \"!\" command.\\n'\n'\\n'\n'w(here)\\n'\n'\\n'\n' Print a stack trace, with the most recent frame at the '\n'bottom. An\\n'\n' arrow indicates the current frame, which determines the '\n'context of\\n'\n' most commands.\\n'\n'\\n'\n'd(own) [count]\\n'\n'\\n'\n' Move the current frame *count* (default one) levels down in '\n'the\\n'\n' stack trace (to a newer frame).\\n'\n'\\n'\n'u(p) [count]\\n'\n'\\n'\n' Move the current frame *count* (default one) levels up in the '\n'stack\\n'\n' trace (to an older frame).\\n'\n'\\n'\n'b(reak) [([filename:]lineno | function) [, condition]]\\n'\n'\\n'\n' With a *lineno* argument, set a break there in the current '\n'file.\\n'\n' With a *function* argument, set a break at the first '\n'executable\\n'\n' statement within that function. The line number may be '\n'prefixed\\n'\n' with a filename and a colon, to specify a breakpoint in '\n'another\\n'\n' file (probably one that hasn\u2019t been loaded yet). The file '\n'is\\n'\n' searched on \"sys.path\". Note that each breakpoint is '\n'assigned a\\n'\n' number to which all the other breakpoint commands refer.\\n'\n'\\n'\n' If a second argument is present, it is an expression which '\n'must\\n'\n' evaluate to true before the breakpoint is honored.\\n'\n'\\n'\n' Without argument, list all breaks, including for each '\n'breakpoint,\\n'\n' the number of times that breakpoint has been hit, the '\n'current\\n'\n' ignore count, and the associated condition if any.\\n'\n'\\n'\n'tbreak [([filename:]lineno | function) [, condition]]\\n'\n'\\n'\n' Temporary breakpoint, which is removed automatically when it '\n'is\\n'\n' first hit. The arguments are the same as for \"break\".\\n'\n'\\n'\n'cl(ear) [filename:lineno | bpnumber ...]\\n'\n'\\n'\n' With a *filename:lineno* argument, clear all the breakpoints '\n'at\\n'\n' this line. With a space separated list of breakpoint numbers, '\n'clear\\n'\n' those breakpoints. Without argument, clear all breaks (but '\n'first\\n'\n' ask confirmation).\\n'\n'\\n'\n'disable [bpnumber ...]\\n'\n'\\n'\n' Disable the breakpoints given as a space separated list of\\n'\n' breakpoint numbers. Disabling a breakpoint means it cannot '\n'cause\\n'\n' the program to stop execution, but unlike clearing a '\n'breakpoint, it\\n'\n' remains in the list of breakpoints and can be (re-)enabled.\\n'\n'\\n'\n'enable [bpnumber ...]\\n'\n'\\n'\n' Enable the breakpoints specified.\\n'\n'\\n'\n'ignore bpnumber [count]\\n'\n'\\n'\n' Set the ignore count for the given breakpoint number. If '\n'count is\\n'\n' omitted, the ignore count is set to 0. A breakpoint becomes '\n'active\\n'\n' when the ignore count is zero. When non-zero, the count is\\n'\n' decremented each time the breakpoint is reached and the '\n'breakpoint\\n'\n' is not disabled and any associated condition evaluates to '\n'true.\\n'\n'\\n'\n'condition bpnumber [condition]\\n'\n'\\n'\n' Set a new *condition* for the breakpoint, an expression which '\n'must\\n'\n' evaluate to true before the breakpoint is honored. If '\n'*condition*\\n'\n' is absent, any existing condition is removed; i.e., the '\n'breakpoint\\n'\n' is made unconditional.\\n'\n'\\n'\n'commands [bpnumber]\\n'\n'\\n'\n' Specify a list of commands for breakpoint number *bpnumber*. '\n'The\\n'\n' commands themselves appear on the following lines. Type a '\n'line\\n'\n' containing just \"end\" to terminate the commands. An example:\\n'\n'\\n'\n' (Pdb) commands 1\\n'\n' (com) p some_variable\\n'\n' (com) end\\n'\n' (Pdb)\\n'\n'\\n'\n' To remove all commands from a breakpoint, type \"commands\" '\n'and\\n'\n' follow it immediately with \"end\"; that is, give no commands.\\n'\n'\\n'\n' With no *bpnumber* argument, \"commands\" refers to the last\\n'\n' breakpoint set.\\n'\n'\\n'\n' You can use breakpoint commands to start your program up '\n'again.\\n'\n' Simply use the \"continue\" command, or \"step\", or any other '\n'command\\n'\n' that resumes execution.\\n'\n'\\n'\n' Specifying any command resuming execution (currently '\n'\"continue\",\\n'\n' \"step\", \"next\", \"return\", \"jump\", \"quit\" and their '\n'abbreviations)\\n'\n' terminates the command list (as if that command was '\n'immediately\\n'\n' followed by end). This is because any time you resume '\n'execution\\n'\n' (even with a simple next or step), you may encounter another\\n'\n' breakpoint\u2014which could have its own command list, leading to\\n'\n' ambiguities about which list to execute.\\n'\n'\\n'\n' If you use the \u2018silent\u2019 command in the command list, the '\n'usual\\n'\n' message about stopping at a breakpoint is not printed. This '\n'may be\\n'\n' desirable for breakpoints that are to print a specific '\n'message and\\n'\n' then continue. If none of the other commands print anything, '\n'you\\n'\n' see no sign that the breakpoint was reached.\\n'\n'\\n'\n's(tep)\\n'\n'\\n'\n' Execute the current line, stop at the first possible '\n'occasion\\n'\n' (either in a function that is called or on the next line in '\n'the\\n'\n' current function).\\n'\n'\\n'\n'n(ext)\\n'\n'\\n'\n' Continue execution until the next line in the current '\n'function is\\n'\n' reached or it returns. (The difference between \"next\" and '\n'\"step\"\\n'\n' is that \"step\" stops inside a called function, while \"next\"\\n'\n' executes called functions at (nearly) full speed, only '\n'stopping at\\n'\n' the next line in the current function.)\\n'\n'\\n'\n'unt(il) [lineno]\\n'\n'\\n'\n' Without argument, continue execution until the line with a '\n'number\\n'\n' greater than the current one is reached.\\n'\n'\\n'\n' With a line number, continue execution until a line with a '\n'number\\n'\n' greater or equal to that is reached. In both cases, also '\n'stop when\\n'\n' the current frame returns.\\n'\n'\\n'\n' Changed in version 3.2: Allow giving an explicit line '\n'number.\\n'\n'\\n'\n'r(eturn)\\n'\n'\\n'\n' Continue execution until the current function returns.\\n'\n'\\n'\n'c(ont(inue))\\n'\n'\\n'\n' Continue execution, only stop when a breakpoint is '\n'encountered.\\n'\n'\\n'\n'j(ump) lineno\\n'\n'\\n'\n' Set the next line that will be executed. Only available in '\n'the\\n'\n' bottom-most frame. This lets you jump back and execute code '\n'again,\\n'\n' or jump forward to skip code that you don\u2019t want to run.\\n'\n'\\n'\n' It should be noted that not all jumps are allowed \u2013 for '\n'instance it\\n'\n' is not possible to jump into the middle of a \"for\" loop or '\n'out of a\\n'\n' \"finally\" clause.\\n'\n'\\n'\n'l(ist) [first[, last]]\\n'\n'\\n'\n' List source code for the current file. Without arguments, '\n'list 11\\n'\n' lines around the current line or continue the previous '\n'listing.\\n'\n' With \".\" as argument, list 11 lines around the current line. '\n'With\\n'\n' one argument, list 11 lines around at that line. With two\\n'\n' arguments, list the given range; if the second argument is '\n'less\\n'\n' than the first, it is interpreted as a count.\\n'\n'\\n'\n' The current line in the current frame is indicated by \"->\". '\n'If an\\n'\n' exception is being debugged, the line where the exception '\n'was\\n'\n' originally raised or propagated is indicated by \">>\", if it '\n'differs\\n'\n' from the current line.\\n'\n'\\n'\n' New in version 3.2: The \">>\" marker.\\n'\n'\\n'\n'll | longlist\\n'\n'\\n'\n' List all source code for the current function or frame.\\n'\n' Interesting lines are marked as for \"list\".\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'a(rgs)\\n'\n'\\n'\n' Print the argument list of the current function.\\n'\n'\\n'\n'p expression\\n'\n'\\n'\n' Evaluate the *expression* in the current context and print '\n'its\\n'\n' value.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"print()\" can also be used, but is not a debugger command \u2014 '\n'this\\n'\n' executes the Python \"print()\" function.\\n'\n'\\n'\n'pp expression\\n'\n'\\n'\n' Like the \"p\" command, except the value of the expression is '\n'pretty-\\n'\n' printed using the \"pprint\" module.\\n'\n'\\n'\n'whatis expression\\n'\n'\\n'\n' Print the type of the *expression*.\\n'\n'\\n'\n'source expression\\n'\n'\\n'\n' Try to get source code for the given object and display it.\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'display [expression]\\n'\n'\\n'\n' Display the value of the expression if it changed, each time\\n'\n' execution stops in the current frame.\\n'\n'\\n'\n' Without expression, list all display expressions for the '\n'current\\n'\n' frame.\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'undisplay [expression]\\n'\n'\\n'\n' Do not display the expression any more in the current frame.\\n'\n' Without expression, clear all display expressions for the '\n'current\\n'\n' frame.\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'interact\\n'\n'\\n'\n' Start an interactive interpreter (using the \"code\" module) '\n'whose\\n'\n' global namespace contains all the (global and local) names '\n'found in\\n'\n' the current scope.\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'alias [name [command]]\\n'\n'\\n'\n' Create an alias called *name* that executes *command*. The '\n'command\\n'\n' must *not* be enclosed in quotes. Replaceable parameters can '\n'be\\n'\n' indicated by \"%1\", \"%2\", and so on, while \"%*\" is replaced by '\n'all\\n'\n' the parameters. If no command is given, the current alias '\n'for\\n'\n' *name* is shown. If no arguments are given, all aliases are '\n'listed.\\n'\n'\\n'\n' Aliases may be nested and can contain anything that can be '\n'legally\\n'\n' typed at the pdb prompt. Note that internal pdb commands '\n'*can* be\\n'\n' overridden by aliases. Such a command is then hidden until '\n'the\\n'\n' alias is removed. Aliasing is recursively applied to the '\n'first\\n'\n' word of the command line; all other words in the line are '\n'left\\n'\n' alone.\\n'\n'\\n'\n' As an example, here are two useful aliases (especially when '\n'placed\\n'\n' in the \".pdbrc\" file):\\n'\n'\\n'\n' # Print instance variables (usage \"pi classInst\")\\n'\n' alias pi for k in %1.__dict__.keys(): '\n'print(\"%1.\",k,\"=\",%1.__dict__[k])\\n'\n' # Print instance variables in self\\n'\n' alias ps pi self\\n'\n'\\n'\n'unalias name\\n'\n'\\n'\n' Delete the specified alias.\\n'\n'\\n'\n'! statement\\n'\n'\\n'\n' Execute the (one-line) *statement* in the context of the '\n'current\\n'\n' stack frame. The exclamation point can be omitted unless the '\n'first\\n'\n' word of the statement resembles a debugger command. To set '\n'a\\n'\n' global variable, you can prefix the assignment command with '\n'a\\n'\n' \"global\" statement on the same line, e.g.:\\n'\n'\\n'\n\" (Pdb) global list_options; list_options = ['-l']\\n\"\n' (Pdb)\\n'\n'\\n'\n'run [args ...]\\n'\n'restart [args ...]\\n'\n'\\n'\n' Restart the debugged Python program. If an argument is '\n'supplied,\\n'\n' it is split with \"shlex\" and the result is used as the new\\n'\n' \"sys.argv\". History, breakpoints, actions and debugger '\n'options are\\n'\n' preserved. \"restart\" is an alias for \"run\".\\n'\n'\\n'\n'q(uit)\\n'\n'\\n'\n' Quit from the debugger. The program being executed is '\n'aborted.\\n'\n'\\n'\n'debug code\\n'\n'\\n'\n' Enter a recursive debugger that steps through the code '\n'argument\\n'\n' (which is an arbitrary expression or statement to be executed '\n'in\\n'\n' the current environment).\\n'\n'\\n'\n'retval\\n'\n'\\n'\n' Print the return value for the last return of a function.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] Whether a frame is considered to originate in a certain '\n'module is\\n'\n' determined by the \"__name__\" in the frame globals.\\n',\n'del':'The \"del\" statement\\n'\n'*******************\\n'\n'\\n'\n' del_stmt ::= \"del\" target_list\\n'\n'\\n'\n'Deletion is recursively defined very similar to the way assignment '\n'is\\n'\n'defined. Rather than spelling it out in full details, here are some\\n'\n'hints.\\n'\n'\\n'\n'Deletion of a target list recursively deletes each target, from left\\n'\n'to right.\\n'\n'\\n'\n'Deletion of a name removes the binding of that name from the local '\n'or\\n'\n'global namespace, depending on whether the name occurs in a \"global\"\\n'\n'statement in the same code block. If the name is unbound, a\\n'\n'\"NameError\" exception will be raised.\\n'\n'\\n'\n'Deletion of attribute references, subscriptions and slicings is '\n'passed\\n'\n'to the primary object involved; deletion of a slicing is in general\\n'\n'equivalent to assignment of an empty slice of the right type (but '\n'even\\n'\n'this is determined by the sliced object).\\n'\n'\\n'\n'Changed in version 3.2: Previously it was illegal to delete a name\\n'\n'from the local namespace if it occurs as a free variable in a nested\\n'\n'block.\\n',\n'dict':'Dictionary displays\\n'\n'*******************\\n'\n'\\n'\n'A dictionary display is a possibly empty series of key/datum pairs\\n'\n'enclosed in curly braces:\\n'\n'\\n'\n' dict_display ::= \"{\" [key_datum_list | dict_comprehension] '\n'\"}\"\\n'\n' key_datum_list ::= key_datum (\",\" key_datum)* [\",\"]\\n'\n' key_datum ::= expression \":\" expression | \"**\" or_expr\\n'\n' dict_comprehension ::= expression \":\" expression comp_for\\n'\n'\\n'\n'A dictionary display yields a new dictionary object.\\n'\n'\\n'\n'If a comma-separated sequence of key/datum pairs is given, they are\\n'\n'evaluated from left to right to define the entries of the '\n'dictionary:\\n'\n'each key object is used as a key into the dictionary to store the\\n'\n'corresponding datum. This means that you can specify the same key\\n'\n'multiple times in the key/datum list, and the final dictionary\u2019s '\n'value\\n'\n'for that key will be the last one given.\\n'\n'\\n'\n'A double asterisk \"**\" denotes *dictionary unpacking*. Its operand\\n'\n'must be a *mapping*. Each mapping item is added to the new\\n'\n'dictionary. Later values replace values already set by earlier\\n'\n'key/datum pairs and earlier dictionary unpackings.\\n'\n'\\n'\n'New in version 3.5: Unpacking into dictionary displays, originally\\n'\n'proposed by **PEP 448**.\\n'\n'\\n'\n'A dict comprehension, in contrast to list and set comprehensions,\\n'\n'needs two expressions separated with a colon followed by the usual\\n'\n'\u201cfor\u201d and \u201cif\u201d clauses. When the comprehension is run, the '\n'resulting\\n'\n'key and value elements are inserted in the new dictionary in the '\n'order\\n'\n'they are produced.\\n'\n'\\n'\n'Restrictions on the types of the key values are listed earlier in\\n'\n'section The standard type hierarchy. (To summarize, the key type\\n'\n'should be *hashable*, which excludes all mutable objects.) Clashes\\n'\n'between duplicate keys are not detected; the last datum (textually\\n'\n'rightmost in the display) stored for a given key value prevails.\\n'\n'\\n'\n'Changed in version 3.8: Prior to Python 3.8, in dict '\n'comprehensions,\\n'\n'the evaluation order of key and value was not well-defined. In\\n'\n'CPython, the value was evaluated before the key. Starting with '\n'3.8,\\n'\n'the key is evaluated before the value, as proposed by **PEP 572**.\\n',\n'dynamic-features':'Interaction with dynamic features\\n'\n'*********************************\\n'\n'\\n'\n'Name resolution of free variables occurs at runtime, not '\n'at compile\\n'\n'time. This means that the following code will print 42:\\n'\n'\\n'\n' i = 10\\n'\n' def f():\\n'\n' print(i)\\n'\n' i = 42\\n'\n' f()\\n'\n'\\n'\n'The \"eval()\" and \"exec()\" functions do not have access '\n'to the full\\n'\n'environment for resolving names. Names may be resolved '\n'in the local\\n'\n'and global namespaces of the caller. Free variables are '\n'not resolved\\n'\n'in the nearest enclosing namespace, but in the global '\n'namespace. [1]\\n'\n'The \"exec()\" and \"eval()\" functions have optional '\n'arguments to\\n'\n'override the global and local namespace. If only one '\n'namespace is\\n'\n'specified, it is used for both.\\n',\n'else':'The \"if\" statement\\n'\n'******************\\n'\n'\\n'\n'The \"if\" statement is used for conditional execution:\\n'\n'\\n'\n' if_stmt ::= \"if\" assignment_expression \":\" suite\\n'\n' (\"elif\" assignment_expression \":\" suite)*\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'It selects exactly one of the suites by evaluating the expressions '\n'one\\n'\n'by one until one is found to be true (see section Boolean '\n'operations\\n'\n'for the definition of true and false); then that suite is executed\\n'\n'(and no other part of the \"if\" statement is executed or evaluated).\\n'\n'If all expressions are false, the suite of the \"else\" clause, if\\n'\n'present, is executed.\\n',\n'exceptions':'Exceptions\\n'\n'**********\\n'\n'\\n'\n'Exceptions are a means of breaking out of the normal flow of '\n'control\\n'\n'of a code block in order to handle errors or other '\n'exceptional\\n'\n'conditions. An exception is *raised* at the point where the '\n'error is\\n'\n'detected; it may be *handled* by the surrounding code block or '\n'by any\\n'\n'code block that directly or indirectly invoked the code block '\n'where\\n'\n'the error occurred.\\n'\n'\\n'\n'The Python interpreter raises an exception when it detects a '\n'run-time\\n'\n'error (such as division by zero). A Python program can also\\n'\n'explicitly raise an exception with the \"raise\" statement. '\n'Exception\\n'\n'handlers are specified with the \"try\" \u2026 \"except\" statement. '\n'The\\n'\n'\"finally\" clause of such a statement can be used to specify '\n'cleanup\\n'\n'code which does not handle the exception, but is executed '\n'whether an\\n'\n'exception occurred or not in the preceding code.\\n'\n'\\n'\n'Python uses the \u201ctermination\u201d model of error handling: an '\n'exception\\n'\n'handler can find out what happened and continue execution at '\n'an outer\\n'\n'level, but it cannot repair the cause of the error and retry '\n'the\\n'\n'failing operation (except by re-entering the offending piece '\n'of code\\n'\n'from the top).\\n'\n'\\n'\n'When an exception is not handled at all, the interpreter '\n'terminates\\n'\n'execution of the program, or returns to its interactive main '\n'loop. In\\n'\n'either case, it prints a stack traceback, except when the '\n'exception is\\n'\n'\"SystemExit\".\\n'\n'\\n'\n'Exceptions are identified by class instances. The \"except\" '\n'clause is\\n'\n'selected depending on the class of the instance: it must '\n'reference the\\n'\n'class of the instance or a base class thereof. The instance '\n'can be\\n'\n'received by the handler and can carry additional information '\n'about the\\n'\n'exceptional condition.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Exception messages are not part of the Python API. Their '\n'contents\\n'\n' may change from one version of Python to the next without '\n'warning\\n'\n' and should not be relied on by code which will run under '\n'multiple\\n'\n' versions of the interpreter.\\n'\n'\\n'\n'See also the description of the \"try\" statement in section The '\n'try\\n'\n'statement and \"raise\" statement in section The raise '\n'statement.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] This limitation occurs because the code that is executed '\n'by these\\n'\n' operations is not available at the time the module is '\n'compiled.\\n',\n'execmodel':'Execution model\\n'\n'***************\\n'\n'\\n'\n'\\n'\n'Structure of a program\\n'\n'======================\\n'\n'\\n'\n'A Python program is constructed from code blocks. A *block* is '\n'a piece\\n'\n'of Python program text that is executed as a unit. The '\n'following are\\n'\n'blocks: a module, a function body, and a class definition. '\n'Each\\n'\n'command typed interactively is a block. A script file (a file '\n'given\\n'\n'as standard input to the interpreter or specified as a command '\n'line\\n'\n'argument to the interpreter) is a code block. A script command '\n'(a\\n'\n'command specified on the interpreter command line with the '\n'\"-c\"\\n'\n'option) is a code block. A module run as a top level script (as '\n'module\\n'\n'\"__main__\") from the command line using a \"-m\" argument is also '\n'a code\\n'\n'block. The string argument passed to the built-in functions '\n'\"eval()\"\\n'\n'and \"exec()\" is a code block.\\n'\n'\\n'\n'A code block is executed in an *execution frame*. A frame '\n'contains\\n'\n'some administrative information (used for debugging) and '\n'determines\\n'\n'where and how execution continues after the code block\u2019s '\n'execution has\\n'\n'completed.\\n'\n'\\n'\n'\\n'\n'Naming and binding\\n'\n'==================\\n'\n'\\n'\n'\\n'\n'Binding of names\\n'\n'----------------\\n'\n'\\n'\n'*Names* refer to objects. Names are introduced by name '\n'binding\\n'\n'operations.\\n'\n'\\n'\n'The following constructs bind names: formal parameters to '\n'functions,\\n'\n'\"import\" statements, class and function definitions (these bind '\n'the\\n'\n'class or function name in the defining block), and targets that '\n'are\\n'\n'identifiers if occurring in an assignment, \"for\" loop header, '\n'or after\\n'\n'\"as\" in a \"with\" statement or \"except\" clause. The \"import\" '\n'statement\\n'\n'of the form \"from ... import *\" binds all names defined in the\\n'\n'imported module, except those beginning with an underscore. '\n'This form\\n'\n'may only be used at the module level.\\n'\n'\\n'\n'A target occurring in a \"del\" statement is also considered '\n'bound for\\n'\n'this purpose (though the actual semantics are to unbind the '\n'name).\\n'\n'\\n'\n'Each assignment or import statement occurs within a block '\n'defined by a\\n'\n'class or function definition or at the module level (the '\n'top-level\\n'\n'code block).\\n'\n'\\n'\n'If a name is bound in a block, it is a local variable of that '\n'block,\\n'\n'unless declared as \"nonlocal\" or \"global\". If a name is bound '\n'at the\\n'\n'module level, it is a global variable. (The variables of the '\n'module\\n'\n'code block are local and global.) If a variable is used in a '\n'code\\n'\n'block but not defined there, it is a *free variable*.\\n'\n'\\n'\n'Each occurrence of a name in the program text refers to the '\n'*binding*\\n'\n'of that name established by the following name resolution '\n'rules.\\n'\n'\\n'\n'\\n'\n'Resolution of names\\n'\n'-------------------\\n'\n'\\n'\n'A *scope* defines the visibility of a name within a block. If '\n'a local\\n'\n'variable is defined in a block, its scope includes that block. '\n'If the\\n'\n'definition occurs in a function block, the scope extends to any '\n'blocks\\n'\n'contained within the defining one, unless a contained block '\n'introduces\\n'\n'a different binding for the name.\\n'\n'\\n'\n'When a name is used in a code block, it is resolved using the '\n'nearest\\n'\n'enclosing scope. The set of all such scopes visible to a code '\n'block\\n'\n'is called the block\u2019s *environment*.\\n'\n'\\n'\n'When a name is not found at all, a \"NameError\" exception is '\n'raised. If\\n'\n'the current scope is a function scope, and the name refers to a '\n'local\\n'\n'variable that has not yet been bound to a value at the point '\n'where the\\n'\n'name is used, an \"UnboundLocalError\" exception is raised.\\n'\n'\"UnboundLocalError\" is a subclass of \"NameError\".\\n'\n'\\n'\n'If a name binding operation occurs anywhere within a code '\n'block, all\\n'\n'uses of the name within the block are treated as references to '\n'the\\n'\n'current block. This can lead to errors when a name is used '\n'within a\\n'\n'block before it is bound. This rule is subtle. Python lacks\\n'\n'declarations and allows name binding operations to occur '\n'anywhere\\n'\n'within a code block. The local variables of a code block can '\n'be\\n'\n'determined by scanning the entire text of the block for name '\n'binding\\n'\n'operations.\\n'\n'\\n'\n'If the \"global\" statement occurs within a block, all uses of '\n'the name\\n'\n'specified in the statement refer to the binding of that name in '\n'the\\n'\n'top-level namespace. Names are resolved in the top-level '\n'namespace by\\n'\n'searching the global namespace, i.e. the namespace of the '\n'module\\n'\n'containing the code block, and the builtins namespace, the '\n'namespace\\n'\n'of the module \"builtins\". The global namespace is searched '\n'first. If\\n'\n'the name is not found there, the builtins namespace is '\n'searched. The\\n'\n'\"global\" statement must precede all uses of the name.\\n'\n'\\n'\n'The \"global\" statement has the same scope as a name binding '\n'operation\\n'\n'in the same block. If the nearest enclosing scope for a free '\n'variable\\n'\n'contains a global statement, the free variable is treated as a '\n'global.\\n'\n'\\n'\n'The \"nonlocal\" statement causes corresponding names to refer '\n'to\\n'\n'previously bound variables in the nearest enclosing function '\n'scope.\\n'\n'\"SyntaxError\" is raised at compile time if the given name does '\n'not\\n'\n'exist in any enclosing function scope.\\n'\n'\\n'\n'The namespace for a module is automatically created the first '\n'time a\\n'\n'module is imported. The main module for a script is always '\n'called\\n'\n'\"__main__\".\\n'\n'\\n'\n'Class definition blocks and arguments to \"exec()\" and \"eval()\" '\n'are\\n'\n'special in the context of name resolution. A class definition '\n'is an\\n'\n'executable statement that may use and define names. These '\n'references\\n'\n'follow the normal rules for name resolution with an exception '\n'that\\n'\n'unbound local variables are looked up in the global namespace. '\n'The\\n'\n'namespace of the class definition becomes the attribute '\n'dictionary of\\n'\n'the class. The scope of names defined in a class block is '\n'limited to\\n'\n'the class block; it does not extend to the code blocks of '\n'methods \u2013\\n'\n'this includes comprehensions and generator expressions since '\n'they are\\n'\n'implemented using a function scope. This means that the '\n'following\\n'\n'will fail:\\n'\n'\\n'\n' class A:\\n'\n' a = 42\\n'\n' b = list(a + i for i in range(10))\\n'\n'\\n'\n'\\n'\n'Builtins and restricted execution\\n'\n'---------------------------------\\n'\n'\\n'\n'**CPython implementation detail:** Users should not touch\\n'\n'\"__builtins__\"; it is strictly an implementation detail. '\n'Users\\n'\n'wanting to override values in the builtins namespace should '\n'\"import\"\\n'\n'the \"builtins\" module and modify its attributes appropriately.\\n'\n'\\n'\n'The builtins namespace associated with the execution of a code '\n'block\\n'\n'is actually found by looking up the name \"__builtins__\" in its '\n'global\\n'\n'namespace; this should be a dictionary or a module (in the '\n'latter case\\n'\n'the module\u2019s dictionary is used). By default, when in the '\n'\"__main__\"\\n'\n'module, \"__builtins__\" is the built-in module \"builtins\"; when '\n'in any\\n'\n'other module, \"__builtins__\" is an alias for the dictionary of '\n'the\\n'\n'\"builtins\" module itself.\\n'\n'\\n'\n'\\n'\n'Interaction with dynamic features\\n'\n'---------------------------------\\n'\n'\\n'\n'Name resolution of free variables occurs at runtime, not at '\n'compile\\n'\n'time. This means that the following code will print 42:\\n'\n'\\n'\n' i = 10\\n'\n' def f():\\n'\n' print(i)\\n'\n' i = 42\\n'\n' f()\\n'\n'\\n'\n'The \"eval()\" and \"exec()\" functions do not have access to the '\n'full\\n'\n'environment for resolving names. Names may be resolved in the '\n'local\\n'\n'and global namespaces of the caller. Free variables are not '\n'resolved\\n'\n'in the nearest enclosing namespace, but in the global '\n'namespace. [1]\\n'\n'The \"exec()\" and \"eval()\" functions have optional arguments to\\n'\n'override the global and local namespace. If only one namespace '\n'is\\n'\n'specified, it is used for both.\\n'\n'\\n'\n'\\n'\n'Exceptions\\n'\n'==========\\n'\n'\\n'\n'Exceptions are a means of breaking out of the normal flow of '\n'control\\n'\n'of a code block in order to handle errors or other exceptional\\n'\n'conditions. An exception is *raised* at the point where the '\n'error is\\n'\n'detected; it may be *handled* by the surrounding code block or '\n'by any\\n'\n'code block that directly or indirectly invoked the code block '\n'where\\n'\n'the error occurred.\\n'\n'\\n'\n'The Python interpreter raises an exception when it detects a '\n'run-time\\n'\n'error (such as division by zero). A Python program can also\\n'\n'explicitly raise an exception with the \"raise\" statement. '\n'Exception\\n'\n'handlers are specified with the \"try\" \u2026 \"except\" statement. '\n'The\\n'\n'\"finally\" clause of such a statement can be used to specify '\n'cleanup\\n'\n'code which does not handle the exception, but is executed '\n'whether an\\n'\n'exception occurred or not in the preceding code.\\n'\n'\\n'\n'Python uses the \u201ctermination\u201d model of error handling: an '\n'exception\\n'\n'handler can find out what happened and continue execution at an '\n'outer\\n'\n'level, but it cannot repair the cause of the error and retry '\n'the\\n'\n'failing operation (except by re-entering the offending piece of '\n'code\\n'\n'from the top).\\n'\n'\\n'\n'When an exception is not handled at all, the interpreter '\n'terminates\\n'\n'execution of the program, or returns to its interactive main '\n'loop. In\\n'\n'either case, it prints a stack traceback, except when the '\n'exception is\\n'\n'\"SystemExit\".\\n'\n'\\n'\n'Exceptions are identified by class instances. The \"except\" '\n'clause is\\n'\n'selected depending on the class of the instance: it must '\n'reference the\\n'\n'class of the instance or a base class thereof. The instance '\n'can be\\n'\n'received by the handler and can carry additional information '\n'about the\\n'\n'exceptional condition.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Exception messages are not part of the Python API. Their '\n'contents\\n'\n' may change from one version of Python to the next without '\n'warning\\n'\n' and should not be relied on by code which will run under '\n'multiple\\n'\n' versions of the interpreter.\\n'\n'\\n'\n'See also the description of the \"try\" statement in section The '\n'try\\n'\n'statement and \"raise\" statement in section The raise '\n'statement.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] This limitation occurs because the code that is executed by '\n'these\\n'\n' operations is not available at the time the module is '\n'compiled.\\n',\n'exprlists':'Expression lists\\n'\n'****************\\n'\n'\\n'\n' expression_list ::= expression (\",\" expression)* [\",\"]\\n'\n' starred_list ::= starred_item (\",\" starred_item)* '\n'[\",\"]\\n'\n' starred_expression ::= expression | (starred_item \",\")* '\n'[starred_item]\\n'\n' starred_item ::= assignment_expression | \"*\" or_expr\\n'\n'\\n'\n'Except when part of a list or set display, an expression list\\n'\n'containing at least one comma yields a tuple. The length of '\n'the tuple\\n'\n'is the number of expressions in the list. The expressions are\\n'\n'evaluated from left to right.\\n'\n'\\n'\n'An asterisk \"*\" denotes *iterable unpacking*. Its operand must '\n'be an\\n'\n'*iterable*. The iterable is expanded into a sequence of items, '\n'which\\n'\n'are included in the new tuple, list, or set, at the site of '\n'the\\n'\n'unpacking.\\n'\n'\\n'\n'New in version 3.5: Iterable unpacking in expression lists, '\n'originally\\n'\n'proposed by **PEP 448**.\\n'\n'\\n'\n'The trailing comma is required only to create a single tuple '\n'(a.k.a. a\\n'\n'*singleton*); it is optional in all other cases. A single '\n'expression\\n'\n'without a trailing comma doesn\u2019t create a tuple, but rather '\n'yields the\\n'\n'value of that expression. (To create an empty tuple, use an '\n'empty pair\\n'\n'of parentheses: \"()\".)\\n',\n'floating':'Floating point literals\\n'\n'***********************\\n'\n'\\n'\n'Floating point literals are described by the following lexical\\n'\n'definitions:\\n'\n'\\n'\n' floatnumber ::= pointfloat | exponentfloat\\n'\n' pointfloat ::= [digitpart] fraction | digitpart \".\"\\n'\n' exponentfloat ::= (digitpart | pointfloat) exponent\\n'\n' digitpart ::= digit ([\"_\"] digit)*\\n'\n' fraction ::= \".\" digitpart\\n'\n' exponent ::= (\"e\" | \"E\") [\"+\" | \"-\"] digitpart\\n'\n'\\n'\n'Note that the integer and exponent parts are always interpreted '\n'using\\n'\n'radix 10. For example, \"077e010\" is legal, and denotes the same '\n'number\\n'\n'as \"77e10\". The allowed range of floating point literals is\\n'\n'implementation-dependent. As in integer literals, underscores '\n'are\\n'\n'supported for digit grouping.\\n'\n'\\n'\n'Some examples of floating point literals:\\n'\n'\\n'\n' 3.14 10. .001 1e100 3.14e-10 0e0 '\n'3.14_15_93\\n'\n'\\n'\n'Changed in version 3.6: Underscores are now allowed for '\n'grouping\\n'\n'purposes in literals.\\n',\n'for':'The \"for\" statement\\n'\n'*******************\\n'\n'\\n'\n'The \"for\" statement is used to iterate over the elements of a '\n'sequence\\n'\n'(such as a string, tuple or list) or other iterable object:\\n'\n'\\n'\n' for_stmt ::= \"for\" target_list \"in\" expression_list \":\" suite\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'The expression list is evaluated once; it should yield an iterable\\n'\n'object. An iterator is created for the result of the\\n'\n'\"expression_list\". The suite is then executed once for each item\\n'\n'provided by the iterator, in the order returned by the iterator. '\n'Each\\n'\n'item in turn is assigned to the target list using the standard rules\\n'\n'for assignments (see Assignment statements), and then the suite is\\n'\n'executed. When the items are exhausted (which is immediately when '\n'the\\n'\n'sequence is empty or an iterator raises a \"StopIteration\" '\n'exception),\\n'\n'the suite in the \"else\" clause, if present, is executed, and the '\n'loop\\n'\n'terminates.\\n'\n'\\n'\n'A \"break\" statement executed in the first suite terminates the loop\\n'\n'without executing the \"else\" clause\u2019s suite. A \"continue\" statement\\n'\n'executed in the first suite skips the rest of the suite and '\n'continues\\n'\n'with the next item, or with the \"else\" clause if there is no next\\n'\n'item.\\n'\n'\\n'\n'The for-loop makes assignments to the variables in the target list.\\n'\n'This overwrites all previous assignments to those variables '\n'including\\n'\n'those made in the suite of the for-loop:\\n'\n'\\n'\n' for i in range(10):\\n'\n' print(i)\\n'\n' i = 5 # this will not affect the for-loop\\n'\n' # because i will be overwritten with the '\n'next\\n'\n' # index in the range\\n'\n'\\n'\n'Names in the target list are not deleted when the loop is finished,\\n'\n'but if the sequence is empty, they will not have been assigned to at\\n'\n'all by the loop. Hint: the built-in function \"range()\" returns an\\n'\n'iterator of integers suitable to emulate the effect of Pascal\u2019s \"for '\n'i\\n'\n':= a to b do\"; e.g., \"list(range(3))\" returns the list \"[0, 1, 2]\".\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' There is a subtlety when the sequence is being modified by the '\n'loop\\n'\n' (this can only occur for mutable sequences, e.g. lists). An\\n'\n' internal counter is used to keep track of which item is used next,\\n'\n' and this is incremented on each iteration. When this counter has\\n'\n' reached the length of the sequence the loop terminates. This '\n'means\\n'\n' that if the suite deletes the current (or a previous) item from '\n'the\\n'\n' sequence, the next item will be skipped (since it gets the index '\n'of\\n'\n' the current item which has already been treated). Likewise, if '\n'the\\n'\n' suite inserts an item in the sequence before the current item, the\\n'\n' current item will be treated again the next time through the loop.\\n'\n' This can lead to nasty bugs that can be avoided by making a\\n'\n' temporary copy using a slice of the whole sequence, e.g.,\\n'\n'\\n'\n' for x in a[:]:\\n'\n' if x < 0: a.remove(x)\\n',\n'formatstrings':'Format String Syntax\\n'\n'********************\\n'\n'\\n'\n'The \"str.format()\" method and the \"Formatter\" class share '\n'the same\\n'\n'syntax for format strings (although in the case of '\n'\"Formatter\",\\n'\n'subclasses can define their own format string syntax). The '\n'syntax is\\n'\n'related to that of formatted string literals, but it is '\n'less\\n'\n'sophisticated and, in particular, does not support '\n'arbitrary\\n'\n'expressions.\\n'\n'\\n'\n'Format strings contain \u201creplacement fields\u201d surrounded by '\n'curly braces\\n'\n'\"{}\". Anything that is not contained in braces is '\n'considered literal\\n'\n'text, which is copied unchanged to the output. If you need '\n'to include\\n'\n'a brace character in the literal text, it can be escaped by '\n'doubling:\\n'\n'\"{{\" and \"}}\".\\n'\n'\\n'\n'The grammar for a replacement field is as follows:\\n'\n'\\n'\n' replacement_field ::= \"{\" [field_name] [\"!\" '\n'conversion] [\":\" format_spec] \"}\"\\n'\n' field_name ::= arg_name (\".\" attribute_name | '\n'\"[\" element_index \"]\")*\\n'\n' arg_name ::= [identifier | digit+]\\n'\n' attribute_name ::= identifier\\n'\n' element_index ::= digit+ | index_string\\n'\n' index_string ::= +\\n'\n' conversion ::= \"r\" | \"s\" | \"a\"\\n'\n' format_spec ::= \\n'\n'\\n'\n'In less formal terms, the replacement field can start with '\n'a\\n'\n'*field_name* that specifies the object whose value is to be '\n'formatted\\n'\n'and inserted into the output instead of the replacement '\n'field. The\\n'\n'*field_name* is optionally followed by a *conversion* '\n'field, which is\\n'\n'preceded by an exclamation point \"\\'!\\'\", and a '\n'*format_spec*, which is\\n'\n'preceded by a colon \"\\':\\'\". These specify a non-default '\n'format for the\\n'\n'replacement value.\\n'\n'\\n'\n'See also the Format Specification Mini-Language section.\\n'\n'\\n'\n'The *field_name* itself begins with an *arg_name* that is '\n'either a\\n'\n'number or a keyword. If it\u2019s a number, it refers to a '\n'positional\\n'\n'argument, and if it\u2019s a keyword, it refers to a named '\n'keyword\\n'\n'argument. If the numerical arg_names in a format string '\n'are 0, 1, 2,\\n'\n'\u2026 in sequence, they can all be omitted (not just some) and '\n'the numbers\\n'\n'0, 1, 2, \u2026 will be automatically inserted in that order. '\n'Because\\n'\n'*arg_name* is not quote-delimited, it is not possible to '\n'specify\\n'\n'arbitrary dictionary keys (e.g., the strings \"\\'10\\'\" or '\n'\"\\':-]\\'\") within\\n'\n'a format string. The *arg_name* can be followed by any '\n'number of index\\n'\n'or attribute expressions. An expression of the form '\n'\"\\'.name\\'\" selects\\n'\n'the named attribute using \"getattr()\", while an expression '\n'of the form\\n'\n'\"\\'[index]\\'\" does an index lookup using \"__getitem__()\".\\n'\n'\\n'\n'Changed in version 3.1: The positional argument specifiers '\n'can be\\n'\n'omitted for \"str.format()\", so \"\\'{} {}\\'.format(a, b)\" is '\n'equivalent to\\n'\n'\"\\'{0} {1}\\'.format(a, b)\".\\n'\n'\\n'\n'Changed in version 3.4: The positional argument specifiers '\n'can be\\n'\n'omitted for \"Formatter\".\\n'\n'\\n'\n'Some simple format string examples:\\n'\n'\\n'\n' \"First, thou shalt count to {0}\" # References first '\n'positional argument\\n'\n' \"Bring me a {}\" # Implicitly '\n'references the first positional argument\\n'\n' \"From {} to {}\" # Same as \"From {0} to '\n'{1}\"\\n'\n' \"My quest is {name}\" # References keyword '\n\"argument 'name'\\n\"\n' \"Weight in tons {0.weight}\" # \\'weight\\' attribute '\n'of first positional arg\\n'\n' \"Units destroyed: {players[0]}\" # First element of '\n\"keyword argument 'players'.\\n\"\n'\\n'\n'The *conversion* field causes a type coercion before '\n'formatting.\\n'\n'Normally, the job of formatting a value is done by the '\n'\"__format__()\"\\n'\n'method of the value itself. However, in some cases it is '\n'desirable to\\n'\n'force a type to be formatted as a string, overriding its '\n'own\\n'\n'definition of formatting. By converting the value to a '\n'string before\\n'\n'calling \"__format__()\", the normal formatting logic is '\n'bypassed.\\n'\n'\\n'\n'Three conversion flags are currently supported: \"\\'!s\\'\" '\n'which calls\\n'\n'\"str()\" on the value, \"\\'!r\\'\" which calls \"repr()\" and '\n'\"\\'!a\\'\" which\\n'\n'calls \"ascii()\".\\n'\n'\\n'\n'Some examples:\\n'\n'\\n'\n' \"Harold\\'s a clever {0!s}\" # Calls str() on the '\n'argument first\\n'\n' \"Bring out the holy {name!r}\" # Calls repr() on the '\n'argument first\\n'\n' \"More {!a}\" # Calls ascii() on the '\n'argument first\\n'\n'\\n'\n'The *format_spec* field contains a specification of how the '\n'value\\n'\n'should be presented, including such details as field width, '\n'alignment,\\n'\n'padding, decimal precision and so on. Each value type can '\n'define its\\n'\n'own \u201cformatting mini-language\u201d or interpretation of the '\n'*format_spec*.\\n'\n'\\n'\n'Most built-in types support a common formatting '\n'mini-language, which\\n'\n'is described in the next section.\\n'\n'\\n'\n'A *format_spec* field can also include nested replacement '\n'fields\\n'\n'within it. These nested replacement fields may contain a '\n'field name,\\n'\n'conversion flag and format specification, but deeper '\n'nesting is not\\n'\n'allowed. The replacement fields within the format_spec '\n'are\\n'\n'substituted before the *format_spec* string is interpreted. '\n'This\\n'\n'allows the formatting of a value to be dynamically '\n'specified.\\n'\n'\\n'\n'See the Format examples section for some examples.\\n'\n'\\n'\n'\\n'\n'Format Specification Mini-Language\\n'\n'==================================\\n'\n'\\n'\n'\u201cFormat specifications\u201d are used within replacement fields '\n'contained\\n'\n'within a format string to define how individual values are '\n'presented\\n'\n'(see Format String Syntax and Formatted string literals). '\n'They can\\n'\n'also be passed directly to the built-in \"format()\" '\n'function. Each\\n'\n'formattable type may define how the format specification is '\n'to be\\n'\n'interpreted.\\n'\n'\\n'\n'Most built-in types implement the following options for '\n'format\\n'\n'specifications, although some of the formatting options are '\n'only\\n'\n'supported by the numeric types.\\n'\n'\\n'\n'A general convention is that an empty format specification '\n'produces\\n'\n'the same result as if you had called \"str()\" on the value. '\n'A non-empty\\n'\n'format specification typically modifies the result.\\n'\n'\\n'\n'The general form of a *standard format specifier* is:\\n'\n'\\n'\n' format_spec ::= '\n'[[fill]align][sign][#][0][width][grouping_option][.precision][type]\\n'\n' fill ::= \\n'\n' align ::= \"<\" | \">\" | \"=\" | \"^\"\\n'\n' sign ::= \"+\" | \"-\" | \" \"\\n'\n' width ::= digit+\\n'\n' grouping_option ::= \"_\" | \",\"\\n'\n' precision ::= digit+\\n'\n' type ::= \"b\" | \"c\" | \"d\" | \"e\" | \"E\" | \"f\" | '\n'\"F\" | \"g\" | \"G\" | \"n\" | \"o\" | \"s\" | \"x\" | \"X\" | \"%\"\\n'\n'\\n'\n'If a valid *align* value is specified, it can be preceded '\n'by a *fill*\\n'\n'character that can be any character and defaults to a space '\n'if\\n'\n'omitted. It is not possible to use a literal curly brace '\n'(\u201d\"{\"\u201d or\\n'\n'\u201c\"}\"\u201d) as the *fill* character in a formatted string '\n'literal or when\\n'\n'using the \"str.format()\" method. However, it is possible '\n'to insert a\\n'\n'curly brace with a nested replacement field. This '\n'limitation doesn\u2019t\\n'\n'affect the \"format()\" function.\\n'\n'\\n'\n'The meaning of the various alignment options is as '\n'follows:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Option | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'<\\'\" | Forces the field to be left-aligned '\n'within the available |\\n'\n' | | space (this is the default for most '\n'objects). |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'>\\'\" | Forces the field to be right-aligned '\n'within the available |\\n'\n' | | space (this is the default for '\n'numbers). |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'=\\'\" | Forces the padding to be placed after '\n'the sign (if any) |\\n'\n' | | but before the digits. This is used for '\n'printing fields |\\n'\n' | | in the form \u2018+000000120\u2019. This alignment '\n'option is only |\\n'\n' | | valid for numeric types. It becomes the '\n'default for |\\n'\n' | | numbers when \u20180\u2019 immediately precedes the '\n'field width. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'^\\'\" | Forces the field to be centered within '\n'the available |\\n'\n' | | '\n'space. '\n'|\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'Note that unless a minimum field width is defined, the '\n'field width\\n'\n'will always be the same size as the data to fill it, so '\n'that the\\n'\n'alignment option has no meaning in this case.\\n'\n'\\n'\n'The *sign* option is only valid for number types, and can '\n'be one of\\n'\n'the following:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Option | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'+\\'\" | indicates that a sign should be used for '\n'both positive as |\\n'\n' | | well as negative '\n'numbers. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'-\\'\" | indicates that a sign should be used '\n'only for negative |\\n'\n' | | numbers (this is the default '\n'behavior). |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | space | indicates that a leading space should be '\n'used on positive |\\n'\n' | | numbers, and a minus sign on negative '\n'numbers. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'The \"\\'#\\'\" option causes the \u201calternate form\u201d to be used '\n'for the\\n'\n'conversion. The alternate form is defined differently for '\n'different\\n'\n'types. This option is only valid for integer, float and '\n'complex\\n'\n'types. For integers, when binary, octal, or hexadecimal '\n'output is\\n'\n'used, this option adds the respective prefix \"\\'0b\\'\", '\n'\"\\'0o\\'\", \"\\'0x\\'\",\\n'\n'or \"\\'0X\\'\" to the output value. For float and complex the '\n'alternate\\n'\n'form causes the result of the conversion to always contain '\n'a decimal-\\n'\n'point character, even if no digits follow it. Normally, a '\n'decimal-\\n'\n'point character appears in the result of these conversions '\n'only if a\\n'\n'digit follows it. In addition, for \"\\'g\\'\" and \"\\'G\\'\" '\n'conversions,\\n'\n'trailing zeros are not removed from the result.\\n'\n'\\n'\n'The \"\\',\\'\" option signals the use of a comma for a '\n'thousands separator.\\n'\n'For a locale aware separator, use the \"\\'n\\'\" integer '\n'presentation type\\n'\n'instead.\\n'\n'\\n'\n'Changed in version 3.1: Added the \"\\',\\'\" option (see also '\n'**PEP 378**).\\n'\n'\\n'\n'The \"\\'_\\'\" option signals the use of an underscore for a '\n'thousands\\n'\n'separator for floating point presentation types and for '\n'integer\\n'\n'presentation type \"\\'d\\'\". For integer presentation types '\n'\"\\'b\\'\", \"\\'o\\'\",\\n'\n'\"\\'x\\'\", and \"\\'X\\'\", underscores will be inserted every 4 '\n'digits. For\\n'\n'other presentation types, specifying this option is an '\n'error.\\n'\n'\\n'\n'Changed in version 3.6: Added the \"\\'_\\'\" option (see also '\n'**PEP 515**).\\n'\n'\\n'\n'*width* is a decimal integer defining the minimum total '\n'field width,\\n'\n'including any prefixes, separators, and other formatting '\n'characters.\\n'\n'If not specified, then the field width will be determined '\n'by the\\n'\n'content.\\n'\n'\\n'\n'When no explicit alignment is given, preceding the *width* '\n'field by a\\n'\n'zero (\"\\'0\\'\") character enables sign-aware zero-padding '\n'for numeric\\n'\n'types. This is equivalent to a *fill* character of \"\\'0\\'\" '\n'with an\\n'\n'*alignment* type of \"\\'=\\'\".\\n'\n'\\n'\n'Changed in version 3.10: Preceding the *width* field by '\n'\"\\'0\\'\" no\\n'\n'longer affects the default alignment for strings.\\n'\n'\\n'\n'The *precision* is a decimal number indicating how many '\n'digits should\\n'\n'be displayed after the decimal point for a floating point '\n'value\\n'\n'formatted with \"\\'f\\'\" and \"\\'F\\'\", or before and after the '\n'decimal point\\n'\n'for a floating point value formatted with \"\\'g\\'\" or '\n'\"\\'G\\'\". For non-\\n'\n'number types the field indicates the maximum field size - '\n'in other\\n'\n'words, how many characters will be used from the field '\n'content. The\\n'\n'*precision* is not allowed for integer values.\\n'\n'\\n'\n'Finally, the *type* determines how the data should be '\n'presented.\\n'\n'\\n'\n'The available string presentation types are:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Type | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'s\\'\" | String format. This is the default type '\n'for strings and |\\n'\n' | | may be '\n'omitted. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | None | The same as '\n'\"\\'s\\'\". |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'The available integer presentation types are:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Type | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'b\\'\" | Binary format. Outputs the number in '\n'base 2. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'c\\'\" | Character. Converts the integer to the '\n'corresponding |\\n'\n' | | unicode character before '\n'printing. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'d\\'\" | Decimal Integer. Outputs the number in '\n'base 10. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'o\\'\" | Octal format. Outputs the number in base '\n'8. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'x\\'\" | Hex format. Outputs the number in base '\n'16, using lower- |\\n'\n' | | case letters for the digits above '\n'9. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'X\\'\" | Hex format. Outputs the number in base '\n'16, using upper- |\\n'\n' | | case letters for the digits above 9. In '\n'case \"\\'#\\'\" is |\\n'\n' | | specified, the prefix \"\\'0x\\'\" will be '\n'upper-cased to \"\\'0X\\'\" |\\n'\n' | | as '\n'well. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'n\\'\" | Number. This is the same as \"\\'d\\'\", '\n'except that it uses the |\\n'\n' | | current locale setting to insert the '\n'appropriate number |\\n'\n' | | separator '\n'characters. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | None | The same as '\n'\"\\'d\\'\". |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'In addition to the above presentation types, integers can '\n'be formatted\\n'\n'with the floating point presentation types listed below '\n'(except \"\\'n\\'\"\\n'\n'and \"None\"). When doing so, \"float()\" is used to convert '\n'the integer\\n'\n'to a floating point number before formatting.\\n'\n'\\n'\n'The available presentation types for \"float\" and \"Decimal\" '\n'values are:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Type | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'e\\'\" | Scientific notation. For a given '\n'precision \"p\", formats |\\n'\n' | | the number in scientific notation with the '\n'letter \u2018e\u2019 |\\n'\n' | | separating the coefficient from the '\n'exponent. The |\\n'\n' | | coefficient has one digit before and \"p\" '\n'digits after the |\\n'\n' | | decimal point, for a total of \"p + 1\" '\n'significant digits. |\\n'\n' | | With no precision given, uses a precision '\n'of \"6\" digits |\\n'\n' | | after the decimal point for \"float\", and '\n'shows all |\\n'\n' | | coefficient digits for \"Decimal\". If no '\n'digits follow the |\\n'\n' | | decimal point, the decimal point is also '\n'removed unless |\\n'\n' | | the \"#\" option is '\n'used. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'E\\'\" | Scientific notation. Same as \"\\'e\\'\" '\n'except it uses an upper |\\n'\n' | | case \u2018E\u2019 as the separator '\n'character. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'f\\'\" | Fixed-point notation. For a given '\n'precision \"p\", formats |\\n'\n' | | the number as a decimal number with '\n'exactly \"p\" digits |\\n'\n' | | following the decimal point. With no '\n'precision given, uses |\\n'\n' | | a precision of \"6\" digits after the '\n'decimal point for |\\n'\n' | | \"float\", and uses a precision large enough '\n'to show all |\\n'\n' | | coefficient digits for \"Decimal\". If no '\n'digits follow the |\\n'\n' | | decimal point, the decimal point is also '\n'removed unless |\\n'\n' | | the \"#\" option is '\n'used. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'F\\'\" | Fixed-point notation. Same as \"\\'f\\'\", '\n'but converts \"nan\" to |\\n'\n' | | \"NAN\" and \"inf\" to '\n'\"INF\". |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'g\\'\" | General format. For a given precision '\n'\"p >= 1\", this |\\n'\n' | | rounds the number to \"p\" significant '\n'digits and then |\\n'\n' | | formats the result in either fixed-point '\n'format or in |\\n'\n' | | scientific notation, depending on its '\n'magnitude. A |\\n'\n' | | precision of \"0\" is treated as equivalent '\n'to a precision |\\n'\n' | | of \"1\". The precise rules are as follows: '\n'suppose that |\\n'\n' | | the result formatted with presentation '\n'type \"\\'e\\'\" and |\\n'\n' | | precision \"p-1\" would have exponent '\n'\"exp\". Then, if \"m <= |\\n'\n' | | exp < p\", where \"m\" is -4 for floats and '\n'-6 for |\\n'\n' | | \"Decimals\", the number is formatted with '\n'presentation type |\\n'\n' | | \"\\'f\\'\" and precision \"p-1-exp\". '\n'Otherwise, the number is |\\n'\n' | | formatted with presentation type \"\\'e\\'\" '\n'and precision |\\n'\n' | | \"p-1\". In both cases insignificant '\n'trailing zeros are |\\n'\n' | | removed from the significand, and the '\n'decimal point is |\\n'\n' | | also removed if there are no remaining '\n'digits following |\\n'\n' | | it, unless the \"\\'#\\'\" option is used. '\n'With no precision |\\n'\n' | | given, uses a precision of \"6\" significant '\n'digits for |\\n'\n' | | \"float\". For \"Decimal\", the coefficient of '\n'the result is |\\n'\n' | | formed from the coefficient digits of the '\n'value; |\\n'\n' | | scientific notation is used for values '\n'smaller than \"1e-6\" |\\n'\n' | | in absolute value and values where the '\n'place value of the |\\n'\n' | | least significant digit is larger than 1, '\n'and fixed-point |\\n'\n' | | notation is used otherwise. Positive and '\n'negative |\\n'\n' | | infinity, positive and negative zero, and '\n'nans, are |\\n'\n' | | formatted as \"inf\", \"-inf\", \"0\", \"-0\" and '\n'\"nan\" |\\n'\n' | | respectively, regardless of the '\n'precision. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'G\\'\" | General format. Same as \"\\'g\\'\" except '\n'switches to \"\\'E\\'\" if |\\n'\n' | | the number gets too large. The '\n'representations of infinity |\\n'\n' | | and NaN are uppercased, '\n'too. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'n\\'\" | Number. This is the same as \"\\'g\\'\", '\n'except that it uses the |\\n'\n' | | current locale setting to insert the '\n'appropriate number |\\n'\n' | | separator '\n'characters. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'%\\'\" | Percentage. Multiplies the number by 100 '\n'and displays in |\\n'\n' | | fixed (\"\\'f\\'\") format, followed by a '\n'percent sign. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | None | For \"float\" this is the same as \"\\'g\\'\", '\n'except that when |\\n'\n' | | fixed-point notation is used to format the '\n'result, it |\\n'\n' | | always includes at least one digit past '\n'the decimal point. |\\n'\n' | | The precision used is as large as needed '\n'to represent the |\\n'\n' | | given value faithfully. For \"Decimal\", '\n'this is the same |\\n'\n' | | as either \"\\'g\\'\" or \"\\'G\\'\" depending on '\n'the value of |\\n'\n' | | \"context.capitals\" for the current decimal '\n'context. The |\\n'\n' | | overall effect is to match the output of '\n'\"str()\" as |\\n'\n' | | altered by the other format '\n'modifiers. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'\\n'\n'Format examples\\n'\n'===============\\n'\n'\\n'\n'This section contains examples of the \"str.format()\" syntax '\n'and\\n'\n'comparison with the old \"%\"-formatting.\\n'\n'\\n'\n'In most of the cases the syntax is similar to the old '\n'\"%\"-formatting,\\n'\n'with the addition of the \"{}\" and with \":\" used instead of '\n'\"%\". For\\n'\n'example, \"\\'%03.2f\\'\" can be translated to \"\\'{:03.2f}\\'\".\\n'\n'\\n'\n'The new format syntax also supports new and different '\n'options, shown\\n'\n'in the following examples.\\n'\n'\\n'\n'Accessing arguments by position:\\n'\n'\\n'\n\" >>> '{0}, {1}, {2}'.format('a', 'b', 'c')\\n\"\n\" 'a, b, c'\\n\"\n\" >>> '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only\\n\"\n\" 'a, b, c'\\n\"\n\" >>> '{2}, {1}, {0}'.format('a', 'b', 'c')\\n\"\n\" 'c, b, a'\\n\"\n\" >>> '{2}, {1}, {0}'.format(*'abc') # unpacking \"\n'argument sequence\\n'\n\" 'c, b, a'\\n\"\n\" >>> '{0}{1}{0}'.format('abra', 'cad') # arguments' \"\n'indices can be repeated\\n'\n\" 'abracadabra'\\n\"\n'\\n'\n'Accessing arguments by name:\\n'\n'\\n'\n\" >>> 'Coordinates: {latitude}, \"\n\"{longitude}'.format(latitude='37.24N', \"\n\"longitude='-115.81W')\\n\"\n\" 'Coordinates: 37.24N, -115.81W'\\n\"\n\" >>> coord = {'latitude': '37.24N', 'longitude': \"\n\"'-115.81W'}\\n\"\n\" >>> 'Coordinates: {latitude}, \"\n\"{longitude}'.format(**coord)\\n\"\n\" 'Coordinates: 37.24N, -115.81W'\\n\"\n'\\n'\n'Accessing arguments\u2019 attributes:\\n'\n'\\n'\n' >>> c = 3-5j\\n'\n\" >>> ('The complex number {0} is formed from the real \"\n\"part {0.real} '\\n\"\n\" ... 'and the imaginary part {0.imag}.').format(c)\\n\"\n\" 'The complex number (3-5j) is formed from the real part \"\n\"3.0 and the imaginary part -5.0.'\\n\"\n' >>> class Point:\\n'\n' ... def __init__(self, x, y):\\n'\n' ... self.x, self.y = x, y\\n'\n' ... def __str__(self):\\n'\n\" ... return 'Point({self.x}, \"\n\"{self.y})'.format(self=self)\\n\"\n' ...\\n'\n' >>> str(Point(4, 2))\\n'\n\" 'Point(4, 2)'\\n\"\n'\\n'\n'Accessing arguments\u2019 items:\\n'\n'\\n'\n' >>> coord = (3, 5)\\n'\n\" >>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\\n\"\n\" 'X: 3; Y: 5'\\n\"\n'\\n'\n'Replacing \"%s\" and \"%r\":\\n'\n'\\n'\n' >>> \"repr() shows quotes: {!r}; str() doesn\\'t: '\n'{!s}\".format(\\'test1\\', \\'test2\\')\\n'\n' \"repr() shows quotes: \\'test1\\'; str() doesn\\'t: test2\"\\n'\n'\\n'\n'Aligning the text and specifying a width:\\n'\n'\\n'\n\" >>> '{:<30}'.format('left aligned')\\n\"\n\" 'left aligned '\\n\"\n\" >>> '{:>30}'.format('right aligned')\\n\"\n\" ' right aligned'\\n\"\n\" >>> '{:^30}'.format('centered')\\n\"\n\" ' centered '\\n\"\n\" >>> '{:*^30}'.format('centered') # use '*' as a fill \"\n'char\\n'\n\" '***********centered***********'\\n\"\n'\\n'\n'Replacing \"%+f\", \"%-f\", and \"% f\" and specifying a sign:\\n'\n'\\n'\n\" >>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it \"\n'always\\n'\n\" '+3.140000; -3.140000'\\n\"\n\" >>> '{: f}; {: f}'.format(3.14, -3.14) # show a space \"\n'for positive numbers\\n'\n\" ' 3.140000; -3.140000'\\n\"\n\" >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the \"\n\"minus -- same as '{:f}; {:f}'\\n\"\n\" '3.140000; -3.140000'\\n\"\n'\\n'\n'Replacing \"%x\" and \"%o\" and converting the value to '\n'different bases:\\n'\n'\\n'\n' >>> # format also supports binary numbers\\n'\n' >>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: '\n'{0:b}\".format(42)\\n'\n\" 'int: 42; hex: 2a; oct: 52; bin: 101010'\\n\"\n' >>> # with 0x, 0o, or 0b as prefix:\\n'\n' >>> \"int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: '\n'{0:#b}\".format(42)\\n'\n\" 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'\\n\"\n'\\n'\n'Using the comma as a thousands separator:\\n'\n'\\n'\n\" >>> '{:,}'.format(1234567890)\\n\"\n\" '1,234,567,890'\\n\"\n'\\n'\n'Expressing a percentage:\\n'\n'\\n'\n' >>> points = 19\\n'\n' >>> total = 22\\n'\n\" >>> 'Correct answers: {:.2%}'.format(points/total)\\n\"\n\" 'Correct answers: 86.36%'\\n\"\n'\\n'\n'Using type-specific formatting:\\n'\n'\\n'\n' >>> import datetime\\n'\n' >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\\n'\n\" >>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\\n\"\n\" '2010-07-04 12:15:58'\\n\"\n'\\n'\n'Nesting arguments and more complex examples:\\n'\n'\\n'\n\" >>> for align, text in zip('<^>', ['left', 'center', \"\n\"'right']):\\n\"\n\" ... '{0:{fill}{align}16}'.format(text, fill=align, \"\n'align=align)\\n'\n' ...\\n'\n\" 'left<<<<<<<<<<<<'\\n\"\n\" '^^^^^center^^^^^'\\n\"\n\" '>>>>>>>>>>>right'\\n\"\n' >>>\\n'\n' >>> octets = [192, 168, 0, 1]\\n'\n\" >>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\\n\"\n\" 'C0A80001'\\n\"\n' >>> int(_, 16)\\n'\n' 3232235521\\n'\n' >>>\\n'\n' >>> width = 5\\n'\n' >>> for num in range(5,12): \\n'\n\" ... for base in 'dXob':\\n\"\n\" ... print('{0:{width}{base}}'.format(num, \"\n\"base=base, width=width), end=' ')\\n\"\n' ... print()\\n'\n' ...\\n'\n' 5 5 5 101\\n'\n' 6 6 6 110\\n'\n' 7 7 7 111\\n'\n' 8 8 10 1000\\n'\n' 9 9 11 1001\\n'\n' 10 A 12 1010\\n'\n' 11 B 13 1011\\n',\n'function':'Function definitions\\n'\n'********************\\n'\n'\\n'\n'A function definition defines a user-defined function object '\n'(see\\n'\n'section The standard type hierarchy):\\n'\n'\\n'\n' funcdef ::= [decorators] \"def\" funcname \"(\" '\n'[parameter_list] \")\"\\n'\n' [\"->\" expression] \":\" suite\\n'\n' decorators ::= decorator+\\n'\n' decorator ::= \"@\" assignment_expression '\n'NEWLINE\\n'\n' parameter_list ::= defparameter (\",\" '\n'defparameter)* \",\" \"/\" [\",\" [parameter_list_no_posonly]]\\n'\n' | parameter_list_no_posonly\\n'\n' parameter_list_no_posonly ::= defparameter (\",\" '\n'defparameter)* [\",\" [parameter_list_starargs]]\\n'\n' | parameter_list_starargs\\n'\n' parameter_list_starargs ::= \"*\" [parameter] (\",\" '\n'defparameter)* [\",\" [\"**\" parameter [\",\"]]]\\n'\n' | \"**\" parameter [\",\"]\\n'\n' parameter ::= identifier [\":\" expression]\\n'\n' defparameter ::= parameter [\"=\" expression]\\n'\n' funcname ::= identifier\\n'\n'\\n'\n'A function definition is an executable statement. Its execution '\n'binds\\n'\n'the function name in the current local namespace to a function '\n'object\\n'\n'(a wrapper around the executable code for the function). This\\n'\n'function object contains a reference to the current global '\n'namespace\\n'\n'as the global namespace to be used when the function is called.\\n'\n'\\n'\n'The function definition does not execute the function body; this '\n'gets\\n'\n'executed only when the function is called. [4]\\n'\n'\\n'\n'A function definition may be wrapped by one or more *decorator*\\n'\n'expressions. Decorator expressions are evaluated when the '\n'function is\\n'\n'defined, in the scope that contains the function definition. '\n'The\\n'\n'result must be a callable, which is invoked with the function '\n'object\\n'\n'as the only argument. The returned value is bound to the '\n'function name\\n'\n'instead of the function object. Multiple decorators are applied '\n'in\\n'\n'nested fashion. For example, the following code\\n'\n'\\n'\n' @f1(arg)\\n'\n' @f2\\n'\n' def func(): pass\\n'\n'\\n'\n'is roughly equivalent to\\n'\n'\\n'\n' def func(): pass\\n'\n' func = f1(arg)(f2(func))\\n'\n'\\n'\n'except that the original function is not temporarily bound to '\n'the name\\n'\n'\"func\".\\n'\n'\\n'\n'Changed in version 3.9: Functions may be decorated with any '\n'valid\\n'\n'\"assignment_expression\". Previously, the grammar was much more\\n'\n'restrictive; see **PEP 614** for details.\\n'\n'\\n'\n'When one or more *parameters* have the form *parameter* \"=\"\\n'\n'*expression*, the function is said to have \u201cdefault parameter '\n'values.\u201d\\n'\n'For a parameter with a default value, the corresponding '\n'*argument* may\\n'\n'be omitted from a call, in which case the parameter\u2019s default '\n'value is\\n'\n'substituted. If a parameter has a default value, all following\\n'\n'parameters up until the \u201c\"*\"\u201d must also have a default value \u2014 '\n'this is\\n'\n'a syntactic restriction that is not expressed by the grammar.\\n'\n'\\n'\n'**Default parameter values are evaluated from left to right when '\n'the\\n'\n'function definition is executed.** This means that the '\n'expression is\\n'\n'evaluated once, when the function is defined, and that the same '\n'\u201cpre-\\n'\n'computed\u201d value is used for each call. This is especially '\n'important\\n'\n'to understand when a default parameter value is a mutable '\n'object, such\\n'\n'as a list or a dictionary: if the function modifies the object '\n'(e.g.\\n'\n'by appending an item to a list), the default parameter value is '\n'in\\n'\n'effect modified. This is generally not what was intended. A '\n'way\\n'\n'around this is to use \"None\" as the default, and explicitly test '\n'for\\n'\n'it in the body of the function, e.g.:\\n'\n'\\n'\n' def whats_on_the_telly(penguin=None):\\n'\n' if penguin is None:\\n'\n' penguin = []\\n'\n' penguin.append(\"property of the zoo\")\\n'\n' return penguin\\n'\n'\\n'\n'Function call semantics are described in more detail in section '\n'Calls.\\n'\n'A function call always assigns values to all parameters '\n'mentioned in\\n'\n'the parameter list, either from positional arguments, from '\n'keyword\\n'\n'arguments, or from default values. If the form \u201c\"*identifier\"\u201d '\n'is\\n'\n'present, it is initialized to a tuple receiving any excess '\n'positional\\n'\n'parameters, defaulting to the empty tuple. If the form\\n'\n'\u201c\"**identifier\"\u201d is present, it is initialized to a new ordered\\n'\n'mapping receiving any excess keyword arguments, defaulting to a '\n'new\\n'\n'empty mapping of the same type. Parameters after \u201c\"*\"\u201d or\\n'\n'\u201c\"*identifier\"\u201d are keyword-only parameters and may only be '\n'passed by\\n'\n'keyword arguments. Parameters before \u201c\"/\"\u201d are positional-only\\n'\n'parameters and may only be passed by positional arguments.\\n'\n'\\n'\n'Changed in version 3.8: The \"/\" function parameter syntax may be '\n'used\\n'\n'to indicate positional-only parameters. See **PEP 570** for '\n'details.\\n'\n'\\n'\n'Parameters may have an *annotation* of the form \u201c\": '\n'expression\"\u201d\\n'\n'following the parameter name. Any parameter may have an '\n'annotation,\\n'\n'even those of the form \"*identifier\" or \"**identifier\". '\n'Functions may\\n'\n'have \u201creturn\u201d annotation of the form \u201c\"-> expression\"\u201d after '\n'the\\n'\n'parameter list. These annotations can be any valid Python '\n'expression.\\n'\n'The presence of annotations does not change the semantics of a\\n'\n'function. The annotation values are available as values of a\\n'\n'dictionary keyed by the parameters\u2019 names in the '\n'\"__annotations__\"\\n'\n'attribute of the function object. If the \"annotations\" import '\n'from\\n'\n'\"__future__\" is used, annotations are preserved as strings at '\n'runtime\\n'\n'which enables postponed evaluation. Otherwise, they are '\n'evaluated\\n'\n'when the function definition is executed. In this case '\n'annotations\\n'\n'may be evaluated in a different order than they appear in the '\n'source\\n'\n'code.\\n'\n'\\n'\n'It is also possible to create anonymous functions (functions not '\n'bound\\n'\n'to a name), for immediate use in expressions. This uses lambda\\n'\n'expressions, described in section Lambdas. Note that the '\n'lambda\\n'\n'expression is merely a shorthand for a simplified function '\n'definition;\\n'\n'a function defined in a \u201c\"def\"\u201d statement can be passed around '\n'or\\n'\n'assigned to another name just like a function defined by a '\n'lambda\\n'\n'expression. The \u201c\"def\"\u201d form is actually more powerful since '\n'it\\n'\n'allows the execution of multiple statements and annotations.\\n'\n'\\n'\n'**Programmer\u2019s note:** Functions are first-class objects. A '\n'\u201c\"def\"\u201d\\n'\n'statement executed inside a function definition defines a local\\n'\n'function that can be returned or passed around. Free variables '\n'used\\n'\n'in the nested function can access the local variables of the '\n'function\\n'\n'containing the def. See section Naming and binding for '\n'details.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3107** - Function Annotations\\n'\n' The original specification for function annotations.\\n'\n'\\n'\n' **PEP 484** - Type Hints\\n'\n' Definition of a standard meaning for annotations: type '\n'hints.\\n'\n'\\n'\n' **PEP 526** - Syntax for Variable Annotations\\n'\n' Ability to type hint variable declarations, including '\n'class\\n'\n' variables and instance variables\\n'\n'\\n'\n' **PEP 563** - Postponed Evaluation of Annotations\\n'\n' Support for forward references within annotations by '\n'preserving\\n'\n' annotations in a string form at runtime instead of eager\\n'\n' evaluation.\\n',\n'global':'The \"global\" statement\\n'\n'**********************\\n'\n'\\n'\n' global_stmt ::= \"global\" identifier (\",\" identifier)*\\n'\n'\\n'\n'The \"global\" statement is a declaration which holds for the '\n'entire\\n'\n'current code block. It means that the listed identifiers are to '\n'be\\n'\n'interpreted as globals. It would be impossible to assign to a '\n'global\\n'\n'variable without \"global\", although free variables may refer to\\n'\n'globals without being declared global.\\n'\n'\\n'\n'Names listed in a \"global\" statement must not be used in the same '\n'code\\n'\n'block textually preceding that \"global\" statement.\\n'\n'\\n'\n'Names listed in a \"global\" statement must not be defined as '\n'formal\\n'\n'parameters, or as targets in \"with\" statements or \"except\" '\n'clauses, or\\n'\n'in a \"for\" target list, \"class\" definition, function definition,\\n'\n'\"import\" statement, or variable annotation.\\n'\n'\\n'\n'**CPython implementation detail:** The current implementation does '\n'not\\n'\n'enforce some of these restrictions, but programs should not abuse '\n'this\\n'\n'freedom, as future implementations may enforce them or silently '\n'change\\n'\n'the meaning of the program.\\n'\n'\\n'\n'**Programmer\u2019s note:** \"global\" is a directive to the parser. It\\n'\n'applies only to code parsed at the same time as the \"global\"\\n'\n'statement. In particular, a \"global\" statement contained in a '\n'string\\n'\n'or code object supplied to the built-in \"exec()\" function does '\n'not\\n'\n'affect the code block *containing* the function call, and code\\n'\n'contained in such a string is unaffected by \"global\" statements in '\n'the\\n'\n'code containing the function call. The same applies to the '\n'\"eval()\"\\n'\n'and \"compile()\" functions.\\n',\n'id-classes':'Reserved classes of identifiers\\n'\n'*******************************\\n'\n'\\n'\n'Certain classes of identifiers (besides keywords) have '\n'special\\n'\n'meanings. These classes are identified by the patterns of '\n'leading and\\n'\n'trailing underscore characters:\\n'\n'\\n'\n'\"_*\"\\n'\n' Not imported by \"from module import *\". The special '\n'identifier \"_\"\\n'\n' is used in the interactive interpreter to store the result '\n'of the\\n'\n' last evaluation; it is stored in the \"builtins\" module. '\n'When not\\n'\n' in interactive mode, \"_\" has no special meaning and is not '\n'defined.\\n'\n' See section The import statement.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The name \"_\" is often used in conjunction with\\n'\n' internationalization; refer to the documentation for the\\n'\n' \"gettext\" module for more information on this '\n'convention.\\n'\n'\\n'\n'\"__*__\"\\n'\n' System-defined names, informally known as \u201cdunder\u201d names. '\n'These\\n'\n' names are defined by the interpreter and its '\n'implementation\\n'\n' (including the standard library). Current system names are\\n'\n' discussed in the Special method names section and '\n'elsewhere. More\\n'\n' will likely be defined in future versions of Python. *Any* '\n'use of\\n'\n' \"__*__\" names, in any context, that does not follow '\n'explicitly\\n'\n' documented use, is subject to breakage without warning.\\n'\n'\\n'\n'\"__*\"\\n'\n' Class-private names. Names in this category, when used '\n'within the\\n'\n' context of a class definition, are re-written to use a '\n'mangled form\\n'\n' to help avoid name clashes between \u201cprivate\u201d attributes of '\n'base and\\n'\n' derived classes. See section Identifiers (Names).\\n',\n'identifiers':'Identifiers and keywords\\n'\n'************************\\n'\n'\\n'\n'Identifiers (also referred to as *names*) are described by '\n'the\\n'\n'following lexical definitions.\\n'\n'\\n'\n'The syntax of identifiers in Python is based on the Unicode '\n'standard\\n'\n'annex UAX-31, with elaboration and changes as defined below; '\n'see also\\n'\n'**PEP 3131** for further details.\\n'\n'\\n'\n'Within the ASCII range (U+0001..U+007F), the valid characters '\n'for\\n'\n'identifiers are the same as in Python 2.x: the uppercase and '\n'lowercase\\n'\n'letters \"A\" through \"Z\", the underscore \"_\" and, except for '\n'the first\\n'\n'character, the digits \"0\" through \"9\".\\n'\n'\\n'\n'Python 3.0 introduces additional characters from outside the '\n'ASCII\\n'\n'range (see **PEP 3131**). For these characters, the '\n'classification\\n'\n'uses the version of the Unicode Character Database as '\n'included in the\\n'\n'\"unicodedata\" module.\\n'\n'\\n'\n'Identifiers are unlimited in length. Case is significant.\\n'\n'\\n'\n' identifier ::= xid_start xid_continue*\\n'\n' id_start ::= \\n'\n' id_continue ::= \\n'\n' xid_start ::= \\n'\n' xid_continue ::= \\n'\n'\\n'\n'The Unicode category codes mentioned above stand for:\\n'\n'\\n'\n'* *Lu* - uppercase letters\\n'\n'\\n'\n'* *Ll* - lowercase letters\\n'\n'\\n'\n'* *Lt* - titlecase letters\\n'\n'\\n'\n'* *Lm* - modifier letters\\n'\n'\\n'\n'* *Lo* - other letters\\n'\n'\\n'\n'* *Nl* - letter numbers\\n'\n'\\n'\n'* *Mn* - nonspacing marks\\n'\n'\\n'\n'* *Mc* - spacing combining marks\\n'\n'\\n'\n'* *Nd* - decimal numbers\\n'\n'\\n'\n'* *Pc* - connector punctuations\\n'\n'\\n'\n'* *Other_ID_Start* - explicit list of characters in '\n'PropList.txt to\\n'\n' support backwards compatibility\\n'\n'\\n'\n'* *Other_ID_Continue* - likewise\\n'\n'\\n'\n'All identifiers are converted into the normal form NFKC while '\n'parsing;\\n'\n'comparison of identifiers is based on NFKC.\\n'\n'\\n'\n'A non-normative HTML file listing all valid identifier '\n'characters for\\n'\n'Unicode 4.1 can be found at\\n'\n'https://www.unicode.org/Public/13.0.0/ucd/DerivedCoreProperties.txt\\n'\n'\\n'\n'\\n'\n'Keywords\\n'\n'========\\n'\n'\\n'\n'The following identifiers are used as reserved words, or '\n'*keywords* of\\n'\n'the language, and cannot be used as ordinary identifiers. '\n'They must\\n'\n'be spelled exactly as written here:\\n'\n'\\n'\n' False await else import pass\\n'\n' None break except in raise\\n'\n' True class finally is return\\n'\n' and continue for lambda try\\n'\n' as def from nonlocal while\\n'\n' assert del global not with\\n'\n' async elif if or yield\\n'\n'\\n'\n'\\n'\n'Soft Keywords\\n'\n'=============\\n'\n'\\n'\n'New in version 3.10.\\n'\n'\\n'\n'Some identifiers are only reserved under specific contexts. '\n'These are\\n'\n'known as *soft keywords*. The identifiers \"match\", \"case\" '\n'and \"_\" can\\n'\n'syntactically act as keywords in contexts related to the '\n'pattern\\n'\n'matching statement, but this distinction is done at the '\n'parser level,\\n'\n'not when tokenizing.\\n'\n'\\n'\n'As soft keywords, their use with pattern matching is possible '\n'while\\n'\n'still preserving compatibility with existing code that uses '\n'\"match\",\\n'\n'\"case\" and \"_\" as identifier names.\\n'\n'\\n'\n'\\n'\n'Reserved classes of identifiers\\n'\n'===============================\\n'\n'\\n'\n'Certain classes of identifiers (besides keywords) have '\n'special\\n'\n'meanings. These classes are identified by the patterns of '\n'leading and\\n'\n'trailing underscore characters:\\n'\n'\\n'\n'\"_*\"\\n'\n' Not imported by \"from module import *\". The special '\n'identifier \"_\"\\n'\n' is used in the interactive interpreter to store the result '\n'of the\\n'\n' last evaluation; it is stored in the \"builtins\" module. '\n'When not\\n'\n' in interactive mode, \"_\" has no special meaning and is not '\n'defined.\\n'\n' See section The import statement.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The name \"_\" is often used in conjunction with\\n'\n' internationalization; refer to the documentation for '\n'the\\n'\n' \"gettext\" module for more information on this '\n'convention.\\n'\n'\\n'\n'\"__*__\"\\n'\n' System-defined names, informally known as \u201cdunder\u201d names. '\n'These\\n'\n' names are defined by the interpreter and its '\n'implementation\\n'\n' (including the standard library). Current system names '\n'are\\n'\n' discussed in the Special method names section and '\n'elsewhere. More\\n'\n' will likely be defined in future versions of Python. '\n'*Any* use of\\n'\n' \"__*__\" names, in any context, that does not follow '\n'explicitly\\n'\n' documented use, is subject to breakage without warning.\\n'\n'\\n'\n'\"__*\"\\n'\n' Class-private names. Names in this category, when used '\n'within the\\n'\n' context of a class definition, are re-written to use a '\n'mangled form\\n'\n' to help avoid name clashes between \u201cprivate\u201d attributes of '\n'base and\\n'\n' derived classes. See section Identifiers (Names).\\n',\n'if':'The \"if\" statement\\n'\n'******************\\n'\n'\\n'\n'The \"if\" statement is used for conditional execution:\\n'\n'\\n'\n' if_stmt ::= \"if\" assignment_expression \":\" suite\\n'\n' (\"elif\" assignment_expression \":\" suite)*\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'It selects exactly one of the suites by evaluating the expressions '\n'one\\n'\n'by one until one is found to be true (see section Boolean operations\\n'\n'for the definition of true and false); then that suite is executed\\n'\n'(and no other part of the \"if\" statement is executed or evaluated).\\n'\n'If all expressions are false, the suite of the \"else\" clause, if\\n'\n'present, is executed.\\n',\n'imaginary':'Imaginary literals\\n'\n'******************\\n'\n'\\n'\n'Imaginary literals are described by the following lexical '\n'definitions:\\n'\n'\\n'\n' imagnumber ::= (floatnumber | digitpart) (\"j\" | \"J\")\\n'\n'\\n'\n'An imaginary literal yields a complex number with a real part '\n'of 0.0.\\n'\n'Complex numbers are represented as a pair of floating point '\n'numbers\\n'\n'and have the same restrictions on their range. To create a '\n'complex\\n'\n'number with a nonzero real part, add a floating point number to '\n'it,\\n'\n'e.g., \"(3+4j)\". Some examples of imaginary literals:\\n'\n'\\n'\n' 3.14j 10.j 10j .001j 1e100j 3.14e-10j '\n'3.14_15_93j\\n',\n'import':'The \"import\" statement\\n'\n'**********************\\n'\n'\\n'\n' import_stmt ::= \"import\" module [\"as\" identifier] (\",\" '\n'module [\"as\" identifier])*\\n'\n' | \"from\" relative_module \"import\" identifier '\n'[\"as\" identifier]\\n'\n' (\",\" identifier [\"as\" identifier])*\\n'\n' | \"from\" relative_module \"import\" \"(\" '\n'identifier [\"as\" identifier]\\n'\n' (\",\" identifier [\"as\" identifier])* [\",\"] \")\"\\n'\n' | \"from\" relative_module \"import\" \"*\"\\n'\n' module ::= (identifier \".\")* identifier\\n'\n' relative_module ::= \".\"* module | \".\"+\\n'\n'\\n'\n'The basic import statement (no \"from\" clause) is executed in two\\n'\n'steps:\\n'\n'\\n'\n'1. find a module, loading and initializing it if necessary\\n'\n'\\n'\n'2. define a name or names in the local namespace for the scope '\n'where\\n'\n' the \"import\" statement occurs.\\n'\n'\\n'\n'When the statement contains multiple clauses (separated by commas) '\n'the\\n'\n'two steps are carried out separately for each clause, just as '\n'though\\n'\n'the clauses had been separated out into individual import '\n'statements.\\n'\n'\\n'\n'The details of the first step, finding and loading modules are\\n'\n'described in greater detail in the section on the import system, '\n'which\\n'\n'also describes the various types of packages and modules that can '\n'be\\n'\n'imported, as well as all the hooks that can be used to customize '\n'the\\n'\n'import system. Note that failures in this step may indicate '\n'either\\n'\n'that the module could not be located, *or* that an error occurred\\n'\n'while initializing the module, which includes execution of the\\n'\n'module\u2019s code.\\n'\n'\\n'\n'If the requested module is retrieved successfully, it will be '\n'made\\n'\n'available in the local namespace in one of three ways:\\n'\n'\\n'\n'* If the module name is followed by \"as\", then the name following '\n'\"as\"\\n'\n' is bound directly to the imported module.\\n'\n'\\n'\n'* If no other name is specified, and the module being imported is '\n'a\\n'\n' top level module, the module\u2019s name is bound in the local '\n'namespace\\n'\n' as a reference to the imported module\\n'\n'\\n'\n'* If the module being imported is *not* a top level module, then '\n'the\\n'\n' name of the top level package that contains the module is bound '\n'in\\n'\n' the local namespace as a reference to the top level package. '\n'The\\n'\n' imported module must be accessed using its full qualified name\\n'\n' rather than directly\\n'\n'\\n'\n'The \"from\" form uses a slightly more complex process:\\n'\n'\\n'\n'1. find the module specified in the \"from\" clause, loading and\\n'\n' initializing it if necessary;\\n'\n'\\n'\n'2. for each of the identifiers specified in the \"import\" clauses:\\n'\n'\\n'\n' 1. check if the imported module has an attribute by that name\\n'\n'\\n'\n' 2. if not, attempt to import a submodule with that name and '\n'then\\n'\n' check the imported module again for that attribute\\n'\n'\\n'\n' 3. if the attribute is not found, \"ImportError\" is raised.\\n'\n'\\n'\n' 4. otherwise, a reference to that value is stored in the local\\n'\n' namespace, using the name in the \"as\" clause if it is '\n'present,\\n'\n' otherwise using the attribute name\\n'\n'\\n'\n'Examples:\\n'\n'\\n'\n' import foo # foo imported and bound locally\\n'\n' import foo.bar.baz # foo.bar.baz imported, foo bound '\n'locally\\n'\n' import foo.bar.baz as fbb # foo.bar.baz imported and bound as '\n'fbb\\n'\n' from foo.bar import baz # foo.bar.baz imported and bound as '\n'baz\\n'\n' from foo import attr # foo imported and foo.attr bound as '\n'attr\\n'\n'\\n'\n'If the list of identifiers is replaced by a star (\"\\'*\\'\"), all '\n'public\\n'\n'names defined in the module are bound in the local namespace for '\n'the\\n'\n'scope where the \"import\" statement occurs.\\n'\n'\\n'\n'The *public names* defined by a module are determined by checking '\n'the\\n'\n'module\u2019s namespace for a variable named \"__all__\"; if defined, it '\n'must\\n'\n'be a sequence of strings which are names defined or imported by '\n'that\\n'\n'module. The names given in \"__all__\" are all considered public '\n'and\\n'\n'are required to exist. If \"__all__\" is not defined, the set of '\n'public\\n'\n'names includes all names found in the module\u2019s namespace which do '\n'not\\n'\n'begin with an underscore character (\"\\'_\\'\"). \"__all__\" should '\n'contain\\n'\n'the entire public API. It is intended to avoid accidentally '\n'exporting\\n'\n'items that are not part of the API (such as library modules which '\n'were\\n'\n'imported and used within the module).\\n'\n'\\n'\n'The wild card form of import \u2014 \"from module import *\" \u2014 is only\\n'\n'allowed at the module level. Attempting to use it in class or\\n'\n'function definitions will raise a \"SyntaxError\".\\n'\n'\\n'\n'When specifying what module to import you do not have to specify '\n'the\\n'\n'absolute name of the module. When a module or package is '\n'contained\\n'\n'within another package it is possible to make a relative import '\n'within\\n'\n'the same top package without having to mention the package name. '\n'By\\n'\n'using leading dots in the specified module or package after \"from\" '\n'you\\n'\n'can specify how high to traverse up the current package hierarchy\\n'\n'without specifying exact names. One leading dot means the current\\n'\n'package where the module making the import exists. Two dots means '\n'up\\n'\n'one package level. Three dots is up two levels, etc. So if you '\n'execute\\n'\n'\"from . import mod\" from a module in the \"pkg\" package then you '\n'will\\n'\n'end up importing \"pkg.mod\". If you execute \"from ..subpkg2 import '\n'mod\"\\n'\n'from within \"pkg.subpkg1\" you will import \"pkg.subpkg2.mod\". The\\n'\n'specification for relative imports is contained in the Package\\n'\n'Relative Imports section.\\n'\n'\\n'\n'\"importlib.import_module()\" is provided to support applications '\n'that\\n'\n'determine dynamically the modules to be loaded.\\n'\n'\\n'\n'Raises an auditing event \"import\" with arguments \"module\", '\n'\"filename\",\\n'\n'\"sys.path\", \"sys.meta_path\", \"sys.path_hooks\".\\n'\n'\\n'\n'\\n'\n'Future statements\\n'\n'=================\\n'\n'\\n'\n'A *future statement* is a directive to the compiler that a '\n'particular\\n'\n'module should be compiled using syntax or semantics that will be\\n'\n'available in a specified future release of Python where the '\n'feature\\n'\n'becomes standard.\\n'\n'\\n'\n'The future statement is intended to ease migration to future '\n'versions\\n'\n'of Python that introduce incompatible changes to the language. '\n'It\\n'\n'allows use of the new features on a per-module basis before the\\n'\n'release in which the feature becomes standard.\\n'\n'\\n'\n' future_stmt ::= \"from\" \"__future__\" \"import\" feature [\"as\" '\n'identifier]\\n'\n' (\",\" feature [\"as\" identifier])*\\n'\n' | \"from\" \"__future__\" \"import\" \"(\" feature '\n'[\"as\" identifier]\\n'\n' (\",\" feature [\"as\" identifier])* [\",\"] \")\"\\n'\n' feature ::= identifier\\n'\n'\\n'\n'A future statement must appear near the top of the module. The '\n'only\\n'\n'lines that can appear before a future statement are:\\n'\n'\\n'\n'* the module docstring (if any),\\n'\n'\\n'\n'* comments,\\n'\n'\\n'\n'* blank lines, and\\n'\n'\\n'\n'* other future statements.\\n'\n'\\n'\n'The only feature that requires using the future statement is\\n'\n'\"annotations\" (see **PEP 563**).\\n'\n'\\n'\n'All historical features enabled by the future statement are still\\n'\n'recognized by Python 3. The list includes \"absolute_import\",\\n'\n'\"division\", \"generators\", \"generator_stop\", \"unicode_literals\",\\n'\n'\"print_function\", \"nested_scopes\" and \"with_statement\". They are '\n'all\\n'\n'redundant because they are always enabled, and only kept for '\n'backwards\\n'\n'compatibility.\\n'\n'\\n'\n'A future statement is recognized and treated specially at compile\\n'\n'time: Changes to the semantics of core constructs are often\\n'\n'implemented by generating different code. It may even be the '\n'case\\n'\n'that a new feature introduces new incompatible syntax (such as a '\n'new\\n'\n'reserved word), in which case the compiler may need to parse the\\n'\n'module differently. Such decisions cannot be pushed off until\\n'\n'runtime.\\n'\n'\\n'\n'For any given release, the compiler knows which feature names '\n'have\\n'\n'been defined, and raises a compile-time error if a future '\n'statement\\n'\n'contains a feature not known to it.\\n'\n'\\n'\n'The direct runtime semantics are the same as for any import '\n'statement:\\n'\n'there is a standard module \"__future__\", described later, and it '\n'will\\n'\n'be imported in the usual way at the time the future statement is\\n'\n'executed.\\n'\n'\\n'\n'The interesting runtime semantics depend on the specific feature\\n'\n'enabled by the future statement.\\n'\n'\\n'\n'Note that there is nothing special about the statement:\\n'\n'\\n'\n' import __future__ [as name]\\n'\n'\\n'\n'That is not a future statement; it\u2019s an ordinary import statement '\n'with\\n'\n'no special semantics or syntax restrictions.\\n'\n'\\n'\n'Code compiled by calls to the built-in functions \"exec()\" and\\n'\n'\"compile()\" that occur in a module \"M\" containing a future '\n'statement\\n'\n'will, by default, use the new syntax or semantics associated with '\n'the\\n'\n'future statement. This can be controlled by optional arguments '\n'to\\n'\n'\"compile()\" \u2014 see the documentation of that function for details.\\n'\n'\\n'\n'A future statement typed at an interactive interpreter prompt '\n'will\\n'\n'take effect for the rest of the interpreter session. If an\\n'\n'interpreter is started with the \"-i\" option, is passed a script '\n'name\\n'\n'to execute, and the script includes a future statement, it will be '\n'in\\n'\n'effect in the interactive session started after the script is\\n'\n'executed.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 236** - Back to the __future__\\n'\n' The original proposal for the __future__ mechanism.\\n',\n'in':'Membership test operations\\n'\n'**************************\\n'\n'\\n'\n'The operators \"in\" and \"not in\" test for membership. \"x in s\"\\n'\n'evaluates to \"True\" if *x* is a member of *s*, and \"False\" otherwise.\\n'\n'\"x not in s\" returns the negation of \"x in s\". All built-in '\n'sequences\\n'\n'and set types support this as well as dictionary, for which \"in\" '\n'tests\\n'\n'whether the dictionary has a given key. For container types such as\\n'\n'list, tuple, set, frozenset, dict, or collections.deque, the\\n'\n'expression \"x in y\" is equivalent to \"any(x is e or x == e for e in\\n'\n'y)\".\\n'\n'\\n'\n'For the string and bytes types, \"x in y\" is \"True\" if and only if *x*\\n'\n'is a substring of *y*. An equivalent test is \"y.find(x) != -1\".\\n'\n'Empty strings are always considered to be a substring of any other\\n'\n'string, so \"\"\" in \"abc\"\" will return \"True\".\\n'\n'\\n'\n'For user-defined classes which define the \"__contains__()\" method, \"x\\n'\n'in y\" returns \"True\" if \"y.__contains__(x)\" returns a true value, and\\n'\n'\"False\" otherwise.\\n'\n'\\n'\n'For user-defined classes which do not define \"__contains__()\" but do\\n'\n'define \"__iter__()\", \"x in y\" is \"True\" if some value \"z\", for which\\n'\n'the expression \"x is z or x == z\" is true, is produced while '\n'iterating\\n'\n'over \"y\". If an exception is raised during the iteration, it is as if\\n'\n'\"in\" raised that exception.\\n'\n'\\n'\n'Lastly, the old-style iteration protocol is tried: if a class defines\\n'\n'\"__getitem__()\", \"x in y\" is \"True\" if and only if there is a non-\\n'\n'negative integer index *i* such that \"x is y[i] or x == y[i]\", and no\\n'\n'lower integer index raises the \"IndexError\" exception. (If any other\\n'\n'exception is raised, it is as if \"in\" raised that exception).\\n'\n'\\n'\n'The operator \"not in\" is defined to have the inverse truth value of\\n'\n'\"in\".\\n',\n'integers':'Integer literals\\n'\n'****************\\n'\n'\\n'\n'Integer literals are described by the following lexical '\n'definitions:\\n'\n'\\n'\n' integer ::= decinteger | bininteger | octinteger | '\n'hexinteger\\n'\n' decinteger ::= nonzerodigit ([\"_\"] digit)* | \"0\"+ ([\"_\"] '\n'\"0\")*\\n'\n' bininteger ::= \"0\" (\"b\" | \"B\") ([\"_\"] bindigit)+\\n'\n' octinteger ::= \"0\" (\"o\" | \"O\") ([\"_\"] octdigit)+\\n'\n' hexinteger ::= \"0\" (\"x\" | \"X\") ([\"_\"] hexdigit)+\\n'\n' nonzerodigit ::= \"1\"...\"9\"\\n'\n' digit ::= \"0\"...\"9\"\\n'\n' bindigit ::= \"0\" | \"1\"\\n'\n' octdigit ::= \"0\"...\"7\"\\n'\n' hexdigit ::= digit | \"a\"...\"f\" | \"A\"...\"F\"\\n'\n'\\n'\n'There is no limit for the length of integer literals apart from '\n'what\\n'\n'can be stored in available memory.\\n'\n'\\n'\n'Underscores are ignored for determining the numeric value of '\n'the\\n'\n'literal. They can be used to group digits for enhanced '\n'readability.\\n'\n'One underscore can occur between digits, and after base '\n'specifiers\\n'\n'like \"0x\".\\n'\n'\\n'\n'Note that leading zeros in a non-zero decimal number are not '\n'allowed.\\n'\n'This is for disambiguation with C-style octal literals, which '\n'Python\\n'\n'used before version 3.0.\\n'\n'\\n'\n'Some examples of integer literals:\\n'\n'\\n'\n' 7 2147483647 0o177 0b100110111\\n'\n' 3 79228162514264337593543950336 0o377 0xdeadbeef\\n'\n' 100_000_000_000 0b_1110_0101\\n'\n'\\n'\n'Changed in version 3.6: Underscores are now allowed for '\n'grouping\\n'\n'purposes in literals.\\n',\n'lambda':'Lambdas\\n'\n'*******\\n'\n'\\n'\n' lambda_expr ::= \"lambda\" [parameter_list] \":\" expression\\n'\n'\\n'\n'Lambda expressions (sometimes called lambda forms) are used to '\n'create\\n'\n'anonymous functions. The expression \"lambda parameters: '\n'expression\"\\n'\n'yields a function object. The unnamed object behaves like a '\n'function\\n'\n'object defined with:\\n'\n'\\n'\n' def (parameters):\\n'\n' return expression\\n'\n'\\n'\n'See section Function definitions for the syntax of parameter '\n'lists.\\n'\n'Note that functions created with lambda expressions cannot '\n'contain\\n'\n'statements or annotations.\\n',\n'lists':'List displays\\n'\n'*************\\n'\n'\\n'\n'A list display is a possibly empty series of expressions enclosed '\n'in\\n'\n'square brackets:\\n'\n'\\n'\n' list_display ::= \"[\" [starred_list | comprehension] \"]\"\\n'\n'\\n'\n'A list display yields a new list object, the contents being '\n'specified\\n'\n'by either a list of expressions or a comprehension. When a comma-\\n'\n'separated list of expressions is supplied, its elements are '\n'evaluated\\n'\n'from left to right and placed into the list object in that order.\\n'\n'When a comprehension is supplied, the list is constructed from the\\n'\n'elements resulting from the comprehension.\\n',\n'naming':'Naming and binding\\n'\n'******************\\n'\n'\\n'\n'\\n'\n'Binding of names\\n'\n'================\\n'\n'\\n'\n'*Names* refer to objects. Names are introduced by name binding\\n'\n'operations.\\n'\n'\\n'\n'The following constructs bind names: formal parameters to '\n'functions,\\n'\n'\"import\" statements, class and function definitions (these bind '\n'the\\n'\n'class or function name in the defining block), and targets that '\n'are\\n'\n'identifiers if occurring in an assignment, \"for\" loop header, or '\n'after\\n'\n'\"as\" in a \"with\" statement or \"except\" clause. The \"import\" '\n'statement\\n'\n'of the form \"from ... import *\" binds all names defined in the\\n'\n'imported module, except those beginning with an underscore. This '\n'form\\n'\n'may only be used at the module level.\\n'\n'\\n'\n'A target occurring in a \"del\" statement is also considered bound '\n'for\\n'\n'this purpose (though the actual semantics are to unbind the '\n'name).\\n'\n'\\n'\n'Each assignment or import statement occurs within a block defined '\n'by a\\n'\n'class or function definition or at the module level (the '\n'top-level\\n'\n'code block).\\n'\n'\\n'\n'If a name is bound in a block, it is a local variable of that '\n'block,\\n'\n'unless declared as \"nonlocal\" or \"global\". If a name is bound at '\n'the\\n'\n'module level, it is a global variable. (The variables of the '\n'module\\n'\n'code block are local and global.) If a variable is used in a '\n'code\\n'\n'block but not defined there, it is a *free variable*.\\n'\n'\\n'\n'Each occurrence of a name in the program text refers to the '\n'*binding*\\n'\n'of that name established by the following name resolution rules.\\n'\n'\\n'\n'\\n'\n'Resolution of names\\n'\n'===================\\n'\n'\\n'\n'A *scope* defines the visibility of a name within a block. If a '\n'local\\n'\n'variable is defined in a block, its scope includes that block. If '\n'the\\n'\n'definition occurs in a function block, the scope extends to any '\n'blocks\\n'\n'contained within the defining one, unless a contained block '\n'introduces\\n'\n'a different binding for the name.\\n'\n'\\n'\n'When a name is used in a code block, it is resolved using the '\n'nearest\\n'\n'enclosing scope. The set of all such scopes visible to a code '\n'block\\n'\n'is called the block\u2019s *environment*.\\n'\n'\\n'\n'When a name is not found at all, a \"NameError\" exception is '\n'raised. If\\n'\n'the current scope is a function scope, and the name refers to a '\n'local\\n'\n'variable that has not yet been bound to a value at the point where '\n'the\\n'\n'name is used, an \"UnboundLocalError\" exception is raised.\\n'\n'\"UnboundLocalError\" is a subclass of \"NameError\".\\n'\n'\\n'\n'If a name binding operation occurs anywhere within a code block, '\n'all\\n'\n'uses of the name within the block are treated as references to '\n'the\\n'\n'current block. This can lead to errors when a name is used within '\n'a\\n'\n'block before it is bound. This rule is subtle. Python lacks\\n'\n'declarations and allows name binding operations to occur anywhere\\n'\n'within a code block. The local variables of a code block can be\\n'\n'determined by scanning the entire text of the block for name '\n'binding\\n'\n'operations.\\n'\n'\\n'\n'If the \"global\" statement occurs within a block, all uses of the '\n'name\\n'\n'specified in the statement refer to the binding of that name in '\n'the\\n'\n'top-level namespace. Names are resolved in the top-level '\n'namespace by\\n'\n'searching the global namespace, i.e. the namespace of the module\\n'\n'containing the code block, and the builtins namespace, the '\n'namespace\\n'\n'of the module \"builtins\". The global namespace is searched '\n'first. If\\n'\n'the name is not found there, the builtins namespace is searched. '\n'The\\n'\n'\"global\" statement must precede all uses of the name.\\n'\n'\\n'\n'The \"global\" statement has the same scope as a name binding '\n'operation\\n'\n'in the same block. If the nearest enclosing scope for a free '\n'variable\\n'\n'contains a global statement, the free variable is treated as a '\n'global.\\n'\n'\\n'\n'The \"nonlocal\" statement causes corresponding names to refer to\\n'\n'previously bound variables in the nearest enclosing function '\n'scope.\\n'\n'\"SyntaxError\" is raised at compile time if the given name does '\n'not\\n'\n'exist in any enclosing function scope.\\n'\n'\\n'\n'The namespace for a module is automatically created the first time '\n'a\\n'\n'module is imported. The main module for a script is always '\n'called\\n'\n'\"__main__\".\\n'\n'\\n'\n'Class definition blocks and arguments to \"exec()\" and \"eval()\" '\n'are\\n'\n'special in the context of name resolution. A class definition is '\n'an\\n'\n'executable statement that may use and define names. These '\n'references\\n'\n'follow the normal rules for name resolution with an exception '\n'that\\n'\n'unbound local variables are looked up in the global namespace. '\n'The\\n'\n'namespace of the class definition becomes the attribute dictionary '\n'of\\n'\n'the class. The scope of names defined in a class block is limited '\n'to\\n'\n'the class block; it does not extend to the code blocks of methods '\n'\u2013\\n'\n'this includes comprehensions and generator expressions since they '\n'are\\n'\n'implemented using a function scope. This means that the '\n'following\\n'\n'will fail:\\n'\n'\\n'\n' class A:\\n'\n' a = 42\\n'\n' b = list(a + i for i in range(10))\\n'\n'\\n'\n'\\n'\n'Builtins and restricted execution\\n'\n'=================================\\n'\n'\\n'\n'**CPython implementation detail:** Users should not touch\\n'\n'\"__builtins__\"; it is strictly an implementation detail. Users\\n'\n'wanting to override values in the builtins namespace should '\n'\"import\"\\n'\n'the \"builtins\" module and modify its attributes appropriately.\\n'\n'\\n'\n'The builtins namespace associated with the execution of a code '\n'block\\n'\n'is actually found by looking up the name \"__builtins__\" in its '\n'global\\n'\n'namespace; this should be a dictionary or a module (in the latter '\n'case\\n'\n'the module\u2019s dictionary is used). By default, when in the '\n'\"__main__\"\\n'\n'module, \"__builtins__\" is the built-in module \"builtins\"; when in '\n'any\\n'\n'other module, \"__builtins__\" is an alias for the dictionary of '\n'the\\n'\n'\"builtins\" module itself.\\n'\n'\\n'\n'\\n'\n'Interaction with dynamic features\\n'\n'=================================\\n'\n'\\n'\n'Name resolution of free variables occurs at runtime, not at '\n'compile\\n'\n'time. This means that the following code will print 42:\\n'\n'\\n'\n' i = 10\\n'\n' def f():\\n'\n' print(i)\\n'\n' i = 42\\n'\n' f()\\n'\n'\\n'\n'The \"eval()\" and \"exec()\" functions do not have access to the '\n'full\\n'\n'environment for resolving names. Names may be resolved in the '\n'local\\n'\n'and global namespaces of the caller. Free variables are not '\n'resolved\\n'\n'in the nearest enclosing namespace, but in the global namespace. '\n'[1]\\n'\n'The \"exec()\" and \"eval()\" functions have optional arguments to\\n'\n'override the global and local namespace. If only one namespace '\n'is\\n'\n'specified, it is used for both.\\n',\n'nonlocal':'The \"nonlocal\" statement\\n'\n'************************\\n'\n'\\n'\n' nonlocal_stmt ::= \"nonlocal\" identifier (\",\" identifier)*\\n'\n'\\n'\n'The \"nonlocal\" statement causes the listed identifiers to refer '\n'to\\n'\n'previously bound variables in the nearest enclosing scope '\n'excluding\\n'\n'globals. This is important because the default behavior for '\n'binding is\\n'\n'to search the local namespace first. The statement allows\\n'\n'encapsulated code to rebind variables outside of the local '\n'scope\\n'\n'besides the global (module) scope.\\n'\n'\\n'\n'Names listed in a \"nonlocal\" statement, unlike those listed in '\n'a\\n'\n'\"global\" statement, must refer to pre-existing bindings in an\\n'\n'enclosing scope (the scope in which a new binding should be '\n'created\\n'\n'cannot be determined unambiguously).\\n'\n'\\n'\n'Names listed in a \"nonlocal\" statement must not collide with '\n'pre-\\n'\n'existing bindings in the local scope.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3104** - Access to Names in Outer Scopes\\n'\n' The specification for the \"nonlocal\" statement.\\n',\n'numbers':'Numeric literals\\n'\n'****************\\n'\n'\\n'\n'There are three types of numeric literals: integers, floating '\n'point\\n'\n'numbers, and imaginary numbers. There are no complex literals\\n'\n'(complex numbers can be formed by adding a real number and an\\n'\n'imaginary number).\\n'\n'\\n'\n'Note that numeric literals do not include a sign; a phrase like '\n'\"-1\"\\n'\n'is actually an expression composed of the unary operator \u2018\"-\"\u2019 '\n'and the\\n'\n'literal \"1\".\\n',\n'numeric-types':'Emulating numeric types\\n'\n'***********************\\n'\n'\\n'\n'The following methods can be defined to emulate numeric '\n'objects.\\n'\n'Methods corresponding to operations that are not supported '\n'by the\\n'\n'particular kind of number implemented (e.g., bitwise '\n'operations for\\n'\n'non-integral numbers) should be left undefined.\\n'\n'\\n'\n'object.__add__(self, other)\\n'\n'object.__sub__(self, other)\\n'\n'object.__mul__(self, other)\\n'\n'object.__matmul__(self, other)\\n'\n'object.__truediv__(self, other)\\n'\n'object.__floordiv__(self, other)\\n'\n'object.__mod__(self, other)\\n'\n'object.__divmod__(self, other)\\n'\n'object.__pow__(self, other[, modulo])\\n'\n'object.__lshift__(self, other)\\n'\n'object.__rshift__(self, other)\\n'\n'object.__and__(self, other)\\n'\n'object.__xor__(self, other)\\n'\n'object.__or__(self, other)\\n'\n'\\n'\n' These methods are called to implement the binary '\n'arithmetic\\n'\n' operations (\"+\", \"-\", \"*\", \"@\", \"/\", \"//\", \"%\", '\n'\"divmod()\",\\n'\n' \"pow()\", \"**\", \"<<\", \">>\", \"&\", \"^\", \"|\"). For '\n'instance, to\\n'\n' evaluate the expression \"x + y\", where *x* is an '\n'instance of a\\n'\n' class that has an \"__add__()\" method, \"x.__add__(y)\" is '\n'called.\\n'\n' The \"__divmod__()\" method should be the equivalent to '\n'using\\n'\n' \"__floordiv__()\" and \"__mod__()\"; it should not be '\n'related to\\n'\n' \"__truediv__()\". Note that \"__pow__()\" should be '\n'defined to accept\\n'\n' an optional third argument if the ternary version of the '\n'built-in\\n'\n' \"pow()\" function is to be supported.\\n'\n'\\n'\n' If one of those methods does not support the operation '\n'with the\\n'\n' supplied arguments, it should return \"NotImplemented\".\\n'\n'\\n'\n'object.__radd__(self, other)\\n'\n'object.__rsub__(self, other)\\n'\n'object.__rmul__(self, other)\\n'\n'object.__rmatmul__(self, other)\\n'\n'object.__rtruediv__(self, other)\\n'\n'object.__rfloordiv__(self, other)\\n'\n'object.__rmod__(self, other)\\n'\n'object.__rdivmod__(self, other)\\n'\n'object.__rpow__(self, other[, modulo])\\n'\n'object.__rlshift__(self, other)\\n'\n'object.__rrshift__(self, other)\\n'\n'object.__rand__(self, other)\\n'\n'object.__rxor__(self, other)\\n'\n'object.__ror__(self, other)\\n'\n'\\n'\n' These methods are called to implement the binary '\n'arithmetic\\n'\n' operations (\"+\", \"-\", \"*\", \"@\", \"/\", \"//\", \"%\", '\n'\"divmod()\",\\n'\n' \"pow()\", \"**\", \"<<\", \">>\", \"&\", \"^\", \"|\") with reflected '\n'(swapped)\\n'\n' operands. These functions are only called if the left '\n'operand does\\n'\n' not support the corresponding operation [3] and the '\n'operands are of\\n'\n' different types. [4] For instance, to evaluate the '\n'expression \"x -\\n'\n' y\", where *y* is an instance of a class that has an '\n'\"__rsub__()\"\\n'\n' method, \"y.__rsub__(x)\" is called if \"x.__sub__(y)\" '\n'returns\\n'\n' *NotImplemented*.\\n'\n'\\n'\n' Note that ternary \"pow()\" will not try calling '\n'\"__rpow__()\" (the\\n'\n' coercion rules would become too complicated).\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' If the right operand\u2019s type is a subclass of the left '\n'operand\u2019s\\n'\n' type and that subclass provides a different '\n'implementation of the\\n'\n' reflected method for the operation, this method will '\n'be called\\n'\n' before the left operand\u2019s non-reflected method. This '\n'behavior\\n'\n' allows subclasses to override their ancestors\u2019 '\n'operations.\\n'\n'\\n'\n'object.__iadd__(self, other)\\n'\n'object.__isub__(self, other)\\n'\n'object.__imul__(self, other)\\n'\n'object.__imatmul__(self, other)\\n'\n'object.__itruediv__(self, other)\\n'\n'object.__ifloordiv__(self, other)\\n'\n'object.__imod__(self, other)\\n'\n'object.__ipow__(self, other[, modulo])\\n'\n'object.__ilshift__(self, other)\\n'\n'object.__irshift__(self, other)\\n'\n'object.__iand__(self, other)\\n'\n'object.__ixor__(self, other)\\n'\n'object.__ior__(self, other)\\n'\n'\\n'\n' These methods are called to implement the augmented '\n'arithmetic\\n'\n' assignments (\"+=\", \"-=\", \"*=\", \"@=\", \"/=\", \"//=\", \"%=\", '\n'\"**=\",\\n'\n' \"<<=\", \">>=\", \"&=\", \"^=\", \"|=\"). These methods should '\n'attempt to\\n'\n' do the operation in-place (modifying *self*) and return '\n'the result\\n'\n' (which could be, but does not have to be, *self*). If a '\n'specific\\n'\n' method is not defined, the augmented assignment falls '\n'back to the\\n'\n' normal methods. For instance, if *x* is an instance of '\n'a class\\n'\n' with an \"__iadd__()\" method, \"x += y\" is equivalent to '\n'\"x =\\n'\n' x.__iadd__(y)\" . Otherwise, \"x.__add__(y)\" and '\n'\"y.__radd__(x)\" are\\n'\n' considered, as with the evaluation of \"x + y\". In '\n'certain\\n'\n' situations, augmented assignment can result in '\n'unexpected errors\\n'\n' (see Why does a_tuple[i] += [\u2018item\u2019] raise an exception '\n'when the\\n'\n' addition works?), but this behavior is in fact part of '\n'the data\\n'\n' model.\\n'\n'\\n'\n'object.__neg__(self)\\n'\n'object.__pos__(self)\\n'\n'object.__abs__(self)\\n'\n'object.__invert__(self)\\n'\n'\\n'\n' Called to implement the unary arithmetic operations '\n'(\"-\", \"+\",\\n'\n' \"abs()\" and \"~\").\\n'\n'\\n'\n'object.__complex__(self)\\n'\n'object.__int__(self)\\n'\n'object.__float__(self)\\n'\n'\\n'\n' Called to implement the built-in functions \"complex()\", '\n'\"int()\" and\\n'\n' \"float()\". Should return a value of the appropriate '\n'type.\\n'\n'\\n'\n'object.__index__(self)\\n'\n'\\n'\n' Called to implement \"operator.index()\", and whenever '\n'Python needs\\n'\n' to losslessly convert the numeric object to an integer '\n'object (such\\n'\n' as in slicing, or in the built-in \"bin()\", \"hex()\" and '\n'\"oct()\"\\n'\n' functions). Presence of this method indicates that the '\n'numeric\\n'\n' object is an integer type. Must return an integer.\\n'\n'\\n'\n' If \"__int__()\", \"__float__()\" and \"__complex__()\" are '\n'not defined\\n'\n' then corresponding built-in functions \"int()\", \"float()\" '\n'and\\n'\n' \"complex()\" fall back to \"__index__()\".\\n'\n'\\n'\n'object.__round__(self[, ndigits])\\n'\n'object.__trunc__(self)\\n'\n'object.__floor__(self)\\n'\n'object.__ceil__(self)\\n'\n'\\n'\n' Called to implement the built-in function \"round()\" and '\n'\"math\"\\n'\n' functions \"trunc()\", \"floor()\" and \"ceil()\". Unless '\n'*ndigits* is\\n'\n' passed to \"__round__()\" all these methods should return '\n'the value\\n'\n' of the object truncated to an \"Integral\" (typically an '\n'\"int\").\\n'\n'\\n'\n' If \"__int__()\" is not defined then the built-in function '\n'\"int()\"\\n'\n' falls back to \"__trunc__()\".\\n',\n'objects':'Objects, values and types\\n'\n'*************************\\n'\n'\\n'\n'*Objects* are Python\u2019s abstraction for data. All data in a '\n'Python\\n'\n'program is represented by objects or by relations between '\n'objects. (In\\n'\n'a sense, and in conformance to Von Neumann\u2019s model of a \u201cstored\\n'\n'program computer\u201d, code is also represented by objects.)\\n'\n'\\n'\n'Every object has an identity, a type and a value. An object\u2019s\\n'\n'*identity* never changes once it has been created; you may think '\n'of it\\n'\n'as the object\u2019s address in memory. The \u2018\"is\"\u2019 operator compares '\n'the\\n'\n'identity of two objects; the \"id()\" function returns an integer\\n'\n'representing its identity.\\n'\n'\\n'\n'**CPython implementation detail:** For CPython, \"id(x)\" is the '\n'memory\\n'\n'address where \"x\" is stored.\\n'\n'\\n'\n'An object\u2019s type determines the operations that the object '\n'supports\\n'\n'(e.g., \u201cdoes it have a length?\u201d) and also defines the possible '\n'values\\n'\n'for objects of that type. The \"type()\" function returns an '\n'object\u2019s\\n'\n'type (which is an object itself). Like its identity, an '\n'object\u2019s\\n'\n'*type* is also unchangeable. [1]\\n'\n'\\n'\n'The *value* of some objects can change. Objects whose value can\\n'\n'change are said to be *mutable*; objects whose value is '\n'unchangeable\\n'\n'once they are created are called *immutable*. (The value of an\\n'\n'immutable container object that contains a reference to a '\n'mutable\\n'\n'object can change when the latter\u2019s value is changed; however '\n'the\\n'\n'container is still considered immutable, because the collection '\n'of\\n'\n'objects it contains cannot be changed. So, immutability is not\\n'\n'strictly the same as having an unchangeable value, it is more '\n'subtle.)\\n'\n'An object\u2019s mutability is determined by its type; for instance,\\n'\n'numbers, strings and tuples are immutable, while dictionaries '\n'and\\n'\n'lists are mutable.\\n'\n'\\n'\n'Objects are never explicitly destroyed; however, when they '\n'become\\n'\n'unreachable they may be garbage-collected. An implementation is\\n'\n'allowed to postpone garbage collection or omit it altogether \u2014 it '\n'is a\\n'\n'matter of implementation quality how garbage collection is\\n'\n'implemented, as long as no objects are collected that are still\\n'\n'reachable.\\n'\n'\\n'\n'**CPython implementation detail:** CPython currently uses a '\n'reference-\\n'\n'counting scheme with (optional) delayed detection of cyclically '\n'linked\\n'\n'garbage, which collects most objects as soon as they become\\n'\n'unreachable, but is not guaranteed to collect garbage containing\\n'\n'circular references. See the documentation of the \"gc\" module '\n'for\\n'\n'information on controlling the collection of cyclic garbage. '\n'Other\\n'\n'implementations act differently and CPython may change. Do not '\n'depend\\n'\n'on immediate finalization of objects when they become unreachable '\n'(so\\n'\n'you should always close files explicitly).\\n'\n'\\n'\n'Note that the use of the implementation\u2019s tracing or debugging\\n'\n'facilities may keep objects alive that would normally be '\n'collectable.\\n'\n'Also note that catching an exception with a \u2018\"try\"\u2026\"except\"\u2019 '\n'statement\\n'\n'may keep objects alive.\\n'\n'\\n'\n'Some objects contain references to \u201cexternal\u201d resources such as '\n'open\\n'\n'files or windows. It is understood that these resources are '\n'freed\\n'\n'when the object is garbage-collected, but since garbage '\n'collection is\\n'\n'not guaranteed to happen, such objects also provide an explicit '\n'way to\\n'\n'release the external resource, usually a \"close()\" method. '\n'Programs\\n'\n'are strongly recommended to explicitly close such objects. The\\n'\n'\u2018\"try\"\u2026\"finally\"\u2019 statement and the \u2018\"with\"\u2019 statement provide\\n'\n'convenient ways to do this.\\n'\n'\\n'\n'Some objects contain references to other objects; these are '\n'called\\n'\n'*containers*. Examples of containers are tuples, lists and\\n'\n'dictionaries. The references are part of a container\u2019s value. '\n'In\\n'\n'most cases, when we talk about the value of a container, we imply '\n'the\\n'\n'values, not the identities of the contained objects; however, '\n'when we\\n'\n'talk about the mutability of a container, only the identities of '\n'the\\n'\n'immediately contained objects are implied. So, if an immutable\\n'\n'container (like a tuple) contains a reference to a mutable '\n'object, its\\n'\n'value changes if that mutable object is changed.\\n'\n'\\n'\n'Types affect almost all aspects of object behavior. Even the\\n'\n'importance of object identity is affected in some sense: for '\n'immutable\\n'\n'types, operations that compute new values may actually return a\\n'\n'reference to any existing object with the same type and value, '\n'while\\n'\n'for mutable objects this is not allowed. E.g., after \"a = 1; b = '\n'1\",\\n'\n'\"a\" and \"b\" may or may not refer to the same object with the '\n'value\\n'\n'one, depending on the implementation, but after \"c = []; d = []\", '\n'\"c\"\\n'\n'and \"d\" are guaranteed to refer to two different, unique, newly\\n'\n'created empty lists. (Note that \"c = d = []\" assigns the same '\n'object\\n'\n'to both \"c\" and \"d\".)\\n',\n'operator-summary':'Operator precedence\\n'\n'*******************\\n'\n'\\n'\n'The following table summarizes the operator precedence '\n'in Python, from\\n'\n'highest precedence (most binding) to lowest precedence '\n'(least\\n'\n'binding). Operators in the same box have the same '\n'precedence. Unless\\n'\n'the syntax is explicitly given, operators are binary. '\n'Operators in\\n'\n'the same box group left to right (except for '\n'exponentiation, which\\n'\n'groups from right to left).\\n'\n'\\n'\n'Note that comparisons, membership tests, and identity '\n'tests, all have\\n'\n'the same precedence and have a left-to-right chaining '\n'feature as\\n'\n'described in the Comparisons section.\\n'\n'\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| Operator | '\n'Description |\\n'\n'|=================================================|=======================================|\\n'\n'| \"(expressions...)\", \"[expressions...]\", \"{key: | '\n'Binding or parenthesized expression, |\\n'\n'| value...}\", \"{expressions...}\" | list '\n'display, dictionary display, set |\\n'\n'| | '\n'display |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"x[index]\", \"x[index:index]\", | '\n'Subscription, slicing, call, |\\n'\n'| \"x(arguments...)\", \"x.attribute\" | '\n'attribute reference |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"await\" \"x\" | '\n'Await expression |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"**\" | '\n'Exponentiation [5] |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"+x\", \"-x\", \"~x\" | '\n'Positive, negative, bitwise NOT |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"*\", \"@\", \"/\", \"//\", \"%\" | '\n'Multiplication, matrix |\\n'\n'| | '\n'multiplication, division, floor |\\n'\n'| | '\n'division, remainder [6] |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"+\", \"-\" | '\n'Addition and subtraction |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"<<\", \">>\" | '\n'Shifts |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"&\" | '\n'Bitwise AND |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"^\" | '\n'Bitwise XOR |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"|\" | '\n'Bitwise OR |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"in\", \"not in\", \"is\", \"is not\", \"<\", \"<=\", \">\", | '\n'Comparisons, including membership |\\n'\n'| \">=\", \"!=\", \"==\" | '\n'tests and identity tests |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"not\" \"x\" | '\n'Boolean NOT |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"and\" | '\n'Boolean AND |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"or\" | '\n'Boolean OR |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"if\" \u2013 \"else\" | '\n'Conditional expression |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"lambda\" | '\n'Lambda expression |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \":=\" | '\n'Assignment expression |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] While \"abs(x%y) < abs(y)\" is true mathematically, '\n'for floats it\\n'\n' may not be true numerically due to roundoff. For '\n'example, and\\n'\n' assuming a platform on which a Python float is an '\n'IEEE 754 double-\\n'\n' precision number, in order that \"-1e-100 % 1e100\" '\n'have the same\\n'\n' sign as \"1e100\", the computed result is \"-1e-100 + '\n'1e100\", which\\n'\n' is numerically exactly equal to \"1e100\". The '\n'function\\n'\n' \"math.fmod()\" returns a result whose sign matches '\n'the sign of the\\n'\n' first argument instead, and so returns \"-1e-100\" in '\n'this case.\\n'\n' Which approach is more appropriate depends on the '\n'application.\\n'\n'\\n'\n'[2] If x is very close to an exact integer multiple of '\n'y, it\u2019s\\n'\n' possible for \"x//y\" to be one larger than '\n'\"(x-x%y)//y\" due to\\n'\n' rounding. In such cases, Python returns the latter '\n'result, in\\n'\n' order to preserve that \"divmod(x,y)[0] * y + x % y\" '\n'be very close\\n'\n' to \"x\".\\n'\n'\\n'\n'[3] The Unicode standard distinguishes between *code '\n'points* (e.g.\\n'\n' U+0041) and *abstract characters* (e.g. \u201cLATIN '\n'CAPITAL LETTER A\u201d).\\n'\n' While most abstract characters in Unicode are only '\n'represented\\n'\n' using one code point, there is a number of abstract '\n'characters\\n'\n' that can in addition be represented using a sequence '\n'of more than\\n'\n' one code point. For example, the abstract character '\n'\u201cLATIN\\n'\n' CAPITAL LETTER C WITH CEDILLA\u201d can be represented as '\n'a single\\n'\n' *precomposed character* at code position U+00C7, or '\n'as a sequence\\n'\n' of a *base character* at code position U+0043 (LATIN '\n'CAPITAL\\n'\n' LETTER C), followed by a *combining character* at '\n'code position\\n'\n' U+0327 (COMBINING CEDILLA).\\n'\n'\\n'\n' The comparison operators on strings compare at the '\n'level of\\n'\n' Unicode code points. This may be counter-intuitive '\n'to humans. For\\n'\n' example, \"\"\\\\u00C7\" == \"\\\\u0043\\\\u0327\"\" is \"False\", '\n'even though both\\n'\n' strings represent the same abstract character \u201cLATIN '\n'CAPITAL\\n'\n' LETTER C WITH CEDILLA\u201d.\\n'\n'\\n'\n' To compare strings at the level of abstract '\n'characters (that is,\\n'\n' in a way intuitive to humans), use '\n'\"unicodedata.normalize()\".\\n'\n'\\n'\n'[4] Due to automatic garbage-collection, free lists, and '\n'the dynamic\\n'\n' nature of descriptors, you may notice seemingly '\n'unusual behaviour\\n'\n' in certain uses of the \"is\" operator, like those '\n'involving\\n'\n' comparisons between instance methods, or constants. '\n'Check their\\n'\n' documentation for more info.\\n'\n'\\n'\n'[5] The power operator \"**\" binds less tightly than an '\n'arithmetic or\\n'\n' bitwise unary operator on its right, that is, '\n'\"2**-1\" is \"0.5\".\\n'\n'\\n'\n'[6] The \"%\" operator is also used for string formatting; '\n'the same\\n'\n' precedence applies.\\n',\n'pass':'The \"pass\" statement\\n'\n'********************\\n'\n'\\n'\n' pass_stmt ::= \"pass\"\\n'\n'\\n'\n'\"pass\" is a null operation \u2014 when it is executed, nothing happens. '\n'It\\n'\n'is useful as a placeholder when a statement is required '\n'syntactically,\\n'\n'but no code needs to be executed, for example:\\n'\n'\\n'\n' def f(arg): pass # a function that does nothing (yet)\\n'\n'\\n'\n' class C: pass # a class with no methods (yet)\\n',\n'power':'The power operator\\n'\n'******************\\n'\n'\\n'\n'The power operator binds more tightly than unary operators on its\\n'\n'left; it binds less tightly than unary operators on its right. '\n'The\\n'\n'syntax is:\\n'\n'\\n'\n' power ::= (await_expr | primary) [\"**\" u_expr]\\n'\n'\\n'\n'Thus, in an unparenthesized sequence of power and unary operators, '\n'the\\n'\n'operators are evaluated from right to left (this does not '\n'constrain\\n'\n'the evaluation order for the operands): \"-1**2\" results in \"-1\".\\n'\n'\\n'\n'The power operator has the same semantics as the built-in \"pow()\"\\n'\n'function, when called with two arguments: it yields its left '\n'argument\\n'\n'raised to the power of its right argument. The numeric arguments '\n'are\\n'\n'first converted to a common type, and the result is of that type.\\n'\n'\\n'\n'For int operands, the result has the same type as the operands '\n'unless\\n'\n'the second argument is negative; in that case, all arguments are\\n'\n'converted to float and a float result is delivered. For example,\\n'\n'\"10**2\" returns \"100\", but \"10**-2\" returns \"0.01\".\\n'\n'\\n'\n'Raising \"0.0\" to a negative power results in a '\n'\"ZeroDivisionError\".\\n'\n'Raising a negative number to a fractional power results in a '\n'\"complex\"\\n'\n'number. (In earlier versions it raised a \"ValueError\".)\\n'\n'\\n'\n'This operation can be customized using the special \"__pow__()\" '\n'method.\\n',\n'raise':'The \"raise\" statement\\n'\n'*********************\\n'\n'\\n'\n' raise_stmt ::= \"raise\" [expression [\"from\" expression]]\\n'\n'\\n'\n'If no expressions are present, \"raise\" re-raises the last '\n'exception\\n'\n'that was active in the current scope. If no exception is active '\n'in\\n'\n'the current scope, a \"RuntimeError\" exception is raised indicating\\n'\n'that this is an error.\\n'\n'\\n'\n'Otherwise, \"raise\" evaluates the first expression as the exception\\n'\n'object. It must be either a subclass or an instance of\\n'\n'\"BaseException\". If it is a class, the exception instance will be\\n'\n'obtained when needed by instantiating the class with no arguments.\\n'\n'\\n'\n'The *type* of the exception is the exception instance\u2019s class, the\\n'\n'*value* is the instance itself.\\n'\n'\\n'\n'A traceback object is normally created automatically when an '\n'exception\\n'\n'is raised and attached to it as the \"__traceback__\" attribute, '\n'which\\n'\n'is writable. You can create an exception and set your own traceback '\n'in\\n'\n'one step using the \"with_traceback()\" exception method (which '\n'returns\\n'\n'the same exception instance, with its traceback set to its '\n'argument),\\n'\n'like so:\\n'\n'\\n'\n' raise Exception(\"foo occurred\").with_traceback(tracebackobj)\\n'\n'\\n'\n'The \"from\" clause is used for exception chaining: if given, the '\n'second\\n'\n'*expression* must be another exception class or instance. If the\\n'\n'second expression is an exception instance, it will be attached to '\n'the\\n'\n'raised exception as the \"__cause__\" attribute (which is writable). '\n'If\\n'\n'the expression is an exception class, the class will be '\n'instantiated\\n'\n'and the resulting exception instance will be attached to the '\n'raised\\n'\n'exception as the \"__cause__\" attribute. If the raised exception is '\n'not\\n'\n'handled, both exceptions will be printed:\\n'\n'\\n'\n' >>> try:\\n'\n' ... print(1 / 0)\\n'\n' ... except Exception as exc:\\n'\n' ... raise RuntimeError(\"Something bad happened\") from exc\\n'\n' ...\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 2, in \\n'\n' ZeroDivisionError: division by zero\\n'\n'\\n'\n' The above exception was the direct cause of the following '\n'exception:\\n'\n'\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 4, in \\n'\n' RuntimeError: Something bad happened\\n'\n'\\n'\n'A similar mechanism works implicitly if an exception is raised '\n'inside\\n'\n'an exception handler or a \"finally\" clause: the previous exception '\n'is\\n'\n'then attached as the new exception\u2019s \"__context__\" attribute:\\n'\n'\\n'\n' >>> try:\\n'\n' ... print(1 / 0)\\n'\n' ... except:\\n'\n' ... raise RuntimeError(\"Something bad happened\")\\n'\n' ...\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 2, in \\n'\n' ZeroDivisionError: division by zero\\n'\n'\\n'\n' During handling of the above exception, another exception '\n'occurred:\\n'\n'\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 4, in \\n'\n' RuntimeError: Something bad happened\\n'\n'\\n'\n'Exception chaining can be explicitly suppressed by specifying '\n'\"None\"\\n'\n'in the \"from\" clause:\\n'\n'\\n'\n' >>> try:\\n'\n' ... print(1 / 0)\\n'\n' ... except:\\n'\n' ... raise RuntimeError(\"Something bad happened\") from None\\n'\n' ...\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 4, in \\n'\n' RuntimeError: Something bad happened\\n'\n'\\n'\n'Additional information on exceptions can be found in section\\n'\n'Exceptions, and information about handling exceptions is in '\n'section\\n'\n'The try statement.\\n'\n'\\n'\n'Changed in version 3.3: \"None\" is now permitted as \"Y\" in \"raise X\\n'\n'from Y\".\\n'\n'\\n'\n'New in version 3.3: The \"__suppress_context__\" attribute to '\n'suppress\\n'\n'automatic display of the exception context.\\n',\n'return':'The \"return\" statement\\n'\n'**********************\\n'\n'\\n'\n' return_stmt ::= \"return\" [expression_list]\\n'\n'\\n'\n'\"return\" may only occur syntactically nested in a function '\n'definition,\\n'\n'not within a nested class definition.\\n'\n'\\n'\n'If an expression list is present, it is evaluated, else \"None\" is\\n'\n'substituted.\\n'\n'\\n'\n'\"return\" leaves the current function call with the expression list '\n'(or\\n'\n'\"None\") as return value.\\n'\n'\\n'\n'When \"return\" passes control out of a \"try\" statement with a '\n'\"finally\"\\n'\n'clause, that \"finally\" clause is executed before really leaving '\n'the\\n'\n'function.\\n'\n'\\n'\n'In a generator function, the \"return\" statement indicates that '\n'the\\n'\n'generator is done and will cause \"StopIteration\" to be raised. '\n'The\\n'\n'returned value (if any) is used as an argument to construct\\n'\n'\"StopIteration\" and becomes the \"StopIteration.value\" attribute.\\n'\n'\\n'\n'In an asynchronous generator function, an empty \"return\" '\n'statement\\n'\n'indicates that the asynchronous generator is done and will cause\\n'\n'\"StopAsyncIteration\" to be raised. A non-empty \"return\" statement '\n'is\\n'\n'a syntax error in an asynchronous generator function.\\n',\n'sequence-types':'Emulating container types\\n'\n'*************************\\n'\n'\\n'\n'The following methods can be defined to implement '\n'container objects.\\n'\n'Containers usually are sequences (such as lists or tuples) '\n'or mappings\\n'\n'(like dictionaries), but can represent other containers as '\n'well. The\\n'\n'first set of methods is used either to emulate a sequence '\n'or to\\n'\n'emulate a mapping; the difference is that for a sequence, '\n'the\\n'\n'allowable keys should be the integers *k* for which \"0 <= '\n'k < N\" where\\n'\n'*N* is the length of the sequence, or slice objects, which '\n'define a\\n'\n'range of items. It is also recommended that mappings '\n'provide the\\n'\n'methods \"keys()\", \"values()\", \"items()\", \"get()\", '\n'\"clear()\",\\n'\n'\"setdefault()\", \"pop()\", \"popitem()\", \"copy()\", and '\n'\"update()\"\\n'\n'behaving similar to those for Python\u2019s standard dictionary '\n'objects.\\n'\n'The \"collections.abc\" module provides a \"MutableMapping\" '\n'abstract base\\n'\n'class to help create those methods from a base set of '\n'\"__getitem__()\",\\n'\n'\"__setitem__()\", \"__delitem__()\", and \"keys()\". Mutable '\n'sequences\\n'\n'should provide methods \"append()\", \"count()\", \"index()\", '\n'\"extend()\",\\n'\n'\"insert()\", \"pop()\", \"remove()\", \"reverse()\" and \"sort()\", '\n'like Python\\n'\n'standard list objects. Finally, sequence types should '\n'implement\\n'\n'addition (meaning concatenation) and multiplication '\n'(meaning\\n'\n'repetition) by defining the methods \"__add__()\", '\n'\"__radd__()\",\\n'\n'\"__iadd__()\", \"__mul__()\", \"__rmul__()\" and \"__imul__()\" '\n'described\\n'\n'below; they should not define other numerical operators. '\n'It is\\n'\n'recommended that both mappings and sequences implement '\n'the\\n'\n'\"__contains__()\" method to allow efficient use of the \"in\" '\n'operator;\\n'\n'for mappings, \"in\" should search the mapping\u2019s keys; for '\n'sequences, it\\n'\n'should search through the values. It is further '\n'recommended that both\\n'\n'mappings and sequences implement the \"__iter__()\" method '\n'to allow\\n'\n'efficient iteration through the container; for mappings, '\n'\"__iter__()\"\\n'\n'should iterate through the object\u2019s keys; for sequences, '\n'it should\\n'\n'iterate through the values.\\n'\n'\\n'\n'object.__len__(self)\\n'\n'\\n'\n' Called to implement the built-in function \"len()\". '\n'Should return\\n'\n' the length of the object, an integer \">=\" 0. Also, an '\n'object that\\n'\n' doesn\u2019t define a \"__bool__()\" method and whose '\n'\"__len__()\" method\\n'\n' returns zero is considered to be false in a Boolean '\n'context.\\n'\n'\\n'\n' **CPython implementation detail:** In CPython, the '\n'length is\\n'\n' required to be at most \"sys.maxsize\". If the length is '\n'larger than\\n'\n' \"sys.maxsize\" some features (such as \"len()\") may '\n'raise\\n'\n' \"OverflowError\". To prevent raising \"OverflowError\" by '\n'truth value\\n'\n' testing, an object must define a \"__bool__()\" method.\\n'\n'\\n'\n'object.__length_hint__(self)\\n'\n'\\n'\n' Called to implement \"operator.length_hint()\". Should '\n'return an\\n'\n' estimated length for the object (which may be greater '\n'or less than\\n'\n' the actual length). The length must be an integer \">=\" '\n'0. The\\n'\n' return value may also be \"NotImplemented\", which is '\n'treated the\\n'\n' same as if the \"__length_hint__\" method didn\u2019t exist at '\n'all. This\\n'\n' method is purely an optimization and is never required '\n'for\\n'\n' correctness.\\n'\n'\\n'\n' New in version 3.4.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Slicing is done exclusively with the following three '\n'methods. A\\n'\n' call like\\n'\n'\\n'\n' a[1:2] = b\\n'\n'\\n'\n' is translated to\\n'\n'\\n'\n' a[slice(1, 2, None)] = b\\n'\n'\\n'\n' and so forth. Missing slice items are always filled in '\n'with \"None\".\\n'\n'\\n'\n'object.__getitem__(self, key)\\n'\n'\\n'\n' Called to implement evaluation of \"self[key]\". For '\n'sequence types,\\n'\n' the accepted keys should be integers and slice '\n'objects. Note that\\n'\n' the special interpretation of negative indexes (if the '\n'class wishes\\n'\n' to emulate a sequence type) is up to the '\n'\"__getitem__()\" method. If\\n'\n' *key* is of an inappropriate type, \"TypeError\" may be '\n'raised; if of\\n'\n' a value outside the set of indexes for the sequence '\n'(after any\\n'\n' special interpretation of negative values), '\n'\"IndexError\" should be\\n'\n' raised. For mapping types, if *key* is missing (not in '\n'the\\n'\n' container), \"KeyError\" should be raised.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"for\" loops expect that an \"IndexError\" will be '\n'raised for\\n'\n' illegal indexes to allow proper detection of the end '\n'of the\\n'\n' sequence.\\n'\n'\\n'\n'object.__setitem__(self, key, value)\\n'\n'\\n'\n' Called to implement assignment to \"self[key]\". Same '\n'note as for\\n'\n' \"__getitem__()\". This should only be implemented for '\n'mappings if\\n'\n' the objects support changes to the values for keys, or '\n'if new keys\\n'\n' can be added, or for sequences if elements can be '\n'replaced. The\\n'\n' same exceptions should be raised for improper *key* '\n'values as for\\n'\n' the \"__getitem__()\" method.\\n'\n'\\n'\n'object.__delitem__(self, key)\\n'\n'\\n'\n' Called to implement deletion of \"self[key]\". Same note '\n'as for\\n'\n' \"__getitem__()\". This should only be implemented for '\n'mappings if\\n'\n' the objects support removal of keys, or for sequences '\n'if elements\\n'\n' can be removed from the sequence. The same exceptions '\n'should be\\n'\n' raised for improper *key* values as for the '\n'\"__getitem__()\" method.\\n'\n'\\n'\n'object.__missing__(self, key)\\n'\n'\\n'\n' Called by \"dict\".\"__getitem__()\" to implement '\n'\"self[key]\" for dict\\n'\n' subclasses when key is not in the dictionary.\\n'\n'\\n'\n'object.__iter__(self)\\n'\n'\\n'\n' This method is called when an iterator is required for '\n'a container.\\n'\n' This method should return a new iterator object that '\n'can iterate\\n'\n' over all the objects in the container. For mappings, '\n'it should\\n'\n' iterate over the keys of the container.\\n'\n'\\n'\n' Iterator objects also need to implement this method; '\n'they are\\n'\n' required to return themselves. For more information on '\n'iterator\\n'\n' objects, see Iterator Types.\\n'\n'\\n'\n'object.__reversed__(self)\\n'\n'\\n'\n' Called (if present) by the \"reversed()\" built-in to '\n'implement\\n'\n' reverse iteration. It should return a new iterator '\n'object that\\n'\n' iterates over all the objects in the container in '\n'reverse order.\\n'\n'\\n'\n' If the \"__reversed__()\" method is not provided, the '\n'\"reversed()\"\\n'\n' built-in will fall back to using the sequence protocol '\n'(\"__len__()\"\\n'\n' and \"__getitem__()\"). Objects that support the '\n'sequence protocol\\n'\n' should only provide \"__reversed__()\" if they can '\n'provide an\\n'\n' implementation that is more efficient than the one '\n'provided by\\n'\n' \"reversed()\".\\n'\n'\\n'\n'The membership test operators (\"in\" and \"not in\") are '\n'normally\\n'\n'implemented as an iteration through a container. However, '\n'container\\n'\n'objects can supply the following special method with a '\n'more efficient\\n'\n'implementation, which also does not require the object be '\n'iterable.\\n'\n'\\n'\n'object.__contains__(self, item)\\n'\n'\\n'\n' Called to implement membership test operators. Should '\n'return true\\n'\n' if *item* is in *self*, false otherwise. For mapping '\n'objects, this\\n'\n' should consider the keys of the mapping rather than the '\n'values or\\n'\n' the key-item pairs.\\n'\n'\\n'\n' For objects that don\u2019t define \"__contains__()\", the '\n'membership test\\n'\n' first tries iteration via \"__iter__()\", then the old '\n'sequence\\n'\n' iteration protocol via \"__getitem__()\", see this '\n'section in the\\n'\n' language reference.\\n',\n'shifting':'Shifting operations\\n'\n'*******************\\n'\n'\\n'\n'The shifting operations have lower priority than the arithmetic\\n'\n'operations:\\n'\n'\\n'\n' shift_expr ::= a_expr | shift_expr (\"<<\" | \">>\") a_expr\\n'\n'\\n'\n'These operators accept integers as arguments. They shift the '\n'first\\n'\n'argument to the left or right by the number of bits given by '\n'the\\n'\n'second argument.\\n'\n'\\n'\n'This operation can be customized using the special '\n'\"__lshift__()\" and\\n'\n'\"__rshift__()\" methods.\\n'\n'\\n'\n'A right shift by *n* bits is defined as floor division by '\n'\"pow(2,n)\".\\n'\n'A left shift by *n* bits is defined as multiplication with '\n'\"pow(2,n)\".\\n',\n'slicings':'Slicings\\n'\n'********\\n'\n'\\n'\n'A slicing selects a range of items in a sequence object (e.g., '\n'a\\n'\n'string, tuple or list). Slicings may be used as expressions or '\n'as\\n'\n'targets in assignment or \"del\" statements. The syntax for a '\n'slicing:\\n'\n'\\n'\n' slicing ::= primary \"[\" slice_list \"]\"\\n'\n' slice_list ::= slice_item (\",\" slice_item)* [\",\"]\\n'\n' slice_item ::= expression | proper_slice\\n'\n' proper_slice ::= [lower_bound] \":\" [upper_bound] [ \":\" '\n'[stride] ]\\n'\n' lower_bound ::= expression\\n'\n' upper_bound ::= expression\\n'\n' stride ::= expression\\n'\n'\\n'\n'There is ambiguity in the formal syntax here: anything that '\n'looks like\\n'\n'an expression list also looks like a slice list, so any '\n'subscription\\n'\n'can be interpreted as a slicing. Rather than further '\n'complicating the\\n'\n'syntax, this is disambiguated by defining that in this case the\\n'\n'interpretation as a subscription takes priority over the\\n'\n'interpretation as a slicing (this is the case if the slice list\\n'\n'contains no proper slice).\\n'\n'\\n'\n'The semantics for a slicing are as follows. The primary is '\n'indexed\\n'\n'(using the same \"__getitem__()\" method as normal subscription) '\n'with a\\n'\n'key that is constructed from the slice list, as follows. If the '\n'slice\\n'\n'list contains at least one comma, the key is a tuple containing '\n'the\\n'\n'conversion of the slice items; otherwise, the conversion of the '\n'lone\\n'\n'slice item is the key. The conversion of a slice item that is '\n'an\\n'\n'expression is that expression. The conversion of a proper slice '\n'is a\\n'\n'slice object (see section The standard type hierarchy) whose '\n'\"start\",\\n'\n'\"stop\" and \"step\" attributes are the values of the expressions '\n'given\\n'\n'as lower bound, upper bound and stride, respectively, '\n'substituting\\n'\n'\"None\" for missing expressions.\\n',\n'specialattrs':'Special Attributes\\n'\n'******************\\n'\n'\\n'\n'The implementation adds a few special read-only attributes '\n'to several\\n'\n'object types, where they are relevant. Some of these are '\n'not reported\\n'\n'by the \"dir()\" built-in function.\\n'\n'\\n'\n'object.__dict__\\n'\n'\\n'\n' A dictionary or other mapping object used to store an '\n'object\u2019s\\n'\n' (writable) attributes.\\n'\n'\\n'\n'instance.__class__\\n'\n'\\n'\n' The class to which a class instance belongs.\\n'\n'\\n'\n'class.__bases__\\n'\n'\\n'\n' The tuple of base classes of a class object.\\n'\n'\\n'\n'definition.__name__\\n'\n'\\n'\n' The name of the class, function, method, descriptor, or '\n'generator\\n'\n' instance.\\n'\n'\\n'\n'definition.__qualname__\\n'\n'\\n'\n' The *qualified name* of the class, function, method, '\n'descriptor, or\\n'\n' generator instance.\\n'\n'\\n'\n' New in version 3.3.\\n'\n'\\n'\n'class.__mro__\\n'\n'\\n'\n' This attribute is a tuple of classes that are considered '\n'when\\n'\n' looking for base classes during method resolution.\\n'\n'\\n'\n'class.mro()\\n'\n'\\n'\n' This method can be overridden by a metaclass to customize '\n'the\\n'\n' method resolution order for its instances. It is called '\n'at class\\n'\n' instantiation, and its result is stored in \"__mro__\".\\n'\n'\\n'\n'class.__subclasses__()\\n'\n'\\n'\n' Each class keeps a list of weak references to its '\n'immediate\\n'\n' subclasses. This method returns a list of all those '\n'references\\n'\n' still alive. The list is in definition order. Example:\\n'\n'\\n'\n' >>> int.__subclasses__()\\n'\n\" []\\n\"\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] Additional information on these special methods may be '\n'found in\\n'\n' the Python Reference Manual (Basic customization).\\n'\n'\\n'\n'[2] As a consequence, the list \"[1, 2]\" is considered equal '\n'to \"[1.0,\\n'\n' 2.0]\", and similarly for tuples.\\n'\n'\\n'\n'[3] They must have since the parser can\u2019t tell the type of '\n'the\\n'\n' operands.\\n'\n'\\n'\n'[4] Cased characters are those with general category '\n'property being\\n'\n' one of \u201cLu\u201d (Letter, uppercase), \u201cLl\u201d (Letter, '\n'lowercase), or \u201cLt\u201d\\n'\n' (Letter, titlecase).\\n'\n'\\n'\n'[5] To format only a tuple you should therefore provide a '\n'singleton\\n'\n' tuple whose only element is the tuple to be formatted.\\n',\n'specialnames':'Special method names\\n'\n'********************\\n'\n'\\n'\n'A class can implement certain operations that are invoked by '\n'special\\n'\n'syntax (such as arithmetic operations or subscripting and '\n'slicing) by\\n'\n'defining methods with special names. This is Python\u2019s '\n'approach to\\n'\n'*operator overloading*, allowing classes to define their own '\n'behavior\\n'\n'with respect to language operators. For instance, if a '\n'class defines\\n'\n'a method named \"__getitem__()\", and \"x\" is an instance of '\n'this class,\\n'\n'then \"x[i]\" is roughly equivalent to \"type(x).__getitem__(x, '\n'i)\".\\n'\n'Except where mentioned, attempts to execute an operation '\n'raise an\\n'\n'exception when no appropriate method is defined (typically\\n'\n'\"AttributeError\" or \"TypeError\").\\n'\n'\\n'\n'Setting a special method to \"None\" indicates that the '\n'corresponding\\n'\n'operation is not available. For example, if a class sets '\n'\"__iter__()\"\\n'\n'to \"None\", the class is not iterable, so calling \"iter()\" on '\n'its\\n'\n'instances will raise a \"TypeError\" (without falling back to\\n'\n'\"__getitem__()\"). [2]\\n'\n'\\n'\n'When implementing a class that emulates any built-in type, '\n'it is\\n'\n'important that the emulation only be implemented to the '\n'degree that it\\n'\n'makes sense for the object being modelled. For example, '\n'some\\n'\n'sequences may work well with retrieval of individual '\n'elements, but\\n'\n'extracting a slice may not make sense. (One example of this '\n'is the\\n'\n'\"NodeList\" interface in the W3C\u2019s Document Object Model.)\\n'\n'\\n'\n'\\n'\n'Basic customization\\n'\n'===================\\n'\n'\\n'\n'object.__new__(cls[, ...])\\n'\n'\\n'\n' Called to create a new instance of class *cls*. '\n'\"__new__()\" is a\\n'\n' static method (special-cased so you need not declare it '\n'as such)\\n'\n' that takes the class of which an instance was requested '\n'as its\\n'\n' first argument. The remaining arguments are those passed '\n'to the\\n'\n' object constructor expression (the call to the class). '\n'The return\\n'\n' value of \"__new__()\" should be the new object instance '\n'(usually an\\n'\n' instance of *cls*).\\n'\n'\\n'\n' Typical implementations create a new instance of the '\n'class by\\n'\n' invoking the superclass\u2019s \"__new__()\" method using\\n'\n' \"super().__new__(cls[, ...])\" with appropriate arguments '\n'and then\\n'\n' modifying the newly-created instance as necessary before '\n'returning\\n'\n' it.\\n'\n'\\n'\n' If \"__new__()\" is invoked during object construction and '\n'it returns\\n'\n' an instance or subclass of *cls*, then the new '\n'instance\u2019s\\n'\n' \"__init__()\" method will be invoked like \"__init__(self[, '\n'...])\",\\n'\n' where *self* is the new instance and the remaining '\n'arguments are\\n'\n' the same as were passed to the object constructor.\\n'\n'\\n'\n' If \"__new__()\" does not return an instance of *cls*, then '\n'the new\\n'\n' instance\u2019s \"__init__()\" method will not be invoked.\\n'\n'\\n'\n' \"__new__()\" is intended mainly to allow subclasses of '\n'immutable\\n'\n' types (like int, str, or tuple) to customize instance '\n'creation. It\\n'\n' is also commonly overridden in custom metaclasses in '\n'order to\\n'\n' customize class creation.\\n'\n'\\n'\n'object.__init__(self[, ...])\\n'\n'\\n'\n' Called after the instance has been created (by '\n'\"__new__()\"), but\\n'\n' before it is returned to the caller. The arguments are '\n'those\\n'\n' passed to the class constructor expression. If a base '\n'class has an\\n'\n' \"__init__()\" method, the derived class\u2019s \"__init__()\" '\n'method, if\\n'\n' any, must explicitly call it to ensure proper '\n'initialization of the\\n'\n' base class part of the instance; for example:\\n'\n' \"super().__init__([args...])\".\\n'\n'\\n'\n' Because \"__new__()\" and \"__init__()\" work together in '\n'constructing\\n'\n' objects (\"__new__()\" to create it, and \"__init__()\" to '\n'customize\\n'\n' it), no non-\"None\" value may be returned by \"__init__()\"; '\n'doing so\\n'\n' will cause a \"TypeError\" to be raised at runtime.\\n'\n'\\n'\n'object.__del__(self)\\n'\n'\\n'\n' Called when the instance is about to be destroyed. This '\n'is also\\n'\n' called a finalizer or (improperly) a destructor. If a '\n'base class\\n'\n' has a \"__del__()\" method, the derived class\u2019s \"__del__()\" '\n'method,\\n'\n' if any, must explicitly call it to ensure proper deletion '\n'of the\\n'\n' base class part of the instance.\\n'\n'\\n'\n' It is possible (though not recommended!) for the '\n'\"__del__()\" method\\n'\n' to postpone destruction of the instance by creating a new '\n'reference\\n'\n' to it. This is called object *resurrection*. It is\\n'\n' implementation-dependent whether \"__del__()\" is called a '\n'second\\n'\n' time when a resurrected object is about to be destroyed; '\n'the\\n'\n' current *CPython* implementation only calls it once.\\n'\n'\\n'\n' It is not guaranteed that \"__del__()\" methods are called '\n'for\\n'\n' objects that still exist when the interpreter exits.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"del x\" doesn\u2019t directly call \"x.__del__()\" \u2014 the '\n'former\\n'\n' decrements the reference count for \"x\" by one, and the '\n'latter is\\n'\n' only called when \"x\"\u2019s reference count reaches zero.\\n'\n'\\n'\n' **CPython implementation detail:** It is possible for a '\n'reference\\n'\n' cycle to prevent the reference count of an object from '\n'going to\\n'\n' zero. In this case, the cycle will be later detected and '\n'deleted\\n'\n' by the *cyclic garbage collector*. A common cause of '\n'reference\\n'\n' cycles is when an exception has been caught in a local '\n'variable.\\n'\n' The frame\u2019s locals then reference the exception, which '\n'references\\n'\n' its own traceback, which references the locals of all '\n'frames caught\\n'\n' in the traceback.\\n'\n'\\n'\n' See also: Documentation for the \"gc\" module.\\n'\n'\\n'\n' Warning:\\n'\n'\\n'\n' Due to the precarious circumstances under which '\n'\"__del__()\"\\n'\n' methods are invoked, exceptions that occur during their '\n'execution\\n'\n' are ignored, and a warning is printed to \"sys.stderr\" '\n'instead.\\n'\n' In particular:\\n'\n'\\n'\n' * \"__del__()\" can be invoked when arbitrary code is '\n'being\\n'\n' executed, including from any arbitrary thread. If '\n'\"__del__()\"\\n'\n' needs to take a lock or invoke any other blocking '\n'resource, it\\n'\n' may deadlock as the resource may already be taken by '\n'the code\\n'\n' that gets interrupted to execute \"__del__()\".\\n'\n'\\n'\n' * \"__del__()\" can be executed during interpreter '\n'shutdown. As a\\n'\n' consequence, the global variables it needs to access '\n'(including\\n'\n' other modules) may already have been deleted or set '\n'to \"None\".\\n'\n' Python guarantees that globals whose name begins with '\n'a single\\n'\n' underscore are deleted from their module before other '\n'globals\\n'\n' are deleted; if no other references to such globals '\n'exist, this\\n'\n' may help in assuring that imported modules are still '\n'available\\n'\n' at the time when the \"__del__()\" method is called.\\n'\n'\\n'\n'object.__repr__(self)\\n'\n'\\n'\n' Called by the \"repr()\" built-in function to compute the '\n'\u201cofficial\u201d\\n'\n' string representation of an object. If at all possible, '\n'this\\n'\n' should look like a valid Python expression that could be '\n'used to\\n'\n' recreate an object with the same value (given an '\n'appropriate\\n'\n' environment). If this is not possible, a string of the '\n'form\\n'\n' \"<...some useful description...>\" should be returned. The '\n'return\\n'\n' value must be a string object. If a class defines '\n'\"__repr__()\" but\\n'\n' not \"__str__()\", then \"__repr__()\" is also used when an '\n'\u201cinformal\u201d\\n'\n' string representation of instances of that class is '\n'required.\\n'\n'\\n'\n' This is typically used for debugging, so it is important '\n'that the\\n'\n' representation is information-rich and unambiguous.\\n'\n'\\n'\n'object.__str__(self)\\n'\n'\\n'\n' Called by \"str(object)\" and the built-in functions '\n'\"format()\" and\\n'\n' \"print()\" to compute the \u201cinformal\u201d or nicely printable '\n'string\\n'\n' representation of an object. The return value must be a '\n'string\\n'\n' object.\\n'\n'\\n'\n' This method differs from \"object.__repr__()\" in that '\n'there is no\\n'\n' expectation that \"__str__()\" return a valid Python '\n'expression: a\\n'\n' more convenient or concise representation can be used.\\n'\n'\\n'\n' The default implementation defined by the built-in type '\n'\"object\"\\n'\n' calls \"object.__repr__()\".\\n'\n'\\n'\n'object.__bytes__(self)\\n'\n'\\n'\n' Called by bytes to compute a byte-string representation '\n'of an\\n'\n' object. This should return a \"bytes\" object.\\n'\n'\\n'\n'object.__format__(self, format_spec)\\n'\n'\\n'\n' Called by the \"format()\" built-in function, and by '\n'extension,\\n'\n' evaluation of formatted string literals and the '\n'\"str.format()\"\\n'\n' method, to produce a \u201cformatted\u201d string representation of '\n'an\\n'\n' object. The *format_spec* argument is a string that '\n'contains a\\n'\n' description of the formatting options desired. The '\n'interpretation\\n'\n' of the *format_spec* argument is up to the type '\n'implementing\\n'\n' \"__format__()\", however most classes will either '\n'delegate\\n'\n' formatting to one of the built-in types, or use a '\n'similar\\n'\n' formatting option syntax.\\n'\n'\\n'\n' See Format Specification Mini-Language for a description '\n'of the\\n'\n' standard formatting syntax.\\n'\n'\\n'\n' The return value must be a string object.\\n'\n'\\n'\n' Changed in version 3.4: The __format__ method of \"object\" '\n'itself\\n'\n' raises a \"TypeError\" if passed any non-empty string.\\n'\n'\\n'\n' Changed in version 3.7: \"object.__format__(x, \\'\\')\" is '\n'now\\n'\n' equivalent to \"str(x)\" rather than \"format(str(x), '\n'\\'\\')\".\\n'\n'\\n'\n'object.__lt__(self, other)\\n'\n'object.__le__(self, other)\\n'\n'object.__eq__(self, other)\\n'\n'object.__ne__(self, other)\\n'\n'object.__gt__(self, other)\\n'\n'object.__ge__(self, other)\\n'\n'\\n'\n' These are the so-called \u201crich comparison\u201d methods. The\\n'\n' correspondence between operator symbols and method names '\n'is as\\n'\n' follows: \"xy\" calls\\n'\n' \"x.__gt__(y)\", and \"x>=y\" calls \"x.__ge__(y)\".\\n'\n'\\n'\n' A rich comparison method may return the singleton '\n'\"NotImplemented\"\\n'\n' if it does not implement the operation for a given pair '\n'of\\n'\n' arguments. By convention, \"False\" and \"True\" are returned '\n'for a\\n'\n' successful comparison. However, these methods can return '\n'any value,\\n'\n' so if the comparison operator is used in a Boolean '\n'context (e.g.,\\n'\n' in the condition of an \"if\" statement), Python will call '\n'\"bool()\"\\n'\n' on the value to determine if the result is true or '\n'false.\\n'\n'\\n'\n' By default, \"object\" implements \"__eq__()\" by using \"is\", '\n'returning\\n'\n' \"NotImplemented\" in the case of a false comparison: \"True '\n'if x is y\\n'\n' else NotImplemented\". For \"__ne__()\", by default it '\n'delegates to\\n'\n' \"__eq__()\" and inverts the result unless it is '\n'\"NotImplemented\".\\n'\n' There are no other implied relationships among the '\n'comparison\\n'\n' operators or default implementations; for example, the '\n'truth of\\n'\n' \"(x.__hash__\".\\n'\n'\\n'\n' If a class that does not override \"__eq__()\" wishes to '\n'suppress\\n'\n' hash support, it should include \"__hash__ = None\" in the '\n'class\\n'\n' definition. A class which defines its own \"__hash__()\" '\n'that\\n'\n' explicitly raises a \"TypeError\" would be incorrectly '\n'identified as\\n'\n' hashable by an \"isinstance(obj, '\n'collections.abc.Hashable)\" call.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' By default, the \"__hash__()\" values of str and bytes '\n'objects are\\n'\n' \u201csalted\u201d with an unpredictable random value. Although '\n'they\\n'\n' remain constant within an individual Python process, '\n'they are not\\n'\n' predictable between repeated invocations of Python.This '\n'is\\n'\n' intended to provide protection against a '\n'denial-of-service caused\\n'\n' by carefully-chosen inputs that exploit the worst case\\n'\n' performance of a dict insertion, O(n^2) complexity. '\n'See\\n'\n' http://www.ocert.org/advisories/ocert-2011-003.html '\n'for\\n'\n' details.Changing hash values affects the iteration '\n'order of sets.\\n'\n' Python has never made guarantees about this ordering '\n'(and it\\n'\n' typically varies between 32-bit and 64-bit builds).See '\n'also\\n'\n' \"PYTHONHASHSEED\".\\n'\n'\\n'\n' Changed in version 3.3: Hash randomization is enabled by '\n'default.\\n'\n'\\n'\n'object.__bool__(self)\\n'\n'\\n'\n' Called to implement truth value testing and the built-in '\n'operation\\n'\n' \"bool()\"; should return \"False\" or \"True\". When this '\n'method is not\\n'\n' defined, \"__len__()\" is called, if it is defined, and the '\n'object is\\n'\n' considered true if its result is nonzero. If a class '\n'defines\\n'\n' neither \"__len__()\" nor \"__bool__()\", all its instances '\n'are\\n'\n' considered true.\\n'\n'\\n'\n'\\n'\n'Customizing attribute access\\n'\n'============================\\n'\n'\\n'\n'The following methods can be defined to customize the '\n'meaning of\\n'\n'attribute access (use of, assignment to, or deletion of '\n'\"x.name\") for\\n'\n'class instances.\\n'\n'\\n'\n'object.__getattr__(self, name)\\n'\n'\\n'\n' Called when the default attribute access fails with an\\n'\n' \"AttributeError\" (either \"__getattribute__()\" raises an\\n'\n' \"AttributeError\" because *name* is not an instance '\n'attribute or an\\n'\n' attribute in the class tree for \"self\"; or \"__get__()\" of '\n'a *name*\\n'\n' property raises \"AttributeError\"). This method should '\n'either\\n'\n' return the (computed) attribute value or raise an '\n'\"AttributeError\"\\n'\n' exception.\\n'\n'\\n'\n' Note that if the attribute is found through the normal '\n'mechanism,\\n'\n' \"__getattr__()\" is not called. (This is an intentional '\n'asymmetry\\n'\n' between \"__getattr__()\" and \"__setattr__()\".) This is '\n'done both for\\n'\n' efficiency reasons and because otherwise \"__getattr__()\" '\n'would have\\n'\n' no way to access other attributes of the instance. Note '\n'that at\\n'\n' least for instance variables, you can fake total control '\n'by not\\n'\n' inserting any values in the instance attribute dictionary '\n'(but\\n'\n' instead inserting them in another object). See the\\n'\n' \"__getattribute__()\" method below for a way to actually '\n'get total\\n'\n' control over attribute access.\\n'\n'\\n'\n'object.__getattribute__(self, name)\\n'\n'\\n'\n' Called unconditionally to implement attribute accesses '\n'for\\n'\n' instances of the class. If the class also defines '\n'\"__getattr__()\",\\n'\n' the latter will not be called unless \"__getattribute__()\" '\n'either\\n'\n' calls it explicitly or raises an \"AttributeError\". This '\n'method\\n'\n' should return the (computed) attribute value or raise an\\n'\n' \"AttributeError\" exception. In order to avoid infinite '\n'recursion in\\n'\n' this method, its implementation should always call the '\n'base class\\n'\n' method with the same name to access any attributes it '\n'needs, for\\n'\n' example, \"object.__getattribute__(self, name)\".\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' This method may still be bypassed when looking up '\n'special methods\\n'\n' as the result of implicit invocation via language '\n'syntax or\\n'\n' built-in functions. See Special method lookup.\\n'\n'\\n'\n' For certain sensitive attribute accesses, raises an '\n'auditing event\\n'\n' \"object.__getattr__\" with arguments \"obj\" and \"name\".\\n'\n'\\n'\n'object.__setattr__(self, name, value)\\n'\n'\\n'\n' Called when an attribute assignment is attempted. This '\n'is called\\n'\n' instead of the normal mechanism (i.e. store the value in '\n'the\\n'\n' instance dictionary). *name* is the attribute name, '\n'*value* is the\\n'\n' value to be assigned to it.\\n'\n'\\n'\n' If \"__setattr__()\" wants to assign to an instance '\n'attribute, it\\n'\n' should call the base class method with the same name, for '\n'example,\\n'\n' \"object.__setattr__(self, name, value)\".\\n'\n'\\n'\n' For certain sensitive attribute assignments, raises an '\n'auditing\\n'\n' event \"object.__setattr__\" with arguments \"obj\", \"name\", '\n'\"value\".\\n'\n'\\n'\n'object.__delattr__(self, name)\\n'\n'\\n'\n' Like \"__setattr__()\" but for attribute deletion instead '\n'of\\n'\n' assignment. This should only be implemented if \"del '\n'obj.name\" is\\n'\n' meaningful for the object.\\n'\n'\\n'\n' For certain sensitive attribute deletions, raises an '\n'auditing event\\n'\n' \"object.__delattr__\" with arguments \"obj\" and \"name\".\\n'\n'\\n'\n'object.__dir__(self)\\n'\n'\\n'\n' Called when \"dir()\" is called on the object. A sequence '\n'must be\\n'\n' returned. \"dir()\" converts the returned sequence to a '\n'list and\\n'\n' sorts it.\\n'\n'\\n'\n'\\n'\n'Customizing module attribute access\\n'\n'-----------------------------------\\n'\n'\\n'\n'Special names \"__getattr__\" and \"__dir__\" can be also used '\n'to\\n'\n'customize access to module attributes. The \"__getattr__\" '\n'function at\\n'\n'the module level should accept one argument which is the '\n'name of an\\n'\n'attribute and return the computed value or raise an '\n'\"AttributeError\".\\n'\n'If an attribute is not found on a module object through the '\n'normal\\n'\n'lookup, i.e. \"object.__getattribute__()\", then \"__getattr__\" '\n'is\\n'\n'searched in the module \"__dict__\" before raising an '\n'\"AttributeError\".\\n'\n'If found, it is called with the attribute name and the '\n'result is\\n'\n'returned.\\n'\n'\\n'\n'The \"__dir__\" function should accept no arguments, and '\n'return a\\n'\n'sequence of strings that represents the names accessible on '\n'module. If\\n'\n'present, this function overrides the standard \"dir()\" search '\n'on a\\n'\n'module.\\n'\n'\\n'\n'For a more fine grained customization of the module behavior '\n'(setting\\n'\n'attributes, properties, etc.), one can set the \"__class__\" '\n'attribute\\n'\n'of a module object to a subclass of \"types.ModuleType\". For '\n'example:\\n'\n'\\n'\n' import sys\\n'\n' from types import ModuleType\\n'\n'\\n'\n' class VerboseModule(ModuleType):\\n'\n' def __repr__(self):\\n'\n\" return f'Verbose {self.__name__}'\\n\"\n'\\n'\n' def __setattr__(self, attr, value):\\n'\n\" print(f'Setting {attr}...')\\n\"\n' super().__setattr__(attr, value)\\n'\n'\\n'\n' sys.modules[__name__].__class__ = VerboseModule\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Defining module \"__getattr__\" and setting module '\n'\"__class__\" only\\n'\n' affect lookups made using the attribute access syntax \u2013 '\n'directly\\n'\n' accessing the module globals (whether by code within the '\n'module, or\\n'\n' via a reference to the module\u2019s globals dictionary) is '\n'unaffected.\\n'\n'\\n'\n'Changed in version 3.5: \"__class__\" module attribute is now '\n'writable.\\n'\n'\\n'\n'New in version 3.7: \"__getattr__\" and \"__dir__\" module '\n'attributes.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 562** - Module __getattr__ and __dir__\\n'\n' Describes the \"__getattr__\" and \"__dir__\" functions on '\n'modules.\\n'\n'\\n'\n'\\n'\n'Implementing Descriptors\\n'\n'------------------------\\n'\n'\\n'\n'The following methods only apply when an instance of the '\n'class\\n'\n'containing the method (a so-called *descriptor* class) '\n'appears in an\\n'\n'*owner* class (the descriptor must be in either the owner\u2019s '\n'class\\n'\n'dictionary or in the class dictionary for one of its '\n'parents). In the\\n'\n'examples below, \u201cthe attribute\u201d refers to the attribute '\n'whose name is\\n'\n'the key of the property in the owner class\u2019 \"__dict__\".\\n'\n'\\n'\n'object.__get__(self, instance, owner=None)\\n'\n'\\n'\n' Called to get the attribute of the owner class (class '\n'attribute\\n'\n' access) or of an instance of that class (instance '\n'attribute\\n'\n' access). The optional *owner* argument is the owner '\n'class, while\\n'\n' *instance* is the instance that the attribute was '\n'accessed through,\\n'\n' or \"None\" when the attribute is accessed through the '\n'*owner*.\\n'\n'\\n'\n' This method should return the computed attribute value or '\n'raise an\\n'\n' \"AttributeError\" exception.\\n'\n'\\n'\n' **PEP 252** specifies that \"__get__()\" is callable with '\n'one or two\\n'\n' arguments. Python\u2019s own built-in descriptors support '\n'this\\n'\n' specification; however, it is likely that some '\n'third-party tools\\n'\n' have descriptors that require both arguments. Python\u2019s '\n'own\\n'\n' \"__getattribute__()\" implementation always passes in both '\n'arguments\\n'\n' whether they are required or not.\\n'\n'\\n'\n'object.__set__(self, instance, value)\\n'\n'\\n'\n' Called to set the attribute on an instance *instance* of '\n'the owner\\n'\n' class to a new value, *value*.\\n'\n'\\n'\n' Note, adding \"__set__()\" or \"__delete__()\" changes the '\n'kind of\\n'\n' descriptor to a \u201cdata descriptor\u201d. See Invoking '\n'Descriptors for\\n'\n' more details.\\n'\n'\\n'\n'object.__delete__(self, instance)\\n'\n'\\n'\n' Called to delete the attribute on an instance *instance* '\n'of the\\n'\n' owner class.\\n'\n'\\n'\n'object.__set_name__(self, owner, name)\\n'\n'\\n'\n' Called at the time the owning class *owner* is created. '\n'The\\n'\n' descriptor has been assigned to *name*.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"__set_name__()\" is only called implicitly as part of '\n'the \"type\"\\n'\n' constructor, so it will need to be called explicitly '\n'with the\\n'\n' appropriate parameters when a descriptor is added to a '\n'class\\n'\n' after initial creation:\\n'\n'\\n'\n' class A:\\n'\n' pass\\n'\n' descr = custom_descriptor()\\n'\n' A.attr = descr\\n'\n\" descr.__set_name__(A, 'attr')\\n\"\n'\\n'\n' See Creating the class object for more details.\\n'\n'\\n'\n' New in version 3.6.\\n'\n'\\n'\n'The attribute \"__objclass__\" is interpreted by the \"inspect\" '\n'module as\\n'\n'specifying the class where this object was defined (setting '\n'this\\n'\n'appropriately can assist in runtime introspection of dynamic '\n'class\\n'\n'attributes). For callables, it may indicate that an instance '\n'of the\\n'\n'given type (or a subclass) is expected or required as the '\n'first\\n'\n'positional argument (for example, CPython sets this '\n'attribute for\\n'\n'unbound methods that are implemented in C).\\n'\n'\\n'\n'\\n'\n'Invoking Descriptors\\n'\n'--------------------\\n'\n'\\n'\n'In general, a descriptor is an object attribute with '\n'\u201cbinding\\n'\n'behavior\u201d, one whose attribute access has been overridden by '\n'methods\\n'\n'in the descriptor protocol: \"__get__()\", \"__set__()\", and\\n'\n'\"__delete__()\". If any of those methods are defined for an '\n'object, it\\n'\n'is said to be a descriptor.\\n'\n'\\n'\n'The default behavior for attribute access is to get, set, or '\n'delete\\n'\n'the attribute from an object\u2019s dictionary. For instance, '\n'\"a.x\" has a\\n'\n'lookup chain starting with \"a.__dict__[\\'x\\']\", then\\n'\n'\"type(a).__dict__[\\'x\\']\", and continuing through the base '\n'classes of\\n'\n'\"type(a)\" excluding metaclasses.\\n'\n'\\n'\n'However, if the looked-up value is an object defining one of '\n'the\\n'\n'descriptor methods, then Python may override the default '\n'behavior and\\n'\n'invoke the descriptor method instead. Where this occurs in '\n'the\\n'\n'precedence chain depends on which descriptor methods were '\n'defined and\\n'\n'how they were called.\\n'\n'\\n'\n'The starting point for descriptor invocation is a binding, '\n'\"a.x\". How\\n'\n'the arguments are assembled depends on \"a\":\\n'\n'\\n'\n'Direct Call\\n'\n' The simplest and least common call is when user code '\n'directly\\n'\n' invokes a descriptor method: \"x.__get__(a)\".\\n'\n'\\n'\n'Instance Binding\\n'\n' If binding to an object instance, \"a.x\" is transformed '\n'into the\\n'\n' call: \"type(a).__dict__[\\'x\\'].__get__(a, type(a))\".\\n'\n'\\n'\n'Class Binding\\n'\n' If binding to a class, \"A.x\" is transformed into the '\n'call:\\n'\n' \"A.__dict__[\\'x\\'].__get__(None, A)\".\\n'\n'\\n'\n'Super Binding\\n'\n' If \"a\" is an instance of \"super\", then the binding '\n'\"super(B,\\n'\n' obj).m()\" searches \"obj.__class__.__mro__\" for the base '\n'class \"A\"\\n'\n' immediately preceding \"B\" and then invokes the descriptor '\n'with the\\n'\n' call: \"A.__dict__[\\'m\\'].__get__(obj, obj.__class__)\".\\n'\n'\\n'\n'For instance bindings, the precedence of descriptor '\n'invocation depends\\n'\n'on which descriptor methods are defined. A descriptor can '\n'define any\\n'\n'combination of \"__get__()\", \"__set__()\" and \"__delete__()\". '\n'If it\\n'\n'does not define \"__get__()\", then accessing the attribute '\n'will return\\n'\n'the descriptor object itself unless there is a value in the '\n'object\u2019s\\n'\n'instance dictionary. If the descriptor defines \"__set__()\" '\n'and/or\\n'\n'\"__delete__()\", it is a data descriptor; if it defines '\n'neither, it is\\n'\n'a non-data descriptor. Normally, data descriptors define '\n'both\\n'\n'\"__get__()\" and \"__set__()\", while non-data descriptors have '\n'just the\\n'\n'\"__get__()\" method. Data descriptors with \"__get__()\" and '\n'\"__set__()\"\\n'\n'(and/or \"__delete__()\") defined always override a '\n'redefinition in an\\n'\n'instance dictionary. In contrast, non-data descriptors can '\n'be\\n'\n'overridden by instances.\\n'\n'\\n'\n'Python methods (including \"staticmethod()\" and '\n'\"classmethod()\") are\\n'\n'implemented as non-data descriptors. Accordingly, instances '\n'can\\n'\n'redefine and override methods. This allows individual '\n'instances to\\n'\n'acquire behaviors that differ from other instances of the '\n'same class.\\n'\n'\\n'\n'The \"property()\" function is implemented as a data '\n'descriptor.\\n'\n'Accordingly, instances cannot override the behavior of a '\n'property.\\n'\n'\\n'\n'\\n'\n'__slots__\\n'\n'---------\\n'\n'\\n'\n'*__slots__* allow us to explicitly declare data members '\n'(like\\n'\n'properties) and deny the creation of *__dict__* and '\n'*__weakref__*\\n'\n'(unless explicitly declared in *__slots__* or available in a '\n'parent.)\\n'\n'\\n'\n'The space saved over using *__dict__* can be significant. '\n'Attribute\\n'\n'lookup speed can be significantly improved as well.\\n'\n'\\n'\n'object.__slots__\\n'\n'\\n'\n' This class variable can be assigned a string, iterable, '\n'or sequence\\n'\n' of strings with variable names used by instances. '\n'*__slots__*\\n'\n' reserves space for the declared variables and prevents '\n'the\\n'\n' automatic creation of *__dict__* and *__weakref__* for '\n'each\\n'\n' instance.\\n'\n'\\n'\n'\\n'\n'Notes on using *__slots__*\\n'\n'~~~~~~~~~~~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'* When inheriting from a class without *__slots__*, the '\n'*__dict__* and\\n'\n' *__weakref__* attribute of the instances will always be '\n'accessible.\\n'\n'\\n'\n'* Without a *__dict__* variable, instances cannot be '\n'assigned new\\n'\n' variables not listed in the *__slots__* definition. '\n'Attempts to\\n'\n' assign to an unlisted variable name raises '\n'\"AttributeError\". If\\n'\n' dynamic assignment of new variables is desired, then add\\n'\n' \"\\'__dict__\\'\" to the sequence of strings in the '\n'*__slots__*\\n'\n' declaration.\\n'\n'\\n'\n'* Without a *__weakref__* variable for each instance, '\n'classes defining\\n'\n' *__slots__* do not support weak references to its '\n'instances. If weak\\n'\n' reference support is needed, then add \"\\'__weakref__\\'\" to '\n'the\\n'\n' sequence of strings in the *__slots__* declaration.\\n'\n'\\n'\n'* *__slots__* are implemented at the class level by '\n'creating\\n'\n' descriptors (Implementing Descriptors) for each variable '\n'name. As a\\n'\n' result, class attributes cannot be used to set default '\n'values for\\n'\n' instance variables defined by *__slots__*; otherwise, the '\n'class\\n'\n' attribute would overwrite the descriptor assignment.\\n'\n'\\n'\n'* The action of a *__slots__* declaration is not limited to '\n'the class\\n'\n' where it is defined. *__slots__* declared in parents are '\n'available\\n'\n' in child classes. However, child subclasses will get a '\n'*__dict__*\\n'\n' and *__weakref__* unless they also define *__slots__* '\n'(which should\\n'\n' only contain names of any *additional* slots).\\n'\n'\\n'\n'* If a class defines a slot also defined in a base class, '\n'the instance\\n'\n' variable defined by the base class slot is inaccessible '\n'(except by\\n'\n' retrieving its descriptor directly from the base class). '\n'This\\n'\n' renders the meaning of the program undefined. In the '\n'future, a\\n'\n' check may be added to prevent this.\\n'\n'\\n'\n'* Nonempty *__slots__* does not work for classes derived '\n'from\\n'\n' \u201cvariable-length\u201d built-in types such as \"int\", \"bytes\" '\n'and \"tuple\".\\n'\n'\\n'\n'* Any non-string iterable may be assigned to *__slots__*. '\n'Mappings may\\n'\n' also be used; however, in the future, special meaning may '\n'be\\n'\n' assigned to the values corresponding to each key.\\n'\n'\\n'\n'* *__class__* assignment works only if both classes have the '\n'same\\n'\n' *__slots__*.\\n'\n'\\n'\n'* Multiple inheritance with multiple slotted parent classes '\n'can be\\n'\n' used, but only one parent is allowed to have attributes '\n'created by\\n'\n' slots (the other bases must have empty slot layouts) - '\n'violations\\n'\n' raise \"TypeError\".\\n'\n'\\n'\n'* If an iterator is used for *__slots__* then a descriptor '\n'is created\\n'\n' for each of the iterator\u2019s values. However, the '\n'*__slots__*\\n'\n' attribute will be an empty iterator.\\n'\n'\\n'\n'\\n'\n'Customizing class creation\\n'\n'==========================\\n'\n'\\n'\n'Whenever a class inherits from another class, '\n'*__init_subclass__* is\\n'\n'called on that class. This way, it is possible to write '\n'classes which\\n'\n'change the behavior of subclasses. This is closely related '\n'to class\\n'\n'decorators, but where class decorators only affect the '\n'specific class\\n'\n'they\u2019re applied to, \"__init_subclass__\" solely applies to '\n'future\\n'\n'subclasses of the class defining the method.\\n'\n'\\n'\n'classmethod object.__init_subclass__(cls)\\n'\n'\\n'\n' This method is called whenever the containing class is '\n'subclassed.\\n'\n' *cls* is then the new subclass. If defined as a normal '\n'instance\\n'\n' method, this method is implicitly converted to a class '\n'method.\\n'\n'\\n'\n' Keyword arguments which are given to a new class are '\n'passed to the\\n'\n' parent\u2019s class \"__init_subclass__\". For compatibility '\n'with other\\n'\n' classes using \"__init_subclass__\", one should take out '\n'the needed\\n'\n' keyword arguments and pass the others over to the base '\n'class, as\\n'\n' in:\\n'\n'\\n'\n' class Philosopher:\\n'\n' def __init_subclass__(cls, /, default_name, '\n'**kwargs):\\n'\n' super().__init_subclass__(**kwargs)\\n'\n' cls.default_name = default_name\\n'\n'\\n'\n' class AustralianPhilosopher(Philosopher, '\n'default_name=\"Bruce\"):\\n'\n' pass\\n'\n'\\n'\n' The default implementation \"object.__init_subclass__\" '\n'does nothing,\\n'\n' but raises an error if it is called with any arguments.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The metaclass hint \"metaclass\" is consumed by the rest '\n'of the\\n'\n' type machinery, and is never passed to '\n'\"__init_subclass__\"\\n'\n' implementations. The actual metaclass (rather than the '\n'explicit\\n'\n' hint) can be accessed as \"type(cls)\".\\n'\n'\\n'\n' New in version 3.6.\\n'\n'\\n'\n'\\n'\n'Metaclasses\\n'\n'-----------\\n'\n'\\n'\n'By default, classes are constructed using \"type()\". The '\n'class body is\\n'\n'executed in a new namespace and the class name is bound '\n'locally to the\\n'\n'result of \"type(name, bases, namespace)\".\\n'\n'\\n'\n'The class creation process can be customized by passing the\\n'\n'\"metaclass\" keyword argument in the class definition line, '\n'or by\\n'\n'inheriting from an existing class that included such an '\n'argument. In\\n'\n'the following example, both \"MyClass\" and \"MySubclass\" are '\n'instances\\n'\n'of \"Meta\":\\n'\n'\\n'\n' class Meta(type):\\n'\n' pass\\n'\n'\\n'\n' class MyClass(metaclass=Meta):\\n'\n' pass\\n'\n'\\n'\n' class MySubclass(MyClass):\\n'\n' pass\\n'\n'\\n'\n'Any other keyword arguments that are specified in the class '\n'definition\\n'\n'are passed through to all metaclass operations described '\n'below.\\n'\n'\\n'\n'When a class definition is executed, the following steps '\n'occur:\\n'\n'\\n'\n'* MRO entries are resolved;\\n'\n'\\n'\n'* the appropriate metaclass is determined;\\n'\n'\\n'\n'* the class namespace is prepared;\\n'\n'\\n'\n'* the class body is executed;\\n'\n'\\n'\n'* the class object is created.\\n'\n'\\n'\n'\\n'\n'Resolving MRO entries\\n'\n'---------------------\\n'\n'\\n'\n'If a base that appears in class definition is not an '\n'instance of\\n'\n'\"type\", then an \"__mro_entries__\" method is searched on it. '\n'If found,\\n'\n'it is called with the original bases tuple. This method must '\n'return a\\n'\n'tuple of classes that will be used instead of this base. The '\n'tuple may\\n'\n'be empty, in such case the original base is ignored.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 560** - Core support for typing module and generic '\n'types\\n'\n'\\n'\n'\\n'\n'Determining the appropriate metaclass\\n'\n'-------------------------------------\\n'\n'\\n'\n'The appropriate metaclass for a class definition is '\n'determined as\\n'\n'follows:\\n'\n'\\n'\n'* if no bases and no explicit metaclass are given, then '\n'\"type()\" is\\n'\n' used;\\n'\n'\\n'\n'* if an explicit metaclass is given and it is *not* an '\n'instance of\\n'\n' \"type()\", then it is used directly as the metaclass;\\n'\n'\\n'\n'* if an instance of \"type()\" is given as the explicit '\n'metaclass, or\\n'\n' bases are defined, then the most derived metaclass is '\n'used.\\n'\n'\\n'\n'The most derived metaclass is selected from the explicitly '\n'specified\\n'\n'metaclass (if any) and the metaclasses (i.e. \"type(cls)\") of '\n'all\\n'\n'specified base classes. The most derived metaclass is one '\n'which is a\\n'\n'subtype of *all* of these candidate metaclasses. If none of '\n'the\\n'\n'candidate metaclasses meets that criterion, then the class '\n'definition\\n'\n'will fail with \"TypeError\".\\n'\n'\\n'\n'\\n'\n'Preparing the class namespace\\n'\n'-----------------------------\\n'\n'\\n'\n'Once the appropriate metaclass has been identified, then the '\n'class\\n'\n'namespace is prepared. If the metaclass has a \"__prepare__\" '\n'attribute,\\n'\n'it is called as \"namespace = metaclass.__prepare__(name, '\n'bases,\\n'\n'**kwds)\" (where the additional keyword arguments, if any, '\n'come from\\n'\n'the class definition). The \"__prepare__\" method should be '\n'implemented\\n'\n'as a \"classmethod()\". The namespace returned by '\n'\"__prepare__\" is\\n'\n'passed in to \"__new__\", but when the final class object is '\n'created the\\n'\n'namespace is copied into a new \"dict\".\\n'\n'\\n'\n'If the metaclass has no \"__prepare__\" attribute, then the '\n'class\\n'\n'namespace is initialised as an empty ordered mapping.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3115** - Metaclasses in Python 3000\\n'\n' Introduced the \"__prepare__\" namespace hook\\n'\n'\\n'\n'\\n'\n'Executing the class body\\n'\n'------------------------\\n'\n'\\n'\n'The class body is executed (approximately) as \"exec(body, '\n'globals(),\\n'\n'namespace)\". The key difference from a normal call to '\n'\"exec()\" is that\\n'\n'lexical scoping allows the class body (including any '\n'methods) to\\n'\n'reference names from the current and outer scopes when the '\n'class\\n'\n'definition occurs inside a function.\\n'\n'\\n'\n'However, even when the class definition occurs inside the '\n'function,\\n'\n'methods defined inside the class still cannot see names '\n'defined at the\\n'\n'class scope. Class variables must be accessed through the '\n'first\\n'\n'parameter of instance or class methods, or through the '\n'implicit\\n'\n'lexically scoped \"__class__\" reference described in the next '\n'section.\\n'\n'\\n'\n'\\n'\n'Creating the class object\\n'\n'-------------------------\\n'\n'\\n'\n'Once the class namespace has been populated by executing the '\n'class\\n'\n'body, the class object is created by calling '\n'\"metaclass(name, bases,\\n'\n'namespace, **kwds)\" (the additional keywords passed here are '\n'the same\\n'\n'as those passed to \"__prepare__\").\\n'\n'\\n'\n'This class object is the one that will be referenced by the '\n'zero-\\n'\n'argument form of \"super()\". \"__class__\" is an implicit '\n'closure\\n'\n'reference created by the compiler if any methods in a class '\n'body refer\\n'\n'to either \"__class__\" or \"super\". This allows the zero '\n'argument form\\n'\n'of \"super()\" to correctly identify the class being defined '\n'based on\\n'\n'lexical scoping, while the class or instance that was used '\n'to make the\\n'\n'current call is identified based on the first argument '\n'passed to the\\n'\n'method.\\n'\n'\\n'\n'**CPython implementation detail:** In CPython 3.6 and later, '\n'the\\n'\n'\"__class__\" cell is passed to the metaclass as a '\n'\"__classcell__\" entry\\n'\n'in the class namespace. If present, this must be propagated '\n'up to the\\n'\n'\"type.__new__\" call in order for the class to be '\n'initialised\\n'\n'correctly. Failing to do so will result in a \"RuntimeError\" '\n'in Python\\n'\n'3.8.\\n'\n'\\n'\n'When using the default metaclass \"type\", or any metaclass '\n'that\\n'\n'ultimately calls \"type.__new__\", the following additional\\n'\n'customisation steps are invoked after creating the class '\n'object:\\n'\n'\\n'\n'* first, \"type.__new__\" collects all of the descriptors in '\n'the class\\n'\n' namespace that define a \"__set_name__()\" method;\\n'\n'\\n'\n'* second, all of these \"__set_name__\" methods are called '\n'with the\\n'\n' class being defined and the assigned name of that '\n'particular\\n'\n' descriptor;\\n'\n'\\n'\n'* finally, the \"__init_subclass__()\" hook is called on the '\n'immediate\\n'\n' parent of the new class in its method resolution order.\\n'\n'\\n'\n'After the class object is created, it is passed to the '\n'class\\n'\n'decorators included in the class definition (if any) and the '\n'resulting\\n'\n'object is bound in the local namespace as the defined '\n'class.\\n'\n'\\n'\n'When a new class is created by \"type.__new__\", the object '\n'provided as\\n'\n'the namespace parameter is copied to a new ordered mapping '\n'and the\\n'\n'original object is discarded. The new copy is wrapped in a '\n'read-only\\n'\n'proxy, which becomes the \"__dict__\" attribute of the class '\n'object.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3135** - New super\\n'\n' Describes the implicit \"__class__\" closure reference\\n'\n'\\n'\n'\\n'\n'Uses for metaclasses\\n'\n'--------------------\\n'\n'\\n'\n'The potential uses for metaclasses are boundless. Some ideas '\n'that have\\n'\n'been explored include enum, logging, interface checking, '\n'automatic\\n'\n'delegation, automatic property creation, proxies, '\n'frameworks, and\\n'\n'automatic resource locking/synchronization.\\n'\n'\\n'\n'\\n'\n'Customizing instance and subclass checks\\n'\n'========================================\\n'\n'\\n'\n'The following methods are used to override the default '\n'behavior of the\\n'\n'\"isinstance()\" and \"issubclass()\" built-in functions.\\n'\n'\\n'\n'In particular, the metaclass \"abc.ABCMeta\" implements these '\n'methods in\\n'\n'order to allow the addition of Abstract Base Classes (ABCs) '\n'as\\n'\n'\u201cvirtual base classes\u201d to any class or type (including '\n'built-in\\n'\n'types), including other ABCs.\\n'\n'\\n'\n'class.__instancecheck__(self, instance)\\n'\n'\\n'\n' Return true if *instance* should be considered a (direct '\n'or\\n'\n' indirect) instance of *class*. If defined, called to '\n'implement\\n'\n' \"isinstance(instance, class)\".\\n'\n'\\n'\n'class.__subclasscheck__(self, subclass)\\n'\n'\\n'\n' Return true if *subclass* should be considered a (direct '\n'or\\n'\n' indirect) subclass of *class*. If defined, called to '\n'implement\\n'\n' \"issubclass(subclass, class)\".\\n'\n'\\n'\n'Note that these methods are looked up on the type '\n'(metaclass) of a\\n'\n'class. They cannot be defined as class methods in the '\n'actual class.\\n'\n'This is consistent with the lookup of special methods that '\n'are called\\n'\n'on instances, only in this case the instance is itself a '\n'class.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3119** - Introducing Abstract Base Classes\\n'\n' Includes the specification for customizing '\n'\"isinstance()\" and\\n'\n' \"issubclass()\" behavior through \"__instancecheck__()\" '\n'and\\n'\n' \"__subclasscheck__()\", with motivation for this '\n'functionality in\\n'\n' the context of adding Abstract Base Classes (see the '\n'\"abc\"\\n'\n' module) to the language.\\n'\n'\\n'\n'\\n'\n'Emulating generic types\\n'\n'=======================\\n'\n'\\n'\n'One can implement the generic class syntax as specified by '\n'**PEP 484**\\n'\n'(for example \"List[int]\") by defining a special method:\\n'\n'\\n'\n'classmethod object.__class_getitem__(cls, key)\\n'\n'\\n'\n' Return an object representing the specialization of a '\n'generic class\\n'\n' by type arguments found in *key*.\\n'\n'\\n'\n'This method is looked up on the class object itself, and '\n'when defined\\n'\n'in the class body, this method is implicitly a class '\n'method. Note,\\n'\n'this mechanism is primarily reserved for use with static '\n'type hints,\\n'\n'other usage is discouraged.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 560** - Core support for typing module and generic '\n'types\\n'\n'\\n'\n'\\n'\n'Emulating callable objects\\n'\n'==========================\\n'\n'\\n'\n'object.__call__(self[, args...])\\n'\n'\\n'\n' Called when the instance is \u201ccalled\u201d as a function; if '\n'this method\\n'\n' is defined, \"x(arg1, arg2, ...)\" roughly translates to\\n'\n' \"type(x).__call__(x, arg1, ...)\".\\n'\n'\\n'\n'\\n'\n'Emulating container types\\n'\n'=========================\\n'\n'\\n'\n'The following methods can be defined to implement container '\n'objects.\\n'\n'Containers usually are sequences (such as lists or tuples) '\n'or mappings\\n'\n'(like dictionaries), but can represent other containers as '\n'well. The\\n'\n'first set of methods is used either to emulate a sequence or '\n'to\\n'\n'emulate a mapping; the difference is that for a sequence, '\n'the\\n'\n'allowable keys should be the integers *k* for which \"0 <= k '\n'< N\" where\\n'\n'*N* is the length of the sequence, or slice objects, which '\n'define a\\n'\n'range of items. It is also recommended that mappings '\n'provide the\\n'\n'methods \"keys()\", \"values()\", \"items()\", \"get()\", '\n'\"clear()\",\\n'\n'\"setdefault()\", \"pop()\", \"popitem()\", \"copy()\", and '\n'\"update()\"\\n'\n'behaving similar to those for Python\u2019s standard dictionary '\n'objects.\\n'\n'The \"collections.abc\" module provides a \"MutableMapping\" '\n'abstract base\\n'\n'class to help create those methods from a base set of '\n'\"__getitem__()\",\\n'\n'\"__setitem__()\", \"__delitem__()\", and \"keys()\". Mutable '\n'sequences\\n'\n'should provide methods \"append()\", \"count()\", \"index()\", '\n'\"extend()\",\\n'\n'\"insert()\", \"pop()\", \"remove()\", \"reverse()\" and \"sort()\", '\n'like Python\\n'\n'standard list objects. Finally, sequence types should '\n'implement\\n'\n'addition (meaning concatenation) and multiplication '\n'(meaning\\n'\n'repetition) by defining the methods \"__add__()\", '\n'\"__radd__()\",\\n'\n'\"__iadd__()\", \"__mul__()\", \"__rmul__()\" and \"__imul__()\" '\n'described\\n'\n'below; they should not define other numerical operators. It '\n'is\\n'\n'recommended that both mappings and sequences implement the\\n'\n'\"__contains__()\" method to allow efficient use of the \"in\" '\n'operator;\\n'\n'for mappings, \"in\" should search the mapping\u2019s keys; for '\n'sequences, it\\n'\n'should search through the values. It is further recommended '\n'that both\\n'\n'mappings and sequences implement the \"__iter__()\" method to '\n'allow\\n'\n'efficient iteration through the container; for mappings, '\n'\"__iter__()\"\\n'\n'should iterate through the object\u2019s keys; for sequences, it '\n'should\\n'\n'iterate through the values.\\n'\n'\\n'\n'object.__len__(self)\\n'\n'\\n'\n' Called to implement the built-in function \"len()\". '\n'Should return\\n'\n' the length of the object, an integer \">=\" 0. Also, an '\n'object that\\n'\n' doesn\u2019t define a \"__bool__()\" method and whose '\n'\"__len__()\" method\\n'\n' returns zero is considered to be false in a Boolean '\n'context.\\n'\n'\\n'\n' **CPython implementation detail:** In CPython, the length '\n'is\\n'\n' required to be at most \"sys.maxsize\". If the length is '\n'larger than\\n'\n' \"sys.maxsize\" some features (such as \"len()\") may raise\\n'\n' \"OverflowError\". To prevent raising \"OverflowError\" by '\n'truth value\\n'\n' testing, an object must define a \"__bool__()\" method.\\n'\n'\\n'\n'object.__length_hint__(self)\\n'\n'\\n'\n' Called to implement \"operator.length_hint()\". Should '\n'return an\\n'\n' estimated length for the object (which may be greater or '\n'less than\\n'\n' the actual length). The length must be an integer \">=\" 0. '\n'The\\n'\n' return value may also be \"NotImplemented\", which is '\n'treated the\\n'\n' same as if the \"__length_hint__\" method didn\u2019t exist at '\n'all. This\\n'\n' method is purely an optimization and is never required '\n'for\\n'\n' correctness.\\n'\n'\\n'\n' New in version 3.4.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Slicing is done exclusively with the following three '\n'methods. A\\n'\n' call like\\n'\n'\\n'\n' a[1:2] = b\\n'\n'\\n'\n' is translated to\\n'\n'\\n'\n' a[slice(1, 2, None)] = b\\n'\n'\\n'\n' and so forth. Missing slice items are always filled in '\n'with \"None\".\\n'\n'\\n'\n'object.__getitem__(self, key)\\n'\n'\\n'\n' Called to implement evaluation of \"self[key]\". For '\n'sequence types,\\n'\n' the accepted keys should be integers and slice objects. '\n'Note that\\n'\n' the special interpretation of negative indexes (if the '\n'class wishes\\n'\n' to emulate a sequence type) is up to the \"__getitem__()\" '\n'method. If\\n'\n' *key* is of an inappropriate type, \"TypeError\" may be '\n'raised; if of\\n'\n' a value outside the set of indexes for the sequence '\n'(after any\\n'\n' special interpretation of negative values), \"IndexError\" '\n'should be\\n'\n' raised. For mapping types, if *key* is missing (not in '\n'the\\n'\n' container), \"KeyError\" should be raised.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"for\" loops expect that an \"IndexError\" will be raised '\n'for\\n'\n' illegal indexes to allow proper detection of the end of '\n'the\\n'\n' sequence.\\n'\n'\\n'\n'object.__setitem__(self, key, value)\\n'\n'\\n'\n' Called to implement assignment to \"self[key]\". Same note '\n'as for\\n'\n' \"__getitem__()\". This should only be implemented for '\n'mappings if\\n'\n' the objects support changes to the values for keys, or if '\n'new keys\\n'\n' can be added, or for sequences if elements can be '\n'replaced. The\\n'\n' same exceptions should be raised for improper *key* '\n'values as for\\n'\n' the \"__getitem__()\" method.\\n'\n'\\n'\n'object.__delitem__(self, key)\\n'\n'\\n'\n' Called to implement deletion of \"self[key]\". Same note '\n'as for\\n'\n' \"__getitem__()\". This should only be implemented for '\n'mappings if\\n'\n' the objects support removal of keys, or for sequences if '\n'elements\\n'\n' can be removed from the sequence. The same exceptions '\n'should be\\n'\n' raised for improper *key* values as for the '\n'\"__getitem__()\" method.\\n'\n'\\n'\n'object.__missing__(self, key)\\n'\n'\\n'\n' Called by \"dict\".\"__getitem__()\" to implement \"self[key]\" '\n'for dict\\n'\n' subclasses when key is not in the dictionary.\\n'\n'\\n'\n'object.__iter__(self)\\n'\n'\\n'\n' This method is called when an iterator is required for a '\n'container.\\n'\n' This method should return a new iterator object that can '\n'iterate\\n'\n' over all the objects in the container. For mappings, it '\n'should\\n'\n' iterate over the keys of the container.\\n'\n'\\n'\n' Iterator objects also need to implement this method; they '\n'are\\n'\n' required to return themselves. For more information on '\n'iterator\\n'\n' objects, see Iterator Types.\\n'\n'\\n'\n'object.__reversed__(self)\\n'\n'\\n'\n' Called (if present) by the \"reversed()\" built-in to '\n'implement\\n'\n' reverse iteration. It should return a new iterator '\n'object that\\n'\n' iterates over all the objects in the container in reverse '\n'order.\\n'\n'\\n'\n' If the \"__reversed__()\" method is not provided, the '\n'\"reversed()\"\\n'\n' built-in will fall back to using the sequence protocol '\n'(\"__len__()\"\\n'\n' and \"__getitem__()\"). Objects that support the sequence '\n'protocol\\n'\n' should only provide \"__reversed__()\" if they can provide '\n'an\\n'\n' implementation that is more efficient than the one '\n'provided by\\n'\n' \"reversed()\".\\n'\n'\\n'\n'The membership test operators (\"in\" and \"not in\") are '\n'normally\\n'\n'implemented as an iteration through a container. However, '\n'container\\n'\n'objects can supply the following special method with a more '\n'efficient\\n'\n'implementation, which also does not require the object be '\n'iterable.\\n'\n'\\n'\n'object.__contains__(self, item)\\n'\n'\\n'\n' Called to implement membership test operators. Should '\n'return true\\n'\n' if *item* is in *self*, false otherwise. For mapping '\n'objects, this\\n'\n' should consider the keys of the mapping rather than the '\n'values or\\n'\n' the key-item pairs.\\n'\n'\\n'\n' For objects that don\u2019t define \"__contains__()\", the '\n'membership test\\n'\n' first tries iteration via \"__iter__()\", then the old '\n'sequence\\n'\n' iteration protocol via \"__getitem__()\", see this section '\n'in the\\n'\n' language reference.\\n'\n'\\n'\n'\\n'\n'Emulating numeric types\\n'\n'=======================\\n'\n'\\n'\n'The following methods can be defined to emulate numeric '\n'objects.\\n'\n'Methods corresponding to operations that are not supported '\n'by the\\n'\n'particular kind of number implemented (e.g., bitwise '\n'operations for\\n'\n'non-integral numbers) should be left undefined.\\n'\n'\\n'\n'object.__add__(self, other)\\n'\n'object.__sub__(self, other)\\n'\n'object.__mul__(self, other)\\n'\n'object.__matmul__(self, other)\\n'\n'object.__truediv__(self, other)\\n'\n'object.__floordiv__(self, other)\\n'\n'object.__mod__(self, other)\\n'\n'object.__divmod__(self, other)\\n'\n'object.__pow__(self, other[, modulo])\\n'\n'object.__lshift__(self, other)\\n'\n'object.__rshift__(self, other)\\n'\n'object.__and__(self, other)\\n'\n'object.__xor__(self, other)\\n'\n'object.__or__(self, other)\\n'\n'\\n'\n' These methods are called to implement the binary '\n'arithmetic\\n'\n' operations (\"+\", \"-\", \"*\", \"@\", \"/\", \"//\", \"%\", '\n'\"divmod()\",\\n'\n' \"pow()\", \"**\", \"<<\", \">>\", \"&\", \"^\", \"|\"). For instance, '\n'to\\n'\n' evaluate the expression \"x + y\", where *x* is an instance '\n'of a\\n'\n' class that has an \"__add__()\" method, \"x.__add__(y)\" is '\n'called.\\n'\n' The \"__divmod__()\" method should be the equivalent to '\n'using\\n'\n' \"__floordiv__()\" and \"__mod__()\"; it should not be '\n'related to\\n'\n' \"__truediv__()\". Note that \"__pow__()\" should be defined '\n'to accept\\n'\n' an optional third argument if the ternary version of the '\n'built-in\\n'\n' \"pow()\" function is to be supported.\\n'\n'\\n'\n' If one of those methods does not support the operation '\n'with the\\n'\n' supplied arguments, it should return \"NotImplemented\".\\n'\n'\\n'\n'object.__radd__(self, other)\\n'\n'object.__rsub__(self, other)\\n'\n'object.__rmul__(self, other)\\n'\n'object.__rmatmul__(self, other)\\n'\n'object.__rtruediv__(self, other)\\n'\n'object.__rfloordiv__(self, other)\\n'\n'object.__rmod__(self, other)\\n'\n'object.__rdivmod__(self, other)\\n'\n'object.__rpow__(self, other[, modulo])\\n'\n'object.__rlshift__(self, other)\\n'\n'object.__rrshift__(self, other)\\n'\n'object.__rand__(self, other)\\n'\n'object.__rxor__(self, other)\\n'\n'object.__ror__(self, other)\\n'\n'\\n'\n' These methods are called to implement the binary '\n'arithmetic\\n'\n' operations (\"+\", \"-\", \"*\", \"@\", \"/\", \"//\", \"%\", '\n'\"divmod()\",\\n'\n' \"pow()\", \"**\", \"<<\", \">>\", \"&\", \"^\", \"|\") with reflected '\n'(swapped)\\n'\n' operands. These functions are only called if the left '\n'operand does\\n'\n' not support the corresponding operation [3] and the '\n'operands are of\\n'\n' different types. [4] For instance, to evaluate the '\n'expression \"x -\\n'\n' y\", where *y* is an instance of a class that has an '\n'\"__rsub__()\"\\n'\n' method, \"y.__rsub__(x)\" is called if \"x.__sub__(y)\" '\n'returns\\n'\n' *NotImplemented*.\\n'\n'\\n'\n' Note that ternary \"pow()\" will not try calling '\n'\"__rpow__()\" (the\\n'\n' coercion rules would become too complicated).\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' If the right operand\u2019s type is a subclass of the left '\n'operand\u2019s\\n'\n' type and that subclass provides a different '\n'implementation of the\\n'\n' reflected method for the operation, this method will be '\n'called\\n'\n' before the left operand\u2019s non-reflected method. This '\n'behavior\\n'\n' allows subclasses to override their ancestors\u2019 '\n'operations.\\n'\n'\\n'\n'object.__iadd__(self, other)\\n'\n'object.__isub__(self, other)\\n'\n'object.__imul__(self, other)\\n'\n'object.__imatmul__(self, other)\\n'\n'object.__itruediv__(self, other)\\n'\n'object.__ifloordiv__(self, other)\\n'\n'object.__imod__(self, other)\\n'\n'object.__ipow__(self, other[, modulo])\\n'\n'object.__ilshift__(self, other)\\n'\n'object.__irshift__(self, other)\\n'\n'object.__iand__(self, other)\\n'\n'object.__ixor__(self, other)\\n'\n'object.__ior__(self, other)\\n'\n'\\n'\n' These methods are called to implement the augmented '\n'arithmetic\\n'\n' assignments (\"+=\", \"-=\", \"*=\", \"@=\", \"/=\", \"//=\", \"%=\", '\n'\"**=\",\\n'\n' \"<<=\", \">>=\", \"&=\", \"^=\", \"|=\"). These methods should '\n'attempt to\\n'\n' do the operation in-place (modifying *self*) and return '\n'the result\\n'\n' (which could be, but does not have to be, *self*). If a '\n'specific\\n'\n' method is not defined, the augmented assignment falls '\n'back to the\\n'\n' normal methods. For instance, if *x* is an instance of a '\n'class\\n'\n' with an \"__iadd__()\" method, \"x += y\" is equivalent to \"x '\n'=\\n'\n' x.__iadd__(y)\" . Otherwise, \"x.__add__(y)\" and '\n'\"y.__radd__(x)\" are\\n'\n' considered, as with the evaluation of \"x + y\". In '\n'certain\\n'\n' situations, augmented assignment can result in unexpected '\n'errors\\n'\n' (see Why does a_tuple[i] += [\u2018item\u2019] raise an exception '\n'when the\\n'\n' addition works?), but this behavior is in fact part of '\n'the data\\n'\n' model.\\n'\n'\\n'\n'object.__neg__(self)\\n'\n'object.__pos__(self)\\n'\n'object.__abs__(self)\\n'\n'object.__invert__(self)\\n'\n'\\n'\n' Called to implement the unary arithmetic operations (\"-\", '\n'\"+\",\\n'\n' \"abs()\" and \"~\").\\n'\n'\\n'\n'object.__complex__(self)\\n'\n'object.__int__(self)\\n'\n'object.__float__(self)\\n'\n'\\n'\n' Called to implement the built-in functions \"complex()\", '\n'\"int()\" and\\n'\n' \"float()\". Should return a value of the appropriate '\n'type.\\n'\n'\\n'\n'object.__index__(self)\\n'\n'\\n'\n' Called to implement \"operator.index()\", and whenever '\n'Python needs\\n'\n' to losslessly convert the numeric object to an integer '\n'object (such\\n'\n' as in slicing, or in the built-in \"bin()\", \"hex()\" and '\n'\"oct()\"\\n'\n' functions). Presence of this method indicates that the '\n'numeric\\n'\n' object is an integer type. Must return an integer.\\n'\n'\\n'\n' If \"__int__()\", \"__float__()\" and \"__complex__()\" are not '\n'defined\\n'\n' then corresponding built-in functions \"int()\", \"float()\" '\n'and\\n'\n' \"complex()\" fall back to \"__index__()\".\\n'\n'\\n'\n'object.__round__(self[, ndigits])\\n'\n'object.__trunc__(self)\\n'\n'object.__floor__(self)\\n'\n'object.__ceil__(self)\\n'\n'\\n'\n' Called to implement the built-in function \"round()\" and '\n'\"math\"\\n'\n' functions \"trunc()\", \"floor()\" and \"ceil()\". Unless '\n'*ndigits* is\\n'\n' passed to \"__round__()\" all these methods should return '\n'the value\\n'\n' of the object truncated to an \"Integral\" (typically an '\n'\"int\").\\n'\n'\\n'\n' If \"__int__()\" is not defined then the built-in function '\n'\"int()\"\\n'\n' falls back to \"__trunc__()\".\\n'\n'\\n'\n'\\n'\n'With Statement Context Managers\\n'\n'===============================\\n'\n'\\n'\n'A *context manager* is an object that defines the runtime '\n'context to\\n'\n'be established when executing a \"with\" statement. The '\n'context manager\\n'\n'handles the entry into, and the exit from, the desired '\n'runtime context\\n'\n'for the execution of the block of code. Context managers '\n'are normally\\n'\n'invoked using the \"with\" statement (described in section The '\n'with\\n'\n'statement), but can also be used by directly invoking their '\n'methods.\\n'\n'\\n'\n'Typical uses of context managers include saving and '\n'restoring various\\n'\n'kinds of global state, locking and unlocking resources, '\n'closing opened\\n'\n'files, etc.\\n'\n'\\n'\n'For more information on context managers, see Context '\n'Manager Types.\\n'\n'\\n'\n'object.__enter__(self)\\n'\n'\\n'\n' Enter the runtime context related to this object. The '\n'\"with\"\\n'\n' statement will bind this method\u2019s return value to the '\n'target(s)\\n'\n' specified in the \"as\" clause of the statement, if any.\\n'\n'\\n'\n'object.__exit__(self, exc_type, exc_value, traceback)\\n'\n'\\n'\n' Exit the runtime context related to this object. The '\n'parameters\\n'\n' describe the exception that caused the context to be '\n'exited. If the\\n'\n' context was exited without an exception, all three '\n'arguments will\\n'\n' be \"None\".\\n'\n'\\n'\n' If an exception is supplied, and the method wishes to '\n'suppress the\\n'\n' exception (i.e., prevent it from being propagated), it '\n'should\\n'\n' return a true value. Otherwise, the exception will be '\n'processed\\n'\n' normally upon exit from this method.\\n'\n'\\n'\n' Note that \"__exit__()\" methods should not reraise the '\n'passed-in\\n'\n' exception; this is the caller\u2019s responsibility.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 343** - The \u201cwith\u201d statement\\n'\n' The specification, background, and examples for the '\n'Python \"with\"\\n'\n' statement.\\n'\n'\\n'\n'\\n'\n'Customizing positional arguments in class pattern matching\\n'\n'==========================================================\\n'\n'\\n'\n'When using a class name in a pattern, positional arguments '\n'in the\\n'\n'pattern are not allowed by default, i.e. \"case MyClass(x, '\n'y)\" is\\n'\n'typically invalid without special support in \"MyClass\". To '\n'be able to\\n'\n'use that kind of patterns, the class needs to define a\\n'\n'*__match_args__* attribute.\\n'\n'\\n'\n'object.__match_args__\\n'\n'\\n'\n' This class variable can be assigned a tuple of strings. '\n'When this\\n'\n' class is used in a class pattern with positional '\n'arguments, each\\n'\n' positional argument will be converted into a keyword '\n'argument,\\n'\n' using the corresponding value in *__match_args__* as the '\n'keyword.\\n'\n' The absence of this attribute is equivalent to setting it '\n'to \"()\".\\n'\n'\\n'\n'For example, if \"MyClass.__match_args__\" is \"(\"left\", '\n'\"center\",\\n'\n'\"right\")\" that means that \"case MyClass(x, y)\" is equivalent '\n'to \"case\\n'\n'MyClass(left=x, center=y)\". Note that the number of '\n'arguments in the\\n'\n'pattern must be smaller than or equal to the number of '\n'elements in\\n'\n'*__match_args__*; if it is larger, the pattern match attempt '\n'will\\n'\n'raise a \"TypeError\".\\n'\n'\\n'\n'New in version 3.10.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 634** - Structural Pattern Matching\\n'\n' The specification for the Python \"match\" statement.\\n'\n'\\n'\n'\\n'\n'Special method lookup\\n'\n'=====================\\n'\n'\\n'\n'For custom classes, implicit invocations of special methods '\n'are only\\n'\n'guaranteed to work correctly if defined on an object\u2019s type, '\n'not in\\n'\n'the object\u2019s instance dictionary. That behaviour is the '\n'reason why\\n'\n'the following code raises an exception:\\n'\n'\\n'\n' >>> class C:\\n'\n' ... pass\\n'\n' ...\\n'\n' >>> c = C()\\n'\n' >>> c.__len__ = lambda: 5\\n'\n' >>> len(c)\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n\" TypeError: object of type 'C' has no len()\\n\"\n'\\n'\n'The rationale behind this behaviour lies with a number of '\n'special\\n'\n'methods such as \"__hash__()\" and \"__repr__()\" that are '\n'implemented by\\n'\n'all objects, including type objects. If the implicit lookup '\n'of these\\n'\n'methods used the conventional lookup process, they would '\n'fail when\\n'\n'invoked on the type object itself:\\n'\n'\\n'\n' >>> 1 .__hash__() == hash(1)\\n'\n' True\\n'\n' >>> int.__hash__() == hash(int)\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n\" TypeError: descriptor '__hash__' of 'int' object needs an \"\n'argument\\n'\n'\\n'\n'Incorrectly attempting to invoke an unbound method of a '\n'class in this\\n'\n'way is sometimes referred to as \u2018metaclass confusion\u2019, and '\n'is avoided\\n'\n'by bypassing the instance when looking up special methods:\\n'\n'\\n'\n' >>> type(1).__hash__(1) == hash(1)\\n'\n' True\\n'\n' >>> type(int).__hash__(int) == hash(int)\\n'\n' True\\n'\n'\\n'\n'In addition to bypassing any instance attributes in the '\n'interest of\\n'\n'correctness, implicit special method lookup generally also '\n'bypasses\\n'\n'the \"__getattribute__()\" method even of the object\u2019s '\n'metaclass:\\n'\n'\\n'\n' >>> class Meta(type):\\n'\n' ... def __getattribute__(*args):\\n'\n' ... print(\"Metaclass getattribute invoked\")\\n'\n' ... return type.__getattribute__(*args)\\n'\n' ...\\n'\n' >>> class C(object, metaclass=Meta):\\n'\n' ... def __len__(self):\\n'\n' ... return 10\\n'\n' ... def __getattribute__(*args):\\n'\n' ... print(\"Class getattribute invoked\")\\n'\n' ... return object.__getattribute__(*args)\\n'\n' ...\\n'\n' >>> c = C()\\n'\n' >>> c.__len__() # Explicit lookup via '\n'instance\\n'\n' Class getattribute invoked\\n'\n' 10\\n'\n' >>> type(c).__len__(c) # Explicit lookup via '\n'type\\n'\n' Metaclass getattribute invoked\\n'\n' 10\\n'\n' >>> len(c) # Implicit lookup\\n'\n' 10\\n'\n'\\n'\n'Bypassing the \"__getattribute__()\" machinery in this fashion '\n'provides\\n'\n'significant scope for speed optimisations within the '\n'interpreter, at\\n'\n'the cost of some flexibility in the handling of special '\n'methods (the\\n'\n'special method *must* be set on the class object itself in '\n'order to be\\n'\n'consistently invoked by the interpreter).\\n',\n'string-methods':'String Methods\\n'\n'**************\\n'\n'\\n'\n'Strings implement all of the common sequence operations, '\n'along with\\n'\n'the additional methods described below.\\n'\n'\\n'\n'Strings also support two styles of string formatting, one '\n'providing a\\n'\n'large degree of flexibility and customization (see '\n'\"str.format()\",\\n'\n'Format String Syntax and Custom String Formatting) and the '\n'other based\\n'\n'on C \"printf\" style formatting that handles a narrower '\n'range of types\\n'\n'and is slightly harder to use correctly, but is often '\n'faster for the\\n'\n'cases it can handle (printf-style String Formatting).\\n'\n'\\n'\n'The Text Processing Services section of the standard '\n'library covers a\\n'\n'number of other modules that provide various text related '\n'utilities\\n'\n'(including regular expression support in the \"re\" '\n'module).\\n'\n'\\n'\n'str.capitalize()\\n'\n'\\n'\n' Return a copy of the string with its first character '\n'capitalized\\n'\n' and the rest lowercased.\\n'\n'\\n'\n' Changed in version 3.8: The first character is now put '\n'into\\n'\n' titlecase rather than uppercase. This means that '\n'characters like\\n'\n' digraphs will only have their first letter capitalized, '\n'instead of\\n'\n' the full character.\\n'\n'\\n'\n'str.casefold()\\n'\n'\\n'\n' Return a casefolded copy of the string. Casefolded '\n'strings may be\\n'\n' used for caseless matching.\\n'\n'\\n'\n' Casefolding is similar to lowercasing but more '\n'aggressive because\\n'\n' it is intended to remove all case distinctions in a '\n'string. For\\n'\n' example, the German lowercase letter \"\\'\u00df\\'\" is '\n'equivalent to \"\"ss\"\".\\n'\n' Since it is already lowercase, \"lower()\" would do '\n'nothing to \"\\'\u00df\\'\";\\n'\n' \"casefold()\" converts it to \"\"ss\"\".\\n'\n'\\n'\n' The casefolding algorithm is described in section 3.13 '\n'of the\\n'\n' Unicode Standard.\\n'\n'\\n'\n' New in version 3.3.\\n'\n'\\n'\n'str.center(width[, fillchar])\\n'\n'\\n'\n' Return centered in a string of length *width*. Padding '\n'is done\\n'\n' using the specified *fillchar* (default is an ASCII '\n'space). The\\n'\n' original string is returned if *width* is less than or '\n'equal to\\n'\n' \"len(s)\".\\n'\n'\\n'\n'str.count(sub[, start[, end]])\\n'\n'\\n'\n' Return the number of non-overlapping occurrences of '\n'substring *sub*\\n'\n' in the range [*start*, *end*]. Optional arguments '\n'*start* and\\n'\n' *end* are interpreted as in slice notation.\\n'\n'\\n'\n\"str.encode(encoding='utf-8', errors='strict')\\n\"\n'\\n'\n' Return an encoded version of the string as a bytes '\n'object. Default\\n'\n' encoding is \"\\'utf-8\\'\". *errors* may be given to set a '\n'different\\n'\n' error handling scheme. The default for *errors* is '\n'\"\\'strict\\'\",\\n'\n' meaning that encoding errors raise a \"UnicodeError\". '\n'Other possible\\n'\n' values are \"\\'ignore\\'\", \"\\'replace\\'\", '\n'\"\\'xmlcharrefreplace\\'\",\\n'\n' \"\\'backslashreplace\\'\" and any other name registered '\n'via\\n'\n' \"codecs.register_error()\", see section Error Handlers. '\n'For a list\\n'\n' of possible encodings, see section Standard Encodings.\\n'\n'\\n'\n' By default, the *errors* argument is not checked for '\n'best\\n'\n' performances, but only used at the first encoding '\n'error. Enable the\\n'\n' Python Development Mode, or use a debug build to check '\n'*errors*.\\n'\n'\\n'\n' Changed in version 3.1: Support for keyword arguments '\n'added.\\n'\n'\\n'\n' Changed in version 3.9: The *errors* is now checked in '\n'development\\n'\n' mode and in debug mode.\\n'\n'\\n'\n'str.endswith(suffix[, start[, end]])\\n'\n'\\n'\n' Return \"True\" if the string ends with the specified '\n'*suffix*,\\n'\n' otherwise return \"False\". *suffix* can also be a tuple '\n'of suffixes\\n'\n' to look for. With optional *start*, test beginning at '\n'that\\n'\n' position. With optional *end*, stop comparing at that '\n'position.\\n'\n'\\n'\n'str.expandtabs(tabsize=8)\\n'\n'\\n'\n' Return a copy of the string where all tab characters '\n'are replaced\\n'\n' by one or more spaces, depending on the current column '\n'and the\\n'\n' given tab size. Tab positions occur every *tabsize* '\n'characters\\n'\n' (default is 8, giving tab positions at columns 0, 8, 16 '\n'and so on).\\n'\n' To expand the string, the current column is set to zero '\n'and the\\n'\n' string is examined character by character. If the '\n'character is a\\n'\n' tab (\"\\\\t\"), one or more space characters are inserted '\n'in the result\\n'\n' until the current column is equal to the next tab '\n'position. (The\\n'\n' tab character itself is not copied.) If the character '\n'is a newline\\n'\n' (\"\\\\n\") or return (\"\\\\r\"), it is copied and the current '\n'column is\\n'\n' reset to zero. Any other character is copied unchanged '\n'and the\\n'\n' current column is incremented by one regardless of how '\n'the\\n'\n' character is represented when printed.\\n'\n'\\n'\n\" >>> '01\\\\t012\\\\t0123\\\\t01234'.expandtabs()\\n\"\n\" '01 012 0123 01234'\\n\"\n\" >>> '01\\\\t012\\\\t0123\\\\t01234'.expandtabs(4)\\n\"\n\" '01 012 0123 01234'\\n\"\n'\\n'\n'str.find(sub[, start[, end]])\\n'\n'\\n'\n' Return the lowest index in the string where substring '\n'*sub* is\\n'\n' found within the slice \"s[start:end]\". Optional '\n'arguments *start*\\n'\n' and *end* are interpreted as in slice notation. Return '\n'\"-1\" if\\n'\n' *sub* is not found.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The \"find()\" method should be used only if you need '\n'to know the\\n'\n' position of *sub*. To check if *sub* is a substring '\n'or not, use\\n'\n' the \"in\" operator:\\n'\n'\\n'\n\" >>> 'Py' in 'Python'\\n\"\n' True\\n'\n'\\n'\n'str.format(*args, **kwargs)\\n'\n'\\n'\n' Perform a string formatting operation. The string on '\n'which this\\n'\n' method is called can contain literal text or '\n'replacement fields\\n'\n' delimited by braces \"{}\". Each replacement field '\n'contains either\\n'\n' the numeric index of a positional argument, or the name '\n'of a\\n'\n' keyword argument. Returns a copy of the string where '\n'each\\n'\n' replacement field is replaced with the string value of '\n'the\\n'\n' corresponding argument.\\n'\n'\\n'\n' >>> \"The sum of 1 + 2 is {0}\".format(1+2)\\n'\n\" 'The sum of 1 + 2 is 3'\\n\"\n'\\n'\n' See Format String Syntax for a description of the '\n'various\\n'\n' formatting options that can be specified in format '\n'strings.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' When formatting a number (\"int\", \"float\", \"complex\",\\n'\n' \"decimal.Decimal\" and subclasses) with the \"n\" type '\n'(ex:\\n'\n' \"\\'{:n}\\'.format(1234)\"), the function temporarily '\n'sets the\\n'\n' \"LC_CTYPE\" locale to the \"LC_NUMERIC\" locale to '\n'decode\\n'\n' \"decimal_point\" and \"thousands_sep\" fields of '\n'\"localeconv()\" if\\n'\n' they are non-ASCII or longer than 1 byte, and the '\n'\"LC_NUMERIC\"\\n'\n' locale is different than the \"LC_CTYPE\" locale. This '\n'temporary\\n'\n' change affects other threads.\\n'\n'\\n'\n' Changed in version 3.7: When formatting a number with '\n'the \"n\" type,\\n'\n' the function sets temporarily the \"LC_CTYPE\" locale to '\n'the\\n'\n' \"LC_NUMERIC\" locale in some cases.\\n'\n'\\n'\n'str.format_map(mapping)\\n'\n'\\n'\n' Similar to \"str.format(**mapping)\", except that '\n'\"mapping\" is used\\n'\n' directly and not copied to a \"dict\". This is useful if '\n'for example\\n'\n' \"mapping\" is a dict subclass:\\n'\n'\\n'\n' >>> class Default(dict):\\n'\n' ... def __missing__(self, key):\\n'\n' ... return key\\n'\n' ...\\n'\n\" >>> '{name} was born in \"\n\"{country}'.format_map(Default(name='Guido'))\\n\"\n\" 'Guido was born in country'\\n\"\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'str.index(sub[, start[, end]])\\n'\n'\\n'\n' Like \"find()\", but raise \"ValueError\" when the '\n'substring is not\\n'\n' found.\\n'\n'\\n'\n'str.isalnum()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'alphanumeric and\\n'\n' there is at least one character, \"False\" otherwise. A '\n'character\\n'\n' \"c\" is alphanumeric if one of the following returns '\n'\"True\":\\n'\n' \"c.isalpha()\", \"c.isdecimal()\", \"c.isdigit()\", or '\n'\"c.isnumeric()\".\\n'\n'\\n'\n'str.isalpha()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'alphabetic and\\n'\n' there is at least one character, \"False\" otherwise. '\n'Alphabetic\\n'\n' characters are those characters defined in the Unicode '\n'character\\n'\n' database as \u201cLetter\u201d, i.e., those with general category '\n'property\\n'\n' being one of \u201cLm\u201d, \u201cLt\u201d, \u201cLu\u201d, \u201cLl\u201d, or \u201cLo\u201d. Note '\n'that this is\\n'\n' different from the \u201cAlphabetic\u201d property defined in the '\n'Unicode\\n'\n' Standard.\\n'\n'\\n'\n'str.isascii()\\n'\n'\\n'\n' Return \"True\" if the string is empty or all characters '\n'in the\\n'\n' string are ASCII, \"False\" otherwise. ASCII characters '\n'have code\\n'\n' points in the range U+0000-U+007F.\\n'\n'\\n'\n' New in version 3.7.\\n'\n'\\n'\n'str.isdecimal()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'decimal\\n'\n' characters and there is at least one character, \"False\" '\n'otherwise.\\n'\n' Decimal characters are those that can be used to form '\n'numbers in\\n'\n' base 10, e.g. U+0660, ARABIC-INDIC DIGIT ZERO. '\n'Formally a decimal\\n'\n' character is a character in the Unicode General '\n'Category \u201cNd\u201d.\\n'\n'\\n'\n'str.isdigit()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'digits and there\\n'\n' is at least one character, \"False\" otherwise. Digits '\n'include\\n'\n' decimal characters and digits that need special '\n'handling, such as\\n'\n' the compatibility superscript digits. This covers '\n'digits which\\n'\n' cannot be used to form numbers in base 10, like the '\n'Kharosthi\\n'\n' numbers. Formally, a digit is a character that has the '\n'property\\n'\n' value Numeric_Type=Digit or Numeric_Type=Decimal.\\n'\n'\\n'\n'str.isidentifier()\\n'\n'\\n'\n' Return \"True\" if the string is a valid identifier '\n'according to the\\n'\n' language definition, section Identifiers and keywords.\\n'\n'\\n'\n' Call \"keyword.iskeyword()\" to test whether string \"s\" '\n'is a reserved\\n'\n' identifier, such as \"def\" and \"class\".\\n'\n'\\n'\n' Example:\\n'\n'\\n'\n' >>> from keyword import iskeyword\\n'\n'\\n'\n\" >>> 'hello'.isidentifier(), iskeyword('hello')\\n\"\n' True, False\\n'\n\" >>> 'def'.isidentifier(), iskeyword('def')\\n\"\n' True, True\\n'\n'\\n'\n'str.islower()\\n'\n'\\n'\n' Return \"True\" if all cased characters [4] in the string '\n'are\\n'\n' lowercase and there is at least one cased character, '\n'\"False\"\\n'\n' otherwise.\\n'\n'\\n'\n'str.isnumeric()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'numeric\\n'\n' characters, and there is at least one character, '\n'\"False\" otherwise.\\n'\n' Numeric characters include digit characters, and all '\n'characters\\n'\n' that have the Unicode numeric value property, e.g. '\n'U+2155, VULGAR\\n'\n' FRACTION ONE FIFTH. Formally, numeric characters are '\n'those with\\n'\n' the property value Numeric_Type=Digit, '\n'Numeric_Type=Decimal or\\n'\n' Numeric_Type=Numeric.\\n'\n'\\n'\n'str.isprintable()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'printable or the\\n'\n' string is empty, \"False\" otherwise. Nonprintable '\n'characters are\\n'\n' those characters defined in the Unicode character '\n'database as\\n'\n' \u201cOther\u201d or \u201cSeparator\u201d, excepting the ASCII space '\n'(0x20) which is\\n'\n' considered printable. (Note that printable characters '\n'in this\\n'\n' context are those which should not be escaped when '\n'\"repr()\" is\\n'\n' invoked on a string. It has no bearing on the handling '\n'of strings\\n'\n' written to \"sys.stdout\" or \"sys.stderr\".)\\n'\n'\\n'\n'str.isspace()\\n'\n'\\n'\n' Return \"True\" if there are only whitespace characters '\n'in the string\\n'\n' and there is at least one character, \"False\" '\n'otherwise.\\n'\n'\\n'\n' A character is *whitespace* if in the Unicode character '\n'database\\n'\n' (see \"unicodedata\"), either its general category is '\n'\"Zs\"\\n'\n' (\u201cSeparator, space\u201d), or its bidirectional class is one '\n'of \"WS\",\\n'\n' \"B\", or \"S\".\\n'\n'\\n'\n'str.istitle()\\n'\n'\\n'\n' Return \"True\" if the string is a titlecased string and '\n'there is at\\n'\n' least one character, for example uppercase characters '\n'may only\\n'\n' follow uncased characters and lowercase characters only '\n'cased ones.\\n'\n' Return \"False\" otherwise.\\n'\n'\\n'\n'str.isupper()\\n'\n'\\n'\n' Return \"True\" if all cased characters [4] in the string '\n'are\\n'\n' uppercase and there is at least one cased character, '\n'\"False\"\\n'\n' otherwise.\\n'\n'\\n'\n\" >>> 'BANANA'.isupper()\\n\"\n' True\\n'\n\" >>> 'banana'.isupper()\\n\"\n' False\\n'\n\" >>> 'baNana'.isupper()\\n\"\n' False\\n'\n\" >>> ' '.isupper()\\n\"\n' False\\n'\n'\\n'\n'str.join(iterable)\\n'\n'\\n'\n' Return a string which is the concatenation of the '\n'strings in\\n'\n' *iterable*. A \"TypeError\" will be raised if there are '\n'any non-\\n'\n' string values in *iterable*, including \"bytes\" '\n'objects. The\\n'\n' separator between elements is the string providing this '\n'method.\\n'\n'\\n'\n'str.ljust(width[, fillchar])\\n'\n'\\n'\n' Return the string left justified in a string of length '\n'*width*.\\n'\n' Padding is done using the specified *fillchar* (default '\n'is an ASCII\\n'\n' space). The original string is returned if *width* is '\n'less than or\\n'\n' equal to \"len(s)\".\\n'\n'\\n'\n'str.lower()\\n'\n'\\n'\n' Return a copy of the string with all the cased '\n'characters [4]\\n'\n' converted to lowercase.\\n'\n'\\n'\n' The lowercasing algorithm used is described in section '\n'3.13 of the\\n'\n' Unicode Standard.\\n'\n'\\n'\n'str.lstrip([chars])\\n'\n'\\n'\n' Return a copy of the string with leading characters '\n'removed. The\\n'\n' *chars* argument is a string specifying the set of '\n'characters to be\\n'\n' removed. If omitted or \"None\", the *chars* argument '\n'defaults to\\n'\n' removing whitespace. The *chars* argument is not a '\n'prefix; rather,\\n'\n' all combinations of its values are stripped:\\n'\n'\\n'\n\" >>> ' spacious '.lstrip()\\n\"\n\" 'spacious '\\n\"\n\" >>> 'www.example.com'.lstrip('cmowz.')\\n\"\n\" 'example.com'\\n\"\n'\\n'\n' See \"str.removeprefix()\" for a method that will remove '\n'a single\\n'\n' prefix string rather than all of a set of characters. '\n'For example:\\n'\n'\\n'\n\" >>> 'Arthur: three!'.lstrip('Arthur: ')\\n\"\n\" 'ee!'\\n\"\n\" >>> 'Arthur: three!'.removeprefix('Arthur: ')\\n\"\n\" 'three!'\\n\"\n'\\n'\n'static str.maketrans(x[, y[, z]])\\n'\n'\\n'\n' This static method returns a translation table usable '\n'for\\n'\n' \"str.translate()\".\\n'\n'\\n'\n' If there is only one argument, it must be a dictionary '\n'mapping\\n'\n' Unicode ordinals (integers) or characters (strings of '\n'length 1) to\\n'\n' Unicode ordinals, strings (of arbitrary lengths) or '\n'\"None\".\\n'\n' Character keys will then be converted to ordinals.\\n'\n'\\n'\n' If there are two arguments, they must be strings of '\n'equal length,\\n'\n' and in the resulting dictionary, each character in x '\n'will be mapped\\n'\n' to the character at the same position in y. If there '\n'is a third\\n'\n' argument, it must be a string, whose characters will be '\n'mapped to\\n'\n' \"None\" in the result.\\n'\n'\\n'\n'str.partition(sep)\\n'\n'\\n'\n' Split the string at the first occurrence of *sep*, and '\n'return a\\n'\n' 3-tuple containing the part before the separator, the '\n'separator\\n'\n' itself, and the part after the separator. If the '\n'separator is not\\n'\n' found, return a 3-tuple containing the string itself, '\n'followed by\\n'\n' two empty strings.\\n'\n'\\n'\n'str.removeprefix(prefix, /)\\n'\n'\\n'\n' If the string starts with the *prefix* string, return\\n'\n' \"string[len(prefix):]\". Otherwise, return a copy of the '\n'original\\n'\n' string:\\n'\n'\\n'\n\" >>> 'TestHook'.removeprefix('Test')\\n\"\n\" 'Hook'\\n\"\n\" >>> 'BaseTestCase'.removeprefix('Test')\\n\"\n\" 'BaseTestCase'\\n\"\n'\\n'\n' New in version 3.9.\\n'\n'\\n'\n'str.removesuffix(suffix, /)\\n'\n'\\n'\n' If the string ends with the *suffix* string and that '\n'*suffix* is\\n'\n' not empty, return \"string[:-len(suffix)]\". Otherwise, '\n'return a copy\\n'\n' of the original string:\\n'\n'\\n'\n\" >>> 'MiscTests'.removesuffix('Tests')\\n\"\n\" 'Misc'\\n\"\n\" >>> 'TmpDirMixin'.removesuffix('Tests')\\n\"\n\" 'TmpDirMixin'\\n\"\n'\\n'\n' New in version 3.9.\\n'\n'\\n'\n'str.replace(old, new[, count])\\n'\n'\\n'\n' Return a copy of the string with all occurrences of '\n'substring *old*\\n'\n' replaced by *new*. If the optional argument *count* is '\n'given, only\\n'\n' the first *count* occurrences are replaced.\\n'\n'\\n'\n'str.rfind(sub[, start[, end]])\\n'\n'\\n'\n' Return the highest index in the string where substring '\n'*sub* is\\n'\n' found, such that *sub* is contained within '\n'\"s[start:end]\".\\n'\n' Optional arguments *start* and *end* are interpreted as '\n'in slice\\n'\n' notation. Return \"-1\" on failure.\\n'\n'\\n'\n'str.rindex(sub[, start[, end]])\\n'\n'\\n'\n' Like \"rfind()\" but raises \"ValueError\" when the '\n'substring *sub* is\\n'\n' not found.\\n'\n'\\n'\n'str.rjust(width[, fillchar])\\n'\n'\\n'\n' Return the string right justified in a string of length '\n'*width*.\\n'\n' Padding is done using the specified *fillchar* (default '\n'is an ASCII\\n'\n' space). The original string is returned if *width* is '\n'less than or\\n'\n' equal to \"len(s)\".\\n'\n'\\n'\n'str.rpartition(sep)\\n'\n'\\n'\n' Split the string at the last occurrence of *sep*, and '\n'return a\\n'\n' 3-tuple containing the part before the separator, the '\n'separator\\n'\n' itself, and the part after the separator. If the '\n'separator is not\\n'\n' found, return a 3-tuple containing two empty strings, '\n'followed by\\n'\n' the string itself.\\n'\n'\\n'\n'str.rsplit(sep=None, maxsplit=- 1)\\n'\n'\\n'\n' Return a list of the words in the string, using *sep* '\n'as the\\n'\n' delimiter string. If *maxsplit* is given, at most '\n'*maxsplit* splits\\n'\n' are done, the *rightmost* ones. If *sep* is not '\n'specified or\\n'\n' \"None\", any whitespace string is a separator. Except '\n'for splitting\\n'\n' from the right, \"rsplit()\" behaves like \"split()\" which '\n'is\\n'\n' described in detail below.\\n'\n'\\n'\n'str.rstrip([chars])\\n'\n'\\n'\n' Return a copy of the string with trailing characters '\n'removed. The\\n'\n' *chars* argument is a string specifying the set of '\n'characters to be\\n'\n' removed. If omitted or \"None\", the *chars* argument '\n'defaults to\\n'\n' removing whitespace. The *chars* argument is not a '\n'suffix; rather,\\n'\n' all combinations of its values are stripped:\\n'\n'\\n'\n\" >>> ' spacious '.rstrip()\\n\"\n\" ' spacious'\\n\"\n\" >>> 'mississippi'.rstrip('ipz')\\n\"\n\" 'mississ'\\n\"\n'\\n'\n' See \"str.removesuffix()\" for a method that will remove '\n'a single\\n'\n' suffix string rather than all of a set of characters. '\n'For example:\\n'\n'\\n'\n\" >>> 'Monty Python'.rstrip(' Python')\\n\"\n\" 'M'\\n\"\n\" >>> 'Monty Python'.removesuffix(' Python')\\n\"\n\" 'Monty'\\n\"\n'\\n'\n'str.split(sep=None, maxsplit=- 1)\\n'\n'\\n'\n' Return a list of the words in the string, using *sep* '\n'as the\\n'\n' delimiter string. If *maxsplit* is given, at most '\n'*maxsplit*\\n'\n' splits are done (thus, the list will have at most '\n'\"maxsplit+1\"\\n'\n' elements). If *maxsplit* is not specified or \"-1\", '\n'then there is\\n'\n' no limit on the number of splits (all possible splits '\n'are made).\\n'\n'\\n'\n' If *sep* is given, consecutive delimiters are not '\n'grouped together\\n'\n' and are deemed to delimit empty strings (for example,\\n'\n' \"\\'1,,2\\'.split(\\',\\')\" returns \"[\\'1\\', \\'\\', '\n'\\'2\\']\"). The *sep* argument\\n'\n' may consist of multiple characters (for example,\\n'\n' \"\\'1<>2<>3\\'.split(\\'<>\\')\" returns \"[\\'1\\', \\'2\\', '\n'\\'3\\']\"). Splitting an\\n'\n' empty string with a specified separator returns '\n'\"[\\'\\']\".\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n\" >>> '1,2,3'.split(',')\\n\"\n\" ['1', '2', '3']\\n\"\n\" >>> '1,2,3'.split(',', maxsplit=1)\\n\"\n\" ['1', '2,3']\\n\"\n\" >>> '1,2,,3,'.split(',')\\n\"\n\" ['1', '2', '', '3', '']\\n\"\n'\\n'\n' If *sep* is not specified or is \"None\", a different '\n'splitting\\n'\n' algorithm is applied: runs of consecutive whitespace '\n'are regarded\\n'\n' as a single separator, and the result will contain no '\n'empty strings\\n'\n' at the start or end if the string has leading or '\n'trailing\\n'\n' whitespace. Consequently, splitting an empty string or '\n'a string\\n'\n' consisting of just whitespace with a \"None\" separator '\n'returns \"[]\".\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n\" >>> '1 2 3'.split()\\n\"\n\" ['1', '2', '3']\\n\"\n\" >>> '1 2 3'.split(maxsplit=1)\\n\"\n\" ['1', '2 3']\\n\"\n\" >>> ' 1 2 3 '.split()\\n\"\n\" ['1', '2', '3']\\n\"\n'\\n'\n'str.splitlines([keepends])\\n'\n'\\n'\n' Return a list of the lines in the string, breaking at '\n'line\\n'\n' boundaries. Line breaks are not included in the '\n'resulting list\\n'\n' unless *keepends* is given and true.\\n'\n'\\n'\n' This method splits on the following line boundaries. '\n'In\\n'\n' particular, the boundaries are a superset of *universal '\n'newlines*.\\n'\n'\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | Representation | '\n'Description |\\n'\n' '\n'|=========================|===============================|\\n'\n' | \"\\\\n\" | Line '\n'Feed |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\r\" | Carriage '\n'Return |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\r\\\\n\" | Carriage Return + Line '\n'Feed |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\v\" or \"\\\\x0b\" | Line '\n'Tabulation |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\f\" or \"\\\\x0c\" | Form '\n'Feed |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\x1c\" | File '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\x1d\" | Group '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\x1e\" | Record '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\x85\" | Next Line (C1 Control '\n'Code) |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\u2028\" | Line '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\u2029\" | Paragraph '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n'\\n'\n' Changed in version 3.2: \"\\\\v\" and \"\\\\f\" added to list '\n'of line\\n'\n' boundaries.\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n\" >>> 'ab c\\\\n\\\\nde fg\\\\rkl\\\\r\\\\n'.splitlines()\\n\"\n\" ['ab c', '', 'de fg', 'kl']\\n\"\n\" >>> 'ab c\\\\n\\\\nde \"\n\"fg\\\\rkl\\\\r\\\\n'.splitlines(keepends=True)\\n\"\n\" ['ab c\\\\n', '\\\\n', 'de fg\\\\r', 'kl\\\\r\\\\n']\\n\"\n'\\n'\n' Unlike \"split()\" when a delimiter string *sep* is '\n'given, this\\n'\n' method returns an empty list for the empty string, and '\n'a terminal\\n'\n' line break does not result in an extra line:\\n'\n'\\n'\n' >>> \"\".splitlines()\\n'\n' []\\n'\n' >>> \"One line\\\\n\".splitlines()\\n'\n\" ['One line']\\n\"\n'\\n'\n' For comparison, \"split(\\'\\\\n\\')\" gives:\\n'\n'\\n'\n\" >>> ''.split('\\\\n')\\n\"\n\" ['']\\n\"\n\" >>> 'Two lines\\\\n'.split('\\\\n')\\n\"\n\" ['Two lines', '']\\n\"\n'\\n'\n'str.startswith(prefix[, start[, end]])\\n'\n'\\n'\n' Return \"True\" if string starts with the *prefix*, '\n'otherwise return\\n'\n' \"False\". *prefix* can also be a tuple of prefixes to '\n'look for.\\n'\n' With optional *start*, test string beginning at that '\n'position.\\n'\n' With optional *end*, stop comparing string at that '\n'position.\\n'\n'\\n'\n'str.strip([chars])\\n'\n'\\n'\n' Return a copy of the string with the leading and '\n'trailing\\n'\n' characters removed. The *chars* argument is a string '\n'specifying the\\n'\n' set of characters to be removed. If omitted or \"None\", '\n'the *chars*\\n'\n' argument defaults to removing whitespace. The *chars* '\n'argument is\\n'\n' not a prefix or suffix; rather, all combinations of its '\n'values are\\n'\n' stripped:\\n'\n'\\n'\n\" >>> ' spacious '.strip()\\n\"\n\" 'spacious'\\n\"\n\" >>> 'www.example.com'.strip('cmowz.')\\n\"\n\" 'example'\\n\"\n'\\n'\n' The outermost leading and trailing *chars* argument '\n'values are\\n'\n' stripped from the string. Characters are removed from '\n'the leading\\n'\n' end until reaching a string character that is not '\n'contained in the\\n'\n' set of characters in *chars*. A similar action takes '\n'place on the\\n'\n' trailing end. For example:\\n'\n'\\n'\n\" >>> comment_string = '#....... Section 3.2.1 Issue \"\n\"#32 .......'\\n\"\n\" >>> comment_string.strip('.#! ')\\n\"\n\" 'Section 3.2.1 Issue #32'\\n\"\n'\\n'\n'str.swapcase()\\n'\n'\\n'\n' Return a copy of the string with uppercase characters '\n'converted to\\n'\n' lowercase and vice versa. Note that it is not '\n'necessarily true that\\n'\n' \"s.swapcase().swapcase() == s\".\\n'\n'\\n'\n'str.title()\\n'\n'\\n'\n' Return a titlecased version of the string where words '\n'start with an\\n'\n' uppercase character and the remaining characters are '\n'lowercase.\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n\" >>> 'Hello world'.title()\\n\"\n\" 'Hello World'\\n\"\n'\\n'\n' The algorithm uses a simple language-independent '\n'definition of a\\n'\n' word as groups of consecutive letters. The definition '\n'works in\\n'\n' many contexts but it means that apostrophes in '\n'contractions and\\n'\n' possessives form word boundaries, which may not be the '\n'desired\\n'\n' result:\\n'\n'\\n'\n' >>> \"they\\'re bill\\'s friends from the UK\".title()\\n'\n' \"They\\'Re Bill\\'S Friends From The Uk\"\\n'\n'\\n'\n' A workaround for apostrophes can be constructed using '\n'regular\\n'\n' expressions:\\n'\n'\\n'\n' >>> import re\\n'\n' >>> def titlecase(s):\\n'\n' ... return re.sub(r\"[A-Za-z]+(\\'[A-Za-z]+)?\",\\n'\n' ... lambda mo: '\n'mo.group(0).capitalize(),\\n'\n' ... s)\\n'\n' ...\\n'\n' >>> titlecase(\"they\\'re bill\\'s friends.\")\\n'\n' \"They\\'re Bill\\'s Friends.\"\\n'\n'\\n'\n'str.translate(table)\\n'\n'\\n'\n' Return a copy of the string in which each character has '\n'been mapped\\n'\n' through the given translation table. The table must be '\n'an object\\n'\n' that implements indexing via \"__getitem__()\", typically '\n'a *mapping*\\n'\n' or *sequence*. When indexed by a Unicode ordinal (an '\n'integer), the\\n'\n' table object can do any of the following: return a '\n'Unicode ordinal\\n'\n' or a string, to map the character to one or more other '\n'characters;\\n'\n' return \"None\", to delete the character from the return '\n'string; or\\n'\n' raise a \"LookupError\" exception, to map the character '\n'to itself.\\n'\n'\\n'\n' You can use \"str.maketrans()\" to create a translation '\n'map from\\n'\n' character-to-character mappings in different formats.\\n'\n'\\n'\n' See also the \"codecs\" module for a more flexible '\n'approach to custom\\n'\n' character mappings.\\n'\n'\\n'\n'str.upper()\\n'\n'\\n'\n' Return a copy of the string with all the cased '\n'characters [4]\\n'\n' converted to uppercase. Note that '\n'\"s.upper().isupper()\" might be\\n'\n' \"False\" if \"s\" contains uncased characters or if the '\n'Unicode\\n'\n' category of the resulting character(s) is not \u201cLu\u201d '\n'(Letter,\\n'\n' uppercase), but e.g. \u201cLt\u201d (Letter, titlecase).\\n'\n'\\n'\n' The uppercasing algorithm used is described in section '\n'3.13 of the\\n'\n' Unicode Standard.\\n'\n'\\n'\n'str.zfill(width)\\n'\n'\\n'\n' Return a copy of the string left filled with ASCII '\n'\"\\'0\\'\" digits to\\n'\n' make a string of length *width*. A leading sign prefix\\n'\n' (\"\\'+\\'\"/\"\\'-\\'\") is handled by inserting the padding '\n'*after* the sign\\n'\n' character rather than before. The original string is '\n'returned if\\n'\n' *width* is less than or equal to \"len(s)\".\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n' >>> \"42\".zfill(5)\\n'\n\" '00042'\\n\"\n' >>> \"-42\".zfill(5)\\n'\n\" '-0042'\\n\",\n'strings':'String and Bytes literals\\n'\n'*************************\\n'\n'\\n'\n'String literals are described by the following lexical '\n'definitions:\\n'\n'\\n'\n' stringliteral ::= [stringprefix](shortstring | longstring)\\n'\n' stringprefix ::= \"r\" | \"u\" | \"R\" | \"U\" | \"f\" | \"F\"\\n'\n' | \"fr\" | \"Fr\" | \"fR\" | \"FR\" | \"rf\" | \"rF\" | '\n'\"Rf\" | \"RF\"\\n'\n' shortstring ::= \"\\'\" shortstringitem* \"\\'\" | \\'\"\\' '\n'shortstringitem* \\'\"\\'\\n'\n' longstring ::= \"\\'\\'\\'\" longstringitem* \"\\'\\'\\'\" | '\n'\\'\"\"\"\\' longstringitem* \\'\"\"\"\\'\\n'\n' shortstringitem ::= shortstringchar | stringescapeseq\\n'\n' longstringitem ::= longstringchar | stringescapeseq\\n'\n' shortstringchar ::= \\n'\n' longstringchar ::= \\n'\n' stringescapeseq ::= \"\\\\\" \\n'\n'\\n'\n' bytesliteral ::= bytesprefix(shortbytes | longbytes)\\n'\n' bytesprefix ::= \"b\" | \"B\" | \"br\" | \"Br\" | \"bR\" | \"BR\" | '\n'\"rb\" | \"rB\" | \"Rb\" | \"RB\"\\n'\n' shortbytes ::= \"\\'\" shortbytesitem* \"\\'\" | \\'\"\\' '\n'shortbytesitem* \\'\"\\'\\n'\n' longbytes ::= \"\\'\\'\\'\" longbytesitem* \"\\'\\'\\'\" | \\'\"\"\"\\' '\n'longbytesitem* \\'\"\"\"\\'\\n'\n' shortbytesitem ::= shortbyteschar | bytesescapeseq\\n'\n' longbytesitem ::= longbyteschar | bytesescapeseq\\n'\n' shortbyteschar ::= \\n'\n' longbyteschar ::= \\n'\n' bytesescapeseq ::= \"\\\\\" \\n'\n'\\n'\n'One syntactic restriction not indicated by these productions is '\n'that\\n'\n'whitespace is not allowed between the \"stringprefix\" or '\n'\"bytesprefix\"\\n'\n'and the rest of the literal. The source character set is defined '\n'by\\n'\n'the encoding declaration; it is UTF-8 if no encoding declaration '\n'is\\n'\n'given in the source file; see section Encoding declarations.\\n'\n'\\n'\n'In plain English: Both types of literals can be enclosed in '\n'matching\\n'\n'single quotes (\"\\'\") or double quotes (\"\"\"). They can also be '\n'enclosed\\n'\n'in matching groups of three single or double quotes (these are\\n'\n'generally referred to as *triple-quoted strings*). The '\n'backslash\\n'\n'(\"\\\\\") character is used to escape characters that otherwise have '\n'a\\n'\n'special meaning, such as newline, backslash itself, or the quote\\n'\n'character.\\n'\n'\\n'\n'Bytes literals are always prefixed with \"\\'b\\'\" or \"\\'B\\'\"; they '\n'produce\\n'\n'an instance of the \"bytes\" type instead of the \"str\" type. They '\n'may\\n'\n'only contain ASCII characters; bytes with a numeric value of 128 '\n'or\\n'\n'greater must be expressed with escapes.\\n'\n'\\n'\n'Both string and bytes literals may optionally be prefixed with a\\n'\n'letter \"\\'r\\'\" or \"\\'R\\'\"; such strings are called *raw strings* '\n'and treat\\n'\n'backslashes as literal characters. As a result, in string '\n'literals,\\n'\n'\"\\'\\\\U\\'\" and \"\\'\\\\u\\'\" escapes in raw strings are not treated '\n'specially.\\n'\n'Given that Python 2.x\u2019s raw unicode literals behave differently '\n'than\\n'\n'Python 3.x\u2019s the \"\\'ur\\'\" syntax is not supported.\\n'\n'\\n'\n'New in version 3.3: The \"\\'rb\\'\" prefix of raw bytes literals has '\n'been\\n'\n'added as a synonym of \"\\'br\\'\".\\n'\n'\\n'\n'New in version 3.3: Support for the unicode legacy literal\\n'\n'(\"u\\'value\\'\") was reintroduced to simplify the maintenance of '\n'dual\\n'\n'Python 2.x and 3.x codebases. See **PEP 414** for more '\n'information.\\n'\n'\\n'\n'A string literal with \"\\'f\\'\" or \"\\'F\\'\" in its prefix is a '\n'*formatted\\n'\n'string literal*; see Formatted string literals. The \"\\'f\\'\" may '\n'be\\n'\n'combined with \"\\'r\\'\", but not with \"\\'b\\'\" or \"\\'u\\'\", therefore '\n'raw\\n'\n'formatted strings are possible, but formatted bytes literals are '\n'not.\\n'\n'\\n'\n'In triple-quoted literals, unescaped newlines and quotes are '\n'allowed\\n'\n'(and are retained), except that three unescaped quotes in a row\\n'\n'terminate the literal. (A \u201cquote\u201d is the character used to open '\n'the\\n'\n'literal, i.e. either \"\\'\" or \"\"\".)\\n'\n'\\n'\n'Unless an \"\\'r\\'\" or \"\\'R\\'\" prefix is present, escape sequences '\n'in string\\n'\n'and bytes literals are interpreted according to rules similar to '\n'those\\n'\n'used by Standard C. The recognized escape sequences are:\\n'\n'\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| Escape Sequence | Meaning | Notes '\n'|\\n'\n'|===================|===================================|=========|\\n'\n'| \"\\\\newline\" | Backslash and newline ignored '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\\\\\\" | Backslash (\"\\\\\") '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\\\'\" | Single quote (\"\\'\") '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\\"\" | Double quote (\"\"\") '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\a\" | ASCII Bell (BEL) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\b\" | ASCII Backspace (BS) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\f\" | ASCII Formfeed (FF) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\n\" | ASCII Linefeed (LF) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\r\" | ASCII Carriage Return (CR) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\t\" | ASCII Horizontal Tab (TAB) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\v\" | ASCII Vertical Tab (VT) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\ooo\" | Character with octal value *ooo* | '\n'(1,3) |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\xhh\" | Character with hex value *hh* | '\n'(2,3) |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'\\n'\n'Escape sequences only recognized in string literals are:\\n'\n'\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| Escape Sequence | Meaning | Notes '\n'|\\n'\n'|===================|===================================|=========|\\n'\n'| \"\\\\N{name}\" | Character named *name* in the | '\n'(4) |\\n'\n'| | Unicode database | '\n'|\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\uxxxx\" | Character with 16-bit hex value | '\n'(5) |\\n'\n'| | *xxxx* | '\n'|\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\Uxxxxxxxx\" | Character with 32-bit hex value | '\n'(6) |\\n'\n'| | *xxxxxxxx* | '\n'|\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'\\n'\n'Notes:\\n'\n'\\n'\n'1. As in Standard C, up to three octal digits are accepted.\\n'\n'\\n'\n'2. Unlike in Standard C, exactly two hex digits are required.\\n'\n'\\n'\n'3. In a bytes literal, hexadecimal and octal escapes denote the '\n'byte\\n'\n' with the given value. In a string literal, these escapes '\n'denote a\\n'\n' Unicode character with the given value.\\n'\n'\\n'\n'4. Changed in version 3.3: Support for name aliases [1] has been\\n'\n' added.\\n'\n'\\n'\n'5. Exactly four hex digits are required.\\n'\n'\\n'\n'6. Any Unicode character can be encoded this way. Exactly eight '\n'hex\\n'\n' digits are required.\\n'\n'\\n'\n'Unlike Standard C, all unrecognized escape sequences are left in '\n'the\\n'\n'string unchanged, i.e., *the backslash is left in the result*. '\n'(This\\n'\n'behavior is useful when debugging: if an escape sequence is '\n'mistyped,\\n'\n'the resulting output is more easily recognized as broken.) It is '\n'also\\n'\n'important to note that the escape sequences only recognized in '\n'string\\n'\n'literals fall into the category of unrecognized escapes for '\n'bytes\\n'\n'literals.\\n'\n'\\n'\n' Changed in version 3.6: Unrecognized escape sequences produce '\n'a\\n'\n' \"DeprecationWarning\". In a future Python version they will be '\n'a\\n'\n' \"SyntaxWarning\" and eventually a \"SyntaxError\".\\n'\n'\\n'\n'Even in a raw literal, quotes can be escaped with a backslash, '\n'but the\\n'\n'backslash remains in the result; for example, \"r\"\\\\\"\"\" is a '\n'valid\\n'\n'string literal consisting of two characters: a backslash and a '\n'double\\n'\n'quote; \"r\"\\\\\"\" is not a valid string literal (even a raw string '\n'cannot\\n'\n'end in an odd number of backslashes). Specifically, *a raw '\n'literal\\n'\n'cannot end in a single backslash* (since the backslash would '\n'escape\\n'\n'the following quote character). Note also that a single '\n'backslash\\n'\n'followed by a newline is interpreted as those two characters as '\n'part\\n'\n'of the literal, *not* as a line continuation.\\n',\n'subscriptions':'Subscriptions\\n'\n'*************\\n'\n'\\n'\n'Subscription of a sequence (string, tuple or list) or '\n'mapping\\n'\n'(dictionary) object usually selects an item from the '\n'collection:\\n'\n'\\n'\n' subscription ::= primary \"[\" expression_list \"]\"\\n'\n'\\n'\n'The primary must evaluate to an object that supports '\n'subscription\\n'\n'(lists or dictionaries for example). User-defined objects '\n'can support\\n'\n'subscription by defining a \"__getitem__()\" method.\\n'\n'\\n'\n'For built-in objects, there are two types of objects that '\n'support\\n'\n'subscription:\\n'\n'\\n'\n'If the primary is a mapping, the expression list must '\n'evaluate to an\\n'\n'object whose value is one of the keys of the mapping, and '\n'the\\n'\n'subscription selects the value in the mapping that '\n'corresponds to that\\n'\n'key. (The expression list is a tuple except if it has '\n'exactly one\\n'\n'item.)\\n'\n'\\n'\n'If the primary is a sequence, the expression list must '\n'evaluate to an\\n'\n'integer or a slice (as discussed in the following '\n'section).\\n'\n'\\n'\n'The formal syntax makes no special provision for negative '\n'indices in\\n'\n'sequences; however, built-in sequences all provide a '\n'\"__getitem__()\"\\n'\n'method that interprets negative indices by adding the '\n'length of the\\n'\n'sequence to the index (so that \"x[-1]\" selects the last '\n'item of \"x\").\\n'\n'The resulting value must be a nonnegative integer less than '\n'the number\\n'\n'of items in the sequence, and the subscription selects the '\n'item whose\\n'\n'index is that value (counting from zero). Since the support '\n'for\\n'\n'negative indices and slicing occurs in the object\u2019s '\n'\"__getitem__()\"\\n'\n'method, subclasses overriding this method will need to '\n'explicitly add\\n'\n'that support.\\n'\n'\\n'\n'A string\u2019s items are characters. A character is not a '\n'separate data\\n'\n'type but a string of exactly one character.\\n'\n'\\n'\n'Subscription of certain *classes* or *types* creates a '\n'generic alias.\\n'\n'In this case, user-defined classes can support subscription '\n'by\\n'\n'providing a \"__class_getitem__()\" classmethod.\\n',\n'truth':'Truth Value Testing\\n'\n'*******************\\n'\n'\\n'\n'Any object can be tested for truth value, for use in an \"if\" or\\n'\n'\"while\" condition or as operand of the Boolean operations below.\\n'\n'\\n'\n'By default, an object is considered true unless its class defines\\n'\n'either a \"__bool__()\" method that returns \"False\" or a \"__len__()\"\\n'\n'method that returns zero, when called with the object. [1] Here '\n'are\\n'\n'most of the built-in objects considered false:\\n'\n'\\n'\n'* constants defined to be false: \"None\" and \"False\".\\n'\n'\\n'\n'* zero of any numeric type: \"0\", \"0.0\", \"0j\", \"Decimal(0)\",\\n'\n' \"Fraction(0, 1)\"\\n'\n'\\n'\n'* empty sequences and collections: \"\\'\\'\", \"()\", \"[]\", \"{}\", '\n'\"set()\",\\n'\n' \"range(0)\"\\n'\n'\\n'\n'Operations and built-in functions that have a Boolean result '\n'always\\n'\n'return \"0\" or \"False\" for false and \"1\" or \"True\" for true, unless\\n'\n'otherwise stated. (Important exception: the Boolean operations '\n'\"or\"\\n'\n'and \"and\" always return one of their operands.)\\n',\n'try':'The \"try\" statement\\n'\n'*******************\\n'\n'\\n'\n'The \"try\" statement specifies exception handlers and/or cleanup code\\n'\n'for a group of statements:\\n'\n'\\n'\n' try_stmt ::= try1_stmt | try2_stmt\\n'\n' try1_stmt ::= \"try\" \":\" suite\\n'\n' (\"except\" [expression [\"as\" identifier]] \":\" '\n'suite)+\\n'\n' [\"else\" \":\" suite]\\n'\n' [\"finally\" \":\" suite]\\n'\n' try2_stmt ::= \"try\" \":\" suite\\n'\n' \"finally\" \":\" suite\\n'\n'\\n'\n'The \"except\" clause(s) specify one or more exception handlers. When '\n'no\\n'\n'exception occurs in the \"try\" clause, no exception handler is\\n'\n'executed. When an exception occurs in the \"try\" suite, a search for '\n'an\\n'\n'exception handler is started. This search inspects the except '\n'clauses\\n'\n'in turn until one is found that matches the exception. An '\n'expression-\\n'\n'less except clause, if present, must be last; it matches any\\n'\n'exception. For an except clause with an expression, that expression\\n'\n'is evaluated, and the clause matches the exception if the resulting\\n'\n'object is \u201ccompatible\u201d with the exception. An object is compatible\\n'\n'with an exception if it is the class or a base class of the '\n'exception\\n'\n'object, or a tuple containing an item that is the class or a base\\n'\n'class of the exception object.\\n'\n'\\n'\n'If no except clause matches the exception, the search for an '\n'exception\\n'\n'handler continues in the surrounding code and on the invocation '\n'stack.\\n'\n'[1]\\n'\n'\\n'\n'If the evaluation of an expression in the header of an except clause\\n'\n'raises an exception, the original search for a handler is canceled '\n'and\\n'\n'a search starts for the new exception in the surrounding code and on\\n'\n'the call stack (it is treated as if the entire \"try\" statement '\n'raised\\n'\n'the exception).\\n'\n'\\n'\n'When a matching except clause is found, the exception is assigned to\\n'\n'the target specified after the \"as\" keyword in that except clause, '\n'if\\n'\n'present, and the except clause\u2019s suite is executed. All except\\n'\n'clauses must have an executable block. When the end of this block '\n'is\\n'\n'reached, execution continues normally after the entire try '\n'statement.\\n'\n'(This means that if two nested handlers exist for the same '\n'exception,\\n'\n'and the exception occurs in the try clause of the inner handler, the\\n'\n'outer handler will not handle the exception.)\\n'\n'\\n'\n'When an exception has been assigned using \"as target\", it is cleared\\n'\n'at the end of the except clause. This is as if\\n'\n'\\n'\n' except E as N:\\n'\n' foo\\n'\n'\\n'\n'was translated to\\n'\n'\\n'\n' except E as N:\\n'\n' try:\\n'\n' foo\\n'\n' finally:\\n'\n' del N\\n'\n'\\n'\n'This means the exception must be assigned to a different name to be\\n'\n'able to refer to it after the except clause. Exceptions are cleared\\n'\n'because with the traceback attached to them, they form a reference\\n'\n'cycle with the stack frame, keeping all locals in that frame alive\\n'\n'until the next garbage collection occurs.\\n'\n'\\n'\n'Before an except clause\u2019s suite is executed, details about the\\n'\n'exception are stored in the \"sys\" module and can be accessed via\\n'\n'\"sys.exc_info()\". \"sys.exc_info()\" returns a 3-tuple consisting of '\n'the\\n'\n'exception class, the exception instance and a traceback object (see\\n'\n'section The standard type hierarchy) identifying the point in the\\n'\n'program where the exception occurred. The details about the '\n'exception\\n'\n'accessed via \"sys.exc_info()\" are restored to their previous values\\n'\n'when leaving an exception handler:\\n'\n'\\n'\n' >>> print(sys.exc_info())\\n'\n' (None, None, None)\\n'\n' >>> try:\\n'\n' ... raise TypeError\\n'\n' ... except:\\n'\n' ... print(sys.exc_info())\\n'\n' ... try:\\n'\n' ... raise ValueError\\n'\n' ... except:\\n'\n' ... print(sys.exc_info())\\n'\n' ... print(sys.exc_info())\\n'\n' ...\\n'\n\" (, TypeError(), )\\n'\n\" (, ValueError(), )\\n'\n\" (, TypeError(), )\\n'\n' >>> print(sys.exc_info())\\n'\n' (None, None, None)\\n'\n'\\n'\n'The optional \"else\" clause is executed if the control flow leaves '\n'the\\n'\n'\"try\" suite, no exception was raised, and no \"return\", \"continue\", '\n'or\\n'\n'\"break\" statement was executed. Exceptions in the \"else\" clause are\\n'\n'not handled by the preceding \"except\" clauses.\\n'\n'\\n'\n'If \"finally\" is present, it specifies a \u2018cleanup\u2019 handler. The '\n'\"try\"\\n'\n'clause is executed, including any \"except\" and \"else\" clauses. If '\n'an\\n'\n'exception occurs in any of the clauses and is not handled, the\\n'\n'exception is temporarily saved. The \"finally\" clause is executed. '\n'If\\n'\n'there is a saved exception it is re-raised at the end of the '\n'\"finally\"\\n'\n'clause. If the \"finally\" clause raises another exception, the saved\\n'\n'exception is set as the context of the new exception. If the '\n'\"finally\"\\n'\n'clause executes a \"return\", \"break\" or \"continue\" statement, the '\n'saved\\n'\n'exception is discarded:\\n'\n'\\n'\n' >>> def f():\\n'\n' ... try:\\n'\n' ... 1/0\\n'\n' ... finally:\\n'\n' ... return 42\\n'\n' ...\\n'\n' >>> f()\\n'\n' 42\\n'\n'\\n'\n'The exception information is not available to the program during\\n'\n'execution of the \"finally\" clause.\\n'\n'\\n'\n'When a \"return\", \"break\" or \"continue\" statement is executed in the\\n'\n'\"try\" suite of a \"try\"\u2026\"finally\" statement, the \"finally\" clause is\\n'\n'also executed \u2018on the way out.\u2019\\n'\n'\\n'\n'The return value of a function is determined by the last \"return\"\\n'\n'statement executed. Since the \"finally\" clause always executes, a\\n'\n'\"return\" statement executed in the \"finally\" clause will always be '\n'the\\n'\n'last one executed:\\n'\n'\\n'\n' >>> def foo():\\n'\n' ... try:\\n'\n\" ... return 'try'\\n\"\n' ... finally:\\n'\n\" ... return 'finally'\\n\"\n' ...\\n'\n' >>> foo()\\n'\n\" 'finally'\\n\"\n'\\n'\n'Additional information on exceptions can be found in section\\n'\n'Exceptions, and information on using the \"raise\" statement to '\n'generate\\n'\n'exceptions may be found in section The raise statement.\\n'\n'\\n'\n'Changed in version 3.8: Prior to Python 3.8, a \"continue\" statement\\n'\n'was illegal in the \"finally\" clause due to a problem with the\\n'\n'implementation.\\n',\n'types':'The standard type hierarchy\\n'\n'***************************\\n'\n'\\n'\n'Below is a list of the types that are built into Python. '\n'Extension\\n'\n'modules (written in C, Java, or other languages, depending on the\\n'\n'implementation) can define additional types. Future versions of\\n'\n'Python may add types to the type hierarchy (e.g., rational '\n'numbers,\\n'\n'efficiently stored arrays of integers, etc.), although such '\n'additions\\n'\n'will often be provided via the standard library instead.\\n'\n'\\n'\n'Some of the type descriptions below contain a paragraph listing\\n'\n'\u2018special attributes.\u2019 These are attributes that provide access to '\n'the\\n'\n'implementation and are not intended for general use. Their '\n'definition\\n'\n'may change in the future.\\n'\n'\\n'\n'None\\n'\n' This type has a single value. There is a single object with '\n'this\\n'\n' value. This object is accessed through the built-in name \"None\". '\n'It\\n'\n' is used to signify the absence of a value in many situations, '\n'e.g.,\\n'\n' it is returned from functions that don\u2019t explicitly return\\n'\n' anything. Its truth value is false.\\n'\n'\\n'\n'NotImplemented\\n'\n' This type has a single value. There is a single object with '\n'this\\n'\n' value. This object is accessed through the built-in name\\n'\n' \"NotImplemented\". Numeric methods and rich comparison methods\\n'\n' should return this value if they do not implement the operation '\n'for\\n'\n' the operands provided. (The interpreter will then try the\\n'\n' reflected operation, or some other fallback, depending on the\\n'\n' operator.) It should not be evaluated in a boolean context.\\n'\n'\\n'\n' See Implementing the arithmetic operations for more details.\\n'\n'\\n'\n' Changed in version 3.9: Evaluating \"NotImplemented\" in a '\n'boolean\\n'\n' context is deprecated. While it currently evaluates as true, it\\n'\n' will emit a \"DeprecationWarning\". It will raise a \"TypeError\" in '\n'a\\n'\n' future version of Python.\\n'\n'\\n'\n'Ellipsis\\n'\n' This type has a single value. There is a single object with '\n'this\\n'\n' value. This object is accessed through the literal \"...\" or the\\n'\n' built-in name \"Ellipsis\". Its truth value is true.\\n'\n'\\n'\n'\"numbers.Number\"\\n'\n' These are created by numeric literals and returned as results '\n'by\\n'\n' arithmetic operators and arithmetic built-in functions. '\n'Numeric\\n'\n' objects are immutable; once created their value never changes.\\n'\n' Python numbers are of course strongly related to mathematical\\n'\n' numbers, but subject to the limitations of numerical '\n'representation\\n'\n' in computers.\\n'\n'\\n'\n' The string representations of the numeric classes, computed by\\n'\n' \"__repr__()\" and \"__str__()\", have the following properties:\\n'\n'\\n'\n' * They are valid numeric literals which, when passed to their '\n'class\\n'\n' constructor, produce an object having the value of the '\n'original\\n'\n' numeric.\\n'\n'\\n'\n' * The representation is in base 10, when possible.\\n'\n'\\n'\n' * Leading zeros, possibly excepting a single zero before a '\n'decimal\\n'\n' point, are not shown.\\n'\n'\\n'\n' * Trailing zeros, possibly excepting a single zero after a '\n'decimal\\n'\n' point, are not shown.\\n'\n'\\n'\n' * A sign is shown only when the number is negative.\\n'\n'\\n'\n' Python distinguishes between integers, floating point numbers, '\n'and\\n'\n' complex numbers:\\n'\n'\\n'\n' \"numbers.Integral\"\\n'\n' These represent elements from the mathematical set of '\n'integers\\n'\n' (positive and negative).\\n'\n'\\n'\n' There are two types of integers:\\n'\n'\\n'\n' Integers (\"int\")\\n'\n' These represent numbers in an unlimited range, subject to\\n'\n' available (virtual) memory only. For the purpose of '\n'shift\\n'\n' and mask operations, a binary representation is assumed, '\n'and\\n'\n' negative numbers are represented in a variant of 2\u2019s\\n'\n' complement which gives the illusion of an infinite string '\n'of\\n'\n' sign bits extending to the left.\\n'\n'\\n'\n' Booleans (\"bool\")\\n'\n' These represent the truth values False and True. The two\\n'\n' objects representing the values \"False\" and \"True\" are '\n'the\\n'\n' only Boolean objects. The Boolean type is a subtype of '\n'the\\n'\n' integer type, and Boolean values behave like the values 0 '\n'and\\n'\n' 1, respectively, in almost all contexts, the exception '\n'being\\n'\n' that when converted to a string, the strings \"\"False\"\" or\\n'\n' \"\"True\"\" are returned, respectively.\\n'\n'\\n'\n' The rules for integer representation are intended to give '\n'the\\n'\n' most meaningful interpretation of shift and mask operations\\n'\n' involving negative integers.\\n'\n'\\n'\n' \"numbers.Real\" (\"float\")\\n'\n' These represent machine-level double precision floating '\n'point\\n'\n' numbers. You are at the mercy of the underlying machine\\n'\n' architecture (and C or Java implementation) for the accepted\\n'\n' range and handling of overflow. Python does not support '\n'single-\\n'\n' precision floating point numbers; the savings in processor '\n'and\\n'\n' memory usage that are usually the reason for using these are\\n'\n' dwarfed by the overhead of using objects in Python, so there '\n'is\\n'\n' no reason to complicate the language with two kinds of '\n'floating\\n'\n' point numbers.\\n'\n'\\n'\n' \"numbers.Complex\" (\"complex\")\\n'\n' These represent complex numbers as a pair of machine-level\\n'\n' double precision floating point numbers. The same caveats '\n'apply\\n'\n' as for floating point numbers. The real and imaginary parts '\n'of a\\n'\n' complex number \"z\" can be retrieved through the read-only\\n'\n' attributes \"z.real\" and \"z.imag\".\\n'\n'\\n'\n'Sequences\\n'\n' These represent finite ordered sets indexed by non-negative\\n'\n' numbers. The built-in function \"len()\" returns the number of '\n'items\\n'\n' of a sequence. When the length of a sequence is *n*, the index '\n'set\\n'\n' contains the numbers 0, 1, \u2026, *n*-1. Item *i* of sequence *a* '\n'is\\n'\n' selected by \"a[i]\".\\n'\n'\\n'\n' Sequences also support slicing: \"a[i:j]\" selects all items with\\n'\n' index *k* such that *i* \"<=\" *k* \"<\" *j*. When used as an\\n'\n' expression, a slice is a sequence of the same type. This '\n'implies\\n'\n' that the index set is renumbered so that it starts at 0.\\n'\n'\\n'\n' Some sequences also support \u201cextended slicing\u201d with a third '\n'\u201cstep\u201d\\n'\n' parameter: \"a[i:j:k]\" selects all items of *a* with index *x* '\n'where\\n'\n' \"x = i + n*k\", *n* \">=\" \"0\" and *i* \"<=\" *x* \"<\" *j*.\\n'\n'\\n'\n' Sequences are distinguished according to their mutability:\\n'\n'\\n'\n' Immutable sequences\\n'\n' An object of an immutable sequence type cannot change once it '\n'is\\n'\n' created. (If the object contains references to other '\n'objects,\\n'\n' these other objects may be mutable and may be changed; '\n'however,\\n'\n' the collection of objects directly referenced by an '\n'immutable\\n'\n' object cannot change.)\\n'\n'\\n'\n' The following types are immutable sequences:\\n'\n'\\n'\n' Strings\\n'\n' A string is a sequence of values that represent Unicode '\n'code\\n'\n' points. All the code points in the range \"U+0000 - '\n'U+10FFFF\"\\n'\n' can be represented in a string. Python doesn\u2019t have a '\n'*char*\\n'\n' type; instead, every code point in the string is '\n'represented\\n'\n' as a string object with length \"1\". The built-in '\n'function\\n'\n' \"ord()\" converts a code point from its string form to an\\n'\n' integer in the range \"0 - 10FFFF\"; \"chr()\" converts an\\n'\n' integer in the range \"0 - 10FFFF\" to the corresponding '\n'length\\n'\n' \"1\" string object. \"str.encode()\" can be used to convert '\n'a\\n'\n' \"str\" to \"bytes\" using the given text encoding, and\\n'\n' \"bytes.decode()\" can be used to achieve the opposite.\\n'\n'\\n'\n' Tuples\\n'\n' The items of a tuple are arbitrary Python objects. Tuples '\n'of\\n'\n' two or more items are formed by comma-separated lists of\\n'\n' expressions. A tuple of one item (a \u2018singleton\u2019) can be\\n'\n' formed by affixing a comma to an expression (an expression '\n'by\\n'\n' itself does not create a tuple, since parentheses must be\\n'\n' usable for grouping of expressions). An empty tuple can '\n'be\\n'\n' formed by an empty pair of parentheses.\\n'\n'\\n'\n' Bytes\\n'\n' A bytes object is an immutable array. The items are '\n'8-bit\\n'\n' bytes, represented by integers in the range 0 <= x < 256.\\n'\n' Bytes literals (like \"b\\'abc\\'\") and the built-in '\n'\"bytes()\"\\n'\n' constructor can be used to create bytes objects. Also, '\n'bytes\\n'\n' objects can be decoded to strings via the \"decode()\" '\n'method.\\n'\n'\\n'\n' Mutable sequences\\n'\n' Mutable sequences can be changed after they are created. '\n'The\\n'\n' subscription and slicing notations can be used as the target '\n'of\\n'\n' assignment and \"del\" (delete) statements.\\n'\n'\\n'\n' There are currently two intrinsic mutable sequence types:\\n'\n'\\n'\n' Lists\\n'\n' The items of a list are arbitrary Python objects. Lists '\n'are\\n'\n' formed by placing a comma-separated list of expressions '\n'in\\n'\n' square brackets. (Note that there are no special cases '\n'needed\\n'\n' to form lists of length 0 or 1.)\\n'\n'\\n'\n' Byte Arrays\\n'\n' A bytearray object is a mutable array. They are created '\n'by\\n'\n' the built-in \"bytearray()\" constructor. Aside from being\\n'\n' mutable (and hence unhashable), byte arrays otherwise '\n'provide\\n'\n' the same interface and functionality as immutable \"bytes\"\\n'\n' objects.\\n'\n'\\n'\n' The extension module \"array\" provides an additional example '\n'of a\\n'\n' mutable sequence type, as does the \"collections\" module.\\n'\n'\\n'\n'Set types\\n'\n' These represent unordered, finite sets of unique, immutable\\n'\n' objects. As such, they cannot be indexed by any subscript. '\n'However,\\n'\n' they can be iterated over, and the built-in function \"len()\"\\n'\n' returns the number of items in a set. Common uses for sets are '\n'fast\\n'\n' membership testing, removing duplicates from a sequence, and\\n'\n' computing mathematical operations such as intersection, union,\\n'\n' difference, and symmetric difference.\\n'\n'\\n'\n' For set elements, the same immutability rules apply as for\\n'\n' dictionary keys. Note that numeric types obey the normal rules '\n'for\\n'\n' numeric comparison: if two numbers compare equal (e.g., \"1\" and\\n'\n' \"1.0\"), only one of them can be contained in a set.\\n'\n'\\n'\n' There are currently two intrinsic set types:\\n'\n'\\n'\n' Sets\\n'\n' These represent a mutable set. They are created by the '\n'built-in\\n'\n' \"set()\" constructor and can be modified afterwards by '\n'several\\n'\n' methods, such as \"add()\".\\n'\n'\\n'\n' Frozen sets\\n'\n' These represent an immutable set. They are created by the\\n'\n' built-in \"frozenset()\" constructor. As a frozenset is '\n'immutable\\n'\n' and *hashable*, it can be used again as an element of '\n'another\\n'\n' set, or as a dictionary key.\\n'\n'\\n'\n'Mappings\\n'\n' These represent finite sets of objects indexed by arbitrary '\n'index\\n'\n' sets. The subscript notation \"a[k]\" selects the item indexed by '\n'\"k\"\\n'\n' from the mapping \"a\"; this can be used in expressions and as '\n'the\\n'\n' target of assignments or \"del\" statements. The built-in '\n'function\\n'\n' \"len()\" returns the number of items in a mapping.\\n'\n'\\n'\n' There is currently a single intrinsic mapping type:\\n'\n'\\n'\n' Dictionaries\\n'\n' These represent finite sets of objects indexed by nearly\\n'\n' arbitrary values. The only types of values not acceptable '\n'as\\n'\n' keys are values containing lists or dictionaries or other\\n'\n' mutable types that are compared by value rather than by '\n'object\\n'\n' identity, the reason being that the efficient implementation '\n'of\\n'\n' dictionaries requires a key\u2019s hash value to remain constant.\\n'\n' Numeric types used for keys obey the normal rules for '\n'numeric\\n'\n' comparison: if two numbers compare equal (e.g., \"1\" and '\n'\"1.0\")\\n'\n' then they can be used interchangeably to index the same\\n'\n' dictionary entry.\\n'\n'\\n'\n' Dictionaries preserve insertion order, meaning that keys will '\n'be\\n'\n' produced in the same order they were added sequentially over '\n'the\\n'\n' dictionary. Replacing an existing key does not change the '\n'order,\\n'\n' however removing a key and re-inserting it will add it to '\n'the\\n'\n' end instead of keeping its old place.\\n'\n'\\n'\n' Dictionaries are mutable; they can be created by the \"{...}\"\\n'\n' notation (see section Dictionary displays).\\n'\n'\\n'\n' The extension modules \"dbm.ndbm\" and \"dbm.gnu\" provide\\n'\n' additional examples of mapping types, as does the '\n'\"collections\"\\n'\n' module.\\n'\n'\\n'\n' Changed in version 3.7: Dictionaries did not preserve '\n'insertion\\n'\n' order in versions of Python before 3.6. In CPython 3.6,\\n'\n' insertion order was preserved, but it was considered an\\n'\n' implementation detail at that time rather than a language\\n'\n' guarantee.\\n'\n'\\n'\n'Callable types\\n'\n' These are the types to which the function call operation (see\\n'\n' section Calls) can be applied:\\n'\n'\\n'\n' User-defined functions\\n'\n' A user-defined function object is created by a function\\n'\n' definition (see section Function definitions). It should be\\n'\n' called with an argument list containing the same number of '\n'items\\n'\n' as the function\u2019s formal parameter list.\\n'\n'\\n'\n' Special attributes:\\n'\n'\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | Attribute | Meaning '\n'| |\\n'\n' '\n'|===========================|=================================|=============|\\n'\n' | \"__doc__\" | The function\u2019s documentation '\n'| Writable |\\n'\n' | | string, or \"None\" if '\n'| |\\n'\n' | | unavailable; not inherited by '\n'| |\\n'\n' | | subclasses. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__name__\" | The function\u2019s name. '\n'| Writable |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__qualname__\" | The function\u2019s *qualified '\n'| Writable |\\n'\n' | | name*. New in version 3.3. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__module__\" | The name of the module the '\n'| Writable |\\n'\n' | | function was defined in, or '\n'| |\\n'\n' | | \"None\" if unavailable. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__defaults__\" | A tuple containing default '\n'| Writable |\\n'\n' | | argument values for those '\n'| |\\n'\n' | | arguments that have defaults, '\n'| |\\n'\n' | | or \"None\" if no arguments have '\n'| |\\n'\n' | | a default value. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__code__\" | The code object representing '\n'| Writable |\\n'\n' | | the compiled function body. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__globals__\" | A reference to the dictionary '\n'| Read-only |\\n'\n' | | that holds the function\u2019s '\n'| |\\n'\n' | | global variables \u2014 the global '\n'| |\\n'\n' | | namespace of the module in '\n'| |\\n'\n' | | which the function was defined. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__dict__\" | The namespace supporting '\n'| Writable |\\n'\n' | | arbitrary function attributes. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__closure__\" | \"None\" or a tuple of cells that '\n'| Read-only |\\n'\n' | | contain bindings for the '\n'| |\\n'\n' | | function\u2019s free variables. See '\n'| |\\n'\n' | | below for information on the '\n'| |\\n'\n' | | \"cell_contents\" attribute. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__annotations__\" | A dict containing annotations '\n'| Writable |\\n'\n' | | of parameters. The keys of the '\n'| |\\n'\n' | | dict are the parameter names, '\n'| |\\n'\n' | | and \"\\'return\\'\" for the '\n'return | |\\n'\n' | | annotation, if provided. For '\n'| |\\n'\n' | | more information on working '\n'| |\\n'\n' | | with this attribute, see '\n'| |\\n'\n' | | Annotations Best Practices. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__kwdefaults__\" | A dict containing defaults for '\n'| Writable |\\n'\n' | | keyword-only parameters. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n'\\n'\n' Most of the attributes labelled \u201cWritable\u201d check the type of '\n'the\\n'\n' assigned value.\\n'\n'\\n'\n' Function objects also support getting and setting arbitrary\\n'\n' attributes, which can be used, for example, to attach '\n'metadata\\n'\n' to functions. Regular attribute dot-notation is used to get '\n'and\\n'\n' set such attributes. *Note that the current implementation '\n'only\\n'\n' supports function attributes on user-defined functions. '\n'Function\\n'\n' attributes on built-in functions may be supported in the\\n'\n' future.*\\n'\n'\\n'\n' A cell object has the attribute \"cell_contents\". This can be\\n'\n' used to get the value of the cell, as well as set the value.\\n'\n'\\n'\n' Additional information about a function\u2019s definition can be\\n'\n' retrieved from its code object; see the description of '\n'internal\\n'\n' types below. The \"cell\" type can be accessed in the \"types\"\\n'\n' module.\\n'\n'\\n'\n' Instance methods\\n'\n' An instance method object combines a class, a class instance '\n'and\\n'\n' any callable object (normally a user-defined function).\\n'\n'\\n'\n' Special read-only attributes: \"__self__\" is the class '\n'instance\\n'\n' object, \"__func__\" is the function object; \"__doc__\" is the\\n'\n' method\u2019s documentation (same as \"__func__.__doc__\"); '\n'\"__name__\"\\n'\n' is the method name (same as \"__func__.__name__\"); '\n'\"__module__\"\\n'\n' is the name of the module the method was defined in, or '\n'\"None\"\\n'\n' if unavailable.\\n'\n'\\n'\n' Methods also support accessing (but not setting) the '\n'arbitrary\\n'\n' function attributes on the underlying function object.\\n'\n'\\n'\n' User-defined method objects may be created when getting an\\n'\n' attribute of a class (perhaps via an instance of that class), '\n'if\\n'\n' that attribute is a user-defined function object or a class\\n'\n' method object.\\n'\n'\\n'\n' When an instance method object is created by retrieving a '\n'user-\\n'\n' defined function object from a class via one of its '\n'instances,\\n'\n' its \"__self__\" attribute is the instance, and the method '\n'object\\n'\n' is said to be bound. The new method\u2019s \"__func__\" attribute '\n'is\\n'\n' the original function object.\\n'\n'\\n'\n' When an instance method object is created by retrieving a '\n'class\\n'\n' method object from a class or instance, its \"__self__\" '\n'attribute\\n'\n' is the class itself, and its \"__func__\" attribute is the\\n'\n' function object underlying the class method.\\n'\n'\\n'\n' When an instance method object is called, the underlying\\n'\n' function (\"__func__\") is called, inserting the class '\n'instance\\n'\n' (\"__self__\") in front of the argument list. For instance, '\n'when\\n'\n' \"C\" is a class which contains a definition for a function '\n'\"f()\",\\n'\n' and \"x\" is an instance of \"C\", calling \"x.f(1)\" is equivalent '\n'to\\n'\n' calling \"C.f(x, 1)\".\\n'\n'\\n'\n' When an instance method object is derived from a class '\n'method\\n'\n' object, the \u201cclass instance\u201d stored in \"__self__\" will '\n'actually\\n'\n' be the class itself, so that calling either \"x.f(1)\" or '\n'\"C.f(1)\"\\n'\n' is equivalent to calling \"f(C,1)\" where \"f\" is the '\n'underlying\\n'\n' function.\\n'\n'\\n'\n' Note that the transformation from function object to '\n'instance\\n'\n' method object happens each time the attribute is retrieved '\n'from\\n'\n' the instance. In some cases, a fruitful optimization is to\\n'\n' assign the attribute to a local variable and call that local\\n'\n' variable. Also notice that this transformation only happens '\n'for\\n'\n' user-defined functions; other callable objects (and all non-\\n'\n' callable objects) are retrieved without transformation. It '\n'is\\n'\n' also important to note that user-defined functions which are\\n'\n' attributes of a class instance are not converted to bound\\n'\n' methods; this *only* happens when the function is an '\n'attribute\\n'\n' of the class.\\n'\n'\\n'\n' Generator functions\\n'\n' A function or method which uses the \"yield\" statement (see\\n'\n' section The yield statement) is called a *generator '\n'function*.\\n'\n' Such a function, when called, always returns an iterator '\n'object\\n'\n' which can be used to execute the body of the function: '\n'calling\\n'\n' the iterator\u2019s \"iterator.__next__()\" method will cause the\\n'\n' function to execute until it provides a value using the '\n'\"yield\"\\n'\n' statement. When the function executes a \"return\" statement '\n'or\\n'\n' falls off the end, a \"StopIteration\" exception is raised and '\n'the\\n'\n' iterator will have reached the end of the set of values to '\n'be\\n'\n' returned.\\n'\n'\\n'\n' Coroutine functions\\n'\n' A function or method which is defined using \"async def\" is\\n'\n' called a *coroutine function*. Such a function, when '\n'called,\\n'\n' returns a *coroutine* object. It may contain \"await\"\\n'\n' expressions, as well as \"async with\" and \"async for\" '\n'statements.\\n'\n' See also the Coroutine Objects section.\\n'\n'\\n'\n' Asynchronous generator functions\\n'\n' A function or method which is defined using \"async def\" and\\n'\n' which uses the \"yield\" statement is called a *asynchronous\\n'\n' generator function*. Such a function, when called, returns '\n'an\\n'\n' asynchronous iterator object which can be used in an \"async '\n'for\"\\n'\n' statement to execute the body of the function.\\n'\n'\\n'\n' Calling the asynchronous iterator\u2019s \"aiterator.__anext__()\"\\n'\n' method will return an *awaitable* which when awaited will\\n'\n' execute until it provides a value using the \"yield\" '\n'expression.\\n'\n' When the function executes an empty \"return\" statement or '\n'falls\\n'\n' off the end, a \"StopAsyncIteration\" exception is raised and '\n'the\\n'\n' asynchronous iterator will have reached the end of the set '\n'of\\n'\n' values to be yielded.\\n'\n'\\n'\n' Built-in functions\\n'\n' A built-in function object is a wrapper around a C function.\\n'\n' Examples of built-in functions are \"len()\" and \"math.sin()\"\\n'\n' (\"math\" is a standard built-in module). The number and type '\n'of\\n'\n' the arguments are determined by the C function. Special '\n'read-\\n'\n' only attributes: \"__doc__\" is the function\u2019s documentation\\n'\n' string, or \"None\" if unavailable; \"__name__\" is the '\n'function\u2019s\\n'\n' name; \"__self__\" is set to \"None\" (but see the next item);\\n'\n' \"__module__\" is the name of the module the function was '\n'defined\\n'\n' in or \"None\" if unavailable.\\n'\n'\\n'\n' Built-in methods\\n'\n' This is really a different disguise of a built-in function, '\n'this\\n'\n' time containing an object passed to the C function as an\\n'\n' implicit extra argument. An example of a built-in method is\\n'\n' \"alist.append()\", assuming *alist* is a list object. In this\\n'\n' case, the special read-only attribute \"__self__\" is set to '\n'the\\n'\n' object denoted by *alist*.\\n'\n'\\n'\n' Classes\\n'\n' Classes are callable. These objects normally act as '\n'factories\\n'\n' for new instances of themselves, but variations are possible '\n'for\\n'\n' class types that override \"__new__()\". The arguments of the\\n'\n' call are passed to \"__new__()\" and, in the typical case, to\\n'\n' \"__init__()\" to initialize the new instance.\\n'\n'\\n'\n' Class Instances\\n'\n' Instances of arbitrary classes can be made callable by '\n'defining\\n'\n' a \"__call__()\" method in their class.\\n'\n'\\n'\n'Modules\\n'\n' Modules are a basic organizational unit of Python code, and are\\n'\n' created by the import system as invoked either by the \"import\"\\n'\n' statement, or by calling functions such as\\n'\n' \"importlib.import_module()\" and built-in \"__import__()\". A '\n'module\\n'\n' object has a namespace implemented by a dictionary object (this '\n'is\\n'\n' the dictionary referenced by the \"__globals__\" attribute of\\n'\n' functions defined in the module). Attribute references are\\n'\n' translated to lookups in this dictionary, e.g., \"m.x\" is '\n'equivalent\\n'\n' to \"m.__dict__[\"x\"]\". A module object does not contain the code\\n'\n' object used to initialize the module (since it isn\u2019t needed '\n'once\\n'\n' the initialization is done).\\n'\n'\\n'\n' Attribute assignment updates the module\u2019s namespace dictionary,\\n'\n' e.g., \"m.x = 1\" is equivalent to \"m.__dict__[\"x\"] = 1\".\\n'\n'\\n'\n' Predefined (writable) attributes:\\n'\n'\\n'\n' \"__name__\"\\n'\n' The module\u2019s name.\\n'\n'\\n'\n' \"__doc__\"\\n'\n' The module\u2019s documentation string, or \"None\" if '\n'unavailable.\\n'\n'\\n'\n' \"__file__\"\\n'\n' The pathname of the file from which the module was loaded, '\n'if\\n'\n' it was loaded from a file. The \"__file__\" attribute may '\n'be\\n'\n' missing for certain types of modules, such as C modules '\n'that\\n'\n' are statically linked into the interpreter. For '\n'extension\\n'\n' modules loaded dynamically from a shared library, it\u2019s '\n'the\\n'\n' pathname of the shared library file.\\n'\n'\\n'\n' \"__annotations__\"\\n'\n' A dictionary containing *variable annotations* collected\\n'\n' during module body execution. For best practices on '\n'working\\n'\n' with \"__annotations__\", please see Annotations Best\\n'\n' Practices.\\n'\n'\\n'\n' Special read-only attribute: \"__dict__\" is the module\u2019s '\n'namespace\\n'\n' as a dictionary object.\\n'\n'\\n'\n' **CPython implementation detail:** Because of the way CPython\\n'\n' clears module dictionaries, the module dictionary will be '\n'cleared\\n'\n' when the module falls out of scope even if the dictionary still '\n'has\\n'\n' live references. To avoid this, copy the dictionary or keep '\n'the\\n'\n' module around while using its dictionary directly.\\n'\n'\\n'\n'Custom classes\\n'\n' Custom class types are typically created by class definitions '\n'(see\\n'\n' section Class definitions). A class has a namespace implemented '\n'by\\n'\n' a dictionary object. Class attribute references are translated '\n'to\\n'\n' lookups in this dictionary, e.g., \"C.x\" is translated to\\n'\n' \"C.__dict__[\"x\"]\" (although there are a number of hooks which '\n'allow\\n'\n' for other means of locating attributes). When the attribute name '\n'is\\n'\n' not found there, the attribute search continues in the base\\n'\n' classes. This search of the base classes uses the C3 method\\n'\n' resolution order which behaves correctly even in the presence '\n'of\\n'\n' \u2018diamond\u2019 inheritance structures where there are multiple\\n'\n' inheritance paths leading back to a common ancestor. Additional\\n'\n' details on the C3 MRO used by Python can be found in the\\n'\n' documentation accompanying the 2.3 release at\\n'\n' https://www.python.org/download/releases/2.3/mro/.\\n'\n'\\n'\n' When a class attribute reference (for class \"C\", say) would '\n'yield a\\n'\n' class method object, it is transformed into an instance method\\n'\n' object whose \"__self__\" attribute is \"C\". When it would yield '\n'a\\n'\n' static method object, it is transformed into the object wrapped '\n'by\\n'\n' the static method object. See section Implementing Descriptors '\n'for\\n'\n' another way in which attributes retrieved from a class may '\n'differ\\n'\n' from those actually contained in its \"__dict__\".\\n'\n'\\n'\n' Class attribute assignments update the class\u2019s dictionary, '\n'never\\n'\n' the dictionary of a base class.\\n'\n'\\n'\n' A class object can be called (see above) to yield a class '\n'instance\\n'\n' (see below).\\n'\n'\\n'\n' Special attributes:\\n'\n'\\n'\n' \"__name__\"\\n'\n' The class name.\\n'\n'\\n'\n' \"__module__\"\\n'\n' The name of the module in which the class was defined.\\n'\n'\\n'\n' \"__dict__\"\\n'\n' The dictionary containing the class\u2019s namespace.\\n'\n'\\n'\n' \"__bases__\"\\n'\n' A tuple containing the base classes, in the order of '\n'their\\n'\n' occurrence in the base class list.\\n'\n'\\n'\n' \"__doc__\"\\n'\n' The class\u2019s documentation string, or \"None\" if undefined.\\n'\n'\\n'\n' \"__annotations__\"\\n'\n' A dictionary containing *variable annotations* collected\\n'\n' during class body execution. For best practices on '\n'working\\n'\n' with \"__annotations__\", please see Annotations Best\\n'\n' Practices.\\n'\n'\\n'\n'Class instances\\n'\n' A class instance is created by calling a class object (see '\n'above).\\n'\n' A class instance has a namespace implemented as a dictionary '\n'which\\n'\n' is the first place in which attribute references are searched.\\n'\n' When an attribute is not found there, and the instance\u2019s class '\n'has\\n'\n' an attribute by that name, the search continues with the class\\n'\n' attributes. If a class attribute is found that is a '\n'user-defined\\n'\n' function object, it is transformed into an instance method '\n'object\\n'\n' whose \"__self__\" attribute is the instance. Static method and\\n'\n' class method objects are also transformed; see above under\\n'\n' \u201cClasses\u201d. See section Implementing Descriptors for another way '\n'in\\n'\n' which attributes of a class retrieved via its instances may '\n'differ\\n'\n' from the objects actually stored in the class\u2019s \"__dict__\". If '\n'no\\n'\n' class attribute is found, and the object\u2019s class has a\\n'\n' \"__getattr__()\" method, that is called to satisfy the lookup.\\n'\n'\\n'\n' Attribute assignments and deletions update the instance\u2019s\\n'\n' dictionary, never a class\u2019s dictionary. If the class has a\\n'\n' \"__setattr__()\" or \"__delattr__()\" method, this is called '\n'instead\\n'\n' of updating the instance dictionary directly.\\n'\n'\\n'\n' Class instances can pretend to be numbers, sequences, or '\n'mappings\\n'\n' if they have methods with certain special names. See section\\n'\n' Special method names.\\n'\n'\\n'\n' Special attributes: \"__dict__\" is the attribute dictionary;\\n'\n' \"__class__\" is the instance\u2019s class.\\n'\n'\\n'\n'I/O objects (also known as file objects)\\n'\n' A *file object* represents an open file. Various shortcuts are\\n'\n' available to create file objects: the \"open()\" built-in '\n'function,\\n'\n' and also \"os.popen()\", \"os.fdopen()\", and the \"makefile()\" '\n'method\\n'\n' of socket objects (and perhaps by other functions or methods\\n'\n' provided by extension modules).\\n'\n'\\n'\n' The objects \"sys.stdin\", \"sys.stdout\" and \"sys.stderr\" are\\n'\n' initialized to file objects corresponding to the interpreter\u2019s\\n'\n' standard input, output and error streams; they are all open in '\n'text\\n'\n' mode and therefore follow the interface defined by the\\n'\n' \"io.TextIOBase\" abstract class.\\n'\n'\\n'\n'Internal types\\n'\n' A few types used internally by the interpreter are exposed to '\n'the\\n'\n' user. Their definitions may change with future versions of the\\n'\n' interpreter, but they are mentioned here for completeness.\\n'\n'\\n'\n' Code objects\\n'\n' Code objects represent *byte-compiled* executable Python '\n'code,\\n'\n' or *bytecode*. The difference between a code object and a\\n'\n' function object is that the function object contains an '\n'explicit\\n'\n' reference to the function\u2019s globals (the module in which it '\n'was\\n'\n' defined), while a code object contains no context; also the\\n'\n' default argument values are stored in the function object, '\n'not\\n'\n' in the code object (because they represent values calculated '\n'at\\n'\n' run-time). Unlike function objects, code objects are '\n'immutable\\n'\n' and contain no references (directly or indirectly) to '\n'mutable\\n'\n' objects.\\n'\n'\\n'\n' Special read-only attributes: \"co_name\" gives the function '\n'name;\\n'\n' \"co_argcount\" is the total number of positional arguments\\n'\n' (including positional-only arguments and arguments with '\n'default\\n'\n' values); \"co_posonlyargcount\" is the number of '\n'positional-only\\n'\n' arguments (including arguments with default values);\\n'\n' \"co_kwonlyargcount\" is the number of keyword-only arguments\\n'\n' (including arguments with default values); \"co_nlocals\" is '\n'the\\n'\n' number of local variables used by the function (including\\n'\n' arguments); \"co_varnames\" is a tuple containing the names of '\n'the\\n'\n' local variables (starting with the argument names);\\n'\n' \"co_cellvars\" is a tuple containing the names of local '\n'variables\\n'\n' that are referenced by nested functions; \"co_freevars\" is a\\n'\n' tuple containing the names of free variables; \"co_code\" is a\\n'\n' string representing the sequence of bytecode instructions;\\n'\n' \"co_consts\" is a tuple containing the literals used by the\\n'\n' bytecode; \"co_names\" is a tuple containing the names used by '\n'the\\n'\n' bytecode; \"co_filename\" is the filename from which the code '\n'was\\n'\n' compiled; \"co_firstlineno\" is the first line number of the\\n'\n' function; \"co_lnotab\" is a string encoding the mapping from\\n'\n' bytecode offsets to line numbers (for details see the source\\n'\n' code of the interpreter); \"co_stacksize\" is the required '\n'stack\\n'\n' size; \"co_flags\" is an integer encoding a number of flags '\n'for\\n'\n' the interpreter.\\n'\n'\\n'\n' The following flag bits are defined for \"co_flags\": bit '\n'\"0x04\"\\n'\n' is set if the function uses the \"*arguments\" syntax to accept '\n'an\\n'\n' arbitrary number of positional arguments; bit \"0x08\" is set '\n'if\\n'\n' the function uses the \"**keywords\" syntax to accept '\n'arbitrary\\n'\n' keyword arguments; bit \"0x20\" is set if the function is a\\n'\n' generator.\\n'\n'\\n'\n' Future feature declarations (\"from __future__ import '\n'division\")\\n'\n' also use bits in \"co_flags\" to indicate whether a code '\n'object\\n'\n' was compiled with a particular feature enabled: bit \"0x2000\" '\n'is\\n'\n' set if the function was compiled with future division '\n'enabled;\\n'\n' bits \"0x10\" and \"0x1000\" were used in earlier versions of\\n'\n' Python.\\n'\n'\\n'\n' Other bits in \"co_flags\" are reserved for internal use.\\n'\n'\\n'\n' If a code object represents a function, the first item in\\n'\n' \"co_consts\" is the documentation string of the function, or\\n'\n' \"None\" if undefined.\\n'\n'\\n'\n' Frame objects\\n'\n' Frame objects represent execution frames. They may occur in\\n'\n' traceback objects (see below), and are also passed to '\n'registered\\n'\n' trace functions.\\n'\n'\\n'\n' Special read-only attributes: \"f_back\" is to the previous '\n'stack\\n'\n' frame (towards the caller), or \"None\" if this is the bottom\\n'\n' stack frame; \"f_code\" is the code object being executed in '\n'this\\n'\n' frame; \"f_locals\" is the dictionary used to look up local\\n'\n' variables; \"f_globals\" is used for global variables;\\n'\n' \"f_builtins\" is used for built-in (intrinsic) names; '\n'\"f_lasti\"\\n'\n' gives the precise instruction (this is an index into the\\n'\n' bytecode string of the code object).\\n'\n'\\n'\n' Accessing \"f_code\" raises an auditing event '\n'\"object.__getattr__\"\\n'\n' with arguments \"obj\" and \"\"f_code\"\".\\n'\n'\\n'\n' Special writable attributes: \"f_trace\", if not \"None\", is a\\n'\n' function called for various events during code execution '\n'(this\\n'\n' is used by the debugger). Normally an event is triggered for\\n'\n' each new source line - this can be disabled by setting\\n'\n' \"f_trace_lines\" to \"False\".\\n'\n'\\n'\n' Implementations *may* allow per-opcode events to be requested '\n'by\\n'\n' setting \"f_trace_opcodes\" to \"True\". Note that this may lead '\n'to\\n'\n' undefined interpreter behaviour if exceptions raised by the\\n'\n' trace function escape to the function being traced.\\n'\n'\\n'\n' \"f_lineno\" is the current line number of the frame \u2014 writing '\n'to\\n'\n' this from within a trace function jumps to the given line '\n'(only\\n'\n' for the bottom-most frame). A debugger can implement a Jump\\n'\n' command (aka Set Next Statement) by writing to f_lineno.\\n'\n'\\n'\n' Frame objects support one method:\\n'\n'\\n'\n' frame.clear()\\n'\n'\\n'\n' This method clears all references to local variables held '\n'by\\n'\n' the frame. Also, if the frame belonged to a generator, '\n'the\\n'\n' generator is finalized. This helps break reference '\n'cycles\\n'\n' involving frame objects (for example when catching an\\n'\n' exception and storing its traceback for later use).\\n'\n'\\n'\n' \"RuntimeError\" is raised if the frame is currently '\n'executing.\\n'\n'\\n'\n' New in version 3.4.\\n'\n'\\n'\n' Traceback objects\\n'\n' Traceback objects represent a stack trace of an exception. '\n'A\\n'\n' traceback object is implicitly created when an exception '\n'occurs,\\n'\n' and may also be explicitly created by calling\\n'\n' \"types.TracebackType\".\\n'\n'\\n'\n' For implicitly created tracebacks, when the search for an\\n'\n' exception handler unwinds the execution stack, at each '\n'unwound\\n'\n' level a traceback object is inserted in front of the current\\n'\n' traceback. When an exception handler is entered, the stack\\n'\n' trace is made available to the program. (See section The try\\n'\n' statement.) It is accessible as the third item of the tuple\\n'\n' returned by \"sys.exc_info()\", and as the \"__traceback__\"\\n'\n' attribute of the caught exception.\\n'\n'\\n'\n' When the program contains no suitable handler, the stack '\n'trace\\n'\n' is written (nicely formatted) to the standard error stream; '\n'if\\n'\n' the interpreter is interactive, it is also made available to '\n'the\\n'\n' user as \"sys.last_traceback\".\\n'\n'\\n'\n' For explicitly created tracebacks, it is up to the creator '\n'of\\n'\n' the traceback to determine how the \"tb_next\" attributes '\n'should\\n'\n' be linked to form a full stack trace.\\n'\n'\\n'\n' Special read-only attributes: \"tb_frame\" points to the '\n'execution\\n'\n' frame of the current level; \"tb_lineno\" gives the line '\n'number\\n'\n' where the exception occurred; \"tb_lasti\" indicates the '\n'precise\\n'\n' instruction. The line number and last instruction in the\\n'\n' traceback may differ from the line number of its frame object '\n'if\\n'\n' the exception occurred in a \"try\" statement with no matching\\n'\n' except clause or with a finally clause.\\n'\n'\\n'\n' Accessing \"tb_frame\" raises an auditing event\\n'\n' \"object.__getattr__\" with arguments \"obj\" and \"\"tb_frame\"\".\\n'\n'\\n'\n' Special writable attribute: \"tb_next\" is the next level in '\n'the\\n'\n' stack trace (towards the frame where the exception occurred), '\n'or\\n'\n' \"None\" if there is no next level.\\n'\n'\\n'\n' Changed in version 3.7: Traceback objects can now be '\n'explicitly\\n'\n' instantiated from Python code, and the \"tb_next\" attribute '\n'of\\n'\n' existing instances can be updated.\\n'\n'\\n'\n' Slice objects\\n'\n' Slice objects are used to represent slices for '\n'\"__getitem__()\"\\n'\n' methods. They are also created by the built-in \"slice()\"\\n'\n' function.\\n'\n'\\n'\n' Special read-only attributes: \"start\" is the lower bound; '\n'\"stop\"\\n'\n' is the upper bound; \"step\" is the step value; each is \"None\" '\n'if\\n'\n' omitted. These attributes can have any type.\\n'\n'\\n'\n' Slice objects support one method:\\n'\n'\\n'\n' slice.indices(self, length)\\n'\n'\\n'\n' This method takes a single integer argument *length* and\\n'\n' computes information about the slice that the slice '\n'object\\n'\n' would describe if applied to a sequence of *length* '\n'items.\\n'\n' It returns a tuple of three integers; respectively these '\n'are\\n'\n' the *start* and *stop* indices and the *step* or stride\\n'\n' length of the slice. Missing or out-of-bounds indices are\\n'\n' handled in a manner consistent with regular slices.\\n'\n'\\n'\n' Static method objects\\n'\n' Static method objects provide a way of defeating the\\n'\n' transformation of function objects to method objects '\n'described\\n'\n' above. A static method object is a wrapper around any other\\n'\n' object, usually a user-defined method object. When a static\\n'\n' method object is retrieved from a class or a class instance, '\n'the\\n'\n' object actually returned is the wrapped object, which is not\\n'\n' subject to any further transformation. Static method objects '\n'are\\n'\n' also callable. Static method objects are created by the '\n'built-in\\n'\n' \"staticmethod()\" constructor.\\n'\n'\\n'\n' Class method objects\\n'\n' A class method object, like a static method object, is a '\n'wrapper\\n'\n' around another object that alters the way in which that '\n'object\\n'\n' is retrieved from classes and class instances. The behaviour '\n'of\\n'\n' class method objects upon such retrieval is described above,\\n'\n' under \u201cUser-defined methods\u201d. Class method objects are '\n'created\\n'\n' by the built-in \"classmethod()\" constructor.\\n',\n'typesfunctions':'Functions\\n'\n'*********\\n'\n'\\n'\n'Function objects are created by function definitions. The '\n'only\\n'\n'operation on a function object is to call it: '\n'\"func(argument-list)\".\\n'\n'\\n'\n'There are really two flavors of function objects: built-in '\n'functions\\n'\n'and user-defined functions. Both support the same '\n'operation (to call\\n'\n'the function), but the implementation is different, hence '\n'the\\n'\n'different object types.\\n'\n'\\n'\n'See Function definitions for more information.\\n',\n'typesmapping':'Mapping Types \u2014 \"dict\"\\n'\n'**********************\\n'\n'\\n'\n'A *mapping* object maps *hashable* values to arbitrary '\n'objects.\\n'\n'Mappings are mutable objects. There is currently only one '\n'standard\\n'\n'mapping type, the *dictionary*. (For other containers see '\n'the built-\\n'\n'in \"list\", \"set\", and \"tuple\" classes, and the \"collections\" '\n'module.)\\n'\n'\\n'\n'A dictionary\u2019s keys are *almost* arbitrary values. Values '\n'that are\\n'\n'not *hashable*, that is, values containing lists, '\n'dictionaries or\\n'\n'other mutable types (that are compared by value rather than '\n'by object\\n'\n'identity) may not be used as keys. Numeric types used for '\n'keys obey\\n'\n'the normal rules for numeric comparison: if two numbers '\n'compare equal\\n'\n'(such as \"1\" and \"1.0\") then they can be used '\n'interchangeably to index\\n'\n'the same dictionary entry. (Note however, that since '\n'computers store\\n'\n'floating-point numbers as approximations it is usually '\n'unwise to use\\n'\n'them as dictionary keys.)\\n'\n'\\n'\n'Dictionaries can be created by placing a comma-separated '\n'list of \"key:\\n'\n'value\" pairs within braces, for example: \"{\\'jack\\': 4098, '\n\"'sjoerd':\\n\"\n'4127}\" or \"{4098: \\'jack\\', 4127: \\'sjoerd\\'}\", or by the '\n'\"dict\"\\n'\n'constructor.\\n'\n'\\n'\n'class dict(**kwarg)\\n'\n'class dict(mapping, **kwarg)\\n'\n'class dict(iterable, **kwarg)\\n'\n'\\n'\n' Return a new dictionary initialized from an optional '\n'positional\\n'\n' argument and a possibly empty set of keyword arguments.\\n'\n'\\n'\n' Dictionaries can be created by several means:\\n'\n'\\n'\n' * Use a comma-separated list of \"key: value\" pairs within '\n'braces:\\n'\n' \"{\\'jack\\': 4098, \\'sjoerd\\': 4127}\" or \"{4098: '\n\"'jack', 4127:\\n\"\n' \\'sjoerd\\'}\"\\n'\n'\\n'\n' * Use a dict comprehension: \"{}\", \"{x: x ** 2 for x in '\n'range(10)}\"\\n'\n'\\n'\n' * Use the type constructor: \"dict()\", \"dict([(\\'foo\\', '\n\"100), ('bar',\\n\"\n' 200)])\", \"dict(foo=100, bar=200)\"\\n'\n'\\n'\n' If no positional argument is given, an empty dictionary '\n'is created.\\n'\n' If a positional argument is given and it is a mapping '\n'object, a\\n'\n' dictionary is created with the same key-value pairs as '\n'the mapping\\n'\n' object. Otherwise, the positional argument must be an '\n'*iterable*\\n'\n' object. Each item in the iterable must itself be an '\n'iterable with\\n'\n' exactly two objects. The first object of each item '\n'becomes a key\\n'\n' in the new dictionary, and the second object the '\n'corresponding\\n'\n' value. If a key occurs more than once, the last value '\n'for that key\\n'\n' becomes the corresponding value in the new dictionary.\\n'\n'\\n'\n' If keyword arguments are given, the keyword arguments and '\n'their\\n'\n' values are added to the dictionary created from the '\n'positional\\n'\n' argument. If a key being added is already present, the '\n'value from\\n'\n' the keyword argument replaces the value from the '\n'positional\\n'\n' argument.\\n'\n'\\n'\n' To illustrate, the following examples all return a '\n'dictionary equal\\n'\n' to \"{\"one\": 1, \"two\": 2, \"three\": 3}\":\\n'\n'\\n'\n' >>> a = dict(one=1, two=2, three=3)\\n'\n\" >>> b = {'one': 1, 'two': 2, 'three': 3}\\n\"\n\" >>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\\n\"\n\" >>> d = dict([('two', 2), ('one', 1), ('three', 3)])\\n\"\n\" >>> e = dict({'three': 3, 'one': 1, 'two': 2})\\n\"\n\" >>> f = dict({'one': 1, 'three': 3}, two=2)\\n\"\n' >>> a == b == c == d == e == f\\n'\n' True\\n'\n'\\n'\n' Providing keyword arguments as in the first example only '\n'works for\\n'\n' keys that are valid Python identifiers. Otherwise, any '\n'valid keys\\n'\n' can be used.\\n'\n'\\n'\n' These are the operations that dictionaries support (and '\n'therefore,\\n'\n' custom mapping types should support too):\\n'\n'\\n'\n' list(d)\\n'\n'\\n'\n' Return a list of all the keys used in the dictionary '\n'*d*.\\n'\n'\\n'\n' len(d)\\n'\n'\\n'\n' Return the number of items in the dictionary *d*.\\n'\n'\\n'\n' d[key]\\n'\n'\\n'\n' Return the item of *d* with key *key*. Raises a '\n'\"KeyError\" if\\n'\n' *key* is not in the map.\\n'\n'\\n'\n' If a subclass of dict defines a method \"__missing__()\" '\n'and *key*\\n'\n' is not present, the \"d[key]\" operation calls that '\n'method with\\n'\n' the key *key* as argument. The \"d[key]\" operation '\n'then returns\\n'\n' or raises whatever is returned or raised by the\\n'\n' \"__missing__(key)\" call. No other operations or '\n'methods invoke\\n'\n' \"__missing__()\". If \"__missing__()\" is not defined, '\n'\"KeyError\"\\n'\n' is raised. \"__missing__()\" must be a method; it cannot '\n'be an\\n'\n' instance variable:\\n'\n'\\n'\n' >>> class Counter(dict):\\n'\n' ... def __missing__(self, key):\\n'\n' ... return 0\\n'\n' >>> c = Counter()\\n'\n\" >>> c['red']\\n\"\n' 0\\n'\n\" >>> c['red'] += 1\\n\"\n\" >>> c['red']\\n\"\n' 1\\n'\n'\\n'\n' The example above shows part of the implementation of\\n'\n' \"collections.Counter\". A different \"__missing__\" '\n'method is used\\n'\n' by \"collections.defaultdict\".\\n'\n'\\n'\n' d[key] = value\\n'\n'\\n'\n' Set \"d[key]\" to *value*.\\n'\n'\\n'\n' del d[key]\\n'\n'\\n'\n' Remove \"d[key]\" from *d*. Raises a \"KeyError\" if '\n'*key* is not\\n'\n' in the map.\\n'\n'\\n'\n' key in d\\n'\n'\\n'\n' Return \"True\" if *d* has a key *key*, else \"False\".\\n'\n'\\n'\n' key not in d\\n'\n'\\n'\n' Equivalent to \"not key in d\".\\n'\n'\\n'\n' iter(d)\\n'\n'\\n'\n' Return an iterator over the keys of the dictionary. '\n'This is a\\n'\n' shortcut for \"iter(d.keys())\".\\n'\n'\\n'\n' clear()\\n'\n'\\n'\n' Remove all items from the dictionary.\\n'\n'\\n'\n' copy()\\n'\n'\\n'\n' Return a shallow copy of the dictionary.\\n'\n'\\n'\n' classmethod fromkeys(iterable[, value])\\n'\n'\\n'\n' Create a new dictionary with keys from *iterable* and '\n'values set\\n'\n' to *value*.\\n'\n'\\n'\n' \"fromkeys()\" is a class method that returns a new '\n'dictionary.\\n'\n' *value* defaults to \"None\". All of the values refer '\n'to just a\\n'\n' single instance, so it generally doesn\u2019t make sense '\n'for *value*\\n'\n' to be a mutable object such as an empty list. To get '\n'distinct\\n'\n' values, use a dict comprehension instead.\\n'\n'\\n'\n' get(key[, default])\\n'\n'\\n'\n' Return the value for *key* if *key* is in the '\n'dictionary, else\\n'\n' *default*. If *default* is not given, it defaults to '\n'\"None\", so\\n'\n' that this method never raises a \"KeyError\".\\n'\n'\\n'\n' items()\\n'\n'\\n'\n' Return a new view of the dictionary\u2019s items (\"(key, '\n'value)\"\\n'\n' pairs). See the documentation of view objects.\\n'\n'\\n'\n' keys()\\n'\n'\\n'\n' Return a new view of the dictionary\u2019s keys. See the\\n'\n' documentation of view objects.\\n'\n'\\n'\n' pop(key[, default])\\n'\n'\\n'\n' If *key* is in the dictionary, remove it and return '\n'its value,\\n'\n' else return *default*. If *default* is not given and '\n'*key* is\\n'\n' not in the dictionary, a \"KeyError\" is raised.\\n'\n'\\n'\n' popitem()\\n'\n'\\n'\n' Remove and return a \"(key, value)\" pair from the '\n'dictionary.\\n'\n' Pairs are returned in LIFO (last-in, first-out) '\n'order.\\n'\n'\\n'\n' \"popitem()\" is useful to destructively iterate over a\\n'\n' dictionary, as often used in set algorithms. If the '\n'dictionary\\n'\n' is empty, calling \"popitem()\" raises a \"KeyError\".\\n'\n'\\n'\n' Changed in version 3.7: LIFO order is now guaranteed. '\n'In prior\\n'\n' versions, \"popitem()\" would return an arbitrary '\n'key/value pair.\\n'\n'\\n'\n' reversed(d)\\n'\n'\\n'\n' Return a reverse iterator over the keys of the '\n'dictionary. This\\n'\n' is a shortcut for \"reversed(d.keys())\".\\n'\n'\\n'\n' New in version 3.8.\\n'\n'\\n'\n' setdefault(key[, default])\\n'\n'\\n'\n' If *key* is in the dictionary, return its value. If '\n'not, insert\\n'\n' *key* with a value of *default* and return *default*. '\n'*default*\\n'\n' defaults to \"None\".\\n'\n'\\n'\n' update([other])\\n'\n'\\n'\n' Update the dictionary with the key/value pairs from '\n'*other*,\\n'\n' overwriting existing keys. Return \"None\".\\n'\n'\\n'\n' \"update()\" accepts either another dictionary object or '\n'an\\n'\n' iterable of key/value pairs (as tuples or other '\n'iterables of\\n'\n' length two). If keyword arguments are specified, the '\n'dictionary\\n'\n' is then updated with those key/value pairs: '\n'\"d.update(red=1,\\n'\n' blue=2)\".\\n'\n'\\n'\n' values()\\n'\n'\\n'\n' Return a new view of the dictionary\u2019s values. See '\n'the\\n'\n' documentation of view objects.\\n'\n'\\n'\n' An equality comparison between one \"dict.values()\" '\n'view and\\n'\n' another will always return \"False\". This also applies '\n'when\\n'\n' comparing \"dict.values()\" to itself:\\n'\n'\\n'\n\" >>> d = {'a': 1}\\n\"\n' >>> d.values() == d.values()\\n'\n' False\\n'\n'\\n'\n' d | other\\n'\n'\\n'\n' Create a new dictionary with the merged keys and '\n'values of *d*\\n'\n' and *other*, which must both be dictionaries. The '\n'values of\\n'\n' *other* take priority when *d* and *other* share '\n'keys.\\n'\n'\\n'\n' New in version 3.9.\\n'\n'\\n'\n' d |= other\\n'\n'\\n'\n' Update the dictionary *d* with keys and values from '\n'*other*,\\n'\n' which may be either a *mapping* or an *iterable* of '\n'key/value\\n'\n' pairs. The values of *other* take priority when *d* '\n'and *other*\\n'\n' share keys.\\n'\n'\\n'\n' New in version 3.9.\\n'\n'\\n'\n' Dictionaries compare equal if and only if they have the '\n'same \"(key,\\n'\n' value)\" pairs (regardless of ordering). Order comparisons '\n'(\u2018<\u2019,\\n'\n' \u2018<=\u2019, \u2018>=\u2019, \u2018>\u2019) raise \"TypeError\".\\n'\n'\\n'\n' Dictionaries preserve insertion order. Note that '\n'updating a key\\n'\n' does not affect the order. Keys added after deletion are '\n'inserted\\n'\n' at the end.\\n'\n'\\n'\n' >>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\\n'\n' >>> d\\n'\n\" {'one': 1, 'two': 2, 'three': 3, 'four': 4}\\n\"\n' >>> list(d)\\n'\n\" ['one', 'two', 'three', 'four']\\n\"\n' >>> list(d.values())\\n'\n' [1, 2, 3, 4]\\n'\n' >>> d[\"one\"] = 42\\n'\n' >>> d\\n'\n\" {'one': 42, 'two': 2, 'three': 3, 'four': 4}\\n\"\n' >>> del d[\"two\"]\\n'\n' >>> d[\"two\"] = None\\n'\n' >>> d\\n'\n\" {'one': 42, 'three': 3, 'four': 4, 'two': None}\\n\"\n'\\n'\n' Changed in version 3.7: Dictionary order is guaranteed to '\n'be\\n'\n' insertion order. This behavior was an implementation '\n'detail of\\n'\n' CPython from 3.6.\\n'\n'\\n'\n' Dictionaries and dictionary views are reversible.\\n'\n'\\n'\n' >>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\\n'\n' >>> d\\n'\n\" {'one': 1, 'two': 2, 'three': 3, 'four': 4}\\n\"\n' >>> list(reversed(d))\\n'\n\" ['four', 'three', 'two', 'one']\\n\"\n' >>> list(reversed(d.values()))\\n'\n' [4, 3, 2, 1]\\n'\n' >>> list(reversed(d.items()))\\n'\n\" [('four', 4), ('three', 3), ('two', 2), ('one', 1)]\\n\"\n'\\n'\n' Changed in version 3.8: Dictionaries are now reversible.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' \"types.MappingProxyType\" can be used to create a read-only '\n'view of a\\n'\n' \"dict\".\\n'\n'\\n'\n'\\n'\n'Dictionary view objects\\n'\n'=======================\\n'\n'\\n'\n'The objects returned by \"dict.keys()\", \"dict.values()\" and\\n'\n'\"dict.items()\" are *view objects*. They provide a dynamic '\n'view on the\\n'\n'dictionary\u2019s entries, which means that when the dictionary '\n'changes,\\n'\n'the view reflects these changes.\\n'\n'\\n'\n'Dictionary views can be iterated over to yield their '\n'respective data,\\n'\n'and support membership tests:\\n'\n'\\n'\n'len(dictview)\\n'\n'\\n'\n' Return the number of entries in the dictionary.\\n'\n'\\n'\n'iter(dictview)\\n'\n'\\n'\n' Return an iterator over the keys, values or items '\n'(represented as\\n'\n' tuples of \"(key, value)\") in the dictionary.\\n'\n'\\n'\n' Keys and values are iterated over in insertion order. '\n'This allows\\n'\n' the creation of \"(value, key)\" pairs using \"zip()\": '\n'\"pairs =\\n'\n' zip(d.values(), d.keys())\". Another way to create the '\n'same list is\\n'\n' \"pairs = [(v, k) for (k, v) in d.items()]\".\\n'\n'\\n'\n' Iterating views while adding or deleting entries in the '\n'dictionary\\n'\n' may raise a \"RuntimeError\" or fail to iterate over all '\n'entries.\\n'\n'\\n'\n' Changed in version 3.7: Dictionary order is guaranteed to '\n'be\\n'\n' insertion order.\\n'\n'\\n'\n'x in dictview\\n'\n'\\n'\n' Return \"True\" if *x* is in the underlying dictionary\u2019s '\n'keys, values\\n'\n' or items (in the latter case, *x* should be a \"(key, '\n'value)\"\\n'\n' tuple).\\n'\n'\\n'\n'reversed(dictview)\\n'\n'\\n'\n' Return a reverse iterator over the keys, values or items '\n'of the\\n'\n' dictionary. The view will be iterated in reverse order of '\n'the\\n'\n' insertion.\\n'\n'\\n'\n' Changed in version 3.8: Dictionary views are now '\n'reversible.\\n'\n'\\n'\n'dictview.mapping\\n'\n'\\n'\n' Return a \"types.MappingProxyType\" that wraps the '\n'original\\n'\n' dictionary to which the view refers.\\n'\n'\\n'\n' New in version 3.10.\\n'\n'\\n'\n'Keys views are set-like since their entries are unique and '\n'hashable.\\n'\n'If all values are hashable, so that \"(key, value)\" pairs are '\n'unique\\n'\n'and hashable, then the items view is also set-like. (Values '\n'views are\\n'\n'not treated as set-like since the entries are generally not '\n'unique.)\\n'\n'For set-like views, all of the operations defined for the '\n'abstract\\n'\n'base class \"collections.abc.Set\" are available (for example, '\n'\"==\",\\n'\n'\"<\", or \"^\").\\n'\n'\\n'\n'An example of dictionary view usage:\\n'\n'\\n'\n\" >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, \"\n\"'spam': 500}\\n\"\n' >>> keys = dishes.keys()\\n'\n' >>> values = dishes.values()\\n'\n'\\n'\n' >>> # iteration\\n'\n' >>> n = 0\\n'\n' >>> for val in values:\\n'\n' ... n += val\\n'\n' >>> print(n)\\n'\n' 504\\n'\n'\\n'\n' >>> # keys and values are iterated over in the same order '\n'(insertion order)\\n'\n' >>> list(keys)\\n'\n\" ['eggs', 'sausage', 'bacon', 'spam']\\n\"\n' >>> list(values)\\n'\n' [2, 1, 1, 500]\\n'\n'\\n'\n' >>> # view objects are dynamic and reflect dict changes\\n'\n\" >>> del dishes['eggs']\\n\"\n\" >>> del dishes['sausage']\\n\"\n' >>> list(keys)\\n'\n\" ['bacon', 'spam']\\n\"\n'\\n'\n' >>> # set operations\\n'\n\" >>> keys & {'eggs', 'bacon', 'salad'}\\n\"\n\" {'bacon'}\\n\"\n\" >>> keys ^ {'sausage', 'juice'}\\n\"\n\" {'juice', 'sausage', 'bacon', 'spam'}\\n\"\n'\\n'\n' >>> # get back a read-only proxy for the original '\n'dictionary\\n'\n' >>> values.mapping\\n'\n\" mappingproxy({'eggs': 2, 'sausage': 1, 'bacon': 1, \"\n\"'spam': 500})\\n\"\n\" >>> values.mapping['spam']\\n\"\n' 500\\n',\n'typesmethods':'Methods\\n'\n'*******\\n'\n'\\n'\n'Methods are functions that are called using the attribute '\n'notation.\\n'\n'There are two flavors: built-in methods (such as \"append()\" '\n'on lists)\\n'\n'and class instance methods. Built-in methods are described '\n'with the\\n'\n'types that support them.\\n'\n'\\n'\n'If you access a method (a function defined in a class '\n'namespace)\\n'\n'through an instance, you get a special object: a *bound '\n'method* (also\\n'\n'called *instance method*) object. When called, it will add '\n'the \"self\"\\n'\n'argument to the argument list. Bound methods have two '\n'special read-\\n'\n'only attributes: \"m.__self__\" is the object on which the '\n'method\\n'\n'operates, and \"m.__func__\" is the function implementing the '\n'method.\\n'\n'Calling \"m(arg-1, arg-2, ..., arg-n)\" is completely '\n'equivalent to\\n'\n'calling \"m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)\".\\n'\n'\\n'\n'Like function objects, bound method objects support getting '\n'arbitrary\\n'\n'attributes. However, since method attributes are actually '\n'stored on\\n'\n'the underlying function object (\"meth.__func__\"), setting '\n'method\\n'\n'attributes on bound methods is disallowed. Attempting to '\n'set an\\n'\n'attribute on a method results in an \"AttributeError\" being '\n'raised. In\\n'\n'order to set a method attribute, you need to explicitly set '\n'it on the\\n'\n'underlying function object:\\n'\n'\\n'\n' >>> class C:\\n'\n' ... def method(self):\\n'\n' ... pass\\n'\n' ...\\n'\n' >>> c = C()\\n'\n\" >>> c.method.whoami = 'my name is method' # can't set on \"\n'the method\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n\" AttributeError: 'method' object has no attribute \"\n\"'whoami'\\n\"\n\" >>> c.method.__func__.whoami = 'my name is method'\\n\"\n' >>> c.method.whoami\\n'\n\" 'my name is method'\\n\"\n'\\n'\n'See The standard type hierarchy for more information.\\n',\n'typesmodules':'Modules\\n'\n'*******\\n'\n'\\n'\n'The only special operation on a module is attribute access: '\n'\"m.name\",\\n'\n'where *m* is a module and *name* accesses a name defined in '\n'*m*\u2019s\\n'\n'symbol table. Module attributes can be assigned to. (Note '\n'that the\\n'\n'\"import\" statement is not, strictly speaking, an operation '\n'on a module\\n'\n'object; \"import foo\" does not require a module object named '\n'*foo* to\\n'\n'exist, rather it requires an (external) *definition* for a '\n'module\\n'\n'named *foo* somewhere.)\\n'\n'\\n'\n'A special attribute of every module is \"__dict__\". This is '\n'the\\n'\n'dictionary containing the module\u2019s symbol table. Modifying '\n'this\\n'\n'dictionary will actually change the module\u2019s symbol table, '\n'but direct\\n'\n'assignment to the \"__dict__\" attribute is not possible (you '\n'can write\\n'\n'\"m.__dict__[\\'a\\'] = 1\", which defines \"m.a\" to be \"1\", but '\n'you can\u2019t\\n'\n'write \"m.__dict__ = {}\"). Modifying \"__dict__\" directly is '\n'not\\n'\n'recommended.\\n'\n'\\n'\n'Modules built into the interpreter are written like this: '\n'\"\". If loaded from a file, they are '\n'written as\\n'\n'\"\".\\n',\n'typesseq':'Sequence Types \u2014 \"list\", \"tuple\", \"range\"\\n'\n'*****************************************\\n'\n'\\n'\n'There are three basic sequence types: lists, tuples, and range\\n'\n'objects. Additional sequence types tailored for processing of '\n'binary\\n'\n'data and text strings are described in dedicated sections.\\n'\n'\\n'\n'\\n'\n'Common Sequence Operations\\n'\n'==========================\\n'\n'\\n'\n'The operations in the following table are supported by most '\n'sequence\\n'\n'types, both mutable and immutable. The '\n'\"collections.abc.Sequence\" ABC\\n'\n'is provided to make it easier to correctly implement these '\n'operations\\n'\n'on custom sequence types.\\n'\n'\\n'\n'This table lists the sequence operations sorted in ascending '\n'priority.\\n'\n'In the table, *s* and *t* are sequences of the same type, *n*, '\n'*i*,\\n'\n'*j* and *k* are integers and *x* is an arbitrary object that '\n'meets any\\n'\n'type and value restrictions imposed by *s*.\\n'\n'\\n'\n'The \"in\" and \"not in\" operations have the same priorities as '\n'the\\n'\n'comparison operations. The \"+\" (concatenation) and \"*\" '\n'(repetition)\\n'\n'operations have the same priority as the corresponding numeric\\n'\n'operations. [3]\\n'\n'\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| Operation | Result '\n'| Notes |\\n'\n'|============================|==================================|============|\\n'\n'| \"x in s\" | \"True\" if an item of *s* is '\n'| (1) |\\n'\n'| | equal to *x*, else \"False\" '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"x not in s\" | \"False\" if an item of *s* is '\n'| (1) |\\n'\n'| | equal to *x*, else \"True\" '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s + t\" | the concatenation of *s* and *t* '\n'| (6)(7) |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s * n\" or \"n * s\" | equivalent to adding *s* to '\n'| (2)(7) |\\n'\n'| | itself *n* times '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s[i]\" | *i*th item of *s*, origin 0 '\n'| (3) |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s[i:j]\" | slice of *s* from *i* to *j* '\n'| (3)(4) |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s[i:j:k]\" | slice of *s* from *i* to *j* '\n'| (3)(5) |\\n'\n'| | with step *k* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"len(s)\" | length of *s* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"min(s)\" | smallest item of *s* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"max(s)\" | largest item of *s* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s.index(x[, i[, j]])\" | index of the first occurrence of '\n'| (8) |\\n'\n'| | *x* in *s* (at or after index '\n'| |\\n'\n'| | *i* and before index *j*) '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s.count(x)\" | total number of occurrences of '\n'| |\\n'\n'| | *x* in *s* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'\\n'\n'Sequences of the same type also support comparisons. In '\n'particular,\\n'\n'tuples and lists are compared lexicographically by comparing\\n'\n'corresponding elements. This means that to compare equal, every\\n'\n'element must compare equal and the two sequences must be of the '\n'same\\n'\n'type and have the same length. (For full details see '\n'Comparisons in\\n'\n'the language reference.)\\n'\n'\\n'\n'Notes:\\n'\n'\\n'\n'1. While the \"in\" and \"not in\" operations are used only for '\n'simple\\n'\n' containment testing in the general case, some specialised '\n'sequences\\n'\n' (such as \"str\", \"bytes\" and \"bytearray\") also use them for\\n'\n' subsequence testing:\\n'\n'\\n'\n' >>> \"gg\" in \"eggs\"\\n'\n' True\\n'\n'\\n'\n'2. Values of *n* less than \"0\" are treated as \"0\" (which yields '\n'an\\n'\n' empty sequence of the same type as *s*). Note that items in '\n'the\\n'\n' sequence *s* are not copied; they are referenced multiple '\n'times.\\n'\n' This often haunts new Python programmers; consider:\\n'\n'\\n'\n' >>> lists = [[]] * 3\\n'\n' >>> lists\\n'\n' [[], [], []]\\n'\n' >>> lists[0].append(3)\\n'\n' >>> lists\\n'\n' [[3], [3], [3]]\\n'\n'\\n'\n' What has happened is that \"[[]]\" is a one-element list '\n'containing\\n'\n' an empty list, so all three elements of \"[[]] * 3\" are '\n'references\\n'\n' to this single empty list. Modifying any of the elements of\\n'\n' \"lists\" modifies this single list. You can create a list of\\n'\n' different lists this way:\\n'\n'\\n'\n' >>> lists = [[] for i in range(3)]\\n'\n' >>> lists[0].append(3)\\n'\n' >>> lists[1].append(5)\\n'\n' >>> lists[2].append(7)\\n'\n' >>> lists\\n'\n' [[3], [5], [7]]\\n'\n'\\n'\n' Further explanation is available in the FAQ entry How do I '\n'create a\\n'\n' multidimensional list?.\\n'\n'\\n'\n'3. If *i* or *j* is negative, the index is relative to the end '\n'of\\n'\n' sequence *s*: \"len(s) + i\" or \"len(s) + j\" is substituted. '\n'But\\n'\n' note that \"-0\" is still \"0\".\\n'\n'\\n'\n'4. The slice of *s* from *i* to *j* is defined as the sequence '\n'of\\n'\n' items with index *k* such that \"i <= k < j\". If *i* or *j* '\n'is\\n'\n' greater than \"len(s)\", use \"len(s)\". If *i* is omitted or '\n'\"None\",\\n'\n' use \"0\". If *j* is omitted or \"None\", use \"len(s)\". If *i* '\n'is\\n'\n' greater than or equal to *j*, the slice is empty.\\n'\n'\\n'\n'5. The slice of *s* from *i* to *j* with step *k* is defined as '\n'the\\n'\n' sequence of items with index \"x = i + n*k\" such that \"0 <= n '\n'<\\n'\n' (j-i)/k\". In other words, the indices are \"i\", \"i+k\", '\n'\"i+2*k\",\\n'\n' \"i+3*k\" and so on, stopping when *j* is reached (but never\\n'\n' including *j*). When *k* is positive, *i* and *j* are '\n'reduced to\\n'\n' \"len(s)\" if they are greater. When *k* is negative, *i* and '\n'*j* are\\n'\n' reduced to \"len(s) - 1\" if they are greater. If *i* or *j* '\n'are\\n'\n' omitted or \"None\", they become \u201cend\u201d values (which end '\n'depends on\\n'\n' the sign of *k*). Note, *k* cannot be zero. If *k* is '\n'\"None\", it\\n'\n' is treated like \"1\".\\n'\n'\\n'\n'6. Concatenating immutable sequences always results in a new '\n'object.\\n'\n' This means that building up a sequence by repeated '\n'concatenation\\n'\n' will have a quadratic runtime cost in the total sequence '\n'length.\\n'\n' To get a linear runtime cost, you must switch to one of the\\n'\n' alternatives below:\\n'\n'\\n'\n' * if concatenating \"str\" objects, you can build a list and '\n'use\\n'\n' \"str.join()\" at the end or else write to an \"io.StringIO\"\\n'\n' instance and retrieve its value when complete\\n'\n'\\n'\n' * if concatenating \"bytes\" objects, you can similarly use\\n'\n' \"bytes.join()\" or \"io.BytesIO\", or you can do in-place\\n'\n' concatenation with a \"bytearray\" object. \"bytearray\" '\n'objects are\\n'\n' mutable and have an efficient overallocation mechanism\\n'\n'\\n'\n' * if concatenating \"tuple\" objects, extend a \"list\" instead\\n'\n'\\n'\n' * for other types, investigate the relevant class '\n'documentation\\n'\n'\\n'\n'7. Some sequence types (such as \"range\") only support item '\n'sequences\\n'\n' that follow specific patterns, and hence don\u2019t support '\n'sequence\\n'\n' concatenation or repetition.\\n'\n'\\n'\n'8. \"index\" raises \"ValueError\" when *x* is not found in *s*. Not '\n'all\\n'\n' implementations support passing the additional arguments *i* '\n'and\\n'\n' *j*. These arguments allow efficient searching of subsections '\n'of\\n'\n' the sequence. Passing the extra arguments is roughly '\n'equivalent to\\n'\n' using \"s[i:j].index(x)\", only without copying any data and '\n'with the\\n'\n' returned index being relative to the start of the sequence '\n'rather\\n'\n' than the start of the slice.\\n'\n'\\n'\n'\\n'\n'Immutable Sequence Types\\n'\n'========================\\n'\n'\\n'\n'The only operation that immutable sequence types generally '\n'implement\\n'\n'that is not also implemented by mutable sequence types is '\n'support for\\n'\n'the \"hash()\" built-in.\\n'\n'\\n'\n'This support allows immutable sequences, such as \"tuple\" '\n'instances, to\\n'\n'be used as \"dict\" keys and stored in \"set\" and \"frozenset\" '\n'instances.\\n'\n'\\n'\n'Attempting to hash an immutable sequence that contains '\n'unhashable\\n'\n'values will result in \"TypeError\".\\n'\n'\\n'\n'\\n'\n'Mutable Sequence Types\\n'\n'======================\\n'\n'\\n'\n'The operations in the following table are defined on mutable '\n'sequence\\n'\n'types. The \"collections.abc.MutableSequence\" ABC is provided to '\n'make\\n'\n'it easier to correctly implement these operations on custom '\n'sequence\\n'\n'types.\\n'\n'\\n'\n'In the table *s* is an instance of a mutable sequence type, *t* '\n'is any\\n'\n'iterable object and *x* is an arbitrary object that meets any '\n'type and\\n'\n'value restrictions imposed by *s* (for example, \"bytearray\" '\n'only\\n'\n'accepts integers that meet the value restriction \"0 <= x <= '\n'255\").\\n'\n'\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| Operation | '\n'Result | Notes |\\n'\n'|================================|==================================|=======================|\\n'\n'| \"s[i] = x\" | item *i* of *s* is replaced '\n'by | |\\n'\n'| | '\n'*x* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s[i:j] = t\" | slice of *s* from *i* to *j* '\n'is | |\\n'\n'| | replaced by the contents of '\n'the | |\\n'\n'| | iterable '\n'*t* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"del s[i:j]\" | same as \"s[i:j] = '\n'[]\" | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s[i:j:k] = t\" | the elements of \"s[i:j:k]\" '\n'are | (1) |\\n'\n'| | replaced by those of '\n'*t* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"del s[i:j:k]\" | removes the elements '\n'of | |\\n'\n'| | \"s[i:j:k]\" from the '\n'list | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.append(x)\" | appends *x* to the end of '\n'the | |\\n'\n'| | sequence (same '\n'as | |\\n'\n'| | \"s[len(s):len(s)] = '\n'[x]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.clear()\" | removes all items from *s* '\n'(same | (5) |\\n'\n'| | as \"del '\n's[:]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.copy()\" | creates a shallow copy of '\n'*s* | (5) |\\n'\n'| | (same as '\n'\"s[:]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.extend(t)\" or \"s += t\" | extends *s* with the contents '\n'of | |\\n'\n'| | *t* (for the most part the '\n'same | |\\n'\n'| | as \"s[len(s):len(s)] = '\n't\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s *= n\" | updates *s* with its '\n'contents | (6) |\\n'\n'| | repeated *n* '\n'times | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.insert(i, x)\" | inserts *x* into *s* at '\n'the | |\\n'\n'| | index given by *i* (same '\n'as | |\\n'\n'| | \"s[i:i] = '\n'[x]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.pop()\" or \"s.pop(i)\" | retrieves the item at *i* '\n'and | (2) |\\n'\n'| | also removes it from '\n'*s* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.remove(x)\" | remove the first item from '\n'*s* | (3) |\\n'\n'| | where \"s[i]\" is equal to '\n'*x* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.reverse()\" | reverses the items of *s* '\n'in | (4) |\\n'\n'| | '\n'place | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'\\n'\n'Notes:\\n'\n'\\n'\n'1. *t* must have the same length as the slice it is replacing.\\n'\n'\\n'\n'2. The optional argument *i* defaults to \"-1\", so that by '\n'default the\\n'\n' last item is removed and returned.\\n'\n'\\n'\n'3. \"remove()\" raises \"ValueError\" when *x* is not found in *s*.\\n'\n'\\n'\n'4. The \"reverse()\" method modifies the sequence in place for '\n'economy\\n'\n' of space when reversing a large sequence. To remind users '\n'that it\\n'\n' operates by side effect, it does not return the reversed '\n'sequence.\\n'\n'\\n'\n'5. \"clear()\" and \"copy()\" are included for consistency with the\\n'\n' interfaces of mutable containers that don\u2019t support slicing\\n'\n' operations (such as \"dict\" and \"set\"). \"copy()\" is not part '\n'of the\\n'\n' \"collections.abc.MutableSequence\" ABC, but most concrete '\n'mutable\\n'\n' sequence classes provide it.\\n'\n'\\n'\n' New in version 3.3: \"clear()\" and \"copy()\" methods.\\n'\n'\\n'\n'6. The value *n* is an integer, or an object implementing\\n'\n' \"__index__()\". Zero and negative values of *n* clear the '\n'sequence.\\n'\n' Items in the sequence are not copied; they are referenced '\n'multiple\\n'\n' times, as explained for \"s * n\" under Common Sequence '\n'Operations.\\n'\n'\\n'\n'\\n'\n'Lists\\n'\n'=====\\n'\n'\\n'\n'Lists are mutable sequences, typically used to store collections '\n'of\\n'\n'homogeneous items (where the precise degree of similarity will '\n'vary by\\n'\n'application).\\n'\n'\\n'\n'class list([iterable])\\n'\n'\\n'\n' Lists may be constructed in several ways:\\n'\n'\\n'\n' * Using a pair of square brackets to denote the empty list: '\n'\"[]\"\\n'\n'\\n'\n' * Using square brackets, separating items with commas: \"[a]\", '\n'\"[a,\\n'\n' b, c]\"\\n'\n'\\n'\n' * Using a list comprehension: \"[x for x in iterable]\"\\n'\n'\\n'\n' * Using the type constructor: \"list()\" or \"list(iterable)\"\\n'\n'\\n'\n' The constructor builds a list whose items are the same and in '\n'the\\n'\n' same order as *iterable*\u2019s items. *iterable* may be either '\n'a\\n'\n' sequence, a container that supports iteration, or an '\n'iterator\\n'\n' object. If *iterable* is already a list, a copy is made and\\n'\n' returned, similar to \"iterable[:]\". For example, '\n'\"list(\\'abc\\')\"\\n'\n' returns \"[\\'a\\', \\'b\\', \\'c\\']\" and \"list( (1, 2, 3) )\" '\n'returns \"[1, 2,\\n'\n' 3]\". If no argument is given, the constructor creates a new '\n'empty\\n'\n' list, \"[]\".\\n'\n'\\n'\n' Many other operations also produce lists, including the '\n'\"sorted()\"\\n'\n' built-in.\\n'\n'\\n'\n' Lists implement all of the common and mutable sequence '\n'operations.\\n'\n' Lists also provide the following additional method:\\n'\n'\\n'\n' sort(*, key=None, reverse=False)\\n'\n'\\n'\n' This method sorts the list in place, using only \"<\" '\n'comparisons\\n'\n' between items. Exceptions are not suppressed - if any '\n'comparison\\n'\n' operations fail, the entire sort operation will fail (and '\n'the\\n'\n' list will likely be left in a partially modified state).\\n'\n'\\n'\n' \"sort()\" accepts two arguments that can only be passed by\\n'\n' keyword (keyword-only arguments):\\n'\n'\\n'\n' *key* specifies a function of one argument that is used '\n'to\\n'\n' extract a comparison key from each list element (for '\n'example,\\n'\n' \"key=str.lower\"). The key corresponding to each item in '\n'the list\\n'\n' is calculated once and then used for the entire sorting '\n'process.\\n'\n' The default value of \"None\" means that list items are '\n'sorted\\n'\n' directly without calculating a separate key value.\\n'\n'\\n'\n' The \"functools.cmp_to_key()\" utility is available to '\n'convert a\\n'\n' 2.x style *cmp* function to a *key* function.\\n'\n'\\n'\n' *reverse* is a boolean value. If set to \"True\", then the '\n'list\\n'\n' elements are sorted as if each comparison were reversed.\\n'\n'\\n'\n' This method modifies the sequence in place for economy of '\n'space\\n'\n' when sorting a large sequence. To remind users that it '\n'operates\\n'\n' by side effect, it does not return the sorted sequence '\n'(use\\n'\n' \"sorted()\" to explicitly request a new sorted list '\n'instance).\\n'\n'\\n'\n' The \"sort()\" method is guaranteed to be stable. A sort '\n'is\\n'\n' stable if it guarantees not to change the relative order '\n'of\\n'\n' elements that compare equal \u2014 this is helpful for sorting '\n'in\\n'\n' multiple passes (for example, sort by department, then by '\n'salary\\n'\n' grade).\\n'\n'\\n'\n' For sorting examples and a brief sorting tutorial, see '\n'Sorting\\n'\n' HOW TO.\\n'\n'\\n'\n' **CPython implementation detail:** While a list is being '\n'sorted,\\n'\n' the effect of attempting to mutate, or even inspect, the '\n'list is\\n'\n' undefined. The C implementation of Python makes the list '\n'appear\\n'\n' empty for the duration, and raises \"ValueError\" if it can '\n'detect\\n'\n' that the list has been mutated during a sort.\\n'\n'\\n'\n'\\n'\n'Tuples\\n'\n'======\\n'\n'\\n'\n'Tuples are immutable sequences, typically used to store '\n'collections of\\n'\n'heterogeneous data (such as the 2-tuples produced by the '\n'\"enumerate()\"\\n'\n'built-in). Tuples are also used for cases where an immutable '\n'sequence\\n'\n'of homogeneous data is needed (such as allowing storage in a '\n'\"set\" or\\n'\n'\"dict\" instance).\\n'\n'\\n'\n'class tuple([iterable])\\n'\n'\\n'\n' Tuples may be constructed in a number of ways:\\n'\n'\\n'\n' * Using a pair of parentheses to denote the empty tuple: '\n'\"()\"\\n'\n'\\n'\n' * Using a trailing comma for a singleton tuple: \"a,\" or '\n'\"(a,)\"\\n'\n'\\n'\n' * Separating items with commas: \"a, b, c\" or \"(a, b, c)\"\\n'\n'\\n'\n' * Using the \"tuple()\" built-in: \"tuple()\" or '\n'\"tuple(iterable)\"\\n'\n'\\n'\n' The constructor builds a tuple whose items are the same and '\n'in the\\n'\n' same order as *iterable*\u2019s items. *iterable* may be either '\n'a\\n'\n' sequence, a container that supports iteration, or an '\n'iterator\\n'\n' object. If *iterable* is already a tuple, it is returned\\n'\n' unchanged. For example, \"tuple(\\'abc\\')\" returns \"(\\'a\\', '\n'\\'b\\', \\'c\\')\"\\n'\n' and \"tuple( [1, 2, 3] )\" returns \"(1, 2, 3)\". If no argument '\n'is\\n'\n' given, the constructor creates a new empty tuple, \"()\".\\n'\n'\\n'\n' Note that it is actually the comma which makes a tuple, not '\n'the\\n'\n' parentheses. The parentheses are optional, except in the '\n'empty\\n'\n' tuple case, or when they are needed to avoid syntactic '\n'ambiguity.\\n'\n' For example, \"f(a, b, c)\" is a function call with three '\n'arguments,\\n'\n' while \"f((a, b, c))\" is a function call with a 3-tuple as the '\n'sole\\n'\n' argument.\\n'\n'\\n'\n' Tuples implement all of the common sequence operations.\\n'\n'\\n'\n'For heterogeneous collections of data where access by name is '\n'clearer\\n'\n'than access by index, \"collections.namedtuple()\" may be a more\\n'\n'appropriate choice than a simple tuple object.\\n'\n'\\n'\n'\\n'\n'Ranges\\n'\n'======\\n'\n'\\n'\n'The \"range\" type represents an immutable sequence of numbers and '\n'is\\n'\n'commonly used for looping a specific number of times in \"for\" '\n'loops.\\n'\n'\\n'\n'class range(stop)\\n'\n'class range(start, stop[, step])\\n'\n'\\n'\n' The arguments to the range constructor must be integers '\n'(either\\n'\n' built-in \"int\" or any object that implements the \"__index__\"\\n'\n' special method). If the *step* argument is omitted, it '\n'defaults to\\n'\n' \"1\". If the *start* argument is omitted, it defaults to \"0\". '\n'If\\n'\n' *step* is zero, \"ValueError\" is raised.\\n'\n'\\n'\n' For a positive *step*, the contents of a range \"r\" are '\n'determined\\n'\n' by the formula \"r[i] = start + step*i\" where \"i >= 0\" and '\n'\"r[i] <\\n'\n' stop\".\\n'\n'\\n'\n' For a negative *step*, the contents of the range are still\\n'\n' determined by the formula \"r[i] = start + step*i\", but the\\n'\n' constraints are \"i >= 0\" and \"r[i] > stop\".\\n'\n'\\n'\n' A range object will be empty if \"r[0]\" does not meet the '\n'value\\n'\n' constraint. Ranges do support negative indices, but these '\n'are\\n'\n' interpreted as indexing from the end of the sequence '\n'determined by\\n'\n' the positive indices.\\n'\n'\\n'\n' Ranges containing absolute values larger than \"sys.maxsize\" '\n'are\\n'\n' permitted but some features (such as \"len()\") may raise\\n'\n' \"OverflowError\".\\n'\n'\\n'\n' Range examples:\\n'\n'\\n'\n' >>> list(range(10))\\n'\n' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\\n'\n' >>> list(range(1, 11))\\n'\n' [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\\n'\n' >>> list(range(0, 30, 5))\\n'\n' [0, 5, 10, 15, 20, 25]\\n'\n' >>> list(range(0, 10, 3))\\n'\n' [0, 3, 6, 9]\\n'\n' >>> list(range(0, -10, -1))\\n'\n' [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\\n'\n' >>> list(range(0))\\n'\n' []\\n'\n' >>> list(range(1, 0))\\n'\n' []\\n'\n'\\n'\n' Ranges implement all of the common sequence operations '\n'except\\n'\n' concatenation and repetition (due to the fact that range '\n'objects\\n'\n' can only represent sequences that follow a strict pattern '\n'and\\n'\n' repetition and concatenation will usually violate that '\n'pattern).\\n'\n'\\n'\n' start\\n'\n'\\n'\n' The value of the *start* parameter (or \"0\" if the '\n'parameter was\\n'\n' not supplied)\\n'\n'\\n'\n' stop\\n'\n'\\n'\n' The value of the *stop* parameter\\n'\n'\\n'\n' step\\n'\n'\\n'\n' The value of the *step* parameter (or \"1\" if the parameter '\n'was\\n'\n' not supplied)\\n'\n'\\n'\n'The advantage of the \"range\" type over a regular \"list\" or '\n'\"tuple\" is\\n'\n'that a \"range\" object will always take the same (small) amount '\n'of\\n'\n'memory, no matter the size of the range it represents (as it '\n'only\\n'\n'stores the \"start\", \"stop\" and \"step\" values, calculating '\n'individual\\n'\n'items and subranges as needed).\\n'\n'\\n'\n'Range objects implement the \"collections.abc.Sequence\" ABC, and\\n'\n'provide features such as containment tests, element index '\n'lookup,\\n'\n'slicing and support for negative indices (see Sequence Types \u2014 '\n'list,\\n'\n'tuple, range):\\n'\n'\\n'\n'>>> r = range(0, 20, 2)\\n'\n'>>> r\\n'\n'range(0, 20, 2)\\n'\n'>>> 11 in r\\n'\n'False\\n'\n'>>> 10 in r\\n'\n'True\\n'\n'>>> r.index(10)\\n'\n'5\\n'\n'>>> r[5]\\n'\n'10\\n'\n'>>> r[:5]\\n'\n'range(0, 10, 2)\\n'\n'>>> r[-1]\\n'\n'18\\n'\n'\\n'\n'Testing range objects for equality with \"==\" and \"!=\" compares '\n'them as\\n'\n'sequences. That is, two range objects are considered equal if '\n'they\\n'\n'represent the same sequence of values. (Note that two range '\n'objects\\n'\n'that compare equal might have different \"start\", \"stop\" and '\n'\"step\"\\n'\n'attributes, for example \"range(0) == range(2, 1, 3)\" or '\n'\"range(0, 3,\\n'\n'2) == range(0, 4, 2)\".)\\n'\n'\\n'\n'Changed in version 3.2: Implement the Sequence ABC. Support '\n'slicing\\n'\n'and negative indices. Test \"int\" objects for membership in '\n'constant\\n'\n'time instead of iterating through all items.\\n'\n'\\n'\n'Changed in version 3.3: Define \u2018==\u2019 and \u2018!=\u2019 to compare range '\n'objects\\n'\n'based on the sequence of values they define (instead of '\n'comparing\\n'\n'based on object identity).\\n'\n'\\n'\n'New in version 3.3: The \"start\", \"stop\" and \"step\" attributes.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' * The linspace recipe shows how to implement a lazy version of '\n'range\\n'\n' suitable for floating point applications.\\n',\n'typesseq-mutable':'Mutable Sequence Types\\n'\n'**********************\\n'\n'\\n'\n'The operations in the following table are defined on '\n'mutable sequence\\n'\n'types. The \"collections.abc.MutableSequence\" ABC is '\n'provided to make\\n'\n'it easier to correctly implement these operations on '\n'custom sequence\\n'\n'types.\\n'\n'\\n'\n'In the table *s* is an instance of a mutable sequence '\n'type, *t* is any\\n'\n'iterable object and *x* is an arbitrary object that '\n'meets any type and\\n'\n'value restrictions imposed by *s* (for example, '\n'\"bytearray\" only\\n'\n'accepts integers that meet the value restriction \"0 <= x '\n'<= 255\").\\n'\n'\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| Operation | '\n'Result | Notes '\n'|\\n'\n'|================================|==================================|=======================|\\n'\n'| \"s[i] = x\" | item *i* of *s* is '\n'replaced by | |\\n'\n'| | '\n'*x* | '\n'|\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s[i:j] = t\" | slice of *s* from *i* '\n'to *j* is | |\\n'\n'| | replaced by the '\n'contents of the | |\\n'\n'| | iterable '\n'*t* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"del s[i:j]\" | same as \"s[i:j] = '\n'[]\" | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s[i:j:k] = t\" | the elements of '\n'\"s[i:j:k]\" are | (1) |\\n'\n'| | replaced by those of '\n'*t* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"del s[i:j:k]\" | removes the elements '\n'of | |\\n'\n'| | \"s[i:j:k]\" from the '\n'list | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.append(x)\" | appends *x* to the '\n'end of the | |\\n'\n'| | sequence (same '\n'as | |\\n'\n'| | \"s[len(s):len(s)] = '\n'[x]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.clear()\" | removes all items '\n'from *s* (same | (5) |\\n'\n'| | as \"del '\n's[:]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.copy()\" | creates a shallow '\n'copy of *s* | (5) |\\n'\n'| | (same as '\n'\"s[:]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.extend(t)\" or \"s += t\" | extends *s* with the '\n'contents of | |\\n'\n'| | *t* (for the most '\n'part the same | |\\n'\n'| | as \"s[len(s):len(s)] '\n'= t\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s *= n\" | updates *s* with its '\n'contents | (6) |\\n'\n'| | repeated *n* '\n'times | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.insert(i, x)\" | inserts *x* into *s* '\n'at the | |\\n'\n'| | index given by *i* '\n'(same as | |\\n'\n'| | \"s[i:i] = '\n'[x]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.pop()\" or \"s.pop(i)\" | retrieves the item at '\n'*i* and | (2) |\\n'\n'| | also removes it from '\n'*s* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.remove(x)\" | remove the first item '\n'from *s* | (3) |\\n'\n'| | where \"s[i]\" is equal '\n'to *x* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.reverse()\" | reverses the items of '\n'*s* in | (4) |\\n'\n'| | '\n'place | '\n'|\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'\\n'\n'Notes:\\n'\n'\\n'\n'1. *t* must have the same length as the slice it is '\n'replacing.\\n'\n'\\n'\n'2. The optional argument *i* defaults to \"-1\", so that '\n'by default the\\n'\n' last item is removed and returned.\\n'\n'\\n'\n'3. \"remove()\" raises \"ValueError\" when *x* is not found '\n'in *s*.\\n'\n'\\n'\n'4. The \"reverse()\" method modifies the sequence in place '\n'for economy\\n'\n' of space when reversing a large sequence. To remind '\n'users that it\\n'\n' operates by side effect, it does not return the '\n'reversed sequence.\\n'\n'\\n'\n'5. \"clear()\" and \"copy()\" are included for consistency '\n'with the\\n'\n' interfaces of mutable containers that don\u2019t support '\n'slicing\\n'\n' operations (such as \"dict\" and \"set\"). \"copy()\" is '\n'not part of the\\n'\n' \"collections.abc.MutableSequence\" ABC, but most '\n'concrete mutable\\n'\n' sequence classes provide it.\\n'\n'\\n'\n' New in version 3.3: \"clear()\" and \"copy()\" methods.\\n'\n'\\n'\n'6. The value *n* is an integer, or an object '\n'implementing\\n'\n' \"__index__()\". Zero and negative values of *n* clear '\n'the sequence.\\n'\n' Items in the sequence are not copied; they are '\n'referenced multiple\\n'\n' times, as explained for \"s * n\" under Common Sequence '\n'Operations.\\n',\n'unary':'Unary arithmetic and bitwise operations\\n'\n'***************************************\\n'\n'\\n'\n'All unary arithmetic and bitwise operations have the same '\n'priority:\\n'\n'\\n'\n' u_expr ::= power | \"-\" u_expr | \"+\" u_expr | \"~\" u_expr\\n'\n'\\n'\n'The unary \"-\" (minus) operator yields the negation of its numeric\\n'\n'argument; the operation can be overridden with the \"__neg__()\" '\n'special\\n'\n'method.\\n'\n'\\n'\n'The unary \"+\" (plus) operator yields its numeric argument '\n'unchanged;\\n'\n'the operation can be overridden with the \"__pos__()\" special '\n'method.\\n'\n'\\n'\n'The unary \"~\" (invert) operator yields the bitwise inversion of '\n'its\\n'\n'integer argument. The bitwise inversion of \"x\" is defined as\\n'\n'\"-(x+1)\". It only applies to integral numbers or to custom '\n'objects\\n'\n'that override the \"__invert__()\" special method.\\n'\n'\\n'\n'In all three cases, if the argument does not have the proper type, '\n'a\\n'\n'\"TypeError\" exception is raised.\\n',\n'while':'The \"while\" statement\\n'\n'*********************\\n'\n'\\n'\n'The \"while\" statement is used for repeated execution as long as an\\n'\n'expression is true:\\n'\n'\\n'\n' while_stmt ::= \"while\" assignment_expression \":\" suite\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'This repeatedly tests the expression and, if it is true, executes '\n'the\\n'\n'first suite; if the expression is false (which may be the first '\n'time\\n'\n'it is tested) the suite of the \"else\" clause, if present, is '\n'executed\\n'\n'and the loop terminates.\\n'\n'\\n'\n'A \"break\" statement executed in the first suite terminates the '\n'loop\\n'\n'without executing the \"else\" clause\u2019s suite. A \"continue\" '\n'statement\\n'\n'executed in the first suite skips the rest of the suite and goes '\n'back\\n'\n'to testing the expression.\\n',\n'with':'The \"with\" statement\\n'\n'********************\\n'\n'\\n'\n'The \"with\" statement is used to wrap the execution of a block with\\n'\n'methods defined by a context manager (see section With Statement\\n'\n'Context Managers). This allows common \"try\"\u2026\"except\"\u2026\"finally\" '\n'usage\\n'\n'patterns to be encapsulated for convenient reuse.\\n'\n'\\n'\n' with_stmt ::= \"with\" ( \"(\" with_stmt_contents \",\"? \")\" | '\n'with_stmt_contents ) \":\" suite\\n'\n' with_stmt_contents ::= with_item (\",\" with_item)*\\n'\n' with_item ::= expression [\"as\" target]\\n'\n'\\n'\n'The execution of the \"with\" statement with one \u201citem\u201d proceeds as\\n'\n'follows:\\n'\n'\\n'\n'1. The context expression (the expression given in the \"with_item\") '\n'is\\n'\n' evaluated to obtain a context manager.\\n'\n'\\n'\n'2. The context manager\u2019s \"__enter__()\" is loaded for later use.\\n'\n'\\n'\n'3. The context manager\u2019s \"__exit__()\" is loaded for later use.\\n'\n'\\n'\n'4. The context manager\u2019s \"__enter__()\" method is invoked.\\n'\n'\\n'\n'5. If a target was included in the \"with\" statement, the return '\n'value\\n'\n' from \"__enter__()\" is assigned to it.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The \"with\" statement guarantees that if the \"__enter__()\" '\n'method\\n'\n' returns without an error, then \"__exit__()\" will always be\\n'\n' called. Thus, if an error occurs during the assignment to the\\n'\n' target list, it will be treated the same as an error occurring\\n'\n' within the suite would be. See step 6 below.\\n'\n'\\n'\n'6. The suite is executed.\\n'\n'\\n'\n'7. The context manager\u2019s \"__exit__()\" method is invoked. If an\\n'\n' exception caused the suite to be exited, its type, value, and\\n'\n' traceback are passed as arguments to \"__exit__()\". Otherwise, '\n'three\\n'\n' \"None\" arguments are supplied.\\n'\n'\\n'\n' If the suite was exited due to an exception, and the return '\n'value\\n'\n' from the \"__exit__()\" method was false, the exception is '\n'reraised.\\n'\n' If the return value was true, the exception is suppressed, and\\n'\n' execution continues with the statement following the \"with\"\\n'\n' statement.\\n'\n'\\n'\n' If the suite was exited for any reason other than an exception, '\n'the\\n'\n' return value from \"__exit__()\" is ignored, and execution '\n'proceeds\\n'\n' at the normal location for the kind of exit that was taken.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' with EXPRESSION as TARGET:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' manager = (EXPRESSION)\\n'\n' enter = type(manager).__enter__\\n'\n' exit = type(manager).__exit__\\n'\n' value = enter(manager)\\n'\n' hit_except = False\\n'\n'\\n'\n' try:\\n'\n' TARGET = value\\n'\n' SUITE\\n'\n' except:\\n'\n' hit_except = True\\n'\n' if not exit(manager, *sys.exc_info()):\\n'\n' raise\\n'\n' finally:\\n'\n' if not hit_except:\\n'\n' exit(manager, None, None, None)\\n'\n'\\n'\n'With more than one item, the context managers are processed as if\\n'\n'multiple \"with\" statements were nested:\\n'\n'\\n'\n' with A() as a, B() as b:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' with A() as a:\\n'\n' with B() as b:\\n'\n' SUITE\\n'\n'\\n'\n'You can also write multi-item context managers in multiple lines if\\n'\n'the items are surrounded by parentheses. For example:\\n'\n'\\n'\n' with (\\n'\n' A() as a,\\n'\n' B() as b,\\n'\n' ):\\n'\n' SUITE\\n'\n'\\n'\n'Changed in version 3.1: Support for multiple context expressions.\\n'\n'\\n'\n'Changed in version 3.10: Support for using grouping parentheses to\\n'\n'break the statement in multiple lines.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 343** - The \u201cwith\u201d statement\\n'\n' The specification, background, and examples for the Python '\n'\"with\"\\n'\n' statement.\\n',\n'yield':'The \"yield\" statement\\n'\n'*********************\\n'\n'\\n'\n' yield_stmt ::= yield_expression\\n'\n'\\n'\n'A \"yield\" statement is semantically equivalent to a yield '\n'expression.\\n'\n'The yield statement can be used to omit the parentheses that would\\n'\n'otherwise be required in the equivalent yield expression '\n'statement.\\n'\n'For example, the yield statements\\n'\n'\\n'\n' yield \\n'\n' yield from \\n'\n'\\n'\n'are equivalent to the yield expression statements\\n'\n'\\n'\n' (yield )\\n'\n' (yield from )\\n'\n'\\n'\n'Yield expressions and statements are only used when defining a\\n'\n'*generator* function, and are only used in the body of the '\n'generator\\n'\n'function. Using yield in a function definition is sufficient to '\n'cause\\n'\n'that definition to create a generator function instead of a normal\\n'\n'function.\\n'\n'\\n'\n'For full details of \"yield\" semantics, refer to the Yield '\n'expressions\\n'\n'section.\\n'}\n", []], "pydoc_data": [".py", "", [], 1], "unittest.async_case": [".py", "import asyncio\nimport contextvars\nimport inspect\nimport warnings\n\nfrom .case import TestCase\n\n\nclass IsolatedAsyncioTestCase(TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n def __init__(self,methodName='runTest'):\n super().__init__(methodName)\n self._asyncioRunner=None\n self._asyncioTestContext=contextvars.copy_context()\n \n async def asyncSetUp(self):\n pass\n \n async def asyncTearDown(self):\n pass\n \n def addAsyncCleanup(self,func,/,*args,**kwargs):\n \n \n \n \n \n \n \n \n \n \n \n \n self.addCleanup(*(func,*args),**kwargs)\n \n async def enterAsyncContext(self,cm):\n ''\n\n\n\n \n \n \n cls=type(cm)\n try :\n enter=cls.__aenter__\n exit=cls.__aexit__\n except AttributeError:\n raise TypeError(f\"'{cls.__module__}.{cls.__qualname__}' object does \"\n f\"not support the asynchronous context manager protocol\"\n )from None\n result=await enter(cm)\n self.addAsyncCleanup(exit,cm,None ,None ,None )\n return result\n \n def _callSetUp(self):\n \n \n \n self._asyncioRunner.get_loop()\n self._asyncioTestContext.run(self.setUp)\n self._callAsync(self.asyncSetUp)\n \n def _callTestMethod(self,method):\n if self._callMaybeAsync(method)is not None :\n warnings.warn(f'It is deprecated to return a value!=None from a '\n f'test case ({method})',DeprecationWarning,stacklevel=4)\n \n def _callTearDown(self):\n self._callAsync(self.asyncTearDown)\n self._asyncioTestContext.run(self.tearDown)\n \n def _callCleanup(self,function,*args,**kwargs):\n self._callMaybeAsync(function,*args,**kwargs)\n \n def _callAsync(self,func,/,*args,**kwargs):\n assert self._asyncioRunner is not None ,'asyncio runner is not initialized'\n assert inspect.iscoroutinefunction(func),f'{func!r} is not an async function'\n return self._asyncioRunner.run(\n func(*args,**kwargs),\n context=self._asyncioTestContext\n )\n \n def _callMaybeAsync(self,func,/,*args,**kwargs):\n assert self._asyncioRunner is not None ,'asyncio runner is not initialized'\n if inspect.iscoroutinefunction(func):\n return self._asyncioRunner.run(\n func(*args,**kwargs),\n context=self._asyncioTestContext,\n )\n else :\n return self._asyncioTestContext.run(func,*args,**kwargs)\n \n def _setupAsyncioRunner(self):\n assert self._asyncioRunner is None ,'asyncio runner is already initialized'\n runner=asyncio.Runner(debug=True )\n self._asyncioRunner=runner\n \n def _tearDownAsyncioRunner(self):\n runner=self._asyncioRunner\n runner.close()\n \n def run(self,result=None ):\n self._setupAsyncioRunner()\n try :\n return super().run(result)\n finally :\n self._tearDownAsyncioRunner()\n \n def debug(self):\n self._setupAsyncioRunner()\n super().debug()\n self._tearDownAsyncioRunner()\n \n def __del__(self):\n if self._asyncioRunner is not None :\n self._tearDownAsyncioRunner()\n", ["asyncio", "contextvars", "inspect", "unittest.case", "warnings"]], "unittest.case": [".py", "''\n\nimport sys\nimport functools\nimport difflib\nimport pprint\nimport re\nimport warnings\nimport collections\nimport contextlib\nimport traceback\nimport types\n\nfrom . import result\nfrom .util import (strclass,safe_repr,_count_diff_all_purpose,\n_count_diff_hashable,_common_shorten_repr)\n\n__unittest=True\n\n_subtest_msg_sentinel=object()\n\nDIFF_OMITTED=('\\nDiff is %s characters long. '\n'Set self.maxDiff to None to see it.')\n\nclass SkipTest(Exception):\n ''\n\n\n\n\n \n \nclass _ShouldStop(Exception):\n ''\n\n \n \nclass _UnexpectedSuccess(Exception):\n ''\n\n \n \n \nclass _Outcome(object):\n def __init__(self,result=None ):\n self.expecting_failure=False\n self.result=result\n self.result_supports_subtests=hasattr(result,\"addSubTest\")\n self.success=True\n self.expectedFailure=None\n \n @contextlib.contextmanager\n def testPartExecutor(self,test_case,subTest=False ):\n old_success=self.success\n self.success=True\n try :\n yield\n except KeyboardInterrupt:\n raise\n except SkipTest as e:\n self.success=False\n _addSkip(self.result,test_case,str(e))\n except _ShouldStop:\n pass\n except :\n exc_info=sys.exc_info()\n if self.expecting_failure:\n self.expectedFailure=exc_info\n else :\n self.success=False\n if subTest:\n self.result.addSubTest(test_case.test_case,test_case,exc_info)\n else :\n _addError(self.result,test_case,exc_info)\n \n \n exc_info=None\n else :\n if subTest and self.success:\n self.result.addSubTest(test_case.test_case,test_case,None )\n finally :\n self.success=self.success and old_success\n \n \ndef _addSkip(result,test_case,reason):\n addSkip=getattr(result,'addSkip',None )\n if addSkip is not None :\n addSkip(test_case,reason)\n else :\n warnings.warn(\"TestResult has no addSkip method, skips not reported\",\n RuntimeWarning,2)\n result.addSuccess(test_case)\n \ndef _addError(result,test,exc_info):\n if result is not None and exc_info is not None :\n if issubclass(exc_info[0],test.failureException):\n result.addFailure(test,exc_info)\n else :\n result.addError(test,exc_info)\n \ndef _id(obj):\n return obj\n \n \ndef _enter_context(cm,addcleanup):\n\n\n cls=type(cm)\n try :\n enter=cls.__enter__\n exit=cls.__exit__\n except AttributeError:\n raise TypeError(f\"'{cls.__module__}.{cls.__qualname__}' object does \"\n f\"not support the context manager protocol\")from None\n result=enter(cm)\n addcleanup(exit,cm,None ,None ,None )\n return result\n \n \n_module_cleanups=[]\ndef addModuleCleanup(function,/,*args,**kwargs):\n ''\n \n _module_cleanups.append((function,args,kwargs))\n \ndef enterModuleContext(cm):\n ''\n return _enter_context(cm,addModuleCleanup)\n \n \ndef doModuleCleanups():\n ''\n \n exceptions=[]\n while _module_cleanups:\n function,args,kwargs=_module_cleanups.pop()\n try :\n function(*args,**kwargs)\n except Exception as exc:\n exceptions.append(exc)\n if exceptions:\n \n \n raise exceptions[0]\n \n \ndef skip(reason):\n ''\n\n \n def decorator(test_item):\n if not isinstance(test_item,type):\n @functools.wraps(test_item)\n def skip_wrapper(*args,**kwargs):\n raise SkipTest(reason)\n test_item=skip_wrapper\n \n test_item.__unittest_skip__=True\n test_item.__unittest_skip_why__=reason\n return test_item\n if isinstance(reason,types.FunctionType):\n test_item=reason\n reason=''\n return decorator(test_item)\n return decorator\n \ndef skipIf(condition,reason):\n ''\n\n \n if condition:\n return skip(reason)\n return _id\n \ndef skipUnless(condition,reason):\n ''\n\n \n if not condition:\n return skip(reason)\n return _id\n \ndef expectedFailure(test_item):\n test_item.__unittest_expecting_failure__=True\n return test_item\n \ndef _is_subtype(expected,basetype):\n if isinstance(expected,tuple):\n return all(_is_subtype(e,basetype)for e in expected)\n return isinstance(expected,type)and issubclass(expected,basetype)\n \nclass _BaseTestCaseContext:\n\n def __init__(self,test_case):\n self.test_case=test_case\n \n def _raiseFailure(self,standardMsg):\n msg=self.test_case._formatMessage(self.msg,standardMsg)\n raise self.test_case.failureException(msg)\n \nclass _AssertRaisesBaseContext(_BaseTestCaseContext):\n\n def __init__(self,expected,test_case,expected_regex=None ):\n _BaseTestCaseContext.__init__(self,test_case)\n self.expected=expected\n self.test_case=test_case\n if expected_regex is not None :\n expected_regex=re.compile(expected_regex)\n self.expected_regex=expected_regex\n self.obj_name=None\n self.msg=None\n \n def handle(self,name,args,kwargs):\n ''\n\n\n\n\n \n try :\n if not _is_subtype(self.expected,self._base_type):\n raise TypeError('%s() arg 1 must be %s'%\n (name,self._base_type_str))\n if not args:\n self.msg=kwargs.pop('msg',None )\n if kwargs:\n raise TypeError('%r is an invalid keyword argument for '\n 'this function'%(next(iter(kwargs)),))\n return self\n \n callable_obj,*args=args\n try :\n self.obj_name=callable_obj.__name__\n except AttributeError:\n self.obj_name=str(callable_obj)\n with self:\n callable_obj(*args,**kwargs)\n finally :\n \n self=None\n \n \nclass _AssertRaisesContext(_AssertRaisesBaseContext):\n ''\n \n _base_type=BaseException\n _base_type_str='an exception type or tuple of exception types'\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,tb):\n if exc_type is None :\n try :\n exc_name=self.expected.__name__\n except AttributeError:\n exc_name=str(self.expected)\n if self.obj_name:\n self._raiseFailure(\"{} not raised by {}\".format(exc_name,\n self.obj_name))\n else :\n self._raiseFailure(\"{} not raised\".format(exc_name))\n else :\n traceback.clear_frames(tb)\n if not issubclass(exc_type,self.expected):\n \n return False\n \n self.exception=exc_value.with_traceback(None )\n if self.expected_regex is None :\n return True\n \n expected_regex=self.expected_regex\n if not expected_regex.search(str(exc_value)):\n self._raiseFailure('\"{}\" does not match \"{}\"'.format(\n expected_regex.pattern,str(exc_value)))\n return True\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \nclass _AssertWarnsContext(_AssertRaisesBaseContext):\n ''\n \n _base_type=Warning\n _base_type_str='a warning type or tuple of warning types'\n \n def __enter__(self):\n \n \n for v in list(sys.modules.values()):\n if getattr(v,'__warningregistry__',None ):\n v.__warningregistry__={}\n self.warnings_manager=warnings.catch_warnings(record=True )\n self.warnings=self.warnings_manager.__enter__()\n warnings.simplefilter(\"always\",self.expected)\n return self\n \n def __exit__(self,exc_type,exc_value,tb):\n self.warnings_manager.__exit__(exc_type,exc_value,tb)\n if exc_type is not None :\n \n return\n try :\n exc_name=self.expected.__name__\n except AttributeError:\n exc_name=str(self.expected)\n first_matching=None\n for m in self.warnings:\n w=m.message\n if not isinstance(w,self.expected):\n continue\n if first_matching is None :\n first_matching=w\n if (self.expected_regex is not None and\n not self.expected_regex.search(str(w))):\n continue\n \n self.warning=w\n self.filename=m.filename\n self.lineno=m.lineno\n return\n \n if first_matching is not None :\n self._raiseFailure('\"{}\" does not match \"{}\"'.format(\n self.expected_regex.pattern,str(first_matching)))\n if self.obj_name:\n self._raiseFailure(\"{} not triggered by {}\".format(exc_name,\n self.obj_name))\n else :\n self._raiseFailure(\"{} not triggered\".format(exc_name))\n \n \nclass _OrderedChainMap(collections.ChainMap):\n def __iter__(self):\n seen=set()\n for mapping in self.maps:\n for k in mapping:\n if k not in seen:\n seen.add(k)\n yield k\n \n \nclass TestCase(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n failureException=AssertionError\n \n longMessage=True\n \n maxDiff=80 *8\n \n \n \n _diffThreshold=2 **16\n \n \n \n _classSetupFailed=False\n \n _class_cleanups=[]\n \n def __init__(self,methodName='runTest'):\n ''\n\n\n \n self._testMethodName=methodName\n self._outcome=None\n self._testMethodDoc='No test'\n try :\n testMethod=getattr(self,methodName)\n except AttributeError:\n if methodName !='runTest':\n \n \n raise ValueError(\"no such test method in %s: %s\"%\n (self.__class__,methodName))\n else :\n self._testMethodDoc=testMethod.__doc__\n self._cleanups=[]\n self._subtest=None\n \n \n \n \n self._type_equality_funcs={}\n self.addTypeEqualityFunc(dict,'assertDictEqual')\n self.addTypeEqualityFunc(list,'assertListEqual')\n self.addTypeEqualityFunc(tuple,'assertTupleEqual')\n self.addTypeEqualityFunc(set,'assertSetEqual')\n self.addTypeEqualityFunc(frozenset,'assertSetEqual')\n self.addTypeEqualityFunc(str,'assertMultiLineEqual')\n \n def addTypeEqualityFunc(self,typeobj,function):\n ''\n\n\n\n\n\n\n\n\n\n\n \n self._type_equality_funcs[typeobj]=function\n \n def addCleanup(self,function,/,*args,**kwargs):\n ''\n\n\n\n \n self._cleanups.append((function,args,kwargs))\n \n def enterContext(self,cm):\n ''\n\n\n\n \n return _enter_context(cm,self.addCleanup)\n \n @classmethod\n def addClassCleanup(cls,function,/,*args,**kwargs):\n ''\n \n cls._class_cleanups.append((function,args,kwargs))\n \n @classmethod\n def enterClassContext(cls,cm):\n ''\n return _enter_context(cm,cls.addClassCleanup)\n \n def setUp(self):\n ''\n pass\n \n def tearDown(self):\n ''\n pass\n \n @classmethod\n def setUpClass(cls):\n ''\n \n @classmethod\n def tearDownClass(cls):\n ''\n \n def countTestCases(self):\n return 1\n \n def defaultTestResult(self):\n return result.TestResult()\n \n def shortDescription(self):\n ''\n\n\n\n\n \n doc=self._testMethodDoc\n return doc.strip().split(\"\\n\")[0].strip()if doc else None\n \n \n def id(self):\n return \"%s.%s\"%(strclass(self.__class__),self._testMethodName)\n \n def __eq__(self,other):\n if type(self)is not type(other):\n return NotImplemented\n \n return self._testMethodName ==other._testMethodName\n \n def __hash__(self):\n return hash((type(self),self._testMethodName))\n \n def __str__(self):\n return \"%s (%s.%s)\"%(self._testMethodName,strclass(self.__class__),self._testMethodName)\n \n def __repr__(self):\n return \"<%s testMethod=%s>\"%\\\n (strclass(self.__class__),self._testMethodName)\n \n @contextlib.contextmanager\n def subTest(self,msg=_subtest_msg_sentinel,**params):\n ''\n\n\n\n\n \n if self._outcome is None or not self._outcome.result_supports_subtests:\n yield\n return\n parent=self._subtest\n if parent is None :\n params_map=_OrderedChainMap(params)\n else :\n params_map=parent.params.new_child(params)\n self._subtest=_SubTest(self,msg,params_map)\n try :\n with self._outcome.testPartExecutor(self._subtest,subTest=True ):\n yield\n if not self._outcome.success:\n result=self._outcome.result\n if result is not None and result.failfast:\n raise _ShouldStop\n elif self._outcome.expectedFailure:\n \n \n raise _ShouldStop\n finally :\n self._subtest=parent\n \n def _addExpectedFailure(self,result,exc_info):\n try :\n addExpectedFailure=result.addExpectedFailure\n except AttributeError:\n warnings.warn(\"TestResult has no addExpectedFailure method, reporting as passes\",\n RuntimeWarning)\n result.addSuccess(self)\n else :\n addExpectedFailure(self,exc_info)\n \n def _addUnexpectedSuccess(self,result):\n try :\n addUnexpectedSuccess=result.addUnexpectedSuccess\n except AttributeError:\n warnings.warn(\"TestResult has no addUnexpectedSuccess method, reporting as failure\",\n RuntimeWarning)\n \n \n try :\n raise _UnexpectedSuccess from None\n except _UnexpectedSuccess:\n result.addFailure(self,sys.exc_info())\n else :\n addUnexpectedSuccess(self)\n \n def _callSetUp(self):\n self.setUp()\n \n def _callTestMethod(self,method):\n if method()is not None :\n warnings.warn(f'It is deprecated to return a value!=None from a '\n f'test case ({method})',DeprecationWarning,stacklevel=3)\n \n def _callTearDown(self):\n self.tearDown()\n \n def _callCleanup(self,function,/,*args,**kwargs):\n function(*args,**kwargs)\n \n def run(self,result=None ):\n if result is None :\n result=self.defaultTestResult()\n startTestRun=getattr(result,'startTestRun',None )\n stopTestRun=getattr(result,'stopTestRun',None )\n if startTestRun is not None :\n startTestRun()\n else :\n stopTestRun=None\n \n result.startTest(self)\n try :\n testMethod=getattr(self,self._testMethodName)\n if (getattr(self.__class__,\"__unittest_skip__\",False )or\n getattr(testMethod,\"__unittest_skip__\",False )):\n \n skip_why=(getattr(self.__class__,'__unittest_skip_why__','')\n or getattr(testMethod,'__unittest_skip_why__',''))\n _addSkip(result,self,skip_why)\n return result\n \n expecting_failure=(\n getattr(self,\"__unittest_expecting_failure__\",False )or\n getattr(testMethod,\"__unittest_expecting_failure__\",False )\n )\n outcome=_Outcome(result)\n try :\n self._outcome=outcome\n \n with outcome.testPartExecutor(self):\n self._callSetUp()\n if outcome.success:\n outcome.expecting_failure=expecting_failure\n with outcome.testPartExecutor(self):\n self._callTestMethod(testMethod)\n outcome.expecting_failure=False\n with outcome.testPartExecutor(self):\n self._callTearDown()\n self.doCleanups()\n \n if outcome.success:\n if expecting_failure:\n if outcome.expectedFailure:\n self._addExpectedFailure(result,outcome.expectedFailure)\n else :\n self._addUnexpectedSuccess(result)\n else :\n result.addSuccess(self)\n return result\n finally :\n \n \n outcome.expectedFailure=None\n outcome=None\n \n \n self._outcome=None\n \n finally :\n result.stopTest(self)\n if stopTestRun is not None :\n stopTestRun()\n \n def doCleanups(self):\n ''\n \n outcome=self._outcome or _Outcome()\n while self._cleanups:\n function,args,kwargs=self._cleanups.pop()\n with outcome.testPartExecutor(self):\n self._callCleanup(function,*args,**kwargs)\n \n \n \n return outcome.success\n \n @classmethod\n def doClassCleanups(cls):\n ''\n \n cls.tearDown_exceptions=[]\n while cls._class_cleanups:\n function,args,kwargs=cls._class_cleanups.pop()\n try :\n function(*args,**kwargs)\n except Exception:\n cls.tearDown_exceptions.append(sys.exc_info())\n \n def __call__(self,*args,**kwds):\n return self.run(*args,**kwds)\n \n def debug(self):\n ''\n testMethod=getattr(self,self._testMethodName)\n if (getattr(self.__class__,\"__unittest_skip__\",False )or\n getattr(testMethod,\"__unittest_skip__\",False )):\n \n skip_why=(getattr(self.__class__,'__unittest_skip_why__','')\n or getattr(testMethod,'__unittest_skip_why__',''))\n raise SkipTest(skip_why)\n \n self._callSetUp()\n self._callTestMethod(testMethod)\n self._callTearDown()\n while self._cleanups:\n function,args,kwargs=self._cleanups.pop()\n self._callCleanup(function,*args,**kwargs)\n \n def skipTest(self,reason):\n ''\n raise SkipTest(reason)\n \n def fail(self,msg=None ):\n ''\n raise self.failureException(msg)\n \n def assertFalse(self,expr,msg=None ):\n ''\n if expr:\n msg=self._formatMessage(msg,\"%s is not false\"%safe_repr(expr))\n raise self.failureException(msg)\n \n def assertTrue(self,expr,msg=None ):\n ''\n if not expr:\n msg=self._formatMessage(msg,\"%s is not true\"%safe_repr(expr))\n raise self.failureException(msg)\n \n def _formatMessage(self,msg,standardMsg):\n ''\n\n\n\n\n\n\n\n \n if not self.longMessage:\n return msg or standardMsg\n if msg is None :\n return standardMsg\n try :\n \n \n return '%s : %s'%(standardMsg,msg)\n except UnicodeDecodeError:\n return '%s : %s'%(safe_repr(standardMsg),safe_repr(msg))\n \n def assertRaises(self,expected_exception,*args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n context=_AssertRaisesContext(expected_exception,self)\n try :\n return context.handle('assertRaises',args,kwargs)\n finally :\n \n context=None\n \n def assertWarns(self,expected_warning,*args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n context=_AssertWarnsContext(expected_warning,self)\n return context.handle('assertWarns',args,kwargs)\n \n def assertLogs(self,logger=None ,level=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n from ._log import _AssertLogsContext\n return _AssertLogsContext(self,logger,level,no_logs=False )\n \n def assertNoLogs(self,logger=None ,level=None ):\n ''\n\n\n\n \n from ._log import _AssertLogsContext\n return _AssertLogsContext(self,logger,level,no_logs=True )\n \n def _getAssertEqualityFunc(self,first,second):\n ''\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n if type(first)is type(second):\n asserter=self._type_equality_funcs.get(type(first))\n if asserter is not None :\n if isinstance(asserter,str):\n asserter=getattr(self,asserter)\n return asserter\n \n return self._baseAssertEqual\n \n def _baseAssertEqual(self,first,second,msg=None ):\n ''\n if not first ==second:\n standardMsg='%s != %s'%_common_shorten_repr(first,second)\n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n def assertEqual(self,first,second,msg=None ):\n ''\n\n \n assertion_func=self._getAssertEqualityFunc(first,second)\n assertion_func(first,second,msg=msg)\n \n def assertNotEqual(self,first,second,msg=None ):\n ''\n\n \n if not first !=second:\n msg=self._formatMessage(msg,'%s == %s'%(safe_repr(first),\n safe_repr(second)))\n raise self.failureException(msg)\n \n def assertAlmostEqual(self,first,second,places=None ,msg=None ,\n delta=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if first ==second:\n \n return\n if delta is not None and places is not None :\n raise TypeError(\"specify delta or places not both\")\n \n diff=abs(first -second)\n if delta is not None :\n if diff <=delta:\n return\n \n standardMsg='%s != %s within %s delta (%s difference)'%(\n safe_repr(first),\n safe_repr(second),\n safe_repr(delta),\n safe_repr(diff))\n else :\n if places is None :\n places=7\n \n if round(diff,places)==0:\n return\n \n standardMsg='%s != %s within %r places (%s difference)'%(\n safe_repr(first),\n safe_repr(second),\n places,\n safe_repr(diff))\n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n def assertNotAlmostEqual(self,first,second,places=None ,msg=None ,\n delta=None ):\n ''\n\n\n\n\n\n\n\n\n \n if delta is not None and places is not None :\n raise TypeError(\"specify delta or places not both\")\n diff=abs(first -second)\n if delta is not None :\n if not (first ==second)and diff >delta:\n return\n standardMsg='%s == %s within %s delta (%s difference)'%(\n safe_repr(first),\n safe_repr(second),\n safe_repr(delta),\n safe_repr(diff))\n else :\n if places is None :\n places=7\n if not (first ==second)and round(diff,places)!=0:\n return\n standardMsg='%s == %s within %r places'%(safe_repr(first),\n safe_repr(second),\n places)\n \n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n def assertSequenceEqual(self,seq1,seq2,msg=None ,seq_type=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if seq_type is not None :\n seq_type_name=seq_type.__name__\n if not isinstance(seq1,seq_type):\n raise self.failureException('First sequence is not a %s: %s'\n %(seq_type_name,safe_repr(seq1)))\n if not isinstance(seq2,seq_type):\n raise self.failureException('Second sequence is not a %s: %s'\n %(seq_type_name,safe_repr(seq2)))\n else :\n seq_type_name=\"sequence\"\n \n differing=None\n try :\n len1=len(seq1)\n except (TypeError,NotImplementedError):\n differing='First %s has no length. Non-sequence?'%(\n seq_type_name)\n \n if differing is None :\n try :\n len2=len(seq2)\n except (TypeError,NotImplementedError):\n differing='Second %s has no length. Non-sequence?'%(\n seq_type_name)\n \n if differing is None :\n if seq1 ==seq2:\n return\n \n differing='%ss differ: %s != %s\\n'%(\n (seq_type_name.capitalize(),)+\n _common_shorten_repr(seq1,seq2))\n \n for i in range(min(len1,len2)):\n try :\n item1=seq1[i]\n except (TypeError,IndexError,NotImplementedError):\n differing +=('\\nUnable to index element %d of first %s\\n'%\n (i,seq_type_name))\n break\n \n try :\n item2=seq2[i]\n except (TypeError,IndexError,NotImplementedError):\n differing +=('\\nUnable to index element %d of second %s\\n'%\n (i,seq_type_name))\n break\n \n if item1 !=item2:\n differing +=('\\nFirst differing element %d:\\n%s\\n%s\\n'%\n ((i,)+_common_shorten_repr(item1,item2)))\n break\n else :\n if (len1 ==len2 and seq_type is None and\n type(seq1)!=type(seq2)):\n \n return\n \n if len1 >len2:\n differing +=('\\nFirst %s contains %d additional '\n 'elements.\\n'%(seq_type_name,len1 -len2))\n try :\n differing +=('First extra element %d:\\n%s\\n'%\n (len2,safe_repr(seq1[len2])))\n except (TypeError,IndexError,NotImplementedError):\n differing +=('Unable to index element %d '\n 'of first %s\\n'%(len2,seq_type_name))\n elif len1 self._diffThreshold or\n len(second)>self._diffThreshold):\n self._baseAssertEqual(first,second,msg)\n firstlines=first.splitlines(keepends=True )\n secondlines=second.splitlines(keepends=True )\n if len(firstlines)==1 and first.strip('\\r\\n')==first:\n firstlines=[first+'\\n']\n secondlines=[second+'\\n']\n standardMsg='%s != %s'%_common_shorten_repr(first,second)\n diff='\\n'+''.join(difflib.ndiff(firstlines,secondlines))\n standardMsg=self._truncateMessage(standardMsg,diff)\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertLess(self,a,b,msg=None ):\n ''\n if not a b:\n standardMsg='%s not greater than %s'%(safe_repr(a),safe_repr(b))\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertGreaterEqual(self,a,b,msg=None ):\n ''\n if not a >=b:\n standardMsg='%s not greater than or equal to %s'%(safe_repr(a),safe_repr(b))\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertIsNone(self,obj,msg=None ):\n ''\n if obj is not None :\n standardMsg='%s is not None'%(safe_repr(obj),)\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertIsNotNone(self,obj,msg=None ):\n ''\n if obj is None :\n standardMsg='unexpectedly None'\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertIsInstance(self,obj,cls,msg=None ):\n ''\n \n if not isinstance(obj,cls):\n standardMsg='%s is not an instance of %r'%(safe_repr(obj),cls)\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertNotIsInstance(self,obj,cls,msg=None ):\n ''\n if isinstance(obj,cls):\n standardMsg='%s is an instance of %r'%(safe_repr(obj),cls)\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertRaisesRegex(self,expected_exception,expected_regex,\n *args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n \n context=_AssertRaisesContext(expected_exception,self,expected_regex)\n return context.handle('assertRaisesRegex',args,kwargs)\n \n def assertWarnsRegex(self,expected_warning,expected_regex,\n *args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n context=_AssertWarnsContext(expected_warning,self,expected_regex)\n return context.handle('assertWarnsRegex',args,kwargs)\n \n def assertRegex(self,text,expected_regex,msg=None ):\n ''\n if isinstance(expected_regex,(str,bytes)):\n assert expected_regex,\"expected_regex must not be empty.\"\n expected_regex=re.compile(expected_regex)\n if not expected_regex.search(text):\n standardMsg=\"Regex didn't match: %r not found in %r\"%(\n expected_regex.pattern,text)\n \n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n def assertNotRegex(self,text,unexpected_regex,msg=None ):\n ''\n if isinstance(unexpected_regex,(str,bytes)):\n unexpected_regex=re.compile(unexpected_regex)\n match=unexpected_regex.search(text)\n if match:\n standardMsg='Regex matched: %r matches %r in %r'%(\n text[match.start():match.end()],\n unexpected_regex.pattern,\n text)\n \n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n \n def _deprecate(original_func):\n def deprecated_func(*args,**kwargs):\n warnings.warn(\n 'Please use {0} instead.'.format(original_func.__name__),\n DeprecationWarning,2)\n return original_func(*args,**kwargs)\n return deprecated_func\n \n \n failUnlessEqual=assertEquals=_deprecate(assertEqual)\n failIfEqual=assertNotEquals=_deprecate(assertNotEqual)\n failUnlessAlmostEqual=assertAlmostEquals=_deprecate(assertAlmostEqual)\n failIfAlmostEqual=assertNotAlmostEquals=_deprecate(assertNotAlmostEqual)\n failUnless=assert_=_deprecate(assertTrue)\n failUnlessRaises=_deprecate(assertRaises)\n failIf=_deprecate(assertFalse)\n assertRaisesRegexp=_deprecate(assertRaisesRegex)\n assertRegexpMatches=_deprecate(assertRegex)\n assertNotRegexpMatches=_deprecate(assertNotRegex)\n \n \n \nclass FunctionTestCase(TestCase):\n ''\n\n\n\n\n\n \n \n def __init__(self,testFunc,setUp=None ,tearDown=None ,description=None ):\n super(FunctionTestCase,self).__init__()\n self._setUpFunc=setUp\n self._tearDownFunc=tearDown\n self._testFunc=testFunc\n self._description=description\n \n def setUp(self):\n if self._setUpFunc is not None :\n self._setUpFunc()\n \n def tearDown(self):\n if self._tearDownFunc is not None :\n self._tearDownFunc()\n \n def runTest(self):\n self._testFunc()\n \n def id(self):\n return self._testFunc.__name__\n \n def __eq__(self,other):\n if not isinstance(other,self.__class__):\n return NotImplemented\n \n return self._setUpFunc ==other._setUpFunc and\\\n self._tearDownFunc ==other._tearDownFunc and\\\n self._testFunc ==other._testFunc and\\\n self._description ==other._description\n \n def __hash__(self):\n return hash((type(self),self._setUpFunc,self._tearDownFunc,\n self._testFunc,self._description))\n \n def __str__(self):\n return \"%s (%s)\"%(strclass(self.__class__),\n self._testFunc.__name__)\n \n def __repr__(self):\n return \"<%s tec=%s>\"%(strclass(self.__class__),\n self._testFunc)\n \n def shortDescription(self):\n if self._description is not None :\n return self._description\n doc=self._testFunc.__doc__\n return doc and doc.split(\"\\n\")[0].strip()or None\n \n \nclass _SubTest(TestCase):\n\n def __init__(self,test_case,message,params):\n super().__init__()\n self._message=message\n self.test_case=test_case\n self.params=params\n self.failureException=test_case.failureException\n \n def runTest(self):\n raise NotImplementedError(\"subtests cannot be run directly\")\n \n def _subDescription(self):\n parts=[]\n if self._message is not _subtest_msg_sentinel:\n parts.append(\"[{}]\".format(self._message))\n if self.params:\n params_desc=', '.join(\n \"{}={!r}\".format(k,v)\n for (k,v)in self.params.items())\n parts.append(\"({})\".format(params_desc))\n return \" \".join(parts)or '()'\n \n def id(self):\n return \"{} {}\".format(self.test_case.id(),self._subDescription())\n \n def shortDescription(self):\n ''\n\n \n return self.test_case.shortDescription()\n \n def __str__(self):\n return \"{} {}\".format(self.test_case,self._subDescription())\n", ["collections", "contextlib", "difflib", "functools", "pprint", "re", "sys", "traceback", "types", "unittest", "unittest._log", "unittest.result", "unittest.util", "warnings"]], "unittest.loader": [".py", "''\n\nimport os\nimport re\nimport sys\nimport traceback\nimport types\nimport functools\n\nfrom fnmatch import fnmatch,fnmatchcase\n\nfrom. import case,suite,util\n\n__unittest=True\n\n\n\n\nVALID_MODULE_NAME=re.compile(r'[_a-z]\\w*\\.py$',re.IGNORECASE)\n\n\nclass _FailedTest(case.TestCase):\n _testMethodName=None\n \n def __init__(self,method_name,exception):\n self._exception=exception\n super(_FailedTest,self).__init__(method_name)\n \n def __getattr__(self,name):\n if name !=self._testMethodName:\n return super(_FailedTest,self).__getattr__(name)\n def testFailure():\n raise self._exception\n return testFailure\n \n \ndef _make_failed_import_test(name,suiteClass):\n message='Failed to import test module: %s\\n%s'%(\n name,traceback.format_exc())\n return _make_failed_test(name,ImportError(message),suiteClass,message)\n \ndef _make_failed_load_tests(name,exception,suiteClass):\n message='Failed to call load_tests:\\n%s'%(traceback.format_exc(),)\n return _make_failed_test(\n name,exception,suiteClass,message)\n \ndef _make_failed_test(methodname,exception,suiteClass,message):\n test=_FailedTest(methodname,exception)\n return suiteClass((test,)),message\n \ndef _make_skipped_test(methodname,exception,suiteClass):\n @case.skip(str(exception))\n def testSkipped(self):\n pass\n attrs={methodname:testSkipped}\n TestClass=type(\"ModuleSkipped\",(case.TestCase,),attrs)\n return suiteClass((TestClass(methodname),))\n \ndef _splitext(path):\n return os.path.splitext(path)[0]\n \n \nclass TestLoader(object):\n ''\n\n\n \n testMethodPrefix='test'\n sortTestMethodsUsing=staticmethod(util.three_way_cmp)\n testNamePatterns=None\n suiteClass=suite.TestSuite\n _top_level_dir=None\n \n def __init__(self):\n super(TestLoader,self).__init__()\n self.errors=[]\n \n \n self._loading_packages=set()\n \n def loadTestsFromTestCase(self,testCaseClass):\n ''\n if issubclass(testCaseClass,suite.TestSuite):\n raise TypeError(\"Test cases should not be derived from \"\n \"TestSuite. Maybe you meant to derive from \"\n \"TestCase?\")\n testCaseNames=self.getTestCaseNames(testCaseClass)\n if not testCaseNames and hasattr(testCaseClass,'runTest'):\n testCaseNames=['runTest']\n loaded_suite=self.suiteClass(map(testCaseClass,testCaseNames))\n return loaded_suite\n \n def loadTestsFromModule(self,module,*,pattern=None):\n ''\n tests=[]\n for name in dir(module):\n obj=getattr(module,name)\n if isinstance(obj,type)and issubclass(obj,case.TestCase):\n tests.append(self.loadTestsFromTestCase(obj))\n \n load_tests=getattr(module,'load_tests',None)\n tests=self.suiteClass(tests)\n if load_tests is not None:\n try:\n return load_tests(self,tests,pattern)\n except Exception as e:\n error_case,error_message=_make_failed_load_tests(\n module.__name__,e,self.suiteClass)\n self.errors.append(error_message)\n return error_case\n return tests\n \n def loadTestsFromName(self,name,module=None):\n ''\n\n\n\n\n\n\n \n parts=name.split('.')\n error_case,error_message=None,None\n if module is None:\n parts_copy=parts[:]\n while parts_copy:\n try:\n module_name='.'.join(parts_copy)\n module=__import__(module_name)\n break\n except ImportError:\n next_attribute=parts_copy.pop()\n \n error_case,error_message=_make_failed_import_test(\n next_attribute,self.suiteClass)\n if not parts_copy:\n \n self.errors.append(error_message)\n return error_case\n parts=parts[1:]\n obj=module\n for part in parts:\n try:\n parent,obj=obj,getattr(obj,part)\n except AttributeError as e:\n \n if(getattr(obj,'__path__',None)is not None\n and error_case is not None):\n \n \n \n \n \n self.errors.append(error_message)\n return error_case\n else:\n \n error_case,error_message=_make_failed_test(\n part,e,self.suiteClass,\n 'Failed to access attribute:\\n%s'%(\n traceback.format_exc(),))\n self.errors.append(error_message)\n return error_case\n \n if isinstance(obj,types.ModuleType):\n return self.loadTestsFromModule(obj)\n elif isinstance(obj,type)and issubclass(obj,case.TestCase):\n return self.loadTestsFromTestCase(obj)\n elif(isinstance(obj,types.FunctionType)and\n isinstance(parent,type)and\n issubclass(parent,case.TestCase)):\n name=parts[-1]\n inst=parent(name)\n \n if not isinstance(getattr(inst,name),types.FunctionType):\n return self.suiteClass([inst])\n elif isinstance(obj,suite.TestSuite):\n return obj\n if callable(obj):\n test=obj()\n if isinstance(test,suite.TestSuite):\n return test\n elif isinstance(test,case.TestCase):\n return self.suiteClass([test])\n else:\n raise TypeError(\"calling %s returned %s, not a test\"%\n (obj,test))\n else:\n raise TypeError(\"don't know how to make test from: %s\"%obj)\n \n def loadTestsFromNames(self,names,module=None):\n ''\n\n \n suites=[self.loadTestsFromName(name,module)for name in names]\n return self.suiteClass(suites)\n \n def getTestCaseNames(self,testCaseClass):\n ''\n \n def shouldIncludeMethod(attrname):\n if not attrname.startswith(self.testMethodPrefix):\n return False\n testFunc=getattr(testCaseClass,attrname)\n if not callable(testFunc):\n return False\n fullName=f'%s.%s.%s'%(\n testCaseClass.__module__,testCaseClass.__qualname__,attrname\n )\n return self.testNamePatterns is None or\\\n any(fnmatchcase(fullName,pattern)for pattern in self.testNamePatterns)\n testFnNames=list(filter(shouldIncludeMethod,dir(testCaseClass)))\n if self.sortTestMethodsUsing:\n testFnNames.sort(key=functools.cmp_to_key(self.sortTestMethodsUsing))\n return testFnNames\n \n def discover(self,start_dir,pattern='test*.py',top_level_dir=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n set_implicit_top=False\n if top_level_dir is None and self._top_level_dir is not None:\n \n top_level_dir=self._top_level_dir\n elif top_level_dir is None:\n set_implicit_top=True\n top_level_dir=start_dir\n \n top_level_dir=os.path.abspath(top_level_dir)\n \n if not top_level_dir in sys.path:\n \n \n \n \n sys.path.insert(0,top_level_dir)\n self._top_level_dir=top_level_dir\n \n is_not_importable=False\n if os.path.isdir(os.path.abspath(start_dir)):\n start_dir=os.path.abspath(start_dir)\n if start_dir !=top_level_dir:\n is_not_importable=not os.path.isfile(os.path.join(start_dir,'__init__.py'))\n else:\n \n try:\n __import__(start_dir)\n except ImportError:\n is_not_importable=True\n else:\n the_module=sys.modules[start_dir]\n top_part=start_dir.split('.')[0]\n try:\n start_dir=os.path.abspath(\n os.path.dirname((the_module.__file__)))\n except AttributeError:\n if the_module.__name__ in sys.builtin_module_names:\n \n raise TypeError('Can not use builtin modules '\n 'as dotted module names')from None\n else:\n raise TypeError(\n f\"don't know how to discover from {the_module !r}\"\n )from None\n \n if set_implicit_top:\n self._top_level_dir=self._get_directory_containing_module(top_part)\n sys.path.remove(top_level_dir)\n \n if is_not_importable:\n raise ImportError('Start directory is not importable: %r'%start_dir)\n \n tests=list(self._find_tests(start_dir,pattern))\n return self.suiteClass(tests)\n \n def _get_directory_containing_module(self,module_name):\n module=sys.modules[module_name]\n full_path=os.path.abspath(module.__file__)\n \n if os.path.basename(full_path).lower().startswith('__init__.py'):\n return os.path.dirname(os.path.dirname(full_path))\n else:\n \n \n \n return os.path.dirname(full_path)\n \n def _get_name_from_path(self,path):\n if path ==self._top_level_dir:\n return '.'\n path=_splitext(os.path.normpath(path))\n \n _relpath=os.path.relpath(path,self._top_level_dir)\n assert not os.path.isabs(_relpath),\"Path must be within the project\"\n assert not _relpath.startswith('..'),\"Path must be within the project\"\n \n name=_relpath.replace(os.path.sep,'.')\n return name\n \n def _get_module_from_name(self,name):\n __import__(name)\n return sys.modules[name]\n \n def _match_path(self,path,full_path,pattern):\n \n return fnmatch(path,pattern)\n \n def _find_tests(self,start_dir,pattern):\n ''\n \n name=self._get_name_from_path(start_dir)\n \n \n if name !='.'and name not in self._loading_packages:\n \n \n tests,should_recurse=self._find_test_path(start_dir,pattern)\n if tests is not None:\n yield tests\n if not should_recurse:\n \n \n return\n \n paths=sorted(os.listdir(start_dir))\n for path in paths:\n full_path=os.path.join(start_dir,path)\n tests,should_recurse=self._find_test_path(full_path,pattern)\n if tests is not None:\n yield tests\n if should_recurse:\n \n name=self._get_name_from_path(full_path)\n self._loading_packages.add(name)\n try:\n yield from self._find_tests(full_path,pattern)\n finally:\n self._loading_packages.discard(name)\n \n def _find_test_path(self,full_path,pattern):\n ''\n\n\n\n\n\n \n basename=os.path.basename(full_path)\n if os.path.isfile(full_path):\n if not VALID_MODULE_NAME.match(basename):\n \n return None,False\n if not self._match_path(basename,full_path,pattern):\n return None,False\n \n name=self._get_name_from_path(full_path)\n try:\n module=self._get_module_from_name(name)\n except case.SkipTest as e:\n return _make_skipped_test(name,e,self.suiteClass),False\n except:\n error_case,error_message=\\\n _make_failed_import_test(name,self.suiteClass)\n self.errors.append(error_message)\n return error_case,False\n else:\n mod_file=os.path.abspath(\n getattr(module,'__file__',full_path))\n realpath=_splitext(\n os.path.realpath(mod_file))\n fullpath_noext=_splitext(\n os.path.realpath(full_path))\n if realpath.lower()!=fullpath_noext.lower():\n module_dir=os.path.dirname(realpath)\n mod_name=_splitext(\n os.path.basename(full_path))\n expected_dir=os.path.dirname(full_path)\n msg=(\"%r module incorrectly imported from %r. Expected \"\n \"%r. Is this module globally installed?\")\n raise ImportError(\n msg %(mod_name,module_dir,expected_dir))\n return self.loadTestsFromModule(module,pattern=pattern),False\n elif os.path.isdir(full_path):\n if not os.path.isfile(os.path.join(full_path,'__init__.py')):\n return None,False\n \n load_tests=None\n tests=None\n name=self._get_name_from_path(full_path)\n try:\n package=self._get_module_from_name(name)\n except case.SkipTest as e:\n return _make_skipped_test(name,e,self.suiteClass),False\n except:\n error_case,error_message=\\\n _make_failed_import_test(name,self.suiteClass)\n self.errors.append(error_message)\n return error_case,False\n else:\n load_tests=getattr(package,'load_tests',None)\n \n self._loading_packages.add(name)\n try:\n tests=self.loadTestsFromModule(package,pattern=pattern)\n if load_tests is not None:\n \n return tests,False\n return tests,True\n finally:\n self._loading_packages.discard(name)\n else:\n return None,False\n \n \ndefaultTestLoader=TestLoader()\n\n\n\n\n\ndef _makeLoader(prefix,sortUsing,suiteClass=None,testNamePatterns=None):\n loader=TestLoader()\n loader.sortTestMethodsUsing=sortUsing\n loader.testMethodPrefix=prefix\n loader.testNamePatterns=testNamePatterns\n if suiteClass:\n loader.suiteClass=suiteClass\n return loader\n \ndef getTestCaseNames(testCaseClass,prefix,sortUsing=util.three_way_cmp,testNamePatterns=None):\n import warnings\n warnings.warn(\n \"unittest.getTestCaseNames() is deprecated and will be removed in Python 3.13. \"\n \"Please use unittest.TestLoader.getTestCaseNames() instead.\",\n DeprecationWarning,stacklevel=2\n )\n return _makeLoader(prefix,sortUsing,testNamePatterns=testNamePatterns).getTestCaseNames(testCaseClass)\n \ndef makeSuite(testCaseClass,prefix='test',sortUsing=util.three_way_cmp,\nsuiteClass=suite.TestSuite):\n import warnings\n warnings.warn(\n \"unittest.makeSuite() is deprecated and will be removed in Python 3.13. \"\n \"Please use unittest.TestLoader.loadTestsFromTestCase() instead.\",\n DeprecationWarning,stacklevel=2\n )\n return _makeLoader(prefix,sortUsing,suiteClass).loadTestsFromTestCase(\n testCaseClass)\n \ndef findTestCases(module,prefix='test',sortUsing=util.three_way_cmp,\nsuiteClass=suite.TestSuite):\n import warnings\n warnings.warn(\n \"unittest.findTestCases() is deprecated and will be removed in Python 3.13. \"\n \"Please use unittest.TestLoader.loadTestsFromModule() instead.\",\n DeprecationWarning,stacklevel=2\n )\n return _makeLoader(prefix,sortUsing,suiteClass).loadTestsFromModule(\\\n module)\n", ["fnmatch", "functools", "os", "re", "sys", "traceback", "types", "unittest", "unittest.case", "unittest.suite", "unittest.util", "warnings"]], "unittest.main": [".py", "''\n\nimport sys\nimport argparse\nimport os\nimport warnings\n\nfrom. import loader,runner\nfrom.signals import installHandler\n\n__unittest=True\n_NO_TESTS_EXITCODE=5\n\nMAIN_EXAMPLES=\"\"\"\\\nExamples:\n %(prog)s test_module - run tests from test_module\n %(prog)s module.TestClass - run tests from module.TestClass\n %(prog)s module.Class.test_method - run specified test method\n %(prog)s path/to/test_file.py - run tests from test_file.py\n\"\"\"\n\nMODULE_EXAMPLES=\"\"\"\\\nExamples:\n %(prog)s - run default set of tests\n %(prog)s MyTestSuite - run suite 'MyTestSuite'\n %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething\n %(prog)s MyTestCase - run all 'test*' test methods\n in MyTestCase\n\"\"\"\n\ndef _convert_name(name):\n\n\n\n\n if os.path.isfile(name)and name.lower().endswith('.py'):\n if os.path.isabs(name):\n rel_path=os.path.relpath(name,os.getcwd())\n if os.path.isabs(rel_path)or rel_path.startswith(os.pardir):\n return name\n name=rel_path\n \n \n return os.path.normpath(name)[:-3].replace('\\\\','.').replace('/','.')\n return name\n \ndef _convert_names(names):\n return[_convert_name(name)for name in names]\n \n \ndef _convert_select_pattern(pattern):\n if not '*'in pattern:\n pattern='*%s*'%pattern\n return pattern\n \n \nclass TestProgram(object):\n ''\n\n \n \n module=None\n verbosity=1\n failfast=catchbreak=buffer=progName=warnings=testNamePatterns=None\n _discovery_parser=None\n \n def __init__(self,module='__main__',defaultTest=None,argv=None,\n testRunner=None,testLoader=loader.defaultTestLoader,\n exit=True,verbosity=1,failfast=None,catchbreak=None,\n buffer=None,warnings=None,*,tb_locals=False,\n durations=None):\n if isinstance(module,str):\n self.module=__import__(module)\n for part in module.split('.')[1:]:\n self.module=getattr(self.module,part)\n else:\n self.module=module\n if argv is None:\n argv=sys.argv\n \n self.exit=exit\n self.failfast=failfast\n self.catchbreak=catchbreak\n self.verbosity=verbosity\n self.buffer=buffer\n self.tb_locals=tb_locals\n self.durations=durations\n if warnings is None and not sys.warnoptions:\n \n \n \n self.warnings='default'\n else:\n \n \n \n \n \n self.warnings=warnings\n self.defaultTest=defaultTest\n self.testRunner=testRunner\n self.testLoader=testLoader\n self.progName=os.path.basename(argv[0])\n self.parseArgs(argv)\n self.runTests()\n \n def usageExit(self,msg=None):\n warnings.warn(\"TestProgram.usageExit() is deprecated and will be\"\n \" removed in Python 3.13\",DeprecationWarning)\n if msg:\n print(msg)\n if self._discovery_parser is None:\n self._initArgParsers()\n self._print_help()\n sys.exit(2)\n \n def _print_help(self,*args,**kwargs):\n if self.module is None:\n print(self._main_parser.format_help())\n print(MAIN_EXAMPLES %{'prog':self.progName})\n self._discovery_parser.print_help()\n else:\n print(self._main_parser.format_help())\n print(MODULE_EXAMPLES %{'prog':self.progName})\n \n def parseArgs(self,argv):\n self._initArgParsers()\n if self.module is None:\n if len(argv)>1 and argv[1].lower()=='discover':\n self._do_discovery(argv[2:])\n return\n self._main_parser.parse_args(argv[1:],self)\n if not self.tests:\n \n \n self._do_discovery([])\n return\n else:\n self._main_parser.parse_args(argv[1:],self)\n \n if self.tests:\n self.testNames=_convert_names(self.tests)\n if __name__ =='__main__':\n \n self.module=None\n elif self.defaultTest is None:\n \n self.testNames=None\n elif isinstance(self.defaultTest,str):\n self.testNames=(self.defaultTest,)\n else:\n self.testNames=list(self.defaultTest)\n self.createTests()\n \n def createTests(self,from_discovery=False,Loader=None):\n if self.testNamePatterns:\n self.testLoader.testNamePatterns=self.testNamePatterns\n if from_discovery:\n loader=self.testLoader if Loader is None else Loader()\n self.test=loader.discover(self.start,self.pattern,self.top)\n elif self.testNames is None:\n self.test=self.testLoader.loadTestsFromModule(self.module)\n else:\n self.test=self.testLoader.loadTestsFromNames(self.testNames,\n self.module)\n \n def _initArgParsers(self):\n parent_parser=self._getParentArgParser()\n self._main_parser=self._getMainArgParser(parent_parser)\n self._discovery_parser=self._getDiscoveryArgParser(parent_parser)\n \n def _getParentArgParser(self):\n parser=argparse.ArgumentParser(add_help=False)\n \n parser.add_argument('-v','--verbose',dest='verbosity',\n action='store_const',const=2,\n help='Verbose output')\n parser.add_argument('-q','--quiet',dest='verbosity',\n action='store_const',const=0,\n help='Quiet output')\n parser.add_argument('--locals',dest='tb_locals',\n action='store_true',\n help='Show local variables in tracebacks')\n parser.add_argument('--durations',dest='durations',type=int,\n default=None,metavar=\"N\",\n help='Show the N slowest test cases (N=0 for all)')\n if self.failfast is None:\n parser.add_argument('-f','--failfast',dest='failfast',\n action='store_true',\n help='Stop on first fail or error')\n self.failfast=False\n if self.catchbreak is None:\n parser.add_argument('-c','--catch',dest='catchbreak',\n action='store_true',\n help='Catch Ctrl-C and display results so far')\n self.catchbreak=False\n if self.buffer is None:\n parser.add_argument('-b','--buffer',dest='buffer',\n action='store_true',\n help='Buffer stdout and stderr during tests')\n self.buffer=False\n if self.testNamePatterns is None:\n parser.add_argument('-k',dest='testNamePatterns',\n action='append',type=_convert_select_pattern,\n help='Only run tests which match the given substring')\n self.testNamePatterns=[]\n \n return parser\n \n def _getMainArgParser(self,parent):\n parser=argparse.ArgumentParser(parents=[parent])\n parser.prog=self.progName\n parser.print_help=self._print_help\n \n parser.add_argument('tests',nargs='*',\n help='a list of any number of test modules, '\n 'classes and test methods.')\n \n return parser\n \n def _getDiscoveryArgParser(self,parent):\n parser=argparse.ArgumentParser(parents=[parent])\n parser.prog='%s discover'%self.progName\n parser.epilog=('For test discovery all test modules must be '\n 'importable from the top level directory of the '\n 'project.')\n \n parser.add_argument('-s','--start-directory',dest='start',\n help=\"Directory to start discovery ('.' default)\")\n parser.add_argument('-p','--pattern',dest='pattern',\n help=\"Pattern to match tests ('test*.py' default)\")\n parser.add_argument('-t','--top-level-directory',dest='top',\n help='Top level directory of project (defaults to '\n 'start directory)')\n for arg in('start','pattern','top'):\n parser.add_argument(arg,nargs='?',\n default=argparse.SUPPRESS,\n help=argparse.SUPPRESS)\n \n return parser\n \n def _do_discovery(self,argv,Loader=None):\n self.start='.'\n self.pattern='test*.py'\n self.top=None\n if argv is not None:\n \n if self._discovery_parser is None:\n \n self._initArgParsers()\n self._discovery_parser.parse_args(argv,self)\n \n self.createTests(from_discovery=True,Loader=Loader)\n \n def runTests(self):\n if self.catchbreak:\n installHandler()\n if self.testRunner is None:\n self.testRunner=runner.TextTestRunner\n if isinstance(self.testRunner,type):\n try:\n try:\n testRunner=self.testRunner(verbosity=self.verbosity,\n failfast=self.failfast,\n buffer=self.buffer,\n warnings=self.warnings,\n tb_locals=self.tb_locals,\n durations=self.durations)\n except TypeError:\n \n testRunner=self.testRunner(verbosity=self.verbosity,\n failfast=self.failfast,\n buffer=self.buffer,\n warnings=self.warnings)\n except TypeError:\n \n testRunner=self.testRunner()\n else:\n \n testRunner=self.testRunner\n self.result=testRunner.run(self.test)\n if self.exit:\n if self.result.testsRun ==0:\n sys.exit(_NO_TESTS_EXITCODE)\n elif self.result.wasSuccessful():\n sys.exit(0)\n else:\n sys.exit(1)\n \n \nmain=TestProgram\n", ["argparse", "os", "sys", "unittest", "unittest.loader", "unittest.runner", "unittest.signals", "warnings"]], "unittest.mock": [".py", "\n\n\n\n\n\n__all__=(\n'Mock',\n'MagicMock',\n'patch',\n'sentinel',\n'DEFAULT',\n'ANY',\n'call',\n'create_autospec',\n'AsyncMock',\n'FILTER_DIR',\n'NonCallableMock',\n'NonCallableMagicMock',\n'mock_open',\n'PropertyMock',\n'seal',\n)\n\n\nimport asyncio\nimport contextlib\nimport io\nimport inspect\nimport pprint\nimport sys\nimport builtins\nimport pkgutil\nfrom asyncio import iscoroutinefunction\nfrom types import CodeType,ModuleType,MethodType\nfrom unittest.util import safe_repr\nfrom functools import wraps,partial\n\n\nclass InvalidSpecError(Exception):\n ''\n \n \n_builtins={name for name in dir(builtins)if not name.startswith('_')}\n\nFILTER_DIR=True\n\n\n\n_safe_super=super\n\ndef _is_async_obj(obj):\n if _is_instance_mock(obj)and not isinstance(obj,AsyncMock):\n return False\n if hasattr(obj,'__func__'):\n obj=getattr(obj,'__func__')\n return iscoroutinefunction(obj)or inspect.isawaitable(obj)\n \n \ndef _is_async_func(func):\n if getattr(func,'__code__',None ):\n return iscoroutinefunction(func)\n else :\n return False\n \n \ndef _is_instance_mock(obj):\n\n\n return issubclass(type(obj),NonCallableMock)\n \n \ndef _is_exception(obj):\n return (\n isinstance(obj,BaseException)or\n isinstance(obj,type)and issubclass(obj,BaseException)\n )\n \n \ndef _extract_mock(obj):\n\n\n if isinstance(obj,FunctionTypes)and hasattr(obj,'mock'):\n return obj.mock\n else :\n return obj\n \n \ndef _get_signature_object(func,as_instance,eat_self):\n ''\n\n\n\n \n if isinstance(func,type)and not as_instance:\n \n func=func.__init__\n \n eat_self=True\n elif not isinstance(func,FunctionTypes):\n \n \n try :\n func=func.__call__\n except AttributeError:\n return None\n if eat_self:\n sig_func=partial(func,None )\n else :\n sig_func=func\n try :\n return func,inspect.signature(sig_func)\n except ValueError:\n \n return None\n \n \ndef _check_signature(func,mock,skipfirst,instance=False ):\n sig=_get_signature_object(func,instance,skipfirst)\n if sig is None :\n return\n func,sig=sig\n def checksig(self,/,*args,**kwargs):\n sig.bind(*args,**kwargs)\n _copy_func_details(func,checksig)\n type(mock)._mock_check_sig=checksig\n type(mock).__signature__=sig\n \n \ndef _copy_func_details(func,funcopy):\n\n\n for attribute in (\n '__name__','__doc__','__text_signature__',\n '__module__','__defaults__','__kwdefaults__',\n ):\n try :\n setattr(funcopy,attribute,getattr(func,attribute))\n except AttributeError:\n pass\n \n \ndef _callable(obj):\n if isinstance(obj,type):\n return True\n if isinstance(obj,(staticmethod,classmethod,MethodType)):\n return _callable(obj.__func__)\n if getattr(obj,'__call__',None )is not None :\n return True\n return False\n \n \ndef _is_list(obj):\n\n\n return type(obj)in (list,tuple)\n \n \ndef _instance_callable(obj):\n ''\n \n if not isinstance(obj,type):\n \n return getattr(obj,'__call__',None )is not None\n \n \n \n for base in (obj,)+obj.__mro__:\n if base.__dict__.get('__call__')is not None :\n return True\n return False\n \n \ndef _set_signature(mock,original,instance=False ):\n\n\n\n\n skipfirst=isinstance(original,type)\n result=_get_signature_object(original,instance,skipfirst)\n if result is None :\n return mock\n func,sig=result\n def checksig(*args,**kwargs):\n sig.bind(*args,**kwargs)\n _copy_func_details(func,checksig)\n \n name=original.__name__\n if not name.isidentifier():\n name='funcopy'\n context={'_checksig_':checksig,'mock':mock}\n src=\"\"\"def %s(*args, **kwargs):\n _checksig_(*args, **kwargs)\n return mock(*args, **kwargs)\"\"\"%name\n exec(src,context)\n funcopy=context[name]\n _setup_func(funcopy,mock,sig)\n return funcopy\n \n \ndef _setup_func(funcopy,mock,sig):\n funcopy.mock=mock\n \n def assert_called_with(*args,**kwargs):\n return mock.assert_called_with(*args,**kwargs)\n def assert_called(*args,**kwargs):\n return mock.assert_called(*args,**kwargs)\n def assert_not_called(*args,**kwargs):\n return mock.assert_not_called(*args,**kwargs)\n def assert_called_once(*args,**kwargs):\n return mock.assert_called_once(*args,**kwargs)\n def assert_called_once_with(*args,**kwargs):\n return mock.assert_called_once_with(*args,**kwargs)\n def assert_has_calls(*args,**kwargs):\n return mock.assert_has_calls(*args,**kwargs)\n def assert_any_call(*args,**kwargs):\n return mock.assert_any_call(*args,**kwargs)\n def reset_mock():\n funcopy.method_calls=_CallList()\n funcopy.mock_calls=_CallList()\n mock.reset_mock()\n ret=funcopy.return_value\n if _is_instance_mock(ret)and not ret is mock:\n ret.reset_mock()\n \n funcopy.called=False\n funcopy.call_count=0\n funcopy.call_args=None\n funcopy.call_args_list=_CallList()\n funcopy.method_calls=_CallList()\n funcopy.mock_calls=_CallList()\n \n funcopy.return_value=mock.return_value\n funcopy.side_effect=mock.side_effect\n funcopy._mock_children=mock._mock_children\n \n funcopy.assert_called_with=assert_called_with\n funcopy.assert_called_once_with=assert_called_once_with\n funcopy.assert_has_calls=assert_has_calls\n funcopy.assert_any_call=assert_any_call\n funcopy.reset_mock=reset_mock\n funcopy.assert_called=assert_called\n funcopy.assert_not_called=assert_not_called\n funcopy.assert_called_once=assert_called_once\n funcopy.__signature__=sig\n \n mock._mock_delegate=funcopy\n \n \ndef _setup_async_mock(mock):\n mock._is_coroutine=asyncio.coroutines._is_coroutine\n mock.await_count=0\n mock.await_args=None\n mock.await_args_list=_CallList()\n \n \n \n \n def wrapper(attr,/,*args,**kwargs):\n return getattr(mock.mock,attr)(*args,**kwargs)\n \n for attribute in ('assert_awaited',\n 'assert_awaited_once',\n 'assert_awaited_with',\n 'assert_awaited_once_with',\n 'assert_any_await',\n 'assert_has_awaits',\n 'assert_not_awaited'):\n \n \n \n \n \n setattr(mock,attribute,partial(wrapper,attribute))\n \n \ndef _is_magic(name):\n return '__%s__'%name[2:-2]==name\n \n \nclass _SentinelObject(object):\n ''\n def __init__(self,name):\n self.name=name\n \n def __repr__(self):\n return 'sentinel.%s'%self.name\n \n def __reduce__(self):\n return 'sentinel.%s'%self.name\n \n \nclass _Sentinel(object):\n ''\n def __init__(self):\n self._sentinels={}\n \n def __getattr__(self,name):\n if name =='__bases__':\n \n raise AttributeError\n return self._sentinels.setdefault(name,_SentinelObject(name))\n \n def __reduce__(self):\n return 'sentinel'\n \n \nsentinel=_Sentinel()\n\nDEFAULT=sentinel.DEFAULT\n_missing=sentinel.MISSING\n_deleted=sentinel.DELETED\n\n\n_allowed_names={\n'return_value','_mock_return_value','side_effect',\n'_mock_side_effect','_mock_parent','_mock_new_parent',\n'_mock_name','_mock_new_name'\n}\n\n\ndef _delegating_property(name):\n _allowed_names.add(name)\n _the_name='_mock_'+name\n def _get(self,name=name,_the_name=_the_name):\n sig=self._mock_delegate\n if sig is None :\n return getattr(self,_the_name)\n return getattr(sig,name)\n def _set(self,value,name=name,_the_name=_the_name):\n sig=self._mock_delegate\n if sig is None :\n self.__dict__[_the_name]=value\n else :\n setattr(sig,name,value)\n \n return property(_get,_set)\n \n \n \nclass _CallList(list):\n\n def __contains__(self,value):\n if not isinstance(value,list):\n return list.__contains__(self,value)\n len_value=len(value)\n len_self=len(self)\n if len_value >len_self:\n return False\n \n for i in range(0,len_self -len_value+1):\n sub_list=self[i:i+len_value]\n if sub_list ==value:\n return True\n return False\n \n def __repr__(self):\n return pprint.pformat(list(self))\n \n \ndef _check_and_set_parent(parent,value,name,new_name):\n value=_extract_mock(value)\n \n if not _is_instance_mock(value):\n return False\n if ((value._mock_name or value._mock_new_name)or\n (value._mock_parent is not None )or\n (value._mock_new_parent is not None )):\n return False\n \n _parent=parent\n while _parent is not None :\n \n \n if _parent is value:\n return False\n _parent=_parent._mock_new_parent\n \n if new_name:\n value._mock_new_parent=parent\n value._mock_new_name=new_name\n if name:\n value._mock_parent=parent\n value._mock_name=name\n return True\n \n \nclass _MockIter(object):\n def __init__(self,obj):\n self.obj=iter(obj)\n def __next__(self):\n return next(self.obj)\n \nclass Base(object):\n _mock_return_value=DEFAULT\n _mock_side_effect=None\n def __init__(self,/,*args,**kwargs):\n pass\n \n \n \nclass NonCallableMock(Base):\n ''\n \n def __new__(cls,/,*args,**kw):\n \n \n \n bases=(cls,)\n if not issubclass(cls,AsyncMockMixin):\n \n bound_args=_MOCK_SIG.bind_partial(cls,*args,**kw).arguments\n spec_arg=bound_args.get('spec_set',bound_args.get('spec'))\n if spec_arg is not None and _is_async_obj(spec_arg):\n bases=(AsyncMockMixin,cls)\n new=type(cls.__name__,bases,{'__doc__':cls.__doc__})\n instance=_safe_super(NonCallableMock,cls).__new__(new)\n return instance\n \n \n def __init__(\n self,spec=None ,wraps=None ,name=None ,spec_set=None ,\n parent=None ,_spec_state=None ,_new_name='',_new_parent=None ,\n _spec_as_instance=False ,_eat_self=None ,unsafe=False ,**kwargs\n ):\n if _new_parent is None :\n _new_parent=parent\n \n __dict__=self.__dict__\n __dict__['_mock_parent']=parent\n __dict__['_mock_name']=name\n __dict__['_mock_new_name']=_new_name\n __dict__['_mock_new_parent']=_new_parent\n __dict__['_mock_sealed']=False\n \n if spec_set is not None :\n spec=spec_set\n spec_set=True\n if _eat_self is None :\n _eat_self=parent is not None\n \n self._mock_add_spec(spec,spec_set,_spec_as_instance,_eat_self)\n \n __dict__['_mock_children']={}\n __dict__['_mock_wraps']=wraps\n __dict__['_mock_delegate']=None\n \n __dict__['_mock_called']=False\n __dict__['_mock_call_args']=None\n __dict__['_mock_call_count']=0\n __dict__['_mock_call_args_list']=_CallList()\n __dict__['_mock_mock_calls']=_CallList()\n \n __dict__['method_calls']=_CallList()\n __dict__['_mock_unsafe']=unsafe\n \n if kwargs:\n self.configure_mock(**kwargs)\n \n _safe_super(NonCallableMock,self).__init__(\n spec,wraps,name,spec_set,parent,\n _spec_state\n )\n \n \n def attach_mock(self,mock,attribute):\n ''\n\n\n \n inner_mock=_extract_mock(mock)\n \n inner_mock._mock_parent=None\n inner_mock._mock_new_parent=None\n inner_mock._mock_name=''\n inner_mock._mock_new_name=None\n \n setattr(self,attribute,mock)\n \n \n def mock_add_spec(self,spec,spec_set=False ):\n ''\n\n\n\n \n self._mock_add_spec(spec,spec_set)\n \n \n def _mock_add_spec(self,spec,spec_set,_spec_as_instance=False ,\n _eat_self=False ):\n if _is_instance_mock(spec):\n raise InvalidSpecError(f'Cannot spec a Mock object. [object={spec!r}]')\n \n _spec_class=None\n _spec_signature=None\n _spec_asyncs=[]\n \n for attr in dir(spec):\n if iscoroutinefunction(getattr(spec,attr,None )):\n _spec_asyncs.append(attr)\n \n if spec is not None and not _is_list(spec):\n if isinstance(spec,type):\n _spec_class=spec\n else :\n _spec_class=type(spec)\n res=_get_signature_object(spec,\n _spec_as_instance,_eat_self)\n _spec_signature=res and res[1]\n \n spec=dir(spec)\n \n __dict__=self.__dict__\n __dict__['_spec_class']=_spec_class\n __dict__['_spec_set']=spec_set\n __dict__['_spec_signature']=_spec_signature\n __dict__['_mock_methods']=spec\n __dict__['_spec_asyncs']=_spec_asyncs\n \n def __get_return_value(self):\n ret=self._mock_return_value\n if self._mock_delegate is not None :\n ret=self._mock_delegate.return_value\n \n if ret is DEFAULT:\n ret=self._get_child_mock(\n _new_parent=self,_new_name='()'\n )\n self.return_value=ret\n return ret\n \n \n def __set_return_value(self,value):\n if self._mock_delegate is not None :\n self._mock_delegate.return_value=value\n else :\n self._mock_return_value=value\n _check_and_set_parent(self,value,None ,'()')\n \n __return_value_doc=\"The value to be returned when the mock is called.\"\n return_value=property(__get_return_value,__set_return_value,\n __return_value_doc)\n \n \n @property\n def __class__(self):\n if self._spec_class is None :\n return type(self)\n return self._spec_class\n \n called=_delegating_property('called')\n call_count=_delegating_property('call_count')\n call_args=_delegating_property('call_args')\n call_args_list=_delegating_property('call_args_list')\n mock_calls=_delegating_property('mock_calls')\n \n \n def __get_side_effect(self):\n delegated=self._mock_delegate\n if delegated is None :\n return self._mock_side_effect\n sf=delegated.side_effect\n if (sf is not None and not callable(sf)\n and not isinstance(sf,_MockIter)and not _is_exception(sf)):\n sf=_MockIter(sf)\n delegated.side_effect=sf\n return sf\n \n def __set_side_effect(self,value):\n value=_try_iter(value)\n delegated=self._mock_delegate\n if delegated is None :\n self._mock_side_effect=value\n else :\n delegated.side_effect=value\n \n side_effect=property(__get_side_effect,__set_side_effect)\n \n \n def reset_mock(self,visited=None ,*,return_value=False ,side_effect=False ):\n ''\n if visited is None :\n visited=[]\n if id(self)in visited:\n return\n visited.append(id(self))\n \n self.called=False\n self.call_args=None\n self.call_count=0\n self.mock_calls=_CallList()\n self.call_args_list=_CallList()\n self.method_calls=_CallList()\n \n if return_value:\n self._mock_return_value=DEFAULT\n if side_effect:\n self._mock_side_effect=None\n \n for child in self._mock_children.values():\n if isinstance(child,_SpecState)or child is _deleted:\n continue\n child.reset_mock(visited,return_value=return_value,side_effect=side_effect)\n \n ret=self._mock_return_value\n if _is_instance_mock(ret)and ret is not self:\n ret.reset_mock(visited)\n \n \n def configure_mock(self,/,**kwargs):\n ''\n\n\n\n\n\n\n \n for arg,val in sorted(kwargs.items(),\n \n \n \n key=lambda entry:entry[0].count('.')):\n args=arg.split('.')\n final=args.pop()\n obj=self\n for entry in args:\n obj=getattr(obj,entry)\n setattr(obj,final,val)\n \n \n def __getattr__(self,name):\n if name in {'_mock_methods','_mock_unsafe'}:\n raise AttributeError(name)\n elif self._mock_methods is not None :\n if name not in self._mock_methods or name in _all_magics:\n raise AttributeError(\"Mock object has no attribute %r\"%name)\n elif _is_magic(name):\n raise AttributeError(name)\n if not self._mock_unsafe:\n if name.startswith(('assert','assret','asert','aseert','assrt')):\n raise AttributeError(\n f\"{name!r} is not a valid assertion. Use a spec \"\n f\"for the mock if {name!r} is meant to be an attribute.\")\n \n result=self._mock_children.get(name)\n if result is _deleted:\n raise AttributeError(name)\n elif result is None :\n wraps=None\n if self._mock_wraps is not None :\n \n \n wraps=getattr(self._mock_wraps,name)\n \n result=self._get_child_mock(\n parent=self,name=name,wraps=wraps,_new_name=name,\n _new_parent=self\n )\n self._mock_children[name]=result\n \n elif isinstance(result,_SpecState):\n try :\n result=create_autospec(\n result.spec,result.spec_set,result.instance,\n result.parent,result.name\n )\n except InvalidSpecError:\n target_name=self.__dict__['_mock_name']or self\n raise InvalidSpecError(\n f'Cannot autospec attr {name!r} from target '\n f'{target_name!r} as it has already been mocked out. '\n f'[target={self!r}, attr={result.spec!r}]')\n self._mock_children[name]=result\n \n return result\n \n \n def _extract_mock_name(self):\n _name_list=[self._mock_new_name]\n _parent=self._mock_new_parent\n last=self\n \n dot='.'\n if _name_list ==['()']:\n dot=''\n \n while _parent is not None :\n last=_parent\n \n _name_list.append(_parent._mock_new_name+dot)\n dot='.'\n if _parent._mock_new_name =='()':\n dot=''\n \n _parent=_parent._mock_new_parent\n \n _name_list=list(reversed(_name_list))\n _first=last._mock_name or 'mock'\n if len(_name_list)>1:\n if _name_list[1]not in ('()','().'):\n _first +='.'\n _name_list[0]=_first\n return ''.join(_name_list)\n \n def __repr__(self):\n name=self._extract_mock_name()\n \n name_string=''\n if name not in ('mock','mock.'):\n name_string=' name=%r'%name\n \n spec_string=''\n if self._spec_class is not None :\n spec_string=' spec=%r'\n if self._spec_set:\n spec_string=' spec_set=%r'\n spec_string=spec_string %self._spec_class.__name__\n return \"<%s%s%s id='%s'>\"%(\n type(self).__name__,\n name_string,\n spec_string,\n id(self)\n )\n \n \n def __dir__(self):\n ''\n if not FILTER_DIR:\n return object.__dir__(self)\n \n extras=self._mock_methods or []\n from_type=dir(type(self))\n from_dict=list(self.__dict__)\n from_child_mocks=[\n m_name for m_name,m_value in self._mock_children.items()\n if m_value is not _deleted]\n \n from_type=[e for e in from_type if not e.startswith('_')]\n from_dict=[e for e in from_dict if not e.startswith('_')or\n _is_magic(e)]\n return sorted(set(extras+from_type+from_dict+from_child_mocks))\n \n \n def __setattr__(self,name,value):\n if name in _allowed_names:\n \n return object.__setattr__(self,name,value)\n elif (self._spec_set and self._mock_methods is not None and\n name not in self._mock_methods and\n name not in self.__dict__):\n raise AttributeError(\"Mock object has no attribute '%s'\"%name)\n elif name in _unsupported_magics:\n msg='Attempting to set unsupported magic method %r.'%name\n raise AttributeError(msg)\n elif name in _all_magics:\n if self._mock_methods is not None and name not in self._mock_methods:\n raise AttributeError(\"Mock object has no attribute '%s'\"%name)\n \n if not _is_instance_mock(value):\n setattr(type(self),name,_get_method(name,value))\n original=value\n value=lambda *args,**kw:original(self,*args,**kw)\n else :\n \n \n _check_and_set_parent(self,value,None ,name)\n setattr(type(self),name,value)\n self._mock_children[name]=value\n elif name =='__class__':\n self._spec_class=value\n return\n else :\n if _check_and_set_parent(self,value,name,name):\n self._mock_children[name]=value\n \n if self._mock_sealed and not hasattr(self,name):\n mock_name=f'{self._extract_mock_name()}.{name}'\n raise AttributeError(f'Cannot set {mock_name}')\n \n return object.__setattr__(self,name,value)\n \n \n def __delattr__(self,name):\n if name in _all_magics and name in type(self).__dict__:\n delattr(type(self),name)\n if name not in self.__dict__:\n \n \n return\n \n obj=self._mock_children.get(name,_missing)\n if name in self.__dict__:\n _safe_super(NonCallableMock,self).__delattr__(name)\n elif obj is _deleted:\n raise AttributeError(name)\n if obj is not _missing:\n del self._mock_children[name]\n self._mock_children[name]=_deleted\n \n \n def _format_mock_call_signature(self,args,kwargs):\n name=self._mock_name or 'mock'\n return _format_call_signature(name,args,kwargs)\n \n \n def _format_mock_failure_message(self,args,kwargs,action='call'):\n message='expected %s not found.\\nExpected: %s\\nActual: %s'\n expected_string=self._format_mock_call_signature(args,kwargs)\n call_args=self.call_args\n actual_string=self._format_mock_call_signature(*call_args)\n return message %(action,expected_string,actual_string)\n \n \n def _get_call_signature_from_name(self,name):\n ''\n\n\n\n\n\n\n\n\n \n if not name:\n return self._spec_signature\n \n sig=None\n names=name.replace('()','').split('.')\n children=self._mock_children\n \n for name in names:\n child=children.get(name)\n if child is None or isinstance(child,_SpecState):\n break\n else :\n \n \n \n child=_extract_mock(child)\n children=child._mock_children\n sig=child._spec_signature\n \n return sig\n \n \n def _call_matcher(self,_call):\n ''\n\n\n\n\n \n \n if isinstance(_call,tuple)and len(_call)>2:\n sig=self._get_call_signature_from_name(_call[0])\n else :\n sig=self._spec_signature\n \n if sig is not None :\n if len(_call)==2:\n name=''\n args,kwargs=_call\n else :\n name,args,kwargs=_call\n try :\n bound_call=sig.bind(*args,**kwargs)\n return call(name,bound_call.args,bound_call.kwargs)\n except TypeError as e:\n return e.with_traceback(None )\n else :\n return _call\n \n def assert_not_called(self):\n ''\n \n if self.call_count !=0:\n msg=(\"Expected '%s' to not have been called. Called %s times.%s\"\n %(self._mock_name or 'mock',\n self.call_count,\n self._calls_repr()))\n raise AssertionError(msg)\n \n def assert_called(self):\n ''\n \n if self.call_count ==0:\n msg=(\"Expected '%s' to have been called.\"%\n (self._mock_name or 'mock'))\n raise AssertionError(msg)\n \n def assert_called_once(self):\n ''\n \n if not self.call_count ==1:\n msg=(\"Expected '%s' to have been called once. Called %s times.%s\"\n %(self._mock_name or 'mock',\n self.call_count,\n self._calls_repr()))\n raise AssertionError(msg)\n \n def assert_called_with(self,/,*args,**kwargs):\n ''\n\n\n \n if self.call_args is None :\n expected=self._format_mock_call_signature(args,kwargs)\n actual='not called.'\n error_message=('expected call not found.\\nExpected: %s\\nActual: %s'\n %(expected,actual))\n raise AssertionError(error_message)\n \n def _error_message():\n msg=self._format_mock_failure_message(args,kwargs)\n return msg\n expected=self._call_matcher(_Call((args,kwargs),two=True ))\n actual=self._call_matcher(self.call_args)\n if actual !=expected:\n cause=expected if isinstance(expected,Exception)else None\n raise AssertionError(_error_message())from cause\n \n \n def assert_called_once_with(self,/,*args,**kwargs):\n ''\n \n if not self.call_count ==1:\n msg=(\"Expected '%s' to be called once. Called %s times.%s\"\n %(self._mock_name or 'mock',\n self.call_count,\n self._calls_repr()))\n raise AssertionError(msg)\n return self.assert_called_with(*args,**kwargs)\n \n \n def assert_has_calls(self,calls,any_order=False ):\n ''\n\n\n\n\n\n\n\n \n expected=[self._call_matcher(c)for c in calls]\n cause=next((e for e in expected if isinstance(e,Exception)),None )\n all_calls=_CallList(self._call_matcher(c)for c in self.mock_calls)\n if not any_order:\n if expected not in all_calls:\n if cause is None :\n problem='Calls not found.'\n else :\n problem=('Error processing expected calls.\\n'\n 'Errors: {}').format(\n [e if isinstance(e,Exception)else None\n for e in expected])\n raise AssertionError(\n f'{problem}\\n'\n f'Expected: {_CallList(calls)}'\n f'{self._calls_repr(prefix=\"Actual\").rstrip(\".\")}'\n )from cause\n return\n \n all_calls=list(all_calls)\n \n not_found=[]\n for kall in expected:\n try :\n all_calls.remove(kall)\n except ValueError:\n not_found.append(kall)\n if not_found:\n raise AssertionError(\n '%r does not contain all of %r in its call list, '\n 'found %r instead'%(self._mock_name or 'mock',\n tuple(not_found),all_calls)\n )from cause\n \n \n def assert_any_call(self,/,*args,**kwargs):\n ''\n\n\n\n \n expected=self._call_matcher(_Call((args,kwargs),two=True ))\n cause=expected if isinstance(expected,Exception)else None\n actual=[self._call_matcher(c)for c in self.call_args_list]\n if cause or expected not in _AnyComparer(actual):\n expected_string=self._format_mock_call_signature(args,kwargs)\n raise AssertionError(\n '%s call not found'%expected_string\n )from cause\n \n \n def _get_child_mock(self,/,**kw):\n ''\n\n\n\n\n\n \n _new_name=kw.get(\"_new_name\")\n if _new_name in self.__dict__['_spec_asyncs']:\n return AsyncMock(**kw)\n \n if self._mock_sealed:\n attribute=f\".{kw['name']}\"if \"name\"in kw else \"()\"\n mock_name=self._extract_mock_name()+attribute\n raise AttributeError(mock_name)\n \n _type=type(self)\n if issubclass(_type,MagicMock)and _new_name in _async_method_magics:\n \n klass=AsyncMock\n elif issubclass(_type,AsyncMockMixin):\n if (_new_name in _all_sync_magics or\n self._mock_methods and _new_name in self._mock_methods):\n \n klass=MagicMock\n else :\n klass=AsyncMock\n elif not issubclass(_type,CallableMixin):\n if issubclass(_type,NonCallableMagicMock):\n klass=MagicMock\n elif issubclass(_type,NonCallableMock):\n klass=Mock\n else :\n klass=_type.__mro__[1]\n return klass(**kw)\n \n \n def _calls_repr(self,prefix=\"Calls\"):\n ''\n\n\n\n\n\n \n if not self.mock_calls:\n return \"\"\n return f\"\\n{prefix}: {safe_repr(self.mock_calls)}.\"\n \n \n_MOCK_SIG=inspect.signature(NonCallableMock.__init__)\n\n\nclass _AnyComparer(list):\n ''\n\n\n \n def __contains__(self,item):\n for _call in self:\n assert len(item)==len(_call)\n if all([\n expected ==actual\n for expected,actual in zip(item,_call)\n ]):\n return True\n return False\n \n \ndef _try_iter(obj):\n if obj is None :\n return obj\n if _is_exception(obj):\n return obj\n if _callable(obj):\n return obj\n try :\n return iter(obj)\n except TypeError:\n \n \n return obj\n \n \nclass CallableMixin(Base):\n\n def __init__(self,spec=None ,side_effect=None ,return_value=DEFAULT,\n wraps=None ,name=None ,spec_set=None ,parent=None ,\n _spec_state=None ,_new_name='',_new_parent=None ,**kwargs):\n self.__dict__['_mock_return_value']=return_value\n _safe_super(CallableMixin,self).__init__(\n spec,wraps,name,spec_set,parent,\n _spec_state,_new_name,_new_parent,**kwargs\n )\n \n self.side_effect=side_effect\n \n \n def _mock_check_sig(self,/,*args,**kwargs):\n \n pass\n \n \n def __call__(self,/,*args,**kwargs):\n \n \n self._mock_check_sig(*args,**kwargs)\n self._increment_mock_call(*args,**kwargs)\n return self._mock_call(*args,**kwargs)\n \n \n def _mock_call(self,/,*args,**kwargs):\n return self._execute_mock_call(*args,**kwargs)\n \n def _increment_mock_call(self,/,*args,**kwargs):\n self.called=True\n self.call_count +=1\n \n \n \n \n _call=_Call((args,kwargs),two=True )\n self.call_args=_call\n self.call_args_list.append(_call)\n \n \n do_method_calls=self._mock_parent is not None\n method_call_name=self._mock_name\n \n \n mock_call_name=self._mock_new_name\n is_a_call=mock_call_name =='()'\n self.mock_calls.append(_Call(('',args,kwargs)))\n \n \n _new_parent=self._mock_new_parent\n while _new_parent is not None :\n \n \n if do_method_calls:\n _new_parent.method_calls.append(_Call((method_call_name,args,kwargs)))\n do_method_calls=_new_parent._mock_parent is not None\n if do_method_calls:\n method_call_name=_new_parent._mock_name+'.'+method_call_name\n \n \n this_mock_call=_Call((mock_call_name,args,kwargs))\n _new_parent.mock_calls.append(this_mock_call)\n \n if _new_parent._mock_new_name:\n if is_a_call:\n dot=''\n else :\n dot='.'\n is_a_call=_new_parent._mock_new_name =='()'\n mock_call_name=_new_parent._mock_new_name+dot+mock_call_name\n \n \n _new_parent=_new_parent._mock_new_parent\n \n def _execute_mock_call(self,/,*args,**kwargs):\n \n \n \n effect=self.side_effect\n if effect is not None :\n if _is_exception(effect):\n raise effect\n elif not _callable(effect):\n result=next(effect)\n if _is_exception(result):\n raise result\n else :\n result=effect(*args,**kwargs)\n \n if result is not DEFAULT:\n return result\n \n if self._mock_return_value is not DEFAULT:\n return self.return_value\n \n if self._mock_wraps is not None :\n return self._mock_wraps(*args,**kwargs)\n \n return self.return_value\n \n \n \nclass Mock(CallableMixin,NonCallableMock):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \ndef _check_spec_arg_typos(kwargs_to_check):\n typos=(\"autospect\",\"auto_spec\",\"set_spec\")\n for typo in typos:\n if typo in kwargs_to_check:\n raise RuntimeError(\n f\"{typo!r} might be a typo; use unsafe=True if this is intended\"\n )\n \n \nclass _patch(object):\n\n attribute_name=None\n _active_patches=[]\n \n def __init__(\n self,getter,attribute,new,spec,create,\n spec_set,autospec,new_callable,kwargs,*,unsafe=False\n ):\n if new_callable is not None :\n if new is not DEFAULT:\n raise ValueError(\n \"Cannot use 'new' and 'new_callable' together\"\n )\n if autospec is not None :\n raise ValueError(\n \"Cannot use 'autospec' and 'new_callable' together\"\n )\n if not unsafe:\n _check_spec_arg_typos(kwargs)\n if _is_instance_mock(spec):\n raise InvalidSpecError(\n f'Cannot spec attr {attribute!r} as the spec '\n f'has already been mocked out. [spec={spec!r}]')\n if _is_instance_mock(spec_set):\n raise InvalidSpecError(\n f'Cannot spec attr {attribute!r} as the spec_set '\n f'target has already been mocked out. [spec_set={spec_set!r}]')\n \n self.getter=getter\n self.attribute=attribute\n self.new=new\n self.new_callable=new_callable\n self.spec=spec\n self.create=create\n self.has_local=False\n self.spec_set=spec_set\n self.autospec=autospec\n self.kwargs=kwargs\n self.additional_patchers=[]\n \n \n def copy(self):\n patcher=_patch(\n self.getter,self.attribute,self.new,self.spec,\n self.create,self.spec_set,\n self.autospec,self.new_callable,self.kwargs\n )\n patcher.attribute_name=self.attribute_name\n patcher.additional_patchers=[\n p.copy()for p in self.additional_patchers\n ]\n return patcher\n \n \n def __call__(self,func):\n if isinstance(func,type):\n return self.decorate_class(func)\n if inspect.iscoroutinefunction(func):\n return self.decorate_async_callable(func)\n return self.decorate_callable(func)\n \n \n def decorate_class(self,klass):\n for attr in dir(klass):\n if not attr.startswith(patch.TEST_PREFIX):\n continue\n \n attr_value=getattr(klass,attr)\n if not hasattr(attr_value,\"__call__\"):\n continue\n \n patcher=self.copy()\n setattr(klass,attr,patcher(attr_value))\n return klass\n \n \n @contextlib.contextmanager\n def decoration_helper(self,patched,args,keywargs):\n extra_args=[]\n with contextlib.ExitStack()as exit_stack:\n for patching in patched.patchings:\n arg=exit_stack.enter_context(patching)\n if patching.attribute_name is not None :\n keywargs.update(arg)\n elif patching.new is DEFAULT:\n extra_args.append(arg)\n \n args +=tuple(extra_args)\n yield (args,keywargs)\n \n \n def decorate_callable(self,func):\n \n if hasattr(func,'patchings'):\n func.patchings.append(self)\n return func\n \n @wraps(func)\n def patched(*args,**keywargs):\n with self.decoration_helper(patched,\n args,\n keywargs)as (newargs,newkeywargs):\n return func(*newargs,**newkeywargs)\n \n patched.patchings=[self]\n return patched\n \n \n def decorate_async_callable(self,func):\n \n if hasattr(func,'patchings'):\n func.patchings.append(self)\n return func\n \n @wraps(func)\n async def patched(*args,**keywargs):\n with self.decoration_helper(patched,\n args,\n keywargs)as (newargs,newkeywargs):\n return await func(*newargs,**newkeywargs)\n \n patched.patchings=[self]\n return patched\n \n \n def get_original(self):\n target=self.getter()\n name=self.attribute\n \n original=DEFAULT\n local=False\n \n try :\n original=target.__dict__[name]\n except (AttributeError,KeyError):\n original=getattr(target,name,DEFAULT)\n else :\n local=True\n \n if name in _builtins and isinstance(target,ModuleType):\n self.create=True\n \n if not self.create and original is DEFAULT:\n raise AttributeError(\n \"%s does not have the attribute %r\"%(target,name)\n )\n return original,local\n \n \n def __enter__(self):\n ''\n new,spec,spec_set=self.new,self.spec,self.spec_set\n autospec,kwargs=self.autospec,self.kwargs\n new_callable=self.new_callable\n self.target=self.getter()\n \n \n if spec is False :\n spec=None\n if spec_set is False :\n spec_set=None\n if autospec is False :\n autospec=None\n \n if spec is not None and autospec is not None :\n raise TypeError(\"Can't specify spec and autospec\")\n if ((spec is not None or autospec is not None )and\n spec_set not in (True ,None )):\n raise TypeError(\"Can't provide explicit spec_set *and* spec or autospec\")\n \n original,local=self.get_original()\n \n if new is DEFAULT and autospec is None :\n inherit=False\n if spec is True :\n \n spec=original\n if spec_set is True :\n spec_set=original\n spec=None\n elif spec is not None :\n if spec_set is True :\n spec_set=spec\n spec=None\n elif spec_set is True :\n spec_set=original\n \n if spec is not None or spec_set is not None :\n if original is DEFAULT:\n raise TypeError(\"Can't use 'spec' with create=True\")\n if isinstance(original,type):\n \n inherit=True\n if spec is None and _is_async_obj(original):\n Klass=AsyncMock\n else :\n Klass=MagicMock\n _kwargs={}\n if new_callable is not None :\n Klass=new_callable\n elif spec is not None or spec_set is not None :\n this_spec=spec\n if spec_set is not None :\n this_spec=spec_set\n if _is_list(this_spec):\n not_callable='__call__'not in this_spec\n else :\n not_callable=not callable(this_spec)\n if _is_async_obj(this_spec):\n Klass=AsyncMock\n elif not_callable:\n Klass=NonCallableMagicMock\n \n if spec is not None :\n _kwargs['spec']=spec\n if spec_set is not None :\n _kwargs['spec_set']=spec_set\n \n \n if (isinstance(Klass,type)and\n issubclass(Klass,NonCallableMock)and self.attribute):\n _kwargs['name']=self.attribute\n \n _kwargs.update(kwargs)\n new=Klass(**_kwargs)\n \n if inherit and _is_instance_mock(new):\n \n \n this_spec=spec\n if spec_set is not None :\n this_spec=spec_set\n if (not _is_list(this_spec)and not\n _instance_callable(this_spec)):\n Klass=NonCallableMagicMock\n \n _kwargs.pop('name')\n new.return_value=Klass(_new_parent=new,_new_name='()',\n **_kwargs)\n elif autospec is not None :\n \n \n \n if new is not DEFAULT:\n raise TypeError(\n \"autospec creates the mock for you. Can't specify \"\n \"autospec and new.\"\n )\n if original is DEFAULT:\n raise TypeError(\"Can't use 'autospec' with create=True\")\n spec_set=bool(spec_set)\n if autospec is True :\n autospec=original\n \n if _is_instance_mock(self.target):\n raise InvalidSpecError(\n f'Cannot autospec attr {self.attribute!r} as the patch '\n f'target has already been mocked out. '\n f'[target={self.target!r}, attr={autospec!r}]')\n if _is_instance_mock(autospec):\n target_name=getattr(self.target,'__name__',self.target)\n raise InvalidSpecError(\n f'Cannot autospec attr {self.attribute!r} from target '\n f'{target_name!r} as it has already been mocked out. '\n f'[target={self.target!r}, attr={autospec!r}]')\n \n new=create_autospec(autospec,spec_set=spec_set,\n _name=self.attribute,**kwargs)\n elif kwargs:\n \n \n raise TypeError(\"Can't pass kwargs to a mock we aren't creating\")\n \n new_attr=new\n \n self.temp_original=original\n self.is_local=local\n self._exit_stack=contextlib.ExitStack()\n try :\n setattr(self.target,self.attribute,new_attr)\n if self.attribute_name is not None :\n extra_args={}\n if self.new is DEFAULT:\n extra_args[self.attribute_name]=new\n for patching in self.additional_patchers:\n arg=self._exit_stack.enter_context(patching)\n if patching.new is DEFAULT:\n extra_args.update(arg)\n return extra_args\n \n return new\n except :\n if not self.__exit__(*sys.exc_info()):\n raise\n \n def __exit__(self,*exc_info):\n ''\n if self.is_local and self.temp_original is not DEFAULT:\n setattr(self.target,self.attribute,self.temp_original)\n else :\n delattr(self.target,self.attribute)\n if not self.create and (not hasattr(self.target,self.attribute)or\n self.attribute in ('__doc__','__module__',\n '__defaults__','__annotations__',\n '__kwdefaults__')):\n \n setattr(self.target,self.attribute,self.temp_original)\n \n del self.temp_original\n del self.is_local\n del self.target\n exit_stack=self._exit_stack\n del self._exit_stack\n return exit_stack.__exit__(*exc_info)\n \n \n def start(self):\n ''\n result=self.__enter__()\n self._active_patches.append(self)\n return result\n \n \n def stop(self):\n ''\n try :\n self._active_patches.remove(self)\n except ValueError:\n \n return None\n \n return self.__exit__(None ,None ,None )\n \n \n \ndef _get_target(target):\n try :\n target,attribute=target.rsplit('.',1)\n except (TypeError,ValueError,AttributeError):\n raise TypeError(\n f\"Need a valid target to patch. You supplied: {target!r}\")\n return partial(pkgutil.resolve_name,target),attribute\n \n \ndef _patch_object(\ntarget,attribute,new=DEFAULT,spec=None ,\ncreate=False ,spec_set=None ,autospec=None ,\nnew_callable=None ,*,unsafe=False ,**kwargs\n):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if type(target)is str:\n raise TypeError(\n f\"{target!r} must be the actual object to be patched, not a str\"\n )\n getter=lambda :target\n return _patch(\n getter,attribute,new,spec,create,\n spec_set,autospec,new_callable,kwargs,unsafe=unsafe\n )\n \n \ndef _patch_multiple(target,spec=None ,create=False ,spec_set=None ,\nautospec=None ,new_callable=None ,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if type(target)is str:\n getter=partial(pkgutil.resolve_name,target)\n else :\n getter=lambda :target\n \n if not kwargs:\n raise ValueError(\n 'Must supply at least one keyword argument with patch.multiple'\n )\n \n items=list(kwargs.items())\n attribute,new=items[0]\n patcher=_patch(\n getter,attribute,new,spec,create,spec_set,\n autospec,new_callable,{}\n )\n patcher.attribute_name=attribute\n for attribute,new in items[1:]:\n this_patcher=_patch(\n getter,attribute,new,spec,create,spec_set,\n autospec,new_callable,{}\n )\n this_patcher.attribute_name=attribute\n patcher.additional_patchers.append(this_patcher)\n return patcher\n \n \ndef patch(\ntarget,new=DEFAULT,spec=None ,create=False ,\nspec_set=None ,autospec=None ,new_callable=None ,*,unsafe=False ,**kwargs\n):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n getter,attribute=_get_target(target)\n return _patch(\n getter,attribute,new,spec,create,\n spec_set,autospec,new_callable,kwargs,unsafe=unsafe\n )\n \n \nclass _patch_dict(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,in_dict,values=(),clear=False ,**kwargs):\n self.in_dict=in_dict\n \n self.values=dict(values)\n self.values.update(kwargs)\n self.clear=clear\n self._original=None\n \n \n def __call__(self,f):\n if isinstance(f,type):\n return self.decorate_class(f)\n @wraps(f)\n def _inner(*args,**kw):\n self._patch_dict()\n try :\n return f(*args,**kw)\n finally :\n self._unpatch_dict()\n \n return _inner\n \n \n def decorate_class(self,klass):\n for attr in dir(klass):\n attr_value=getattr(klass,attr)\n if (attr.startswith(patch.TEST_PREFIX)and\n hasattr(attr_value,\"__call__\")):\n decorator=_patch_dict(self.in_dict,self.values,self.clear)\n decorated=decorator(attr_value)\n setattr(klass,attr,decorated)\n return klass\n \n \n def __enter__(self):\n ''\n self._patch_dict()\n return self.in_dict\n \n \n def _patch_dict(self):\n values=self.values\n if isinstance(self.in_dict,str):\n self.in_dict=pkgutil.resolve_name(self.in_dict)\n in_dict=self.in_dict\n clear=self.clear\n \n try :\n original=in_dict.copy()\n except AttributeError:\n \n \n original={}\n for key in in_dict:\n original[key]=in_dict[key]\n self._original=original\n \n if clear:\n _clear_dict(in_dict)\n \n try :\n in_dict.update(values)\n except AttributeError:\n \n for key in values:\n in_dict[key]=values[key]\n \n \n def _unpatch_dict(self):\n in_dict=self.in_dict\n original=self._original\n \n _clear_dict(in_dict)\n \n try :\n in_dict.update(original)\n except AttributeError:\n for key in original:\n in_dict[key]=original[key]\n \n \n def __exit__(self,*args):\n ''\n if self._original is not None :\n self._unpatch_dict()\n return False\n \n \n def start(self):\n ''\n result=self.__enter__()\n _patch._active_patches.append(self)\n return result\n \n \n def stop(self):\n ''\n try :\n _patch._active_patches.remove(self)\n except ValueError:\n \n return None\n \n return self.__exit__(None ,None ,None )\n \n \ndef _clear_dict(in_dict):\n try :\n in_dict.clear()\n except AttributeError:\n keys=list(in_dict)\n for key in keys:\n del in_dict[key]\n \n \ndef _patch_stopall():\n ''\n for patch in reversed(_patch._active_patches):\n patch.stop()\n \n \npatch.object=_patch_object\npatch.dict=_patch_dict\npatch.multiple=_patch_multiple\npatch.stopall=_patch_stopall\npatch.TEST_PREFIX='test'\n\nmagic_methods=(\n\"lt le gt ge eq ne \"\n\"getitem setitem delitem \"\n\"len contains iter \"\n\"hash str sizeof \"\n\"enter exit \"\n\n\n\"divmod rdivmod neg pos abs invert \"\n\"complex int float index \"\n\"round trunc floor ceil \"\n\"bool next \"\n\"fspath \"\n\"aiter \"\n)\n\nnumerics=(\n\"add sub mul matmul truediv floordiv mod lshift rshift and xor or pow\"\n)\ninplace=' '.join('i%s'%n for n in numerics.split())\nright=' '.join('r%s'%n for n in numerics.split())\n\n\n\n\n\n_non_defaults={\n'__get__','__set__','__delete__','__reversed__','__missing__',\n'__reduce__','__reduce_ex__','__getinitargs__','__getnewargs__',\n'__getstate__','__setstate__','__getformat__',\n'__repr__','__dir__','__subclasses__','__format__',\n'__getnewargs_ex__',\n}\n\n\ndef _get_method(name,func):\n ''\n def method(self,/,*args,**kw):\n return func(self,*args,**kw)\n method.__name__=name\n return method\n \n \n_magics={\n'__%s__'%method for method in\n' '.join([magic_methods,numerics,inplace,right]).split()\n}\n\n\n_async_method_magics={\"__aenter__\",\"__aexit__\",\"__anext__\"}\n\n_sync_async_magics={\"__aiter__\"}\n_async_magics=_async_method_magics |_sync_async_magics\n\n_all_sync_magics=_magics |_non_defaults\n_all_magics=_all_sync_magics |_async_magics\n\n_unsupported_magics={\n'__getattr__','__setattr__',\n'__init__','__new__','__prepare__',\n'__instancecheck__','__subclasscheck__',\n'__del__'\n}\n\n_calculate_return_value={\n'__hash__':lambda self:object.__hash__(self),\n'__str__':lambda self:object.__str__(self),\n'__sizeof__':lambda self:object.__sizeof__(self),\n'__fspath__':lambda self:f\"{type(self).__name__}/{self._extract_mock_name()}/{id(self)}\",\n}\n\n_return_values={\n'__lt__':NotImplemented,\n'__gt__':NotImplemented,\n'__le__':NotImplemented,\n'__ge__':NotImplemented,\n'__int__':1,\n'__contains__':False ,\n'__len__':0,\n'__exit__':False ,\n'__complex__':1j,\n'__float__':1.0,\n'__bool__':True ,\n'__index__':1,\n'__aexit__':False ,\n}\n\n\ndef _get_eq(self):\n def __eq__(other):\n ret_val=self.__eq__._mock_return_value\n if ret_val is not DEFAULT:\n return ret_val\n if self is other:\n return True\n return NotImplemented\n return __eq__\n \ndef _get_ne(self):\n def __ne__(other):\n if self.__ne__._mock_return_value is not DEFAULT:\n return DEFAULT\n if self is other:\n return False\n return NotImplemented\n return __ne__\n \ndef _get_iter(self):\n def __iter__():\n ret_val=self.__iter__._mock_return_value\n if ret_val is DEFAULT:\n return iter([])\n \n \n return iter(ret_val)\n return __iter__\n \ndef _get_async_iter(self):\n def __aiter__():\n ret_val=self.__aiter__._mock_return_value\n if ret_val is DEFAULT:\n return _AsyncIterator(iter([]))\n return _AsyncIterator(iter(ret_val))\n return __aiter__\n \n_side_effect_methods={\n'__eq__':_get_eq,\n'__ne__':_get_ne,\n'__iter__':_get_iter,\n'__aiter__':_get_async_iter\n}\n\n\n\ndef _set_return_value(mock,method,name):\n fixed=_return_values.get(name,DEFAULT)\n if fixed is not DEFAULT:\n method.return_value=fixed\n return\n \n return_calculator=_calculate_return_value.get(name)\n if return_calculator is not None :\n return_value=return_calculator(mock)\n method.return_value=return_value\n return\n \n side_effector=_side_effect_methods.get(name)\n if side_effector is not None :\n method.side_effect=side_effector(mock)\n \n \n \nclass MagicMixin(Base):\n def __init__(self,/,*args,**kw):\n self._mock_set_magics()\n _safe_super(MagicMixin,self).__init__(*args,**kw)\n self._mock_set_magics()\n \n \n def _mock_set_magics(self):\n orig_magics=_magics |_async_method_magics\n these_magics=orig_magics\n \n if getattr(self,\"_mock_methods\",None )is not None :\n these_magics=orig_magics.intersection(self._mock_methods)\n \n remove_magics=set()\n remove_magics=orig_magics -these_magics\n \n for entry in remove_magics:\n if entry in type(self).__dict__:\n \n delattr(self,entry)\n \n \n these_magics=these_magics -set(type(self).__dict__)\n \n _type=type(self)\n for entry in these_magics:\n setattr(_type,entry,MagicProxy(entry,self))\n \n \n \nclass NonCallableMagicMock(MagicMixin,NonCallableMock):\n ''\n def mock_add_spec(self,spec,spec_set=False ):\n ''\n\n\n\n \n self._mock_add_spec(spec,spec_set)\n self._mock_set_magics()\n \n \nclass AsyncMagicMixin(MagicMixin):\n def __init__(self,/,*args,**kw):\n self._mock_set_magics()\n _safe_super(AsyncMagicMixin,self).__init__(*args,**kw)\n self._mock_set_magics()\n \nclass MagicMock(MagicMixin,Mock):\n ''\n\n\n\n\n\n\n\n\n \n def mock_add_spec(self,spec,spec_set=False ):\n ''\n\n\n\n \n self._mock_add_spec(spec,spec_set)\n self._mock_set_magics()\n \n \n \nclass MagicProxy(Base):\n def __init__(self,name,parent):\n self.name=name\n self.parent=parent\n \n def create_mock(self):\n entry=self.name\n parent=self.parent\n m=parent._get_child_mock(name=entry,_new_name=entry,\n _new_parent=parent)\n setattr(parent,entry,m)\n _set_return_value(parent,m,entry)\n return m\n \n def __get__(self,obj,_type=None ):\n return self.create_mock()\n \n \nclass AsyncMockMixin(Base):\n await_count=_delegating_property('await_count')\n await_args=_delegating_property('await_args')\n await_args_list=_delegating_property('await_args_list')\n \n def __init__(self,/,*args,**kwargs):\n super().__init__(*args,**kwargs)\n \n \n \n \n \n \n self.__dict__['_is_coroutine']=asyncio.coroutines._is_coroutine\n self.__dict__['_mock_await_count']=0\n self.__dict__['_mock_await_args']=None\n self.__dict__['_mock_await_args_list']=_CallList()\n code_mock=NonCallableMock(spec_set=CodeType)\n code_mock.co_flags=inspect.CO_COROUTINE\n self.__dict__['__code__']=code_mock\n self.__dict__['__name__']='AsyncMock'\n self.__dict__['__defaults__']=tuple()\n self.__dict__['__kwdefaults__']={}\n self.__dict__['__annotations__']=None\n \n async def _execute_mock_call(self,/,*args,**kwargs):\n \n \n \n _call=_Call((args,kwargs),two=True )\n self.await_count +=1\n self.await_args=_call\n self.await_args_list.append(_call)\n \n effect=self.side_effect\n if effect is not None :\n if _is_exception(effect):\n raise effect\n elif not _callable(effect):\n try :\n result=next(effect)\n except StopIteration:\n \n \n raise StopAsyncIteration\n if _is_exception(result):\n raise result\n elif iscoroutinefunction(effect):\n result=await effect(*args,**kwargs)\n else :\n result=effect(*args,**kwargs)\n \n if result is not DEFAULT:\n return result\n \n if self._mock_return_value is not DEFAULT:\n return self.return_value\n \n if self._mock_wraps is not None :\n if iscoroutinefunction(self._mock_wraps):\n return await self._mock_wraps(*args,**kwargs)\n return self._mock_wraps(*args,**kwargs)\n \n return self.return_value\n \n def assert_awaited(self):\n ''\n\n \n if self.await_count ==0:\n msg=f\"Expected {self._mock_name or 'mock'} to have been awaited.\"\n raise AssertionError(msg)\n \n def assert_awaited_once(self):\n ''\n\n \n if not self.await_count ==1:\n msg=(f\"Expected {self._mock_name or 'mock'} to have been awaited once.\"\n f\" Awaited {self.await_count} times.\")\n raise AssertionError(msg)\n \n def assert_awaited_with(self,/,*args,**kwargs):\n ''\n\n \n if self.await_args is None :\n expected=self._format_mock_call_signature(args,kwargs)\n raise AssertionError(f'Expected await: {expected}\\nNot awaited')\n \n def _error_message():\n msg=self._format_mock_failure_message(args,kwargs,action='await')\n return msg\n \n expected=self._call_matcher(_Call((args,kwargs),two=True ))\n actual=self._call_matcher(self.await_args)\n if actual !=expected:\n cause=expected if isinstance(expected,Exception)else None\n raise AssertionError(_error_message())from cause\n \n def assert_awaited_once_with(self,/,*args,**kwargs):\n ''\n\n\n \n if not self.await_count ==1:\n msg=(f\"Expected {self._mock_name or 'mock'} to have been awaited once.\"\n f\" Awaited {self.await_count} times.\")\n raise AssertionError(msg)\n return self.assert_awaited_with(*args,**kwargs)\n \n def assert_any_await(self,/,*args,**kwargs):\n ''\n\n \n expected=self._call_matcher(_Call((args,kwargs),two=True ))\n cause=expected if isinstance(expected,Exception)else None\n actual=[self._call_matcher(c)for c in self.await_args_list]\n if cause or expected not in _AnyComparer(actual):\n expected_string=self._format_mock_call_signature(args,kwargs)\n raise AssertionError(\n '%s await not found'%expected_string\n )from cause\n \n def assert_has_awaits(self,calls,any_order=False ):\n ''\n\n\n\n\n\n\n\n\n\n \n expected=[self._call_matcher(c)for c in calls]\n cause=next((e for e in expected if isinstance(e,Exception)),None )\n all_awaits=_CallList(self._call_matcher(c)for c in self.await_args_list)\n if not any_order:\n if expected not in all_awaits:\n if cause is None :\n problem='Awaits not found.'\n else :\n problem=('Error processing expected awaits.\\n'\n 'Errors: {}').format(\n [e if isinstance(e,Exception)else None\n for e in expected])\n raise AssertionError(\n f'{problem}\\n'\n f'Expected: {_CallList(calls)}\\n'\n f'Actual: {self.await_args_list}'\n )from cause\n return\n \n all_awaits=list(all_awaits)\n \n not_found=[]\n for kall in expected:\n try :\n all_awaits.remove(kall)\n except ValueError:\n not_found.append(kall)\n if not_found:\n raise AssertionError(\n '%r not all found in await list'%(tuple(not_found),)\n )from cause\n \n def assert_not_awaited(self):\n ''\n\n \n if self.await_count !=0:\n msg=(f\"Expected {self._mock_name or 'mock'} to not have been awaited.\"\n f\" Awaited {self.await_count} times.\")\n raise AssertionError(msg)\n \n def reset_mock(self,/,*args,**kwargs):\n ''\n\n \n super().reset_mock(*args,**kwargs)\n self.await_count=0\n self.await_args=None\n self.await_args_list=_CallList()\n \n \nclass AsyncMock(AsyncMockMixin,AsyncMagicMixin,Mock):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \nclass _ANY(object):\n ''\n \n def __eq__(self,other):\n return True\n \n def __ne__(self,other):\n return False\n \n def __repr__(self):\n return ''\n \nANY=_ANY()\n\n\n\ndef _format_call_signature(name,args,kwargs):\n message='%s(%%s)'%name\n formatted_args=''\n args_string=', '.join([repr(arg)for arg in args])\n kwargs_string=', '.join([\n '%s=%r'%(key,value)for key,value in kwargs.items()\n ])\n if args_string:\n formatted_args=args_string\n if kwargs_string:\n if formatted_args:\n formatted_args +=', '\n formatted_args +=kwargs_string\n \n return message %formatted_args\n \n \n \nclass _Call(tuple):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __new__(cls,value=(),name='',parent=None ,two=False ,\n from_kall=True ):\n args=()\n kwargs={}\n _len=len(value)\n if _len ==3:\n name,args,kwargs=value\n elif _len ==2:\n first,second=value\n if isinstance(first,str):\n name=first\n if isinstance(second,tuple):\n args=second\n else :\n kwargs=second\n else :\n args,kwargs=first,second\n elif _len ==1:\n value,=value\n if isinstance(value,str):\n name=value\n elif isinstance(value,tuple):\n args=value\n else :\n kwargs=value\n \n if two:\n return tuple.__new__(cls,(args,kwargs))\n \n return tuple.__new__(cls,(name,args,kwargs))\n \n \n def __init__(self,value=(),name=None ,parent=None ,two=False ,\n from_kall=True ):\n self._mock_name=name\n self._mock_parent=parent\n self._mock_from_kall=from_kall\n \n \n def __eq__(self,other):\n try :\n len_other=len(other)\n except TypeError:\n return NotImplemented\n \n self_name=''\n if len(self)==2:\n self_args,self_kwargs=self\n else :\n self_name,self_args,self_kwargs=self\n \n if (getattr(self,'_mock_parent',None )and getattr(other,'_mock_parent',None )\n and self._mock_parent !=other._mock_parent):\n return False\n \n other_name=''\n if len_other ==0:\n other_args,other_kwargs=(),{}\n elif len_other ==3:\n other_name,other_args,other_kwargs=other\n elif len_other ==1:\n value,=other\n if isinstance(value,tuple):\n other_args=value\n other_kwargs={}\n elif isinstance(value,str):\n other_name=value\n other_args,other_kwargs=(),{}\n else :\n other_args=()\n other_kwargs=value\n elif len_other ==2:\n \n first,second=other\n if isinstance(first,str):\n other_name=first\n if isinstance(second,tuple):\n other_args,other_kwargs=second,{}\n else :\n other_args,other_kwargs=(),second\n else :\n other_args,other_kwargs=first,second\n else :\n return False\n \n if self_name and other_name !=self_name:\n return False\n \n \n return (other_args,other_kwargs)==(self_args,self_kwargs)\n \n \n __ne__=object.__ne__\n \n \n def __call__(self,/,*args,**kwargs):\n if self._mock_name is None :\n return _Call(('',args,kwargs),name='()')\n \n name=self._mock_name+'()'\n return _Call((self._mock_name,args,kwargs),name=name,parent=self)\n \n \n def __getattr__(self,attr):\n if self._mock_name is None :\n return _Call(name=attr,from_kall=False )\n name='%s.%s'%(self._mock_name,attr)\n return _Call(name=name,parent=self,from_kall=False )\n \n \n def __getattribute__(self,attr):\n if attr in tuple.__dict__:\n raise AttributeError\n return tuple.__getattribute__(self,attr)\n \n \n def _get_call_arguments(self):\n if len(self)==2:\n args,kwargs=self\n else :\n name,args,kwargs=self\n \n return args,kwargs\n \n @property\n def args(self):\n return self._get_call_arguments()[0]\n \n @property\n def kwargs(self):\n return self._get_call_arguments()[1]\n \n def __repr__(self):\n if not self._mock_from_kall:\n name=self._mock_name or 'call'\n if name.startswith('()'):\n name='call%s'%name\n return name\n \n if len(self)==2:\n name='call'\n args,kwargs=self\n else :\n name,args,kwargs=self\n if not name:\n name='call'\n elif not name.startswith('()'):\n name='call.%s'%name\n else :\n name='call%s'%name\n return _format_call_signature(name,args,kwargs)\n \n \n def call_list(self):\n ''\n\n \n vals=[]\n thing=self\n while thing is not None :\n if thing._mock_from_kall:\n vals.append(thing)\n thing=thing._mock_parent\n return _CallList(reversed(vals))\n \n \ncall=_Call(from_kall=False )\n\n\ndef create_autospec(spec,spec_set=False ,instance=False ,_parent=None ,\n_name=None ,*,unsafe=False ,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if _is_list(spec):\n \n \n spec=type(spec)\n \n is_type=isinstance(spec,type)\n if _is_instance_mock(spec):\n raise InvalidSpecError(f'Cannot autospec a Mock object. '\n f'[object={spec!r}]')\n is_async_func=_is_async_func(spec)\n _kwargs={'spec':spec}\n if spec_set:\n _kwargs={'spec_set':spec}\n elif spec is None :\n \n _kwargs={}\n if _kwargs and instance:\n _kwargs['_spec_as_instance']=True\n if not unsafe:\n _check_spec_arg_typos(kwargs)\n \n _kwargs.update(kwargs)\n \n Klass=MagicMock\n if inspect.isdatadescriptor(spec):\n \n \n _kwargs={}\n elif is_async_func:\n if instance:\n raise RuntimeError(\"Instance can not be True when create_autospec \"\n \"is mocking an async function\")\n Klass=AsyncMock\n elif not _callable(spec):\n Klass=NonCallableMagicMock\n elif is_type and instance and not _instance_callable(spec):\n Klass=NonCallableMagicMock\n \n _name=_kwargs.pop('name',_name)\n \n _new_name=_name\n if _parent is None :\n \n _new_name=''\n \n mock=Klass(parent=_parent,_new_parent=_parent,_new_name=_new_name,\n name=_name,**_kwargs)\n \n if isinstance(spec,FunctionTypes):\n \n \n mock=_set_signature(mock,spec)\n if is_async_func:\n _setup_async_mock(mock)\n else :\n _check_signature(spec,mock,is_type,instance)\n \n if _parent is not None and not instance:\n _parent._mock_children[_name]=mock\n \n if is_type and not instance and 'return_value'not in kwargs:\n mock.return_value=create_autospec(spec,spec_set,instance=True ,\n _name='()',_parent=mock)\n \n for entry in dir(spec):\n if _is_magic(entry):\n \n continue\n \n \n \n \n \n \n \n \n \n \n try :\n original=getattr(spec,entry)\n except AttributeError:\n continue\n \n kwargs={'spec':original}\n if spec_set:\n kwargs={'spec_set':original}\n \n if not isinstance(original,FunctionTypes):\n new=_SpecState(original,spec_set,mock,entry,instance)\n mock._mock_children[entry]=new\n else :\n parent=mock\n if isinstance(spec,FunctionTypes):\n parent=mock.mock\n \n skipfirst=_must_skip(spec,entry,is_type)\n kwargs['_eat_self']=skipfirst\n if iscoroutinefunction(original):\n child_klass=AsyncMock\n else :\n child_klass=MagicMock\n new=child_klass(parent=parent,name=entry,_new_name=entry,\n _new_parent=parent,\n **kwargs)\n mock._mock_children[entry]=new\n _check_signature(original,new,skipfirst=skipfirst)\n \n \n \n \n \n if isinstance(new,FunctionTypes):\n setattr(mock,entry,new)\n \n return mock\n \n \ndef _must_skip(spec,entry,is_type):\n ''\n\n\n \n if not isinstance(spec,type):\n if entry in getattr(spec,'__dict__',{}):\n \n return False\n spec=spec.__class__\n \n for klass in spec.__mro__:\n result=klass.__dict__.get(entry,DEFAULT)\n if result is DEFAULT:\n continue\n if isinstance(result,(staticmethod,classmethod)):\n return False\n elif isinstance(result,FunctionTypes):\n \n \n return is_type\n else :\n return False\n \n \n return is_type\n \n \nclass _SpecState(object):\n\n def __init__(self,spec,spec_set=False ,parent=None ,\n name=None ,ids=None ,instance=False ):\n self.spec=spec\n self.ids=ids\n self.spec_set=spec_set\n self.parent=parent\n self.instance=instance\n self.name=name\n \n \nFunctionTypes=(\n\ntype(create_autospec),\n\ntype(ANY.__eq__),\n)\n\n\nfile_spec=None\nopen_spec=None\n\n\ndef _to_stream(read_data):\n if isinstance(read_data,bytes):\n return io.BytesIO(read_data)\n else :\n return io.StringIO(read_data)\n \n \ndef mock_open(mock=None ,read_data=''):\n ''\n\n\n\n\n\n\n\n\n\n \n _read_data=_to_stream(read_data)\n _state=[_read_data,None ]\n \n def _readlines_side_effect(*args,**kwargs):\n if handle.readlines.return_value is not None :\n return handle.readlines.return_value\n return _state[0].readlines(*args,**kwargs)\n \n def _read_side_effect(*args,**kwargs):\n if handle.read.return_value is not None :\n return handle.read.return_value\n return _state[0].read(*args,**kwargs)\n \n def _readline_side_effect(*args,**kwargs):\n yield from _iter_side_effect()\n while True :\n yield _state[0].readline(*args,**kwargs)\n \n def _iter_side_effect():\n if handle.readline.return_value is not None :\n while True :\n yield handle.readline.return_value\n for line in _state[0]:\n yield line\n \n def _next_side_effect():\n if handle.readline.return_value is not None :\n return handle.readline.return_value\n return next(_state[0])\n \n global file_spec\n if file_spec is None :\n import _io\n file_spec=list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))\n \n global open_spec\n if open_spec is None :\n import _io\n open_spec=list(set(dir(_io.open)))\n if mock is None :\n mock=MagicMock(name='open',spec=open_spec)\n \n handle=MagicMock(spec=file_spec)\n handle.__enter__.return_value=handle\n \n handle.write.return_value=None\n handle.read.return_value=None\n handle.readline.return_value=None\n handle.readlines.return_value=None\n \n handle.read.side_effect=_read_side_effect\n _state[1]=_readline_side_effect()\n handle.readline.side_effect=_state[1]\n handle.readlines.side_effect=_readlines_side_effect\n handle.__iter__.side_effect=_iter_side_effect\n handle.__next__.side_effect=_next_side_effect\n \n def reset_data(*args,**kwargs):\n _state[0]=_to_stream(read_data)\n if handle.readline.side_effect ==_state[1]:\n \n _state[1]=_readline_side_effect()\n handle.readline.side_effect=_state[1]\n return DEFAULT\n \n mock.side_effect=reset_data\n mock.return_value=handle\n return mock\n \n \nclass PropertyMock(Mock):\n ''\n\n\n\n\n\n\n \n def _get_child_mock(self,/,**kwargs):\n return MagicMock(**kwargs)\n \n def __get__(self,obj,obj_type=None ):\n return self()\n def __set__(self,obj,val):\n self(val)\n \n \ndef seal(mock):\n ''\n\n\n\n\n\n\n\n \n mock._mock_sealed=True\n for attr in dir(mock):\n try :\n m=getattr(mock,attr)\n except AttributeError:\n continue\n if not isinstance(m,NonCallableMock):\n continue\n if isinstance(m._mock_children.get(attr),_SpecState):\n continue\n if m._mock_new_parent is mock:\n seal(m)\n \n \nclass _AsyncIterator:\n ''\n\n \n def __init__(self,iterator):\n self.iterator=iterator\n code_mock=NonCallableMock(spec_set=CodeType)\n code_mock.co_flags=inspect.CO_ITERABLE_COROUTINE\n self.__dict__['__code__']=code_mock\n \n async def __anext__(self):\n try :\n return next(self.iterator)\n except StopIteration:\n pass\n raise StopAsyncIteration\n", ["_io", "asyncio", "builtins", "contextlib", "functools", "inspect", "io", "pkgutil", "pprint", "sys", "types", "unittest.util"]], "unittest.result": [".py", "''\n\nimport io\nimport sys\nimport traceback\n\nfrom . import util\nfrom functools import wraps\n\n__unittest=True\n\ndef failfast(method):\n @wraps(method)\n def inner(self,*args,**kw):\n if getattr(self,'failfast',False ):\n self.stop()\n return method(self,*args,**kw)\n return inner\n \nSTDOUT_LINE='\\nStdout:\\n%s'\nSTDERR_LINE='\\nStderr:\\n%s'\n\n\nclass TestResult(object):\n ''\n\n\n\n\n\n\n\n\n \n _previousTestClass=None\n _testRunEntered=False\n _moduleSetUpFailed=False\n def __init__(self,stream=None ,descriptions=None ,verbosity=None ):\n self.failfast=False\n self.failures=[]\n self.errors=[]\n self.testsRun=0\n self.skipped=[]\n self.expectedFailures=[]\n self.unexpectedSuccesses=[]\n self.shouldStop=False\n self.buffer=False\n self.tb_locals=False\n self._stdout_buffer=None\n self._stderr_buffer=None\n self._original_stdout=sys.stdout\n self._original_stderr=sys.stderr\n self._mirrorOutput=False\n \n def printErrors(self):\n ''\n \n def startTest(self,test):\n ''\n self.testsRun +=1\n self._mirrorOutput=False\n self._setupStdout()\n \n def _setupStdout(self):\n if self.buffer:\n if self._stderr_buffer is None :\n self._stderr_buffer=io.StringIO()\n self._stdout_buffer=io.StringIO()\n sys.stdout=self._stdout_buffer\n sys.stderr=self._stderr_buffer\n \n def startTestRun(self):\n ''\n\n\n \n \n def stopTest(self,test):\n ''\n self._restoreStdout()\n self._mirrorOutput=False\n \n def _restoreStdout(self):\n if self.buffer:\n if self._mirrorOutput:\n output=sys.stdout.getvalue()\n error=sys.stderr.getvalue()\n if output:\n if not output.endswith('\\n'):\n output +='\\n'\n self._original_stdout.write(STDOUT_LINE %output)\n if error:\n if not error.endswith('\\n'):\n error +='\\n'\n self._original_stderr.write(STDERR_LINE %error)\n \n sys.stdout=self._original_stdout\n sys.stderr=self._original_stderr\n self._stdout_buffer.seek(0)\n self._stdout_buffer.truncate()\n self._stderr_buffer.seek(0)\n self._stderr_buffer.truncate()\n \n def stopTestRun(self):\n ''\n\n\n \n \n @failfast\n def addError(self,test,err):\n ''\n\n \n self.errors.append((test,self._exc_info_to_string(err,test)))\n self._mirrorOutput=True\n \n @failfast\n def addFailure(self,test,err):\n ''\n \n self.failures.append((test,self._exc_info_to_string(err,test)))\n self._mirrorOutput=True\n \n def addSubTest(self,test,subtest,err):\n ''\n\n\n \n \n \n if err is not None :\n if getattr(self,'failfast',False ):\n self.stop()\n if issubclass(err[0],test.failureException):\n errors=self.failures\n else :\n errors=self.errors\n errors.append((subtest,self._exc_info_to_string(err,test)))\n self._mirrorOutput=True\n \n def addSuccess(self,test):\n ''\n pass\n \n def addSkip(self,test,reason):\n ''\n self.skipped.append((test,reason))\n \n def addExpectedFailure(self,test,err):\n ''\n self.expectedFailures.append(\n (test,self._exc_info_to_string(err,test)))\n \n @failfast\n def addUnexpectedSuccess(self,test):\n ''\n self.unexpectedSuccesses.append(test)\n \n def wasSuccessful(self):\n ''\n \n \n \n return ((len(self.failures)==len(self.errors)==0)and\n (not hasattr(self,'unexpectedSuccesses')or\n len(self.unexpectedSuccesses)==0))\n \n def stop(self):\n ''\n self.shouldStop=True\n \n def _exc_info_to_string(self,err,test):\n ''\n exctype,value,tb=err\n tb=self._clean_tracebacks(exctype,value,tb,test)\n tb_e=traceback.TracebackException(\n exctype,value,tb,\n capture_locals=self.tb_locals,compact=True )\n msgLines=list(tb_e.format())\n \n if self.buffer:\n output=sys.stdout.getvalue()\n error=sys.stderr.getvalue()\n if output:\n if not output.endswith('\\n'):\n output +='\\n'\n msgLines.append(STDOUT_LINE %output)\n if error:\n if not error.endswith('\\n'):\n error +='\\n'\n msgLines.append(STDERR_LINE %error)\n return ''.join(msgLines)\n \n def _clean_tracebacks(self,exctype,value,tb,test):\n ret=None\n first=True\n excs=[(exctype,value,tb)]\n while excs:\n (exctype,value,tb)=excs.pop()\n \n while tb and self._is_relevant_tb_level(tb):\n tb=tb.tb_next\n \n \n if exctype is test.failureException:\n self._remove_unittest_tb_frames(tb)\n \n if first:\n ret=tb\n first=False\n else :\n value.__traceback__=tb\n \n if value is not None :\n for c in (value.__cause__,value.__context__):\n if c is not None :\n excs.append((type(c),c,c.__traceback__))\n return ret\n \n def _is_relevant_tb_level(self,tb):\n return '__unittest'in tb.tb_frame.f_globals\n \n def _remove_unittest_tb_frames(self,tb):\n ''\n\n\n\n\n\n \n prev=None\n while tb and not self._is_relevant_tb_level(tb):\n prev=tb\n tb=tb.tb_next\n if prev is not None :\n prev.tb_next=None\n \n def __repr__(self):\n return (\"<%s run=%i errors=%i failures=%i>\"%\n (util.strclass(self.__class__),self.testsRun,len(self.errors),\n len(self.failures)))\n", ["functools", "io", "sys", "traceback", "unittest", "unittest.util"]], "unittest.runner": [".py", "''\n\nimport sys\nimport time\nimport warnings\n\nfrom. import result\nfrom.case import _SubTest\nfrom.signals import registerResult\n\n__unittest=True\n\n\nclass _WritelnDecorator(object):\n ''\n def __init__(self,stream):\n self.stream=stream\n \n def __getattr__(self,attr):\n if attr in('stream','__getstate__'):\n raise AttributeError(attr)\n return getattr(self.stream,attr)\n \n def writeln(self,arg=None):\n if arg:\n self.write(arg)\n self.write('\\n')\n \n \nclass TextTestResult(result.TestResult):\n ''\n\n\n \n separator1='='*70\n separator2='-'*70\n \n def __init__(self,stream,descriptions,verbosity,*,durations=None):\n ''\n \n super(TextTestResult,self).__init__(stream,descriptions,verbosity)\n self.stream=stream\n self.showAll=verbosity >1\n self.dots=verbosity ==1\n self.descriptions=descriptions\n self._newline=True\n self.durations=durations\n \n def getDescription(self,test):\n doc_first_line=test.shortDescription()\n if self.descriptions and doc_first_line:\n return '\\n'.join((str(test),doc_first_line))\n else:\n return str(test)\n \n def startTest(self,test):\n super(TextTestResult,self).startTest(test)\n if self.showAll:\n self.stream.write(self.getDescription(test))\n self.stream.write(\" ... \")\n self.stream.flush()\n self._newline=False\n \n def _write_status(self,test,status):\n is_subtest=isinstance(test,_SubTest)\n if is_subtest or self._newline:\n if not self._newline:\n self.stream.writeln()\n if is_subtest:\n self.stream.write(\" \")\n self.stream.write(self.getDescription(test))\n self.stream.write(\" ... \")\n self.stream.writeln(status)\n self.stream.flush()\n self._newline=True\n \n def addSubTest(self,test,subtest,err):\n if err is not None:\n if self.showAll:\n if issubclass(err[0],subtest.failureException):\n self._write_status(subtest,\"FAIL\")\n else:\n self._write_status(subtest,\"ERROR\")\n elif self.dots:\n if issubclass(err[0],subtest.failureException):\n self.stream.write('F')\n else:\n self.stream.write('E')\n self.stream.flush()\n super(TextTestResult,self).addSubTest(test,subtest,err)\n \n def addSuccess(self,test):\n super(TextTestResult,self).addSuccess(test)\n if self.showAll:\n self._write_status(test,\"ok\")\n elif self.dots:\n self.stream.write('.')\n self.stream.flush()\n \n def addError(self,test,err):\n super(TextTestResult,self).addError(test,err)\n if self.showAll:\n self._write_status(test,\"ERROR\")\n elif self.dots:\n self.stream.write('E')\n self.stream.flush()\n \n def addFailure(self,test,err):\n super(TextTestResult,self).addFailure(test,err)\n if self.showAll:\n self._write_status(test,\"FAIL\")\n elif self.dots:\n self.stream.write('F')\n self.stream.flush()\n \n def addSkip(self,test,reason):\n super(TextTestResult,self).addSkip(test,reason)\n if self.showAll:\n self._write_status(test,\"skipped {0!r}\".format(reason))\n elif self.dots:\n self.stream.write(\"s\")\n self.stream.flush()\n \n def addExpectedFailure(self,test,err):\n super(TextTestResult,self).addExpectedFailure(test,err)\n if self.showAll:\n self.stream.writeln(\"expected failure\")\n self.stream.flush()\n elif self.dots:\n self.stream.write(\"x\")\n self.stream.flush()\n \n def addUnexpectedSuccess(self,test):\n super(TextTestResult,self).addUnexpectedSuccess(test)\n if self.showAll:\n self.stream.writeln(\"unexpected success\")\n self.stream.flush()\n elif self.dots:\n self.stream.write(\"u\")\n self.stream.flush()\n \n def printErrors(self):\n if self.dots or self.showAll:\n self.stream.writeln()\n self.stream.flush()\n self.printErrorList('ERROR',self.errors)\n self.printErrorList('FAIL',self.failures)\n unexpectedSuccesses=getattr(self,'unexpectedSuccesses',())\n if unexpectedSuccesses:\n self.stream.writeln(self.separator1)\n for test in unexpectedSuccesses:\n self.stream.writeln(f\"UNEXPECTED SUCCESS: {self.getDescription(test)}\")\n self.stream.flush()\n \n def printErrorList(self,flavour,errors):\n for test,err in errors:\n self.stream.writeln(self.separator1)\n self.stream.writeln(\"%s: %s\"%(flavour,self.getDescription(test)))\n self.stream.writeln(self.separator2)\n self.stream.writeln(\"%s\"%err)\n self.stream.flush()\n \n \nclass TextTestRunner(object):\n ''\n\n\n\n \n resultclass=TextTestResult\n \n def __init__(self,stream=None,descriptions=True,verbosity=1,\n failfast=False,buffer=False,resultclass=None,warnings=None,\n *,tb_locals=False,durations=None):\n ''\n\n\n\n \n if stream is None:\n stream=sys.stderr\n self.stream=_WritelnDecorator(stream)\n self.descriptions=descriptions\n self.verbosity=verbosity\n self.failfast=failfast\n self.buffer=buffer\n self.tb_locals=tb_locals\n self.durations=durations\n self.warnings=warnings\n if resultclass is not None:\n self.resultclass=resultclass\n \n def _makeResult(self):\n try:\n return self.resultclass(self.stream,self.descriptions,\n self.verbosity,durations=self.durations)\n except TypeError:\n \n return self.resultclass(self.stream,self.descriptions,\n self.verbosity)\n \n def _printDurations(self,result):\n if not result.collectedDurations:\n return\n ls=sorted(result.collectedDurations,key=lambda x:x[1],\n reverse=True)\n if self.durations >0:\n ls=ls[:self.durations]\n self.stream.writeln(\"Slowest test durations\")\n if hasattr(result,'separator2'):\n self.stream.writeln(result.separator2)\n hidden=False\n for test,elapsed in ls:\n if self.verbosity <2 and elapsed <0.001:\n hidden=True\n continue\n self.stream.writeln(\"%-10s %s\"%(\"%.3fs\"%elapsed,test))\n if hidden:\n self.stream.writeln(\"\\n(durations < 0.001s were hidden; \"\n \"use -v to show these durations)\")\n else:\n self.stream.writeln(\"\")\n \n def run(self,test):\n ''\n result=self._makeResult()\n registerResult(result)\n result.failfast=self.failfast\n result.buffer=self.buffer\n result.tb_locals=self.tb_locals\n with warnings.catch_warnings():\n if self.warnings:\n \n warnings.simplefilter(self.warnings)\n startTime=time.perf_counter()\n startTestRun=getattr(result,'startTestRun',None)\n if startTestRun is not None:\n startTestRun()\n try:\n test(result)\n finally:\n stopTestRun=getattr(result,'stopTestRun',None)\n if stopTestRun is not None:\n stopTestRun()\n stopTime=time.perf_counter()\n timeTaken=stopTime -startTime\n result.printErrors()\n if self.durations is not None:\n self._printDurations(result)\n \n if hasattr(result,'separator2'):\n self.stream.writeln(result.separator2)\n \n run=result.testsRun\n self.stream.writeln(\"Ran %d test%s in %.3fs\"%\n (run,run !=1 and \"s\"or \"\",timeTaken))\n self.stream.writeln()\n \n expectedFails=unexpectedSuccesses=skipped=0\n try:\n results=map(len,(result.expectedFailures,\n result.unexpectedSuccesses,\n result.skipped))\n except AttributeError:\n pass\n else:\n expectedFails,unexpectedSuccesses,skipped=results\n \n infos=[]\n if not result.wasSuccessful():\n self.stream.write(\"FAILED\")\n failed,errored=len(result.failures),len(result.errors)\n if failed:\n infos.append(\"failures=%d\"%failed)\n if errored:\n infos.append(\"errors=%d\"%errored)\n elif run ==0:\n self.stream.write(\"NO TESTS RAN\")\n else:\n self.stream.write(\"OK\")\n if skipped:\n infos.append(\"skipped=%d\"%skipped)\n if expectedFails:\n infos.append(\"expected failures=%d\"%expectedFails)\n if unexpectedSuccesses:\n infos.append(\"unexpected successes=%d\"%unexpectedSuccesses)\n if infos:\n self.stream.writeln(\" (%s)\"%(\", \".join(infos),))\n else:\n self.stream.write(\"\\n\")\n self.stream.flush()\n return result\n", ["sys", "time", "unittest", "unittest.case", "unittest.result", "unittest.signals", "warnings"]], "unittest.signals": [".py", "import signal\nimport weakref\n\nfrom functools import wraps\n\n__unittest=True\n\n\nclass _InterruptHandler(object):\n def __init__(self,default_handler):\n self.called=False\n self.original_handler=default_handler\n if isinstance(default_handler,int):\n if default_handler ==signal.SIG_DFL:\n \n default_handler=signal.default_int_handler\n elif default_handler ==signal.SIG_IGN:\n \n \n def default_handler(unused_signum,unused_frame):\n pass\n else :\n raise TypeError(\"expected SIGINT signal handler to be \"\n \"signal.SIG_IGN, signal.SIG_DFL, or a \"\n \"callable object\")\n self.default_handler=default_handler\n \n def __call__(self,signum,frame):\n installed_handler=signal.getsignal(signal.SIGINT)\n if installed_handler is not self:\n \n \n self.default_handler(signum,frame)\n \n if self.called:\n self.default_handler(signum,frame)\n self.called=True\n for result in _results.keys():\n result.stop()\n \n_results=weakref.WeakKeyDictionary()\ndef registerResult(result):\n _results[result]=1\n \ndef removeResult(result):\n return bool(_results.pop(result,None ))\n \n_interrupt_handler=None\ndef installHandler():\n global _interrupt_handler\n if _interrupt_handler is None :\n default_handler=signal.getsignal(signal.SIGINT)\n _interrupt_handler=_InterruptHandler(default_handler)\n signal.signal(signal.SIGINT,_interrupt_handler)\n \n \ndef removeHandler(method=None ):\n if method is not None :\n @wraps(method)\n def inner(*args,**kwargs):\n initial=signal.getsignal(signal.SIGINT)\n removeHandler()\n try :\n return method(*args,**kwargs)\n finally :\n signal.signal(signal.SIGINT,initial)\n return inner\n \n global _interrupt_handler\n if _interrupt_handler is not None :\n signal.signal(signal.SIGINT,_interrupt_handler.original_handler)\n", ["functools", "signal", "weakref"]], "unittest.suite": [".py", "''\n\nimport sys\n\nfrom . import case\nfrom . import util\n\n__unittest=True\n\n\ndef _call_if_exists(parent,attr):\n func=getattr(parent,attr,lambda :None )\n func()\n \n \nclass BaseTestSuite(object):\n ''\n \n _cleanup=True\n \n def __init__(self,tests=()):\n self._tests=[]\n self._removed_tests=0\n self.addTests(tests)\n \n def __repr__(self):\n return \"<%s tests=%s>\"%(util.strclass(self.__class__),list(self))\n \n def __eq__(self,other):\n if not isinstance(other,self.__class__):\n return NotImplemented\n return list(self)==list(other)\n \n def __iter__(self):\n return iter(self._tests)\n \n def countTestCases(self):\n cases=self._removed_tests\n for test in self:\n if test:\n cases +=test.countTestCases()\n return cases\n \n def addTest(self,test):\n \n if not callable(test):\n raise TypeError(\"{} is not callable\".format(repr(test)))\n if isinstance(test,type)and issubclass(test,\n (case.TestCase,TestSuite)):\n raise TypeError(\"TestCases and TestSuites must be instantiated \"\n \"before passing them to addTest()\")\n self._tests.append(test)\n \n def addTests(self,tests):\n if isinstance(tests,str):\n raise TypeError(\"tests must be an iterable of tests, not a string\")\n for test in tests:\n self.addTest(test)\n \n def run(self,result):\n for index,test in enumerate(self):\n if result.shouldStop:\n break\n test(result)\n if self._cleanup:\n self._removeTestAtIndex(index)\n return result\n \n def _removeTestAtIndex(self,index):\n ''\n try :\n test=self._tests[index]\n except TypeError:\n \n pass\n else :\n \n \n if hasattr(test,'countTestCases'):\n self._removed_tests +=test.countTestCases()\n self._tests[index]=None\n \n def __call__(self,*args,**kwds):\n return self.run(*args,**kwds)\n \n def debug(self):\n ''\n for test in self:\n test.debug()\n \n \nclass TestSuite(BaseTestSuite):\n ''\n\n\n\n\n\n\n \n \n def run(self,result,debug=False ):\n topLevel=False\n if getattr(result,'_testRunEntered',False )is False :\n result._testRunEntered=topLevel=True\n \n for index,test in enumerate(self):\n if result.shouldStop:\n break\n \n if _isnotsuite(test):\n self._tearDownPreviousClass(test,result)\n self._handleModuleFixture(test,result)\n self._handleClassSetUp(test,result)\n result._previousTestClass=test.__class__\n \n if (getattr(test.__class__,'_classSetupFailed',False )or\n getattr(result,'_moduleSetUpFailed',False )):\n continue\n \n if not debug:\n test(result)\n else :\n test.debug()\n \n if self._cleanup:\n self._removeTestAtIndex(index)\n \n if topLevel:\n self._tearDownPreviousClass(None ,result)\n self._handleModuleTearDown(result)\n result._testRunEntered=False\n return result\n \n def debug(self):\n ''\n debug=_DebugResult()\n self.run(debug,True )\n \n \n \n def _handleClassSetUp(self,test,result):\n previousClass=getattr(result,'_previousTestClass',None )\n currentClass=test.__class__\n if currentClass ==previousClass:\n return\n if result._moduleSetUpFailed:\n return\n if getattr(currentClass,\"__unittest_skip__\",False ):\n return\n \n failed=False\n try :\n currentClass._classSetupFailed=False\n except TypeError:\n \n \n pass\n \n setUpClass=getattr(currentClass,'setUpClass',None )\n doClassCleanups=getattr(currentClass,'doClassCleanups',None )\n if setUpClass is not None :\n _call_if_exists(result,'_setupStdout')\n try :\n try :\n setUpClass()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n failed=True\n try :\n currentClass._classSetupFailed=True\n except TypeError:\n pass\n className=util.strclass(currentClass)\n self._createClassOrModuleLevelException(result,e,\n 'setUpClass',\n className)\n if failed and doClassCleanups is not None :\n doClassCleanups()\n for exc_info in currentClass.tearDown_exceptions:\n self._createClassOrModuleLevelException(\n result,exc_info[1],'setUpClass',className,\n info=exc_info)\n finally :\n _call_if_exists(result,'_restoreStdout')\n \n def _get_previous_module(self,result):\n previousModule=None\n previousClass=getattr(result,'_previousTestClass',None )\n if previousClass is not None :\n previousModule=previousClass.__module__\n return previousModule\n \n \n def _handleModuleFixture(self,test,result):\n previousModule=self._get_previous_module(result)\n currentModule=test.__class__.__module__\n if currentModule ==previousModule:\n return\n \n self._handleModuleTearDown(result)\n \n \n result._moduleSetUpFailed=False\n try :\n module=sys.modules[currentModule]\n except KeyError:\n return\n setUpModule=getattr(module,'setUpModule',None )\n if setUpModule is not None :\n _call_if_exists(result,'_setupStdout')\n try :\n try :\n setUpModule()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n result._moduleSetUpFailed=True\n self._createClassOrModuleLevelException(result,e,\n 'setUpModule',\n currentModule)\n if result._moduleSetUpFailed:\n try :\n case.doModuleCleanups()\n except Exception as e:\n self._createClassOrModuleLevelException(result,e,\n 'setUpModule',\n currentModule)\n finally :\n _call_if_exists(result,'_restoreStdout')\n \n def _createClassOrModuleLevelException(self,result,exc,method_name,\n parent,info=None ):\n errorName=f'{method_name} ({parent})'\n self._addClassOrModuleLevelException(result,exc,errorName,info)\n \n def _addClassOrModuleLevelException(self,result,exception,errorName,\n info=None ):\n error=_ErrorHolder(errorName)\n addSkip=getattr(result,'addSkip',None )\n if addSkip is not None and isinstance(exception,case.SkipTest):\n addSkip(error,str(exception))\n else :\n if not info:\n result.addError(error,sys.exc_info())\n else :\n result.addError(error,info)\n \n def _handleModuleTearDown(self,result):\n previousModule=self._get_previous_module(result)\n if previousModule is None :\n return\n if result._moduleSetUpFailed:\n return\n \n try :\n module=sys.modules[previousModule]\n except KeyError:\n return\n \n _call_if_exists(result,'_setupStdout')\n try :\n tearDownModule=getattr(module,'tearDownModule',None )\n if tearDownModule is not None :\n try :\n tearDownModule()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n self._createClassOrModuleLevelException(result,e,\n 'tearDownModule',\n previousModule)\n try :\n case.doModuleCleanups()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n self._createClassOrModuleLevelException(result,e,\n 'tearDownModule',\n previousModule)\n finally :\n _call_if_exists(result,'_restoreStdout')\n \n def _tearDownPreviousClass(self,test,result):\n previousClass=getattr(result,'_previousTestClass',None )\n currentClass=test.__class__\n if currentClass ==previousClass or previousClass is None :\n return\n if getattr(previousClass,'_classSetupFailed',False ):\n return\n if getattr(result,'_moduleSetUpFailed',False ):\n return\n if getattr(previousClass,\"__unittest_skip__\",False ):\n return\n \n tearDownClass=getattr(previousClass,'tearDownClass',None )\n doClassCleanups=getattr(previousClass,'doClassCleanups',None )\n if tearDownClass is None and doClassCleanups is None :\n return\n \n _call_if_exists(result,'_setupStdout')\n try :\n if tearDownClass is not None :\n try :\n tearDownClass()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n className=util.strclass(previousClass)\n self._createClassOrModuleLevelException(result,e,\n 'tearDownClass',\n className)\n if doClassCleanups is not None :\n doClassCleanups()\n for exc_info in previousClass.tearDown_exceptions:\n if isinstance(result,_DebugResult):\n raise exc_info[1]\n className=util.strclass(previousClass)\n self._createClassOrModuleLevelException(result,exc_info[1],\n 'tearDownClass',\n className,\n info=exc_info)\n finally :\n _call_if_exists(result,'_restoreStdout')\n \n \nclass _ErrorHolder(object):\n ''\n\n\n\n \n \n \n \n \n failureException=None\n \n def __init__(self,description):\n self.description=description\n \n def id(self):\n return self.description\n \n def shortDescription(self):\n return None\n \n def __repr__(self):\n return \"\"%(self.description,)\n \n def __str__(self):\n return self.id()\n \n def run(self,result):\n \n \n pass\n \n def __call__(self,result):\n return self.run(result)\n \n def countTestCases(self):\n return 0\n \ndef _isnotsuite(test):\n ''\n try :\n iter(test)\n except TypeError:\n return True\n return False\n \n \nclass _DebugResult(object):\n ''\n _previousTestClass=None\n _moduleSetUpFailed=False\n shouldStop=False\n", ["sys", "unittest", "unittest.case", "unittest.util"]], "unittest.util": [".py", "''\n\nfrom collections import namedtuple,Counter\nfrom os.path import commonprefix\n\n__unittest=True\n\n_MAX_LENGTH=80\n_PLACEHOLDER_LEN=12\n_MIN_BEGIN_LEN=5\n_MIN_END_LEN=5\n_MIN_COMMON_LEN=5\n_MIN_DIFF_LEN=_MAX_LENGTH -\\\n(_MIN_BEGIN_LEN+_PLACEHOLDER_LEN+_MIN_COMMON_LEN+\n_PLACEHOLDER_LEN+_MIN_END_LEN)\nassert _MIN_DIFF_LEN >=0\n\ndef _shorten(s,prefixlen,suffixlen):\n skip=len(s)-prefixlen -suffixlen\n if skip >_PLACEHOLDER_LEN:\n s='%s[%d chars]%s'%(s[:prefixlen],skip,s[len(s)-suffixlen:])\n return s\n \ndef _common_shorten_repr(*args):\n args=tuple(map(safe_repr,args))\n maxlen=max(map(len,args))\n if maxlen <=_MAX_LENGTH:\n return args\n \n prefix=commonprefix(args)\n prefixlen=len(prefix)\n \n common_len=_MAX_LENGTH -\\\n (maxlen -prefixlen+_MIN_BEGIN_LEN+_PLACEHOLDER_LEN)\n if common_len >_MIN_COMMON_LEN:\n assert _MIN_BEGIN_LEN+_PLACEHOLDER_LEN+_MIN_COMMON_LEN+\\\n (maxlen -prefixlen)<_MAX_LENGTH\n prefix=_shorten(prefix,_MIN_BEGIN_LEN,common_len)\n return tuple(prefix+s[prefixlen:]for s in args)\n \n prefix=_shorten(prefix,_MIN_BEGIN_LEN,_MIN_COMMON_LEN)\n return tuple(prefix+_shorten(s[prefixlen:],_MIN_DIFF_LEN,_MIN_END_LEN)\n for s in args)\n \ndef safe_repr(obj,short=False ):\n try :\n result=repr(obj)\n except Exception:\n result=object.__repr__(obj)\n if not short or len(result)<_MAX_LENGTH:\n return result\n return result[:_MAX_LENGTH]+' [truncated]...'\n \ndef strclass(cls):\n return \"%s.%s\"%(cls.__module__,cls.__qualname__)\n \ndef sorted_list_difference(expected,actual):\n ''\n\n\n\n\n\n \n i=j=0\n missing=[]\n unexpected=[]\n while True :\n try :\n e=expected[i]\n a=actual[j]\n if e a:\n unexpected.append(a)\n j +=1\n while actual[j]==a:\n j +=1\n else :\n i +=1\n try :\n while expected[i]==e:\n i +=1\n finally :\n j +=1\n while actual[j]==a:\n j +=1\n except IndexError:\n missing.extend(expected[i:])\n unexpected.extend(actual[j:])\n break\n return missing,unexpected\n \n \ndef unorderable_list_difference(expected,actual):\n ''\n\n\n\n \n missing=[]\n while expected:\n item=expected.pop()\n try :\n actual.remove(item)\n except ValueError:\n missing.append(item)\n \n \n return missing,actual\n \ndef three_way_cmp(x,y):\n ''\n return (x >y)-(x 0:\n self._raiseFailure(\n \"Unexpected logs found: {!r}\".format(\n self.watcher.output\n )\n )\n \n else :\n \n if len(self.watcher.records)==0:\n self._raiseFailure(\n \"no logs of level {} or higher triggered on {}\"\n .format(logging.getLevelName(self.level),self.logger.name))\n", ["collections", "logging", "unittest.case"]], "unittest": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['TestResult','TestCase','IsolatedAsyncioTestCase','TestSuite',\n'TextTestRunner','TestLoader','FunctionTestCase','main',\n'defaultTestLoader','SkipTest','skip','skipIf','skipUnless',\n'expectedFailure','TextTestResult','installHandler',\n'registerResult','removeResult','removeHandler',\n'addModuleCleanup','doModuleCleanups','enterModuleContext']\n\n\n\n__all__.extend(['getTestCaseNames','makeSuite','findTestCases'])\n\n__unittest=True\n\nfrom.result import TestResult\nfrom.case import(addModuleCleanup,TestCase,FunctionTestCase,SkipTest,skip,\nskipIf,skipUnless,expectedFailure,doModuleCleanups,\nenterModuleContext)\nfrom.suite import BaseTestSuite,TestSuite\nfrom.loader import TestLoader,defaultTestLoader\nfrom.main import TestProgram,main\nfrom.runner import TextTestRunner,TextTestResult\nfrom.signals import installHandler,registerResult,removeResult,removeHandler\n\nfrom.loader import makeSuite,getTestCaseNames,findTestCases\n\n\n\n\n\n\ndef __dir__():\n return globals().keys()|{'IsolatedAsyncioTestCase'}\n \ndef __getattr__(name):\n if name =='IsolatedAsyncioTestCase':\n global IsolatedAsyncioTestCase\n from.async_case import IsolatedAsyncioTestCase\n return IsolatedAsyncioTestCase\n raise AttributeError(f\"module {__name__ !r} has no attribute {name !r}\")\n", ["unittest.async_case", "unittest.case", "unittest.loader", "unittest.main", "unittest.result", "unittest.runner", "unittest.signals", "unittest.suite"], 1], "unittest.__main__": [".py", "''\n\nimport sys\nif sys.argv[0].endswith(\"__main__.py\"):\n import os.path\n \n \n \n \n executable=os.path.basename(sys.executable)\n sys.argv[0]=executable+\" -m unittest\"\n del os\n \n__unittest=True\n\nfrom .main import main\n\nmain(module=None )\n", ["os.path", "sys", "unittest.main"]], "urllib.error": [".py", "class HTTPError(Exception):pass\n", []], "urllib.parse": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfrom collections import namedtuple\nimport functools\nimport re\nimport sys\nimport types\nimport warnings\n\n__all__=[\"urlparse\",\"urlunparse\",\"urljoin\",\"urldefrag\",\n\"urlsplit\",\"urlunsplit\",\"urlencode\",\"parse_qs\",\n\"parse_qsl\",\"quote\",\"quote_plus\",\"quote_from_bytes\",\n\"unquote\",\"unquote_plus\",\"unquote_to_bytes\",\n\"DefragResult\",\"ParseResult\",\"SplitResult\",\n\"DefragResultBytes\",\"ParseResultBytes\",\"SplitResultBytes\"]\n\n\n\n\n\nuses_relative=['','ftp','http','gopher','nntp','imap',\n'wais','file','https','shttp','mms',\n'prospero','rtsp','rtspu','sftp',\n'svn','svn+ssh','ws','wss']\n\nuses_netloc=['','ftp','http','gopher','nntp','telnet',\n'imap','wais','file','mms','https','shttp',\n'snews','prospero','rtsp','rtspu','rsync',\n'svn','svn+ssh','sftp','nfs','git','git+ssh',\n'ws','wss']\n\nuses_params=['','ftp','hdl','prospero','http','imap',\n'https','shttp','rtsp','rtspu','sip','sips',\n'mms','sftp','tel']\n\n\n\n\nnon_hierarchical=['gopher','hdl','mailto','news',\n'telnet','wais','imap','snews','sip','sips']\n\nuses_query=['','http','wais','imap','https','shttp','mms',\n'gopher','rtsp','rtspu','sip','sips']\n\nuses_fragment=['','ftp','hdl','http','gopher','news',\n'nntp','wais','https','shttp','snews',\n'file','prospero']\n\n\nscheme_chars=('abcdefghijklmnopqrstuvwxyz'\n'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n'0123456789'\n'+-.')\n\n\n_UNSAFE_URL_BYTES_TO_REMOVE=['\\t','\\r','\\n']\n\ndef clear_cache():\n ''\n urlsplit.cache_clear()\n _byte_quoter_factory.cache_clear()\n \n \n \n \n \n \n \n_implicit_encoding='ascii'\n_implicit_errors='strict'\n\ndef _noop(obj):\n return obj\n \ndef _encode_result(obj,encoding=_implicit_encoding,\nerrors=_implicit_errors):\n return obj.encode(encoding,errors)\n \ndef _decode_args(args,encoding=_implicit_encoding,\nerrors=_implicit_errors):\n return tuple(x.decode(encoding,errors)if x else ''for x in args)\n \ndef _coerce_args(*args):\n\n\n\n\n\n str_input=isinstance(args[0],str)\n for arg in args[1:]:\n \n \n if arg and isinstance(arg,str)!=str_input:\n raise TypeError(\"Cannot mix str and non-str arguments\")\n if str_input:\n return args+(_noop,)\n return _decode_args(args)+(_encode_result,)\n \n \nclass _ResultMixinStr(object):\n ''\n __slots__=()\n \n def encode(self,encoding='ascii',errors='strict'):\n return self._encoded_counterpart(*(x.encode(encoding,errors)for x in self))\n \n \nclass _ResultMixinBytes(object):\n ''\n __slots__=()\n \n def decode(self,encoding='ascii',errors='strict'):\n return self._decoded_counterpart(*(x.decode(encoding,errors)for x in self))\n \n \nclass _NetlocResultMixinBase(object):\n ''\n __slots__=()\n \n @property\n def username(self):\n return self._userinfo[0]\n \n @property\n def password(self):\n return self._userinfo[1]\n \n @property\n def hostname(self):\n hostname=self._hostinfo[0]\n if not hostname:\n return None\n \n \n separator='%'if isinstance(hostname,str)else b'%'\n hostname,percent,zone=hostname.partition(separator)\n return hostname.lower()+percent+zone\n \n @property\n def port(self):\n port=self._hostinfo[1]\n if port is not None :\n try :\n port=int(port,10)\n except ValueError:\n message=f'Port could not be cast to integer value as {port!r}'\n raise ValueError(message)from None\n if not (0 <=port <=65535):\n raise ValueError(\"Port out of range 0-65535\")\n return port\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \nclass _NetlocResultMixinStr(_NetlocResultMixinBase,_ResultMixinStr):\n __slots__=()\n \n @property\n def _userinfo(self):\n netloc=self.netloc\n userinfo,have_info,hostinfo=netloc.rpartition('@')\n if have_info:\n username,have_password,password=userinfo.partition(':')\n if not have_password:\n password=None\n else :\n username=password=None\n return username,password\n \n @property\n def _hostinfo(self):\n netloc=self.netloc\n _,_,hostinfo=netloc.rpartition('@')\n _,have_open_br,bracketed=hostinfo.partition('[')\n if have_open_br:\n hostname,_,port=bracketed.partition(']')\n _,_,port=port.partition(':')\n else :\n hostname,_,port=hostinfo.partition(':')\n if not port:\n port=None\n return hostname,port\n \n \nclass _NetlocResultMixinBytes(_NetlocResultMixinBase,_ResultMixinBytes):\n __slots__=()\n \n @property\n def _userinfo(self):\n netloc=self.netloc\n userinfo,have_info,hostinfo=netloc.rpartition(b'@')\n if have_info:\n username,have_password,password=userinfo.partition(b':')\n if not have_password:\n password=None\n else :\n username=password=None\n return username,password\n \n @property\n def _hostinfo(self):\n netloc=self.netloc\n _,_,hostinfo=netloc.rpartition(b'@')\n _,have_open_br,bracketed=hostinfo.partition(b'[')\n if have_open_br:\n hostname,_,port=bracketed.partition(b']')\n _,_,port=port.partition(b':')\n else :\n hostname,_,port=hostinfo.partition(b':')\n if not port:\n port=None\n return hostname,port\n \n \n_DefragResultBase=namedtuple('DefragResult','url fragment')\n_SplitResultBase=namedtuple(\n'SplitResult','scheme netloc path query fragment')\n_ParseResultBase=namedtuple(\n'ParseResult','scheme netloc path params query fragment')\n\n_DefragResultBase.__doc__=\"\"\"\nDefragResult(url, fragment)\n\nA 2-tuple that contains the url without fragment identifier and the fragment\nidentifier as a separate argument.\n\"\"\"\n\n_DefragResultBase.url.__doc__=\"\"\"The URL with no fragment identifier.\"\"\"\n\n_DefragResultBase.fragment.__doc__=\"\"\"\nFragment identifier separated from URL, that allows indirect identification of a\nsecondary resource by reference to a primary resource and additional identifying\ninformation.\n\"\"\"\n\n_SplitResultBase.__doc__=\"\"\"\nSplitResult(scheme, netloc, path, query, fragment)\n\nA 5-tuple that contains the different components of a URL. Similar to\nParseResult, but does not split params.\n\"\"\"\n\n_SplitResultBase.scheme.__doc__=\"\"\"Specifies URL scheme for the request.\"\"\"\n\n_SplitResultBase.netloc.__doc__=\"\"\"\nNetwork location where the request is made to.\n\"\"\"\n\n_SplitResultBase.path.__doc__=\"\"\"\nThe hierarchical path, such as the path to a file to download.\n\"\"\"\n\n_SplitResultBase.query.__doc__=\"\"\"\nThe query component, that contains non-hierarchical data, that along with data\nin path component, identifies a resource in the scope of URI's scheme and\nnetwork location.\n\"\"\"\n\n_SplitResultBase.fragment.__doc__=\"\"\"\nFragment identifier, that allows indirect identification of a secondary resource\nby reference to a primary resource and additional identifying information.\n\"\"\"\n\n_ParseResultBase.__doc__=\"\"\"\nParseResult(scheme, netloc, path, params, query, fragment)\n\nA 6-tuple that contains components of a parsed URL.\n\"\"\"\n\n_ParseResultBase.scheme.__doc__=_SplitResultBase.scheme.__doc__\n_ParseResultBase.netloc.__doc__=_SplitResultBase.netloc.__doc__\n_ParseResultBase.path.__doc__=_SplitResultBase.path.__doc__\n_ParseResultBase.params.__doc__=\"\"\"\nParameters for last path element used to dereference the URI in order to provide\naccess to perform some operation on the resource.\n\"\"\"\n\n_ParseResultBase.query.__doc__=_SplitResultBase.query.__doc__\n_ParseResultBase.fragment.__doc__=_SplitResultBase.fragment.__doc__\n\n\n\n\n\nResultBase=_NetlocResultMixinStr\n\n\nclass DefragResult(_DefragResultBase,_ResultMixinStr):\n __slots__=()\n def geturl(self):\n if self.fragment:\n return self.url+'#'+self.fragment\n else :\n return self.url\n \nclass SplitResult(_SplitResultBase,_NetlocResultMixinStr):\n __slots__=()\n def geturl(self):\n return urlunsplit(self)\n \nclass ParseResult(_ParseResultBase,_NetlocResultMixinStr):\n __slots__=()\n def geturl(self):\n return urlunparse(self)\n \n \nclass DefragResultBytes(_DefragResultBase,_ResultMixinBytes):\n __slots__=()\n def geturl(self):\n if self.fragment:\n return self.url+b'#'+self.fragment\n else :\n return self.url\n \nclass SplitResultBytes(_SplitResultBase,_NetlocResultMixinBytes):\n __slots__=()\n def geturl(self):\n return urlunsplit(self)\n \nclass ParseResultBytes(_ParseResultBase,_NetlocResultMixinBytes):\n __slots__=()\n def geturl(self):\n return urlunparse(self)\n \n \ndef _fix_result_transcoding():\n _result_pairs=(\n (DefragResult,DefragResultBytes),\n (SplitResult,SplitResultBytes),\n (ParseResult,ParseResultBytes),\n )\n for _decoded,_encoded in _result_pairs:\n _decoded._encoded_counterpart=_encoded\n _encoded._decoded_counterpart=_decoded\n \n_fix_result_transcoding()\ndel _fix_result_transcoding\n\ndef urlparse(url,scheme='',allow_fragments=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n url,scheme,_coerce_result=_coerce_args(url,scheme)\n splitresult=urlsplit(url,scheme,allow_fragments)\n scheme,netloc,url,query,fragment=splitresult\n if scheme in uses_params and ';'in url:\n url,params=_splitparams(url)\n else :\n params=''\n result=ParseResult(scheme,netloc,url,params,query,fragment)\n return _coerce_result(result)\n \ndef _splitparams(url):\n if '/'in url:\n i=url.find(';',url.rfind('/'))\n if i <0:\n return url,''\n else :\n i=url.find(';')\n return url[:i],url[i+1:]\n \ndef _splitnetloc(url,start=0):\n delim=len(url)\n for c in '/?#':\n wdelim=url.find(c,start)\n if wdelim >=0:\n delim=min(delim,wdelim)\n return url[start:delim],url[delim:]\n \ndef _checknetloc(netloc):\n if not netloc or netloc.isascii():\n return\n \n \n import unicodedata\n n=netloc.replace('@','')\n n=n.replace(':','')\n n=n.replace('#','')\n n=n.replace('?','')\n netloc2=unicodedata.normalize('NFKC',n)\n if n ==netloc2:\n return\n for c in '/?#@:':\n if c in netloc2:\n raise ValueError(\"netloc '\"+netloc+\"' contains invalid \"+\n \"characters under NFKC normalization\")\n \n \n \n@functools.lru_cache(typed=True )\ndef urlsplit(url,scheme='',allow_fragments=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n url,scheme,_coerce_result=_coerce_args(url,scheme)\n \n for b in _UNSAFE_URL_BYTES_TO_REMOVE:\n url=url.replace(b,\"\")\n scheme=scheme.replace(b,\"\")\n \n allow_fragments=bool(allow_fragments)\n netloc=query=fragment=''\n i=url.find(':')\n if i >0:\n for c in url[:i]:\n if c not in scheme_chars:\n break\n else :\n scheme,url=url[:i].lower(),url[i+1:]\n \n if url[:2]=='//':\n netloc,url=_splitnetloc(url,2)\n if (('['in netloc and ']'not in netloc)or\n (']'in netloc and '['not in netloc)):\n raise ValueError(\"Invalid IPv6 URL\")\n if allow_fragments and '#'in url:\n url,fragment=url.split('#',1)\n if '?'in url:\n url,query=url.split('?',1)\n _checknetloc(netloc)\n v=SplitResult(scheme,netloc,url,query,fragment)\n return _coerce_result(v)\n \ndef urlunparse(components):\n ''\n\n\n \n scheme,netloc,url,params,query,fragment,_coerce_result=(\n _coerce_args(*components))\n if params:\n url=\"%s;%s\"%(url,params)\n return _coerce_result(urlunsplit((scheme,netloc,url,query,fragment)))\n \ndef urlunsplit(components):\n ''\n\n\n\n \n scheme,netloc,url,query,fragment,_coerce_result=(\n _coerce_args(*components))\n if netloc or (scheme and scheme in uses_netloc and url[:2]!='//'):\n if url and url[:1]!='/':url='/'+url\n url='//'+(netloc or '')+url\n if scheme:\n url=scheme+':'+url\n if query:\n url=url+'?'+query\n if fragment:\n url=url+'#'+fragment\n return _coerce_result(url)\n \ndef urljoin(base,url,allow_fragments=True ):\n ''\n \n if not base:\n return url\n if not url:\n return base\n \n base,url,_coerce_result=_coerce_args(base,url)\n bscheme,bnetloc,bpath,bparams,bquery,bfragment=\\\n urlparse(base,'',allow_fragments)\n scheme,netloc,path,params,query,fragment=\\\n urlparse(url,bscheme,allow_fragments)\n \n if scheme !=bscheme or scheme not in uses_relative:\n return _coerce_result(url)\n if scheme in uses_netloc:\n if netloc:\n return _coerce_result(urlunparse((scheme,netloc,path,\n params,query,fragment)))\n netloc=bnetloc\n \n if not path and not params:\n path=bpath\n params=bparams\n if not query:\n query=bquery\n return _coerce_result(urlunparse((scheme,netloc,path,\n params,query,fragment)))\n \n base_parts=bpath.split('/')\n if base_parts[-1]!='':\n \n \n del base_parts[-1]\n \n \n if path[:1]=='/':\n segments=path.split('/')\n else :\n segments=base_parts+path.split('/')\n \n \n segments[1:-1]=filter(None ,segments[1:-1])\n \n resolved_path=[]\n \n for seg in segments:\n if seg =='..':\n try :\n resolved_path.pop()\n except IndexError:\n \n \n pass\n elif seg =='.':\n continue\n else :\n resolved_path.append(seg)\n \n if segments[-1]in ('.','..'):\n \n \n resolved_path.append('')\n \n return _coerce_result(urlunparse((scheme,netloc,'/'.join(\n resolved_path)or '/',params,query,fragment)))\n \n \ndef urldefrag(url):\n ''\n\n\n\n\n \n url,_coerce_result=_coerce_args(url)\n if '#'in url:\n s,n,p,a,q,frag=urlparse(url)\n defrag=urlunparse((s,n,p,a,q,''))\n else :\n frag=''\n defrag=url\n return _coerce_result(DefragResult(defrag,frag))\n \n_hexdig='0123456789ABCDEFabcdef'\n_hextobyte=None\n\ndef unquote_to_bytes(string):\n ''\n \n \n if not string:\n \n string.split\n return b''\n if isinstance(string,str):\n string=string.encode('utf-8')\n bits=string.split(b'%')\n if len(bits)==1:\n return string\n res=[bits[0]]\n append=res.append\n \n \n global _hextobyte\n if _hextobyte is None :\n _hextobyte={(a+b).encode():bytes.fromhex(a+b)\n for a in _hexdig for b in _hexdig}\n for item in bits[1:]:\n try :\n append(_hextobyte[item[:2]])\n append(item[2:])\n except KeyError:\n append(b'%')\n append(item)\n return b''.join(res)\n \n_asciire=re.compile('([\\x00-\\x7f]+)')\n\ndef unquote(string,encoding='utf-8',errors='replace'):\n ''\n\n\n\n\n\n\n\n \n if isinstance(string,bytes):\n return unquote_to_bytes(string).decode(encoding,errors)\n if '%'not in string:\n string.split\n return string\n if encoding is None :\n encoding='utf-8'\n if errors is None :\n errors='replace'\n bits=_asciire.split(string)\n res=[bits[0]]\n append=res.append\n for i in range(1,len(bits),2):\n append(unquote_to_bytes(bits[i]).decode(encoding,errors))\n append(bits[i+1])\n return ''.join(res)\n \n \ndef parse_qs(qs,keep_blank_values=False ,strict_parsing=False ,\nencoding='utf-8',errors='replace',max_num_fields=None ,separator='&'):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n parsed_result={}\n pairs=parse_qsl(qs,keep_blank_values,strict_parsing,\n encoding=encoding,errors=errors,\n max_num_fields=max_num_fields,separator=separator)\n for name,value in pairs:\n if name in parsed_result:\n parsed_result[name].append(value)\n else :\n parsed_result[name]=[value]\n return parsed_result\n \n \ndef parse_qsl(qs,keep_blank_values=False ,strict_parsing=False ,\nencoding='utf-8',errors='replace',max_num_fields=None ,separator='&'):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n qs,_coerce_result=_coerce_args(qs)\n separator,_=_coerce_args(separator)\n \n if not separator or (not isinstance(separator,(str,bytes))):\n raise ValueError(\"Separator must be of type string or bytes.\")\n \n \n \n \n if max_num_fields is not None :\n num_fields=1+qs.count(separator)if qs else 0\n if max_num_fields \"\n \n def __missing__(self,b):\n \n res=chr(b)if b in self.safe else '%{:02X}'.format(b)\n self[b]=res\n return res\n \ndef quote(string,safe='/',encoding=None ,errors=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(string,str):\n if not string:\n return string\n if encoding is None :\n encoding='utf-8'\n if errors is None :\n errors='strict'\n string=string.encode(encoding,errors)\n else :\n if encoding is not None :\n raise TypeError(\"quote() doesn't support 'encoding' for bytes\")\n if errors is not None :\n raise TypeError(\"quote() doesn't support 'errors' for bytes\")\n return quote_from_bytes(string,safe)\n \ndef quote_plus(string,safe='',encoding=None ,errors=None ):\n ''\n\n\n \n \n \n if ((isinstance(string,str)and ' 'not in string)or\n (isinstance(string,bytes)and b' 'not in string)):\n return quote(string,safe,encoding,errors)\n if isinstance(safe,str):\n space=' '\n else :\n space=b' '\n string=quote(string,safe+space,encoding,errors)\n return string.replace(' ','+')\n \n \n@functools.lru_cache\ndef _byte_quoter_factory(safe):\n return _Quoter(safe).__getitem__\n \ndef quote_from_bytes(bs,safe='/'):\n ''\n\n\n \n if not isinstance(bs,(bytes,bytearray)):\n raise TypeError(\"quote_from_bytes() expected bytes\")\n if not bs:\n return ''\n if isinstance(safe,str):\n \n safe=safe.encode('ascii','ignore')\n else :\n \n safe=bytes([c for c in safe if c <128])\n if not bs.rstrip(_ALWAYS_SAFE_BYTES+safe):\n return bs.decode()\n quoter=_byte_quoter_factory(safe)\n return ''.join([quoter(char)for char in bs])\n \ndef urlencode(query,doseq=False ,safe='',encoding=None ,errors=None ,\nquote_via=quote_plus):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if hasattr(query,\"items\"):\n query=query.items()\n else :\n \n \n try :\n \n \n if len(query)and not isinstance(query[0],tuple):\n raise TypeError\n \n \n \n \n except TypeError as err:\n raise TypeError(\"not a valid non-string sequence \"\n \"or mapping object\")from err\n \n l=[]\n if not doseq:\n for k,v in query:\n if isinstance(k,bytes):\n k=quote_via(k,safe)\n else :\n k=quote_via(str(k),safe,encoding,errors)\n \n if isinstance(v,bytes):\n v=quote_via(v,safe)\n else :\n v=quote_via(str(v),safe,encoding,errors)\n l.append(k+'='+v)\n else :\n for k,v in query:\n if isinstance(k,bytes):\n k=quote_via(k,safe)\n else :\n k=quote_via(str(k),safe,encoding,errors)\n \n if isinstance(v,bytes):\n v=quote_via(v,safe)\n l.append(k+'='+v)\n elif isinstance(v,str):\n v=quote_via(v,safe,encoding,errors)\n l.append(k+'='+v)\n else :\n try :\n \n x=len(v)\n except TypeError:\n \n v=quote_via(str(v),safe,encoding,errors)\n l.append(k+'='+v)\n else :\n \n for elt in v:\n if isinstance(elt,bytes):\n elt=quote_via(elt,safe)\n else :\n elt=quote_via(str(elt),safe,encoding,errors)\n l.append(k+'='+elt)\n return '&'.join(l)\n \n \ndef to_bytes(url):\n warnings.warn(\"urllib.parse.to_bytes() is deprecated as of 3.8\",\n DeprecationWarning,stacklevel=2)\n return _to_bytes(url)\n \n \ndef _to_bytes(url):\n ''\n \n \n \n if isinstance(url,str):\n try :\n url=url.encode(\"ASCII\").decode()\n except UnicodeError:\n raise UnicodeError(\"URL \"+repr(url)+\n \" contains non-ASCII characters\")\n return url\n \n \ndef unwrap(url):\n ''\n\n\n \n url=str(url).strip()\n if url[:1]=='<'and url[-1:]=='>':\n url=url[1:-1].strip()\n if url[:4]=='URL:':\n url=url[4:].strip()\n return url\n \n \ndef splittype(url):\n warnings.warn(\"urllib.parse.splittype() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splittype(url)\n \n \n_typeprog=None\ndef _splittype(url):\n ''\n global _typeprog\n if _typeprog is None :\n _typeprog=re.compile('([^/:]+):(.*)',re.DOTALL)\n \n match=_typeprog.match(url)\n if match:\n scheme,data=match.groups()\n return scheme.lower(),data\n return None ,url\n \n \ndef splithost(url):\n warnings.warn(\"urllib.parse.splithost() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splithost(url)\n \n \n_hostprog=None\ndef _splithost(url):\n ''\n global _hostprog\n if _hostprog is None :\n _hostprog=re.compile('//([^/#?]*)(.*)',re.DOTALL)\n \n match=_hostprog.match(url)\n if match:\n host_port,path=match.groups()\n if path and path[0]!='/':\n path='/'+path\n return host_port,path\n return None ,url\n \n \ndef splituser(host):\n warnings.warn(\"urllib.parse.splituser() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splituser(host)\n \n \ndef _splituser(host):\n ''\n user,delim,host=host.rpartition('@')\n return (user if delim else None ),host\n \n \ndef splitpasswd(user):\n warnings.warn(\"urllib.parse.splitpasswd() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitpasswd(user)\n \n \ndef _splitpasswd(user):\n ''\n user,delim,passwd=user.partition(':')\n return user,(passwd if delim else None )\n \n \ndef splitport(host):\n warnings.warn(\"urllib.parse.splitport() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitport(host)\n \n \n \n_portprog=None\ndef _splitport(host):\n ''\n global _portprog\n if _portprog is None :\n _portprog=re.compile('(.*):([0-9]*)',re.DOTALL)\n \n match=_portprog.fullmatch(host)\n if match:\n host,port=match.groups()\n if port:\n return host,port\n return host,None\n \n \ndef splitnport(host,defport=-1):\n warnings.warn(\"urllib.parse.splitnport() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitnport(host,defport)\n \n \ndef _splitnport(host,defport=-1):\n ''\n\n\n \n host,delim,port=host.rpartition(':')\n if not delim:\n host=port\n elif port:\n try :\n nport=int(port)\n except ValueError:\n nport=None\n return host,nport\n return host,defport\n \n \ndef splitquery(url):\n warnings.warn(\"urllib.parse.splitquery() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitquery(url)\n \n \ndef _splitquery(url):\n ''\n path,delim,query=url.rpartition('?')\n if delim:\n return path,query\n return url,None\n \n \ndef splittag(url):\n warnings.warn(\"urllib.parse.splittag() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splittag(url)\n \n \ndef _splittag(url):\n ''\n path,delim,tag=url.rpartition('#')\n if delim:\n return path,tag\n return url,None\n \n \ndef splitattr(url):\n warnings.warn(\"urllib.parse.splitattr() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitattr(url)\n \n \ndef _splitattr(url):\n ''\n \n words=url.split(';')\n return words[0],words[1:]\n \n \ndef splitvalue(attr):\n warnings.warn(\"urllib.parse.splitvalue() is deprecated as of 3.8, \"\n \"use urllib.parse.parse_qsl() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitvalue(attr)\n \n \ndef _splitvalue(attr):\n ''\n attr,delim,value=attr.partition('=')\n return attr,(value if delim else None )\n", ["collections", "functools", "re", "sys", "types", "unicodedata", "warnings"]], "urllib.request": [".py", "from browser import ajax\nfrom . import error\n\nclass FileIO:\n\n def __init__(self,data):\n self._data=data\n \n def __enter__(self):\n return self\n \n def __exit__(self,*args):\n pass\n \n def read(self):\n return self._data\n \ndef urlopen(url,data=None ,timeout=None ):\n global result\n result=None\n \n def on_complete(req):\n global result\n if req.status ==200:\n result=req\n \n _ajax=ajax.ajax()\n _ajax.bind('complete',on_complete)\n if timeout is not None :\n _ajax.set_timeout(timeout)\n \n if data is None :\n _ajax.open('GET',url,False )\n _ajax.send()\n else :\n _ajax.open('POST',url,False )\n _ajax.send(data)\n \n if result is not None :\n if isinstance(result.text,str):\n return FileIO(result.text)\n \n return FileIO(result.text())\n raise error.HTTPError('file not found')\n", ["browser", "browser.ajax", "urllib", "urllib.error"]], "urllib": [".py", "", [], 1]} +var scripts = {"$timestamp": 1698076343483, "array": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\nvar typecodes = {\n 'b': Int8Array, // signed char, 1 byte\n 'B': Uint8Array, // unsigned char, 1\n 'u': Uint32Array, // Py_UNICODE Unicode character, 2 (deprecated)\n 'h': Int16Array, // signed short, 2\n 'H': Uint16Array, // unsigned short, 2\n 'i': Int16Array, // signed int, 2\n 'I': Uint16Array, // unsigned int, 2\n 'l': Int32Array, // signed long, 4\n 'L': Uint32Array, // unsigned long, 4\n 'q': null, // signed long, 8 (not implemented)\n 'Q': null, // unsigned long, 8 (not implemented)\n 'f': Float32Array, // float, 4\n 'd': Float64Array // double float, 8\n}\n\nvar array = $B.make_class(\"array\",\n function(){\n var missing = {},\n $ = $B.args(\"array\", 2, {typecode: null, initializer: null},\n [\"typecode\", \"initializer\"], arguments, {initializer: missing},\n null, null),\n typecode = $.typecode,\n initializer = $.initializer\n if(! typecodes.hasOwnProperty(typecode)){\n throw _b_.ValueError.$factory(\"bad typecode (must be b, \" +\n \"B, u, h, H, i, I, l, L, q, Q, f or d)\")\n }\n if(typecodes[typecode] === null){\n console.log(\"array factory, $\", $, typecode)\n throw _b_.NotImplementedError.$factory(\"type code \" +\n typecode + \" is not implemented\")\n }\n var res = {\n __class__: array,\n typecode: typecode,\n obj: null\n }\n if(initializer !== missing){\n if(Array.isArray(initializer)){\n array.fromlist(res, initializer)\n }else if($B.$isinstance(initializer, _b_.bytes)){\n array.frombytes(res, initializer)\n }else{\n array.extend(res, initializer)\n }\n }\n return res\n }\n)\n\narray.$buffer_protocol = true\narray.$match_sequence_pattern = true // for Pattern Matching (PEP 634)\n\narray.__getitem__ = function(self, key){\n if(self.obj && self.obj[key] !== undefined){\n return self.obj[key]\n }\n throw _b_.IndexError.$factory(\"array index out of range\")\n}\n\nvar array_iterator = $B.make_iterator_class(\"array_iterator\")\narray.__iter__ = function(self){\n return array_iterator.$factory(self.obj === null ? [] : self.obj)\n}\n\narray.__len__ = function(self){\n return self.obj === null ? 0 : self.obj.length\n}\n\narray.__mul__ = function(self, nb){\n if(typeof nb == \"number\" || $B.$isinstance(nb, _b_.int)){\n var t = [],\n copy = self.obj.slice()\n for(var i = 0; i < nb; i++){\n t = t.concat(copy)\n }\n return {\n __class__: array,\n typecode: self.typecode,\n obj: t\n }\n }\n throw _b_.ValueError.$factory(\"cannot multiply array by \" +\n $B.class_name(nb))\n}\n\narray.__setitem__ = function(_self, index, value){\n if(_self.obj[index] === undefined){\n throw _b_.IndexError.$factory(\"array index out of range\")\n }\n _self.obj[index] = value\n}\n\narray.__str__ = function(self){\n $B.args(\"__str__\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n var res = \"array('\" + self.typecode + \"'\"\n if(self.obj !== null){\n res += \", [\" + self.obj + \"]\"\n }\n return res + \")\"\n}\n\nfunction normalize_index(self, i){\n // return an index i between 0 and self.obj.length - 1\n if(i < 0){\n i = self.obj.length + i\n }\n if(i < 0){i = 0}\n else if(i > self.obj.length - 1){\n i = self.obj.length\n }\n return i\n}\n\narray.append = function(self, value){\n $B.args(\"append\", 2, {self: null, value: null},\n [\"self\", \"value\"], arguments, {}, null, null)\n var pos = self.obj === null ? 0 : self.obj.length\n return array.insert(self, pos, value)\n}\n\narray.count = function(self, x){\n $B.args(\"count\", 2, {self: null, x: null},\n [\"self\", \"x\"], arguments, {}, null, null)\n if(self.obj === null){return 0}\n return self.obj.filter(function(item){return item == x}).length\n}\n\narray.extend = function(self, iterable){\n $B.args(\"extend\", 2, {self: null, iterable: null},\n [\"self\", \"iterable\"], arguments, {}, null, null)\n if(iterable.__class__ === array){\n if(iterable.typecode !== self.typecode){\n throw _b_.TypeError.$factory(\"can only extend with array \" +\n \"of same kind\")\n }\n if(iterable.obj === null){return _b_.None}\n // create new object with length = sum of lengths\n var newobj = new typecodes[self.typecode](self.obj.length +\n iterable.obj.length)\n // copy self.obj\n newobj.set(self.obj)\n // copy iterable.obj\n newobj.set(iterable.obj, self.obj.length)\n self.obj = newobj\n }else{\n var it = _b_.iter(iterable)\n while(true){\n try{\n var item = _b_.next(it)\n array.append(self, item)\n }catch(err){\n if(err.__class__ !== _b_.StopIteration){\n throw err\n }\n break\n }\n }\n }\n return _b_.None\n}\n\narray.frombytes = function(self, s){\n $B.args(\"frombytes\", 2, {self: null, s: null},\n [\"self\", \"s\"], arguments, {}, null, null)\n if(! $B.$isinstance(s, _b_.bytes)){\n throw _b_.TypeError.$factory(\"a bytes-like object is required, \" +\n \"not '\" + $B.class_name(s) + \"'\")\n }\n self.obj = new typecodes[self.typecode](s.source)\n return _b_.None\n}\n\narray.fromlist = function(self, list){\n $B.args(\"fromlist\", 2, {self: null, list: null},\n [\"self\", \"list\"], arguments, {}, null, null)\n var it = _b_.iter(list)\n while(true){\n try{\n var item = _b_.next(it)\n try{\n array.append(self, item)\n }catch(err){\n console.log(err)\n return _b_.None\n }\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n return _b_.None\n }\n throw err\n }\n }\n}\n\narray.fromstring = array.frombytes\n\narray.index = function(self, x){\n $B.args(\"index\", 2, {self: null, x: null},\n [\"self\", \"x\"], arguments, {}, null, null)\n var res = self.obj.findIndex(function(item){return x == item})\n if(res == -1){\n throw _b_.ValueError.$factory(\"array.index(x): x not in array\")\n }\n return res\n}\n\narray.insert = function(self, i, value){\n $B.args(\"insert\", 3, {self: null, i: null, value: null},\n [\"self\", \"i\", \"value\"], arguments, {}, null, null)\n if(self.obj === null){\n self.obj = [value]\n }else{\n self.obj.splice(i, 0, value)\n }\n return _b_.None\n}\n\narray.itemsize = function(self){\n return typecodes[self.typecode].BYTES_PER_ELEMENT\n}\n\narray.pop = function(self, i){\n var $ = $B.args(\"count\", 2, {self: null, i: null},\n [\"self\", \"i\"], arguments, {i: -1}, null, null)\n i = $.i\n if(self.obj === null){\n throw _b_.IndexError.$factory(\"pop from empty array\")\n }else if(self.obj.length == 1){\n var res = self.obj[0]\n self.obj = null\n return res\n }\n i = normalize_index(self, i)\n // store value to return\n var res = self.obj[i]\n // create new array, size = previous size - 1\n var newobj = new typecodes[self.typecode](self.obj.length - 1)\n // fill new array with values until i excluded\n newobj.set(self.obj.slice(0, i))\n // fill with values after i\n newobj.set(self.obj.slice(i + 1), i)\n // set self.obj to new array\n self.obj = newobj\n // return stored value\n return res\n}\n\narray.remove = function(self, x){\n $B.args(\"remove\", 2, {self: null, x: null},\n [\"self\", \"x\"], arguments, {}, null, null)\n var res = self.obj.findIndex(function(item){return x == item})\n if(res == -1){\n throw _b_.ValueError.$factory(\"array.remove(x): x not in array\")\n }\n array.pop(self, res)\n return _b_.None\n}\n\narray.reverse = function(self){\n $B.args(\"reverse\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n if(self.obj === null){return _b_.None}\n self.obj.reverse()\n return _b_.None\n}\n\narray.tobytes = function(self){\n $B.args(\"tobytes\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n var items = Array.prototype.slice.call(self.obj),\n res = []\n items.forEach(function(item){\n while(item > 256){\n res.push(item % 256)\n item = Math.floor(item / 256)\n }\n res.push(item)\n })\n return _b_.bytes.$factory(res)\n}\n\narray.tolist = function(self){\n $B.args(\"tolist\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n if(self.obj === null){\n return $B.$list([])\n }\n return Array.prototype.slice.call(self.obj)\n}\n\narray.tostring = array.tobytes\n\narray.typecode = function(self){\n return self.typecode\n}\n\n$B.set_func_names(array, \"array\")\n\nreturn {\n array: array,\n typecodes: Object.keys(typecodes).join('')\n}\n\n})(__BRYTHON__)\n"], "builtins": [".js", "var $module = (function(){\n var obj = {\n __class__: __BRYTHON__.module,\n __name__: 'builtins'\n },\n builtin_names = ['ArithmeticError', 'AssertionError',\n 'AttributeError', 'BaseException', 'BaseExceptionGroup',\n 'BlockingIOError', 'BrokenPipeError', 'BufferError',\n 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError',\n 'ConnectionError', 'ConnectionRefusedError',\n 'ConnectionResetError', 'DeprecationWarning', 'EOFError',\n 'Ellipsis', 'EncodingWarning', 'EnvironmentError', 'Exception',\n 'ExceptionGroup', 'False', 'FileExistsError', 'FileNotFoundError',\n 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError',\n 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError',\n 'InterruptedError', 'IsADirectoryError', 'KeyError',\n 'KeyboardInterrupt', 'LookupError', 'MemoryError',\n 'ModuleNotFoundError', 'NameError', 'None', 'NotADirectoryError',\n 'NotImplemented', 'NotImplementedError', 'OSError',\n 'OverflowError', 'PendingDeprecationWarning', 'PermissionError',\n 'ProcessLookupError', 'RecursionError', 'ReferenceError',\n 'ResourceWarning', 'RuntimeError', 'RuntimeWarning',\n 'StopAsyncIteration', 'StopIteration', 'SyntaxError',\n 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError',\n 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError',\n 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError',\n 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning',\n 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError',\n '_', '__build_class__', '__debug__', '__import__',\n 'abs', 'aiter', 'all', 'anext', 'any', 'ascii', 'bin', 'bool',\n 'breakpoint', 'bytearray', 'bytes', 'callable', 'chr',\n 'classmethod', 'compile', 'complex', 'delattr', 'dict', 'dir',\n 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float',\n 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash',\n 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass',\n 'iter', 'len', 'list', 'locals', 'map', 'max', 'memoryview',\n 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print',\n 'property', 'quit', 'range', 'repr', 'reversed', 'round', 'set',\n 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum',\n 'super', 'tuple', 'type', 'vars', 'zip']\n for(var key of builtin_names){\n if(__BRYTHON__.builtins[key] !== undefined){\n obj[key] = __BRYTHON__.builtins[key]\n }\n }\n obj.__doc__ = 'builtins module'\n obj.copyright = 'CPython copyright'\n obj.credits = 'CPython builtins credits'\n obj.license = 'CPython license'\n return obj\n})()\n"], "dis": [".js", "var $module=(function($B){\n\nvar dict = $B.builtins.dict\nvar mod = {\n dis:function(src){\n $B.$py_module_path['__main__'] = $B.brython_path\n return __BRYTHON__.py2js(src,'__main__','__main__',\n $B.builtins_scope).to_js()\n },\n OPTIMIZED: 1,\n NEWLOCALS: 2,\n VARARGS: 4,\n VARKEYWORDS: 8,\n NESTED: 16,\n GENERATOR: 32,\n NOFREE: 64,\n COROUTINE: 128,\n ITERABLE_COROUTINE: 256,\n ASYNC_GENERATOR: 512,\n COMPILER_FLAG_NAMES: $B.builtins.dict.$factory()\n}\nmod.COMPILER_FLAG_NAMES = dict.$factory([\n [1, \"OPTIMIZED\"],\n [2, \"NEWLOCALS\"],\n [4, \"VARARGS\"],\n [8, \"VARKEYWORDS\"],\n [16, \"NESTED\"],\n [32, \"GENERATOR\"],\n [64, \"NOFREE\"],\n [128, \"COROUTINE\"],\n [256, \"ITERABLE_COROUTINE\"],\n [512, \"ASYNC_GENERATOR\"]\n])\n\nreturn mod\n\n})(__BRYTHON__)"], "encoding_cp932": [".js", "var _table = [0x00, 0x0000,0x01, 0x0001,0x02, 0x0002,0x03, 0x0003,0x04, 0x0004,0x05, 0x0005,0x06, 0x0006,0x07, 0x0007,0x08, 0x0008,0x09, 0x0009,0x0A, 0x000A,0x0B, 0x000B,0x0C, 0x000C,0x0D, 0x000D,0x0E, 0x000E,0x0F, 0x000F,0x10, 0x0010,0x11, 0x0011,0x12, 0x0012,0x13, 0x0013,0x14, 0x0014,0x15, 0x0015,0x16, 0x0016,0x17, 0x0017,0x18, 0x0018,0x19, 0x0019,0x1A, 0x001A,0x1B, 0x001B,0x1C, 0x001C,0x1D, 0x001D,0x1E, 0x001E,0x1F, 0x001F,0x20, 0x0020,0x21, 0x0021,0x22, 0x0022,0x23, 0x0023,0x24, 0x0024,0x25, 0x0025,0x26, 0x0026,0x27, 0x0027,0x28, 0x0028,0x29, 0x0029,0x2A, 0x002A,0x2B, 0x002B,0x2C, 0x002C,0x2D, 0x002D,0x2E, 0x002E,0x2F, 0x002F,0x30, 0x0030,0x31, 0x0031,0x32, 0x0032,0x33, 0x0033,0x34, 0x0034,0x35, 0x0035,0x36, 0x0036,0x37, 0x0037,0x38, 0x0038,0x39, 0x0039,0x3A, 0x003A,0x3B, 0x003B,0x3C, 0x003C,0x3D, 0x003D,0x3E, 0x003E,0x3F, 0x003F,0x40, 0x0040,0x41, 0x0041,0x42, 0x0042,0x43, 0x0043,0x44, 0x0044,0x45, 0x0045,0x46, 0x0046,0x47, 0x0047,0x48, 0x0048,0x49, 0x0049,0x4A, 0x004A,0x4B, 0x004B,0x4C, 0x004C,0x4D, 0x004D,0x4E, 0x004E,0x4F, 0x004F,0x50, 0x0050,0x51, 0x0051,0x52, 0x0052,0x53, 0x0053,0x54, 0x0054,0x55, 0x0055,0x56, 0x0056,0x57, 0x0057,0x58, 0x0058,0x59, 0x0059,0x5A, 0x005A,0x5B, 0x005B,0x5C, 0x005C,0x5D, 0x005D,0x5E, 0x005E,0x5F, 0x005F,0x60, 0x0060,0x61, 0x0061,0x62, 0x0062,0x63, 0x0063,0x64, 0x0064,0x65, 0x0065,0x66, 0x0066,0x67, 0x0067,0x68, 0x0068,0x69, 0x0069,0x6A, 0x006A,0x6B, 0x006B,0x6C, 0x006C,0x6D, 0x006D,0x6E, 0x006E,0x6F, 0x006F,0x70, 0x0070,0x71, 0x0071,0x72, 0x0072,0x73, 0x0073,0x74, 0x0074,0x75, 0x0075,0x76, 0x0076,0x77, 0x0077,0x78, 0x0078,0x79, 0x0079,0x7A, 0x007A,0x7B, 0x007B,0x7C, 0x007C,0x7D, 0x007D,0x7E, 0x007E,0x7F, 0x007F,0x80, -1,0x81, -1,0x82, -1,0x83, -1,0x84, -1,0x85, -1,0x86, -1,0x87, -1,0x88, -1,0x89, -1,0x8A, -1,0x8B, -1,0x8C, -1,0x8D, -1,0x8E, -1,0x8F, -1,0x90, -1,0x91, -1,0x92, -1,0x93, -1,0x94, -1,0x95, -1,0x96, -1,0x97, -1,0x98, -1,0x99, -1,0x9A, -1,0x9B, -1,0x9C, -1,0x9D, -1,0x9E, -1,0x9F, -1,0xA0, -1,0xA1, 0xFF61,0xA2, 0xFF62,0xA3, 0xFF63,0xA4, 0xFF64,0xA5, 0xFF65,0xA6, 0xFF66,0xA7, 0xFF67,0xA8, 0xFF68,0xA9, 0xFF69,0xAA, 0xFF6A,0xAB, 0xFF6B,0xAC, 0xFF6C,0xAD, 0xFF6D,0xAE, 0xFF6E,0xAF, 0xFF6F,0xB0, 0xFF70,0xB1, 0xFF71,0xB2, 0xFF72,0xB3, 0xFF73,0xB4, 0xFF74,0xB5, 0xFF75,0xB6, 0xFF76,0xB7, 0xFF77,0xB8, 0xFF78,0xB9, 0xFF79,0xBA, 0xFF7A,0xBB, 0xFF7B,0xBC, 0xFF7C,0xBD, 0xFF7D,0xBE, 0xFF7E,0xBF, 0xFF7F,0xC0, 0xFF80,0xC1, 0xFF81,0xC2, 0xFF82,0xC3, 0xFF83,0xC4, 0xFF84,0xC5, 0xFF85,0xC6, 0xFF86,0xC7, 0xFF87,0xC8, 0xFF88,0xC9, 0xFF89,0xCA, 0xFF8A,0xCB, 0xFF8B,0xCC, 0xFF8C,0xCD, 0xFF8D,0xCE, 0xFF8E,0xCF, 0xFF8F,0xD0, 0xFF90,0xD1, 0xFF91,0xD2, 0xFF92,0xD3, 0xFF93,0xD4, 0xFF94,0xD5, 0xFF95,0xD6, 0xFF96,0xD7, 0xFF97,0xD8, 0xFF98,0xD9, 0xFF99,0xDA, 0xFF9A,0xDB, 0xFF9B,0xDC, 0xFF9C,0xDD, 0xFF9D,0xDE, 0xFF9E,0xDF, 0xFF9F,0xE0, -1,0xE1, -1,0xE2, -1,0xE3, -1,0xE4, -1,0xE5, -1,0xE6, -1,0xE7, -1,0xE8, -1,0xE9, -1,0xEA, -1,0xEB, -1,0xEC, -1,0xED, -1,0xEE, -1,0xEF, -1,0xF0, -1,0xF1, -1,0xF2, -1,0xF3, -1,0xF4, -1,0xF5, -1,0xF6, -1,0xF7, -1,0xF8, -1,0xF9, -1,0xFA, -1,0xFB, -1,0xFC, -1,0xFD, -1,0xFE, -1,0xFF, -1,0x8140, 0x3000,0x8141, 0x3001,0x8142, 0x3002,0x8143, 0xFF0C,0x8144, 0xFF0E,0x8145, 0x30FB,0x8146, 0xFF1A,0x8147, 0xFF1B,0x8148, 0xFF1F,0x8149, 0xFF01,0x814A, 0x309B,0x814B, 0x309C,0x814C, 0x00B4,0x814D, 0xFF40,0x814E, 0x00A8,0x814F, 0xFF3E,0x8150, 0xFFE3,0x8151, 0xFF3F,0x8152, 0x30FD,0x8153, 0x30FE,0x8154, 0x309D,0x8155, 0x309E,0x8156, 0x3003,0x8157, 0x4EDD,0x8158, 0x3005,0x8159, 0x3006,0x815A, 0x3007,0x815B, 0x30FC,0x815C, 0x2015,0x815D, 0x2010,0x815E, 0xFF0F,0x815F, 0xFF3C,0x8160, 0xFF5E,0x8161, 0x2225,0x8162, 0xFF5C,0x8163, 0x2026,0x8164, 0x2025,0x8165, 0x2018,0x8166, 0x2019,0x8167, 0x201C,0x8168, 0x201D,0x8169, 0xFF08,0x816A, 0xFF09,0x816B, 0x3014,0x816C, 0x3015,0x816D, 0xFF3B,0x816E, 0xFF3D,0x816F, 0xFF5B,0x8170, 0xFF5D,0x8171, 0x3008,0x8172, 0x3009,0x8173, 0x300A,0x8174, 0x300B,0x8175, 0x300C,0x8176, 0x300D,0x8177, 0x300E,0x8178, 0x300F,0x8179, 0x3010,0x817A, 0x3011,0x817B, 0xFF0B,0x817C, 0xFF0D,0x817D, 0x00B1,0x817E, 0x00D7,0x8180, 0x00F7,0x8181, 0xFF1D,0x8182, 0x2260,0x8183, 0xFF1C,0x8184, 0xFF1E,0x8185, 0x2266,0x8186, 0x2267,0x8187, 0x221E,0x8188, 0x2234,0x8189, 0x2642,0x818A, 0x2640,0x818B, 0x00B0,0x818C, 0x2032,0x818D, 0x2033,0x818E, 0x2103,0x818F, 0xFFE5,0x8190, 0xFF04,0x8191, 0xFFE0,0x8192, 0xFFE1,0x8193, 0xFF05,0x8194, 0xFF03,0x8195, 0xFF06,0x8196, 0xFF0A,0x8197, 0xFF20,0x8198, 0x00A7,0x8199, 0x2606,0x819A, 0x2605,0x819B, 0x25CB,0x819C, 0x25CF,0x819D, 0x25CE,0x819E, 0x25C7,0x819F, 0x25C6,0x81A0, 0x25A1,0x81A1, 0x25A0,0x81A2, 0x25B3,0x81A3, 0x25B2,0x81A4, 0x25BD,0x81A5, 0x25BC,0x81A6, 0x203B,0x81A7, 0x3012,0x81A8, 0x2192,0x81A9, 0x2190,0x81AA, 0x2191,0x81AB, 0x2193,0x81AC, 0x3013,0x81B8, 0x2208,0x81B9, 0x220B,0x81BA, 0x2286,0x81BB, 0x2287,0x81BC, 0x2282,0x81BD, 0x2283,0x81BE, 0x222A,0x81BF, 0x2229,0x81C8, 0x2227,0x81C9, 0x2228,0x81CA, 0xFFE2,0x81CB, 0x21D2,0x81CC, 0x21D4,0x81CD, 0x2200,0x81CE, 0x2203,0x81DA, 0x2220,0x81DB, 0x22A5,0x81DC, 0x2312,0x81DD, 0x2202,0x81DE, 0x2207,0x81DF, 0x2261,0x81E0, 0x2252,0x81E1, 0x226A,0x81E2, 0x226B,0x81E3, 0x221A,0x81E4, 0x223D,0x81E5, 0x221D,0x81E6, 0x2235,0x81E7, 0x222B,0x81E8, 0x222C,0x81F0, 0x212B,0x81F1, 0x2030,0x81F2, 0x266F,0x81F3, 0x266D,0x81F4, 0x266A,0x81F5, 0x2020,0x81F6, 0x2021,0x81F7, 0x00B6,0x81FC, 0x25EF,0x824F, 0xFF10,0x8250, 0xFF11,0x8251, 0xFF12,0x8252, 0xFF13,0x8253, 0xFF14,0x8254, 0xFF15,0x8255, 0xFF16,0x8256, 0xFF17,0x8257, 0xFF18,0x8258, 0xFF19,0x8260, 0xFF21,0x8261, 0xFF22,0x8262, 0xFF23,0x8263, 0xFF24,0x8264, 0xFF25,0x8265, 0xFF26,0x8266, 0xFF27,0x8267, 0xFF28,0x8268, 0xFF29,0x8269, 0xFF2A,0x826A, 0xFF2B,0x826B, 0xFF2C,0x826C, 0xFF2D,0x826D, 0xFF2E,0x826E, 0xFF2F,0x826F, 0xFF30,0x8270, 0xFF31,0x8271, 0xFF32,0x8272, 0xFF33,0x8273, 0xFF34,0x8274, 0xFF35,0x8275, 0xFF36,0x8276, 0xFF37,0x8277, 0xFF38,0x8278, 0xFF39,0x8279, 0xFF3A,0x8281, 0xFF41,0x8282, 0xFF42,0x8283, 0xFF43,0x8284, 0xFF44,0x8285, 0xFF45,0x8286, 0xFF46,0x8287, 0xFF47,0x8288, 0xFF48,0x8289, 0xFF49,0x828A, 0xFF4A,0x828B, 0xFF4B,0x828C, 0xFF4C,0x828D, 0xFF4D,0x828E, 0xFF4E,0x828F, 0xFF4F,0x8290, 0xFF50,0x8291, 0xFF51,0x8292, 0xFF52,0x8293, 0xFF53,0x8294, 0xFF54,0x8295, 0xFF55,0x8296, 0xFF56,0x8297, 0xFF57,0x8298, 0xFF58,0x8299, 0xFF59,0x829A, 0xFF5A,0x829F, 0x3041,0x82A0, 0x3042,0x82A1, 0x3043,0x82A2, 0x3044,0x82A3, 0x3045,0x82A4, 0x3046,0x82A5, 0x3047,0x82A6, 0x3048,0x82A7, 0x3049,0x82A8, 0x304A,0x82A9, 0x304B,0x82AA, 0x304C,0x82AB, 0x304D,0x82AC, 0x304E,0x82AD, 0x304F,0x82AE, 0x3050,0x82AF, 0x3051,0x82B0, 0x3052,0x82B1, 0x3053,0x82B2, 0x3054,0x82B3, 0x3055,0x82B4, 0x3056,0x82B5, 0x3057,0x82B6, 0x3058,0x82B7, 0x3059,0x82B8, 0x305A,0x82B9, 0x305B,0x82BA, 0x305C,0x82BB, 0x305D,0x82BC, 0x305E,0x82BD, 0x305F,0x82BE, 0x3060,0x82BF, 0x3061,0x82C0, 0x3062,0x82C1, 0x3063,0x82C2, 0x3064,0x82C3, 0x3065,0x82C4, 0x3066,0x82C5, 0x3067,0x82C6, 0x3068,0x82C7, 0x3069,0x82C8, 0x306A,0x82C9, 0x306B,0x82CA, 0x306C,0x82CB, 0x306D,0x82CC, 0x306E,0x82CD, 0x306F,0x82CE, 0x3070,0x82CF, 0x3071,0x82D0, 0x3072,0x82D1, 0x3073,0x82D2, 0x3074,0x82D3, 0x3075,0x82D4, 0x3076,0x82D5, 0x3077,0x82D6, 0x3078,0x82D7, 0x3079,0x82D8, 0x307A,0x82D9, 0x307B,0x82DA, 0x307C,0x82DB, 0x307D,0x82DC, 0x307E,0x82DD, 0x307F,0x82DE, 0x3080,0x82DF, 0x3081,0x82E0, 0x3082,0x82E1, 0x3083,0x82E2, 0x3084,0x82E3, 0x3085,0x82E4, 0x3086,0x82E5, 0x3087,0x82E6, 0x3088,0x82E7, 0x3089,0x82E8, 0x308A,0x82E9, 0x308B,0x82EA, 0x308C,0x82EB, 0x308D,0x82EC, 0x308E,0x82ED, 0x308F,0x82EE, 0x3090,0x82EF, 0x3091,0x82F0, 0x3092,0x82F1, 0x3093,0x8340, 0x30A1,0x8341, 0x30A2,0x8342, 0x30A3,0x8343, 0x30A4,0x8344, 0x30A5,0x8345, 0x30A6,0x8346, 0x30A7,0x8347, 0x30A8,0x8348, 0x30A9,0x8349, 0x30AA,0x834A, 0x30AB,0x834B, 0x30AC,0x834C, 0x30AD,0x834D, 0x30AE,0x834E, 0x30AF,0x834F, 0x30B0,0x8350, 0x30B1,0x8351, 0x30B2,0x8352, 0x30B3,0x8353, 0x30B4,0x8354, 0x30B5,0x8355, 0x30B6,0x8356, 0x30B7,0x8357, 0x30B8,0x8358, 0x30B9,0x8359, 0x30BA,0x835A, 0x30BB,0x835B, 0x30BC,0x835C, 0x30BD,0x835D, 0x30BE,0x835E, 0x30BF,0x835F, 0x30C0,0x8360, 0x30C1,0x8361, 0x30C2,0x8362, 0x30C3,0x8363, 0x30C4,0x8364, 0x30C5,0x8365, 0x30C6,0x8366, 0x30C7,0x8367, 0x30C8,0x8368, 0x30C9,0x8369, 0x30CA,0x836A, 0x30CB,0x836B, 0x30CC,0x836C, 0x30CD,0x836D, 0x30CE,0x836E, 0x30CF,0x836F, 0x30D0,0x8370, 0x30D1,0x8371, 0x30D2,0x8372, 0x30D3,0x8373, 0x30D4,0x8374, 0x30D5,0x8375, 0x30D6,0x8376, 0x30D7,0x8377, 0x30D8,0x8378, 0x30D9,0x8379, 0x30DA,0x837A, 0x30DB,0x837B, 0x30DC,0x837C, 0x30DD,0x837D, 0x30DE,0x837E, 0x30DF,0x8380, 0x30E0,0x8381, 0x30E1,0x8382, 0x30E2,0x8383, 0x30E3,0x8384, 0x30E4,0x8385, 0x30E5,0x8386, 0x30E6,0x8387, 0x30E7,0x8388, 0x30E8,0x8389, 0x30E9,0x838A, 0x30EA,0x838B, 0x30EB,0x838C, 0x30EC,0x838D, 0x30ED,0x838E, 0x30EE,0x838F, 0x30EF,0x8390, 0x30F0,0x8391, 0x30F1,0x8392, 0x30F2,0x8393, 0x30F3,0x8394, 0x30F4,0x8395, 0x30F5,0x8396, 0x30F6,0x839F, 0x0391,0x83A0, 0x0392,0x83A1, 0x0393,0x83A2, 0x0394,0x83A3, 0x0395,0x83A4, 0x0396,0x83A5, 0x0397,0x83A6, 0x0398,0x83A7, 0x0399,0x83A8, 0x039A,0x83A9, 0x039B,0x83AA, 0x039C,0x83AB, 0x039D,0x83AC, 0x039E,0x83AD, 0x039F,0x83AE, 0x03A0,0x83AF, 0x03A1,0x83B0, 0x03A3,0x83B1, 0x03A4,0x83B2, 0x03A5,0x83B3, 0x03A6,0x83B4, 0x03A7,0x83B5, 0x03A8,0x83B6, 0x03A9,0x83BF, 0x03B1,0x83C0, 0x03B2,0x83C1, 0x03B3,0x83C2, 0x03B4,0x83C3, 0x03B5,0x83C4, 0x03B6,0x83C5, 0x03B7,0x83C6, 0x03B8,0x83C7, 0x03B9,0x83C8, 0x03BA,0x83C9, 0x03BB,0x83CA, 0x03BC,0x83CB, 0x03BD,0x83CC, 0x03BE,0x83CD, 0x03BF,0x83CE, 0x03C0,0x83CF, 0x03C1,0x83D0, 0x03C3,0x83D1, 0x03C4,0x83D2, 0x03C5,0x83D3, 0x03C6,0x83D4, 0x03C7,0x83D5, 0x03C8,0x83D6, 0x03C9,0x8440, 0x0410,0x8441, 0x0411,0x8442, 0x0412,0x8443, 0x0413,0x8444, 0x0414,0x8445, 0x0415,0x8446, 0x0401,0x8447, 0x0416,0x8448, 0x0417,0x8449, 0x0418,0x844A, 0x0419,0x844B, 0x041A,0x844C, 0x041B,0x844D, 0x041C,0x844E, 0x041D,0x844F, 0x041E,0x8450, 0x041F,0x8451, 0x0420,0x8452, 0x0421,0x8453, 0x0422,0x8454, 0x0423,0x8455, 0x0424,0x8456, 0x0425,0x8457, 0x0426,0x8458, 0x0427,0x8459, 0x0428,0x845A, 0x0429,0x845B, 0x042A,0x845C, 0x042B,0x845D, 0x042C,0x845E, 0x042D,0x845F, 0x042E,0x8460, 0x042F,0x8470, 0x0430,0x8471, 0x0431,0x8472, 0x0432,0x8473, 0x0433,0x8474, 0x0434,0x8475, 0x0435,0x8476, 0x0451,0x8477, 0x0436,0x8478, 0x0437,0x8479, 0x0438,0x847A, 0x0439,0x847B, 0x043A,0x847C, 0x043B,0x847D, 0x043C,0x847E, 0x043D,0x8480, 0x043E,0x8481, 0x043F,0x8482, 0x0440,0x8483, 0x0441,0x8484, 0x0442,0x8485, 0x0443,0x8486, 0x0444,0x8487, 0x0445,0x8488, 0x0446,0x8489, 0x0447,0x848A, 0x0448,0x848B, 0x0449,0x848C, 0x044A,0x848D, 0x044B,0x848E, 0x044C,0x848F, 0x044D,0x8490, 0x044E,0x8491, 0x044F,0x849F, 0x2500,0x84A0, 0x2502,0x84A1, 0x250C,0x84A2, 0x2510,0x84A3, 0x2518,0x84A4, 0x2514,0x84A5, 0x251C,0x84A6, 0x252C,0x84A7, 0x2524,0x84A8, 0x2534,0x84A9, 0x253C,0x84AA, 0x2501,0x84AB, 0x2503,0x84AC, 0x250F,0x84AD, 0x2513,0x84AE, 0x251B,0x84AF, 0x2517,0x84B0, 0x2523,0x84B1, 0x2533,0x84B2, 0x252B,0x84B3, 0x253B,0x84B4, 0x254B,0x84B5, 0x2520,0x84B6, 0x252F,0x84B7, 0x2528,0x84B8, 0x2537,0x84B9, 0x253F,0x84BA, 0x251D,0x84BB, 0x2530,0x84BC, 0x2525,0x84BD, 0x2538,0x84BE, 0x2542,0x8740, 0x2460,0x8741, 0x2461,0x8742, 0x2462,0x8743, 0x2463,0x8744, 0x2464,0x8745, 0x2465,0x8746, 0x2466,0x8747, 0x2467,0x8748, 0x2468,0x8749, 0x2469,0x874A, 0x246A,0x874B, 0x246B,0x874C, 0x246C,0x874D, 0x246D,0x874E, 0x246E,0x874F, 0x246F,0x8750, 0x2470,0x8751, 0x2471,0x8752, 0x2472,0x8753, 0x2473,0x8754, 0x2160,0x8755, 0x2161,0x8756, 0x2162,0x8757, 0x2163,0x8758, 0x2164,0x8759, 0x2165,0x875A, 0x2166,0x875B, 0x2167,0x875C, 0x2168,0x875D, 0x2169,0x875F, 0x3349,0x8760, 0x3314,0x8761, 0x3322,0x8762, 0x334D,0x8763, 0x3318,0x8764, 0x3327,0x8765, 0x3303,0x8766, 0x3336,0x8767, 0x3351,0x8768, 0x3357,0x8769, 0x330D,0x876A, 0x3326,0x876B, 0x3323,0x876C, 0x332B,0x876D, 0x334A,0x876E, 0x333B,0x876F, 0x339C,0x8770, 0x339D,0x8771, 0x339E,0x8772, 0x338E,0x8773, 0x338F,0x8774, 0x33C4,0x8775, 0x33A1,0x877E, 0x337B,0x8780, 0x301D,0x8781, 0x301F,0x8782, 0x2116,0x8783, 0x33CD,0x8784, 0x2121,0x8785, 0x32A4,0x8786, 0x32A5,0x8787, 0x32A6,0x8788, 0x32A7,0x8789, 0x32A8,0x878A, 0x3231,0x878B, 0x3232,0x878C, 0x3239,0x878D, 0x337E,0x878E, 0x337D,0x878F, 0x337C,0x8790, 0x2252,0x8791, 0x2261,0x8792, 0x222B,0x8793, 0x222E,0x8794, 0x2211,0x8795, 0x221A,0x8796, 0x22A5,0x8797, 0x2220,0x8798, 0x221F,0x8799, 0x22BF,0x879A, 0x2235,0x879B, 0x2229,0x879C, 0x222A,0x889F, 0x4E9C,0x88A0, 0x5516,0x88A1, 0x5A03,0x88A2, 0x963F,0x88A3, 0x54C0,0x88A4, 0x611B,0x88A5, 0x6328,0x88A6, 0x59F6,0x88A7, 0x9022,0x88A8, 0x8475,0x88A9, 0x831C,0x88AA, 0x7A50,0x88AB, 0x60AA,0x88AC, 0x63E1,0x88AD, 0x6E25,0x88AE, 0x65ED,0x88AF, 0x8466,0x88B0, 0x82A6,0x88B1, 0x9BF5,0x88B2, 0x6893,0x88B3, 0x5727,0x88B4, 0x65A1,0x88B5, 0x6271,0x88B6, 0x5B9B,0x88B7, 0x59D0,0x88B8, 0x867B,0x88B9, 0x98F4,0x88BA, 0x7D62,0x88BB, 0x7DBE,0x88BC, 0x9B8E,0x88BD, 0x6216,0x88BE, 0x7C9F,0x88BF, 0x88B7,0x88C0, 0x5B89,0x88C1, 0x5EB5,0x88C2, 0x6309,0x88C3, 0x6697,0x88C4, 0x6848,0x88C5, 0x95C7,0x88C6, 0x978D,0x88C7, 0x674F,0x88C8, 0x4EE5,0x88C9, 0x4F0A,0x88CA, 0x4F4D,0x88CB, 0x4F9D,0x88CC, 0x5049,0x88CD, 0x56F2,0x88CE, 0x5937,0x88CF, 0x59D4,0x88D0, 0x5A01,0x88D1, 0x5C09,0x88D2, 0x60DF,0x88D3, 0x610F,0x88D4, 0x6170,0x88D5, 0x6613,0x88D6, 0x6905,0x88D7, 0x70BA,0x88D8, 0x754F,0x88D9, 0x7570,0x88DA, 0x79FB,0x88DB, 0x7DAD,0x88DC, 0x7DEF,0x88DD, 0x80C3,0x88DE, 0x840E,0x88DF, 0x8863,0x88E0, 0x8B02,0x88E1, 0x9055,0x88E2, 0x907A,0x88E3, 0x533B,0x88E4, 0x4E95,0x88E5, 0x4EA5,0x88E6, 0x57DF,0x88E7, 0x80B2,0x88E8, 0x90C1,0x88E9, 0x78EF,0x88EA, 0x4E00,0x88EB, 0x58F1,0x88EC, 0x6EA2,0x88ED, 0x9038,0x88EE, 0x7A32,0x88EF, 0x8328,0x88F0, 0x828B,0x88F1, 0x9C2F,0x88F2, 0x5141,0x88F3, 0x5370,0x88F4, 0x54BD,0x88F5, 0x54E1,0x88F6, 0x56E0,0x88F7, 0x59FB,0x88F8, 0x5F15,0x88F9, 0x98F2,0x88FA, 0x6DEB,0x88FB, 0x80E4,0x88FC, 0x852D,0x8940, 0x9662,0x8941, 0x9670,0x8942, 0x96A0,0x8943, 0x97FB,0x8944, 0x540B,0x8945, 0x53F3,0x8946, 0x5B87,0x8947, 0x70CF,0x8948, 0x7FBD,0x8949, 0x8FC2,0x894A, 0x96E8,0x894B, 0x536F,0x894C, 0x9D5C,0x894D, 0x7ABA,0x894E, 0x4E11,0x894F, 0x7893,0x8950, 0x81FC,0x8951, 0x6E26,0x8952, 0x5618,0x8953, 0x5504,0x8954, 0x6B1D,0x8955, 0x851A,0x8956, 0x9C3B,0x8957, 0x59E5,0x8958, 0x53A9,0x8959, 0x6D66,0x895A, 0x74DC,0x895B, 0x958F,0x895C, 0x5642,0x895D, 0x4E91,0x895E, 0x904B,0x895F, 0x96F2,0x8960, 0x834F,0x8961, 0x990C,0x8962, 0x53E1,0x8963, 0x55B6,0x8964, 0x5B30,0x8965, 0x5F71,0x8966, 0x6620,0x8967, 0x66F3,0x8968, 0x6804,0x8969, 0x6C38,0x896A, 0x6CF3,0x896B, 0x6D29,0x896C, 0x745B,0x896D, 0x76C8,0x896E, 0x7A4E,0x896F, 0x9834,0x8970, 0x82F1,0x8971, 0x885B,0x8972, 0x8A60,0x8973, 0x92ED,0x8974, 0x6DB2,0x8975, 0x75AB,0x8976, 0x76CA,0x8977, 0x99C5,0x8978, 0x60A6,0x8979, 0x8B01,0x897A, 0x8D8A,0x897B, 0x95B2,0x897C, 0x698E,0x897D, 0x53AD,0x897E, 0x5186,0x8980, 0x5712,0x8981, 0x5830,0x8982, 0x5944,0x8983, 0x5BB4,0x8984, 0x5EF6,0x8985, 0x6028,0x8986, 0x63A9,0x8987, 0x63F4,0x8988, 0x6CBF,0x8989, 0x6F14,0x898A, 0x708E,0x898B, 0x7114,0x898C, 0x7159,0x898D, 0x71D5,0x898E, 0x733F,0x898F, 0x7E01,0x8990, 0x8276,0x8991, 0x82D1,0x8992, 0x8597,0x8993, 0x9060,0x8994, 0x925B,0x8995, 0x9D1B,0x8996, 0x5869,0x8997, 0x65BC,0x8998, 0x6C5A,0x8999, 0x7525,0x899A, 0x51F9,0x899B, 0x592E,0x899C, 0x5965,0x899D, 0x5F80,0x899E, 0x5FDC,0x899F, 0x62BC,0x89A0, 0x65FA,0x89A1, 0x6A2A,0x89A2, 0x6B27,0x89A3, 0x6BB4,0x89A4, 0x738B,0x89A5, 0x7FC1,0x89A6, 0x8956,0x89A7, 0x9D2C,0x89A8, 0x9D0E,0x89A9, 0x9EC4,0x89AA, 0x5CA1,0x89AB, 0x6C96,0x89AC, 0x837B,0x89AD, 0x5104,0x89AE, 0x5C4B,0x89AF, 0x61B6,0x89B0, 0x81C6,0x89B1, 0x6876,0x89B2, 0x7261,0x89B3, 0x4E59,0x89B4, 0x4FFA,0x89B5, 0x5378,0x89B6, 0x6069,0x89B7, 0x6E29,0x89B8, 0x7A4F,0x89B9, 0x97F3,0x89BA, 0x4E0B,0x89BB, 0x5316,0x89BC, 0x4EEE,0x89BD, 0x4F55,0x89BE, 0x4F3D,0x89BF, 0x4FA1,0x89C0, 0x4F73,0x89C1, 0x52A0,0x89C2, 0x53EF,0x89C3, 0x5609,0x89C4, 0x590F,0x89C5, 0x5AC1,0x89C6, 0x5BB6,0x89C7, 0x5BE1,0x89C8, 0x79D1,0x89C9, 0x6687,0x89CA, 0x679C,0x89CB, 0x67B6,0x89CC, 0x6B4C,0x89CD, 0x6CB3,0x89CE, 0x706B,0x89CF, 0x73C2,0x89D0, 0x798D,0x89D1, 0x79BE,0x89D2, 0x7A3C,0x89D3, 0x7B87,0x89D4, 0x82B1,0x89D5, 0x82DB,0x89D6, 0x8304,0x89D7, 0x8377,0x89D8, 0x83EF,0x89D9, 0x83D3,0x89DA, 0x8766,0x89DB, 0x8AB2,0x89DC, 0x5629,0x89DD, 0x8CA8,0x89DE, 0x8FE6,0x89DF, 0x904E,0x89E0, 0x971E,0x89E1, 0x868A,0x89E2, 0x4FC4,0x89E3, 0x5CE8,0x89E4, 0x6211,0x89E5, 0x7259,0x89E6, 0x753B,0x89E7, 0x81E5,0x89E8, 0x82BD,0x89E9, 0x86FE,0x89EA, 0x8CC0,0x89EB, 0x96C5,0x89EC, 0x9913,0x89ED, 0x99D5,0x89EE, 0x4ECB,0x89EF, 0x4F1A,0x89F0, 0x89E3,0x89F1, 0x56DE,0x89F2, 0x584A,0x89F3, 0x58CA,0x89F4, 0x5EFB,0x89F5, 0x5FEB,0x89F6, 0x602A,0x89F7, 0x6094,0x89F8, 0x6062,0x89F9, 0x61D0,0x89FA, 0x6212,0x89FB, 0x62D0,0x89FC, 0x6539,0x8A40, 0x9B41,0x8A41, 0x6666,0x8A42, 0x68B0,0x8A43, 0x6D77,0x8A44, 0x7070,0x8A45, 0x754C,0x8A46, 0x7686,0x8A47, 0x7D75,0x8A48, 0x82A5,0x8A49, 0x87F9,0x8A4A, 0x958B,0x8A4B, 0x968E,0x8A4C, 0x8C9D,0x8A4D, 0x51F1,0x8A4E, 0x52BE,0x8A4F, 0x5916,0x8A50, 0x54B3,0x8A51, 0x5BB3,0x8A52, 0x5D16,0x8A53, 0x6168,0x8A54, 0x6982,0x8A55, 0x6DAF,0x8A56, 0x788D,0x8A57, 0x84CB,0x8A58, 0x8857,0x8A59, 0x8A72,0x8A5A, 0x93A7,0x8A5B, 0x9AB8,0x8A5C, 0x6D6C,0x8A5D, 0x99A8,0x8A5E, 0x86D9,0x8A5F, 0x57A3,0x8A60, 0x67FF,0x8A61, 0x86CE,0x8A62, 0x920E,0x8A63, 0x5283,0x8A64, 0x5687,0x8A65, 0x5404,0x8A66, 0x5ED3,0x8A67, 0x62E1,0x8A68, 0x64B9,0x8A69, 0x683C,0x8A6A, 0x6838,0x8A6B, 0x6BBB,0x8A6C, 0x7372,0x8A6D, 0x78BA,0x8A6E, 0x7A6B,0x8A6F, 0x899A,0x8A70, 0x89D2,0x8A71, 0x8D6B,0x8A72, 0x8F03,0x8A73, 0x90ED,0x8A74, 0x95A3,0x8A75, 0x9694,0x8A76, 0x9769,0x8A77, 0x5B66,0x8A78, 0x5CB3,0x8A79, 0x697D,0x8A7A, 0x984D,0x8A7B, 0x984E,0x8A7C, 0x639B,0x8A7D, 0x7B20,0x8A7E, 0x6A2B,0x8A80, 0x6A7F,0x8A81, 0x68B6,0x8A82, 0x9C0D,0x8A83, 0x6F5F,0x8A84, 0x5272,0x8A85, 0x559D,0x8A86, 0x6070,0x8A87, 0x62EC,0x8A88, 0x6D3B,0x8A89, 0x6E07,0x8A8A, 0x6ED1,0x8A8B, 0x845B,0x8A8C, 0x8910,0x8A8D, 0x8F44,0x8A8E, 0x4E14,0x8A8F, 0x9C39,0x8A90, 0x53F6,0x8A91, 0x691B,0x8A92, 0x6A3A,0x8A93, 0x9784,0x8A94, 0x682A,0x8A95, 0x515C,0x8A96, 0x7AC3,0x8A97, 0x84B2,0x8A98, 0x91DC,0x8A99, 0x938C,0x8A9A, 0x565B,0x8A9B, 0x9D28,0x8A9C, 0x6822,0x8A9D, 0x8305,0x8A9E, 0x8431,0x8A9F, 0x7CA5,0x8AA0, 0x5208,0x8AA1, 0x82C5,0x8AA2, 0x74E6,0x8AA3, 0x4E7E,0x8AA4, 0x4F83,0x8AA5, 0x51A0,0x8AA6, 0x5BD2,0x8AA7, 0x520A,0x8AA8, 0x52D8,0x8AA9, 0x52E7,0x8AAA, 0x5DFB,0x8AAB, 0x559A,0x8AAC, 0x582A,0x8AAD, 0x59E6,0x8AAE, 0x5B8C,0x8AAF, 0x5B98,0x8AB0, 0x5BDB,0x8AB1, 0x5E72,0x8AB2, 0x5E79,0x8AB3, 0x60A3,0x8AB4, 0x611F,0x8AB5, 0x6163,0x8AB6, 0x61BE,0x8AB7, 0x63DB,0x8AB8, 0x6562,0x8AB9, 0x67D1,0x8ABA, 0x6853,0x8ABB, 0x68FA,0x8ABC, 0x6B3E,0x8ABD, 0x6B53,0x8ABE, 0x6C57,0x8ABF, 0x6F22,0x8AC0, 0x6F97,0x8AC1, 0x6F45,0x8AC2, 0x74B0,0x8AC3, 0x7518,0x8AC4, 0x76E3,0x8AC5, 0x770B,0x8AC6, 0x7AFF,0x8AC7, 0x7BA1,0x8AC8, 0x7C21,0x8AC9, 0x7DE9,0x8ACA, 0x7F36,0x8ACB, 0x7FF0,0x8ACC, 0x809D,0x8ACD, 0x8266,0x8ACE, 0x839E,0x8ACF, 0x89B3,0x8AD0, 0x8ACC,0x8AD1, 0x8CAB,0x8AD2, 0x9084,0x8AD3, 0x9451,0x8AD4, 0x9593,0x8AD5, 0x9591,0x8AD6, 0x95A2,0x8AD7, 0x9665,0x8AD8, 0x97D3,0x8AD9, 0x9928,0x8ADA, 0x8218,0x8ADB, 0x4E38,0x8ADC, 0x542B,0x8ADD, 0x5CB8,0x8ADE, 0x5DCC,0x8ADF, 0x73A9,0x8AE0, 0x764C,0x8AE1, 0x773C,0x8AE2, 0x5CA9,0x8AE3, 0x7FEB,0x8AE4, 0x8D0B,0x8AE5, 0x96C1,0x8AE6, 0x9811,0x8AE7, 0x9854,0x8AE8, 0x9858,0x8AE9, 0x4F01,0x8AEA, 0x4F0E,0x8AEB, 0x5371,0x8AEC, 0x559C,0x8AED, 0x5668,0x8AEE, 0x57FA,0x8AEF, 0x5947,0x8AF0, 0x5B09,0x8AF1, 0x5BC4,0x8AF2, 0x5C90,0x8AF3, 0x5E0C,0x8AF4, 0x5E7E,0x8AF5, 0x5FCC,0x8AF6, 0x63EE,0x8AF7, 0x673A,0x8AF8, 0x65D7,0x8AF9, 0x65E2,0x8AFA, 0x671F,0x8AFB, 0x68CB,0x8AFC, 0x68C4,0x8B40, 0x6A5F,0x8B41, 0x5E30,0x8B42, 0x6BC5,0x8B43, 0x6C17,0x8B44, 0x6C7D,0x8B45, 0x757F,0x8B46, 0x7948,0x8B47, 0x5B63,0x8B48, 0x7A00,0x8B49, 0x7D00,0x8B4A, 0x5FBD,0x8B4B, 0x898F,0x8B4C, 0x8A18,0x8B4D, 0x8CB4,0x8B4E, 0x8D77,0x8B4F, 0x8ECC,0x8B50, 0x8F1D,0x8B51, 0x98E2,0x8B52, 0x9A0E,0x8B53, 0x9B3C,0x8B54, 0x4E80,0x8B55, 0x507D,0x8B56, 0x5100,0x8B57, 0x5993,0x8B58, 0x5B9C,0x8B59, 0x622F,0x8B5A, 0x6280,0x8B5B, 0x64EC,0x8B5C, 0x6B3A,0x8B5D, 0x72A0,0x8B5E, 0x7591,0x8B5F, 0x7947,0x8B60, 0x7FA9,0x8B61, 0x87FB,0x8B62, 0x8ABC,0x8B63, 0x8B70,0x8B64, 0x63AC,0x8B65, 0x83CA,0x8B66, 0x97A0,0x8B67, 0x5409,0x8B68, 0x5403,0x8B69, 0x55AB,0x8B6A, 0x6854,0x8B6B, 0x6A58,0x8B6C, 0x8A70,0x8B6D, 0x7827,0x8B6E, 0x6775,0x8B6F, 0x9ECD,0x8B70, 0x5374,0x8B71, 0x5BA2,0x8B72, 0x811A,0x8B73, 0x8650,0x8B74, 0x9006,0x8B75, 0x4E18,0x8B76, 0x4E45,0x8B77, 0x4EC7,0x8B78, 0x4F11,0x8B79, 0x53CA,0x8B7A, 0x5438,0x8B7B, 0x5BAE,0x8B7C, 0x5F13,0x8B7D, 0x6025,0x8B7E, 0x6551,0x8B80, 0x673D,0x8B81, 0x6C42,0x8B82, 0x6C72,0x8B83, 0x6CE3,0x8B84, 0x7078,0x8B85, 0x7403,0x8B86, 0x7A76,0x8B87, 0x7AAE,0x8B88, 0x7B08,0x8B89, 0x7D1A,0x8B8A, 0x7CFE,0x8B8B, 0x7D66,0x8B8C, 0x65E7,0x8B8D, 0x725B,0x8B8E, 0x53BB,0x8B8F, 0x5C45,0x8B90, 0x5DE8,0x8B91, 0x62D2,0x8B92, 0x62E0,0x8B93, 0x6319,0x8B94, 0x6E20,0x8B95, 0x865A,0x8B96, 0x8A31,0x8B97, 0x8DDD,0x8B98, 0x92F8,0x8B99, 0x6F01,0x8B9A, 0x79A6,0x8B9B, 0x9B5A,0x8B9C, 0x4EA8,0x8B9D, 0x4EAB,0x8B9E, 0x4EAC,0x8B9F, 0x4F9B,0x8BA0, 0x4FA0,0x8BA1, 0x50D1,0x8BA2, 0x5147,0x8BA3, 0x7AF6,0x8BA4, 0x5171,0x8BA5, 0x51F6,0x8BA6, 0x5354,0x8BA7, 0x5321,0x8BA8, 0x537F,0x8BA9, 0x53EB,0x8BAA, 0x55AC,0x8BAB, 0x5883,0x8BAC, 0x5CE1,0x8BAD, 0x5F37,0x8BAE, 0x5F4A,0x8BAF, 0x602F,0x8BB0, 0x6050,0x8BB1, 0x606D,0x8BB2, 0x631F,0x8BB3, 0x6559,0x8BB4, 0x6A4B,0x8BB5, 0x6CC1,0x8BB6, 0x72C2,0x8BB7, 0x72ED,0x8BB8, 0x77EF,0x8BB9, 0x80F8,0x8BBA, 0x8105,0x8BBB, 0x8208,0x8BBC, 0x854E,0x8BBD, 0x90F7,0x8BBE, 0x93E1,0x8BBF, 0x97FF,0x8BC0, 0x9957,0x8BC1, 0x9A5A,0x8BC2, 0x4EF0,0x8BC3, 0x51DD,0x8BC4, 0x5C2D,0x8BC5, 0x6681,0x8BC6, 0x696D,0x8BC7, 0x5C40,0x8BC8, 0x66F2,0x8BC9, 0x6975,0x8BCA, 0x7389,0x8BCB, 0x6850,0x8BCC, 0x7C81,0x8BCD, 0x50C5,0x8BCE, 0x52E4,0x8BCF, 0x5747,0x8BD0, 0x5DFE,0x8BD1, 0x9326,0x8BD2, 0x65A4,0x8BD3, 0x6B23,0x8BD4, 0x6B3D,0x8BD5, 0x7434,0x8BD6, 0x7981,0x8BD7, 0x79BD,0x8BD8, 0x7B4B,0x8BD9, 0x7DCA,0x8BDA, 0x82B9,0x8BDB, 0x83CC,0x8BDC, 0x887F,0x8BDD, 0x895F,0x8BDE, 0x8B39,0x8BDF, 0x8FD1,0x8BE0, 0x91D1,0x8BE1, 0x541F,0x8BE2, 0x9280,0x8BE3, 0x4E5D,0x8BE4, 0x5036,0x8BE5, 0x53E5,0x8BE6, 0x533A,0x8BE7, 0x72D7,0x8BE8, 0x7396,0x8BE9, 0x77E9,0x8BEA, 0x82E6,0x8BEB, 0x8EAF,0x8BEC, 0x99C6,0x8BED, 0x99C8,0x8BEE, 0x99D2,0x8BEF, 0x5177,0x8BF0, 0x611A,0x8BF1, 0x865E,0x8BF2, 0x55B0,0x8BF3, 0x7A7A,0x8BF4, 0x5076,0x8BF5, 0x5BD3,0x8BF6, 0x9047,0x8BF7, 0x9685,0x8BF8, 0x4E32,0x8BF9, 0x6ADB,0x8BFA, 0x91E7,0x8BFB, 0x5C51,0x8BFC, 0x5C48,0x8C40, 0x6398,0x8C41, 0x7A9F,0x8C42, 0x6C93,0x8C43, 0x9774,0x8C44, 0x8F61,0x8C45, 0x7AAA,0x8C46, 0x718A,0x8C47, 0x9688,0x8C48, 0x7C82,0x8C49, 0x6817,0x8C4A, 0x7E70,0x8C4B, 0x6851,0x8C4C, 0x936C,0x8C4D, 0x52F2,0x8C4E, 0x541B,0x8C4F, 0x85AB,0x8C50, 0x8A13,0x8C51, 0x7FA4,0x8C52, 0x8ECD,0x8C53, 0x90E1,0x8C54, 0x5366,0x8C55, 0x8888,0x8C56, 0x7941,0x8C57, 0x4FC2,0x8C58, 0x50BE,0x8C59, 0x5211,0x8C5A, 0x5144,0x8C5B, 0x5553,0x8C5C, 0x572D,0x8C5D, 0x73EA,0x8C5E, 0x578B,0x8C5F, 0x5951,0x8C60, 0x5F62,0x8C61, 0x5F84,0x8C62, 0x6075,0x8C63, 0x6176,0x8C64, 0x6167,0x8C65, 0x61A9,0x8C66, 0x63B2,0x8C67, 0x643A,0x8C68, 0x656C,0x8C69, 0x666F,0x8C6A, 0x6842,0x8C6B, 0x6E13,0x8C6C, 0x7566,0x8C6D, 0x7A3D,0x8C6E, 0x7CFB,0x8C6F, 0x7D4C,0x8C70, 0x7D99,0x8C71, 0x7E4B,0x8C72, 0x7F6B,0x8C73, 0x830E,0x8C74, 0x834A,0x8C75, 0x86CD,0x8C76, 0x8A08,0x8C77, 0x8A63,0x8C78, 0x8B66,0x8C79, 0x8EFD,0x8C7A, 0x981A,0x8C7B, 0x9D8F,0x8C7C, 0x82B8,0x8C7D, 0x8FCE,0x8C7E, 0x9BE8,0x8C80, 0x5287,0x8C81, 0x621F,0x8C82, 0x6483,0x8C83, 0x6FC0,0x8C84, 0x9699,0x8C85, 0x6841,0x8C86, 0x5091,0x8C87, 0x6B20,0x8C88, 0x6C7A,0x8C89, 0x6F54,0x8C8A, 0x7A74,0x8C8B, 0x7D50,0x8C8C, 0x8840,0x8C8D, 0x8A23,0x8C8E, 0x6708,0x8C8F, 0x4EF6,0x8C90, 0x5039,0x8C91, 0x5026,0x8C92, 0x5065,0x8C93, 0x517C,0x8C94, 0x5238,0x8C95, 0x5263,0x8C96, 0x55A7,0x8C97, 0x570F,0x8C98, 0x5805,0x8C99, 0x5ACC,0x8C9A, 0x5EFA,0x8C9B, 0x61B2,0x8C9C, 0x61F8,0x8C9D, 0x62F3,0x8C9E, 0x6372,0x8C9F, 0x691C,0x8CA0, 0x6A29,0x8CA1, 0x727D,0x8CA2, 0x72AC,0x8CA3, 0x732E,0x8CA4, 0x7814,0x8CA5, 0x786F,0x8CA6, 0x7D79,0x8CA7, 0x770C,0x8CA8, 0x80A9,0x8CA9, 0x898B,0x8CAA, 0x8B19,0x8CAB, 0x8CE2,0x8CAC, 0x8ED2,0x8CAD, 0x9063,0x8CAE, 0x9375,0x8CAF, 0x967A,0x8CB0, 0x9855,0x8CB1, 0x9A13,0x8CB2, 0x9E78,0x8CB3, 0x5143,0x8CB4, 0x539F,0x8CB5, 0x53B3,0x8CB6, 0x5E7B,0x8CB7, 0x5F26,0x8CB8, 0x6E1B,0x8CB9, 0x6E90,0x8CBA, 0x7384,0x8CBB, 0x73FE,0x8CBC, 0x7D43,0x8CBD, 0x8237,0x8CBE, 0x8A00,0x8CBF, 0x8AFA,0x8CC0, 0x9650,0x8CC1, 0x4E4E,0x8CC2, 0x500B,0x8CC3, 0x53E4,0x8CC4, 0x547C,0x8CC5, 0x56FA,0x8CC6, 0x59D1,0x8CC7, 0x5B64,0x8CC8, 0x5DF1,0x8CC9, 0x5EAB,0x8CCA, 0x5F27,0x8CCB, 0x6238,0x8CCC, 0x6545,0x8CCD, 0x67AF,0x8CCE, 0x6E56,0x8CCF, 0x72D0,0x8CD0, 0x7CCA,0x8CD1, 0x88B4,0x8CD2, 0x80A1,0x8CD3, 0x80E1,0x8CD4, 0x83F0,0x8CD5, 0x864E,0x8CD6, 0x8A87,0x8CD7, 0x8DE8,0x8CD8, 0x9237,0x8CD9, 0x96C7,0x8CDA, 0x9867,0x8CDB, 0x9F13,0x8CDC, 0x4E94,0x8CDD, 0x4E92,0x8CDE, 0x4F0D,0x8CDF, 0x5348,0x8CE0, 0x5449,0x8CE1, 0x543E,0x8CE2, 0x5A2F,0x8CE3, 0x5F8C,0x8CE4, 0x5FA1,0x8CE5, 0x609F,0x8CE6, 0x68A7,0x8CE7, 0x6A8E,0x8CE8, 0x745A,0x8CE9, 0x7881,0x8CEA, 0x8A9E,0x8CEB, 0x8AA4,0x8CEC, 0x8B77,0x8CED, 0x9190,0x8CEE, 0x4E5E,0x8CEF, 0x9BC9,0x8CF0, 0x4EA4,0x8CF1, 0x4F7C,0x8CF2, 0x4FAF,0x8CF3, 0x5019,0x8CF4, 0x5016,0x8CF5, 0x5149,0x8CF6, 0x516C,0x8CF7, 0x529F,0x8CF8, 0x52B9,0x8CF9, 0x52FE,0x8CFA, 0x539A,0x8CFB, 0x53E3,0x8CFC, 0x5411,0x8D40, 0x540E,0x8D41, 0x5589,0x8D42, 0x5751,0x8D43, 0x57A2,0x8D44, 0x597D,0x8D45, 0x5B54,0x8D46, 0x5B5D,0x8D47, 0x5B8F,0x8D48, 0x5DE5,0x8D49, 0x5DE7,0x8D4A, 0x5DF7,0x8D4B, 0x5E78,0x8D4C, 0x5E83,0x8D4D, 0x5E9A,0x8D4E, 0x5EB7,0x8D4F, 0x5F18,0x8D50, 0x6052,0x8D51, 0x614C,0x8D52, 0x6297,0x8D53, 0x62D8,0x8D54, 0x63A7,0x8D55, 0x653B,0x8D56, 0x6602,0x8D57, 0x6643,0x8D58, 0x66F4,0x8D59, 0x676D,0x8D5A, 0x6821,0x8D5B, 0x6897,0x8D5C, 0x69CB,0x8D5D, 0x6C5F,0x8D5E, 0x6D2A,0x8D5F, 0x6D69,0x8D60, 0x6E2F,0x8D61, 0x6E9D,0x8D62, 0x7532,0x8D63, 0x7687,0x8D64, 0x786C,0x8D65, 0x7A3F,0x8D66, 0x7CE0,0x8D67, 0x7D05,0x8D68, 0x7D18,0x8D69, 0x7D5E,0x8D6A, 0x7DB1,0x8D6B, 0x8015,0x8D6C, 0x8003,0x8D6D, 0x80AF,0x8D6E, 0x80B1,0x8D6F, 0x8154,0x8D70, 0x818F,0x8D71, 0x822A,0x8D72, 0x8352,0x8D73, 0x884C,0x8D74, 0x8861,0x8D75, 0x8B1B,0x8D76, 0x8CA2,0x8D77, 0x8CFC,0x8D78, 0x90CA,0x8D79, 0x9175,0x8D7A, 0x9271,0x8D7B, 0x783F,0x8D7C, 0x92FC,0x8D7D, 0x95A4,0x8D7E, 0x964D,0x8D80, 0x9805,0x8D81, 0x9999,0x8D82, 0x9AD8,0x8D83, 0x9D3B,0x8D84, 0x525B,0x8D85, 0x52AB,0x8D86, 0x53F7,0x8D87, 0x5408,0x8D88, 0x58D5,0x8D89, 0x62F7,0x8D8A, 0x6FE0,0x8D8B, 0x8C6A,0x8D8C, 0x8F5F,0x8D8D, 0x9EB9,0x8D8E, 0x514B,0x8D8F, 0x523B,0x8D90, 0x544A,0x8D91, 0x56FD,0x8D92, 0x7A40,0x8D93, 0x9177,0x8D94, 0x9D60,0x8D95, 0x9ED2,0x8D96, 0x7344,0x8D97, 0x6F09,0x8D98, 0x8170,0x8D99, 0x7511,0x8D9A, 0x5FFD,0x8D9B, 0x60DA,0x8D9C, 0x9AA8,0x8D9D, 0x72DB,0x8D9E, 0x8FBC,0x8D9F, 0x6B64,0x8DA0, 0x9803,0x8DA1, 0x4ECA,0x8DA2, 0x56F0,0x8DA3, 0x5764,0x8DA4, 0x58BE,0x8DA5, 0x5A5A,0x8DA6, 0x6068,0x8DA7, 0x61C7,0x8DA8, 0x660F,0x8DA9, 0x6606,0x8DAA, 0x6839,0x8DAB, 0x68B1,0x8DAC, 0x6DF7,0x8DAD, 0x75D5,0x8DAE, 0x7D3A,0x8DAF, 0x826E,0x8DB0, 0x9B42,0x8DB1, 0x4E9B,0x8DB2, 0x4F50,0x8DB3, 0x53C9,0x8DB4, 0x5506,0x8DB5, 0x5D6F,0x8DB6, 0x5DE6,0x8DB7, 0x5DEE,0x8DB8, 0x67FB,0x8DB9, 0x6C99,0x8DBA, 0x7473,0x8DBB, 0x7802,0x8DBC, 0x8A50,0x8DBD, 0x9396,0x8DBE, 0x88DF,0x8DBF, 0x5750,0x8DC0, 0x5EA7,0x8DC1, 0x632B,0x8DC2, 0x50B5,0x8DC3, 0x50AC,0x8DC4, 0x518D,0x8DC5, 0x6700,0x8DC6, 0x54C9,0x8DC7, 0x585E,0x8DC8, 0x59BB,0x8DC9, 0x5BB0,0x8DCA, 0x5F69,0x8DCB, 0x624D,0x8DCC, 0x63A1,0x8DCD, 0x683D,0x8DCE, 0x6B73,0x8DCF, 0x6E08,0x8DD0, 0x707D,0x8DD1, 0x91C7,0x8DD2, 0x7280,0x8DD3, 0x7815,0x8DD4, 0x7826,0x8DD5, 0x796D,0x8DD6, 0x658E,0x8DD7, 0x7D30,0x8DD8, 0x83DC,0x8DD9, 0x88C1,0x8DDA, 0x8F09,0x8DDB, 0x969B,0x8DDC, 0x5264,0x8DDD, 0x5728,0x8DDE, 0x6750,0x8DDF, 0x7F6A,0x8DE0, 0x8CA1,0x8DE1, 0x51B4,0x8DE2, 0x5742,0x8DE3, 0x962A,0x8DE4, 0x583A,0x8DE5, 0x698A,0x8DE6, 0x80B4,0x8DE7, 0x54B2,0x8DE8, 0x5D0E,0x8DE9, 0x57FC,0x8DEA, 0x7895,0x8DEB, 0x9DFA,0x8DEC, 0x4F5C,0x8DED, 0x524A,0x8DEE, 0x548B,0x8DEF, 0x643E,0x8DF0, 0x6628,0x8DF1, 0x6714,0x8DF2, 0x67F5,0x8DF3, 0x7A84,0x8DF4, 0x7B56,0x8DF5, 0x7D22,0x8DF6, 0x932F,0x8DF7, 0x685C,0x8DF8, 0x9BAD,0x8DF9, 0x7B39,0x8DFA, 0x5319,0x8DFB, 0x518A,0x8DFC, 0x5237,0x8E40, 0x5BDF,0x8E41, 0x62F6,0x8E42, 0x64AE,0x8E43, 0x64E6,0x8E44, 0x672D,0x8E45, 0x6BBA,0x8E46, 0x85A9,0x8E47, 0x96D1,0x8E48, 0x7690,0x8E49, 0x9BD6,0x8E4A, 0x634C,0x8E4B, 0x9306,0x8E4C, 0x9BAB,0x8E4D, 0x76BF,0x8E4E, 0x6652,0x8E4F, 0x4E09,0x8E50, 0x5098,0x8E51, 0x53C2,0x8E52, 0x5C71,0x8E53, 0x60E8,0x8E54, 0x6492,0x8E55, 0x6563,0x8E56, 0x685F,0x8E57, 0x71E6,0x8E58, 0x73CA,0x8E59, 0x7523,0x8E5A, 0x7B97,0x8E5B, 0x7E82,0x8E5C, 0x8695,0x8E5D, 0x8B83,0x8E5E, 0x8CDB,0x8E5F, 0x9178,0x8E60, 0x9910,0x8E61, 0x65AC,0x8E62, 0x66AB,0x8E63, 0x6B8B,0x8E64, 0x4ED5,0x8E65, 0x4ED4,0x8E66, 0x4F3A,0x8E67, 0x4F7F,0x8E68, 0x523A,0x8E69, 0x53F8,0x8E6A, 0x53F2,0x8E6B, 0x55E3,0x8E6C, 0x56DB,0x8E6D, 0x58EB,0x8E6E, 0x59CB,0x8E6F, 0x59C9,0x8E70, 0x59FF,0x8E71, 0x5B50,0x8E72, 0x5C4D,0x8E73, 0x5E02,0x8E74, 0x5E2B,0x8E75, 0x5FD7,0x8E76, 0x601D,0x8E77, 0x6307,0x8E78, 0x652F,0x8E79, 0x5B5C,0x8E7A, 0x65AF,0x8E7B, 0x65BD,0x8E7C, 0x65E8,0x8E7D, 0x679D,0x8E7E, 0x6B62,0x8E80, 0x6B7B,0x8E81, 0x6C0F,0x8E82, 0x7345,0x8E83, 0x7949,0x8E84, 0x79C1,0x8E85, 0x7CF8,0x8E86, 0x7D19,0x8E87, 0x7D2B,0x8E88, 0x80A2,0x8E89, 0x8102,0x8E8A, 0x81F3,0x8E8B, 0x8996,0x8E8C, 0x8A5E,0x8E8D, 0x8A69,0x8E8E, 0x8A66,0x8E8F, 0x8A8C,0x8E90, 0x8AEE,0x8E91, 0x8CC7,0x8E92, 0x8CDC,0x8E93, 0x96CC,0x8E94, 0x98FC,0x8E95, 0x6B6F,0x8E96, 0x4E8B,0x8E97, 0x4F3C,0x8E98, 0x4F8D,0x8E99, 0x5150,0x8E9A, 0x5B57,0x8E9B, 0x5BFA,0x8E9C, 0x6148,0x8E9D, 0x6301,0x8E9E, 0x6642,0x8E9F, 0x6B21,0x8EA0, 0x6ECB,0x8EA1, 0x6CBB,0x8EA2, 0x723E,0x8EA3, 0x74BD,0x8EA4, 0x75D4,0x8EA5, 0x78C1,0x8EA6, 0x793A,0x8EA7, 0x800C,0x8EA8, 0x8033,0x8EA9, 0x81EA,0x8EAA, 0x8494,0x8EAB, 0x8F9E,0x8EAC, 0x6C50,0x8EAD, 0x9E7F,0x8EAE, 0x5F0F,0x8EAF, 0x8B58,0x8EB0, 0x9D2B,0x8EB1, 0x7AFA,0x8EB2, 0x8EF8,0x8EB3, 0x5B8D,0x8EB4, 0x96EB,0x8EB5, 0x4E03,0x8EB6, 0x53F1,0x8EB7, 0x57F7,0x8EB8, 0x5931,0x8EB9, 0x5AC9,0x8EBA, 0x5BA4,0x8EBB, 0x6089,0x8EBC, 0x6E7F,0x8EBD, 0x6F06,0x8EBE, 0x75BE,0x8EBF, 0x8CEA,0x8EC0, 0x5B9F,0x8EC1, 0x8500,0x8EC2, 0x7BE0,0x8EC3, 0x5072,0x8EC4, 0x67F4,0x8EC5, 0x829D,0x8EC6, 0x5C61,0x8EC7, 0x854A,0x8EC8, 0x7E1E,0x8EC9, 0x820E,0x8ECA, 0x5199,0x8ECB, 0x5C04,0x8ECC, 0x6368,0x8ECD, 0x8D66,0x8ECE, 0x659C,0x8ECF, 0x716E,0x8ED0, 0x793E,0x8ED1, 0x7D17,0x8ED2, 0x8005,0x8ED3, 0x8B1D,0x8ED4, 0x8ECA,0x8ED5, 0x906E,0x8ED6, 0x86C7,0x8ED7, 0x90AA,0x8ED8, 0x501F,0x8ED9, 0x52FA,0x8EDA, 0x5C3A,0x8EDB, 0x6753,0x8EDC, 0x707C,0x8EDD, 0x7235,0x8EDE, 0x914C,0x8EDF, 0x91C8,0x8EE0, 0x932B,0x8EE1, 0x82E5,0x8EE2, 0x5BC2,0x8EE3, 0x5F31,0x8EE4, 0x60F9,0x8EE5, 0x4E3B,0x8EE6, 0x53D6,0x8EE7, 0x5B88,0x8EE8, 0x624B,0x8EE9, 0x6731,0x8EEA, 0x6B8A,0x8EEB, 0x72E9,0x8EEC, 0x73E0,0x8EED, 0x7A2E,0x8EEE, 0x816B,0x8EEF, 0x8DA3,0x8EF0, 0x9152,0x8EF1, 0x9996,0x8EF2, 0x5112,0x8EF3, 0x53D7,0x8EF4, 0x546A,0x8EF5, 0x5BFF,0x8EF6, 0x6388,0x8EF7, 0x6A39,0x8EF8, 0x7DAC,0x8EF9, 0x9700,0x8EFA, 0x56DA,0x8EFB, 0x53CE,0x8EFC, 0x5468,0x8F40, 0x5B97,0x8F41, 0x5C31,0x8F42, 0x5DDE,0x8F43, 0x4FEE,0x8F44, 0x6101,0x8F45, 0x62FE,0x8F46, 0x6D32,0x8F47, 0x79C0,0x8F48, 0x79CB,0x8F49, 0x7D42,0x8F4A, 0x7E4D,0x8F4B, 0x7FD2,0x8F4C, 0x81ED,0x8F4D, 0x821F,0x8F4E, 0x8490,0x8F4F, 0x8846,0x8F50, 0x8972,0x8F51, 0x8B90,0x8F52, 0x8E74,0x8F53, 0x8F2F,0x8F54, 0x9031,0x8F55, 0x914B,0x8F56, 0x916C,0x8F57, 0x96C6,0x8F58, 0x919C,0x8F59, 0x4EC0,0x8F5A, 0x4F4F,0x8F5B, 0x5145,0x8F5C, 0x5341,0x8F5D, 0x5F93,0x8F5E, 0x620E,0x8F5F, 0x67D4,0x8F60, 0x6C41,0x8F61, 0x6E0B,0x8F62, 0x7363,0x8F63, 0x7E26,0x8F64, 0x91CD,0x8F65, 0x9283,0x8F66, 0x53D4,0x8F67, 0x5919,0x8F68, 0x5BBF,0x8F69, 0x6DD1,0x8F6A, 0x795D,0x8F6B, 0x7E2E,0x8F6C, 0x7C9B,0x8F6D, 0x587E,0x8F6E, 0x719F,0x8F6F, 0x51FA,0x8F70, 0x8853,0x8F71, 0x8FF0,0x8F72, 0x4FCA,0x8F73, 0x5CFB,0x8F74, 0x6625,0x8F75, 0x77AC,0x8F76, 0x7AE3,0x8F77, 0x821C,0x8F78, 0x99FF,0x8F79, 0x51C6,0x8F7A, 0x5FAA,0x8F7B, 0x65EC,0x8F7C, 0x696F,0x8F7D, 0x6B89,0x8F7E, 0x6DF3,0x8F80, 0x6E96,0x8F81, 0x6F64,0x8F82, 0x76FE,0x8F83, 0x7D14,0x8F84, 0x5DE1,0x8F85, 0x9075,0x8F86, 0x9187,0x8F87, 0x9806,0x8F88, 0x51E6,0x8F89, 0x521D,0x8F8A, 0x6240,0x8F8B, 0x6691,0x8F8C, 0x66D9,0x8F8D, 0x6E1A,0x8F8E, 0x5EB6,0x8F8F, 0x7DD2,0x8F90, 0x7F72,0x8F91, 0x66F8,0x8F92, 0x85AF,0x8F93, 0x85F7,0x8F94, 0x8AF8,0x8F95, 0x52A9,0x8F96, 0x53D9,0x8F97, 0x5973,0x8F98, 0x5E8F,0x8F99, 0x5F90,0x8F9A, 0x6055,0x8F9B, 0x92E4,0x8F9C, 0x9664,0x8F9D, 0x50B7,0x8F9E, 0x511F,0x8F9F, 0x52DD,0x8FA0, 0x5320,0x8FA1, 0x5347,0x8FA2, 0x53EC,0x8FA3, 0x54E8,0x8FA4, 0x5546,0x8FA5, 0x5531,0x8FA6, 0x5617,0x8FA7, 0x5968,0x8FA8, 0x59BE,0x8FA9, 0x5A3C,0x8FAA, 0x5BB5,0x8FAB, 0x5C06,0x8FAC, 0x5C0F,0x8FAD, 0x5C11,0x8FAE, 0x5C1A,0x8FAF, 0x5E84,0x8FB0, 0x5E8A,0x8FB1, 0x5EE0,0x8FB2, 0x5F70,0x8FB3, 0x627F,0x8FB4, 0x6284,0x8FB5, 0x62DB,0x8FB6, 0x638C,0x8FB7, 0x6377,0x8FB8, 0x6607,0x8FB9, 0x660C,0x8FBA, 0x662D,0x8FBB, 0x6676,0x8FBC, 0x677E,0x8FBD, 0x68A2,0x8FBE, 0x6A1F,0x8FBF, 0x6A35,0x8FC0, 0x6CBC,0x8FC1, 0x6D88,0x8FC2, 0x6E09,0x8FC3, 0x6E58,0x8FC4, 0x713C,0x8FC5, 0x7126,0x8FC6, 0x7167,0x8FC7, 0x75C7,0x8FC8, 0x7701,0x8FC9, 0x785D,0x8FCA, 0x7901,0x8FCB, 0x7965,0x8FCC, 0x79F0,0x8FCD, 0x7AE0,0x8FCE, 0x7B11,0x8FCF, 0x7CA7,0x8FD0, 0x7D39,0x8FD1, 0x8096,0x8FD2, 0x83D6,0x8FD3, 0x848B,0x8FD4, 0x8549,0x8FD5, 0x885D,0x8FD6, 0x88F3,0x8FD7, 0x8A1F,0x8FD8, 0x8A3C,0x8FD9, 0x8A54,0x8FDA, 0x8A73,0x8FDB, 0x8C61,0x8FDC, 0x8CDE,0x8FDD, 0x91A4,0x8FDE, 0x9266,0x8FDF, 0x937E,0x8FE0, 0x9418,0x8FE1, 0x969C,0x8FE2, 0x9798,0x8FE3, 0x4E0A,0x8FE4, 0x4E08,0x8FE5, 0x4E1E,0x8FE6, 0x4E57,0x8FE7, 0x5197,0x8FE8, 0x5270,0x8FE9, 0x57CE,0x8FEA, 0x5834,0x8FEB, 0x58CC,0x8FEC, 0x5B22,0x8FED, 0x5E38,0x8FEE, 0x60C5,0x8FEF, 0x64FE,0x8FF0, 0x6761,0x8FF1, 0x6756,0x8FF2, 0x6D44,0x8FF3, 0x72B6,0x8FF4, 0x7573,0x8FF5, 0x7A63,0x8FF6, 0x84B8,0x8FF7, 0x8B72,0x8FF8, 0x91B8,0x8FF9, 0x9320,0x8FFA, 0x5631,0x8FFB, 0x57F4,0x8FFC, 0x98FE,0x9040, 0x62ED,0x9041, 0x690D,0x9042, 0x6B96,0x9043, 0x71ED,0x9044, 0x7E54,0x9045, 0x8077,0x9046, 0x8272,0x9047, 0x89E6,0x9048, 0x98DF,0x9049, 0x8755,0x904A, 0x8FB1,0x904B, 0x5C3B,0x904C, 0x4F38,0x904D, 0x4FE1,0x904E, 0x4FB5,0x904F, 0x5507,0x9050, 0x5A20,0x9051, 0x5BDD,0x9052, 0x5BE9,0x9053, 0x5FC3,0x9054, 0x614E,0x9055, 0x632F,0x9056, 0x65B0,0x9057, 0x664B,0x9058, 0x68EE,0x9059, 0x699B,0x905A, 0x6D78,0x905B, 0x6DF1,0x905C, 0x7533,0x905D, 0x75B9,0x905E, 0x771F,0x905F, 0x795E,0x9060, 0x79E6,0x9061, 0x7D33,0x9062, 0x81E3,0x9063, 0x82AF,0x9064, 0x85AA,0x9065, 0x89AA,0x9066, 0x8A3A,0x9067, 0x8EAB,0x9068, 0x8F9B,0x9069, 0x9032,0x906A, 0x91DD,0x906B, 0x9707,0x906C, 0x4EBA,0x906D, 0x4EC1,0x906E, 0x5203,0x906F, 0x5875,0x9070, 0x58EC,0x9071, 0x5C0B,0x9072, 0x751A,0x9073, 0x5C3D,0x9074, 0x814E,0x9075, 0x8A0A,0x9076, 0x8FC5,0x9077, 0x9663,0x9078, 0x976D,0x9079, 0x7B25,0x907A, 0x8ACF,0x907B, 0x9808,0x907C, 0x9162,0x907D, 0x56F3,0x907E, 0x53A8,0x9080, 0x9017,0x9081, 0x5439,0x9082, 0x5782,0x9083, 0x5E25,0x9084, 0x63A8,0x9085, 0x6C34,0x9086, 0x708A,0x9087, 0x7761,0x9088, 0x7C8B,0x9089, 0x7FE0,0x908A, 0x8870,0x908B, 0x9042,0x908C, 0x9154,0x908D, 0x9310,0x908E, 0x9318,0x908F, 0x968F,0x9090, 0x745E,0x9091, 0x9AC4,0x9092, 0x5D07,0x9093, 0x5D69,0x9094, 0x6570,0x9095, 0x67A2,0x9096, 0x8DA8,0x9097, 0x96DB,0x9098, 0x636E,0x9099, 0x6749,0x909A, 0x6919,0x909B, 0x83C5,0x909C, 0x9817,0x909D, 0x96C0,0x909E, 0x88FE,0x909F, 0x6F84,0x90A0, 0x647A,0x90A1, 0x5BF8,0x90A2, 0x4E16,0x90A3, 0x702C,0x90A4, 0x755D,0x90A5, 0x662F,0x90A6, 0x51C4,0x90A7, 0x5236,0x90A8, 0x52E2,0x90A9, 0x59D3,0x90AA, 0x5F81,0x90AB, 0x6027,0x90AC, 0x6210,0x90AD, 0x653F,0x90AE, 0x6574,0x90AF, 0x661F,0x90B0, 0x6674,0x90B1, 0x68F2,0x90B2, 0x6816,0x90B3, 0x6B63,0x90B4, 0x6E05,0x90B5, 0x7272,0x90B6, 0x751F,0x90B7, 0x76DB,0x90B8, 0x7CBE,0x90B9, 0x8056,0x90BA, 0x58F0,0x90BB, 0x88FD,0x90BC, 0x897F,0x90BD, 0x8AA0,0x90BE, 0x8A93,0x90BF, 0x8ACB,0x90C0, 0x901D,0x90C1, 0x9192,0x90C2, 0x9752,0x90C3, 0x9759,0x90C4, 0x6589,0x90C5, 0x7A0E,0x90C6, 0x8106,0x90C7, 0x96BB,0x90C8, 0x5E2D,0x90C9, 0x60DC,0x90CA, 0x621A,0x90CB, 0x65A5,0x90CC, 0x6614,0x90CD, 0x6790,0x90CE, 0x77F3,0x90CF, 0x7A4D,0x90D0, 0x7C4D,0x90D1, 0x7E3E,0x90D2, 0x810A,0x90D3, 0x8CAC,0x90D4, 0x8D64,0x90D5, 0x8DE1,0x90D6, 0x8E5F,0x90D7, 0x78A9,0x90D8, 0x5207,0x90D9, 0x62D9,0x90DA, 0x63A5,0x90DB, 0x6442,0x90DC, 0x6298,0x90DD, 0x8A2D,0x90DE, 0x7A83,0x90DF, 0x7BC0,0x90E0, 0x8AAC,0x90E1, 0x96EA,0x90E2, 0x7D76,0x90E3, 0x820C,0x90E4, 0x8749,0x90E5, 0x4ED9,0x90E6, 0x5148,0x90E7, 0x5343,0x90E8, 0x5360,0x90E9, 0x5BA3,0x90EA, 0x5C02,0x90EB, 0x5C16,0x90EC, 0x5DDD,0x90ED, 0x6226,0x90EE, 0x6247,0x90EF, 0x64B0,0x90F0, 0x6813,0x90F1, 0x6834,0x90F2, 0x6CC9,0x90F3, 0x6D45,0x90F4, 0x6D17,0x90F5, 0x67D3,0x90F6, 0x6F5C,0x90F7, 0x714E,0x90F8, 0x717D,0x90F9, 0x65CB,0x90FA, 0x7A7F,0x90FB, 0x7BAD,0x90FC, 0x7DDA,0x9140, 0x7E4A,0x9141, 0x7FA8,0x9142, 0x817A,0x9143, 0x821B,0x9144, 0x8239,0x9145, 0x85A6,0x9146, 0x8A6E,0x9147, 0x8CCE,0x9148, 0x8DF5,0x9149, 0x9078,0x914A, 0x9077,0x914B, 0x92AD,0x914C, 0x9291,0x914D, 0x9583,0x914E, 0x9BAE,0x914F, 0x524D,0x9150, 0x5584,0x9151, 0x6F38,0x9152, 0x7136,0x9153, 0x5168,0x9154, 0x7985,0x9155, 0x7E55,0x9156, 0x81B3,0x9157, 0x7CCE,0x9158, 0x564C,0x9159, 0x5851,0x915A, 0x5CA8,0x915B, 0x63AA,0x915C, 0x66FE,0x915D, 0x66FD,0x915E, 0x695A,0x915F, 0x72D9,0x9160, 0x758F,0x9161, 0x758E,0x9162, 0x790E,0x9163, 0x7956,0x9164, 0x79DF,0x9165, 0x7C97,0x9166, 0x7D20,0x9167, 0x7D44,0x9168, 0x8607,0x9169, 0x8A34,0x916A, 0x963B,0x916B, 0x9061,0x916C, 0x9F20,0x916D, 0x50E7,0x916E, 0x5275,0x916F, 0x53CC,0x9170, 0x53E2,0x9171, 0x5009,0x9172, 0x55AA,0x9173, 0x58EE,0x9174, 0x594F,0x9175, 0x723D,0x9176, 0x5B8B,0x9177, 0x5C64,0x9178, 0x531D,0x9179, 0x60E3,0x917A, 0x60F3,0x917B, 0x635C,0x917C, 0x6383,0x917D, 0x633F,0x917E, 0x63BB,0x9180, 0x64CD,0x9181, 0x65E9,0x9182, 0x66F9,0x9183, 0x5DE3,0x9184, 0x69CD,0x9185, 0x69FD,0x9186, 0x6F15,0x9187, 0x71E5,0x9188, 0x4E89,0x9189, 0x75E9,0x918A, 0x76F8,0x918B, 0x7A93,0x918C, 0x7CDF,0x918D, 0x7DCF,0x918E, 0x7D9C,0x918F, 0x8061,0x9190, 0x8349,0x9191, 0x8358,0x9192, 0x846C,0x9193, 0x84BC,0x9194, 0x85FB,0x9195, 0x88C5,0x9196, 0x8D70,0x9197, 0x9001,0x9198, 0x906D,0x9199, 0x9397,0x919A, 0x971C,0x919B, 0x9A12,0x919C, 0x50CF,0x919D, 0x5897,0x919E, 0x618E,0x919F, 0x81D3,0x91A0, 0x8535,0x91A1, 0x8D08,0x91A2, 0x9020,0x91A3, 0x4FC3,0x91A4, 0x5074,0x91A5, 0x5247,0x91A6, 0x5373,0x91A7, 0x606F,0x91A8, 0x6349,0x91A9, 0x675F,0x91AA, 0x6E2C,0x91AB, 0x8DB3,0x91AC, 0x901F,0x91AD, 0x4FD7,0x91AE, 0x5C5E,0x91AF, 0x8CCA,0x91B0, 0x65CF,0x91B1, 0x7D9A,0x91B2, 0x5352,0x91B3, 0x8896,0x91B4, 0x5176,0x91B5, 0x63C3,0x91B6, 0x5B58,0x91B7, 0x5B6B,0x91B8, 0x5C0A,0x91B9, 0x640D,0x91BA, 0x6751,0x91BB, 0x905C,0x91BC, 0x4ED6,0x91BD, 0x591A,0x91BE, 0x592A,0x91BF, 0x6C70,0x91C0, 0x8A51,0x91C1, 0x553E,0x91C2, 0x5815,0x91C3, 0x59A5,0x91C4, 0x60F0,0x91C5, 0x6253,0x91C6, 0x67C1,0x91C7, 0x8235,0x91C8, 0x6955,0x91C9, 0x9640,0x91CA, 0x99C4,0x91CB, 0x9A28,0x91CC, 0x4F53,0x91CD, 0x5806,0x91CE, 0x5BFE,0x91CF, 0x8010,0x91D0, 0x5CB1,0x91D1, 0x5E2F,0x91D2, 0x5F85,0x91D3, 0x6020,0x91D4, 0x614B,0x91D5, 0x6234,0x91D6, 0x66FF,0x91D7, 0x6CF0,0x91D8, 0x6EDE,0x91D9, 0x80CE,0x91DA, 0x817F,0x91DB, 0x82D4,0x91DC, 0x888B,0x91DD, 0x8CB8,0x91DE, 0x9000,0x91DF, 0x902E,0x91E0, 0x968A,0x91E1, 0x9EDB,0x91E2, 0x9BDB,0x91E3, 0x4EE3,0x91E4, 0x53F0,0x91E5, 0x5927,0x91E6, 0x7B2C,0x91E7, 0x918D,0x91E8, 0x984C,0x91E9, 0x9DF9,0x91EA, 0x6EDD,0x91EB, 0x7027,0x91EC, 0x5353,0x91ED, 0x5544,0x91EE, 0x5B85,0x91EF, 0x6258,0x91F0, 0x629E,0x91F1, 0x62D3,0x91F2, 0x6CA2,0x91F3, 0x6FEF,0x91F4, 0x7422,0x91F5, 0x8A17,0x91F6, 0x9438,0x91F7, 0x6FC1,0x91F8, 0x8AFE,0x91F9, 0x8338,0x91FA, 0x51E7,0x91FB, 0x86F8,0x91FC, 0x53EA,0x9240, 0x53E9,0x9241, 0x4F46,0x9242, 0x9054,0x9243, 0x8FB0,0x9244, 0x596A,0x9245, 0x8131,0x9246, 0x5DFD,0x9247, 0x7AEA,0x9248, 0x8FBF,0x9249, 0x68DA,0x924A, 0x8C37,0x924B, 0x72F8,0x924C, 0x9C48,0x924D, 0x6A3D,0x924E, 0x8AB0,0x924F, 0x4E39,0x9250, 0x5358,0x9251, 0x5606,0x9252, 0x5766,0x9253, 0x62C5,0x9254, 0x63A2,0x9255, 0x65E6,0x9256, 0x6B4E,0x9257, 0x6DE1,0x9258, 0x6E5B,0x9259, 0x70AD,0x925A, 0x77ED,0x925B, 0x7AEF,0x925C, 0x7BAA,0x925D, 0x7DBB,0x925E, 0x803D,0x925F, 0x80C6,0x9260, 0x86CB,0x9261, 0x8A95,0x9262, 0x935B,0x9263, 0x56E3,0x9264, 0x58C7,0x9265, 0x5F3E,0x9266, 0x65AD,0x9267, 0x6696,0x9268, 0x6A80,0x9269, 0x6BB5,0x926A, 0x7537,0x926B, 0x8AC7,0x926C, 0x5024,0x926D, 0x77E5,0x926E, 0x5730,0x926F, 0x5F1B,0x9270, 0x6065,0x9271, 0x667A,0x9272, 0x6C60,0x9273, 0x75F4,0x9274, 0x7A1A,0x9275, 0x7F6E,0x9276, 0x81F4,0x9277, 0x8718,0x9278, 0x9045,0x9279, 0x99B3,0x927A, 0x7BC9,0x927B, 0x755C,0x927C, 0x7AF9,0x927D, 0x7B51,0x927E, 0x84C4,0x9280, 0x9010,0x9281, 0x79E9,0x9282, 0x7A92,0x9283, 0x8336,0x9284, 0x5AE1,0x9285, 0x7740,0x9286, 0x4E2D,0x9287, 0x4EF2,0x9288, 0x5B99,0x9289, 0x5FE0,0x928A, 0x62BD,0x928B, 0x663C,0x928C, 0x67F1,0x928D, 0x6CE8,0x928E, 0x866B,0x928F, 0x8877,0x9290, 0x8A3B,0x9291, 0x914E,0x9292, 0x92F3,0x9293, 0x99D0,0x9294, 0x6A17,0x9295, 0x7026,0x9296, 0x732A,0x9297, 0x82E7,0x9298, 0x8457,0x9299, 0x8CAF,0x929A, 0x4E01,0x929B, 0x5146,0x929C, 0x51CB,0x929D, 0x558B,0x929E, 0x5BF5,0x929F, 0x5E16,0x92A0, 0x5E33,0x92A1, 0x5E81,0x92A2, 0x5F14,0x92A3, 0x5F35,0x92A4, 0x5F6B,0x92A5, 0x5FB4,0x92A6, 0x61F2,0x92A7, 0x6311,0x92A8, 0x66A2,0x92A9, 0x671D,0x92AA, 0x6F6E,0x92AB, 0x7252,0x92AC, 0x753A,0x92AD, 0x773A,0x92AE, 0x8074,0x92AF, 0x8139,0x92B0, 0x8178,0x92B1, 0x8776,0x92B2, 0x8ABF,0x92B3, 0x8ADC,0x92B4, 0x8D85,0x92B5, 0x8DF3,0x92B6, 0x929A,0x92B7, 0x9577,0x92B8, 0x9802,0x92B9, 0x9CE5,0x92BA, 0x52C5,0x92BB, 0x6357,0x92BC, 0x76F4,0x92BD, 0x6715,0x92BE, 0x6C88,0x92BF, 0x73CD,0x92C0, 0x8CC3,0x92C1, 0x93AE,0x92C2, 0x9673,0x92C3, 0x6D25,0x92C4, 0x589C,0x92C5, 0x690E,0x92C6, 0x69CC,0x92C7, 0x8FFD,0x92C8, 0x939A,0x92C9, 0x75DB,0x92CA, 0x901A,0x92CB, 0x585A,0x92CC, 0x6802,0x92CD, 0x63B4,0x92CE, 0x69FB,0x92CF, 0x4F43,0x92D0, 0x6F2C,0x92D1, 0x67D8,0x92D2, 0x8FBB,0x92D3, 0x8526,0x92D4, 0x7DB4,0x92D5, 0x9354,0x92D6, 0x693F,0x92D7, 0x6F70,0x92D8, 0x576A,0x92D9, 0x58F7,0x92DA, 0x5B2C,0x92DB, 0x7D2C,0x92DC, 0x722A,0x92DD, 0x540A,0x92DE, 0x91E3,0x92DF, 0x9DB4,0x92E0, 0x4EAD,0x92E1, 0x4F4E,0x92E2, 0x505C,0x92E3, 0x5075,0x92E4, 0x5243,0x92E5, 0x8C9E,0x92E6, 0x5448,0x92E7, 0x5824,0x92E8, 0x5B9A,0x92E9, 0x5E1D,0x92EA, 0x5E95,0x92EB, 0x5EAD,0x92EC, 0x5EF7,0x92ED, 0x5F1F,0x92EE, 0x608C,0x92EF, 0x62B5,0x92F0, 0x633A,0x92F1, 0x63D0,0x92F2, 0x68AF,0x92F3, 0x6C40,0x92F4, 0x7887,0x92F5, 0x798E,0x92F6, 0x7A0B,0x92F7, 0x7DE0,0x92F8, 0x8247,0x92F9, 0x8A02,0x92FA, 0x8AE6,0x92FB, 0x8E44,0x92FC, 0x9013,0x9340, 0x90B8,0x9341, 0x912D,0x9342, 0x91D8,0x9343, 0x9F0E,0x9344, 0x6CE5,0x9345, 0x6458,0x9346, 0x64E2,0x9347, 0x6575,0x9348, 0x6EF4,0x9349, 0x7684,0x934A, 0x7B1B,0x934B, 0x9069,0x934C, 0x93D1,0x934D, 0x6EBA,0x934E, 0x54F2,0x934F, 0x5FB9,0x9350, 0x64A4,0x9351, 0x8F4D,0x9352, 0x8FED,0x9353, 0x9244,0x9354, 0x5178,0x9355, 0x586B,0x9356, 0x5929,0x9357, 0x5C55,0x9358, 0x5E97,0x9359, 0x6DFB,0x935A, 0x7E8F,0x935B, 0x751C,0x935C, 0x8CBC,0x935D, 0x8EE2,0x935E, 0x985B,0x935F, 0x70B9,0x9360, 0x4F1D,0x9361, 0x6BBF,0x9362, 0x6FB1,0x9363, 0x7530,0x9364, 0x96FB,0x9365, 0x514E,0x9366, 0x5410,0x9367, 0x5835,0x9368, 0x5857,0x9369, 0x59AC,0x936A, 0x5C60,0x936B, 0x5F92,0x936C, 0x6597,0x936D, 0x675C,0x936E, 0x6E21,0x936F, 0x767B,0x9370, 0x83DF,0x9371, 0x8CED,0x9372, 0x9014,0x9373, 0x90FD,0x9374, 0x934D,0x9375, 0x7825,0x9376, 0x783A,0x9377, 0x52AA,0x9378, 0x5EA6,0x9379, 0x571F,0x937A, 0x5974,0x937B, 0x6012,0x937C, 0x5012,0x937D, 0x515A,0x937E, 0x51AC,0x9380, 0x51CD,0x9381, 0x5200,0x9382, 0x5510,0x9383, 0x5854,0x9384, 0x5858,0x9385, 0x5957,0x9386, 0x5B95,0x9387, 0x5CF6,0x9388, 0x5D8B,0x9389, 0x60BC,0x938A, 0x6295,0x938B, 0x642D,0x938C, 0x6771,0x938D, 0x6843,0x938E, 0x68BC,0x938F, 0x68DF,0x9390, 0x76D7,0x9391, 0x6DD8,0x9392, 0x6E6F,0x9393, 0x6D9B,0x9394, 0x706F,0x9395, 0x71C8,0x9396, 0x5F53,0x9397, 0x75D8,0x9398, 0x7977,0x9399, 0x7B49,0x939A, 0x7B54,0x939B, 0x7B52,0x939C, 0x7CD6,0x939D, 0x7D71,0x939E, 0x5230,0x939F, 0x8463,0x93A0, 0x8569,0x93A1, 0x85E4,0x93A2, 0x8A0E,0x93A3, 0x8B04,0x93A4, 0x8C46,0x93A5, 0x8E0F,0x93A6, 0x9003,0x93A7, 0x900F,0x93A8, 0x9419,0x93A9, 0x9676,0x93AA, 0x982D,0x93AB, 0x9A30,0x93AC, 0x95D8,0x93AD, 0x50CD,0x93AE, 0x52D5,0x93AF, 0x540C,0x93B0, 0x5802,0x93B1, 0x5C0E,0x93B2, 0x61A7,0x93B3, 0x649E,0x93B4, 0x6D1E,0x93B5, 0x77B3,0x93B6, 0x7AE5,0x93B7, 0x80F4,0x93B8, 0x8404,0x93B9, 0x9053,0x93BA, 0x9285,0x93BB, 0x5CE0,0x93BC, 0x9D07,0x93BD, 0x533F,0x93BE, 0x5F97,0x93BF, 0x5FB3,0x93C0, 0x6D9C,0x93C1, 0x7279,0x93C2, 0x7763,0x93C3, 0x79BF,0x93C4, 0x7BE4,0x93C5, 0x6BD2,0x93C6, 0x72EC,0x93C7, 0x8AAD,0x93C8, 0x6803,0x93C9, 0x6A61,0x93CA, 0x51F8,0x93CB, 0x7A81,0x93CC, 0x6934,0x93CD, 0x5C4A,0x93CE, 0x9CF6,0x93CF, 0x82EB,0x93D0, 0x5BC5,0x93D1, 0x9149,0x93D2, 0x701E,0x93D3, 0x5678,0x93D4, 0x5C6F,0x93D5, 0x60C7,0x93D6, 0x6566,0x93D7, 0x6C8C,0x93D8, 0x8C5A,0x93D9, 0x9041,0x93DA, 0x9813,0x93DB, 0x5451,0x93DC, 0x66C7,0x93DD, 0x920D,0x93DE, 0x5948,0x93DF, 0x90A3,0x93E0, 0x5185,0x93E1, 0x4E4D,0x93E2, 0x51EA,0x93E3, 0x8599,0x93E4, 0x8B0E,0x93E5, 0x7058,0x93E6, 0x637A,0x93E7, 0x934B,0x93E8, 0x6962,0x93E9, 0x99B4,0x93EA, 0x7E04,0x93EB, 0x7577,0x93EC, 0x5357,0x93ED, 0x6960,0x93EE, 0x8EDF,0x93EF, 0x96E3,0x93F0, 0x6C5D,0x93F1, 0x4E8C,0x93F2, 0x5C3C,0x93F3, 0x5F10,0x93F4, 0x8FE9,0x93F5, 0x5302,0x93F6, 0x8CD1,0x93F7, 0x8089,0x93F8, 0x8679,0x93F9, 0x5EFF,0x93FA, 0x65E5,0x93FB, 0x4E73,0x93FC, 0x5165,0x9440, 0x5982,0x9441, 0x5C3F,0x9442, 0x97EE,0x9443, 0x4EFB,0x9444, 0x598A,0x9445, 0x5FCD,0x9446, 0x8A8D,0x9447, 0x6FE1,0x9448, 0x79B0,0x9449, 0x7962,0x944A, 0x5BE7,0x944B, 0x8471,0x944C, 0x732B,0x944D, 0x71B1,0x944E, 0x5E74,0x944F, 0x5FF5,0x9450, 0x637B,0x9451, 0x649A,0x9452, 0x71C3,0x9453, 0x7C98,0x9454, 0x4E43,0x9455, 0x5EFC,0x9456, 0x4E4B,0x9457, 0x57DC,0x9458, 0x56A2,0x9459, 0x60A9,0x945A, 0x6FC3,0x945B, 0x7D0D,0x945C, 0x80FD,0x945D, 0x8133,0x945E, 0x81BF,0x945F, 0x8FB2,0x9460, 0x8997,0x9461, 0x86A4,0x9462, 0x5DF4,0x9463, 0x628A,0x9464, 0x64AD,0x9465, 0x8987,0x9466, 0x6777,0x9467, 0x6CE2,0x9468, 0x6D3E,0x9469, 0x7436,0x946A, 0x7834,0x946B, 0x5A46,0x946C, 0x7F75,0x946D, 0x82AD,0x946E, 0x99AC,0x946F, 0x4FF3,0x9470, 0x5EC3,0x9471, 0x62DD,0x9472, 0x6392,0x9473, 0x6557,0x9474, 0x676F,0x9475, 0x76C3,0x9476, 0x724C,0x9477, 0x80CC,0x9478, 0x80BA,0x9479, 0x8F29,0x947A, 0x914D,0x947B, 0x500D,0x947C, 0x57F9,0x947D, 0x5A92,0x947E, 0x6885,0x9480, 0x6973,0x9481, 0x7164,0x9482, 0x72FD,0x9483, 0x8CB7,0x9484, 0x58F2,0x9485, 0x8CE0,0x9486, 0x966A,0x9487, 0x9019,0x9488, 0x877F,0x9489, 0x79E4,0x948A, 0x77E7,0x948B, 0x8429,0x948C, 0x4F2F,0x948D, 0x5265,0x948E, 0x535A,0x948F, 0x62CD,0x9490, 0x67CF,0x9491, 0x6CCA,0x9492, 0x767D,0x9493, 0x7B94,0x9494, 0x7C95,0x9495, 0x8236,0x9496, 0x8584,0x9497, 0x8FEB,0x9498, 0x66DD,0x9499, 0x6F20,0x949A, 0x7206,0x949B, 0x7E1B,0x949C, 0x83AB,0x949D, 0x99C1,0x949E, 0x9EA6,0x949F, 0x51FD,0x94A0, 0x7BB1,0x94A1, 0x7872,0x94A2, 0x7BB8,0x94A3, 0x8087,0x94A4, 0x7B48,0x94A5, 0x6AE8,0x94A6, 0x5E61,0x94A7, 0x808C,0x94A8, 0x7551,0x94A9, 0x7560,0x94AA, 0x516B,0x94AB, 0x9262,0x94AC, 0x6E8C,0x94AD, 0x767A,0x94AE, 0x9197,0x94AF, 0x9AEA,0x94B0, 0x4F10,0x94B1, 0x7F70,0x94B2, 0x629C,0x94B3, 0x7B4F,0x94B4, 0x95A5,0x94B5, 0x9CE9,0x94B6, 0x567A,0x94B7, 0x5859,0x94B8, 0x86E4,0x94B9, 0x96BC,0x94BA, 0x4F34,0x94BB, 0x5224,0x94BC, 0x534A,0x94BD, 0x53CD,0x94BE, 0x53DB,0x94BF, 0x5E06,0x94C0, 0x642C,0x94C1, 0x6591,0x94C2, 0x677F,0x94C3, 0x6C3E,0x94C4, 0x6C4E,0x94C5, 0x7248,0x94C6, 0x72AF,0x94C7, 0x73ED,0x94C8, 0x7554,0x94C9, 0x7E41,0x94CA, 0x822C,0x94CB, 0x85E9,0x94CC, 0x8CA9,0x94CD, 0x7BC4,0x94CE, 0x91C6,0x94CF, 0x7169,0x94D0, 0x9812,0x94D1, 0x98EF,0x94D2, 0x633D,0x94D3, 0x6669,0x94D4, 0x756A,0x94D5, 0x76E4,0x94D6, 0x78D0,0x94D7, 0x8543,0x94D8, 0x86EE,0x94D9, 0x532A,0x94DA, 0x5351,0x94DB, 0x5426,0x94DC, 0x5983,0x94DD, 0x5E87,0x94DE, 0x5F7C,0x94DF, 0x60B2,0x94E0, 0x6249,0x94E1, 0x6279,0x94E2, 0x62AB,0x94E3, 0x6590,0x94E4, 0x6BD4,0x94E5, 0x6CCC,0x94E6, 0x75B2,0x94E7, 0x76AE,0x94E8, 0x7891,0x94E9, 0x79D8,0x94EA, 0x7DCB,0x94EB, 0x7F77,0x94EC, 0x80A5,0x94ED, 0x88AB,0x94EE, 0x8AB9,0x94EF, 0x8CBB,0x94F0, 0x907F,0x94F1, 0x975E,0x94F2, 0x98DB,0x94F3, 0x6A0B,0x94F4, 0x7C38,0x94F5, 0x5099,0x94F6, 0x5C3E,0x94F7, 0x5FAE,0x94F8, 0x6787,0x94F9, 0x6BD8,0x94FA, 0x7435,0x94FB, 0x7709,0x94FC, 0x7F8E,0x9540, 0x9F3B,0x9541, 0x67CA,0x9542, 0x7A17,0x9543, 0x5339,0x9544, 0x758B,0x9545, 0x9AED,0x9546, 0x5F66,0x9547, 0x819D,0x9548, 0x83F1,0x9549, 0x8098,0x954A, 0x5F3C,0x954B, 0x5FC5,0x954C, 0x7562,0x954D, 0x7B46,0x954E, 0x903C,0x954F, 0x6867,0x9550, 0x59EB,0x9551, 0x5A9B,0x9552, 0x7D10,0x9553, 0x767E,0x9554, 0x8B2C,0x9555, 0x4FF5,0x9556, 0x5F6A,0x9557, 0x6A19,0x9558, 0x6C37,0x9559, 0x6F02,0x955A, 0x74E2,0x955B, 0x7968,0x955C, 0x8868,0x955D, 0x8A55,0x955E, 0x8C79,0x955F, 0x5EDF,0x9560, 0x63CF,0x9561, 0x75C5,0x9562, 0x79D2,0x9563, 0x82D7,0x9564, 0x9328,0x9565, 0x92F2,0x9566, 0x849C,0x9567, 0x86ED,0x9568, 0x9C2D,0x9569, 0x54C1,0x956A, 0x5F6C,0x956B, 0x658C,0x956C, 0x6D5C,0x956D, 0x7015,0x956E, 0x8CA7,0x956F, 0x8CD3,0x9570, 0x983B,0x9571, 0x654F,0x9572, 0x74F6,0x9573, 0x4E0D,0x9574, 0x4ED8,0x9575, 0x57E0,0x9576, 0x592B,0x9577, 0x5A66,0x9578, 0x5BCC,0x9579, 0x51A8,0x957A, 0x5E03,0x957B, 0x5E9C,0x957C, 0x6016,0x957D, 0x6276,0x957E, 0x6577,0x9580, 0x65A7,0x9581, 0x666E,0x9582, 0x6D6E,0x9583, 0x7236,0x9584, 0x7B26,0x9585, 0x8150,0x9586, 0x819A,0x9587, 0x8299,0x9588, 0x8B5C,0x9589, 0x8CA0,0x958A, 0x8CE6,0x958B, 0x8D74,0x958C, 0x961C,0x958D, 0x9644,0x958E, 0x4FAE,0x958F, 0x64AB,0x9590, 0x6B66,0x9591, 0x821E,0x9592, 0x8461,0x9593, 0x856A,0x9594, 0x90E8,0x9595, 0x5C01,0x9596, 0x6953,0x9597, 0x98A8,0x9598, 0x847A,0x9599, 0x8557,0x959A, 0x4F0F,0x959B, 0x526F,0x959C, 0x5FA9,0x959D, 0x5E45,0x959E, 0x670D,0x959F, 0x798F,0x95A0, 0x8179,0x95A1, 0x8907,0x95A2, 0x8986,0x95A3, 0x6DF5,0x95A4, 0x5F17,0x95A5, 0x6255,0x95A6, 0x6CB8,0x95A7, 0x4ECF,0x95A8, 0x7269,0x95A9, 0x9B92,0x95AA, 0x5206,0x95AB, 0x543B,0x95AC, 0x5674,0x95AD, 0x58B3,0x95AE, 0x61A4,0x95AF, 0x626E,0x95B0, 0x711A,0x95B1, 0x596E,0x95B2, 0x7C89,0x95B3, 0x7CDE,0x95B4, 0x7D1B,0x95B5, 0x96F0,0x95B6, 0x6587,0x95B7, 0x805E,0x95B8, 0x4E19,0x95B9, 0x4F75,0x95BA, 0x5175,0x95BB, 0x5840,0x95BC, 0x5E63,0x95BD, 0x5E73,0x95BE, 0x5F0A,0x95BF, 0x67C4,0x95C0, 0x4E26,0x95C1, 0x853D,0x95C2, 0x9589,0x95C3, 0x965B,0x95C4, 0x7C73,0x95C5, 0x9801,0x95C6, 0x50FB,0x95C7, 0x58C1,0x95C8, 0x7656,0x95C9, 0x78A7,0x95CA, 0x5225,0x95CB, 0x77A5,0x95CC, 0x8511,0x95CD, 0x7B86,0x95CE, 0x504F,0x95CF, 0x5909,0x95D0, 0x7247,0x95D1, 0x7BC7,0x95D2, 0x7DE8,0x95D3, 0x8FBA,0x95D4, 0x8FD4,0x95D5, 0x904D,0x95D6, 0x4FBF,0x95D7, 0x52C9,0x95D8, 0x5A29,0x95D9, 0x5F01,0x95DA, 0x97AD,0x95DB, 0x4FDD,0x95DC, 0x8217,0x95DD, 0x92EA,0x95DE, 0x5703,0x95DF, 0x6355,0x95E0, 0x6B69,0x95E1, 0x752B,0x95E2, 0x88DC,0x95E3, 0x8F14,0x95E4, 0x7A42,0x95E5, 0x52DF,0x95E6, 0x5893,0x95E7, 0x6155,0x95E8, 0x620A,0x95E9, 0x66AE,0x95EA, 0x6BCD,0x95EB, 0x7C3F,0x95EC, 0x83E9,0x95ED, 0x5023,0x95EE, 0x4FF8,0x95EF, 0x5305,0x95F0, 0x5446,0x95F1, 0x5831,0x95F2, 0x5949,0x95F3, 0x5B9D,0x95F4, 0x5CF0,0x95F5, 0x5CEF,0x95F6, 0x5D29,0x95F7, 0x5E96,0x95F8, 0x62B1,0x95F9, 0x6367,0x95FA, 0x653E,0x95FB, 0x65B9,0x95FC, 0x670B,0x9640, 0x6CD5,0x9641, 0x6CE1,0x9642, 0x70F9,0x9643, 0x7832,0x9644, 0x7E2B,0x9645, 0x80DE,0x9646, 0x82B3,0x9647, 0x840C,0x9648, 0x84EC,0x9649, 0x8702,0x964A, 0x8912,0x964B, 0x8A2A,0x964C, 0x8C4A,0x964D, 0x90A6,0x964E, 0x92D2,0x964F, 0x98FD,0x9650, 0x9CF3,0x9651, 0x9D6C,0x9652, 0x4E4F,0x9653, 0x4EA1,0x9654, 0x508D,0x9655, 0x5256,0x9656, 0x574A,0x9657, 0x59A8,0x9658, 0x5E3D,0x9659, 0x5FD8,0x965A, 0x5FD9,0x965B, 0x623F,0x965C, 0x66B4,0x965D, 0x671B,0x965E, 0x67D0,0x965F, 0x68D2,0x9660, 0x5192,0x9661, 0x7D21,0x9662, 0x80AA,0x9663, 0x81A8,0x9664, 0x8B00,0x9665, 0x8C8C,0x9666, 0x8CBF,0x9667, 0x927E,0x9668, 0x9632,0x9669, 0x5420,0x966A, 0x982C,0x966B, 0x5317,0x966C, 0x50D5,0x966D, 0x535C,0x966E, 0x58A8,0x966F, 0x64B2,0x9670, 0x6734,0x9671, 0x7267,0x9672, 0x7766,0x9673, 0x7A46,0x9674, 0x91E6,0x9675, 0x52C3,0x9676, 0x6CA1,0x9677, 0x6B86,0x9678, 0x5800,0x9679, 0x5E4C,0x967A, 0x5954,0x967B, 0x672C,0x967C, 0x7FFB,0x967D, 0x51E1,0x967E, 0x76C6,0x9680, 0x6469,0x9681, 0x78E8,0x9682, 0x9B54,0x9683, 0x9EBB,0x9684, 0x57CB,0x9685, 0x59B9,0x9686, 0x6627,0x9687, 0x679A,0x9688, 0x6BCE,0x9689, 0x54E9,0x968A, 0x69D9,0x968B, 0x5E55,0x968C, 0x819C,0x968D, 0x6795,0x968E, 0x9BAA,0x968F, 0x67FE,0x9690, 0x9C52,0x9691, 0x685D,0x9692, 0x4EA6,0x9693, 0x4FE3,0x9694, 0x53C8,0x9695, 0x62B9,0x9696, 0x672B,0x9697, 0x6CAB,0x9698, 0x8FC4,0x9699, 0x4FAD,0x969A, 0x7E6D,0x969B, 0x9EBF,0x969C, 0x4E07,0x969D, 0x6162,0x969E, 0x6E80,0x969F, 0x6F2B,0x96A0, 0x8513,0x96A1, 0x5473,0x96A2, 0x672A,0x96A3, 0x9B45,0x96A4, 0x5DF3,0x96A5, 0x7B95,0x96A6, 0x5CAC,0x96A7, 0x5BC6,0x96A8, 0x871C,0x96A9, 0x6E4A,0x96AA, 0x84D1,0x96AB, 0x7A14,0x96AC, 0x8108,0x96AD, 0x5999,0x96AE, 0x7C8D,0x96AF, 0x6C11,0x96B0, 0x7720,0x96B1, 0x52D9,0x96B2, 0x5922,0x96B3, 0x7121,0x96B4, 0x725F,0x96B5, 0x77DB,0x96B6, 0x9727,0x96B7, 0x9D61,0x96B8, 0x690B,0x96B9, 0x5A7F,0x96BA, 0x5A18,0x96BB, 0x51A5,0x96BC, 0x540D,0x96BD, 0x547D,0x96BE, 0x660E,0x96BF, 0x76DF,0x96C0, 0x8FF7,0x96C1, 0x9298,0x96C2, 0x9CF4,0x96C3, 0x59EA,0x96C4, 0x725D,0x96C5, 0x6EC5,0x96C6, 0x514D,0x96C7, 0x68C9,0x96C8, 0x7DBF,0x96C9, 0x7DEC,0x96CA, 0x9762,0x96CB, 0x9EBA,0x96CC, 0x6478,0x96CD, 0x6A21,0x96CE, 0x8302,0x96CF, 0x5984,0x96D0, 0x5B5F,0x96D1, 0x6BDB,0x96D2, 0x731B,0x96D3, 0x76F2,0x96D4, 0x7DB2,0x96D5, 0x8017,0x96D6, 0x8499,0x96D7, 0x5132,0x96D8, 0x6728,0x96D9, 0x9ED9,0x96DA, 0x76EE,0x96DB, 0x6762,0x96DC, 0x52FF,0x96DD, 0x9905,0x96DE, 0x5C24,0x96DF, 0x623B,0x96E0, 0x7C7E,0x96E1, 0x8CB0,0x96E2, 0x554F,0x96E3, 0x60B6,0x96E4, 0x7D0B,0x96E5, 0x9580,0x96E6, 0x5301,0x96E7, 0x4E5F,0x96E8, 0x51B6,0x96E9, 0x591C,0x96EA, 0x723A,0x96EB, 0x8036,0x96EC, 0x91CE,0x96ED, 0x5F25,0x96EE, 0x77E2,0x96EF, 0x5384,0x96F0, 0x5F79,0x96F1, 0x7D04,0x96F2, 0x85AC,0x96F3, 0x8A33,0x96F4, 0x8E8D,0x96F5, 0x9756,0x96F6, 0x67F3,0x96F7, 0x85AE,0x96F8, 0x9453,0x96F9, 0x6109,0x96FA, 0x6108,0x96FB, 0x6CB9,0x96FC, 0x7652,0x9740, 0x8AED,0x9741, 0x8F38,0x9742, 0x552F,0x9743, 0x4F51,0x9744, 0x512A,0x9745, 0x52C7,0x9746, 0x53CB,0x9747, 0x5BA5,0x9748, 0x5E7D,0x9749, 0x60A0,0x974A, 0x6182,0x974B, 0x63D6,0x974C, 0x6709,0x974D, 0x67DA,0x974E, 0x6E67,0x974F, 0x6D8C,0x9750, 0x7336,0x9751, 0x7337,0x9752, 0x7531,0x9753, 0x7950,0x9754, 0x88D5,0x9755, 0x8A98,0x9756, 0x904A,0x9757, 0x9091,0x9758, 0x90F5,0x9759, 0x96C4,0x975A, 0x878D,0x975B, 0x5915,0x975C, 0x4E88,0x975D, 0x4F59,0x975E, 0x4E0E,0x975F, 0x8A89,0x9760, 0x8F3F,0x9761, 0x9810,0x9762, 0x50AD,0x9763, 0x5E7C,0x9764, 0x5996,0x9765, 0x5BB9,0x9766, 0x5EB8,0x9767, 0x63DA,0x9768, 0x63FA,0x9769, 0x64C1,0x976A, 0x66DC,0x976B, 0x694A,0x976C, 0x69D8,0x976D, 0x6D0B,0x976E, 0x6EB6,0x976F, 0x7194,0x9770, 0x7528,0x9771, 0x7AAF,0x9772, 0x7F8A,0x9773, 0x8000,0x9774, 0x8449,0x9775, 0x84C9,0x9776, 0x8981,0x9777, 0x8B21,0x9778, 0x8E0A,0x9779, 0x9065,0x977A, 0x967D,0x977B, 0x990A,0x977C, 0x617E,0x977D, 0x6291,0x977E, 0x6B32,0x9780, 0x6C83,0x9781, 0x6D74,0x9782, 0x7FCC,0x9783, 0x7FFC,0x9784, 0x6DC0,0x9785, 0x7F85,0x9786, 0x87BA,0x9787, 0x88F8,0x9788, 0x6765,0x9789, 0x83B1,0x978A, 0x983C,0x978B, 0x96F7,0x978C, 0x6D1B,0x978D, 0x7D61,0x978E, 0x843D,0x978F, 0x916A,0x9790, 0x4E71,0x9791, 0x5375,0x9792, 0x5D50,0x9793, 0x6B04,0x9794, 0x6FEB,0x9795, 0x85CD,0x9796, 0x862D,0x9797, 0x89A7,0x9798, 0x5229,0x9799, 0x540F,0x979A, 0x5C65,0x979B, 0x674E,0x979C, 0x68A8,0x979D, 0x7406,0x979E, 0x7483,0x979F, 0x75E2,0x97A0, 0x88CF,0x97A1, 0x88E1,0x97A2, 0x91CC,0x97A3, 0x96E2,0x97A4, 0x9678,0x97A5, 0x5F8B,0x97A6, 0x7387,0x97A7, 0x7ACB,0x97A8, 0x844E,0x97A9, 0x63A0,0x97AA, 0x7565,0x97AB, 0x5289,0x97AC, 0x6D41,0x97AD, 0x6E9C,0x97AE, 0x7409,0x97AF, 0x7559,0x97B0, 0x786B,0x97B1, 0x7C92,0x97B2, 0x9686,0x97B3, 0x7ADC,0x97B4, 0x9F8D,0x97B5, 0x4FB6,0x97B6, 0x616E,0x97B7, 0x65C5,0x97B8, 0x865C,0x97B9, 0x4E86,0x97BA, 0x4EAE,0x97BB, 0x50DA,0x97BC, 0x4E21,0x97BD, 0x51CC,0x97BE, 0x5BEE,0x97BF, 0x6599,0x97C0, 0x6881,0x97C1, 0x6DBC,0x97C2, 0x731F,0x97C3, 0x7642,0x97C4, 0x77AD,0x97C5, 0x7A1C,0x97C6, 0x7CE7,0x97C7, 0x826F,0x97C8, 0x8AD2,0x97C9, 0x907C,0x97CA, 0x91CF,0x97CB, 0x9675,0x97CC, 0x9818,0x97CD, 0x529B,0x97CE, 0x7DD1,0x97CF, 0x502B,0x97D0, 0x5398,0x97D1, 0x6797,0x97D2, 0x6DCB,0x97D3, 0x71D0,0x97D4, 0x7433,0x97D5, 0x81E8,0x97D6, 0x8F2A,0x97D7, 0x96A3,0x97D8, 0x9C57,0x97D9, 0x9E9F,0x97DA, 0x7460,0x97DB, 0x5841,0x97DC, 0x6D99,0x97DD, 0x7D2F,0x97DE, 0x985E,0x97DF, 0x4EE4,0x97E0, 0x4F36,0x97E1, 0x4F8B,0x97E2, 0x51B7,0x97E3, 0x52B1,0x97E4, 0x5DBA,0x97E5, 0x601C,0x97E6, 0x73B2,0x97E7, 0x793C,0x97E8, 0x82D3,0x97E9, 0x9234,0x97EA, 0x96B7,0x97EB, 0x96F6,0x97EC, 0x970A,0x97ED, 0x9E97,0x97EE, 0x9F62,0x97EF, 0x66A6,0x97F0, 0x6B74,0x97F1, 0x5217,0x97F2, 0x52A3,0x97F3, 0x70C8,0x97F4, 0x88C2,0x97F5, 0x5EC9,0x97F6, 0x604B,0x97F7, 0x6190,0x97F8, 0x6F23,0x97F9, 0x7149,0x97FA, 0x7C3E,0x97FB, 0x7DF4,0x97FC, 0x806F,0x9840, 0x84EE,0x9841, 0x9023,0x9842, 0x932C,0x9843, 0x5442,0x9844, 0x9B6F,0x9845, 0x6AD3,0x9846, 0x7089,0x9847, 0x8CC2,0x9848, 0x8DEF,0x9849, 0x9732,0x984A, 0x52B4,0x984B, 0x5A41,0x984C, 0x5ECA,0x984D, 0x5F04,0x984E, 0x6717,0x984F, 0x697C,0x9850, 0x6994,0x9851, 0x6D6A,0x9852, 0x6F0F,0x9853, 0x7262,0x9854, 0x72FC,0x9855, 0x7BED,0x9856, 0x8001,0x9857, 0x807E,0x9858, 0x874B,0x9859, 0x90CE,0x985A, 0x516D,0x985B, 0x9E93,0x985C, 0x7984,0x985D, 0x808B,0x985E, 0x9332,0x985F, 0x8AD6,0x9860, 0x502D,0x9861, 0x548C,0x9862, 0x8A71,0x9863, 0x6B6A,0x9864, 0x8CC4,0x9865, 0x8107,0x9866, 0x60D1,0x9867, 0x67A0,0x9868, 0x9DF2,0x9869, 0x4E99,0x986A, 0x4E98,0x986B, 0x9C10,0x986C, 0x8A6B,0x986D, 0x85C1,0x986E, 0x8568,0x986F, 0x6900,0x9870, 0x6E7E,0x9871, 0x7897,0x9872, 0x8155,0x989F, 0x5F0C,0x98A0, 0x4E10,0x98A1, 0x4E15,0x98A2, 0x4E2A,0x98A3, 0x4E31,0x98A4, 0x4E36,0x98A5, 0x4E3C,0x98A6, 0x4E3F,0x98A7, 0x4E42,0x98A8, 0x4E56,0x98A9, 0x4E58,0x98AA, 0x4E82,0x98AB, 0x4E85,0x98AC, 0x8C6B,0x98AD, 0x4E8A,0x98AE, 0x8212,0x98AF, 0x5F0D,0x98B0, 0x4E8E,0x98B1, 0x4E9E,0x98B2, 0x4E9F,0x98B3, 0x4EA0,0x98B4, 0x4EA2,0x98B5, 0x4EB0,0x98B6, 0x4EB3,0x98B7, 0x4EB6,0x98B8, 0x4ECE,0x98B9, 0x4ECD,0x98BA, 0x4EC4,0x98BB, 0x4EC6,0x98BC, 0x4EC2,0x98BD, 0x4ED7,0x98BE, 0x4EDE,0x98BF, 0x4EED,0x98C0, 0x4EDF,0x98C1, 0x4EF7,0x98C2, 0x4F09,0x98C3, 0x4F5A,0x98C4, 0x4F30,0x98C5, 0x4F5B,0x98C6, 0x4F5D,0x98C7, 0x4F57,0x98C8, 0x4F47,0x98C9, 0x4F76,0x98CA, 0x4F88,0x98CB, 0x4F8F,0x98CC, 0x4F98,0x98CD, 0x4F7B,0x98CE, 0x4F69,0x98CF, 0x4F70,0x98D0, 0x4F91,0x98D1, 0x4F6F,0x98D2, 0x4F86,0x98D3, 0x4F96,0x98D4, 0x5118,0x98D5, 0x4FD4,0x98D6, 0x4FDF,0x98D7, 0x4FCE,0x98D8, 0x4FD8,0x98D9, 0x4FDB,0x98DA, 0x4FD1,0x98DB, 0x4FDA,0x98DC, 0x4FD0,0x98DD, 0x4FE4,0x98DE, 0x4FE5,0x98DF, 0x501A,0x98E0, 0x5028,0x98E1, 0x5014,0x98E2, 0x502A,0x98E3, 0x5025,0x98E4, 0x5005,0x98E5, 0x4F1C,0x98E6, 0x4FF6,0x98E7, 0x5021,0x98E8, 0x5029,0x98E9, 0x502C,0x98EA, 0x4FFE,0x98EB, 0x4FEF,0x98EC, 0x5011,0x98ED, 0x5006,0x98EE, 0x5043,0x98EF, 0x5047,0x98F0, 0x6703,0x98F1, 0x5055,0x98F2, 0x5050,0x98F3, 0x5048,0x98F4, 0x505A,0x98F5, 0x5056,0x98F6, 0x506C,0x98F7, 0x5078,0x98F8, 0x5080,0x98F9, 0x509A,0x98FA, 0x5085,0x98FB, 0x50B4,0x98FC, 0x50B2,0x9940, 0x50C9,0x9941, 0x50CA,0x9942, 0x50B3,0x9943, 0x50C2,0x9944, 0x50D6,0x9945, 0x50DE,0x9946, 0x50E5,0x9947, 0x50ED,0x9948, 0x50E3,0x9949, 0x50EE,0x994A, 0x50F9,0x994B, 0x50F5,0x994C, 0x5109,0x994D, 0x5101,0x994E, 0x5102,0x994F, 0x5116,0x9950, 0x5115,0x9951, 0x5114,0x9952, 0x511A,0x9953, 0x5121,0x9954, 0x513A,0x9955, 0x5137,0x9956, 0x513C,0x9957, 0x513B,0x9958, 0x513F,0x9959, 0x5140,0x995A, 0x5152,0x995B, 0x514C,0x995C, 0x5154,0x995D, 0x5162,0x995E, 0x7AF8,0x995F, 0x5169,0x9960, 0x516A,0x9961, 0x516E,0x9962, 0x5180,0x9963, 0x5182,0x9964, 0x56D8,0x9965, 0x518C,0x9966, 0x5189,0x9967, 0x518F,0x9968, 0x5191,0x9969, 0x5193,0x996A, 0x5195,0x996B, 0x5196,0x996C, 0x51A4,0x996D, 0x51A6,0x996E, 0x51A2,0x996F, 0x51A9,0x9970, 0x51AA,0x9971, 0x51AB,0x9972, 0x51B3,0x9973, 0x51B1,0x9974, 0x51B2,0x9975, 0x51B0,0x9976, 0x51B5,0x9977, 0x51BD,0x9978, 0x51C5,0x9979, 0x51C9,0x997A, 0x51DB,0x997B, 0x51E0,0x997C, 0x8655,0x997D, 0x51E9,0x997E, 0x51ED,0x9980, 0x51F0,0x9981, 0x51F5,0x9982, 0x51FE,0x9983, 0x5204,0x9984, 0x520B,0x9985, 0x5214,0x9986, 0x520E,0x9987, 0x5227,0x9988, 0x522A,0x9989, 0x522E,0x998A, 0x5233,0x998B, 0x5239,0x998C, 0x524F,0x998D, 0x5244,0x998E, 0x524B,0x998F, 0x524C,0x9990, 0x525E,0x9991, 0x5254,0x9992, 0x526A,0x9993, 0x5274,0x9994, 0x5269,0x9995, 0x5273,0x9996, 0x527F,0x9997, 0x527D,0x9998, 0x528D,0x9999, 0x5294,0x999A, 0x5292,0x999B, 0x5271,0x999C, 0x5288,0x999D, 0x5291,0x999E, 0x8FA8,0x999F, 0x8FA7,0x99A0, 0x52AC,0x99A1, 0x52AD,0x99A2, 0x52BC,0x99A3, 0x52B5,0x99A4, 0x52C1,0x99A5, 0x52CD,0x99A6, 0x52D7,0x99A7, 0x52DE,0x99A8, 0x52E3,0x99A9, 0x52E6,0x99AA, 0x98ED,0x99AB, 0x52E0,0x99AC, 0x52F3,0x99AD, 0x52F5,0x99AE, 0x52F8,0x99AF, 0x52F9,0x99B0, 0x5306,0x99B1, 0x5308,0x99B2, 0x7538,0x99B3, 0x530D,0x99B4, 0x5310,0x99B5, 0x530F,0x99B6, 0x5315,0x99B7, 0x531A,0x99B8, 0x5323,0x99B9, 0x532F,0x99BA, 0x5331,0x99BB, 0x5333,0x99BC, 0x5338,0x99BD, 0x5340,0x99BE, 0x5346,0x99BF, 0x5345,0x99C0, 0x4E17,0x99C1, 0x5349,0x99C2, 0x534D,0x99C3, 0x51D6,0x99C4, 0x535E,0x99C5, 0x5369,0x99C6, 0x536E,0x99C7, 0x5918,0x99C8, 0x537B,0x99C9, 0x5377,0x99CA, 0x5382,0x99CB, 0x5396,0x99CC, 0x53A0,0x99CD, 0x53A6,0x99CE, 0x53A5,0x99CF, 0x53AE,0x99D0, 0x53B0,0x99D1, 0x53B6,0x99D2, 0x53C3,0x99D3, 0x7C12,0x99D4, 0x96D9,0x99D5, 0x53DF,0x99D6, 0x66FC,0x99D7, 0x71EE,0x99D8, 0x53EE,0x99D9, 0x53E8,0x99DA, 0x53ED,0x99DB, 0x53FA,0x99DC, 0x5401,0x99DD, 0x543D,0x99DE, 0x5440,0x99DF, 0x542C,0x99E0, 0x542D,0x99E1, 0x543C,0x99E2, 0x542E,0x99E3, 0x5436,0x99E4, 0x5429,0x99E5, 0x541D,0x99E6, 0x544E,0x99E7, 0x548F,0x99E8, 0x5475,0x99E9, 0x548E,0x99EA, 0x545F,0x99EB, 0x5471,0x99EC, 0x5477,0x99ED, 0x5470,0x99EE, 0x5492,0x99EF, 0x547B,0x99F0, 0x5480,0x99F1, 0x5476,0x99F2, 0x5484,0x99F3, 0x5490,0x99F4, 0x5486,0x99F5, 0x54C7,0x99F6, 0x54A2,0x99F7, 0x54B8,0x99F8, 0x54A5,0x99F9, 0x54AC,0x99FA, 0x54C4,0x99FB, 0x54C8,0x99FC, 0x54A8,0x9A40, 0x54AB,0x9A41, 0x54C2,0x9A42, 0x54A4,0x9A43, 0x54BE,0x9A44, 0x54BC,0x9A45, 0x54D8,0x9A46, 0x54E5,0x9A47, 0x54E6,0x9A48, 0x550F,0x9A49, 0x5514,0x9A4A, 0x54FD,0x9A4B, 0x54EE,0x9A4C, 0x54ED,0x9A4D, 0x54FA,0x9A4E, 0x54E2,0x9A4F, 0x5539,0x9A50, 0x5540,0x9A51, 0x5563,0x9A52, 0x554C,0x9A53, 0x552E,0x9A54, 0x555C,0x9A55, 0x5545,0x9A56, 0x5556,0x9A57, 0x5557,0x9A58, 0x5538,0x9A59, 0x5533,0x9A5A, 0x555D,0x9A5B, 0x5599,0x9A5C, 0x5580,0x9A5D, 0x54AF,0x9A5E, 0x558A,0x9A5F, 0x559F,0x9A60, 0x557B,0x9A61, 0x557E,0x9A62, 0x5598,0x9A63, 0x559E,0x9A64, 0x55AE,0x9A65, 0x557C,0x9A66, 0x5583,0x9A67, 0x55A9,0x9A68, 0x5587,0x9A69, 0x55A8,0x9A6A, 0x55DA,0x9A6B, 0x55C5,0x9A6C, 0x55DF,0x9A6D, 0x55C4,0x9A6E, 0x55DC,0x9A6F, 0x55E4,0x9A70, 0x55D4,0x9A71, 0x5614,0x9A72, 0x55F7,0x9A73, 0x5616,0x9A74, 0x55FE,0x9A75, 0x55FD,0x9A76, 0x561B,0x9A77, 0x55F9,0x9A78, 0x564E,0x9A79, 0x5650,0x9A7A, 0x71DF,0x9A7B, 0x5634,0x9A7C, 0x5636,0x9A7D, 0x5632,0x9A7E, 0x5638,0x9A80, 0x566B,0x9A81, 0x5664,0x9A82, 0x562F,0x9A83, 0x566C,0x9A84, 0x566A,0x9A85, 0x5686,0x9A86, 0x5680,0x9A87, 0x568A,0x9A88, 0x56A0,0x9A89, 0x5694,0x9A8A, 0x568F,0x9A8B, 0x56A5,0x9A8C, 0x56AE,0x9A8D, 0x56B6,0x9A8E, 0x56B4,0x9A8F, 0x56C2,0x9A90, 0x56BC,0x9A91, 0x56C1,0x9A92, 0x56C3,0x9A93, 0x56C0,0x9A94, 0x56C8,0x9A95, 0x56CE,0x9A96, 0x56D1,0x9A97, 0x56D3,0x9A98, 0x56D7,0x9A99, 0x56EE,0x9A9A, 0x56F9,0x9A9B, 0x5700,0x9A9C, 0x56FF,0x9A9D, 0x5704,0x9A9E, 0x5709,0x9A9F, 0x5708,0x9AA0, 0x570B,0x9AA1, 0x570D,0x9AA2, 0x5713,0x9AA3, 0x5718,0x9AA4, 0x5716,0x9AA5, 0x55C7,0x9AA6, 0x571C,0x9AA7, 0x5726,0x9AA8, 0x5737,0x9AA9, 0x5738,0x9AAA, 0x574E,0x9AAB, 0x573B,0x9AAC, 0x5740,0x9AAD, 0x574F,0x9AAE, 0x5769,0x9AAF, 0x57C0,0x9AB0, 0x5788,0x9AB1, 0x5761,0x9AB2, 0x577F,0x9AB3, 0x5789,0x9AB4, 0x5793,0x9AB5, 0x57A0,0x9AB6, 0x57B3,0x9AB7, 0x57A4,0x9AB8, 0x57AA,0x9AB9, 0x57B0,0x9ABA, 0x57C3,0x9ABB, 0x57C6,0x9ABC, 0x57D4,0x9ABD, 0x57D2,0x9ABE, 0x57D3,0x9ABF, 0x580A,0x9AC0, 0x57D6,0x9AC1, 0x57E3,0x9AC2, 0x580B,0x9AC3, 0x5819,0x9AC4, 0x581D,0x9AC5, 0x5872,0x9AC6, 0x5821,0x9AC7, 0x5862,0x9AC8, 0x584B,0x9AC9, 0x5870,0x9ACA, 0x6BC0,0x9ACB, 0x5852,0x9ACC, 0x583D,0x9ACD, 0x5879,0x9ACE, 0x5885,0x9ACF, 0x58B9,0x9AD0, 0x589F,0x9AD1, 0x58AB,0x9AD2, 0x58BA,0x9AD3, 0x58DE,0x9AD4, 0x58BB,0x9AD5, 0x58B8,0x9AD6, 0x58AE,0x9AD7, 0x58C5,0x9AD8, 0x58D3,0x9AD9, 0x58D1,0x9ADA, 0x58D7,0x9ADB, 0x58D9,0x9ADC, 0x58D8,0x9ADD, 0x58E5,0x9ADE, 0x58DC,0x9ADF, 0x58E4,0x9AE0, 0x58DF,0x9AE1, 0x58EF,0x9AE2, 0x58FA,0x9AE3, 0x58F9,0x9AE4, 0x58FB,0x9AE5, 0x58FC,0x9AE6, 0x58FD,0x9AE7, 0x5902,0x9AE8, 0x590A,0x9AE9, 0x5910,0x9AEA, 0x591B,0x9AEB, 0x68A6,0x9AEC, 0x5925,0x9AED, 0x592C,0x9AEE, 0x592D,0x9AEF, 0x5932,0x9AF0, 0x5938,0x9AF1, 0x593E,0x9AF2, 0x7AD2,0x9AF3, 0x5955,0x9AF4, 0x5950,0x9AF5, 0x594E,0x9AF6, 0x595A,0x9AF7, 0x5958,0x9AF8, 0x5962,0x9AF9, 0x5960,0x9AFA, 0x5967,0x9AFB, 0x596C,0x9AFC, 0x5969,0x9B40, 0x5978,0x9B41, 0x5981,0x9B42, 0x599D,0x9B43, 0x4F5E,0x9B44, 0x4FAB,0x9B45, 0x59A3,0x9B46, 0x59B2,0x9B47, 0x59C6,0x9B48, 0x59E8,0x9B49, 0x59DC,0x9B4A, 0x598D,0x9B4B, 0x59D9,0x9B4C, 0x59DA,0x9B4D, 0x5A25,0x9B4E, 0x5A1F,0x9B4F, 0x5A11,0x9B50, 0x5A1C,0x9B51, 0x5A09,0x9B52, 0x5A1A,0x9B53, 0x5A40,0x9B54, 0x5A6C,0x9B55, 0x5A49,0x9B56, 0x5A35,0x9B57, 0x5A36,0x9B58, 0x5A62,0x9B59, 0x5A6A,0x9B5A, 0x5A9A,0x9B5B, 0x5ABC,0x9B5C, 0x5ABE,0x9B5D, 0x5ACB,0x9B5E, 0x5AC2,0x9B5F, 0x5ABD,0x9B60, 0x5AE3,0x9B61, 0x5AD7,0x9B62, 0x5AE6,0x9B63, 0x5AE9,0x9B64, 0x5AD6,0x9B65, 0x5AFA,0x9B66, 0x5AFB,0x9B67, 0x5B0C,0x9B68, 0x5B0B,0x9B69, 0x5B16,0x9B6A, 0x5B32,0x9B6B, 0x5AD0,0x9B6C, 0x5B2A,0x9B6D, 0x5B36,0x9B6E, 0x5B3E,0x9B6F, 0x5B43,0x9B70, 0x5B45,0x9B71, 0x5B40,0x9B72, 0x5B51,0x9B73, 0x5B55,0x9B74, 0x5B5A,0x9B75, 0x5B5B,0x9B76, 0x5B65,0x9B77, 0x5B69,0x9B78, 0x5B70,0x9B79, 0x5B73,0x9B7A, 0x5B75,0x9B7B, 0x5B78,0x9B7C, 0x6588,0x9B7D, 0x5B7A,0x9B7E, 0x5B80,0x9B80, 0x5B83,0x9B81, 0x5BA6,0x9B82, 0x5BB8,0x9B83, 0x5BC3,0x9B84, 0x5BC7,0x9B85, 0x5BC9,0x9B86, 0x5BD4,0x9B87, 0x5BD0,0x9B88, 0x5BE4,0x9B89, 0x5BE6,0x9B8A, 0x5BE2,0x9B8B, 0x5BDE,0x9B8C, 0x5BE5,0x9B8D, 0x5BEB,0x9B8E, 0x5BF0,0x9B8F, 0x5BF6,0x9B90, 0x5BF3,0x9B91, 0x5C05,0x9B92, 0x5C07,0x9B93, 0x5C08,0x9B94, 0x5C0D,0x9B95, 0x5C13,0x9B96, 0x5C20,0x9B97, 0x5C22,0x9B98, 0x5C28,0x9B99, 0x5C38,0x9B9A, 0x5C39,0x9B9B, 0x5C41,0x9B9C, 0x5C46,0x9B9D, 0x5C4E,0x9B9E, 0x5C53,0x9B9F, 0x5C50,0x9BA0, 0x5C4F,0x9BA1, 0x5B71,0x9BA2, 0x5C6C,0x9BA3, 0x5C6E,0x9BA4, 0x4E62,0x9BA5, 0x5C76,0x9BA6, 0x5C79,0x9BA7, 0x5C8C,0x9BA8, 0x5C91,0x9BA9, 0x5C94,0x9BAA, 0x599B,0x9BAB, 0x5CAB,0x9BAC, 0x5CBB,0x9BAD, 0x5CB6,0x9BAE, 0x5CBC,0x9BAF, 0x5CB7,0x9BB0, 0x5CC5,0x9BB1, 0x5CBE,0x9BB2, 0x5CC7,0x9BB3, 0x5CD9,0x9BB4, 0x5CE9,0x9BB5, 0x5CFD,0x9BB6, 0x5CFA,0x9BB7, 0x5CED,0x9BB8, 0x5D8C,0x9BB9, 0x5CEA,0x9BBA, 0x5D0B,0x9BBB, 0x5D15,0x9BBC, 0x5D17,0x9BBD, 0x5D5C,0x9BBE, 0x5D1F,0x9BBF, 0x5D1B,0x9BC0, 0x5D11,0x9BC1, 0x5D14,0x9BC2, 0x5D22,0x9BC3, 0x5D1A,0x9BC4, 0x5D19,0x9BC5, 0x5D18,0x9BC6, 0x5D4C,0x9BC7, 0x5D52,0x9BC8, 0x5D4E,0x9BC9, 0x5D4B,0x9BCA, 0x5D6C,0x9BCB, 0x5D73,0x9BCC, 0x5D76,0x9BCD, 0x5D87,0x9BCE, 0x5D84,0x9BCF, 0x5D82,0x9BD0, 0x5DA2,0x9BD1, 0x5D9D,0x9BD2, 0x5DAC,0x9BD3, 0x5DAE,0x9BD4, 0x5DBD,0x9BD5, 0x5D90,0x9BD6, 0x5DB7,0x9BD7, 0x5DBC,0x9BD8, 0x5DC9,0x9BD9, 0x5DCD,0x9BDA, 0x5DD3,0x9BDB, 0x5DD2,0x9BDC, 0x5DD6,0x9BDD, 0x5DDB,0x9BDE, 0x5DEB,0x9BDF, 0x5DF2,0x9BE0, 0x5DF5,0x9BE1, 0x5E0B,0x9BE2, 0x5E1A,0x9BE3, 0x5E19,0x9BE4, 0x5E11,0x9BE5, 0x5E1B,0x9BE6, 0x5E36,0x9BE7, 0x5E37,0x9BE8, 0x5E44,0x9BE9, 0x5E43,0x9BEA, 0x5E40,0x9BEB, 0x5E4E,0x9BEC, 0x5E57,0x9BED, 0x5E54,0x9BEE, 0x5E5F,0x9BEF, 0x5E62,0x9BF0, 0x5E64,0x9BF1, 0x5E47,0x9BF2, 0x5E75,0x9BF3, 0x5E76,0x9BF4, 0x5E7A,0x9BF5, 0x9EBC,0x9BF6, 0x5E7F,0x9BF7, 0x5EA0,0x9BF8, 0x5EC1,0x9BF9, 0x5EC2,0x9BFA, 0x5EC8,0x9BFB, 0x5ED0,0x9BFC, 0x5ECF,0x9C40, 0x5ED6,0x9C41, 0x5EE3,0x9C42, 0x5EDD,0x9C43, 0x5EDA,0x9C44, 0x5EDB,0x9C45, 0x5EE2,0x9C46, 0x5EE1,0x9C47, 0x5EE8,0x9C48, 0x5EE9,0x9C49, 0x5EEC,0x9C4A, 0x5EF1,0x9C4B, 0x5EF3,0x9C4C, 0x5EF0,0x9C4D, 0x5EF4,0x9C4E, 0x5EF8,0x9C4F, 0x5EFE,0x9C50, 0x5F03,0x9C51, 0x5F09,0x9C52, 0x5F5D,0x9C53, 0x5F5C,0x9C54, 0x5F0B,0x9C55, 0x5F11,0x9C56, 0x5F16,0x9C57, 0x5F29,0x9C58, 0x5F2D,0x9C59, 0x5F38,0x9C5A, 0x5F41,0x9C5B, 0x5F48,0x9C5C, 0x5F4C,0x9C5D, 0x5F4E,0x9C5E, 0x5F2F,0x9C5F, 0x5F51,0x9C60, 0x5F56,0x9C61, 0x5F57,0x9C62, 0x5F59,0x9C63, 0x5F61,0x9C64, 0x5F6D,0x9C65, 0x5F73,0x9C66, 0x5F77,0x9C67, 0x5F83,0x9C68, 0x5F82,0x9C69, 0x5F7F,0x9C6A, 0x5F8A,0x9C6B, 0x5F88,0x9C6C, 0x5F91,0x9C6D, 0x5F87,0x9C6E, 0x5F9E,0x9C6F, 0x5F99,0x9C70, 0x5F98,0x9C71, 0x5FA0,0x9C72, 0x5FA8,0x9C73, 0x5FAD,0x9C74, 0x5FBC,0x9C75, 0x5FD6,0x9C76, 0x5FFB,0x9C77, 0x5FE4,0x9C78, 0x5FF8,0x9C79, 0x5FF1,0x9C7A, 0x5FDD,0x9C7B, 0x60B3,0x9C7C, 0x5FFF,0x9C7D, 0x6021,0x9C7E, 0x6060,0x9C80, 0x6019,0x9C81, 0x6010,0x9C82, 0x6029,0x9C83, 0x600E,0x9C84, 0x6031,0x9C85, 0x601B,0x9C86, 0x6015,0x9C87, 0x602B,0x9C88, 0x6026,0x9C89, 0x600F,0x9C8A, 0x603A,0x9C8B, 0x605A,0x9C8C, 0x6041,0x9C8D, 0x606A,0x9C8E, 0x6077,0x9C8F, 0x605F,0x9C90, 0x604A,0x9C91, 0x6046,0x9C92, 0x604D,0x9C93, 0x6063,0x9C94, 0x6043,0x9C95, 0x6064,0x9C96, 0x6042,0x9C97, 0x606C,0x9C98, 0x606B,0x9C99, 0x6059,0x9C9A, 0x6081,0x9C9B, 0x608D,0x9C9C, 0x60E7,0x9C9D, 0x6083,0x9C9E, 0x609A,0x9C9F, 0x6084,0x9CA0, 0x609B,0x9CA1, 0x6096,0x9CA2, 0x6097,0x9CA3, 0x6092,0x9CA4, 0x60A7,0x9CA5, 0x608B,0x9CA6, 0x60E1,0x9CA7, 0x60B8,0x9CA8, 0x60E0,0x9CA9, 0x60D3,0x9CAA, 0x60B4,0x9CAB, 0x5FF0,0x9CAC, 0x60BD,0x9CAD, 0x60C6,0x9CAE, 0x60B5,0x9CAF, 0x60D8,0x9CB0, 0x614D,0x9CB1, 0x6115,0x9CB2, 0x6106,0x9CB3, 0x60F6,0x9CB4, 0x60F7,0x9CB5, 0x6100,0x9CB6, 0x60F4,0x9CB7, 0x60FA,0x9CB8, 0x6103,0x9CB9, 0x6121,0x9CBA, 0x60FB,0x9CBB, 0x60F1,0x9CBC, 0x610D,0x9CBD, 0x610E,0x9CBE, 0x6147,0x9CBF, 0x613E,0x9CC0, 0x6128,0x9CC1, 0x6127,0x9CC2, 0x614A,0x9CC3, 0x613F,0x9CC4, 0x613C,0x9CC5, 0x612C,0x9CC6, 0x6134,0x9CC7, 0x613D,0x9CC8, 0x6142,0x9CC9, 0x6144,0x9CCA, 0x6173,0x9CCB, 0x6177,0x9CCC, 0x6158,0x9CCD, 0x6159,0x9CCE, 0x615A,0x9CCF, 0x616B,0x9CD0, 0x6174,0x9CD1, 0x616F,0x9CD2, 0x6165,0x9CD3, 0x6171,0x9CD4, 0x615F,0x9CD5, 0x615D,0x9CD6, 0x6153,0x9CD7, 0x6175,0x9CD8, 0x6199,0x9CD9, 0x6196,0x9CDA, 0x6187,0x9CDB, 0x61AC,0x9CDC, 0x6194,0x9CDD, 0x619A,0x9CDE, 0x618A,0x9CDF, 0x6191,0x9CE0, 0x61AB,0x9CE1, 0x61AE,0x9CE2, 0x61CC,0x9CE3, 0x61CA,0x9CE4, 0x61C9,0x9CE5, 0x61F7,0x9CE6, 0x61C8,0x9CE7, 0x61C3,0x9CE8, 0x61C6,0x9CE9, 0x61BA,0x9CEA, 0x61CB,0x9CEB, 0x7F79,0x9CEC, 0x61CD,0x9CED, 0x61E6,0x9CEE, 0x61E3,0x9CEF, 0x61F6,0x9CF0, 0x61FA,0x9CF1, 0x61F4,0x9CF2, 0x61FF,0x9CF3, 0x61FD,0x9CF4, 0x61FC,0x9CF5, 0x61FE,0x9CF6, 0x6200,0x9CF7, 0x6208,0x9CF8, 0x6209,0x9CF9, 0x620D,0x9CFA, 0x620C,0x9CFB, 0x6214,0x9CFC, 0x621B,0x9D40, 0x621E,0x9D41, 0x6221,0x9D42, 0x622A,0x9D43, 0x622E,0x9D44, 0x6230,0x9D45, 0x6232,0x9D46, 0x6233,0x9D47, 0x6241,0x9D48, 0x624E,0x9D49, 0x625E,0x9D4A, 0x6263,0x9D4B, 0x625B,0x9D4C, 0x6260,0x9D4D, 0x6268,0x9D4E, 0x627C,0x9D4F, 0x6282,0x9D50, 0x6289,0x9D51, 0x627E,0x9D52, 0x6292,0x9D53, 0x6293,0x9D54, 0x6296,0x9D55, 0x62D4,0x9D56, 0x6283,0x9D57, 0x6294,0x9D58, 0x62D7,0x9D59, 0x62D1,0x9D5A, 0x62BB,0x9D5B, 0x62CF,0x9D5C, 0x62FF,0x9D5D, 0x62C6,0x9D5E, 0x64D4,0x9D5F, 0x62C8,0x9D60, 0x62DC,0x9D61, 0x62CC,0x9D62, 0x62CA,0x9D63, 0x62C2,0x9D64, 0x62C7,0x9D65, 0x629B,0x9D66, 0x62C9,0x9D67, 0x630C,0x9D68, 0x62EE,0x9D69, 0x62F1,0x9D6A, 0x6327,0x9D6B, 0x6302,0x9D6C, 0x6308,0x9D6D, 0x62EF,0x9D6E, 0x62F5,0x9D6F, 0x6350,0x9D70, 0x633E,0x9D71, 0x634D,0x9D72, 0x641C,0x9D73, 0x634F,0x9D74, 0x6396,0x9D75, 0x638E,0x9D76, 0x6380,0x9D77, 0x63AB,0x9D78, 0x6376,0x9D79, 0x63A3,0x9D7A, 0x638F,0x9D7B, 0x6389,0x9D7C, 0x639F,0x9D7D, 0x63B5,0x9D7E, 0x636B,0x9D80, 0x6369,0x9D81, 0x63BE,0x9D82, 0x63E9,0x9D83, 0x63C0,0x9D84, 0x63C6,0x9D85, 0x63E3,0x9D86, 0x63C9,0x9D87, 0x63D2,0x9D88, 0x63F6,0x9D89, 0x63C4,0x9D8A, 0x6416,0x9D8B, 0x6434,0x9D8C, 0x6406,0x9D8D, 0x6413,0x9D8E, 0x6426,0x9D8F, 0x6436,0x9D90, 0x651D,0x9D91, 0x6417,0x9D92, 0x6428,0x9D93, 0x640F,0x9D94, 0x6467,0x9D95, 0x646F,0x9D96, 0x6476,0x9D97, 0x644E,0x9D98, 0x652A,0x9D99, 0x6495,0x9D9A, 0x6493,0x9D9B, 0x64A5,0x9D9C, 0x64A9,0x9D9D, 0x6488,0x9D9E, 0x64BC,0x9D9F, 0x64DA,0x9DA0, 0x64D2,0x9DA1, 0x64C5,0x9DA2, 0x64C7,0x9DA3, 0x64BB,0x9DA4, 0x64D8,0x9DA5, 0x64C2,0x9DA6, 0x64F1,0x9DA7, 0x64E7,0x9DA8, 0x8209,0x9DA9, 0x64E0,0x9DAA, 0x64E1,0x9DAB, 0x62AC,0x9DAC, 0x64E3,0x9DAD, 0x64EF,0x9DAE, 0x652C,0x9DAF, 0x64F6,0x9DB0, 0x64F4,0x9DB1, 0x64F2,0x9DB2, 0x64FA,0x9DB3, 0x6500,0x9DB4, 0x64FD,0x9DB5, 0x6518,0x9DB6, 0x651C,0x9DB7, 0x6505,0x9DB8, 0x6524,0x9DB9, 0x6523,0x9DBA, 0x652B,0x9DBB, 0x6534,0x9DBC, 0x6535,0x9DBD, 0x6537,0x9DBE, 0x6536,0x9DBF, 0x6538,0x9DC0, 0x754B,0x9DC1, 0x6548,0x9DC2, 0x6556,0x9DC3, 0x6555,0x9DC4, 0x654D,0x9DC5, 0x6558,0x9DC6, 0x655E,0x9DC7, 0x655D,0x9DC8, 0x6572,0x9DC9, 0x6578,0x9DCA, 0x6582,0x9DCB, 0x6583,0x9DCC, 0x8B8A,0x9DCD, 0x659B,0x9DCE, 0x659F,0x9DCF, 0x65AB,0x9DD0, 0x65B7,0x9DD1, 0x65C3,0x9DD2, 0x65C6,0x9DD3, 0x65C1,0x9DD4, 0x65C4,0x9DD5, 0x65CC,0x9DD6, 0x65D2,0x9DD7, 0x65DB,0x9DD8, 0x65D9,0x9DD9, 0x65E0,0x9DDA, 0x65E1,0x9DDB, 0x65F1,0x9DDC, 0x6772,0x9DDD, 0x660A,0x9DDE, 0x6603,0x9DDF, 0x65FB,0x9DE0, 0x6773,0x9DE1, 0x6635,0x9DE2, 0x6636,0x9DE3, 0x6634,0x9DE4, 0x661C,0x9DE5, 0x664F,0x9DE6, 0x6644,0x9DE7, 0x6649,0x9DE8, 0x6641,0x9DE9, 0x665E,0x9DEA, 0x665D,0x9DEB, 0x6664,0x9DEC, 0x6667,0x9DED, 0x6668,0x9DEE, 0x665F,0x9DEF, 0x6662,0x9DF0, 0x6670,0x9DF1, 0x6683,0x9DF2, 0x6688,0x9DF3, 0x668E,0x9DF4, 0x6689,0x9DF5, 0x6684,0x9DF6, 0x6698,0x9DF7, 0x669D,0x9DF8, 0x66C1,0x9DF9, 0x66B9,0x9DFA, 0x66C9,0x9DFB, 0x66BE,0x9DFC, 0x66BC,0x9E40, 0x66C4,0x9E41, 0x66B8,0x9E42, 0x66D6,0x9E43, 0x66DA,0x9E44, 0x66E0,0x9E45, 0x663F,0x9E46, 0x66E6,0x9E47, 0x66E9,0x9E48, 0x66F0,0x9E49, 0x66F5,0x9E4A, 0x66F7,0x9E4B, 0x670F,0x9E4C, 0x6716,0x9E4D, 0x671E,0x9E4E, 0x6726,0x9E4F, 0x6727,0x9E50, 0x9738,0x9E51, 0x672E,0x9E52, 0x673F,0x9E53, 0x6736,0x9E54, 0x6741,0x9E55, 0x6738,0x9E56, 0x6737,0x9E57, 0x6746,0x9E58, 0x675E,0x9E59, 0x6760,0x9E5A, 0x6759,0x9E5B, 0x6763,0x9E5C, 0x6764,0x9E5D, 0x6789,0x9E5E, 0x6770,0x9E5F, 0x67A9,0x9E60, 0x677C,0x9E61, 0x676A,0x9E62, 0x678C,0x9E63, 0x678B,0x9E64, 0x67A6,0x9E65, 0x67A1,0x9E66, 0x6785,0x9E67, 0x67B7,0x9E68, 0x67EF,0x9E69, 0x67B4,0x9E6A, 0x67EC,0x9E6B, 0x67B3,0x9E6C, 0x67E9,0x9E6D, 0x67B8,0x9E6E, 0x67E4,0x9E6F, 0x67DE,0x9E70, 0x67DD,0x9E71, 0x67E2,0x9E72, 0x67EE,0x9E73, 0x67B9,0x9E74, 0x67CE,0x9E75, 0x67C6,0x9E76, 0x67E7,0x9E77, 0x6A9C,0x9E78, 0x681E,0x9E79, 0x6846,0x9E7A, 0x6829,0x9E7B, 0x6840,0x9E7C, 0x684D,0x9E7D, 0x6832,0x9E7E, 0x684E,0x9E80, 0x68B3,0x9E81, 0x682B,0x9E82, 0x6859,0x9E83, 0x6863,0x9E84, 0x6877,0x9E85, 0x687F,0x9E86, 0x689F,0x9E87, 0x688F,0x9E88, 0x68AD,0x9E89, 0x6894,0x9E8A, 0x689D,0x9E8B, 0x689B,0x9E8C, 0x6883,0x9E8D, 0x6AAE,0x9E8E, 0x68B9,0x9E8F, 0x6874,0x9E90, 0x68B5,0x9E91, 0x68A0,0x9E92, 0x68BA,0x9E93, 0x690F,0x9E94, 0x688D,0x9E95, 0x687E,0x9E96, 0x6901,0x9E97, 0x68CA,0x9E98, 0x6908,0x9E99, 0x68D8,0x9E9A, 0x6922,0x9E9B, 0x6926,0x9E9C, 0x68E1,0x9E9D, 0x690C,0x9E9E, 0x68CD,0x9E9F, 0x68D4,0x9EA0, 0x68E7,0x9EA1, 0x68D5,0x9EA2, 0x6936,0x9EA3, 0x6912,0x9EA4, 0x6904,0x9EA5, 0x68D7,0x9EA6, 0x68E3,0x9EA7, 0x6925,0x9EA8, 0x68F9,0x9EA9, 0x68E0,0x9EAA, 0x68EF,0x9EAB, 0x6928,0x9EAC, 0x692A,0x9EAD, 0x691A,0x9EAE, 0x6923,0x9EAF, 0x6921,0x9EB0, 0x68C6,0x9EB1, 0x6979,0x9EB2, 0x6977,0x9EB3, 0x695C,0x9EB4, 0x6978,0x9EB5, 0x696B,0x9EB6, 0x6954,0x9EB7, 0x697E,0x9EB8, 0x696E,0x9EB9, 0x6939,0x9EBA, 0x6974,0x9EBB, 0x693D,0x9EBC, 0x6959,0x9EBD, 0x6930,0x9EBE, 0x6961,0x9EBF, 0x695E,0x9EC0, 0x695D,0x9EC1, 0x6981,0x9EC2, 0x696A,0x9EC3, 0x69B2,0x9EC4, 0x69AE,0x9EC5, 0x69D0,0x9EC6, 0x69BF,0x9EC7, 0x69C1,0x9EC8, 0x69D3,0x9EC9, 0x69BE,0x9ECA, 0x69CE,0x9ECB, 0x5BE8,0x9ECC, 0x69CA,0x9ECD, 0x69DD,0x9ECE, 0x69BB,0x9ECF, 0x69C3,0x9ED0, 0x69A7,0x9ED1, 0x6A2E,0x9ED2, 0x6991,0x9ED3, 0x69A0,0x9ED4, 0x699C,0x9ED5, 0x6995,0x9ED6, 0x69B4,0x9ED7, 0x69DE,0x9ED8, 0x69E8,0x9ED9, 0x6A02,0x9EDA, 0x6A1B,0x9EDB, 0x69FF,0x9EDC, 0x6B0A,0x9EDD, 0x69F9,0x9EDE, 0x69F2,0x9EDF, 0x69E7,0x9EE0, 0x6A05,0x9EE1, 0x69B1,0x9EE2, 0x6A1E,0x9EE3, 0x69ED,0x9EE4, 0x6A14,0x9EE5, 0x69EB,0x9EE6, 0x6A0A,0x9EE7, 0x6A12,0x9EE8, 0x6AC1,0x9EE9, 0x6A23,0x9EEA, 0x6A13,0x9EEB, 0x6A44,0x9EEC, 0x6A0C,0x9EED, 0x6A72,0x9EEE, 0x6A36,0x9EEF, 0x6A78,0x9EF0, 0x6A47,0x9EF1, 0x6A62,0x9EF2, 0x6A59,0x9EF3, 0x6A66,0x9EF4, 0x6A48,0x9EF5, 0x6A38,0x9EF6, 0x6A22,0x9EF7, 0x6A90,0x9EF8, 0x6A8D,0x9EF9, 0x6AA0,0x9EFA, 0x6A84,0x9EFB, 0x6AA2,0x9EFC, 0x6AA3,0x9F40, 0x6A97,0x9F41, 0x8617,0x9F42, 0x6ABB,0x9F43, 0x6AC3,0x9F44, 0x6AC2,0x9F45, 0x6AB8,0x9F46, 0x6AB3,0x9F47, 0x6AAC,0x9F48, 0x6ADE,0x9F49, 0x6AD1,0x9F4A, 0x6ADF,0x9F4B, 0x6AAA,0x9F4C, 0x6ADA,0x9F4D, 0x6AEA,0x9F4E, 0x6AFB,0x9F4F, 0x6B05,0x9F50, 0x8616,0x9F51, 0x6AFA,0x9F52, 0x6B12,0x9F53, 0x6B16,0x9F54, 0x9B31,0x9F55, 0x6B1F,0x9F56, 0x6B38,0x9F57, 0x6B37,0x9F58, 0x76DC,0x9F59, 0x6B39,0x9F5A, 0x98EE,0x9F5B, 0x6B47,0x9F5C, 0x6B43,0x9F5D, 0x6B49,0x9F5E, 0x6B50,0x9F5F, 0x6B59,0x9F60, 0x6B54,0x9F61, 0x6B5B,0x9F62, 0x6B5F,0x9F63, 0x6B61,0x9F64, 0x6B78,0x9F65, 0x6B79,0x9F66, 0x6B7F,0x9F67, 0x6B80,0x9F68, 0x6B84,0x9F69, 0x6B83,0x9F6A, 0x6B8D,0x9F6B, 0x6B98,0x9F6C, 0x6B95,0x9F6D, 0x6B9E,0x9F6E, 0x6BA4,0x9F6F, 0x6BAA,0x9F70, 0x6BAB,0x9F71, 0x6BAF,0x9F72, 0x6BB2,0x9F73, 0x6BB1,0x9F74, 0x6BB3,0x9F75, 0x6BB7,0x9F76, 0x6BBC,0x9F77, 0x6BC6,0x9F78, 0x6BCB,0x9F79, 0x6BD3,0x9F7A, 0x6BDF,0x9F7B, 0x6BEC,0x9F7C, 0x6BEB,0x9F7D, 0x6BF3,0x9F7E, 0x6BEF,0x9F80, 0x9EBE,0x9F81, 0x6C08,0x9F82, 0x6C13,0x9F83, 0x6C14,0x9F84, 0x6C1B,0x9F85, 0x6C24,0x9F86, 0x6C23,0x9F87, 0x6C5E,0x9F88, 0x6C55,0x9F89, 0x6C62,0x9F8A, 0x6C6A,0x9F8B, 0x6C82,0x9F8C, 0x6C8D,0x9F8D, 0x6C9A,0x9F8E, 0x6C81,0x9F8F, 0x6C9B,0x9F90, 0x6C7E,0x9F91, 0x6C68,0x9F92, 0x6C73,0x9F93, 0x6C92,0x9F94, 0x6C90,0x9F95, 0x6CC4,0x9F96, 0x6CF1,0x9F97, 0x6CD3,0x9F98, 0x6CBD,0x9F99, 0x6CD7,0x9F9A, 0x6CC5,0x9F9B, 0x6CDD,0x9F9C, 0x6CAE,0x9F9D, 0x6CB1,0x9F9E, 0x6CBE,0x9F9F, 0x6CBA,0x9FA0, 0x6CDB,0x9FA1, 0x6CEF,0x9FA2, 0x6CD9,0x9FA3, 0x6CEA,0x9FA4, 0x6D1F,0x9FA5, 0x884D,0x9FA6, 0x6D36,0x9FA7, 0x6D2B,0x9FA8, 0x6D3D,0x9FA9, 0x6D38,0x9FAA, 0x6D19,0x9FAB, 0x6D35,0x9FAC, 0x6D33,0x9FAD, 0x6D12,0x9FAE, 0x6D0C,0x9FAF, 0x6D63,0x9FB0, 0x6D93,0x9FB1, 0x6D64,0x9FB2, 0x6D5A,0x9FB3, 0x6D79,0x9FB4, 0x6D59,0x9FB5, 0x6D8E,0x9FB6, 0x6D95,0x9FB7, 0x6FE4,0x9FB8, 0x6D85,0x9FB9, 0x6DF9,0x9FBA, 0x6E15,0x9FBB, 0x6E0A,0x9FBC, 0x6DB5,0x9FBD, 0x6DC7,0x9FBE, 0x6DE6,0x9FBF, 0x6DB8,0x9FC0, 0x6DC6,0x9FC1, 0x6DEC,0x9FC2, 0x6DDE,0x9FC3, 0x6DCC,0x9FC4, 0x6DE8,0x9FC5, 0x6DD2,0x9FC6, 0x6DC5,0x9FC7, 0x6DFA,0x9FC8, 0x6DD9,0x9FC9, 0x6DE4,0x9FCA, 0x6DD5,0x9FCB, 0x6DEA,0x9FCC, 0x6DEE,0x9FCD, 0x6E2D,0x9FCE, 0x6E6E,0x9FCF, 0x6E2E,0x9FD0, 0x6E19,0x9FD1, 0x6E72,0x9FD2, 0x6E5F,0x9FD3, 0x6E3E,0x9FD4, 0x6E23,0x9FD5, 0x6E6B,0x9FD6, 0x6E2B,0x9FD7, 0x6E76,0x9FD8, 0x6E4D,0x9FD9, 0x6E1F,0x9FDA, 0x6E43,0x9FDB, 0x6E3A,0x9FDC, 0x6E4E,0x9FDD, 0x6E24,0x9FDE, 0x6EFF,0x9FDF, 0x6E1D,0x9FE0, 0x6E38,0x9FE1, 0x6E82,0x9FE2, 0x6EAA,0x9FE3, 0x6E98,0x9FE4, 0x6EC9,0x9FE5, 0x6EB7,0x9FE6, 0x6ED3,0x9FE7, 0x6EBD,0x9FE8, 0x6EAF,0x9FE9, 0x6EC4,0x9FEA, 0x6EB2,0x9FEB, 0x6ED4,0x9FEC, 0x6ED5,0x9FED, 0x6E8F,0x9FEE, 0x6EA5,0x9FEF, 0x6EC2,0x9FF0, 0x6E9F,0x9FF1, 0x6F41,0x9FF2, 0x6F11,0x9FF3, 0x704C,0x9FF4, 0x6EEC,0x9FF5, 0x6EF8,0x9FF6, 0x6EFE,0x9FF7, 0x6F3F,0x9FF8, 0x6EF2,0x9FF9, 0x6F31,0x9FFA, 0x6EEF,0x9FFB, 0x6F32,0x9FFC, 0x6ECC,0xE040, 0x6F3E,0xE041, 0x6F13,0xE042, 0x6EF7,0xE043, 0x6F86,0xE044, 0x6F7A,0xE045, 0x6F78,0xE046, 0x6F81,0xE047, 0x6F80,0xE048, 0x6F6F,0xE049, 0x6F5B,0xE04A, 0x6FF3,0xE04B, 0x6F6D,0xE04C, 0x6F82,0xE04D, 0x6F7C,0xE04E, 0x6F58,0xE04F, 0x6F8E,0xE050, 0x6F91,0xE051, 0x6FC2,0xE052, 0x6F66,0xE053, 0x6FB3,0xE054, 0x6FA3,0xE055, 0x6FA1,0xE056, 0x6FA4,0xE057, 0x6FB9,0xE058, 0x6FC6,0xE059, 0x6FAA,0xE05A, 0x6FDF,0xE05B, 0x6FD5,0xE05C, 0x6FEC,0xE05D, 0x6FD4,0xE05E, 0x6FD8,0xE05F, 0x6FF1,0xE060, 0x6FEE,0xE061, 0x6FDB,0xE062, 0x7009,0xE063, 0x700B,0xE064, 0x6FFA,0xE065, 0x7011,0xE066, 0x7001,0xE067, 0x700F,0xE068, 0x6FFE,0xE069, 0x701B,0xE06A, 0x701A,0xE06B, 0x6F74,0xE06C, 0x701D,0xE06D, 0x7018,0xE06E, 0x701F,0xE06F, 0x7030,0xE070, 0x703E,0xE071, 0x7032,0xE072, 0x7051,0xE073, 0x7063,0xE074, 0x7099,0xE075, 0x7092,0xE076, 0x70AF,0xE077, 0x70F1,0xE078, 0x70AC,0xE079, 0x70B8,0xE07A, 0x70B3,0xE07B, 0x70AE,0xE07C, 0x70DF,0xE07D, 0x70CB,0xE07E, 0x70DD,0xE080, 0x70D9,0xE081, 0x7109,0xE082, 0x70FD,0xE083, 0x711C,0xE084, 0x7119,0xE085, 0x7165,0xE086, 0x7155,0xE087, 0x7188,0xE088, 0x7166,0xE089, 0x7162,0xE08A, 0x714C,0xE08B, 0x7156,0xE08C, 0x716C,0xE08D, 0x718F,0xE08E, 0x71FB,0xE08F, 0x7184,0xE090, 0x7195,0xE091, 0x71A8,0xE092, 0x71AC,0xE093, 0x71D7,0xE094, 0x71B9,0xE095, 0x71BE,0xE096, 0x71D2,0xE097, 0x71C9,0xE098, 0x71D4,0xE099, 0x71CE,0xE09A, 0x71E0,0xE09B, 0x71EC,0xE09C, 0x71E7,0xE09D, 0x71F5,0xE09E, 0x71FC,0xE09F, 0x71F9,0xE0A0, 0x71FF,0xE0A1, 0x720D,0xE0A2, 0x7210,0xE0A3, 0x721B,0xE0A4, 0x7228,0xE0A5, 0x722D,0xE0A6, 0x722C,0xE0A7, 0x7230,0xE0A8, 0x7232,0xE0A9, 0x723B,0xE0AA, 0x723C,0xE0AB, 0x723F,0xE0AC, 0x7240,0xE0AD, 0x7246,0xE0AE, 0x724B,0xE0AF, 0x7258,0xE0B0, 0x7274,0xE0B1, 0x727E,0xE0B2, 0x7282,0xE0B3, 0x7281,0xE0B4, 0x7287,0xE0B5, 0x7292,0xE0B6, 0x7296,0xE0B7, 0x72A2,0xE0B8, 0x72A7,0xE0B9, 0x72B9,0xE0BA, 0x72B2,0xE0BB, 0x72C3,0xE0BC, 0x72C6,0xE0BD, 0x72C4,0xE0BE, 0x72CE,0xE0BF, 0x72D2,0xE0C0, 0x72E2,0xE0C1, 0x72E0,0xE0C2, 0x72E1,0xE0C3, 0x72F9,0xE0C4, 0x72F7,0xE0C5, 0x500F,0xE0C6, 0x7317,0xE0C7, 0x730A,0xE0C8, 0x731C,0xE0C9, 0x7316,0xE0CA, 0x731D,0xE0CB, 0x7334,0xE0CC, 0x732F,0xE0CD, 0x7329,0xE0CE, 0x7325,0xE0CF, 0x733E,0xE0D0, 0x734E,0xE0D1, 0x734F,0xE0D2, 0x9ED8,0xE0D3, 0x7357,0xE0D4, 0x736A,0xE0D5, 0x7368,0xE0D6, 0x7370,0xE0D7, 0x7378,0xE0D8, 0x7375,0xE0D9, 0x737B,0xE0DA, 0x737A,0xE0DB, 0x73C8,0xE0DC, 0x73B3,0xE0DD, 0x73CE,0xE0DE, 0x73BB,0xE0DF, 0x73C0,0xE0E0, 0x73E5,0xE0E1, 0x73EE,0xE0E2, 0x73DE,0xE0E3, 0x74A2,0xE0E4, 0x7405,0xE0E5, 0x746F,0xE0E6, 0x7425,0xE0E7, 0x73F8,0xE0E8, 0x7432,0xE0E9, 0x743A,0xE0EA, 0x7455,0xE0EB, 0x743F,0xE0EC, 0x745F,0xE0ED, 0x7459,0xE0EE, 0x7441,0xE0EF, 0x745C,0xE0F0, 0x7469,0xE0F1, 0x7470,0xE0F2, 0x7463,0xE0F3, 0x746A,0xE0F4, 0x7476,0xE0F5, 0x747E,0xE0F6, 0x748B,0xE0F7, 0x749E,0xE0F8, 0x74A7,0xE0F9, 0x74CA,0xE0FA, 0x74CF,0xE0FB, 0x74D4,0xE0FC, 0x73F1,0xE140, 0x74E0,0xE141, 0x74E3,0xE142, 0x74E7,0xE143, 0x74E9,0xE144, 0x74EE,0xE145, 0x74F2,0xE146, 0x74F0,0xE147, 0x74F1,0xE148, 0x74F8,0xE149, 0x74F7,0xE14A, 0x7504,0xE14B, 0x7503,0xE14C, 0x7505,0xE14D, 0x750C,0xE14E, 0x750E,0xE14F, 0x750D,0xE150, 0x7515,0xE151, 0x7513,0xE152, 0x751E,0xE153, 0x7526,0xE154, 0x752C,0xE155, 0x753C,0xE156, 0x7544,0xE157, 0x754D,0xE158, 0x754A,0xE159, 0x7549,0xE15A, 0x755B,0xE15B, 0x7546,0xE15C, 0x755A,0xE15D, 0x7569,0xE15E, 0x7564,0xE15F, 0x7567,0xE160, 0x756B,0xE161, 0x756D,0xE162, 0x7578,0xE163, 0x7576,0xE164, 0x7586,0xE165, 0x7587,0xE166, 0x7574,0xE167, 0x758A,0xE168, 0x7589,0xE169, 0x7582,0xE16A, 0x7594,0xE16B, 0x759A,0xE16C, 0x759D,0xE16D, 0x75A5,0xE16E, 0x75A3,0xE16F, 0x75C2,0xE170, 0x75B3,0xE171, 0x75C3,0xE172, 0x75B5,0xE173, 0x75BD,0xE174, 0x75B8,0xE175, 0x75BC,0xE176, 0x75B1,0xE177, 0x75CD,0xE178, 0x75CA,0xE179, 0x75D2,0xE17A, 0x75D9,0xE17B, 0x75E3,0xE17C, 0x75DE,0xE17D, 0x75FE,0xE17E, 0x75FF,0xE180, 0x75FC,0xE181, 0x7601,0xE182, 0x75F0,0xE183, 0x75FA,0xE184, 0x75F2,0xE185, 0x75F3,0xE186, 0x760B,0xE187, 0x760D,0xE188, 0x7609,0xE189, 0x761F,0xE18A, 0x7627,0xE18B, 0x7620,0xE18C, 0x7621,0xE18D, 0x7622,0xE18E, 0x7624,0xE18F, 0x7634,0xE190, 0x7630,0xE191, 0x763B,0xE192, 0x7647,0xE193, 0x7648,0xE194, 0x7646,0xE195, 0x765C,0xE196, 0x7658,0xE197, 0x7661,0xE198, 0x7662,0xE199, 0x7668,0xE19A, 0x7669,0xE19B, 0x766A,0xE19C, 0x7667,0xE19D, 0x766C,0xE19E, 0x7670,0xE19F, 0x7672,0xE1A0, 0x7676,0xE1A1, 0x7678,0xE1A2, 0x767C,0xE1A3, 0x7680,0xE1A4, 0x7683,0xE1A5, 0x7688,0xE1A6, 0x768B,0xE1A7, 0x768E,0xE1A8, 0x7696,0xE1A9, 0x7693,0xE1AA, 0x7699,0xE1AB, 0x769A,0xE1AC, 0x76B0,0xE1AD, 0x76B4,0xE1AE, 0x76B8,0xE1AF, 0x76B9,0xE1B0, 0x76BA,0xE1B1, 0x76C2,0xE1B2, 0x76CD,0xE1B3, 0x76D6,0xE1B4, 0x76D2,0xE1B5, 0x76DE,0xE1B6, 0x76E1,0xE1B7, 0x76E5,0xE1B8, 0x76E7,0xE1B9, 0x76EA,0xE1BA, 0x862F,0xE1BB, 0x76FB,0xE1BC, 0x7708,0xE1BD, 0x7707,0xE1BE, 0x7704,0xE1BF, 0x7729,0xE1C0, 0x7724,0xE1C1, 0x771E,0xE1C2, 0x7725,0xE1C3, 0x7726,0xE1C4, 0x771B,0xE1C5, 0x7737,0xE1C6, 0x7738,0xE1C7, 0x7747,0xE1C8, 0x775A,0xE1C9, 0x7768,0xE1CA, 0x776B,0xE1CB, 0x775B,0xE1CC, 0x7765,0xE1CD, 0x777F,0xE1CE, 0x777E,0xE1CF, 0x7779,0xE1D0, 0x778E,0xE1D1, 0x778B,0xE1D2, 0x7791,0xE1D3, 0x77A0,0xE1D4, 0x779E,0xE1D5, 0x77B0,0xE1D6, 0x77B6,0xE1D7, 0x77B9,0xE1D8, 0x77BF,0xE1D9, 0x77BC,0xE1DA, 0x77BD,0xE1DB, 0x77BB,0xE1DC, 0x77C7,0xE1DD, 0x77CD,0xE1DE, 0x77D7,0xE1DF, 0x77DA,0xE1E0, 0x77DC,0xE1E1, 0x77E3,0xE1E2, 0x77EE,0xE1E3, 0x77FC,0xE1E4, 0x780C,0xE1E5, 0x7812,0xE1E6, 0x7926,0xE1E7, 0x7820,0xE1E8, 0x792A,0xE1E9, 0x7845,0xE1EA, 0x788E,0xE1EB, 0x7874,0xE1EC, 0x7886,0xE1ED, 0x787C,0xE1EE, 0x789A,0xE1EF, 0x788C,0xE1F0, 0x78A3,0xE1F1, 0x78B5,0xE1F2, 0x78AA,0xE1F3, 0x78AF,0xE1F4, 0x78D1,0xE1F5, 0x78C6,0xE1F6, 0x78CB,0xE1F7, 0x78D4,0xE1F8, 0x78BE,0xE1F9, 0x78BC,0xE1FA, 0x78C5,0xE1FB, 0x78CA,0xE1FC, 0x78EC,0xE240, 0x78E7,0xE241, 0x78DA,0xE242, 0x78FD,0xE243, 0x78F4,0xE244, 0x7907,0xE245, 0x7912,0xE246, 0x7911,0xE247, 0x7919,0xE248, 0x792C,0xE249, 0x792B,0xE24A, 0x7940,0xE24B, 0x7960,0xE24C, 0x7957,0xE24D, 0x795F,0xE24E, 0x795A,0xE24F, 0x7955,0xE250, 0x7953,0xE251, 0x797A,0xE252, 0x797F,0xE253, 0x798A,0xE254, 0x799D,0xE255, 0x79A7,0xE256, 0x9F4B,0xE257, 0x79AA,0xE258, 0x79AE,0xE259, 0x79B3,0xE25A, 0x79B9,0xE25B, 0x79BA,0xE25C, 0x79C9,0xE25D, 0x79D5,0xE25E, 0x79E7,0xE25F, 0x79EC,0xE260, 0x79E1,0xE261, 0x79E3,0xE262, 0x7A08,0xE263, 0x7A0D,0xE264, 0x7A18,0xE265, 0x7A19,0xE266, 0x7A20,0xE267, 0x7A1F,0xE268, 0x7980,0xE269, 0x7A31,0xE26A, 0x7A3B,0xE26B, 0x7A3E,0xE26C, 0x7A37,0xE26D, 0x7A43,0xE26E, 0x7A57,0xE26F, 0x7A49,0xE270, 0x7A61,0xE271, 0x7A62,0xE272, 0x7A69,0xE273, 0x9F9D,0xE274, 0x7A70,0xE275, 0x7A79,0xE276, 0x7A7D,0xE277, 0x7A88,0xE278, 0x7A97,0xE279, 0x7A95,0xE27A, 0x7A98,0xE27B, 0x7A96,0xE27C, 0x7AA9,0xE27D, 0x7AC8,0xE27E, 0x7AB0,0xE280, 0x7AB6,0xE281, 0x7AC5,0xE282, 0x7AC4,0xE283, 0x7ABF,0xE284, 0x9083,0xE285, 0x7AC7,0xE286, 0x7ACA,0xE287, 0x7ACD,0xE288, 0x7ACF,0xE289, 0x7AD5,0xE28A, 0x7AD3,0xE28B, 0x7AD9,0xE28C, 0x7ADA,0xE28D, 0x7ADD,0xE28E, 0x7AE1,0xE28F, 0x7AE2,0xE290, 0x7AE6,0xE291, 0x7AED,0xE292, 0x7AF0,0xE293, 0x7B02,0xE294, 0x7B0F,0xE295, 0x7B0A,0xE296, 0x7B06,0xE297, 0x7B33,0xE298, 0x7B18,0xE299, 0x7B19,0xE29A, 0x7B1E,0xE29B, 0x7B35,0xE29C, 0x7B28,0xE29D, 0x7B36,0xE29E, 0x7B50,0xE29F, 0x7B7A,0xE2A0, 0x7B04,0xE2A1, 0x7B4D,0xE2A2, 0x7B0B,0xE2A3, 0x7B4C,0xE2A4, 0x7B45,0xE2A5, 0x7B75,0xE2A6, 0x7B65,0xE2A7, 0x7B74,0xE2A8, 0x7B67,0xE2A9, 0x7B70,0xE2AA, 0x7B71,0xE2AB, 0x7B6C,0xE2AC, 0x7B6E,0xE2AD, 0x7B9D,0xE2AE, 0x7B98,0xE2AF, 0x7B9F,0xE2B0, 0x7B8D,0xE2B1, 0x7B9C,0xE2B2, 0x7B9A,0xE2B3, 0x7B8B,0xE2B4, 0x7B92,0xE2B5, 0x7B8F,0xE2B6, 0x7B5D,0xE2B7, 0x7B99,0xE2B8, 0x7BCB,0xE2B9, 0x7BC1,0xE2BA, 0x7BCC,0xE2BB, 0x7BCF,0xE2BC, 0x7BB4,0xE2BD, 0x7BC6,0xE2BE, 0x7BDD,0xE2BF, 0x7BE9,0xE2C0, 0x7C11,0xE2C1, 0x7C14,0xE2C2, 0x7BE6,0xE2C3, 0x7BE5,0xE2C4, 0x7C60,0xE2C5, 0x7C00,0xE2C6, 0x7C07,0xE2C7, 0x7C13,0xE2C8, 0x7BF3,0xE2C9, 0x7BF7,0xE2CA, 0x7C17,0xE2CB, 0x7C0D,0xE2CC, 0x7BF6,0xE2CD, 0x7C23,0xE2CE, 0x7C27,0xE2CF, 0x7C2A,0xE2D0, 0x7C1F,0xE2D1, 0x7C37,0xE2D2, 0x7C2B,0xE2D3, 0x7C3D,0xE2D4, 0x7C4C,0xE2D5, 0x7C43,0xE2D6, 0x7C54,0xE2D7, 0x7C4F,0xE2D8, 0x7C40,0xE2D9, 0x7C50,0xE2DA, 0x7C58,0xE2DB, 0x7C5F,0xE2DC, 0x7C64,0xE2DD, 0x7C56,0xE2DE, 0x7C65,0xE2DF, 0x7C6C,0xE2E0, 0x7C75,0xE2E1, 0x7C83,0xE2E2, 0x7C90,0xE2E3, 0x7CA4,0xE2E4, 0x7CAD,0xE2E5, 0x7CA2,0xE2E6, 0x7CAB,0xE2E7, 0x7CA1,0xE2E8, 0x7CA8,0xE2E9, 0x7CB3,0xE2EA, 0x7CB2,0xE2EB, 0x7CB1,0xE2EC, 0x7CAE,0xE2ED, 0x7CB9,0xE2EE, 0x7CBD,0xE2EF, 0x7CC0,0xE2F0, 0x7CC5,0xE2F1, 0x7CC2,0xE2F2, 0x7CD8,0xE2F3, 0x7CD2,0xE2F4, 0x7CDC,0xE2F5, 0x7CE2,0xE2F6, 0x9B3B,0xE2F7, 0x7CEF,0xE2F8, 0x7CF2,0xE2F9, 0x7CF4,0xE2FA, 0x7CF6,0xE2FB, 0x7CFA,0xE2FC, 0x7D06,0xE340, 0x7D02,0xE341, 0x7D1C,0xE342, 0x7D15,0xE343, 0x7D0A,0xE344, 0x7D45,0xE345, 0x7D4B,0xE346, 0x7D2E,0xE347, 0x7D32,0xE348, 0x7D3F,0xE349, 0x7D35,0xE34A, 0x7D46,0xE34B, 0x7D73,0xE34C, 0x7D56,0xE34D, 0x7D4E,0xE34E, 0x7D72,0xE34F, 0x7D68,0xE350, 0x7D6E,0xE351, 0x7D4F,0xE352, 0x7D63,0xE353, 0x7D93,0xE354, 0x7D89,0xE355, 0x7D5B,0xE356, 0x7D8F,0xE357, 0x7D7D,0xE358, 0x7D9B,0xE359, 0x7DBA,0xE35A, 0x7DAE,0xE35B, 0x7DA3,0xE35C, 0x7DB5,0xE35D, 0x7DC7,0xE35E, 0x7DBD,0xE35F, 0x7DAB,0xE360, 0x7E3D,0xE361, 0x7DA2,0xE362, 0x7DAF,0xE363, 0x7DDC,0xE364, 0x7DB8,0xE365, 0x7D9F,0xE366, 0x7DB0,0xE367, 0x7DD8,0xE368, 0x7DDD,0xE369, 0x7DE4,0xE36A, 0x7DDE,0xE36B, 0x7DFB,0xE36C, 0x7DF2,0xE36D, 0x7DE1,0xE36E, 0x7E05,0xE36F, 0x7E0A,0xE370, 0x7E23,0xE371, 0x7E21,0xE372, 0x7E12,0xE373, 0x7E31,0xE374, 0x7E1F,0xE375, 0x7E09,0xE376, 0x7E0B,0xE377, 0x7E22,0xE378, 0x7E46,0xE379, 0x7E66,0xE37A, 0x7E3B,0xE37B, 0x7E35,0xE37C, 0x7E39,0xE37D, 0x7E43,0xE37E, 0x7E37,0xE380, 0x7E32,0xE381, 0x7E3A,0xE382, 0x7E67,0xE383, 0x7E5D,0xE384, 0x7E56,0xE385, 0x7E5E,0xE386, 0x7E59,0xE387, 0x7E5A,0xE388, 0x7E79,0xE389, 0x7E6A,0xE38A, 0x7E69,0xE38B, 0x7E7C,0xE38C, 0x7E7B,0xE38D, 0x7E83,0xE38E, 0x7DD5,0xE38F, 0x7E7D,0xE390, 0x8FAE,0xE391, 0x7E7F,0xE392, 0x7E88,0xE393, 0x7E89,0xE394, 0x7E8C,0xE395, 0x7E92,0xE396, 0x7E90,0xE397, 0x7E93,0xE398, 0x7E94,0xE399, 0x7E96,0xE39A, 0x7E8E,0xE39B, 0x7E9B,0xE39C, 0x7E9C,0xE39D, 0x7F38,0xE39E, 0x7F3A,0xE39F, 0x7F45,0xE3A0, 0x7F4C,0xE3A1, 0x7F4D,0xE3A2, 0x7F4E,0xE3A3, 0x7F50,0xE3A4, 0x7F51,0xE3A5, 0x7F55,0xE3A6, 0x7F54,0xE3A7, 0x7F58,0xE3A8, 0x7F5F,0xE3A9, 0x7F60,0xE3AA, 0x7F68,0xE3AB, 0x7F69,0xE3AC, 0x7F67,0xE3AD, 0x7F78,0xE3AE, 0x7F82,0xE3AF, 0x7F86,0xE3B0, 0x7F83,0xE3B1, 0x7F88,0xE3B2, 0x7F87,0xE3B3, 0x7F8C,0xE3B4, 0x7F94,0xE3B5, 0x7F9E,0xE3B6, 0x7F9D,0xE3B7, 0x7F9A,0xE3B8, 0x7FA3,0xE3B9, 0x7FAF,0xE3BA, 0x7FB2,0xE3BB, 0x7FB9,0xE3BC, 0x7FAE,0xE3BD, 0x7FB6,0xE3BE, 0x7FB8,0xE3BF, 0x8B71,0xE3C0, 0x7FC5,0xE3C1, 0x7FC6,0xE3C2, 0x7FCA,0xE3C3, 0x7FD5,0xE3C4, 0x7FD4,0xE3C5, 0x7FE1,0xE3C6, 0x7FE6,0xE3C7, 0x7FE9,0xE3C8, 0x7FF3,0xE3C9, 0x7FF9,0xE3CA, 0x98DC,0xE3CB, 0x8006,0xE3CC, 0x8004,0xE3CD, 0x800B,0xE3CE, 0x8012,0xE3CF, 0x8018,0xE3D0, 0x8019,0xE3D1, 0x801C,0xE3D2, 0x8021,0xE3D3, 0x8028,0xE3D4, 0x803F,0xE3D5, 0x803B,0xE3D6, 0x804A,0xE3D7, 0x8046,0xE3D8, 0x8052,0xE3D9, 0x8058,0xE3DA, 0x805A,0xE3DB, 0x805F,0xE3DC, 0x8062,0xE3DD, 0x8068,0xE3DE, 0x8073,0xE3DF, 0x8072,0xE3E0, 0x8070,0xE3E1, 0x8076,0xE3E2, 0x8079,0xE3E3, 0x807D,0xE3E4, 0x807F,0xE3E5, 0x8084,0xE3E6, 0x8086,0xE3E7, 0x8085,0xE3E8, 0x809B,0xE3E9, 0x8093,0xE3EA, 0x809A,0xE3EB, 0x80AD,0xE3EC, 0x5190,0xE3ED, 0x80AC,0xE3EE, 0x80DB,0xE3EF, 0x80E5,0xE3F0, 0x80D9,0xE3F1, 0x80DD,0xE3F2, 0x80C4,0xE3F3, 0x80DA,0xE3F4, 0x80D6,0xE3F5, 0x8109,0xE3F6, 0x80EF,0xE3F7, 0x80F1,0xE3F8, 0x811B,0xE3F9, 0x8129,0xE3FA, 0x8123,0xE3FB, 0x812F,0xE3FC, 0x814B,0xE440, 0x968B,0xE441, 0x8146,0xE442, 0x813E,0xE443, 0x8153,0xE444, 0x8151,0xE445, 0x80FC,0xE446, 0x8171,0xE447, 0x816E,0xE448, 0x8165,0xE449, 0x8166,0xE44A, 0x8174,0xE44B, 0x8183,0xE44C, 0x8188,0xE44D, 0x818A,0xE44E, 0x8180,0xE44F, 0x8182,0xE450, 0x81A0,0xE451, 0x8195,0xE452, 0x81A4,0xE453, 0x81A3,0xE454, 0x815F,0xE455, 0x8193,0xE456, 0x81A9,0xE457, 0x81B0,0xE458, 0x81B5,0xE459, 0x81BE,0xE45A, 0x81B8,0xE45B, 0x81BD,0xE45C, 0x81C0,0xE45D, 0x81C2,0xE45E, 0x81BA,0xE45F, 0x81C9,0xE460, 0x81CD,0xE461, 0x81D1,0xE462, 0x81D9,0xE463, 0x81D8,0xE464, 0x81C8,0xE465, 0x81DA,0xE466, 0x81DF,0xE467, 0x81E0,0xE468, 0x81E7,0xE469, 0x81FA,0xE46A, 0x81FB,0xE46B, 0x81FE,0xE46C, 0x8201,0xE46D, 0x8202,0xE46E, 0x8205,0xE46F, 0x8207,0xE470, 0x820A,0xE471, 0x820D,0xE472, 0x8210,0xE473, 0x8216,0xE474, 0x8229,0xE475, 0x822B,0xE476, 0x8238,0xE477, 0x8233,0xE478, 0x8240,0xE479, 0x8259,0xE47A, 0x8258,0xE47B, 0x825D,0xE47C, 0x825A,0xE47D, 0x825F,0xE47E, 0x8264,0xE480, 0x8262,0xE481, 0x8268,0xE482, 0x826A,0xE483, 0x826B,0xE484, 0x822E,0xE485, 0x8271,0xE486, 0x8277,0xE487, 0x8278,0xE488, 0x827E,0xE489, 0x828D,0xE48A, 0x8292,0xE48B, 0x82AB,0xE48C, 0x829F,0xE48D, 0x82BB,0xE48E, 0x82AC,0xE48F, 0x82E1,0xE490, 0x82E3,0xE491, 0x82DF,0xE492, 0x82D2,0xE493, 0x82F4,0xE494, 0x82F3,0xE495, 0x82FA,0xE496, 0x8393,0xE497, 0x8303,0xE498, 0x82FB,0xE499, 0x82F9,0xE49A, 0x82DE,0xE49B, 0x8306,0xE49C, 0x82DC,0xE49D, 0x8309,0xE49E, 0x82D9,0xE49F, 0x8335,0xE4A0, 0x8334,0xE4A1, 0x8316,0xE4A2, 0x8332,0xE4A3, 0x8331,0xE4A4, 0x8340,0xE4A5, 0x8339,0xE4A6, 0x8350,0xE4A7, 0x8345,0xE4A8, 0x832F,0xE4A9, 0x832B,0xE4AA, 0x8317,0xE4AB, 0x8318,0xE4AC, 0x8385,0xE4AD, 0x839A,0xE4AE, 0x83AA,0xE4AF, 0x839F,0xE4B0, 0x83A2,0xE4B1, 0x8396,0xE4B2, 0x8323,0xE4B3, 0x838E,0xE4B4, 0x8387,0xE4B5, 0x838A,0xE4B6, 0x837C,0xE4B7, 0x83B5,0xE4B8, 0x8373,0xE4B9, 0x8375,0xE4BA, 0x83A0,0xE4BB, 0x8389,0xE4BC, 0x83A8,0xE4BD, 0x83F4,0xE4BE, 0x8413,0xE4BF, 0x83EB,0xE4C0, 0x83CE,0xE4C1, 0x83FD,0xE4C2, 0x8403,0xE4C3, 0x83D8,0xE4C4, 0x840B,0xE4C5, 0x83C1,0xE4C6, 0x83F7,0xE4C7, 0x8407,0xE4C8, 0x83E0,0xE4C9, 0x83F2,0xE4CA, 0x840D,0xE4CB, 0x8422,0xE4CC, 0x8420,0xE4CD, 0x83BD,0xE4CE, 0x8438,0xE4CF, 0x8506,0xE4D0, 0x83FB,0xE4D1, 0x846D,0xE4D2, 0x842A,0xE4D3, 0x843C,0xE4D4, 0x855A,0xE4D5, 0x8484,0xE4D6, 0x8477,0xE4D7, 0x846B,0xE4D8, 0x84AD,0xE4D9, 0x846E,0xE4DA, 0x8482,0xE4DB, 0x8469,0xE4DC, 0x8446,0xE4DD, 0x842C,0xE4DE, 0x846F,0xE4DF, 0x8479,0xE4E0, 0x8435,0xE4E1, 0x84CA,0xE4E2, 0x8462,0xE4E3, 0x84B9,0xE4E4, 0x84BF,0xE4E5, 0x849F,0xE4E6, 0x84D9,0xE4E7, 0x84CD,0xE4E8, 0x84BB,0xE4E9, 0x84DA,0xE4EA, 0x84D0,0xE4EB, 0x84C1,0xE4EC, 0x84C6,0xE4ED, 0x84D6,0xE4EE, 0x84A1,0xE4EF, 0x8521,0xE4F0, 0x84FF,0xE4F1, 0x84F4,0xE4F2, 0x8517,0xE4F3, 0x8518,0xE4F4, 0x852C,0xE4F5, 0x851F,0xE4F6, 0x8515,0xE4F7, 0x8514,0xE4F8, 0x84FC,0xE4F9, 0x8540,0xE4FA, 0x8563,0xE4FB, 0x8558,0xE4FC, 0x8548,0xE540, 0x8541,0xE541, 0x8602,0xE542, 0x854B,0xE543, 0x8555,0xE544, 0x8580,0xE545, 0x85A4,0xE546, 0x8588,0xE547, 0x8591,0xE548, 0x858A,0xE549, 0x85A8,0xE54A, 0x856D,0xE54B, 0x8594,0xE54C, 0x859B,0xE54D, 0x85EA,0xE54E, 0x8587,0xE54F, 0x859C,0xE550, 0x8577,0xE551, 0x857E,0xE552, 0x8590,0xE553, 0x85C9,0xE554, 0x85BA,0xE555, 0x85CF,0xE556, 0x85B9,0xE557, 0x85D0,0xE558, 0x85D5,0xE559, 0x85DD,0xE55A, 0x85E5,0xE55B, 0x85DC,0xE55C, 0x85F9,0xE55D, 0x860A,0xE55E, 0x8613,0xE55F, 0x860B,0xE560, 0x85FE,0xE561, 0x85FA,0xE562, 0x8606,0xE563, 0x8622,0xE564, 0x861A,0xE565, 0x8630,0xE566, 0x863F,0xE567, 0x864D,0xE568, 0x4E55,0xE569, 0x8654,0xE56A, 0x865F,0xE56B, 0x8667,0xE56C, 0x8671,0xE56D, 0x8693,0xE56E, 0x86A3,0xE56F, 0x86A9,0xE570, 0x86AA,0xE571, 0x868B,0xE572, 0x868C,0xE573, 0x86B6,0xE574, 0x86AF,0xE575, 0x86C4,0xE576, 0x86C6,0xE577, 0x86B0,0xE578, 0x86C9,0xE579, 0x8823,0xE57A, 0x86AB,0xE57B, 0x86D4,0xE57C, 0x86DE,0xE57D, 0x86E9,0xE57E, 0x86EC,0xE580, 0x86DF,0xE581, 0x86DB,0xE582, 0x86EF,0xE583, 0x8712,0xE584, 0x8706,0xE585, 0x8708,0xE586, 0x8700,0xE587, 0x8703,0xE588, 0x86FB,0xE589, 0x8711,0xE58A, 0x8709,0xE58B, 0x870D,0xE58C, 0x86F9,0xE58D, 0x870A,0xE58E, 0x8734,0xE58F, 0x873F,0xE590, 0x8737,0xE591, 0x873B,0xE592, 0x8725,0xE593, 0x8729,0xE594, 0x871A,0xE595, 0x8760,0xE596, 0x875F,0xE597, 0x8778,0xE598, 0x874C,0xE599, 0x874E,0xE59A, 0x8774,0xE59B, 0x8757,0xE59C, 0x8768,0xE59D, 0x876E,0xE59E, 0x8759,0xE59F, 0x8753,0xE5A0, 0x8763,0xE5A1, 0x876A,0xE5A2, 0x8805,0xE5A3, 0x87A2,0xE5A4, 0x879F,0xE5A5, 0x8782,0xE5A6, 0x87AF,0xE5A7, 0x87CB,0xE5A8, 0x87BD,0xE5A9, 0x87C0,0xE5AA, 0x87D0,0xE5AB, 0x96D6,0xE5AC, 0x87AB,0xE5AD, 0x87C4,0xE5AE, 0x87B3,0xE5AF, 0x87C7,0xE5B0, 0x87C6,0xE5B1, 0x87BB,0xE5B2, 0x87EF,0xE5B3, 0x87F2,0xE5B4, 0x87E0,0xE5B5, 0x880F,0xE5B6, 0x880D,0xE5B7, 0x87FE,0xE5B8, 0x87F6,0xE5B9, 0x87F7,0xE5BA, 0x880E,0xE5BB, 0x87D2,0xE5BC, 0x8811,0xE5BD, 0x8816,0xE5BE, 0x8815,0xE5BF, 0x8822,0xE5C0, 0x8821,0xE5C1, 0x8831,0xE5C2, 0x8836,0xE5C3, 0x8839,0xE5C4, 0x8827,0xE5C5, 0x883B,0xE5C6, 0x8844,0xE5C7, 0x8842,0xE5C8, 0x8852,0xE5C9, 0x8859,0xE5CA, 0x885E,0xE5CB, 0x8862,0xE5CC, 0x886B,0xE5CD, 0x8881,0xE5CE, 0x887E,0xE5CF, 0x889E,0xE5D0, 0x8875,0xE5D1, 0x887D,0xE5D2, 0x88B5,0xE5D3, 0x8872,0xE5D4, 0x8882,0xE5D5, 0x8897,0xE5D6, 0x8892,0xE5D7, 0x88AE,0xE5D8, 0x8899,0xE5D9, 0x88A2,0xE5DA, 0x888D,0xE5DB, 0x88A4,0xE5DC, 0x88B0,0xE5DD, 0x88BF,0xE5DE, 0x88B1,0xE5DF, 0x88C3,0xE5E0, 0x88C4,0xE5E1, 0x88D4,0xE5E2, 0x88D8,0xE5E3, 0x88D9,0xE5E4, 0x88DD,0xE5E5, 0x88F9,0xE5E6, 0x8902,0xE5E7, 0x88FC,0xE5E8, 0x88F4,0xE5E9, 0x88E8,0xE5EA, 0x88F2,0xE5EB, 0x8904,0xE5EC, 0x890C,0xE5ED, 0x890A,0xE5EE, 0x8913,0xE5EF, 0x8943,0xE5F0, 0x891E,0xE5F1, 0x8925,0xE5F2, 0x892A,0xE5F3, 0x892B,0xE5F4, 0x8941,0xE5F5, 0x8944,0xE5F6, 0x893B,0xE5F7, 0x8936,0xE5F8, 0x8938,0xE5F9, 0x894C,0xE5FA, 0x891D,0xE5FB, 0x8960,0xE5FC, 0x895E,0xE640, 0x8966,0xE641, 0x8964,0xE642, 0x896D,0xE643, 0x896A,0xE644, 0x896F,0xE645, 0x8974,0xE646, 0x8977,0xE647, 0x897E,0xE648, 0x8983,0xE649, 0x8988,0xE64A, 0x898A,0xE64B, 0x8993,0xE64C, 0x8998,0xE64D, 0x89A1,0xE64E, 0x89A9,0xE64F, 0x89A6,0xE650, 0x89AC,0xE651, 0x89AF,0xE652, 0x89B2,0xE653, 0x89BA,0xE654, 0x89BD,0xE655, 0x89BF,0xE656, 0x89C0,0xE657, 0x89DA,0xE658, 0x89DC,0xE659, 0x89DD,0xE65A, 0x89E7,0xE65B, 0x89F4,0xE65C, 0x89F8,0xE65D, 0x8A03,0xE65E, 0x8A16,0xE65F, 0x8A10,0xE660, 0x8A0C,0xE661, 0x8A1B,0xE662, 0x8A1D,0xE663, 0x8A25,0xE664, 0x8A36,0xE665, 0x8A41,0xE666, 0x8A5B,0xE667, 0x8A52,0xE668, 0x8A46,0xE669, 0x8A48,0xE66A, 0x8A7C,0xE66B, 0x8A6D,0xE66C, 0x8A6C,0xE66D, 0x8A62,0xE66E, 0x8A85,0xE66F, 0x8A82,0xE670, 0x8A84,0xE671, 0x8AA8,0xE672, 0x8AA1,0xE673, 0x8A91,0xE674, 0x8AA5,0xE675, 0x8AA6,0xE676, 0x8A9A,0xE677, 0x8AA3,0xE678, 0x8AC4,0xE679, 0x8ACD,0xE67A, 0x8AC2,0xE67B, 0x8ADA,0xE67C, 0x8AEB,0xE67D, 0x8AF3,0xE67E, 0x8AE7,0xE680, 0x8AE4,0xE681, 0x8AF1,0xE682, 0x8B14,0xE683, 0x8AE0,0xE684, 0x8AE2,0xE685, 0x8AF7,0xE686, 0x8ADE,0xE687, 0x8ADB,0xE688, 0x8B0C,0xE689, 0x8B07,0xE68A, 0x8B1A,0xE68B, 0x8AE1,0xE68C, 0x8B16,0xE68D, 0x8B10,0xE68E, 0x8B17,0xE68F, 0x8B20,0xE690, 0x8B33,0xE691, 0x97AB,0xE692, 0x8B26,0xE693, 0x8B2B,0xE694, 0x8B3E,0xE695, 0x8B28,0xE696, 0x8B41,0xE697, 0x8B4C,0xE698, 0x8B4F,0xE699, 0x8B4E,0xE69A, 0x8B49,0xE69B, 0x8B56,0xE69C, 0x8B5B,0xE69D, 0x8B5A,0xE69E, 0x8B6B,0xE69F, 0x8B5F,0xE6A0, 0x8B6C,0xE6A1, 0x8B6F,0xE6A2, 0x8B74,0xE6A3, 0x8B7D,0xE6A4, 0x8B80,0xE6A5, 0x8B8C,0xE6A6, 0x8B8E,0xE6A7, 0x8B92,0xE6A8, 0x8B93,0xE6A9, 0x8B96,0xE6AA, 0x8B99,0xE6AB, 0x8B9A,0xE6AC, 0x8C3A,0xE6AD, 0x8C41,0xE6AE, 0x8C3F,0xE6AF, 0x8C48,0xE6B0, 0x8C4C,0xE6B1, 0x8C4E,0xE6B2, 0x8C50,0xE6B3, 0x8C55,0xE6B4, 0x8C62,0xE6B5, 0x8C6C,0xE6B6, 0x8C78,0xE6B7, 0x8C7A,0xE6B8, 0x8C82,0xE6B9, 0x8C89,0xE6BA, 0x8C85,0xE6BB, 0x8C8A,0xE6BC, 0x8C8D,0xE6BD, 0x8C8E,0xE6BE, 0x8C94,0xE6BF, 0x8C7C,0xE6C0, 0x8C98,0xE6C1, 0x621D,0xE6C2, 0x8CAD,0xE6C3, 0x8CAA,0xE6C4, 0x8CBD,0xE6C5, 0x8CB2,0xE6C6, 0x8CB3,0xE6C7, 0x8CAE,0xE6C8, 0x8CB6,0xE6C9, 0x8CC8,0xE6CA, 0x8CC1,0xE6CB, 0x8CE4,0xE6CC, 0x8CE3,0xE6CD, 0x8CDA,0xE6CE, 0x8CFD,0xE6CF, 0x8CFA,0xE6D0, 0x8CFB,0xE6D1, 0x8D04,0xE6D2, 0x8D05,0xE6D3, 0x8D0A,0xE6D4, 0x8D07,0xE6D5, 0x8D0F,0xE6D6, 0x8D0D,0xE6D7, 0x8D10,0xE6D8, 0x9F4E,0xE6D9, 0x8D13,0xE6DA, 0x8CCD,0xE6DB, 0x8D14,0xE6DC, 0x8D16,0xE6DD, 0x8D67,0xE6DE, 0x8D6D,0xE6DF, 0x8D71,0xE6E0, 0x8D73,0xE6E1, 0x8D81,0xE6E2, 0x8D99,0xE6E3, 0x8DC2,0xE6E4, 0x8DBE,0xE6E5, 0x8DBA,0xE6E6, 0x8DCF,0xE6E7, 0x8DDA,0xE6E8, 0x8DD6,0xE6E9, 0x8DCC,0xE6EA, 0x8DDB,0xE6EB, 0x8DCB,0xE6EC, 0x8DEA,0xE6ED, 0x8DEB,0xE6EE, 0x8DDF,0xE6EF, 0x8DE3,0xE6F0, 0x8DFC,0xE6F1, 0x8E08,0xE6F2, 0x8E09,0xE6F3, 0x8DFF,0xE6F4, 0x8E1D,0xE6F5, 0x8E1E,0xE6F6, 0x8E10,0xE6F7, 0x8E1F,0xE6F8, 0x8E42,0xE6F9, 0x8E35,0xE6FA, 0x8E30,0xE6FB, 0x8E34,0xE6FC, 0x8E4A,0xE740, 0x8E47,0xE741, 0x8E49,0xE742, 0x8E4C,0xE743, 0x8E50,0xE744, 0x8E48,0xE745, 0x8E59,0xE746, 0x8E64,0xE747, 0x8E60,0xE748, 0x8E2A,0xE749, 0x8E63,0xE74A, 0x8E55,0xE74B, 0x8E76,0xE74C, 0x8E72,0xE74D, 0x8E7C,0xE74E, 0x8E81,0xE74F, 0x8E87,0xE750, 0x8E85,0xE751, 0x8E84,0xE752, 0x8E8B,0xE753, 0x8E8A,0xE754, 0x8E93,0xE755, 0x8E91,0xE756, 0x8E94,0xE757, 0x8E99,0xE758, 0x8EAA,0xE759, 0x8EA1,0xE75A, 0x8EAC,0xE75B, 0x8EB0,0xE75C, 0x8EC6,0xE75D, 0x8EB1,0xE75E, 0x8EBE,0xE75F, 0x8EC5,0xE760, 0x8EC8,0xE761, 0x8ECB,0xE762, 0x8EDB,0xE763, 0x8EE3,0xE764, 0x8EFC,0xE765, 0x8EFB,0xE766, 0x8EEB,0xE767, 0x8EFE,0xE768, 0x8F0A,0xE769, 0x8F05,0xE76A, 0x8F15,0xE76B, 0x8F12,0xE76C, 0x8F19,0xE76D, 0x8F13,0xE76E, 0x8F1C,0xE76F, 0x8F1F,0xE770, 0x8F1B,0xE771, 0x8F0C,0xE772, 0x8F26,0xE773, 0x8F33,0xE774, 0x8F3B,0xE775, 0x8F39,0xE776, 0x8F45,0xE777, 0x8F42,0xE778, 0x8F3E,0xE779, 0x8F4C,0xE77A, 0x8F49,0xE77B, 0x8F46,0xE77C, 0x8F4E,0xE77D, 0x8F57,0xE77E, 0x8F5C,0xE780, 0x8F62,0xE781, 0x8F63,0xE782, 0x8F64,0xE783, 0x8F9C,0xE784, 0x8F9F,0xE785, 0x8FA3,0xE786, 0x8FAD,0xE787, 0x8FAF,0xE788, 0x8FB7,0xE789, 0x8FDA,0xE78A, 0x8FE5,0xE78B, 0x8FE2,0xE78C, 0x8FEA,0xE78D, 0x8FEF,0xE78E, 0x9087,0xE78F, 0x8FF4,0xE790, 0x9005,0xE791, 0x8FF9,0xE792, 0x8FFA,0xE793, 0x9011,0xE794, 0x9015,0xE795, 0x9021,0xE796, 0x900D,0xE797, 0x901E,0xE798, 0x9016,0xE799, 0x900B,0xE79A, 0x9027,0xE79B, 0x9036,0xE79C, 0x9035,0xE79D, 0x9039,0xE79E, 0x8FF8,0xE79F, 0x904F,0xE7A0, 0x9050,0xE7A1, 0x9051,0xE7A2, 0x9052,0xE7A3, 0x900E,0xE7A4, 0x9049,0xE7A5, 0x903E,0xE7A6, 0x9056,0xE7A7, 0x9058,0xE7A8, 0x905E,0xE7A9, 0x9068,0xE7AA, 0x906F,0xE7AB, 0x9076,0xE7AC, 0x96A8,0xE7AD, 0x9072,0xE7AE, 0x9082,0xE7AF, 0x907D,0xE7B0, 0x9081,0xE7B1, 0x9080,0xE7B2, 0x908A,0xE7B3, 0x9089,0xE7B4, 0x908F,0xE7B5, 0x90A8,0xE7B6, 0x90AF,0xE7B7, 0x90B1,0xE7B8, 0x90B5,0xE7B9, 0x90E2,0xE7BA, 0x90E4,0xE7BB, 0x6248,0xE7BC, 0x90DB,0xE7BD, 0x9102,0xE7BE, 0x9112,0xE7BF, 0x9119,0xE7C0, 0x9132,0xE7C1, 0x9130,0xE7C2, 0x914A,0xE7C3, 0x9156,0xE7C4, 0x9158,0xE7C5, 0x9163,0xE7C6, 0x9165,0xE7C7, 0x9169,0xE7C8, 0x9173,0xE7C9, 0x9172,0xE7CA, 0x918B,0xE7CB, 0x9189,0xE7CC, 0x9182,0xE7CD, 0x91A2,0xE7CE, 0x91AB,0xE7CF, 0x91AF,0xE7D0, 0x91AA,0xE7D1, 0x91B5,0xE7D2, 0x91B4,0xE7D3, 0x91BA,0xE7D4, 0x91C0,0xE7D5, 0x91C1,0xE7D6, 0x91C9,0xE7D7, 0x91CB,0xE7D8, 0x91D0,0xE7D9, 0x91D6,0xE7DA, 0x91DF,0xE7DB, 0x91E1,0xE7DC, 0x91DB,0xE7DD, 0x91FC,0xE7DE, 0x91F5,0xE7DF, 0x91F6,0xE7E0, 0x921E,0xE7E1, 0x91FF,0xE7E2, 0x9214,0xE7E3, 0x922C,0xE7E4, 0x9215,0xE7E5, 0x9211,0xE7E6, 0x925E,0xE7E7, 0x9257,0xE7E8, 0x9245,0xE7E9, 0x9249,0xE7EA, 0x9264,0xE7EB, 0x9248,0xE7EC, 0x9295,0xE7ED, 0x923F,0xE7EE, 0x924B,0xE7EF, 0x9250,0xE7F0, 0x929C,0xE7F1, 0x9296,0xE7F2, 0x9293,0xE7F3, 0x929B,0xE7F4, 0x925A,0xE7F5, 0x92CF,0xE7F6, 0x92B9,0xE7F7, 0x92B7,0xE7F8, 0x92E9,0xE7F9, 0x930F,0xE7FA, 0x92FA,0xE7FB, 0x9344,0xE7FC, 0x932E,0xE840, 0x9319,0xE841, 0x9322,0xE842, 0x931A,0xE843, 0x9323,0xE844, 0x933A,0xE845, 0x9335,0xE846, 0x933B,0xE847, 0x935C,0xE848, 0x9360,0xE849, 0x937C,0xE84A, 0x936E,0xE84B, 0x9356,0xE84C, 0x93B0,0xE84D, 0x93AC,0xE84E, 0x93AD,0xE84F, 0x9394,0xE850, 0x93B9,0xE851, 0x93D6,0xE852, 0x93D7,0xE853, 0x93E8,0xE854, 0x93E5,0xE855, 0x93D8,0xE856, 0x93C3,0xE857, 0x93DD,0xE858, 0x93D0,0xE859, 0x93C8,0xE85A, 0x93E4,0xE85B, 0x941A,0xE85C, 0x9414,0xE85D, 0x9413,0xE85E, 0x9403,0xE85F, 0x9407,0xE860, 0x9410,0xE861, 0x9436,0xE862, 0x942B,0xE863, 0x9435,0xE864, 0x9421,0xE865, 0x943A,0xE866, 0x9441,0xE867, 0x9452,0xE868, 0x9444,0xE869, 0x945B,0xE86A, 0x9460,0xE86B, 0x9462,0xE86C, 0x945E,0xE86D, 0x946A,0xE86E, 0x9229,0xE86F, 0x9470,0xE870, 0x9475,0xE871, 0x9477,0xE872, 0x947D,0xE873, 0x945A,0xE874, 0x947C,0xE875, 0x947E,0xE876, 0x9481,0xE877, 0x947F,0xE878, 0x9582,0xE879, 0x9587,0xE87A, 0x958A,0xE87B, 0x9594,0xE87C, 0x9596,0xE87D, 0x9598,0xE87E, 0x9599,0xE880, 0x95A0,0xE881, 0x95A8,0xE882, 0x95A7,0xE883, 0x95AD,0xE884, 0x95BC,0xE885, 0x95BB,0xE886, 0x95B9,0xE887, 0x95BE,0xE888, 0x95CA,0xE889, 0x6FF6,0xE88A, 0x95C3,0xE88B, 0x95CD,0xE88C, 0x95CC,0xE88D, 0x95D5,0xE88E, 0x95D4,0xE88F, 0x95D6,0xE890, 0x95DC,0xE891, 0x95E1,0xE892, 0x95E5,0xE893, 0x95E2,0xE894, 0x9621,0xE895, 0x9628,0xE896, 0x962E,0xE897, 0x962F,0xE898, 0x9642,0xE899, 0x964C,0xE89A, 0x964F,0xE89B, 0x964B,0xE89C, 0x9677,0xE89D, 0x965C,0xE89E, 0x965E,0xE89F, 0x965D,0xE8A0, 0x965F,0xE8A1, 0x9666,0xE8A2, 0x9672,0xE8A3, 0x966C,0xE8A4, 0x968D,0xE8A5, 0x9698,0xE8A6, 0x9695,0xE8A7, 0x9697,0xE8A8, 0x96AA,0xE8A9, 0x96A7,0xE8AA, 0x96B1,0xE8AB, 0x96B2,0xE8AC, 0x96B0,0xE8AD, 0x96B4,0xE8AE, 0x96B6,0xE8AF, 0x96B8,0xE8B0, 0x96B9,0xE8B1, 0x96CE,0xE8B2, 0x96CB,0xE8B3, 0x96C9,0xE8B4, 0x96CD,0xE8B5, 0x894D,0xE8B6, 0x96DC,0xE8B7, 0x970D,0xE8B8, 0x96D5,0xE8B9, 0x96F9,0xE8BA, 0x9704,0xE8BB, 0x9706,0xE8BC, 0x9708,0xE8BD, 0x9713,0xE8BE, 0x970E,0xE8BF, 0x9711,0xE8C0, 0x970F,0xE8C1, 0x9716,0xE8C2, 0x9719,0xE8C3, 0x9724,0xE8C4, 0x972A,0xE8C5, 0x9730,0xE8C6, 0x9739,0xE8C7, 0x973D,0xE8C8, 0x973E,0xE8C9, 0x9744,0xE8CA, 0x9746,0xE8CB, 0x9748,0xE8CC, 0x9742,0xE8CD, 0x9749,0xE8CE, 0x975C,0xE8CF, 0x9760,0xE8D0, 0x9764,0xE8D1, 0x9766,0xE8D2, 0x9768,0xE8D3, 0x52D2,0xE8D4, 0x976B,0xE8D5, 0x9771,0xE8D6, 0x9779,0xE8D7, 0x9785,0xE8D8, 0x977C,0xE8D9, 0x9781,0xE8DA, 0x977A,0xE8DB, 0x9786,0xE8DC, 0x978B,0xE8DD, 0x978F,0xE8DE, 0x9790,0xE8DF, 0x979C,0xE8E0, 0x97A8,0xE8E1, 0x97A6,0xE8E2, 0x97A3,0xE8E3, 0x97B3,0xE8E4, 0x97B4,0xE8E5, 0x97C3,0xE8E6, 0x97C6,0xE8E7, 0x97C8,0xE8E8, 0x97CB,0xE8E9, 0x97DC,0xE8EA, 0x97ED,0xE8EB, 0x9F4F,0xE8EC, 0x97F2,0xE8ED, 0x7ADF,0xE8EE, 0x97F6,0xE8EF, 0x97F5,0xE8F0, 0x980F,0xE8F1, 0x980C,0xE8F2, 0x9838,0xE8F3, 0x9824,0xE8F4, 0x9821,0xE8F5, 0x9837,0xE8F6, 0x983D,0xE8F7, 0x9846,0xE8F8, 0x984F,0xE8F9, 0x984B,0xE8FA, 0x986B,0xE8FB, 0x986F,0xE8FC, 0x9870,0xE940, 0x9871,0xE941, 0x9874,0xE942, 0x9873,0xE943, 0x98AA,0xE944, 0x98AF,0xE945, 0x98B1,0xE946, 0x98B6,0xE947, 0x98C4,0xE948, 0x98C3,0xE949, 0x98C6,0xE94A, 0x98E9,0xE94B, 0x98EB,0xE94C, 0x9903,0xE94D, 0x9909,0xE94E, 0x9912,0xE94F, 0x9914,0xE950, 0x9918,0xE951, 0x9921,0xE952, 0x991D,0xE953, 0x991E,0xE954, 0x9924,0xE955, 0x9920,0xE956, 0x992C,0xE957, 0x992E,0xE958, 0x993D,0xE959, 0x993E,0xE95A, 0x9942,0xE95B, 0x9949,0xE95C, 0x9945,0xE95D, 0x9950,0xE95E, 0x994B,0xE95F, 0x9951,0xE960, 0x9952,0xE961, 0x994C,0xE962, 0x9955,0xE963, 0x9997,0xE964, 0x9998,0xE965, 0x99A5,0xE966, 0x99AD,0xE967, 0x99AE,0xE968, 0x99BC,0xE969, 0x99DF,0xE96A, 0x99DB,0xE96B, 0x99DD,0xE96C, 0x99D8,0xE96D, 0x99D1,0xE96E, 0x99ED,0xE96F, 0x99EE,0xE970, 0x99F1,0xE971, 0x99F2,0xE972, 0x99FB,0xE973, 0x99F8,0xE974, 0x9A01,0xE975, 0x9A0F,0xE976, 0x9A05,0xE977, 0x99E2,0xE978, 0x9A19,0xE979, 0x9A2B,0xE97A, 0x9A37,0xE97B, 0x9A45,0xE97C, 0x9A42,0xE97D, 0x9A40,0xE97E, 0x9A43,0xE980, 0x9A3E,0xE981, 0x9A55,0xE982, 0x9A4D,0xE983, 0x9A5B,0xE984, 0x9A57,0xE985, 0x9A5F,0xE986, 0x9A62,0xE987, 0x9A65,0xE988, 0x9A64,0xE989, 0x9A69,0xE98A, 0x9A6B,0xE98B, 0x9A6A,0xE98C, 0x9AAD,0xE98D, 0x9AB0,0xE98E, 0x9ABC,0xE98F, 0x9AC0,0xE990, 0x9ACF,0xE991, 0x9AD1,0xE992, 0x9AD3,0xE993, 0x9AD4,0xE994, 0x9ADE,0xE995, 0x9ADF,0xE996, 0x9AE2,0xE997, 0x9AE3,0xE998, 0x9AE6,0xE999, 0x9AEF,0xE99A, 0x9AEB,0xE99B, 0x9AEE,0xE99C, 0x9AF4,0xE99D, 0x9AF1,0xE99E, 0x9AF7,0xE99F, 0x9AFB,0xE9A0, 0x9B06,0xE9A1, 0x9B18,0xE9A2, 0x9B1A,0xE9A3, 0x9B1F,0xE9A4, 0x9B22,0xE9A5, 0x9B23,0xE9A6, 0x9B25,0xE9A7, 0x9B27,0xE9A8, 0x9B28,0xE9A9, 0x9B29,0xE9AA, 0x9B2A,0xE9AB, 0x9B2E,0xE9AC, 0x9B2F,0xE9AD, 0x9B32,0xE9AE, 0x9B44,0xE9AF, 0x9B43,0xE9B0, 0x9B4F,0xE9B1, 0x9B4D,0xE9B2, 0x9B4E,0xE9B3, 0x9B51,0xE9B4, 0x9B58,0xE9B5, 0x9B74,0xE9B6, 0x9B93,0xE9B7, 0x9B83,0xE9B8, 0x9B91,0xE9B9, 0x9B96,0xE9BA, 0x9B97,0xE9BB, 0x9B9F,0xE9BC, 0x9BA0,0xE9BD, 0x9BA8,0xE9BE, 0x9BB4,0xE9BF, 0x9BC0,0xE9C0, 0x9BCA,0xE9C1, 0x9BB9,0xE9C2, 0x9BC6,0xE9C3, 0x9BCF,0xE9C4, 0x9BD1,0xE9C5, 0x9BD2,0xE9C6, 0x9BE3,0xE9C7, 0x9BE2,0xE9C8, 0x9BE4,0xE9C9, 0x9BD4,0xE9CA, 0x9BE1,0xE9CB, 0x9C3A,0xE9CC, 0x9BF2,0xE9CD, 0x9BF1,0xE9CE, 0x9BF0,0xE9CF, 0x9C15,0xE9D0, 0x9C14,0xE9D1, 0x9C09,0xE9D2, 0x9C13,0xE9D3, 0x9C0C,0xE9D4, 0x9C06,0xE9D5, 0x9C08,0xE9D6, 0x9C12,0xE9D7, 0x9C0A,0xE9D8, 0x9C04,0xE9D9, 0x9C2E,0xE9DA, 0x9C1B,0xE9DB, 0x9C25,0xE9DC, 0x9C24,0xE9DD, 0x9C21,0xE9DE, 0x9C30,0xE9DF, 0x9C47,0xE9E0, 0x9C32,0xE9E1, 0x9C46,0xE9E2, 0x9C3E,0xE9E3, 0x9C5A,0xE9E4, 0x9C60,0xE9E5, 0x9C67,0xE9E6, 0x9C76,0xE9E7, 0x9C78,0xE9E8, 0x9CE7,0xE9E9, 0x9CEC,0xE9EA, 0x9CF0,0xE9EB, 0x9D09,0xE9EC, 0x9D08,0xE9ED, 0x9CEB,0xE9EE, 0x9D03,0xE9EF, 0x9D06,0xE9F0, 0x9D2A,0xE9F1, 0x9D26,0xE9F2, 0x9DAF,0xE9F3, 0x9D23,0xE9F4, 0x9D1F,0xE9F5, 0x9D44,0xE9F6, 0x9D15,0xE9F7, 0x9D12,0xE9F8, 0x9D41,0xE9F9, 0x9D3F,0xE9FA, 0x9D3E,0xE9FB, 0x9D46,0xE9FC, 0x9D48,0xEA40, 0x9D5D,0xEA41, 0x9D5E,0xEA42, 0x9D64,0xEA43, 0x9D51,0xEA44, 0x9D50,0xEA45, 0x9D59,0xEA46, 0x9D72,0xEA47, 0x9D89,0xEA48, 0x9D87,0xEA49, 0x9DAB,0xEA4A, 0x9D6F,0xEA4B, 0x9D7A,0xEA4C, 0x9D9A,0xEA4D, 0x9DA4,0xEA4E, 0x9DA9,0xEA4F, 0x9DB2,0xEA50, 0x9DC4,0xEA51, 0x9DC1,0xEA52, 0x9DBB,0xEA53, 0x9DB8,0xEA54, 0x9DBA,0xEA55, 0x9DC6,0xEA56, 0x9DCF,0xEA57, 0x9DC2,0xEA58, 0x9DD9,0xEA59, 0x9DD3,0xEA5A, 0x9DF8,0xEA5B, 0x9DE6,0xEA5C, 0x9DED,0xEA5D, 0x9DEF,0xEA5E, 0x9DFD,0xEA5F, 0x9E1A,0xEA60, 0x9E1B,0xEA61, 0x9E1E,0xEA62, 0x9E75,0xEA63, 0x9E79,0xEA64, 0x9E7D,0xEA65, 0x9E81,0xEA66, 0x9E88,0xEA67, 0x9E8B,0xEA68, 0x9E8C,0xEA69, 0x9E92,0xEA6A, 0x9E95,0xEA6B, 0x9E91,0xEA6C, 0x9E9D,0xEA6D, 0x9EA5,0xEA6E, 0x9EA9,0xEA6F, 0x9EB8,0xEA70, 0x9EAA,0xEA71, 0x9EAD,0xEA72, 0x9761,0xEA73, 0x9ECC,0xEA74, 0x9ECE,0xEA75, 0x9ECF,0xEA76, 0x9ED0,0xEA77, 0x9ED4,0xEA78, 0x9EDC,0xEA79, 0x9EDE,0xEA7A, 0x9EDD,0xEA7B, 0x9EE0,0xEA7C, 0x9EE5,0xEA7D, 0x9EE8,0xEA7E, 0x9EEF,0xEA80, 0x9EF4,0xEA81, 0x9EF6,0xEA82, 0x9EF7,0xEA83, 0x9EF9,0xEA84, 0x9EFB,0xEA85, 0x9EFC,0xEA86, 0x9EFD,0xEA87, 0x9F07,0xEA88, 0x9F08,0xEA89, 0x76B7,0xEA8A, 0x9F15,0xEA8B, 0x9F21,0xEA8C, 0x9F2C,0xEA8D, 0x9F3E,0xEA8E, 0x9F4A,0xEA8F, 0x9F52,0xEA90, 0x9F54,0xEA91, 0x9F63,0xEA92, 0x9F5F,0xEA93, 0x9F60,0xEA94, 0x9F61,0xEA95, 0x9F66,0xEA96, 0x9F67,0xEA97, 0x9F6C,0xEA98, 0x9F6A,0xEA99, 0x9F77,0xEA9A, 0x9F72,0xEA9B, 0x9F76,0xEA9C, 0x9F95,0xEA9D, 0x9F9C,0xEA9E, 0x9FA0,0xEA9F, 0x582F,0xEAA0, 0x69C7,0xEAA1, 0x9059,0xEAA2, 0x7464,0xEAA3, 0x51DC,0xEAA4, 0x7199,0xED40, 0x7E8A,0xED41, 0x891C,0xED42, 0x9348,0xED43, 0x9288,0xED44, 0x84DC,0xED45, 0x4FC9,0xED46, 0x70BB,0xED47, 0x6631,0xED48, 0x68C8,0xED49, 0x92F9,0xED4A, 0x66FB,0xED4B, 0x5F45,0xED4C, 0x4E28,0xED4D, 0x4EE1,0xED4E, 0x4EFC,0xED4F, 0x4F00,0xED50, 0x4F03,0xED51, 0x4F39,0xED52, 0x4F56,0xED53, 0x4F92,0xED54, 0x4F8A,0xED55, 0x4F9A,0xED56, 0x4F94,0xED57, 0x4FCD,0xED58, 0x5040,0xED59, 0x5022,0xED5A, 0x4FFF,0xED5B, 0x501E,0xED5C, 0x5046,0xED5D, 0x5070,0xED5E, 0x5042,0xED5F, 0x5094,0xED60, 0x50F4,0xED61, 0x50D8,0xED62, 0x514A,0xED63, 0x5164,0xED64, 0x519D,0xED65, 0x51BE,0xED66, 0x51EC,0xED67, 0x5215,0xED68, 0x529C,0xED69, 0x52A6,0xED6A, 0x52C0,0xED6B, 0x52DB,0xED6C, 0x5300,0xED6D, 0x5307,0xED6E, 0x5324,0xED6F, 0x5372,0xED70, 0x5393,0xED71, 0x53B2,0xED72, 0x53DD,0xED73, 0xFA0E,0xED74, 0x549C,0xED75, 0x548A,0xED76, 0x54A9,0xED77, 0x54FF,0xED78, 0x5586,0xED79, 0x5759,0xED7A, 0x5765,0xED7B, 0x57AC,0xED7C, 0x57C8,0xED7D, 0x57C7,0xED7E, 0xFA0F,0xED80, 0xFA10,0xED81, 0x589E,0xED82, 0x58B2,0xED83, 0x590B,0xED84, 0x5953,0xED85, 0x595B,0xED86, 0x595D,0xED87, 0x5963,0xED88, 0x59A4,0xED89, 0x59BA,0xED8A, 0x5B56,0xED8B, 0x5BC0,0xED8C, 0x752F,0xED8D, 0x5BD8,0xED8E, 0x5BEC,0xED8F, 0x5C1E,0xED90, 0x5CA6,0xED91, 0x5CBA,0xED92, 0x5CF5,0xED93, 0x5D27,0xED94, 0x5D53,0xED95, 0xFA11,0xED96, 0x5D42,0xED97, 0x5D6D,0xED98, 0x5DB8,0xED99, 0x5DB9,0xED9A, 0x5DD0,0xED9B, 0x5F21,0xED9C, 0x5F34,0xED9D, 0x5F67,0xED9E, 0x5FB7,0xED9F, 0x5FDE,0xEDA0, 0x605D,0xEDA1, 0x6085,0xEDA2, 0x608A,0xEDA3, 0x60DE,0xEDA4, 0x60D5,0xEDA5, 0x6120,0xEDA6, 0x60F2,0xEDA7, 0x6111,0xEDA8, 0x6137,0xEDA9, 0x6130,0xEDAA, 0x6198,0xEDAB, 0x6213,0xEDAC, 0x62A6,0xEDAD, 0x63F5,0xEDAE, 0x6460,0xEDAF, 0x649D,0xEDB0, 0x64CE,0xEDB1, 0x654E,0xEDB2, 0x6600,0xEDB3, 0x6615,0xEDB4, 0x663B,0xEDB5, 0x6609,0xEDB6, 0x662E,0xEDB7, 0x661E,0xEDB8, 0x6624,0xEDB9, 0x6665,0xEDBA, 0x6657,0xEDBB, 0x6659,0xEDBC, 0xFA12,0xEDBD, 0x6673,0xEDBE, 0x6699,0xEDBF, 0x66A0,0xEDC0, 0x66B2,0xEDC1, 0x66BF,0xEDC2, 0x66FA,0xEDC3, 0x670E,0xEDC4, 0xF929,0xEDC5, 0x6766,0xEDC6, 0x67BB,0xEDC7, 0x6852,0xEDC8, 0x67C0,0xEDC9, 0x6801,0xEDCA, 0x6844,0xEDCB, 0x68CF,0xEDCC, 0xFA13,0xEDCD, 0x6968,0xEDCE, 0xFA14,0xEDCF, 0x6998,0xEDD0, 0x69E2,0xEDD1, 0x6A30,0xEDD2, 0x6A6B,0xEDD3, 0x6A46,0xEDD4, 0x6A73,0xEDD5, 0x6A7E,0xEDD6, 0x6AE2,0xEDD7, 0x6AE4,0xEDD8, 0x6BD6,0xEDD9, 0x6C3F,0xEDDA, 0x6C5C,0xEDDB, 0x6C86,0xEDDC, 0x6C6F,0xEDDD, 0x6CDA,0xEDDE, 0x6D04,0xEDDF, 0x6D87,0xEDE0, 0x6D6F,0xEDE1, 0x6D96,0xEDE2, 0x6DAC,0xEDE3, 0x6DCF,0xEDE4, 0x6DF8,0xEDE5, 0x6DF2,0xEDE6, 0x6DFC,0xEDE7, 0x6E39,0xEDE8, 0x6E5C,0xEDE9, 0x6E27,0xEDEA, 0x6E3C,0xEDEB, 0x6EBF,0xEDEC, 0x6F88,0xEDED, 0x6FB5,0xEDEE, 0x6FF5,0xEDEF, 0x7005,0xEDF0, 0x7007,0xEDF1, 0x7028,0xEDF2, 0x7085,0xEDF3, 0x70AB,0xEDF4, 0x710F,0xEDF5, 0x7104,0xEDF6, 0x715C,0xEDF7, 0x7146,0xEDF8, 0x7147,0xEDF9, 0xFA15,0xEDFA, 0x71C1,0xEDFB, 0x71FE,0xEDFC, 0x72B1,0xEE40, 0x72BE,0xEE41, 0x7324,0xEE42, 0xFA16,0xEE43, 0x7377,0xEE44, 0x73BD,0xEE45, 0x73C9,0xEE46, 0x73D6,0xEE47, 0x73E3,0xEE48, 0x73D2,0xEE49, 0x7407,0xEE4A, 0x73F5,0xEE4B, 0x7426,0xEE4C, 0x742A,0xEE4D, 0x7429,0xEE4E, 0x742E,0xEE4F, 0x7462,0xEE50, 0x7489,0xEE51, 0x749F,0xEE52, 0x7501,0xEE53, 0x756F,0xEE54, 0x7682,0xEE55, 0x769C,0xEE56, 0x769E,0xEE57, 0x769B,0xEE58, 0x76A6,0xEE59, 0xFA17,0xEE5A, 0x7746,0xEE5B, 0x52AF,0xEE5C, 0x7821,0xEE5D, 0x784E,0xEE5E, 0x7864,0xEE5F, 0x787A,0xEE60, 0x7930,0xEE61, 0xFA18,0xEE62, 0xFA19,0xEE63, 0xFA1A,0xEE64, 0x7994,0xEE65, 0xFA1B,0xEE66, 0x799B,0xEE67, 0x7AD1,0xEE68, 0x7AE7,0xEE69, 0xFA1C,0xEE6A, 0x7AEB,0xEE6B, 0x7B9E,0xEE6C, 0xFA1D,0xEE6D, 0x7D48,0xEE6E, 0x7D5C,0xEE6F, 0x7DB7,0xEE70, 0x7DA0,0xEE71, 0x7DD6,0xEE72, 0x7E52,0xEE73, 0x7F47,0xEE74, 0x7FA1,0xEE75, 0xFA1E,0xEE76, 0x8301,0xEE77, 0x8362,0xEE78, 0x837F,0xEE79, 0x83C7,0xEE7A, 0x83F6,0xEE7B, 0x8448,0xEE7C, 0x84B4,0xEE7D, 0x8553,0xEE7E, 0x8559,0xEE80, 0x856B,0xEE81, 0xFA1F,0xEE82, 0x85B0,0xEE83, 0xFA20,0xEE84, 0xFA21,0xEE85, 0x8807,0xEE86, 0x88F5,0xEE87, 0x8A12,0xEE88, 0x8A37,0xEE89, 0x8A79,0xEE8A, 0x8AA7,0xEE8B, 0x8ABE,0xEE8C, 0x8ADF,0xEE8D, 0xFA22,0xEE8E, 0x8AF6,0xEE8F, 0x8B53,0xEE90, 0x8B7F,0xEE91, 0x8CF0,0xEE92, 0x8CF4,0xEE93, 0x8D12,0xEE94, 0x8D76,0xEE95, 0xFA23,0xEE96, 0x8ECF,0xEE97, 0xFA24,0xEE98, 0xFA25,0xEE99, 0x9067,0xEE9A, 0x90DE,0xEE9B, 0xFA26,0xEE9C, 0x9115,0xEE9D, 0x9127,0xEE9E, 0x91DA,0xEE9F, 0x91D7,0xEEA0, 0x91DE,0xEEA1, 0x91ED,0xEEA2, 0x91EE,0xEEA3, 0x91E4,0xEEA4, 0x91E5,0xEEA5, 0x9206,0xEEA6, 0x9210,0xEEA7, 0x920A,0xEEA8, 0x923A,0xEEA9, 0x9240,0xEEAA, 0x923C,0xEEAB, 0x924E,0xEEAC, 0x9259,0xEEAD, 0x9251,0xEEAE, 0x9239,0xEEAF, 0x9267,0xEEB0, 0x92A7,0xEEB1, 0x9277,0xEEB2, 0x9278,0xEEB3, 0x92E7,0xEEB4, 0x92D7,0xEEB5, 0x92D9,0xEEB6, 0x92D0,0xEEB7, 0xFA27,0xEEB8, 0x92D5,0xEEB9, 0x92E0,0xEEBA, 0x92D3,0xEEBB, 0x9325,0xEEBC, 0x9321,0xEEBD, 0x92FB,0xEEBE, 0xFA28,0xEEBF, 0x931E,0xEEC0, 0x92FF,0xEEC1, 0x931D,0xEEC2, 0x9302,0xEEC3, 0x9370,0xEEC4, 0x9357,0xEEC5, 0x93A4,0xEEC6, 0x93C6,0xEEC7, 0x93DE,0xEEC8, 0x93F8,0xEEC9, 0x9431,0xEECA, 0x9445,0xEECB, 0x9448,0xEECC, 0x9592,0xEECD, 0xF9DC,0xEECE, 0xFA29,0xEECF, 0x969D,0xEED0, 0x96AF,0xEED1, 0x9733,0xEED2, 0x973B,0xEED3, 0x9743,0xEED4, 0x974D,0xEED5, 0x974F,0xEED6, 0x9751,0xEED7, 0x9755,0xEED8, 0x9857,0xEED9, 0x9865,0xEEDA, 0xFA2A,0xEEDB, 0xFA2B,0xEEDC, 0x9927,0xEEDD, 0xFA2C,0xEEDE, 0x999E,0xEEDF, 0x9A4E,0xEEE0, 0x9AD9,0xEEE1, 0x9ADC,0xEEE2, 0x9B75,0xEEE3, 0x9B72,0xEEE4, 0x9B8F,0xEEE5, 0x9BB1,0xEEE6, 0x9BBB,0xEEE7, 0x9C00,0xEEE8, 0x9D70,0xEEE9, 0x9D6B,0xEEEA, 0xFA2D,0xEEEB, 0x9E19,0xEEEC, 0x9ED1,0xEEEF, 0x2170,0xEEF0, 0x2171,0xEEF1, 0x2172,0xEEF2, 0x2173,0xEEF3, 0x2174,0xEEF4, 0x2175,0xEEF5, 0x2176,0xEEF6, 0x2177,0xEEF7, 0x2178,0xEEF8, 0x2179,0xEEF9, 0xFFE2,0xEEFA, 0xFFE4,0xEEFB, 0xFF07,0xEEFC, 0xFF02,0xFA40, 0x2170,0xFA41, 0x2171,0xFA42, 0x2172,0xFA43, 0x2173,0xFA44, 0x2174,0xFA45, 0x2175,0xFA46, 0x2176,0xFA47, 0x2177,0xFA48, 0x2178,0xFA49, 0x2179,0xFA4A, 0x2160,0xFA4B, 0x2161,0xFA4C, 0x2162,0xFA4D, 0x2163,0xFA4E, 0x2164,0xFA4F, 0x2165,0xFA50, 0x2166,0xFA51, 0x2167,0xFA52, 0x2168,0xFA53, 0x2169,0xFA54, 0xFFE2,0xFA55, 0xFFE4,0xFA56, 0xFF07,0xFA57, 0xFF02,0xFA58, 0x3231,0xFA59, 0x2116,0xFA5A, 0x2121,0xFA5B, 0x2235,0xFA5C, 0x7E8A,0xFA5D, 0x891C,0xFA5E, 0x9348,0xFA5F, 0x9288,0xFA60, 0x84DC,0xFA61, 0x4FC9,0xFA62, 0x70BB,0xFA63, 0x6631,0xFA64, 0x68C8,0xFA65, 0x92F9,0xFA66, 0x66FB,0xFA67, 0x5F45,0xFA68, 0x4E28,0xFA69, 0x4EE1,0xFA6A, 0x4EFC,0xFA6B, 0x4F00,0xFA6C, 0x4F03,0xFA6D, 0x4F39,0xFA6E, 0x4F56,0xFA6F, 0x4F92,0xFA70, 0x4F8A,0xFA71, 0x4F9A,0xFA72, 0x4F94,0xFA73, 0x4FCD,0xFA74, 0x5040,0xFA75, 0x5022,0xFA76, 0x4FFF,0xFA77, 0x501E,0xFA78, 0x5046,0xFA79, 0x5070,0xFA7A, 0x5042,0xFA7B, 0x5094,0xFA7C, 0x50F4,0xFA7D, 0x50D8,0xFA7E, 0x514A,0xFA80, 0x5164,0xFA81, 0x519D,0xFA82, 0x51BE,0xFA83, 0x51EC,0xFA84, 0x5215,0xFA85, 0x529C,0xFA86, 0x52A6,0xFA87, 0x52C0,0xFA88, 0x52DB,0xFA89, 0x5300,0xFA8A, 0x5307,0xFA8B, 0x5324,0xFA8C, 0x5372,0xFA8D, 0x5393,0xFA8E, 0x53B2,0xFA8F, 0x53DD,0xFA90, 0xFA0E,0xFA91, 0x549C,0xFA92, 0x548A,0xFA93, 0x54A9,0xFA94, 0x54FF,0xFA95, 0x5586,0xFA96, 0x5759,0xFA97, 0x5765,0xFA98, 0x57AC,0xFA99, 0x57C8,0xFA9A, 0x57C7,0xFA9B, 0xFA0F,0xFA9C, 0xFA10,0xFA9D, 0x589E,0xFA9E, 0x58B2,0xFA9F, 0x590B,0xFAA0, 0x5953,0xFAA1, 0x595B,0xFAA2, 0x595D,0xFAA3, 0x5963,0xFAA4, 0x59A4,0xFAA5, 0x59BA,0xFAA6, 0x5B56,0xFAA7, 0x5BC0,0xFAA8, 0x752F,0xFAA9, 0x5BD8,0xFAAA, 0x5BEC,0xFAAB, 0x5C1E,0xFAAC, 0x5CA6,0xFAAD, 0x5CBA,0xFAAE, 0x5CF5,0xFAAF, 0x5D27,0xFAB0, 0x5D53,0xFAB1, 0xFA11,0xFAB2, 0x5D42,0xFAB3, 0x5D6D,0xFAB4, 0x5DB8,0xFAB5, 0x5DB9,0xFAB6, 0x5DD0,0xFAB7, 0x5F21,0xFAB8, 0x5F34,0xFAB9, 0x5F67,0xFABA, 0x5FB7,0xFABB, 0x5FDE,0xFABC, 0x605D,0xFABD, 0x6085,0xFABE, 0x608A,0xFABF, 0x60DE,0xFAC0, 0x60D5,0xFAC1, 0x6120,0xFAC2, 0x60F2,0xFAC3, 0x6111,0xFAC4, 0x6137,0xFAC5, 0x6130,0xFAC6, 0x6198,0xFAC7, 0x6213,0xFAC8, 0x62A6,0xFAC9, 0x63F5,0xFACA, 0x6460,0xFACB, 0x649D,0xFACC, 0x64CE,0xFACD, 0x654E,0xFACE, 0x6600,0xFACF, 0x6615,0xFAD0, 0x663B,0xFAD1, 0x6609,0xFAD2, 0x662E,0xFAD3, 0x661E,0xFAD4, 0x6624,0xFAD5, 0x6665,0xFAD6, 0x6657,0xFAD7, 0x6659,0xFAD8, 0xFA12,0xFAD9, 0x6673,0xFADA, 0x6699,0xFADB, 0x66A0,0xFADC, 0x66B2,0xFADD, 0x66BF,0xFADE, 0x66FA,0xFADF, 0x670E,0xFAE0, 0xF929,0xFAE1, 0x6766,0xFAE2, 0x67BB,0xFAE3, 0x6852,0xFAE4, 0x67C0,0xFAE5, 0x6801,0xFAE6, 0x6844,0xFAE7, 0x68CF,0xFAE8, 0xFA13,0xFAE9, 0x6968,0xFAEA, 0xFA14,0xFAEB, 0x6998,0xFAEC, 0x69E2,0xFAED, 0x6A30,0xFAEE, 0x6A6B,0xFAEF, 0x6A46,0xFAF0, 0x6A73,0xFAF1, 0x6A7E,0xFAF2, 0x6AE2,0xFAF3, 0x6AE4,0xFAF4, 0x6BD6,0xFAF5, 0x6C3F,0xFAF6, 0x6C5C,0xFAF7, 0x6C86,0xFAF8, 0x6C6F,0xFAF9, 0x6CDA,0xFAFA, 0x6D04,0xFAFB, 0x6D87,0xFAFC, 0x6D6F,0xFB40, 0x6D96,0xFB41, 0x6DAC,0xFB42, 0x6DCF,0xFB43, 0x6DF8,0xFB44, 0x6DF2,0xFB45, 0x6DFC,0xFB46, 0x6E39,0xFB47, 0x6E5C,0xFB48, 0x6E27,0xFB49, 0x6E3C,0xFB4A, 0x6EBF,0xFB4B, 0x6F88,0xFB4C, 0x6FB5,0xFB4D, 0x6FF5,0xFB4E, 0x7005,0xFB4F, 0x7007,0xFB50, 0x7028,0xFB51, 0x7085,0xFB52, 0x70AB,0xFB53, 0x710F,0xFB54, 0x7104,0xFB55, 0x715C,0xFB56, 0x7146,0xFB57, 0x7147,0xFB58, 0xFA15,0xFB59, 0x71C1,0xFB5A, 0x71FE,0xFB5B, 0x72B1,0xFB5C, 0x72BE,0xFB5D, 0x7324,0xFB5E, 0xFA16,0xFB5F, 0x7377,0xFB60, 0x73BD,0xFB61, 0x73C9,0xFB62, 0x73D6,0xFB63, 0x73E3,0xFB64, 0x73D2,0xFB65, 0x7407,0xFB66, 0x73F5,0xFB67, 0x7426,0xFB68, 0x742A,0xFB69, 0x7429,0xFB6A, 0x742E,0xFB6B, 0x7462,0xFB6C, 0x7489,0xFB6D, 0x749F,0xFB6E, 0x7501,0xFB6F, 0x756F,0xFB70, 0x7682,0xFB71, 0x769C,0xFB72, 0x769E,0xFB73, 0x769B,0xFB74, 0x76A6,0xFB75, 0xFA17,0xFB76, 0x7746,0xFB77, 0x52AF,0xFB78, 0x7821,0xFB79, 0x784E,0xFB7A, 0x7864,0xFB7B, 0x787A,0xFB7C, 0x7930,0xFB7D, 0xFA18,0xFB7E, 0xFA19,0xFB80, 0xFA1A,0xFB81, 0x7994,0xFB82, 0xFA1B,0xFB83, 0x799B,0xFB84, 0x7AD1,0xFB85, 0x7AE7,0xFB86, 0xFA1C,0xFB87, 0x7AEB,0xFB88, 0x7B9E,0xFB89, 0xFA1D,0xFB8A, 0x7D48,0xFB8B, 0x7D5C,0xFB8C, 0x7DB7,0xFB8D, 0x7DA0,0xFB8E, 0x7DD6,0xFB8F, 0x7E52,0xFB90, 0x7F47,0xFB91, 0x7FA1,0xFB92, 0xFA1E,0xFB93, 0x8301,0xFB94, 0x8362,0xFB95, 0x837F,0xFB96, 0x83C7,0xFB97, 0x83F6,0xFB98, 0x8448,0xFB99, 0x84B4,0xFB9A, 0x8553,0xFB9B, 0x8559,0xFB9C, 0x856B,0xFB9D, 0xFA1F,0xFB9E, 0x85B0,0xFB9F, 0xFA20,0xFBA0, 0xFA21,0xFBA1, 0x8807,0xFBA2, 0x88F5,0xFBA3, 0x8A12,0xFBA4, 0x8A37,0xFBA5, 0x8A79,0xFBA6, 0x8AA7,0xFBA7, 0x8ABE,0xFBA8, 0x8ADF,0xFBA9, 0xFA22,0xFBAA, 0x8AF6,0xFBAB, 0x8B53,0xFBAC, 0x8B7F,0xFBAD, 0x8CF0,0xFBAE, 0x8CF4,0xFBAF, 0x8D12,0xFBB0, 0x8D76,0xFBB1, 0xFA23,0xFBB2, 0x8ECF,0xFBB3, 0xFA24,0xFBB4, 0xFA25,0xFBB5, 0x9067,0xFBB6, 0x90DE,0xFBB7, 0xFA26,0xFBB8, 0x9115,0xFBB9, 0x9127,0xFBBA, 0x91DA,0xFBBB, 0x91D7,0xFBBC, 0x91DE,0xFBBD, 0x91ED,0xFBBE, 0x91EE,0xFBBF, 0x91E4,0xFBC0, 0x91E5,0xFBC1, 0x9206,0xFBC2, 0x9210,0xFBC3, 0x920A,0xFBC4, 0x923A,0xFBC5, 0x9240,0xFBC6, 0x923C,0xFBC7, 0x924E,0xFBC8, 0x9259,0xFBC9, 0x9251,0xFBCA, 0x9239,0xFBCB, 0x9267,0xFBCC, 0x92A7,0xFBCD, 0x9277,0xFBCE, 0x9278,0xFBCF, 0x92E7,0xFBD0, 0x92D7,0xFBD1, 0x92D9,0xFBD2, 0x92D0,0xFBD3, 0xFA27,0xFBD4, 0x92D5,0xFBD5, 0x92E0,0xFBD6, 0x92D3,0xFBD7, 0x9325,0xFBD8, 0x9321,0xFBD9, 0x92FB,0xFBDA, 0xFA28,0xFBDB, 0x931E,0xFBDC, 0x92FF,0xFBDD, 0x931D,0xFBDE, 0x9302,0xFBDF, 0x9370,0xFBE0, 0x9357,0xFBE1, 0x93A4,0xFBE2, 0x93C6,0xFBE3, 0x93DE,0xFBE4, 0x93F8,0xFBE5, 0x9431,0xFBE6, 0x9445,0xFBE7, 0x9448,0xFBE8, 0x9592,0xFBE9, 0xF9DC,0xFBEA, 0xFA29,0xFBEB, 0x969D,0xFBEC, 0x96AF,0xFBED, 0x9733,0xFBEE, 0x973B,0xFBEF, 0x9743,0xFBF0, 0x974D,0xFBF1, 0x974F,0xFBF2, 0x9751,0xFBF3, 0x9755,0xFBF4, 0x9857,0xFBF5, 0x9865,0xFBF6, 0xFA2A,0xFBF7, 0xFA2B,0xFBF8, 0x9927,0xFBF9, 0xFA2C,0xFBFA, 0x999E,0xFBFB, 0x9A4E,0xFBFC, 0x9AD9,0xFC40, 0x9ADC,0xFC41, 0x9B75,0xFC42, 0x9B72,0xFC43, 0x9B8F,0xFC44, 0x9BB1,0xFC45, 0x9BBB,0xFC46, 0x9C00,0xFC47, 0x9D70,0xFC48, 0x9D6B,0xFC49, 0xFA2D,0xFC4A, 0x9E19,0xFC4B, 0x9ED1,]\nvar decoding_table = [],\n encoding_table = []\nfor(var i = 0, len = _table.length; i < len; i += 2){\nvar value = _table[i + 1]\nif(value !== null){\n encoding_table[value] = _table[i]\n}\ndecoding_table[_table[i]] = _table[i + 1]\n}\n$module = {encoding_table, decoding_table}\n"], "hashlib": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins\n\nvar $mod = {\n\n __getattr__ : function(attr){\n if(attr == 'new'){return hash.$factory}\n return this[attr]\n },\n md5: function(obj){return hash.$factory('md5', obj)},\n sha1: function(obj){return hash.$factory('sha1', obj)},\n sha224: function(obj){return hash.$factory('sha224', obj)},\n sha256: function(obj){return hash.$factory('sha256', obj)},\n sha384: function(obj){return hash.$factory('sha384', obj)},\n sha512: function(obj){return hash.$factory('sha512', obj)},\n\n algorithms_guaranteed: ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'],\n algorithms_available: ['md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512']\n}\n\n//todo: eventually move this function to a \"utility\" file or use ajax module?\nfunction $get_CryptoJS_lib(alg){\n if($B.VFS !== undefined && $B.VFS.hashlib){\n // use file in brython_stdlib.js\n var lib = $B.VFS[\"crypto_js.rollups.\" + alg]\n if (lib === undefined){\n throw _b_.ImportError.$factory(\"can't import hashlib.\" + alg)\n }\n var res = lib[1]\n try{\n eval(res + \"; $B.CryptoJS = CryptoJS;\")\n return\n }catch(err){\n throw Error(\"JS Eval Error\",\n \"Cannot eval CryptoJS algorithm '\" + alg + \"' : error:\" + err)\n }\n }\n\n var module = {__name__: 'CryptoJS', $is_package: false}\n var res = $B.$download_module(module, $B.brython_path + 'libs/crypto_js/rollups/' + alg + '.js');\n\n try{\n eval(res + \"; $B.CryptoJS = CryptoJS;\")\n }catch(err){\n throw Error(\"JS Eval Error\",\n \"Cannot eval CryptoJS algorithm '\" + alg + \"' : error:\" + err)\n }\n}\n\nfunction bytes2WordArray(obj){\n // Transform a bytes object into an instance of class WordArray\n // defined in CryptoJS\n if(!$B.$isinstance(obj, _b_.bytes)){\n throw _b_.TypeError(\"expected bytes, got \" + $B.class_name(obj))\n }\n\n var words = []\n for(var i = 0; i < obj.source.length; i += 4){\n var word = obj.source.slice(i, i + 4)\n while(word.length < 4){word.push(0)}\n var w = word[3] + (word[2] << 8) + (word[1] << 16) + (word[0] << 24)\n words.push(w)\n }\n return {words: words, sigBytes: obj.source.length}\n}\n\nvar hash = {\n __class__: _b_.type,\n __mro__: [_b_.object],\n __qualname__: 'hash',\n __name__: 'hash'\n}\n\nhash.update = function(self, msg){\n self.hash.update(bytes2WordArray(msg))\n}\n\nhash.copy = function(self){\n return self.hash.clone()\n}\n\nhash.digest = function(self){\n var obj = self.hash.clone().finalize().toString(),\n res = []\n for(var i = 0; i < obj.length; i += 2){\n res.push(parseInt(obj.substr(i, 2), 16))\n }\n return _b_.bytes.$factory(res)\n}\n\nhash.hexdigest = function(self) {\n return self.hash.clone().finalize().toString()\n}\n\nhash.$factory = function(alg, obj) {\n var res = {\n __class__: hash\n }\n\n switch(alg) {\n case 'md5':\n case 'sha1':\n case 'sha224':\n case 'sha256':\n case 'sha384':\n case 'sha512':\n var ALG = alg.toUpperCase()\n if($B.Crypto === undefined ||\n $B.CryptoJS.algo[ALG] === undefined){$get_CryptoJS_lib(alg)}\n\n res.hash = $B.CryptoJS.algo[ALG].create()\n if(obj !== undefined){\n res.hash.update(bytes2WordArray(obj))\n }\n break\n default:\n throw $B.builtins.AttributeError.$factory('Invalid hash algorithm: ' + alg)\n }\n\n return res\n}\n\nreturn $mod\n\n})(__BRYTHON__)\n"], "html_parser": [".js", "var $module = (function($B){\n\n_b_ = $B.builtins\n\nvar ELEMENT_NODE = 1,\n TEXT_NODE = 3,\n COMMENT_NODE = 8,\n DOCUMENT_TYPE_NODE = 10\n\nvar HTMLNode = $B.make_class(\"HTMLNode\",\n function(){\n return {\n __class__: HTMLNode,\n nodeType: TEXT_NODE,\n text: \"\"\n }\n }\n)\n\nHTMLNode.__str__ = function(self){\n return self.text\n}\n\n$B.set_func_names(HTMLNode, \"_html_parser\")\n\nfunction* tokenize(src){\n var node = HTMLNode.$factory(),\n pos = 0,\n tag = \"\",\n type = \"text\"\n while(pos < src.length){\n var char = src[pos]\n switch(type){\n case \"text\":\n if(char == \"<\"){\n // starts a tag if immediately followed by a letter or by /\n var tag_mo = /^(\\/?)[a-zA-Z]+/.exec(src.substr(pos + 1))\n if(tag_mo){\n yield node\n node = HTMLNode.$factory()\n type = \"tag\"\n node.tagName = \"\"\n node.nodeType = ELEMENT_NODE\n node.closing = tag_mo[1] != \"\"\n node.attrs = []\n }else{\n // doctype declaration\n var decl_mo = /^/i.exec(src.substr(pos))\n if(decl_mo){\n yield node\n node = HTMLNode.$factory()\n node.text = decl_mo[0]\n node.doctype = decl_mo[1]\n node.nodeType = DOCUMENT_TYPE_NODE\n yield node\n node = HTMLNode.$factory()\n type = \"text\"\n pos += decl_mo[0].length\n break\n }else{\n // comment\n var comment_mo = /^\\/.exec(src.substr(pos))\n if(comment_mo){\n yield node\n node = HTMLNode.$factory()\n node.text = comment_mo[0]\n node.comment = comment_mo[1]\n node.nodeType = COMMENT_NODE\n yield node\n node = HTMLNode.$factory()\n type = \"text\"\n pos += comment_mo[0].length\n break\n }\n }\n }\n }\n pos++\n node.text += char\n break\n case \"tag\":\n if(char.search(/[_a-zA-Z]/) > -1){\n var mo = /\\w+/.exec(src.substr(pos))\n if(mo !== null){\n pos += mo[0].length\n if(node.tagName == \"\"){\n node.tagName = mo[0].toUpperCase()\n }\n node.text += mo[0]\n }else{\n pos++\n }\n }else if(char == \">\"){\n node.text += char\n yield node\n node = HTMLNode.$factory()\n type = \"text\"\n pos++\n }else if(char == \"=\"){\n node.text += char\n pos++\n }else if(char == \"'\" || char == '\"'){\n var i = pos + 1,\n found_string_end = false\n while(i < src.length){\n if(src[i] == char){\n var nb_escape = 0\n while(src[i - 1 - nb_escape] == '/'){\n nb_escape++\n }\n if(nb_escape % 2 == 0){\n node.text += src.substr(pos, i + 1 - pos)\n pos = i + 1\n found_string_end = true\n break\n }else{\n i++\n }\n }else if(src[i] == '>'){\n break\n }else{\n i++\n }\n }\n if(! found_string_end){\n // unterminated string: ignore\n pos++\n }\n }else{\n node.text += char\n pos++\n }\n break\n default:\n pos++\n }\n }\n yield node\n}\nreturn {\n ELEMENT_NODE: 1,\n TEXT_NODE: 3,\n COMMENT_NODE: 8,\n DOCUMENT_TYPE_NODE: 10,\n tokenize: tokenize\n}\n\n})(__BRYTHON__)\n"], "marshal": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\nreturn {\n loads: function(){\n var $ = $B.args('loads', 1, {obj:null}, ['obj'], arguments, {},\n null, null)\n return $B.structuredclone2pyobj(JSON.parse($.obj))\n },\n load: function(){\n var $ = $B.args('load', 1, {file:null}, ['file'], arguments, {},\n null, null)\n var content = $B.$call($B.$getattr($.file, \"read\"))()\n return $module.loads(_b_.bytes.decode(content, \"latin-1\"));\n },\n dump: function(){\n var $ = $B.args('dump', 2, {value:null, file: null},\n ['value', 'file'], arguments, {}, null, null)\n var s = JSON.stringify($B.pyobj2structuredclone($.value))\n $B.$getattr($.file, \"write\")(_b_.str.encode(s, 'latin-1'))\n var flush = $B.$getattr($.file, \"flush\", null)\n if(flush !== null){\n $B.$call(flush)()\n }\n return _b_.None\n },\n dumps: function(){\n var $ = $B.args('dumps', 1, {obj:null}, ['obj'], arguments, {},\n null, null)\n return JSON.stringify($B.pyobj2structuredclone($.obj))\n }\n}\n\n})(__BRYTHON__)\n"], "math": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\nconst INF = $B.fast_float(Number.POSITIVE_INFINITY),\n NINF = $B.fast_float(Number.NEGATIVE_INFINITY),\n ZERO = $B.fast_float(0),\n NAN = $B.fast_float(Number.NaN)\n\nvar float_check = function(x) {\n // Returns a Javascript number\n if(x.__class__ === $B.long_int){\n var res = parseInt(x.value)\n if(! isFinite(res)){\n throw _b_.OverflowError.$factory('int too big for float')\n }\n return res\n }else if(x.__class__ === _b_.float){\n return x.value\n }\n return _b_.float.$factory(x).value\n}\n\nfunction check_int(x){\n if(! $B.$isinstance(x, _b_.int)){\n throw _b_.TypeError.$factory(\"'\" + $B.class_name(x) +\n \"' object cannot be interpreted as an integer\")\n }\n}\n\nfunction check_int_or_round_float(x){\n return ($B.$isinstance(x, _b_.float) && Number.isInteger(x.value)) ||\n $B.$isinstance(x, _b_.int)\n}\n\nvar isWholeNumber = function(x){return (x * 10) % 10 == 0}\n\nvar isOdd = function(x) {return isWholeNumber(x) && 2 * Math.floor(x / 2) != x}\n\nvar isNegZero = function(x) {return x === 0 && Math.atan2(x,x) < 0}\n\nfunction overflow(){\n throw _b_.OverflowError.$factory(\"math range error\")\n}\n\nfunction value_error(){\n throw _b_.ValueError.$factory(\"math range error\")\n}\n\nvar EPSILON = Math.pow(2, -52),\n MAX_VALUE = (2 - EPSILON) * Math.pow(2, 1023),\n MIN_VALUE = Math.pow(2, -1022),\n Py_HUGE_VAL = Number.POSITIVE_INFINITY,\n logpi = 1.144729885849400174143427351353058711647,\n sqrtpi = 1.772453850905516027298167483341145182798\n\nfunction nextUp(x){\n if(x !== x){ // NaN\n return x\n }\n if(_b_.float.$funcs.isinf(x)){\n if(_b_.float.$funcs.isninf(x)){\n return -MAX_VALUE\n }\n return _mod.inf\n }\n if($B.$isinstance(x, $B.long_int)){\n x = Number(x.value)\n }else if($B.$isinstance(x, _b_.float)){\n x = x.value\n }\n\n if(x == +MAX_VALUE){\n return +1 / 0\n }\n if(typeof x == \"number\"){\n var y = x * (x < 0 ? 1 - EPSILON / 2 : 1 + EPSILON)\n if(y == x){\n y = MIN_VALUE * EPSILON > 0 ? x + MIN_VALUE * EPSILON : x + MIN_VALUE\n }\n if(y === +1 / 0){\n y = +MAX_VALUE\n }\n var b = x + (y - x) / 2\n if(x < b && b < y){\n y = b;\n }\n var c = (y + x) / 2\n if(x < c && c < y){\n y = c;\n }\n return y === 0 ? -0 : y\n }else{\n var factor = $B.rich_comp('__lt__', x, 0) ? 1 - EPSILON / 2 :\n 1 + EPSILON\n var y = $B.rich_op(\"__mul__\", x , factor)\n if(y == x){\n y = MIN_VALUE * EPSILON > 0 ?\n $B.rich_op('__add__', x, MIN_VALUE * EPSILON) :\n $B.rich_op('__add__', x, MIN_VALUE)\n }\n if(y === +1 / 0){\n y = +MAX_VALUE\n }\n var y_minus_x = $B.rich_op('__sub__', y, x)\n var z = $B.rich_op('__truediv__', y_minus_x, 2) // (y - x) / 2\n\n var b = $B.rich_op('__add__', x, z)\n if($B.rich_comp('__lt__', x, b) && $B.rich_comp('__lt__', b, y)){\n y = b;\n }\n var c = $B.rich_op('__truediv__', $B.rich_op('__add__', y, x), 2)\n if($B.rich_comp('__lt__', x, c) && $B.rich_comp('__lt__', c, y)){\n y = c;\n }\n return y === 0 ? -0 : y\n }\n}\n\nfunction gcd2(a, b){\n // GCD of 2 factors\n if($B.rich_comp(\"__gt__\", b, a)){\n var temp = a\n a = b\n b = temp\n }\n while(true){\n if(b == 0){\n return a\n }\n a = $B.rich_op(\"__mod__\", a, b)\n if(a == 0){\n return b\n }\n b = $B.rich_op(\"__mod__\", b, a)\n }\n}\n\nconst LANCZOS_N = 13,\n lanczos_g = 6.024680040776729583740234375,\n lanczos_g_minus_half = 5.524680040776729583740234375,\n lanczos_num_coeffs = [\n 23531376880.410759688572007674451636754734846804940,\n 42919803642.649098768957899047001988850926355848959,\n 35711959237.355668049440185451547166705960488635843,\n 17921034426.037209699919755754458931112671403265390,\n 6039542586.3520280050642916443072979210699388420708,\n 1439720407.3117216736632230727949123939715485786772,\n 248874557.86205415651146038641322942321632125127801,\n 31426415.585400194380614231628318205362874684987640,\n 2876370.6289353724412254090516208496135991145378768,\n 186056.26539522349504029498971604569928220784236328,\n 8071.6720023658162106380029022722506138218516325024,\n 210.82427775157934587250973392071336271166969580291,\n 2.5066282746310002701649081771338373386264310793408\n ],\n /* denominator is x*(x+1)*...*(x+LANCZOS_N-2) */\n lanczos_den_coeffs = [\n 0.0, 39916800.0, 120543840.0, 150917976.0, 105258076.0, 45995730.0,\n 13339535.0, 2637558.0, 357423.0, 32670.0, 1925.0, 66.0, 1.0],\n /* gamma values for small positive integers, 1 though NGAMMA_INTEGRAL */\n NGAMMA_INTEGRAL = 23,\n gamma_integral = [\n 1.0, 1.0, 2.0, 6.0, 24.0, 120.0, 720.0, 5040.0, 40320.0, 362880.0,\n 3628800.0, 39916800.0, 479001600.0, 6227020800.0, 87178291200.0,\n 1307674368000.0, 20922789888000.0, 355687428096000.0,\n 6402373705728000.0, 121645100408832000.0, 2432902008176640000.0,\n 51090942171709440000.0, 1124000727777607680000.0]\n\n/* Lanczos' sum L_g(x), for positive x */\nfunction lanczos_sum(x){\n var num = 0.0,\n den = 0.0,\n i\n /* evaluate the rational function lanczos_sum(x). For large\n x, the obvious algorithm risks overflow, so we instead\n rescale the denominator and numerator of the rational\n function by x**(1-LANCZOS_N) and treat this as a\n rational function in 1/x. This also reduces the error for\n larger x values. The choice of cutoff point (5.0 below) is\n somewhat arbitrary; in tests, smaller cutoff values than\n this resulted in lower accuracy. */\n if (x < 5.0) {\n for (i = LANCZOS_N; --i >= 0; ) {\n num = num * x + lanczos_num_coeffs[i];\n den = den * x + lanczos_den_coeffs[i];\n }\n }else{\n for (i = 0; i < LANCZOS_N; i++) {\n num = num / x + lanczos_num_coeffs[i];\n den = den / x + lanczos_den_coeffs[i];\n }\n }\n return num/den;\n}\n\nfunction m_sinpi(x){\n // x is float\n // returns a float\n var r,\n y = fmod(fabs(x), 2.0), // float\n n = _b_.round($B.fast_float(2.0 * y.value)) // int\n switch(n){\n case 0:\n r = sin(pi.value * y.value);\n break;\n case 1:\n r = cos(pi.value * (y.value - 0.5));\n break;\n case 2:\n /* N.B. -sin(pi*(y-1.0)) is *not* equivalent: it would give\n -0.0 instead of 0.0 when y == 1.0. */\n r = sin(pi.value * (1.0 - y.value));\n break;\n case 3:\n r = _b_.float.__neg__(cos(pi.value *(y.value - 1.5)))\n break;\n case 4:\n r = sin(pi.value * (y.value - 2.0));\n break;\n }\n return $B.fast_float(copysign(1.0, x).value * r.value);\n}\n\n/*\n lgamma: natural log of the absolute value of the Gamma function.\n For large arguments, Lanczos' formula works extremely well here.\n*/\nfunction m_lgamma(x){\n var r,\n absx\n\n /* special cases */\n if(! isfinite(x)){\n if(isnan(x)){\n return x; /* lgamma(nan) = nan */\n }else{\n return $B.fast_float(Number.POSITIVE_INFINITY); /* lgamma(+-inf) = +inf */\n }\n }\n\n /* integer arguments */\n var x1 = float_check(x)\n if(Number.isInteger(x1) && x1 <= 2.0){\n if(x1 <= 0.0){\n value_error()\n }else{\n return $B.fast_float(0.0); /* lgamma(1) = lgamma(2) = 0.0 */\n }\n }\n\n absx = fabs(x)\n /* tiny arguments: lgamma(x) ~ -log(fabs(x)) for small x */\n if (absx.value < 1e-20){\n return $B.fast_float(-log(absx).value);\n }\n /* Lanczos' formula. We could save a fraction of a ulp in accuracy by\n having a second set of numerator coefficients for lanczos_sum that\n absorbed the exp(-lanczos_g) term, and throwing out the lanczos_g\n subtraction below; it's probably not worth it. */\n var lsum = $B.fast_float(lanczos_sum(absx.value))\n r = log(lsum).value - lanczos_g;\n r += (absx.value - 0.5) *\n (log($B.fast_float(absx.value + lanczos_g - 0.5)).value - 1)\n if (x1 < 0.0){\n /* Use reflection formula to get value for negative x. */\n r = logpi - log(fabs(m_sinpi(absx))).value - log(absx).value - r\n }\n r = $B.fast_float(r)\n if(isinf(r)){\n overflow()\n }\n return r;\n}\n\nfunction acos(x){\n $B.check_nb_args('acos', 1, arguments)\n $B.check_no_kw('acos', x)\n if(_mod.isinf(x)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }else if(_mod.isnan(x)){\n return _mod.nan\n }else{\n x = float_check(x)\n if(x > 1 || x < -1){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return _b_.float.$factory(Math.acos(x))\n }\n}\n\nfunction acosh(x){\n $B.check_nb_args('acosh', 1, arguments)\n $B.check_no_kw('acosh', x)\n\n if(_b_.float.$funcs.isinf(x)){\n if(_b_.float.$funcs.isninf(x)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return _mod.inf\n }else if(_mod.isnan(x)){\n return _mod.nan\n }\n var y = float_check(x)\n if(y <= 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if(y > Math.pow(2, 28)){ // issue 1590\n return _b_.float.$factory(_mod.log(y).value + _mod.log(2).value)\n }\n return _b_.float.$factory(Math.log(y + Math.sqrt(y * y - 1)))\n}\n\nfunction asin(x){\n $B.check_nb_args('asin', 1, arguments)\n $B.check_no_kw('asin', x)\n if(_mod.isinf(x)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }else if(_mod.isnan(x)){\n return _mod.nan\n }else{\n x = float_check(x)\n if(x > 1 || x < -1){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return _b_.float.$factory(Math.asin(x))\n }\n}\n\nfunction asinh(x){\n $B.check_nb_args('asinh', 1, arguments)\n $B.check_no_kw('asinh', x)\n\n var y = float_check(x)\n if(_b_.float.$funcs.isninf(x)){\n return NINF\n }else if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n if(y == 0 && 1 / y === -Infinity){\n return $B.fast_float(-0.0)\n }\n return _b_.float.$factory(Math.asinh(y))\n}\n\nfunction atan(x){\n $B.check_nb_args('atan', 1, arguments)\n $B.check_no_kw('atan', x)\n\n if(_b_.float.$funcs.isninf(x)){return _b_.float.$factory(-Math.PI / 2)}\n if(_b_.float.$funcs.isinf(x)){return _b_.float.$factory(Math.PI / 2)}\n return _b_.float.$factory(Math.atan(float_check(x)))\n}\n\nfunction atan2(x, y){\n $B.check_nb_args('atan2', 2, arguments)\n $B.check_no_kw('atan2', x, y)\n\n return _b_.float.$factory(Math.atan2(float_check(x), float_check(y)))\n}\n\nfunction atanh(x){\n $B.check_nb_args('atanh', 1, arguments)\n $B.check_no_kw('atanh', x)\n if(_b_.float.$funcs.isinf(x)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n var y = float_check(x)\n if(y == 0){\n return 0\n }else if(y <= -1 || y >= 1){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return _b_.float.$factory(0.5 * Math.log((1 / y + 1)/(1 / y - 1)));\n}\n\nfunction cbrt(x){\n // Cubic root\n $B.check_nb_args('cbrt ', 1, arguments)\n $B.check_no_kw('cbrt ', x)\n\n var y = float_check(x)\n if(_b_.float.$funcs.isninf(x)){\n return NINF\n }else if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n var _r = $B.fast_float(Math.cbrt(y))\n if(_b_.float.$funcs.isinf(_r)){\n throw _b_.OverflowError.$factory(\"math range error\")\n }\n return _r\n}\n\nfunction ceil(x){\n $B.check_nb_args('ceil', 1, arguments)\n $B.check_no_kw('ceil', x)\n\n var res\n\n if($B.$isinstance(x, _b_.float)){\n if(_b_.float.$funcs.isinf(x)){\n throw _b_.OverflowError.$factory(\n \"cannot convert float infinity to integer\")\n }else if(_mod.isnan(x)){\n throw _b_.OverflowError.$factory(\n \"cannot convert float NaN to integer\")\n }\n }\n\n var klass = x.__class__ || $B.get_class(x)\n\n try{\n // Use attribute of the object's class, not of the object\n // itself (special method)\n return $B.$call($B.$getattr(klass, '__ceil__'))(x)\n }catch(err){\n if(! $B.is_exc(err, [_b_.AttributeError])){\n throw err\n }\n }\n\n try{\n x = $B.$call($B.$getattr(klass, '__float__'))(x)\n }catch(err){\n if(! $B.is_exc(err, [_b_.AttributeError])){\n throw err\n }else{\n throw _b_.TypeError.$factory(\"must be real number, not \" +\n $B.class_name(x))\n }\n }\n return _mod.ceil(x)\n}\n\nconst ULLONG_MAX = 2n ** 64n - 1n,\n LONG_MAX = 2147483647,\n LONG_MIN = -2147483647,\n LLONG_MAX = 9223372036854775807n,\n LLONG_MIN = -9223372036854775807n,\n p2_64 = 2n ** 64n\n\nconst reduced_factorial_odd_part = [\n 0x0000000000000001n, 0x0000000000000001n, 0x0000000000000001n, 0x0000000000000003n,\n 0x0000000000000003n, 0x000000000000000fn, 0x000000000000002dn, 0x000000000000013bn,\n 0x000000000000013bn, 0x0000000000000b13n, 0x000000000000375fn, 0x0000000000026115n,\n 0x000000000007233fn, 0x00000000005cca33n, 0x0000000002898765n, 0x00000000260eeeebn,\n 0x00000000260eeeebn, 0x0000000286fddd9bn, 0x00000016beecca73n, 0x000001b02b930689n,\n 0x00000870d9df20adn, 0x0000b141df4dae31n, 0x00079dd498567c1bn, 0x00af2e19afc5266dn,\n 0x020d8a4d0f4f7347n, 0x335281867ec241efn, 0x9b3093d46fdd5923n, 0x5e1f9767cc5866b1n,\n 0x92dd23d6966aced7n, 0xa30d0f4f0a196e5bn, 0x8dc3e5a1977d7755n, 0x2ab8ce915831734bn,\n 0x2ab8ce915831734bn, 0x81d2a0bc5e5fdcabn, 0x9efcac82445da75bn, 0xbc8b95cf58cde171n,\n 0xa0e8444a1f3cecf9n, 0x4191deb683ce3ffdn, 0xddd3878bc84ebfc7n, 0xcb39a64b83ff3751n,\n 0xf8203f7993fc1495n, 0xbd2a2a78b35f4bddn, 0x84757be6b6d13921n, 0x3fbbcfc0b524988bn,\n 0xbd11ed47c8928df9n, 0x3c26b59e41c2f4c5n, 0x677a5137e883fdb3n, 0xff74e943b03b93ddn,\n 0xfe5ebbcb10b2bb97n, 0xb021f1de3235e7e7n, 0x33509eb2e743a58fn, 0x390f9da41279fb7dn,\n 0xe5cb0154f031c559n, 0x93074695ba4ddb6dn, 0x81c471caa636247fn, 0xe1347289b5a1d749n,\n 0x286f21c3f76ce2ffn, 0x00be84a2173e8ac7n, 0x1595065ca215b88bn, 0xf95877595b018809n,\n 0x9c2efe3c5516f887n, 0x373294604679382bn, 0xaf1ff7a888adcd35n, 0x18ddf279a2c5800bn,\n 0x18ddf279a2c5800bn, 0x505a90e2542582cbn, 0x5bacad2cd8d5dc2bn, 0xfe3152bcbff89f41n,\n 0xe1467e88bf829351n, 0xb8001adb9e31b4d5n, 0x2803ac06a0cbb91fn, 0x1904b5d698805799n,\n 0xe12a648b5c831461n, 0x3516abbd6160cfa9n, 0xac46d25f12fe036dn, 0x78bfa1da906b00efn,\n 0xf6390338b7f111bdn, 0x0f25f80f538255d9n, 0x4ec8ca55b8db140fn, 0x4ff670740b9b30a1n,\n 0x8fd032443a07f325n, 0x80dfe7965c83eeb5n, 0xa3dc1714d1213afdn, 0x205b7bbfcdc62007n,\n 0xa78126bbe140a093n, 0x9de1dc61ca7550cfn, 0x84f0046d01b492c5n, 0x2d91810b945de0f3n,\n 0xf5408b7f6008aa71n, 0x43707f4863034149n, 0xdac65fb9679279d5n, 0xc48406e7d1114eb7n,\n 0xa7dc9ed3c88e1271n, 0xfb25b2efdb9cb30dn, 0x1bebda0951c4df63n, 0x5c85e975580ee5bdn,\n 0x1591bc60082cb137n, 0x2c38606318ef25d7n, 0x76ca72f7c5c63e27n, 0xf04a75d17baa0915n,\n 0x77458175139ae30dn, 0x0e6c1330bc1b9421n, 0xdf87d2b5797e8293n, 0xefa5c703e1e68925n,\n 0x2b6b1b3278b4f6e1n, 0xceee27b382394249n, 0xd74e3829f5dab91dn, 0xfdb17989c26b5f1fn,\n 0xc1b7d18781530845n, 0x7b4436b2105a8561n, 0x7ba7c0418372a7d7n, 0x9dbc5c67feb6c639n,\n 0x502686d7f6ff6b8fn, 0x6101855406be7a1fn, 0x9956afb5806930e7n, 0xe1f0ee88af40f7c5n,\n 0x984b057bda5c1151n, 0x9a49819acc13ea05n, 0x8ef0dead0896ef27n, 0x71f7826efe292b21n,\n 0xad80a480e46986efn, 0x01cdc0ebf5e0c6f7n, 0x6e06f839968f68dbn, 0xdd5943ab56e76139n,\n 0xcdcf31bf8604c5e7n, 0x7e2b4a847054a1cbn, 0x0ca75697a4d3d0f5n, 0x4703f53ac514a98bn,\n];\n\nconst inverted_factorial_odd_part = [\n 0x0000000000000001n, 0x0000000000000001n, 0x0000000000000001n, 0xaaaaaaaaaaaaaaabn,\n 0xaaaaaaaaaaaaaaabn, 0xeeeeeeeeeeeeeeefn, 0x4fa4fa4fa4fa4fa5n, 0x2ff2ff2ff2ff2ff3n,\n 0x2ff2ff2ff2ff2ff3n, 0x938cc70553e3771bn, 0xb71c27cddd93e49fn, 0xb38e3229fcdee63dn,\n 0xe684bb63544a4cbfn, 0xc2f684917ca340fbn, 0xf747c9cba417526dn, 0xbb26eb51d7bd49c3n,\n 0xbb26eb51d7bd49c3n, 0xb0a7efb985294093n, 0xbe4b8c69f259eabbn, 0x6854d17ed6dc4fb9n,\n 0xe1aa904c915f4325n, 0x3b8206df131cead1n, 0x79c6009fea76fe13n, 0xd8c5d381633cd365n,\n 0x4841f12b21144677n, 0x4a91ff68200b0d0fn, 0x8f9513a58c4f9e8bn, 0x2b3e690621a42251n,\n 0x4f520f00e03c04e7n, 0x2edf84ee600211d3n, 0xadcaa2764aaacdfdn, 0x161f4f9033f4fe63n,\n 0x161f4f9033f4fe63n, 0xbada2932ea4d3e03n, 0xcec189f3efaa30d3n, 0xf7475bb68330bf91n,\n 0x37eb7bf7d5b01549n, 0x46b35660a4e91555n, 0xa567c12d81f151f7n, 0x4c724007bb2071b1n,\n 0x0f4a0cce58a016bdn, 0xfa21068e66106475n, 0x244ab72b5a318ae1n, 0x366ce67e080d0f23n,\n 0xd666fdae5dd2a449n, 0xd740ddd0acc06a0dn, 0xb050bbbb28e6f97bn, 0x70b003fe890a5c75n,\n 0xd03aabff83037427n, 0x13ec4ca72c783bd7n, 0x90282c06afdbd96fn, 0x4414ddb9db4a95d5n,\n 0xa2c68735ae6832e9n, 0xbf72d71455676665n, 0xa8469fab6b759b7fn, 0xc1e55b56e606caf9n,\n 0x40455630fc4a1cffn, 0x0120a7b0046d16f7n, 0xa7c3553b08faef23n, 0x9f0bfd1b08d48639n,\n 0xa433ffce9a304d37n, 0xa22ad1d53915c683n, 0xcb6cbc723ba5dd1dn, 0x547fb1b8ab9d0ba3n,\n 0x547fb1b8ab9d0ba3n, 0x8f15a826498852e3n, 0x32e1a03f38880283n, 0x3de4cce63283f0c1n,\n 0x5dfe6667e4da95b1n, 0xfda6eeeef479e47dn, 0xf14de991cc7882dfn, 0xe68db79247630ca9n,\n 0xa7d6db8207ee8fa1n, 0x255e1f0fcf034499n, 0xc9a8990e43dd7e65n, 0x3279b6f289702e0fn,\n 0xe7b5905d9b71b195n, 0x03025ba41ff0da69n, 0xb7df3d6d3be55aefn, 0xf89b212ebff2b361n,\n 0xfe856d095996f0adn, 0xd6e533e9fdf20f9dn, 0xf8c0e84a63da3255n, 0xa677876cd91b4db7n,\n 0x07ed4f97780d7d9bn, 0x90a8705f258db62fn, 0xa41bbb2be31b1c0dn, 0x6ec28690b038383bn,\n 0xdb860c3bb2edd691n, 0x0838286838a980f9n, 0x558417a74b36f77dn, 0x71779afc3646ef07n,\n 0x743cda377ccb6e91n, 0x7fdf9f3fe89153c5n, 0xdc97d25df49b9a4bn, 0x76321a778eb37d95n,\n 0x7cbb5e27da3bd487n, 0x9cff4ade1a009de7n, 0x70eb166d05c15197n, 0xdcf0460b71d5fe3dn,\n 0x5ac1ee5260b6a3c5n, 0xc922dedfdd78efe1n, 0xe5d381dc3b8eeb9bn, 0xd57e5347bafc6aadn,\n 0x86939040983acd21n, 0x395b9d69740a4ff9n, 0x1467299c8e43d135n, 0x5fe440fcad975cdfn,\n 0xcaa9a39794a6ca8dn, 0xf61dbd640868dea1n, 0xac09d98d74843be7n, 0x2b103b9e1a6b4809n,\n 0x2ab92d16960f536fn, 0x6653323d5e3681dfn, 0xefd48c1c0624e2d7n, 0xa496fefe04816f0dn,\n 0x1754a7b07bbdd7b1n, 0x23353c829a3852cdn, 0xbf831261abd59097n, 0x57a8e656df0618e1n,\n 0x16e9206c3100680fn, 0xadad4c6ee921dac7n, 0x635f2b3860265353n, 0xdd6d0059f44b3d09n,\n 0xac4dd6b894447dd7n, 0x42ea183eeaa87be3n, 0x15612d1550ee5b5dn, 0x226fa19d656cb623n,\n]\n\nconst factorial_trailing_zeros = [\n 0, 0, 1, 1, 3, 3, 4, 4, 7, 7, 8, 8, 10, 10, 11, 11, // 0-15\n 15, 15, 16, 16, 18, 18, 19, 19, 22, 22, 23, 23, 25, 25, 26, 26, // 16-31\n 31, 31, 32, 32, 34, 34, 35, 35, 38, 38, 39, 39, 41, 41, 42, 42, // 32-47\n 46, 46, 47, 47, 49, 49, 50, 50, 53, 53, 54, 54, 56, 56, 57, 57, // 48-63\n 63, 63, 64, 64, 66, 66, 67, 67, 70, 70, 71, 71, 73, 73, 74, 74, // 64-79\n 78, 78, 79, 79, 81, 81, 82, 82, 85, 85, 86, 86, 88, 88, 89, 89, // 80-95\n 94, 94, 95, 95, 97, 97, 98, 98, 101, 101, 102, 102, 104, 104, 105, 105, // 96-111\n 109, 109, 110, 110, 112, 112, 113, 113, 116, 116, 117, 117, 119, 119, 120, 120, // 112-127\n].map(BigInt)\n\nconst NULL = undefined\n\n/* Calculate C(n, k) for n in the 63-bit range. */\n\nfunction perm_comb_small(n, k, iscomb){\n if(k == 0){\n return 1n\n }\n\n /* For small enough n and k the result fits in the 64-bit range and can\n * be calculated without allocating intermediate PyLong objects. */\n if(iscomb){\n /* Maps k to the maximal n so that 2*k-1 <= n <= 127 and C(n, k)\n * fits into a uint64_t. Exclude k = 1, because the second fast\n * path is faster for this case.*/\n var fast_comb_limits1 = [\n 0, 0, 127, 127, 127, 127, 127, 127, // 0-7\n 127, 127, 127, 127, 127, 127, 127, 127, // 8-15\n 116, 105, 97, 91, 86, 82, 78, 76, // 16-23\n 74, 72, 71, 70, 69, 68, 68, 67, // 24-31\n 67, 67, 67 // 32-34\n ];\n if(k < fast_comb_limits1.length && n <= fast_comb_limits1[k]){\n /*\n comb(n, k) fits into a uint64_t. We compute it as\n comb_odd_part << shift\n where 2**shift is the largest power of two dividing comb(n, k)\n and comb_odd_part is comb(n, k) >> shift. comb_odd_part can be\n calculated efficiently via arithmetic modulo 2**64, using three\n lookups and two uint64_t multiplications.\n */\n var comb_odd_part = reduced_factorial_odd_part[n]\n * inverted_factorial_odd_part[k]\n * inverted_factorial_odd_part[n - k];\n comb_odd_part %= p2_64\n var shift = factorial_trailing_zeros[n]\n - factorial_trailing_zeros[k]\n - factorial_trailing_zeros[n - k];\n return comb_odd_part << shift;\n }\n\n /* Maps k to the maximal n so that 2*k-1 <= n <= 127 and C(n, k)*k\n * fits into a long long (which is at least 64 bit). Only contains\n * items larger than in fast_comb_limits1. */\n var fast_comb_limits2 = [\n 0, ULLONG_MAX, 4294967296, 3329022, 102570, 13467, 3612, 1449, // 0-7\n 746, 453, 308, 227, 178, 147 // 8-13\n ];\n if (k < fast_comb_limits2.length && n <= fast_comb_limits2[k]) {\n /* C(n, k) = C(n, k-1) * (n-k+1) / k */\n var result = n,\n i = 1n;\n while(i < k){\n result *= --n;\n result /= ++i;\n }\n return result;\n }\n }else{\n /* Maps k to the maximal n so that k <= n and P(n, k)\n * fits into a long long (which is at least 64 bit). */\n var fast_perm_limits = [\n 0, ULLONG_MAX, 4294967296, 2642246, 65537, 7133, 1627, 568, // 0-7\n 259, 142, 88, 61, 45, 36, 30, 26, // 8-15\n 24, 22, 21, 20, 20 // 16-20\n ];\n if (k < fast_perm_limits.length && n <= fast_perm_limits[k]) {\n if(n <= 127){\n /* P(n, k) fits into a uint64_t. */\n var perm_odd_part = reduced_factorial_odd_part[n]\n * inverted_factorial_odd_part[n - k];\n perm_odd_part %= p2_64\n var shift = factorial_trailing_zeros[n]\n - factorial_trailing_zeros[n - k];\n var res = perm_odd_part << shift\n\n return res;\n }\n\n /* P(n, k) = P(n, k-1) * (n-k+1) */\n var result = n;\n for (var i = 1; i < k; i++) {\n result *= --n;\n }\n return result\n }\n }\n\n /* For larger n use recursive formulas:\n *\n * P(n, k) = P(n, j) * P(n-j, k-j)\n * C(n, k) = C(n, j) * C(n-j, k-j) // C(k, j)\n */\n var j = k / 2n;\n var a = perm_comb_small(n, j, iscomb);\n var b = perm_comb_small(n - j, k - j, iscomb);\n a = a * b;\n if(iscomb){\n b = perm_comb_small(k, j, 1);\n a = a / b;\n }\n return a;\n}\n\n/* Calculate P(n, k) or C(n, k) using recursive formulas.\n * It is more efficient than sequential multiplication thanks to\n * Karatsuba multiplication.\n */\nfunction perm_comb(n, k, iscomb){\n if(k == 0){\n return 1;\n }\n if(k == 1){\n return n;\n }\n\n /* P(n, k) = P(n, j) * P(n-j, k-j) */\n /* C(n, k) = C(n, j) * C(n-j, k-j) // C(k, j) */\n var j = k / 2n\n var a = perm_comb(n, j, iscomb);\n //var t = j\n //n = n - t;\n var b = perm_comb(n - j, k - j, iscomb);\n a = a * b;\n if(iscomb){\n b = perm_comb_small(k, j, 1);\n a = a / b;\n }\n return a;\n}\n\nfunction comb(n, k){\n var $ = $B.args('comb', 2, {n: null, k: null}, ['n', 'k'],\n arguments, {}, null, null),\n n = $.n,\n k = $.k\n\n var result = NULL,\n temp,\n overflow, cmp;\n\n // accept integers or objects with __index__\n n = $B.PyNumber_Index(n)\n k = $B.PyNumber_Index(k)\n\n n = _b_.int.$to_bigint(n);\n k = _b_.int.$to_bigint(k);\n\n if(n < 0){\n throw _b_.ValueError.$factory(\n \"n must be a non-negative integer\");\n }\n if(k < 0){\n throw _b_.ValueError.$factory(\n \"k must be a non-negative integer\");\n }\n\n overflow = n > LLONG_MAX || n < LLONG_MIN\n if(! overflow){\n overflow = k > LLONG_MAX || k < LLONG_MIN\n if (overflow || k > n) {\n result = 0n;\n }else{\n if(n - k < k){\n k = n - k\n }\n if (k > 1) {\n result = perm_comb_small(n, k, 1);\n }\n }\n /* For k == 1 just return the original n in perm_comb(). */\n }else{\n /* k = min(k, n - k) */\n temp = n - k\n if(temp < 0) {\n result = 0n;\n }\n if (temp < k) {\n k = temp\n }\n\n overflow = k > LLONG_MAX || k < LLONG_MIN\n if (overflow) {\n throw _b_.OverflowError.$factory(\n \"min(n - k, k) must not exceed \" +\n LLONG_MAX);\n }\n }\n if(result === undefined){\n result = perm_comb(n, k, 1);\n }\n\n return _b_.int.$int_or_long(result)\n}\n\n\nfunction copysign(x, y){\n $B.check_nb_args_no_kw('copysign', 2, arguments)\n\n var x1 = Math.abs(float_check(x))\n var y1 = float_check(y)\n var sign = Math.sign(y1)\n sign = (sign == 1 || Object.is(sign, +0)) ? 1 : - 1\n return _b_.float.$factory(x1 * sign)\n}\n\nfunction cos(x){\n $B.check_nb_args('cos ', 1, arguments)\n $B.check_no_kw('cos ', x)\n return _b_.float.$factory(Math.cos(float_check(x)))\n}\n\nfunction cosh(x){\n $B.check_nb_args('cosh', 1, arguments)\n $B.check_no_kw('cosh', x)\n\n if(_b_.float.$funcs.isinf(x)){return INF}\n var y = float_check(x)\n if(Math.cosh !== undefined){return _b_.float.$factory(Math.cosh(y))}\n return _b_.float.$factory((Math.pow(Math.E, y) +\n Math.pow(Math.E, -y)) / 2)\n}\n\nfunction degrees(x){\n $B.check_nb_args('degrees', 1, arguments)\n $B.check_no_kw('degrees', x)\n return _b_.float.$factory(float_check(x) * 180 / Math.PI)\n}\n\nfunction dist(p, q){\n $B.check_nb_args_no_kw('dist', 2, arguments)\n\n function test(x){\n if(typeof x === \"number\"){\n return x\n }else if(x.__class__ === _b_.float){\n return x.value\n }\n var y = $B.$getattr(x, '__float__', null)\n if(y === null){\n throw _b_.TypeError.$factory('not a float')\n }\n return $B.$call(y)().value\n }\n\n // build list of differences (as floats) between coordinates of p and q\n var diffs = [],\n diff\n\n if(Array.isArray(p) && Array.isArray(q)){\n // simple case : p and q are lists of tuples\n if(p.length != q.length){\n throw _b_.ValueError.$factory(\"both points must have \" +\n \"the same number of dimensions\")\n }\n p = p.map(test)\n q = q.map(test)\n for(var i = 0, len = p.length; i < len; i++){\n var next_p = p[i],\n next_q = q[i]\n var diff = Math.abs(next_p - next_q)\n diffs.push(diff)\n }\n }else{\n var itp = _b_.iter(p),\n itq = _b_.iter(q),\n res = 0\n\n while(true){\n try{\n var next_p = _b_.next(itp)\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n // check that the other iterator is also exhausted\n try{\n var next_q = _b_.next(itq)\n throw _b_.ValueError.$factory(\"both points must have \" +\n \"the same number of dimensions\")\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n break\n }\n throw err\n }\n }\n throw err\n }\n next_p = test(next_p)\n try{\n var next_q = _b_.next(itq)\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n throw _b_.ValueError.$factory(\"both points must have \" +\n \"the same number of dimensions\")\n }\n throw err\n }\n next_q = test(next_q)\n diff = Math.abs(next_p - next_q)\n diffs.push(diff)\n }\n }\n for(var diff of diffs){\n if(! isFinite(diff) && ! isNaN(diff)){\n return _mod.inf\n }\n }\n for(var diff of diffs){\n if(isNaN(diff)){\n return _mod.nan\n }\n }\n\n var res = 0,\n scale = 1,\n max_diff = Math.max(...diffs),\n min_diff = Math.min(...diffs)\n max_value = Math.sqrt(Number.MAX_VALUE) / p.length,\n min_value = Math.sqrt(Number.MIN_VALUE) * p.length\n if(max_diff > max_value){\n var nb = 0\n while(max_diff > max_value){\n scale *= 2\n max_diff /= 2\n nb++\n }\n for(var diff of diffs){\n diff = diff / scale\n res += diff * diff\n }\n return $B.fast_float(scale * Math.sqrt(res))\n }else if(min_diff !== 0 && min_diff < min_value){\n while(min_diff < min_value){\n scale *= 2\n min_diff *= 2\n }\n for(var diff of diffs){\n diff = diff * scale\n res += diff * diff\n }\n return $B.fast_float(Math.sqrt(res) / scale)\n }else{\n for(var diff of diffs){\n res += Math.pow(diff, 2)\n }\n return $B.fast_float(Math.sqrt(res))\n }\n}\n\nconst e = _b_.float.$factory(Math.E)\n\nconst ERF_SERIES_CUTOFF = 1.5,\n ERF_SERIES_TERMS = 25,\n ERFC_CONTFRAC_CUTOFF = 30.0,\n ERFC_CONTFRAC_TERMS = 50\n\n/*\n Error function, via power series.\n Given a finite float x, return an approximation to erf(x).\n Converges reasonably fast for small x.\n*/\n\nfunction m_erf_series(x){\n var x2, acc, fk, result\n var i\n\n x2 = x * x\n acc = 0.0\n fk = ERF_SERIES_TERMS + 0.5\n for(i = 0; i < ERF_SERIES_TERMS; i++){\n acc = 2.0 + x2 * acc / fk\n fk -= 1.0\n }\n result = acc * x * exp(-x2).value / sqrtpi\n return result\n}\n\nfunction m_erfc_contfrac(x){\n var x2, a, da, p, p_last, q, q_last, b, result;\n var i\n\n if(x >= ERFC_CONTFRAC_CUTOFF){\n return 0.0\n }\n\n x2 = x * x\n a = 0.0\n da = 0.5\n p = 1.0\n p_last = 0.0\n q = da + x2\n q_last = 1.0\n for(i = 0; i < ERFC_CONTFRAC_TERMS; i++){\n var temp\n a += da\n da += 2.0\n b = da + x2\n temp = p; p = b * p - a * p_last; p_last = temp\n temp = q; q = b * q - a * q_last; q_last = temp\n }\n result = p / q * x * exp(-x2).value / sqrtpi\n return result\n}\n\n\nfunction erf(x){\n var absx,\n cf\n var x1 = float_check(x)\n if(isNaN(x1)){\n return x\n }\n absx = fabs(x)\n if(absx.value < ERF_SERIES_CUTOFF){\n return $B.fast_float(m_erf_series(x1))\n }else{\n cf = m_erfc_contfrac(absx.value)\n return $B.fast_float(x1 > 0.0 ? 1.0 - cf : cf - 1.0)\n }\n}\n\nfunction erfc(x){\n\n // inspired from\n // http://stackoverflow.com/questions/457408/is-there-an-easily-available-implementation-of-erf-for-python\n var y = float_check(x)\n var t = 1.0 / (1.0 + 0.5 * Math.abs(y))\n var ans = 1 - t * Math.exp( -y * y - 1.26551223 +\n t * ( 1.00002368 +\n t * ( 0.37409196 +\n t * ( 0.09678418 +\n t * (-0.18628806 +\n t * ( 0.27886807 +\n t * (-1.13520398 +\n t * ( 1.48851587 +\n t * (-0.82215223 +\n t * 0.17087277)))))))))\n if(y >= 0.0){return 1 - ans}\n return 1 + ans\n}\n\nfunction erfc(x){\n $B.check_nb_args_no_kw('erfc', 1, arguments)\n var absx, cf;\n\n var x1 = float_check(x)\n if(isNaN(x1)){\n return x\n }\n absx = fabs(x);\n if(absx.value < ERF_SERIES_CUTOFF){\n return $B.fast_float(1.0 - m_erf_series(x1))\n }else{\n cf = m_erfc_contfrac(absx.value)\n return $B.fast_float(x1 > 0.0 ? cf : 2.0 - cf)\n }\n}\n\nfunction exp(x){\n $B.check_nb_args('exp', 1, arguments)\n $B.check_no_kw('exp', x)\n\n if(_b_.float.$funcs.isninf(x)){\n return _b_.float.$factory(0)\n }\n if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n var _r = Math.exp(float_check(x))\n if(! isNaN(_r) && ! isFinite(_r)){\n throw _b_.OverflowError.$factory(\"math range error\")\n }\n return _b_.float.$factory(_r)\n}\n\nfunction exp2(x){\n return pow(2, x)\n}\n\nfunction expm1(x){\n $B.check_nb_args('expm1', 1, arguments)\n $B.check_no_kw('expm1', x)\n\n if(_b_.float.$funcs.isninf(x)){\n return $B.fast_float(-1)\n }else if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n var _r = Math.expm1(float_check(x))\n if((! isNaN(_r)) && ! isFinite(_r)){\n overflow()\n }\n return $B.fast_float(_r)\n}\n\nfunction fabs(x){\n $B.check_nb_args_no_kw('fabs', 1, arguments)\n return _b_.float.$funcs.fabs(float_check(x)) // located in py_float.js\n}\n\n// factorial implementation, adapted from CPython's mathmodule.c\n\nconst SmallFactorials = [\n 1n, 1n, 2n, 6n, 24n, 120n, 720n, 5040n, 40320n,\n 362880n, 3628800n, 39916800n, 479001600n,\n 6227020800n, 87178291200n, 1307674368000n,\n 20922789888000n, 355687428096000n, 6402373705728000n,\n 121645100408832000n, 2432902008176640000n\n ]\n\nconst SIZEOF_LONG = 4\n\nfunction _Py_bit_length(x){\n const BIT_LENGTH_TABLE = [\n 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,\n 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5\n ]\n var msb = 0;\n while(x >= 32n){\n msb += 6;\n x >>= 6n;\n }\n msb += BIT_LENGTH_TABLE[parseInt(x)];\n return msb\n}\nfunction count_set_bits(n){\n var count = 0n;\n while(n != 0){\n ++count;\n n &= n - 1n; /* clear least significant bit */\n }\n return count;\n}\n\nfunction factorial_partial_product(start, stop, max_bits){\n var midpoint,\n num_operands,\n left,\n right,\n result\n\n /* If the return value will fit an unsigned long, then we can\n * multiply in a tight, fast loop where each multiply is O(1).\n * Compute an upper bound on the number of bits required to store\n * the answer.\n *\n * Storing some integer z requires floor(lg(z))+1 bits, which is\n * conveniently the value returned by bit_length(z). The\n * product x*y will require at most\n * bit_length(x) + bit_length(y) bits to store, based\n * on the idea that lg product = lg x + lg y.\n *\n * We know that stop - 2 is the largest number to be multiplied. From\n * there, we have: bit_length(answer) <= num_operands *\n * bit_length(stop - 2)\n */\n\n num_operands = (stop - start) / 2n;\n max_bits = BigInt(max_bits)\n /* The \"num_operands <= 8 * SIZEOF_LONG\" check guards against the\n * unlikely case of an overflow in num_operands * max_bits. */\n if(num_operands <= 8 * SIZEOF_LONG &&\n num_operands * max_bits <= 8 * SIZEOF_LONG) {\n var j,\n total;\n for (total = start, j = start + 2n; j < stop; j += 2n){\n total *= j;\n }\n return total\n }\n\n /* find midpoint of range(start, stop), rounded up to next odd number. */\n midpoint = (start + num_operands) | 1n;\n left = factorial_partial_product(start, midpoint,\n _Py_bit_length(midpoint - 2n));\n right = factorial_partial_product(midpoint, stop, max_bits);\n result = left * right\n return result;\n}\n\n\nfunction factorial_odd_part(n){\n var i,\n v, lower, upper,\n partial, tmp, inner, outer;\n\n inner = 1n\n outer = inner;\n upper = 3n;\n for (i = BigInt(_Py_bit_length(n)) - 2n; i >= 0; i--) {\n v = n >> i;\n if (v <= 2){\n continue\n }\n lower = upper;\n /* (v + 1) | 1 = least odd integer strictly larger than n / 2**i */\n upper = (v + 1n) | 1n;\n /* Here inner is the product of all odd integers j in the range (0,\n n/2**(i+1)]. The factorial_partial_product call below gives the\n product of all odd integers j in the range (n/2**(i+1), n/2**i]. */\n partial = factorial_partial_product(lower, upper,\n _Py_bit_length(upper-2n));\n /* inner *= partial */\n tmp = inner * partial\n inner = tmp;\n /* Now inner is the product of all odd integers j in the range (0,\n n/2**i], giving the inner product in the formula above. */\n\n /* outer *= inner; */\n tmp = outer * inner\n outer = tmp;\n }\n return outer;\n}\n\nfunction factorial(arg){\n var x,\n two_valuation,\n overflow,\n result,\n odd_part;\n // Check that arg can be converted to an integer, and transform it to\n // a bigint\n x = _b_.int.$to_bigint($B.PyNumber_Index(arg))\n overflow = x > LONG_MAX || x < LONG_MIN\n if(x > LONG_MAX) {\n throw _b_.OverflowError.$factory(\n \"factorial() argument should not exceed \" +\n LONG_MAX)\n }else if(x < 0) {\n throw _b_.ValueError.$factory(\n \"factorial() not defined for negative values\");\n }\n\n /* use lookup table if x is small */\n if (x < SmallFactorials.length){\n return _b_.int.$int_or_long(SmallFactorials[x]);\n }\n /* else express in the form odd_part * 2**two_valuation, and compute as\n odd_part << two_valuation. */\n odd_part = factorial_odd_part(x);\n two_valuation = x - count_set_bits(x);\n return _b_.int.$int_or_long(odd_part << two_valuation);\n}\n\nfunction floor(x){\n $B.check_nb_args_no_kw('floor', 1, arguments)\n\n if(typeof x == \"number\" || x.__class__ === _b_.float){\n return Math.floor(float_check(x))\n }\n var klass = $B.get_class(x)\n try{\n return $B.$call($B.$getattr(klass, \"__floor__\"))(x)\n }catch(err){\n if($B.is_exc(err, [_b_.AttributeError])){\n try{\n var float = $B.$call($B.$getattr(klass, \"__float__\"))(x)\n return floor(float)\n }catch(err){\n if($B.is_exc(err, [_b_.AttributeError])){\n throw _b_.TypeError.$factory(\"no __float__\")\n }\n throw err\n }\n }\n }\n}\n\nfunction fmod(x, y){\n $B.check_nb_args_no_kw('fmod', 2, arguments)\n if($B.$isinstance(x, _b_.float)){\n if(_b_.float.$funcs.isinf(x)){\n throw _b_.ValueError.$factory('math domain error')\n }\n }\n y = float_check(y)\n if(y == 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n return _b_.float.$factory(float_check(x) % float_check(y))\n}\n\nfunction frexp(x){\n $B.check_nb_args_no_kw('frexp', 1, arguments)\n\n var _l = _b_.float.$funcs.frexp(x)\n return _b_.tuple.$factory([_b_.float.$factory(_l[0]), _l[1]])\n}\n\nfunction fsum(x){\n $B.check_nb_args_no_kw('fsum', 1, arguments)\n\n /* Translation into Javascript of the function msum in an Active\n State Cookbook recipe : https://code.activestate.com/recipes/393090/\n by Raymond Hettinger\n */\n var partials = [],\n res = new Number(),\n _it = _b_.iter(x)\n while(true){\n try{\n var x = _b_.next(_it),\n i = 0\n x = float_check(x)\n for(var j = 0, len = partials.length; j < len; j++){\n var y = float_check(partials[j])\n if(Math.abs(x) < Math.abs(y)){\n var z = x\n x = y\n y = z\n }\n var hi = x + y,\n lo = y - (hi - x)\n if(lo){\n partials[i] = lo\n i++\n }\n x = hi\n }\n partials = partials.slice(0, i).concat([x])\n }catch(err){\n if($B.$isinstance(err, _b_.StopIteration)){break}\n throw err\n }\n }\n var res = 0\n for(var i = 0; i < partials.length; i++){\n res += partials[i]\n }\n return $B.fast_float(res)\n}\n\nfunction gamma(x){\n $B.check_nb_args('gamma', 1, arguments)\n $B.check_no_kw('gamma', x)\n var x_as_number = x,\n r,\n y,\n z,\n sqrtpow\n\n /* special cases */\n if($B.$isinstance(x, _b_.float)){\n x_as_number = x.value\n }else if(! $B.$isinstance(x, _b_.int)){\n throw _b_.TypeError.$factory(\"must be real number, not \" +\n $B.class_name(x))\n }\n if(x_as_number === Number.POSITIVE_INFINITY || isNaN(x_as_number)){\n return x\n }else if(x_as_number === Number.NEGATIVE_INFINITY || x_as_number == 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n\n /* integer arguments */\n if(Number.isInteger(x_as_number)){\n if($B.rich_comp('__lt__', x, 0.0)){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if($B.rich_comp('__le__', x, NGAMMA_INTEGRAL)){\n return $B.fast_float(gamma_integral[x_as_number - 1])\n }\n }\n var absx = fabs(x)\n\n /* tiny arguments: tgamma(x) ~ 1/x for x near 0 */\n if(absx.value < 1e-20){\n r = 1.0 / x_as_number\n if(r === Infinity || r === -Infinity){\n overflow()\n }\n return $B.fast_float(r)\n }\n\n /* large arguments: assuming IEEE 754 doubles, tgamma(x) overflows for\n x > 200, and underflows to +-0.0 for x < -200, not a negative\n integer. */\n if(absx.value > 200.0){\n if(x_as_number < 0.0){\n return $B.fast_float(0.0 / m_sinpi(x).value);\n }else{\n overflow()\n }\n }\n\n y = absx.value + lanczos_g_minus_half;\n /* compute error in sum */\n if (absx.value > lanczos_g_minus_half) {\n /* note: the correction can be foiled by an optimizing\n compiler that (incorrectly) thinks that an expression like\n a + b - a - b can be optimized to 0.0. This shouldn't\n happen in a standards-conforming compiler. */\n var q = y - absx.value;\n z = q - lanczos_g_minus_half;\n }else{\n var q = y - lanczos_g_minus_half;\n z = q - absx.value;\n }\n z = z * lanczos_g / y;\n if (x_as_number < 0.0) {\n r = -pi.value / m_sinpi(absx).value /\n absx.value * _mod.exp(y).value /\n lanczos_sum(absx.value);\n r -= z * r;\n if(absx.value < 140.0){\n r /= pow(y, absx.value - 0.5).value;\n }else{\n sqrtpow = pow(y, absx.value / 2.0 - 0.25);\n r /= sqrtpow.value;\n r /= sqrtpow.value;\n }\n }else{\n r = lanczos_sum(absx.value) / exp(y).value;\n r += z * r;\n if(absx.value < 140.0){\n r *= pow(y, absx.value - 0.5).value;\n }else{\n sqrtpow = pow(y, absx.value / 2.0 - 0.25);\n r *= sqrtpow.value;\n r *= sqrtpow.value;\n }\n }\n if(r === Number.POSITIVE_INFINITY){\n overflow()\n }\n return $B.fast_float(r);\n}\n\n\n// GCD algorithm. Javascript adaptation of Python script at\n// https://gist.github.com/cmpute/baa545f0c2b6be8b628e9ded3c19f6c1\n// by Jacob Zhong\nfunction bit_length(x){\n return x.toString(2).length\n}\n\n$B.nb_simple_gcd = 0\n\nfunction simple_gcd(a, b){\n /* a fits into a long, so b must too */\n $B.nb_simple_gcd++\n var x = a >= 0 ? a : -a,\n y = b >= 0 ? b : -b\n\n /* usual Euclidean algorithm for longs */\n while (y != 0) {\n t = y;\n y = x % y;\n x = t;\n }\n return x\n}\n\nfunction lgcd(x, y){\n var a, b, c, d\n if(x < y){\n return lgcd(y, x)\n }\n var shift = BigInt(Math.max(Math.floor(bit_length(x) / 64),\n Math.floor(bit_length(y) / 64))),\n xbar = x >> (shift * 64n),\n ybar = y >> (shift * 64n)\n while(y > p2_64){\n [a, b, c, d] = [1n, 0n, 0n, 1n]\n while(ybar + c != 0 && ybar + d != 0){\n q = (xbar + a) / (ybar + c)\n p = (xbar + b) / (ybar + d)\n if(q != p){\n break\n }\n [a, c] = [c, a - q * c]\n [b, d] = [d, b - q * d]\n [xbar, ybar] = [ybar, xbar - q * ybar]\n }\n if(b == 0){\n [x, y] = [y, x % y]\n }else{\n [x, y] = [a * x + b * y, c * x + d * y]\n }\n }\n return simple_gcd(x, y)\n}\n\nfunction xgcd(x, y){\n var xneg = x < 0 ? -1n : 1n,\n yneg = y < 0 ? -1n : 1n,\n last_r,\n last_s,\n last_t,\n q, r, s, t;\n\n [x, y] = [x >= 0 ? x : -x, y >= 0 ? y : -y];\n\n // it's maintained that r = s * x + t * y, last_r = last_s * x + last_t * y\n [last_r, r] = [x, y];\n [last_s, s] = [1n, 0n];\n [last_t, t] = [0n, 1n];\n\n while(r > 0){\n q = last_r / r;\n [last_r, r] = [r, last_r - q * r];\n [last_s, s] = [s, last_s - q * s];\n [last_t, t] = [t, last_t - q * t];\n }\n return [last_r, last_s * xneg, last_t * yneg]\n}\n\nfunction lxgcd(x, y){\n var g, cy, cx,\n s, last_s,\n t, last_t,\n a, b, c, d\n x = x >= 0 ? x : -x\n y = y >= 0 ? y : -y\n\n if(x < y){\n [g, cy, cx] = xgcd(y, x)\n return [g, cx, cy]\n }\n\n var shift = BigInt(Math.max(Math.floor(bit_length(x) / 64),\n Math.floor(bit_length(y) / 64))),\n xbar = x >> (shift * 64n),\n ybar = y >> (shift * 64n);\n\n [last_s, s] = [1n, 0n];\n [last_t, t] = [0n, 1n];\n\n while(y > p2_64){\n [a, b, c, d] = [1n, 0n, 0n, 1n]\n while(ybar + c != 0 && ybar + d != 0){\n q = (xbar + a) / (ybar + c)\n p = (xbar + b) / (ybar + d)\n if(q != p){\n break\n };\n [a, c = c], [a - q * c];\n [b, d = d], [b - q * d];\n [xbar, ybar] = [ybar, xbar - q * ybar];\n }\n if(b == 0){\n q = x / y;\n [x, y] = [y, x % y];\n [last_s, s] = [s, last_s - q * s];\n [last_t, t] = [t, last_t - q * t];\n }else{\n [x, y] = [a * x + b * y, c * x + d * y];\n [last_s, s] = [a * last_s + b * s, c * last_s + d * s];\n [last_t, t] = [a * last_t + b * t, c * last_t + d * t];\n }\n }\n // notice that here x, y could be negative\n [g, cx, cy] = xgcd(x, y)\n\n return [g, cx * last_s + cy * s, cx * last_t + cy * t]\n}\n\nfunction gcd(x, y){\n var $ = $B.args(\"gcd\", 0, {}, [], arguments, {}, 'args', null)\n var args = $.args.map($B.PyNumber_Index)\n if(args.length == 0){\n return 0\n }else if(args.length == 1){\n return _b_.abs(args[0])\n }\n x = _b_.int.$to_bigint(args[0])\n y = _b_.int.$to_bigint(args[1])\n var res = lxgcd(x, y)[0],\n i = 2\n while(i < args.length){\n res = lxgcd(res, _b_.int.$to_bigint(args[i]))[0]\n i++\n }\n return _b_.int.$int_or_long(res)\n}\n\n\nfunction hypot(x, y){\n var $ = $B.args(\"hypot\", 0, {}, [],\n arguments, {}, \"args\", null)\n var args = []\n for(var arg of $.args){\n try{\n args.push(float_check(arg))\n }catch(err){\n if($B.is_exc(err, [_b_.ValueError])){\n throw _b_.TypeError.$factory('must be real number, not ' +\n $B.class_name(arg))\n }\n throw err\n }\n }\n return $B.fast_float(Math.hypot(...args))\n}\n\nvar inf = INF\n\nfunction isclose(){\n var $ = $B.args(\"isclose\",\n 4,\n {a: null, b: null, rel_tol: null, abs_tol: null},\n ['a', 'b', 'rel_tol', 'abs_tol'],\n arguments,\n {rel_tol: $B.fast_float(1e-09),\n abs_tol: $B.fast_float(0.0)},\n '*',\n null)\n var a = float_check($.a),\n b = float_check($.b),\n rel_tol = float_check($.rel_tol),\n abs_tol = float_check($.abs_tol)\n\n if(rel_tol < 0.0 || abs_tol < 0.0){\n throw _b_.ValueError.$factory('tolerances must be non-negative')\n }\n\n if(a == b){\n return _b_.True\n }\n if(_b_.float.$funcs.isinf(a) || _b_.float.$funcs.isinf(b)){\n return a === b\n }\n // isclose(a, b, rel_tol, abs_tol) is the same as\n // abs_diff = abs(a - b)\n // max_ab = max(abs(a), abs(b))\n // abs_diff <= abs_tol or abs_diff / max_ab <= rel_tol\n // This is more correct than in Python docs:\n // \"abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)\"\n // because this fails for Decimal instances, which do not support\n // multiplication by floats\n\n var diff = b - a,\n abs_diff = Math.abs(diff)\n if(abs_diff <= abs_tol){\n return true\n }\n var abs_a = Math.abs(a),\n abs_b = Math.abs(b),\n max_ab = Math.max(abs_a, abs_b)\n return abs_diff / max_ab <= rel_tol\n}\n\nfunction isfinite(x){\n $B.check_nb_args('isfinite', 1, arguments)\n $B.check_no_kw('isfinite', x)\n return isFinite(float_check(x))\n}\n\nfunction isinf(x){\n $B.check_nb_args('isinf', 1, arguments)\n $B.check_no_kw('isinf', x)\n return _b_.float.$funcs.isinf(x)\n}\n\nfunction isnan(x){\n $B.check_nb_args('isnan', 1, arguments)\n $B.check_no_kw('isnan', x)\n return isNaN(float_check(x))\n}\n\nfunction isqrt(x){\n $B.check_nb_args_no_kw('isqrt', 1, arguments)\n\n x = $B.PyNumber_Index(x)\n if($B.rich_comp(\"__lt__\", x, 0)){\n throw _b_.ValueError.$factory(\n \"isqrt() argument must be nonnegative\")\n }\n if(typeof x == \"number\"){\n return Math.floor(Math.sqrt(x))\n }else{ // big integer\n // adapted from code in mathmodule.c\n var n = x.value,\n bit_length = n.toString(2).length,\n c = BigInt(Math.floor((bit_length - 1) / 2)),\n c_bit_length = c.toString(2).length,\n a = 1n,\n d = 0n,\n e\n\n for(var s = BigInt(c_bit_length - 1); s >= 0; s--){\n // Loop invariant: (a-1)**2 < (n >> 2*(c - d)) < (a+1)**2\n e = d\n d = c >> s\n a = (a << d - e - 1n) + (n >> 2n*c - e - d + 1n) / a\n }\n return _b_.int.$int_or_long(a - (a * a > n ? 1n : 0n))\n }\n}\n\nfunction lcm(){\n var $ = $B.args(\"lcm\", 0, {}, [], arguments, {}, 'args', null),\n product = 1\n\n var args = $.args.map($B.PyNumber_Index)\n if(args.length == 0){\n return 1\n }else if(args.length == 1){\n return _b_.abs(args[0])\n }\n var a = _b_.abs(args[0]),\n b,\n product, gcd\n for(var i = 0, len = args.length; i < len; i++){\n b = _b_.abs(args[i])\n if(b == 0){\n return 0\n }\n gcd = gcd2(a, b)\n product = $B.rich_op('__mul__', a, b)\n a = $B.$getattr(product, \"__floordiv__\")(gcd)\n }\n return a\n}\n\nfunction ldexp(x, i){\n $B.check_nb_args('ldexp', 2, arguments)\n $B.check_no_kw('ldexp', x, i)\n return _b_.float.$funcs.ldexp(x, i) // in py_float.js\n}\n\nfunction lgamma(x){\n $B.check_nb_args('lgamma', 1, arguments)\n $B.check_no_kw('lgamma', x)\n\n return m_lgamma(x)\n}\n\nfunction longint_mant_exp(long_int){\n // Returns mantissa and exponent of a long integer\n var value = long_int.value,\n exp = value.toString(2).length,\n exp1 = exp,\n nb = 0n\n // 2 ** exp is infinite if n > 1023\n var nb = Math.floor(exp / 1023),\n exp1 = BigInt(exp - 1023 * nb)\n nb = BigInt(nb)\n var reduced_value = long_int.value / 2n ** (nb * 1023n)\n var mant = Number(reduced_value) / Number(2n ** exp1)\n return [mant, exp]\n}\n\nvar log10_func = Math.log10 || (x => Math.log(x) / Math.log(10)),\n log2_func = Math.log2 || (x => Math.log(x) / Math.log(2))\n\nfunction log(x, base){\n var $ = $B.args(\"log\", 2, {x: null, base: null}, ['x', 'base'],\n arguments, {base: _b_.None}, null, null),\n x = $.x,\n base = $.base\n if(base == 10){\n return log10(x)\n }else if(base == 2){\n return log2(x)\n }\n var log\n if($B.$isinstance(x, $B.long_int)){\n if(x.value <= 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n var mant_exp = longint_mant_exp(x)\n log = Math.log(mant_exp[0]) + Math.log(2) * mant_exp[1]\n }else if($B.$isinstance(x, _b_.int)){\n x = _b_.int.$int_value(x)\n if(x <= 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n log = Math.log(x)\n }else{\n var x1 = float_check(x)\n if(x1 <= 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n log = Math.log(x1)\n }\n if(x1 <= 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if(base === _b_.None){\n return $B.fast_float(log)\n }\n var denom = _mod.log(base).value\n if(denom == 0){\n throw _b_.ZeroDivisionError.$factory('float division by zero')\n }\n return $B.fast_float(log / denom)\n}\n\nfunction log1p(x){\n $B.check_nb_args('log1p', 1, arguments)\n $B.check_no_kw('log1p', x)\n if($B.$isinstance(x, $B.long_int)){\n if($B.long_int.bit_length(x) > 1024){\n throw _b_.OverflowError.$factory(\n \"int too large to convert to float\")\n }\n x = $B.long_int.$log2($B.fast_long_int(x.value + 1n))\n return $B.fast_float(Number(x.value) * Math.LN2)\n }\n x = float_check(x)\n if(x + 1 <= 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return $B.fast_float(Math.log1p(x))\n}\n\nfunction log2(x){\n $B.check_nb_args('log2', 1, arguments)\n $B.check_no_kw('log2', x)\n var log2_func = Math.log2 || (x => Math.log(x) / Math.LN2)\n if($B.$isinstance(x, $B.long_int)){\n if(x.value <= 0){\n throw _b_.ValueError.$factory('math domain error')\n }\n var mant_exp = longint_mant_exp(x)\n return $B.fast_float(log2_func(mant_exp[0]) + mant_exp[1])\n }\n if(_b_.float.$funcs.isninf(x)){\n throw _b_.ValueError.$factory('')\n }\n x = float_check(x)\n if(x == 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if(isNaN(x)){\n return _b_.float.$factory('nan')\n }\n if(x < 0.0){\n throw _b_.ValueError.$factory('math domain error')\n }\n return $B.fast_float(log2_func(x))\n}\n\nfunction log10(x){\n $B.check_nb_args('log10', 1, arguments)\n $B.check_no_kw('log10', x)\n if($B.$isinstance(x, $B.long_int)){\n return $B.fast_float($B.long_int.$log10(x).value)\n }\n x = float_check(x)\n if(x <= 0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n return $B.fast_float(Math.log10(x))\n}\n\nfunction modf(x){\n $B.check_nb_args('modf', 1, arguments)\n $B.check_no_kw('modf', x)\n\n if(_b_.float.$funcs.isninf(x)){\n return _b_.tuple.$factory([0.0, NINF])\n }\n if(_b_.float.$funcs.isinf(x)){\n return _b_.tuple.$factory([0.0, INF])\n }\n var x1 = float_check(x)\n\n if(isNaN(x1)){\n return _b_.tuple.$factory([_b_.float.$factory('nan'),\n _b_.float.$factory('nan')])\n }\n\n if(x1 > 0){\n var i = _b_.float.$factory(x1 - Math.floor(x1))\n return _b_.tuple.$factory([i, _b_.float.$factory(x1 - i.value)])\n }\n\n var x2 = Math.ceil(x1)\n var i = _b_.float.$factory(x1 - x2)\n return _b_.tuple.$factory([i, _b_.float.$factory(x2)])\n}\n\nvar nan = _b_.float.$factory('nan')\n\nfunction _nextafter(x, y){\n // always returns a Javascript number\n if($B.rich_comp('__lt__', y, x)){\n var nu = nextUp($B.rich_op('__mul__', -1, x))\n return -nu\n }else if($B.rich_comp('__gt__', y, x)){\n return nextUp(x)\n }else{\n var res = x !== x ? x : y\n res = typeof res == 'number' ? res : res.value\n return res\n }\n}\n\nfunction make_float(x){\n return typeof x == 'number' ? $B.fast_float(x) : x\n}\n\nfunction make_number(x){\n return typeof x == 'number' ? x : x.value\n}\n\nfunction doubleToByteArray(number) {\n // adapted from https://stackoverflow.com/questions/\n // 25942516/double-to-byte-array-conversion-in-javascript\n var buffer = new ArrayBuffer(8); // JS numbers are 8 bytes long, or 64 bits\n var longNum = new Float64Array(buffer); // so equivalent to Float64\n\n longNum[0] = number;\n\n return Array.from(new Uint8Array(buffer)).reverse(); // reverse to get little endian\n}\n\nfunction byteArrayToDouble(bytearray) {\n // adapted from https://stackoverflow.com/questions/\n // 42699162/javascript-convert-array-of-4-bytes-into-a-float-value-from-modbustcp-read\n // Create a buffer\n var buf = new ArrayBuffer(8);\n // Create a data view of it\n var view = new DataView(buf);\n\n // set bytes\n bytearray.forEach(function (b, i) {\n view.setUint8(i, b);\n });\n\n // Read the bits as a float\n var num = view.getFloat64(0);\n // Done\n return num\n}\n\nfunction addSteps(array, steps){\n // convert to BigInt, avoids issue when steps >= 2 ** 32\n if(steps.__class__ == $B.long_int){\n steps = steps.value\n }else{\n steps = BigInt(steps)\n }\n var positive = steps > 0n\n if(steps < 0n){\n steps = -steps\n }\n var x1 = steps >> 32n,\n x2 = steps - x1 * 2n ** 32n\n var buffer = new ArrayBuffer(8)\n var longStep = new BigInt64Array(buffer)\n longStep[0] = steps\n var stepArray = Array.from(new Uint8Array(buffer)).reverse()\n if(positive){\n var carry = 0\n for(var i = 7; i >= 0; i--){\n array[i] += stepArray[i] + carry\n if(array[i] > 255){\n carry = 1\n array[i] -= 256\n }else{\n carry = 0\n }\n }\n }else{\n var carry = 0\n for(var i = 7; i >= 0; i--){\n array[i] -= stepArray[i] - carry\n if(array[i] < 0){\n carry = -1\n array[i] += 256\n }else{\n carry = 0\n }\n }\n }\n}\n\nfunction nextafter(){\n var $ = $B.args(\"nextafter\", 3, {x: null, y: null, steps: null},\n ['x', 'y', 'steps'], arguments, {steps: _b_.None}, null, null),\n x = $.x,\n y = $.y,\n steps = $.steps\n if(! $B.$isinstance(x, [_b_.int, _b_.float])){\n throw _b_.TypeError.$factory('must be a real number, not ' +\n $B.class_name(x))\n }\n if(! $B.$isinstance(y, [_b_.int, _b_.float])){\n throw _b_.TypeError.$factory('must be a real number, not ' +\n $B.class_name(y))\n }\n if(isnan(x)){\n return make_float(x)\n }\n if(isnan(y)){\n return make_float(y)\n }\n if(steps === _b_.None){\n return $B.fast_float(_nextafter(x, y))\n }\n steps = $B.PyNumber_Index(steps);\n if(steps < 0) {\n throw _b_.ValueError.$factory(\n \"steps must be a non-negative integer\");\n }\n if(steps == 0){\n return make_float(x)\n }\n if(isnan(x)){\n return make_float(x)\n }\n if(isnan(y)){\n return make_float(y)\n }\n var x1 = make_number(x),\n y1 = make_number(y)\n\n if(y1 == x1){\n return make_float(y)\n }else if(y1 > x1){\n var x_uint64 = doubleToByteArray(x1)\n addSteps(x_uint64, steps)\n var res = byteArrayToDouble(x_uint64)\n return res >= y1 ? y : make_float(res)\n }else{\n var x_uint64 = doubleToByteArray(x1)\n addSteps(x_uint64, -steps)\n var res = byteArrayToDouble(x_uint64)\n return res <= y1 ? y : make_float(res)\n }\n}\n\nfunction perm(n, k){\n var $ = $B.args(\"perm\", 2, {n: null, k: null}, ['n', 'k'],\n arguments, {k: _b_.None}, null, null),\n n = $.n,\n k = $.k\n\n if(k === _b_.None){\n check_int(n)\n return _mod.factorial(n)\n }\n // raise TypeError if n or k is not an integer\n n = $B.PyNumber_Index(n)\n k = $B.PyNumber_Index(k)\n\n // transform to Javascript BigInt\n var n1 = _b_.int.$to_bigint(n),\n k1 = _b_.int.$to_bigint(k);\n\n if(k1 < 0){\n throw _b_.ValueError.$factory(\"k must be a non-negative integer\")\n }\n if(n1 < 0){\n throw _b_.ValueError.$factory(\"n must be a non-negative integer\")\n }\n if(k1 == 0){\n return 1\n }\n if(k1 == 1){\n return n\n }\n if(k1 == 2){\n return _b_.int.$int_or_long(n1 * (n1 - 1n))\n }\n if(k1 > n1){\n return 0\n }\n // Evaluates to n! / (n - k)!\n var fn = _mod.factorial(n),\n fn_k = _mod.factorial(n - k)\n return $B.rich_op('__floordiv__', fn, fn_k)\n}\n\nconst pi = $B.fast_float(Math.PI)\n\nfunction pow(){\n var $ = $B.args(\"pow\", 2, {base: null, exp: null}, ['base', 'exp'],\n arguments, {}, null, null),\n x = $.base,\n y = $.exp\n\n var x1 = float_check(x)\n var y1 = float_check(y)\n\n if(y1 == 0){\n return _b_.float.$factory(1)\n }\n if(x1 == 0 && y1 < 0){\n if(y1 === -Infinity){\n return INF\n }\n throw _b_.ValueError.$factory('math domain error')\n }\n if(isFinite(x1) && x1 < 0 && isFinite(y1) && ! Number.isInteger(y1)){\n throw _b_.ValueError.$factory('math domain error')\n }\n\n if(isNaN(y1)){\n if(x1 == 1){return _b_.float.$factory(1)}\n return NAN\n }\n if(x1 == 0){\n return ZERO\n }\n\n if(_b_.float.$funcs.isninf(y)){\n if(_b_.float.$funcs.isinf(x)){ // pow(INF, NINF) = 0.0\n return ZERO\n }else if(_b_.float.$funcs.isninf(x)){ // pow(NINF, NINF) = 0.0\n return ZERO\n }\n if(x1 == 1 || x1 == -1){return _b_.float.$factory(1)}\n if(x1 < 1 && x1 > -1){return INF}\n return ZERO\n }\n if(_b_.float.$funcs.isinf(y)){\n if(_b_.float.$funcs.isinf(x)){ // pow(INF, INF)\n return INF\n }\n if(_b_.float.$funcs.isninf(x)){\n return INF\n }\n if(x1 == 1 || x1 == -1){return _b_.float.$factory(1)}\n if(x1 < 1 && x1 > -1){return ZERO}\n return INF\n }\n\n if(isNaN(x1)){return _b_.float.$factory('nan')}\n if(_b_.float.$funcs.isninf(x)){\n if(y1 > 0 && isOdd(y1)){return NINF}\n if(y1 > 0){return INF} // this is even or a float\n if(y1 < 0){return ZERO}\n if(_b_.float.$float.isinf(y)){return INF}\n return _b_.float.$factory(1)\n }\n\n if(_b_.float.$funcs.isinf(x)){\n if(y1 > 0){return INF}\n if(y1 < 0){return ZERO}\n return _b_.float.$factory(1)\n }\n\n var r = Math.pow(x1, y1)\n if(isNaN(r)){\n return NAN\n }\n if(! isFinite(r)){\n overflow()\n }\n return _b_.float.$factory(r)\n}\n\nfunction prod(){\n var $ = $B.args(\"prod\", 1, {iterable:null, start:null},\n [\"iterable\", \"start\"], arguments, {start: 1}, \"*\",\n null),\n iterable = $.iterable,\n start = $.start\n var res = start,\n it = _b_.iter(iterable),\n x\n while(true){\n try{\n x = _b_.next(it)\n if(x == 0){\n return 0\n }\n res = $B.rich_op('__mul__', res, x)\n }catch(err){\n if(err.__class__ === _b_.StopIteration){\n return res\n }\n throw err\n }\n }\n}\n\nfunction radians(x){\n $B.check_nb_args('radians', 1, arguments)\n $B.check_no_kw('radians', x)\n\n return _b_.float.$factory(float_check(x) * Math.PI / 180)\n}\n\nfunction is_finite(x){\n return typeof x == \"number\" ||\n (x.__class__ === _b_.floar && isFinite(x.value)) ||\n $B.$isinstance(x, _b_.int) ||\n ($B.$isinstance(x, _b_.float) && isFinite(x.value))\n}\n\nfunction remainder(x, y){\n $B.check_nb_args_no_kw('remainder', 2, arguments)\n float_check(x) // might raise TypeError\n /* Deal with most common case first. */\n if(is_finite(x) && is_finite(y)){\n var absx,\n absy,\n c,\n m,\n r;\n\n if(float_check(y) == 0.0){\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n\n absx = fabs(x);\n absy = fabs(y);\n m = fmod(absx, absy);\n\n c = absy.value - m.value\n if(m.value < c){\n r = m.value\n }else if(m.value > c){\n r = -c\n }else{\n r = m.value -\n 2.0 * fmod($B.fast_float(0.5 * (absx.value - m.value)), absy).value;\n }\n return $B.fast_float(copysign(1.0, x).value * r);\n }\n\n /* Special values. */\n if(float_check(y) == 0){\n if(isnan(x)){\n return x\n }\n }\n if(isinf(x)){\n if(isnan(y)){\n return y\n }\n throw _b_.ValueError.$factory(\"math domain error\")\n }\n if(isnan(y)){\n return y;\n }\n return x;\n}\n\nfunction sin(x){\n $B.check_nb_args('sin ', 1, arguments)\n $B.check_no_kw('sin ', x)\n return _b_.float.$factory(Math.sin(float_check(x)))\n}\n\nfunction sinh(x) {\n $B.check_nb_args('sinh', 1, arguments)\n $B.check_no_kw('sinh', x)\n\n var y = float_check(x)\n if(Math.sinh !== undefined){\n return _b_.float.$factory(Math.sinh(y))\n }\n return _b_.float.$factory(\n (Math.pow(Math.E, y) - Math.pow(Math.E, -y)) / 2)\n}\n\nfunction sqrt(x){\n $B.check_nb_args('sqrt ', 1, arguments)\n $B.check_no_kw('sqrt ', x)\n\n if(_b_.float.$funcs.isninf(x)){\n value_error()\n }else if(_b_.float.$funcs.isinf(x)){\n return INF\n }\n var y = float_check(x)\n if(y < 0){\n value_error()\n }\n var _r = $B.fast_float(Math.sqrt(y))\n if(_b_.float.$funcs.isinf(_r)){\n overflow()\n }\n return _r\n}\n\n/*[clinic input]\nmath.sumprod\n\n p: object\n q: object\n /\n\nReturn the sum of products of values from two iterables p and q.\n\nRoughly equivalent to:\n\n sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))\n\nFor float and mixed int/float inputs, the intermediate products\nand sums are computed with extended precision.\n[clinic start generated code]*/\n\nconst tl_zero = {hi: 0, lo: 0, tiny: 0}\n\nfunction _check_long_mult_overflow(a, b) {\n\n /* From Python2's int_mul code:\n\n Integer overflow checking for * is painful: Python tried a couple ways, but\n they didn't work on all platforms, or failed in endcases (a product of\n -sys.maxint-1 has been a particular pain).\n\n Here's another way:\n\n The native long product x*y is either exactly right or *way* off, being\n just the last n bits of the true product, where n is the number of bits\n in a long (the delivered product is the true product plus i*2**n for\n some integer i).\n\n The native double product (double)x * (double)y is subject to three\n rounding errors: on a sizeof(long)==8 box, each cast to double can lose\n info, and even on a sizeof(long)==4 box, the multiplication can lose info.\n But, unlike the native long product, it's not in *range* trouble: even\n if sizeof(long)==32 (256-bit longs), the product easily fits in the\n dynamic range of a double. So the leading 50 (or so) bits of the double\n product are correct.\n\n We check these two ways against each other, and declare victory if they're\n approximately the same. Else, because the native long product is the only\n one that can lose catastrophic amounts of information, it's the native long\n product that must have overflowed.\n\n */\n\n /*\n\n var longprod = (long)((unsigned long)a * b);\n double doubleprod = (double)a * (double)b;\n double doubled_longprod = (double)longprod;\n\n if (doubled_longprod == doubleprod) {\n return 0;\n }\n\n const double diff = doubled_longprod - doubleprod;\n const double absdiff = diff >= 0.0 ? diff : -diff;\n const double absprod = doubleprod >= 0.0 ? doubleprod : -doubleprod;\n\n if (32.0 * absdiff <= absprod) {\n return 0;\n }\n\n return 1;\n */\n return 0\n}\n\nfunction long_add_would_overflow(a, b){\n return (a > 0n) ? (b > BigInt(LONG_MAX) - a) : (b < BigInt(LONG_MIN) - a);\n}\n\nfunction PyLong_CheckExact(n){\n return typeof n == 'number' || n.__class__ === $B.long_int\n}\n\n/*\n The default implementation of dl_mul() depends on the C math library\n having an accurate fma() function as required by \u00a7 7.12.13.1 of the\n C99 standard.\n\n The UNRELIABLE_FMA option is provided as a slower but accurate\n alternative for builds where the fma() function is found wanting.\n The speed penalty may be modest (17% slower on an Apple M1 Max),\n so don't hesitate to enable this build option.\n\n The algorithms are from the T. J. Dekker paper:\n A Floating-Point Technique for Extending the Available Precision\n https://csclub.uwaterloo.ca/~pbarfuss/dekker1971.pdf\n*/\n\nfunction dl_split(x) {\n // Dekker (5.5) and (5.6).\n var t = x * 134217729.0; // Veltkamp constant = 2.0 ** 27 + 1\n var hi = t - (t - x);\n var lo = x - hi;\n return {hi, lo};\n}\n\nfunction dl_mul(x, y){\n // Dekker (5.12) and mul12()\n var xx = dl_split(x);\n var yy = dl_split(y);\n var p = xx.hi * yy.hi;\n var q = xx.hi * yy.lo + xx.lo * yy.hi;\n var z = p + q;\n var zz = p - z + q + xx.lo * yy.lo;\n return {hi: z, lo: zz};\n}\n\nfunction dl_sum(a, b){\n /* Algorithm 3.1 Error-free transformation of the sum */\n var x = a + b;\n var z = x - a;\n var y = (a - (x - z)) + (b - z);\n return {hi: x, lo: y};\n}\n\nfunction tl_fma(x, y, total){\n /* Algorithm 5.10 with SumKVert for K=3 */\n var pr = dl_mul(x, y);\n var sm = dl_sum(total.hi, pr.hi);\n var r1 = dl_sum(total.lo, pr.lo);\n var r2 = dl_sum(r1.hi, sm.lo);\n return {hi: sm.hi, lo: r2.hi, tiny: total.tiny + r1.lo + r2.lo}\n}\n\nfunction tl_to_d(total){\n var last = dl_sum(total.lo, total.hi);\n return total.tiny + last.lo + last.hi;\n}\n\nfunction sumprod(p, q){\n var $ = $B.args('sumprod', 2, {p: null, q: null}, ['p', 'q'],\n arguments, {}, null, null)\n var p_i = NULL,\n q_i = NULL,\n term_i = NULL,\n new_total = NULL;\n var p_it, q_it, total;\n var p_next, q_next;\n var p_stopped = false, q_stopped = false;\n var int_path_enabled = true,\n int_total_in_use = false;\n var flt_path_enabled = true,\n flt_total_in_use = false;\n var int_total = 0n;\n var flt_total = tl_zero;\n\n p_it = $B.make_js_iterator(p);\n q_it = $B.make_js_iterator(q);\n total = 0\n p_next = p_it.next\n q_next = q_it.next\n while (1) {\n var finished;\n p_i = p_it.next()\n if (p_i.done) {\n /*\n if (PyErr_Occurred()) {\n if (!PyErr_ExceptionMatches(PyExc_StopIteration)) {\n goto err_exit;\n }\n PyErr_Clear();\n }\n */\n p_stopped = true;\n }else{\n p_i = p_i.value\n }\n q_i = q_it.next()\n if (q_i.done) {\n /*\n if (PyErr_Occurred()) {\n if (!PyErr_ExceptionMatches(PyExc_StopIteration)) {\n goto err_exit;\n }\n PyErr_Clear();\n }\n */\n q_stopped = true;\n }else{\n q_i = q_i.value\n }\n if (p_stopped != q_stopped) {\n throw _b_.ValueError.$factory(\"Inputs are not the same length\");\n }\n\n finished = p_stopped & q_stopped;\n\n if (int_path_enabled) {\n\n if (! finished && PyLong_CheckExact(p_i) & PyLong_CheckExact(q_i)) {\n var overflow;\n var int_p, int_q, int_prod;\n\n int_p = _b_.int.$to_bigint($B.PyNumber_Index(p_i))\n overflow = int_p > LONG_MAX || int_p < LONG_MIN\n\n if (overflow) {\n finalize_int_path()\n }\n int_q = _b_.int.$to_bigint($B.PyNumber_Index(q_i));\n overflow = int_q > LONG_MAX || int_q < LONG_MIN\n if (overflow) {\n finalize_int_path()\n }\n if (_check_long_mult_overflow(int_p, int_q)) {\n finalize_int_path()\n }\n int_prod = int_p * int_q;\n if (long_add_would_overflow(int_total, int_prod)) {\n finalize_int_path()\n }\n if(int_path_enabled){\n int_total = int_total + int_prod;\n int_total_in_use = true;\n continue;\n }\n }\n\n if(finished){\n finalize_int_path()\n }\n\n function finalize_int_path(){\n // We're finished, overflowed, or have a non-int\n int_path_enabled = false;\n if (int_total_in_use) {\n term_i = _b_.int.$int_or_long(int_total);\n new_total = $B.rich_op('__add__', total, term_i);\n total = new_total\n new_total = NULL;\n int_total = 0; // An ounce of prevention, ...\n int_total_in_use = false;\n }\n }\n }\n\n if (flt_path_enabled) {\n\n if (!finished) {\n var flt_p, flt_q;\n var p_type_float = p_i.__class__ === _b_.float;\n var q_type_float = q_i.__class__ === _b_.float\n if(p_type_float && q_type_float) {\n flt_p = p_i;\n flt_q = q_i;\n }else if (p_type_float && (PyLong_CheckExact(q_i) ||\n typeof q_i == 'boolean')){\n /* We care about float/int pairs and int/float pairs because\n they arise naturally in several use cases such as price\n times quantity, measurements with integer weights, or\n data selected by a vector of bools. */\n flt_p = p_i\n flt_q = _b_.int.$int_value(q_i)\n }else if(q_type_float && (PyLong_CheckExact(p_i) ||\n typeof p_i == 'boolean')) {\n flt_q = q_i\n flt_p = _b_.int.$int_value(p_i)\n }else{\n finalize_flt_path()\n }\n if(flt_path_enabled){\n var new_flt_total = tl_fma(flt_p.value, flt_q.value, flt_total);\n if (isfinite(new_flt_total.hi)) {\n flt_total = new_flt_total;\n flt_total_in_use = true;\n continue;\n }\n }\n }\n if(finished){\n finalize_flt_path()\n }\n\n function finalize_flt_path(){\n // We're finished, overflowed, have a non-float, or got a non-finite value\n flt_path_enabled = false;\n if(flt_total_in_use){\n term_i = $B.fast_float(tl_to_d(flt_total));\n if (term_i == NULL) {\n err_exit()\n }\n new_total = $B.rich_op('__add__', total, term_i);\n total = new_total\n new_total = NULL\n flt_total = tl_zero;\n flt_total_in_use = false;\n }\n }\n }\n\n if (finished) {\n return total\n }\n term_i = $B.rich_op('__mul__', p_i, q_i);\n new_total = $B.rich_op('__add__', total, term_i);\n total = new_total\n new_total = NULL;\n }\n\n}\n\n\n\nfunction tan(x) {\n $B.check_nb_args('tan', 1, arguments)\n $B.check_no_kw('tan', x)\n\n var y = float_check(x)\n return _b_.float.$factory(Math.tan(y))\n}\n\nfunction tanh(x) {\n $B.check_nb_args('tanh', 1, arguments)\n $B.check_no_kw('tanh', x)\n\n var y = float_check(x)\n if(Math.tanh !== undefined){return _b_.float.$factory(Math.tanh(y))}\n return _b_.float.$factory((Math.pow(Math.E, y) - Math.pow(Math.E, -y))/\n (Math.pow(Math.E, y) + Math.pow(Math.E, -y)))\n}\n\nconst tau = $B.fast_float(2 * Math.PI)\n\nfunction trunc(x) {\n $B.check_nb_args('trunc', 1, arguments)\n $B.check_no_kw('trunc', x)\n\n try{return $B.$getattr(x, '__trunc__')()}catch(err){}\n var x1 = float_check(x)\n if(!isNaN(parseFloat(x1)) && isFinite(x1)){\n if(Math.trunc !== undefined){return _b_.int.$factory(Math.trunc(x1))}\n if(x1 > 0){return _b_.int.$factory(Math.floor(x1))}\n return _b_.int.$factory(Math.ceil(x1)) // x1 < 0\n }\n throw _b_.ValueError.$factory(\n 'object is not a number and does not contain __trunc__')\n}\n\nfunction ulp(){\n var $ = $B.args(\"ulp\", 1, {x: null}, ['x'], arguments, {}, null, null),\n x = $.x\n if($B.$isinstance(x, _b_.float)){\n if(_b_.float.$funcs.isinf(x)){\n return _mod.inf\n }else if(_b_.float.$funcs.isnan(x)){\n return _mod.nan\n }\n }\n if(typeof x == \"number\"){\n return x >= 0 ? $B.fast_float(nextUp(x) - x) :\n $B.fast_float(x - (-nextUp(-x)))\n }else if($B.$isinstance(x, $B.long_int)){\n x = Number(_b_.int.$to_bigint(x))\n return x > 0 ? $B.fast_float(nextUp(x) - x) :\n $B.fast_float(x - (-nextUp(-x)))\n }else{\n if($B.rich_comp('__ge__', x, 0)){\n return $B.rich_op('__sub__', $B.fast_float(nextUp(x.value)), x)\n }else{\n var neg_x = $B.$call($B.$getattr(x, \"__neg__\"))()\n return $B.rich_op('__sub__', x,\n $B.$call($B.$getattr($B.fast_float(nextUp(neg_x.value)), '__neg__'))())\n }\n }\n}\n\nvar _mod = {\n acos,\n acosh,\n asin,\n asinh,\n atan,\n atan2,\n atanh,\n cbrt,\n ceil,\n comb,\n copysign,\n cos,\n cosh,\n degrees,\n dist,\n e,\n erf,\n erfc,\n exp,\n exp2,\n expm1,\n fabs,\n factorial,\n floor,\n fmod,\n frexp,\n fsum,\n gamma,\n gcd,\n hypot,\n inf,\n isclose,\n isfinite,\n isinf,\n isnan,\n isqrt,\n lcm,\n ldexp,\n lgamma,\n log,\n log1p,\n log2,\n log10,\n modf,\n nan,\n nextafter,\n perm,\n pi,\n pow,\n prod,\n radians,\n remainder,\n sin,\n sinh,\n sqrt,\n sumprod,\n tan,\n tanh,\n tau,\n trunc,\n ulp\n}\n\nfor(var $attr in _mod){\n if(typeof _mod[$attr] === 'function'){\n _mod[$attr].__class__ = $B.builtin_function_or_method\n }\n}\n\nreturn _mod\n\n})(__BRYTHON__)\n"], "modulefinder": [".js", "var $module=(function($B){\n\nvar _b_=$B.builtins\nvar _mod = {}\n\n$ModuleFinderDict = {__class__:_b_.type,__name__:'ModuleFinder'}\n$ModuleFinderDict.__mro__ = [_b_.object]\n\n$ModuleFinderDict.run_script = function(self, pathname){\n // pathname is the url of a Python script\n var py_src = _b_.$open(pathname).read()\n // transform into internal Brython tree structure\n var root = $B.py2js(py_src)\n // walk the tree to find occurences of imports\n function walk(node){\n var modules = []\n var ctx = node.context\n if(ctx && ctx.type=='node'){ctx = ctx.tree[0]}\n\n if(ctx && ctx.type==\"import\"){\n for(var i=0, _len_i = ctx.tree.length; i < _len_i;i++){\n if(modules.indexOf(ctx.tree[i].name)==-1){\n modules.push(ctx.tree[i].name)\n }\n }\n }else if(ctx && ctx.type==\"from\"){\n if(modules.indexOf(ctx.module)==-1){\n modules.push(ctx.module)\n }\n }\n \n for(var i=0, _len_i = node.children.length; i < _len_i;i++){\n mods = walk(node.children[i])\n for(var j=0, _len_j = mods.length; j < _len_j;j++){\n if(modules.indexOf(mods[j])==-1){modules.push(mods[j])}\n }\n }\n return modules\n }\n self.modules = walk(root)\n}\n\n_mod.ModuleFinder = function(){return {__class__:$ModuleFinderDict}\n}\n_mod.ModuleFinder.$dict = $ModuleFinderDict\n_mod.ModuleFinder.__class__ = $B.$factory\n$ModuleFinderDict.$factory = _mod.ModuleFinder\n\nreturn _mod\n})(__BRYTHON__)\n"], "posix": [".js", "/*\nThis module provides access to operating system functionality that is\nstandardized by the C Standard and the POSIX standard (a thinly\ndisguised Unix interface). Refer to the library manual and\ncorresponding Unix manual entries for more information on calls.\n*/\n\nvar $B = __BRYTHON__,\n _b_ = $B.builtins\n\nfunction _randint(a, b){\n return parseInt(Math.random() * (b - a + 1) + a)\n}\n\nvar stat_result = $B.make_class(\"stat_result\",\n function(filename){\n filename = _b_.str.$factory(filename)\n if($B.file_cache && $B.file_cache.hasOwnProperty(filename)){\n var f = $B.file_cache[filename],\n res = {\n __class__: stat_result,\n st_atime: __BRYTHON__.timestamp,\n st_ctime: f.ctime,\n st_mtime: f.mtime,\n st_uid: -1,\n st_gid: -1,\n st_ino: -1,\n st_mode: 0,\n st_size: f.length\n };\n [\"mtime\", \"ctime\", \"atime_ns\", \"mtime_ns\", \"ctime_ns\"].\n forEach(function(item){\n res[\"st_\" + item] = res.st_atime\n });\n return res\n }else{\n try{\n var xhr = new XMLHttpRequest()\n }catch(err){\n console.log('err', filename, err.message)\n console.log('stack', $B.make_frames_stack())\n throw err\n }\n xhr.open('HEAD', filename, false)\n var infos = {}\n xhr.onreadystatechange = function(){\n if(this.readyState == 4){\n var res = {\n __class__: stat_result,\n st_atime: __BRYTHON__.timestamp,\n st_uid: -1,\n st_gid: -1,\n st_ino: -1,\n st_mode: filename.endsWith('/') ? 16895 : 33206,\n st_size: this.getResponseHeader('content-length')\n };\n [\"mtime\", \"ctime\", \"atime_ns\", \"mtime_ns\", \"ctime_ns\"].\n forEach(function(item){\n res[\"st_\" + item] = res.st_atime\n });\n infos.value = res\n $B.file_cache[filename] = this.responseText\n }\n }\n xhr.send()\n return infos.value\n }\n }\n)\n$B.set_func_names(stat_result, \"posix\")\n\nvar $module = {\n F_OK: 0,\n O_APPEND: 8,\n O_BINARY: 32768,\n O_CREAT: 256,\n O_EXCL: 1024,\n O_NOINHERIT: 128,\n O_RANDOM: 16,\n O_RDONLY: 0,\n O_RDWR: 2,\n O_SEQUENTIAL: 32,\n O_SHORT_LIVED: 4096,\n O_TEMPORARY: 64,\n O_TEXT: 16384,\n O_TRUNC: 512,\n O_WRONLY: 1,\n P_DETACH: 4,\n P_NOWAIT: 1,\n P_NOWAITO: 3,\n P_OVERLAY: 2,\n P_WAIT: 0,\n R_OK: 4,\n TMP_MAX: 32767,\n W_OK: 2,\n X_OK: 1,\n _have_functions: ['MS_WINDOWS'],\n environ: _b_.dict.$factory(\n [['PYTHONPATH', $B.brython_path],\n ['PYTHONUSERBASE', ' ']]),\n error: _b_.OSError,\n fspath: function(path){\n return path\n },\n getcwd: function(){return $B.brython_path},\n getpid: function(){return 0},\n lstat: function(filename){\n return stat_result.$factory(filename)\n },\n open: function(path, flags){return _b_.open(path, flags)},\n stat: function(filename){return stat_result.$factory(filename)},\n stat_result: function(filename){return stat_result.$factory(filename)},\n urandom: function(n){\n const randbytes = new Uint8Array(n);\n crypto.getRandomValues(randbytes);\n return _b_.bytes.$factory(Array.from(randbytes));\n },\n WTERMSIG: function(){return 0},\n WNOHANG: function(){return _b_.tuple.$factory([0, 0])}\n};\n\n[\"WCOREDUMP\", \"WIFCONTINUED\", \"WIFSTOPPED\", \"WIFSIGNALED\", \"WIFEXITED\"].forEach(function(funcname){\n $module[funcname] = function(){return false}\n });\n\n[\"WEXITSTATUS\", \"WSTOPSIG\", \"WTERMSIG\"].\n forEach(function(funcname){\n $module[funcname] = function(){return _b_.None}\n });\n\n[\"_exit\", \"_getdiskusage\", \"_getfileinformation\", \"_getfinalpathname\",\n \"_getfullpathname\", \"_isdir\", \"abort\", \"access\", \"chdir\", \"chmod\",\n \"close\", \"closerange\", \"device_encoding\", \"dup\", \"dup2\",\n \"execv\", \"execve\", \"fsat\", \"fsync\", \"get_terminal_size\", \"getcwdb\",\n \"getlogin\", \"getppid\", \"isatty\", \"kill\", \"link\", \"listdir\", \"lseek\",\n \"mkdir\", \"pipe\", \"putenv\", \"read\", \"readlink\", \"remove\", \"rename\",\n \"replace\", \"rmdir\", \"spawnv\", \"spawnve\", \"startfile\", \"stat_float_times\",\n \"statvfs_result\", \"strerror\", \"symlink\", \"system\", \"terminal_size\",\n \"times\", \"times_result\", \"umask\", \"uname_result\", \"unlink\", \"utime\",\n \"waitpid\", \"write\"].forEach(function(funcname){\n $module[funcname] = function(){\n throw _b_.NotImplementedError.$factory(\"posix.\" + funcname +\n \" is not implemented\")\n }\n });\n"], "python_re": [".js", "// Regular expression\n\n\nvar _debug = {value: 0}\n\nvar $B = __BRYTHON__,\n _b_ = $B.builtins\n\nvar MAXGROUPS = 2147483647,\n MAXREPEAT = 2147483648\n\nvar word_gcs = ['Ll', 'Lu', 'Lm', 'Lt', 'Lo',\n 'Nd',\n 'Mc', 'Me', 'Mn',\n 'Pc']\n\nfunction is_word(cp){\n if((cp >= 97 && cp <= 122) // a-z\n || (cp >= 65 && cp <= 90) // A-Z\n ){\n return true\n }\n for(var word_gc of word_gcs){\n if(! $B.in_unicode_category(word_gc, cp)){\n return false\n }\n }\n return true\n}\n\nvar ascii_word = {}\n\nfor(var cp = 0; cp <= 127; cp++){\n if(is_word(cp)){\n ascii_word[cp] = true\n }\n}\n\nfunction is_ascii_word(cp){\n return ascii_word[cp] !== undefined\n}\n\nfunction is_digit(cp){\n if(cp >= 48 && cp <= 57){\n return true\n }\n return $B.in_unicode_category('Nd', cp)\n}\n\nfunction is_ascii_digit(cp){\n return cp <= 127 && is_digit(cp)\n}\n\nvar $error_2 = {\n $name: \"error\",\n $qualname: \"error\",\n $is_class: true,\n __module__: \"re\"\n}\n\nvar error = $B.make_class(\"error\",\n function(message){\n return {\n __class__: error,\n msg: message,\n args: $B.fast_tuple([]),\n __cause__: _b_.None,\n __context__: _b_.None,\n __suppress_context__: false\n }\n })\nerror.__bases__ = [_b_.Exception, _b_.object]\nerror.__mro__ = [_b_.Exception, _b_.BaseException, _b_.object]\n\nerror.__str__ = function(self){\n var s = self.msg + ' at position ' + self.pos\n if(self.lineno > 1){\n s += ` (line ${self.lineno}, column ${self.colno})`\n }\n return s\n}\n\n$B.set_func_names(error, \"re\")\n\nfunction $last(t){\n return t[t.length - 1]\n}\n\nfunction fail(message, pos, pattern){\n var err = error.$factory(message)\n err.msg = message\n err.pos = pos\n if(pattern){\n err.pattern = pattern.py_obj // Python object passed to compile()\n err.lineno = 1\n var linestart = 0\n for(var i = 0, len = pattern.string.length; i < pos; i++){\n if(pattern.string[i] == '\\n'){\n err.lineno++\n linestart = i + 1\n }\n }\n err.colno = pos - linestart + 1\n }\n throw err\n}\n\nfunction warn(klass, message, pos, text){\n var frame = $B.frame_obj.frame,\n file = frame[3].__file__,\n src = $B.file_cache[file]\n if(text === undefined){\n var lineno = frame[1].$lineno\n var lines = src.split('\\n'),\n line = lines[lineno - 1]\n }else{\n if(Array.isArray(text)){\n text = from_codepoint_list(text)\n }\n var lineno = 1,\n line_start = 0\n for(var i = 0; i < pos; i++){\n if(text[i] == '\\n'){\n lineno++\n line_start = i + 1\n }\n }\n var line_end = text.substr(line_start).search('\\n'),\n line\n if(line_end == -1){\n line = text.substr(line_start)\n }else{\n line = text.substr(line_start, line_end)\n }\n var col_offset = pos - line_start\n }\n var warning = klass.$factory(message)\n warning.pos = pos\n warning.args[1] = [file, lineno, col_offset, lineno, col_offset,\n line]\n warning.filename = file\n warning.lineno = warning.end_lineno = lineno\n warning.offset = warning.end_offset = col_offset\n warning.line = line\n // module _warning is in builtin_modules.js\n $B.imported._warnings.warn(warning)\n}\n\nfunction chr(i){\n if(i < 0 || i > 1114111){\n throw _b_.ValueError.$factory('Outside valid range')\n }else if(i >= 0x10000 && i <= 0x10FFFF){\n var code = (i - 0x10000)\n return String.fromCodePoint(0xD800 | (code >> 10)) +\n String.fromCodePoint(0xDC00 | (code & 0x3FF))\n }else{\n return String.fromCodePoint(i)\n }\n}\n\nfunction ord(char){\n return char.charCodeAt(0)\n}\n\nconst LETTERS = {\n b: ord('b'),\n N: ord('N'),\n P: ord('P'),\n u: ord('u'),\n U: ord('U'),\n x: ord('x')\n}\n\nconst PARENTH_OPEN = ord('('),\n PARENTH_CLOSE = ord(')'),\n BRACKET_OPEN = ord('['),\n BRACKET_CLOSE = ord(']'),\n BRACE_OPEN = ord('{'),\n BRACE_CLOSE = ord('}'),\n EQUAL = ord('='),\n SUP = ord('>'),\n INF = ord('<'),\n MINUS = ord('-'),\n PLUS = ord('+'),\n OR = ord('|'),\n DOT = ord('.'),\n QUESTION_MARK = ord('?'),\n EXCLAMATION_MARK = ord('!'),\n COLON = ord(':'),\n BACKSLASH = ord('\\\\'),\n DOLLAR = ord('$'),\n CARET = ord('^'),\n LINEFEED = ord('\\n')\n\n// pattern tokenizer\n\nfunction is_ascii(name){\n return /^[\\x00-\\x7F]*$/.test(name)\n}\n\nfunction open_unicode_db(){\n if($B.unicodedb === undefined){\n var xhr = new XMLHttpRequest\n xhr.open(\"GET\",\n $B.brython_path + \"unicode.txt?\" + (new Date()).getTime(), false)\n xhr.onreadystatechange = function(){\n if(this.readyState == 4){\n if(this.status == 200){\n $B.unicodedb = this.responseText\n }else{\n console.log(\n \"Warning - could not load unicode.txt\")\n }\n }\n }\n xhr.send()\n }\n}\n\nfunction validate_named_char(description, pos){\n // validate that \\N{} is in the Unicode db\n // Load unicode table if not already loaded\n if(description.length == 0){\n fail(\"missing character name\", pos)\n }\n open_unicode_db()\n if($B.unicodedb !== undefined){\n var re = new RegExp(\"^([0-9A-F]+);\" +\n description.toUpperCase() + \";.*$\", \"m\")\n search = re.exec($B.unicodedb)\n if(search === null){\n fail(`undefined character name '${description}'`, pos)\n }\n return parseInt(search[1], 16)\n }else{\n fail(\"could not load unicode.txt\", pos)\n }\n}\n\nfunction validate_group_name(sname, pos, is_bytes){\n // sname is an instance of StringObj\n if(! _b_.str.isidentifier(sname.string)){\n fail(`bad character in group name '${sname.string}'`, pos + 4)\n }\n if(is_bytes && ! is_ascii(sname.string)){\n var s = _b_.bytes.decode(_b_.bytes.$factory(sname.codepoints),\n 'ascii', 'backslashreplace')\n warn(_b_.DeprecationWarning,\n `bad character in group name '${s}' at position ${pos + 4}`)\n }\n return true\n}\n\nfunction validate_group_num(so, pos){\n var s = so.string\n if(s.match(/^\\d+$/)){\n return true\n }\n try{\n var num = _b_.int.$factory(s)\n warn(_b_.DeprecationWarning,\n `bad character in group name '${s}' at position ${pos + 3}`,\n pos + 3, s)\n so.string = num + ''\n return true\n }catch(err){\n return false\n }\n}\n\nfunction validate_num_or_name(so, pos, is_bytes){\n return validate_group_num(so, pos, is_bytes) ||\n validate_group_name(so, pos - 1, is_bytes)\n}\n\nvar character_classes = {\n in_charset: to_codepoint_list('dDsSwW'),\n in_re: to_codepoint_list('AbBdDsSwWZ')\n}\n\nfunction escaped_char(args){\n var cps = args.codepoints,\n pos = args.pos,\n in_charset = args.in_charset,\n is_bytes = args.is_bytes // if pattern is bytes\n var special = cps[pos + 1]\n if(special === undefined){\n fail('bad escape (end of pattern)', pos)\n }\n var key = in_charset ? 'in_charset' : 'in_re'\n if(in_charset && special == LETTERS.b){\n // Inside a character range, \\b represents the backspace character,\n // for compatibility with Python\u2019s string literals.\n return '\\b'\n }\n if(character_classes[key].indexOf(special) > -1){\n return new CharacterClass(pos, special, 2)\n }else if(special == LETTERS.N && ! is_bytes){\n if(cps[pos + 2] != BRACE_OPEN){\n fail('missing {', pos)\n }\n var i = pos + 3,\n description = []\n while(i < cps.length){\n if(cps[i] == BRACE_CLOSE){\n break\n }\n description.push(cps[i])\n i++\n }\n if(description.length == 0){\n fail(\"missing character name\", pos)\n }\n if(i == cps.length){\n fail(\"missing }, unterminated name\", pos)\n }\n var cp = validate_named_char(from_codepoint_list(description), pos)\n return {\n type: 'N',\n ord: cp,\n char: chr(cp),\n length: i - pos + 1\n }\n }else if(special == LETTERS.x){\n // \\xhh = character with hex value hh\n var rest = from_codepoint_list(cps.slice(pos + 2)),\n mo = /^[0-9a-fA-F]{0,2}/.exec(rest),\n hh = mo ? mo[0] : ''\n if(mo && mo[0].length == 2){\n var cp = parseInt(mo[0], 16)\n return {\n type: 'x',\n ord: cp,\n char: chr(cp),\n length: 2 + mo[0].length\n }\n }\n fail('incomplete escape \\\\x' + hh, pos)\n }else if(special == LETTERS.u){\n // \\uxxxx = character with 16-bit hex value xxxx\n var rest = from_codepoint_list(cps.slice(pos + 2)),\n mo = /^[0-9a-fA-F]{0,4}/.exec(rest),\n xx = mo ? mo[0] : ''\n if(mo && mo[0].length == 4){\n var cp = parseInt(mo[0], 16)\n return {\n type: 'u',\n ord: cp,\n char: chr(cp),\n length: 2 + mo[0].length\n }\n }\n fail('incomplete escape \\\\u' + xx, pos)\n }else if(special == LETTERS.U){\n // \\Uxxxxxxxx = character with 32-bit hex value xxxxxxxx\n var rest = from_codepoint_list(cps.slice(pos + 2)),\n mo = /^[0-9a-fA-F]{0,8}/.exec(rest),\n xx = mo ? mo[0] : ''\n if(mo && mo[0].length == 8){\n var cp = parseInt(mo[0], 16)\n if(cp > 0x10FFFF){\n fail(`bad escape \\\\U${mo[0]}`, pos)\n }\n return {\n type: 'U',\n ord: cp,\n char: chr(cp),\n length: 2 + mo[0].length\n }\n }\n fail('incomplete escape \\\\U' + xx, pos)\n }else{\n // octal ?\n // If the first digit of number is 0, or number is 3 octal digits\n // long, it will not be interpreted as a group match, but as the\n // character with octal value number\n var rest = from_codepoint_list(cps.slice(pos + 1)),\n mo = /^[0-7]{3}/.exec(rest)\n if(in_charset){\n try{\n var res = $B.test_escape(rest, -1)\n if(res){\n return {\n type: 'u',\n ord: res[0].codePointAt(0),\n char: res[0],\n length: res[1]\n }\n }\n }catch(err){\n // ignore\n }\n }\n if(mo == null){\n mo = /^0[0-7]*/.exec(rest)\n }\n if(mo){\n var octal_value = parseInt(mo[0], 8)\n if(octal_value > 0o377){\n fail(`octal escape value \\\\` +\n `${mo[0]} outside of range 0-0o377`, pos)\n }\n return {\n type: 'o',\n ord: octal_value,\n char: chr(octal_value),\n length: 1 + mo[0].length\n }\n }\n var mo = /^\\d{1,2}/.exec(rest) // backref is at most 99\n if(mo){\n return {\n type: 'backref',\n value: parseInt(mo[0]),\n length: 1 + mo[0].length\n }\n }\n var trans = {a: chr(7), f: '\\f', n: '\\n', r: '\\r', t: '\\t', v: '\\v'},\n res = trans[chr(special)]\n if(res){\n return ord(res)\n }\n if(chr(special).match(/[a-zA-Z]/)){\n fail(\"bad escape \\\\\" + chr(special), pos)\n }else{\n return special\n }\n }\n}\n\nfunction check_character_range(t, positions){\n // Check if last 2 items in t are a valid character range\n var start = t[t.length - 2],\n end = t[t.length - 1]\n if(start instanceof CharacterClass || end instanceof CharacterClass){\n fail(`bad character range ${start}-${end}`,\n positions[positions.length - 2])\n }else if(end < start){\n fail(`bad character range ${start}-${end}`,\n positions[positions.length - 2])\n }\n t.splice(t.length - 2, 2, {\n type: 'character_range',\n start: start,\n end: end,\n ord: [start.ord, end.ord]\n })\n}\n\nfunction parse_character_set(text, pos, is_bytes){\n // Parse character set starting at position \"pos\" in \"text\"\n // pos is the position of the leading \"[\"\n var start = pos,\n result = {items: []},\n positions = []\n pos++\n if(text[pos] == CARET){\n result.neg = true\n pos++\n }else if(text[pos] == BRACKET_CLOSE){\n // a leading ] is the character \"]\", not the set end\n result.items.push(']')\n positions.push(pos)\n pos++\n }else if(text[pos] == BRACKET_OPEN){\n // send FutureWarning\n warn(_b_.FutureWarning, \"Possible nested set\", pos, text)\n }\n var range = false\n while(pos < text.length){\n var cp = text[pos],\n char = chr(cp)\n if(char == ']'){\n if(pos == start + 2 && result.neg){\n // in \"[^]]\", the first ] is the character \"]\"\n result.items.push(']')\n }else{\n return [result, pos]\n }\n }\n if(char == '\\\\'){\n var escape = escaped_char({\n codepoints: text,\n pos,\n in_charset: true,\n is_bytes\n })\n if(typeof escape == \"number\"){\n var s = chr(escape)\n escape = {\n ord: escape,\n length: 2,\n toString: function(){\n return s\n }\n }\n }\n if(escape.type == \"num\"){\n // [\\9] is invalid\n fail(\"bad escape 1 \\\\\" +\n escape.value.toString()[0], pos)\n }\n result.items.push(escape)\n positions.push(pos)\n if(range){\n check_character_range(result.items, positions)\n }\n range = false\n pos += escape.length\n }else if(char == '-'){\n // Character range, or character \"-\"\n if(pos == start + 1 ||\n (result.neg && pos == start + 2) ||\n pos == text.length - 2 || // [a-]\n range ||\n (result.items.length > 0 &&\n result.items[result.items.length - 1].type ==\n \"character_range\")){\n result.items.push({\n ord: cp,\n char,\n toString: function(){\n return this.char\n }\n })\n if(text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set difference\", pos, text)\n }\n pos++\n if(range){\n check_character_range(result.items, positions)\n }\n range = false\n }else{\n range = true\n if(text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set difference\", pos, text)\n }\n pos++\n }\n }else{\n positions.push(pos)\n result.items.push({\n ord: cp,\n char,\n toString: function(){\n return this.char\n }\n })\n if(range){\n check_character_range(result.items, positions)\n }\n range = false\n // FutureWarning for consecutive \"&\", \"|\" or \"~\"\n if(char == \"&\" && text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set intersection\", pos, text)\n }else if(char == \"|\" && text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set union\", pos, text)\n }else if(char == \"~\" && text[pos + 1] == cp){\n warn(_b_.FutureWarning, \"Possible set symmetric difference\",\n pos, text)\n }\n pos++\n }\n }\n fail(\"unterminated character set\", start)\n}\n\nfunction* tokenize(pattern, type, _verbose){\n // pattern is a list of codepoints\n var is_bytes = type == \"bytes\"\n // verbose_stack is the stack of verbose state for each group in the regex\n var verbose_stack = [_verbose],\n verbose = _verbose,\n parenth_pos\n var pos = 0\n while(pos < pattern.length){\n var cp = pattern[pos],\n char = String.fromCharCode(cp)\n if(verbose){\n // current group is in verbose mode\n if(char == \"#\"){\n // skip until next line feed\n while(pos < pattern.length && pattern[pos] != 10){\n pos++\n }\n pos++\n continue\n }else{\n while(pos < pattern.length &&\n [9, 10, 11, 12, 13, 32].indexOf(pattern[pos]) > -1){\n pos++\n }\n }\n cp = pattern[pos]\n if(cp === undefined){\n break\n }\n char = String.fromCharCode(cp)\n if(char == '#'){\n continue\n }\n }\n if(char == '('){\n parenth_pos = pos\n if(pattern[pos + 1] == QUESTION_MARK){\n if(pattern[pos + 2] == LETTERS.P){\n if(pattern[pos + 3] == INF){\n var name = [],\n i = pos + 4\n while(i < pattern.length){\n if(pattern[i] == SUP){\n break\n }else if(pattern[i] == PARENTH_CLOSE){\n fail(\"missing >, unterminated name\", pos)\n }\n name.push(pattern[i])\n i++\n }\n var sname = StringObj.from_codepoints(name)\n validate_group_name(sname, pos, is_bytes)\n name = sname\n if(i == pattern.length){\n fail(\"missing >, unterminated name\", pos)\n }\n yield new Group(pos, {type: 'name_def', value: name})\n verbose_stack.push(verbose)\n pos = i + 1\n continue\n }else if(pattern[pos + 3] == EQUAL){\n var name = [],\n i = pos + 4\n while(i < pattern.length){\n if(pattern[i] == PARENTH_CLOSE){\n break\n }\n name.push(pattern[i])\n i++\n }\n name = StringObj.from_codepoints(name)\n validate_group_name(name, pos, is_bytes)\n if(i == pattern.length){\n fail(\"missing ), unterminated name\", pos)\n }\n yield new BackReference(pos, 'name', name.string)\n pos = i + 1\n continue\n }else if(pattern[pos + 3] === undefined){\n fail(\"unexpected end of pattern\", pos)\n }else{\n fail(\"unknown extension ?P\" + chr(pattern[pos + 3]), pos)\n }\n }else if(pattern[pos + 2] == PARENTH_OPEN){\n var ref = [],\n i = pos + 3\n while(i < pattern.length){\n if(pattern[i] == PARENTH_CLOSE){\n break\n }\n ref.push(pattern[i])\n i++\n }\n var sref = StringObj.from_codepoints(ref)\n if(sref.string.match(/^\\d+$/)){\n ref = parseInt(sref.string)\n }else{\n validate_num_or_name(sref, pos, is_bytes)\n ref = sref.string\n }\n if(i == pattern.length){\n fail(\"missing ), unterminated name\", pos)\n }\n yield new ConditionalBackref(pos, ref)\n pos = i + 1\n continue\n }else if(pattern[pos + 2] == EQUAL){\n // (?=...) : lookahead assertion\n yield new Group(pos, {type: 'lookahead_assertion'})\n verbose_stack.push(verbose)\n pos += 3\n continue\n }else if(pattern[pos + 2] == EXCLAMATION_MARK){\n // (?!...) : negative lookahead assertion\n yield new Group(pos, {type: 'negative_lookahead_assertion'})\n verbose_stack.push(verbose)\n pos += 3\n continue\n }else if(from_codepoint_list(pattern.slice(pos + 2, pos + 4)) == ' -1){\n if(pattern[pos + 2] == MINUS){\n var on_flags = [],\n has_off = true,\n off_flags = []\n pos += 3\n }else{\n var on_flags = [chr(pattern[pos + 2])],\n has_off = false,\n off_flags = [],\n auL = auL_flags.indexOf(pattern[pos + 2]) > -1 ?\n 1 : 0,\n closed = false\n pos += 3\n while(pos < pattern.length){\n if(flags.indexOf(pattern[pos]) > -1){\n if(auL_flags.indexOf(pattern[pos]) > -1){\n auL++\n if(auL > 1){\n fail(\"bad inline flags: flags 'a', 'u'\" +\n \" and 'L' are incompatible\", pos)\n }\n }\n on_flags.push(chr(pattern[pos]))\n pos++\n }else if(pattern[pos] == MINUS){\n has_off = true\n closed = true\n pos++\n break\n }else if(String.fromCharCode(pattern[pos]).\n match(/[a-zA-Z]/)){\n fail(\"unknown flag\", pos)\n }else if(pattern[pos] == PARENTH_CLOSE){\n closed = true\n break\n }else if(pattern[pos] == COLON){\n yield new Group(pos, {name: \"Group\", type: \"flags\"})\n verbose_stack.push(verbose)\n closed = true\n break\n }else{\n fail(\"missing -, : or )\", pos)\n }\n }\n if(! closed){\n fail(\"missing -, : or )\", pos)\n }\n }\n if(has_off){\n while(pos < pattern.length){\n if(flags.indexOf(pattern[pos]) > -1){\n if(auL_flags.indexOf(pattern[pos]) > -1){\n fail(\"bad inline flags: cannot turn off \" +\n \"flags 'a', 'u' and 'L'\", pos)\n }\n if(on_flags.indexOf(chr(pattern[pos])) > -1){\n fail(\"bad inline flags: flag turned on and off\", pos)\n }\n off_flags.push(chr(pattern[pos]))\n pos++\n }else if(pattern[pos] == COLON){\n yield new Group(pos, {name: \"Group\", type: \"flags\"})\n verbose_stack.push(verbose)\n break\n }else if(String.fromCharCode(pattern[pos]).\n match(/[a-zA-Z]/)){\n fail(\"unknown flag\", pos)\n }else if(off_flags.length == 0){\n fail(\"missing flag\", pos)\n }else{\n fail(\"missing :\", pos)\n }\n }\n if(off_flags.length == 0){\n fail(\"missing flag\", pos)\n }\n }\n if(has_off && pattern[pos] != COLON){\n fail(\"missing :\", pos)\n }\n if(on_flags.length == 0 && off_flags.length == 0){\n fail(\"missing flag\", pos)\n }\n var set_flags = new SetFlags(flags_start,\n {on_flags, off_flags})\n\n yield set_flags\n // reset verbose\n if(on_flags.indexOf('x') > -1){\n verbose = true\n verbose_stack.push(verbose)\n }\n if(off_flags.indexOf('x') > -1){\n verbose = false\n }\n if(! closed){\n node = set_flags\n }\n pos++\n }else if(pattern[pos + 2] == ord('#')){\n pos += 3\n while(pos < pattern.length){\n if(pattern[pos] == PARENTH_CLOSE){\n break\n }\n pos++\n }\n if(pos == pattern.length){\n fail(\"missing ), unterminated comment\", pos)\n }\n pos++\n continue\n }else{\n fail(\"unknown extension ?\" + _b_.chr(pattern[pos + 2]),\n pos)\n }\n }else{\n yield new Group(pos)\n verbose_stack.push(verbose)\n pos++\n }\n }else if(cp == PARENTH_CLOSE){\n yield new GroupEnd(pos)\n verbose_stack.pop()\n verbose = $last(verbose_stack)\n pos++\n }else if(cp == BACKSLASH){\n var escape = escaped_char({codepoints: pattern, pos, is_bytes})\n if(escape instanceof CharacterClass){\n yield escape\n pos += escape.length\n }else if(escape.char !== undefined){\n yield new Char(pos, escape.ord)\n pos += escape.length\n }else if(escape.type == \"backref\"){\n var len = escape.length\n if(escape.value.length > 2){\n escape.value = escape.value.substr(0, 2)\n len = 2\n }\n yield new BackReference(pos, \"num\", escape.value)\n pos += len\n }else if(typeof escape == \"number\"){\n // eg \"\\.\"\n var esc = new Char(pos, escape)\n esc.escaped = true\n yield esc\n pos += 2\n }else{\n yield new Char(pos, escape)\n pos += escape.length\n }\n }else if(cp == BRACKET_OPEN){\n // Set of characters\n var set,\n end_pos\n [set, end_pos] = parse_character_set(pattern, pos, is_bytes)\n yield new CharacterSet(pos, set)\n pos = end_pos + 1\n }else if('+?*'.indexOf(char) > -1){\n yield new Repeater(pos, char)\n pos++\n }else if(cp == BRACE_OPEN){\n var reps = /\\{(\\d*)((,)(\\d*))?\\}/.exec(\n from_codepoint_list(pattern.slice(pos)))\n if(reps && reps[0] != '{}'){\n if(reps[1] == \"\"){\n var limits = [0]\n }else{\n var limits = [parseInt(reps[1])]\n }\n if(reps[4] !== undefined){\n if(reps[4] == \"\"){\n var max = Number.POSITIVE_INFINITY\n }else{\n var max = parseInt(reps[4])\n }\n limits.push(max)\n }\n yield new Repeater(pos, limits)\n pos += reps[0].length\n }else if(pattern[pos + 1] == BRACE_CLOSE){\n // {} is the characters \"{\" and \"}\"\n yield new Char(pos, BRACE_OPEN)\n pos++\n }else{\n yield new Char(pos, BRACE_OPEN)\n pos++\n }\n }else if(cp == OR){\n yield new Or(pos)\n pos++\n }else if(cp == DOT){\n yield new CharacterClass(pos, cp, 1)\n pos++\n }else if(cp == CARET){\n yield new StringStart(pos)\n pos++\n }else if(cp == DOLLAR){\n yield new StringEnd(pos)\n pos++\n }else{\n yield new Char(pos, cp)\n pos++\n }\n }\n}\n\nfunction transform_repl(data, pattern){\n // data.repl is a StringObj instance\n var repl = data.repl.string\n repl = repl.replace(/\\\\n/g, '\\n')\n repl = repl.replace(/\\\\r/g, '\\r')\n repl = repl.replace(/\\\\t/g, '\\t')\n repl = repl.replace(/\\\\b/g, '\\b')\n repl = repl.replace(/\\\\v/g, '\\v')\n repl = repl.replace(/\\\\f/g, '\\f')\n repl = repl.replace(/\\\\a/g, '\\x07')\n // detect backreferences\n var pos = 0,\n escaped = false,\n br = false,\n repl1 = \"\",\n has_backref = false\n while(pos < repl.length){\n br = false\n if(repl[pos] == \"\\\\\"){\n escaped = ! escaped\n if(escaped){\n pos++\n continue\n }\n }else if(escaped){\n escaped = false\n var mo = /^\\d+/.exec(repl.substr(pos))\n if(mo){\n var cps = to_codepoint_list(repl)\n var escape = escaped_char({\n codepoints: cps,\n pos: pos - 1,\n is_bytes: cps.type == \"bytes\"\n })\n if(escape.type == \"o\"){\n if(escape.ord > 0o377){\n fail(`octal escape value \\\\${mo[0]} ` +\n \" outside of range 0-0o377\", pos)\n }\n repl1 += escape.char\n pos += escape.length - 1\n continue\n }else if(escape.type != \"backref\"){\n var group_num = mo[0].substr(0,\n Math.min(2, mo[0].length))\n fail(`invalid group reference ${group_num}`, pos)\n }else{\n // only keep first 2 digits\n var group_num = mo[0].substr(0,\n Math.min(2, mo[0].length))\n // check that pattern has the specified group num\n if(pattern.groups === undefined){\n throw _b_.AttributeError.$factory(\"$groups\")\n }\n if(pattern.groups[group_num] === undefined){\n fail(`invalid group reference ${group_num}`,\n pos)\n }else{\n mo[0] = group_num\n }\n }\n if(! has_backref){\n var parts = [repl.substr(0, pos - 1),\n parseInt(mo[0])]\n }else{\n parts.push(repl.substring(next_pos, pos - 1))\n parts.push(parseInt(mo[0]))\n }\n has_backref = true\n var next_pos = pos + mo[0].length\n br = true\n pos += mo[0].length\n }else if(repl[pos] == \"g\"){\n pos++\n if(repl[pos] != '<'){\n fail(\"missing <\", pos)\n }\n pos++\n mo = /(.*?)>/.exec(repl.substr(pos))\n if(mo){\n if(mo[1] == \"\"){\n pos += mo[0].length\n fail(\"missing group name\", pos - 1)\n }\n var group_name = mo[1]\n if(group_name == '0'){\n // The backreference \\g<0> substitutes in the entire\n // substring matched by the RE.\n }else if(/^\\d+$/.exec(group_name)){\n if(pattern.groups[group_name] === undefined){\n fail(`invalid group reference ${group_name}`,\n pos)\n }\n }else{\n try{\n var group_num = _b_.int.$factory(group_name)\n if(group_num < 0){\n fail(`bad character in group name ` +\n `'${group_name}' at position ${pos}`, pos)\n }\n warn(_b_.DeprecationWarning,\n `bad character in group name '${group_name}' ` +\n `at position ${pos}`)\n mo[1] = group_name = group_num + ''\n }catch(err){\n if(! _b_.str.isidentifier(group_name)){\n var cps = to_codepoint_list(group_name)\n if(! $B.is_XID_Start(cps[0])){\n fail(\"bad character in group name '\" +\n group_name + \"'\", pos)\n }else{\n for(cp of cps.slice(1)){\n if(! $B.is_XID_Continue(cp)){\n fail(\"bad character in group name '\" +\n group_name + \"'\", pos)\n }\n }\n }\n }else if(data.type == \"bytes\" && ! is_ascii(group_name)){\n var b = _b_.bytes.$factory(group_name, 'latin-1'),\n s = _b_.bytes.decode(b, 'ascii', 'backslashreplace')\n warn(_b_.DeprecationWarning,\n `bad character in group name '${s}'` +\n ` at position ${pos}`)\n }\n }\n if(pattern.groups[group_name] === undefined){\n throw _b_.IndexError.$factory(\n `unknown group name '${group_name}'`,\n pos)\n }\n }\n if(! has_backref){\n var parts = [repl.substr(0, pos - 3),\n mo[1]]\n }else{\n parts.push(repl.substring(next_pos, pos - 3))\n parts.push(mo[1])\n }\n has_backref = true\n var next_pos = pos + mo[0].length\n br = true\n pos = next_pos\n }else{\n if(repl.substr(pos).length > 0){\n fail(\"missing >, unterminated name\", pos)\n }else{\n fail(\"missing group name\", pos)\n }\n }\n }else{\n if(/[a-zA-Z]/.exec(repl[pos])){\n fail(\"unknown escape\", pos)\n }\n pos += repl[pos]\n }\n }\n if(! br){\n repl1 += repl[pos]\n pos ++\n }\n }\n data.repl1 = repl1\n if(has_backref){\n parts.push(repl.substr(next_pos))\n data.repl = function(bmo){\n var mo = bmo.mo,\n res = parts[0],\n groups = mo.$groups,\n s = mo.string,\n group,\n is_bytes = s.type == 'bytes'\n for(var i = 1, len = parts.length; i < len; i += 2){\n if(parts[i] == 0){\n var x = s.substring(mo.start, mo.end)\n if(is_bytes){\n x = _b_.bytes.decode(x, 'latin-1')\n }\n res += x\n }else if(groups[parts[i]] === undefined){\n if(mo.node.$groups[parts[i]] !== undefined){\n // group is defined in the RE, but didn't contribute\n // to the match\n // groups[parts[i]] = ''\n }else{\n // group is not defined in the RE\n pos++\n group_num = parts[i].toString().substr(0, 2)\n fail(`invalid group reference ${group_num}`, pos)\n }\n }else{\n group = groups[parts[i]]\n var x = s.substring(group.start, group.end)\n if(is_bytes){\n x = _b_.bytes.decode(x, 'latin-1')\n }\n res += x\n }\n res += parts[i + 1]\n }\n return res\n }\n }else{\n data.repl = new StringObj(repl)\n }\n return data\n}\n\n\n\nvar Flag = $B.make_class(\"Flag\",\n function(value){\n return {\n __class__: Flag,\n value\n }\n }\n)\n\nFlag.__and__ = function(self, other){\n if(other.__class__ === Flag){\n return Flag.$factory(self.value & other.value)\n }else if(typeof other == \"number\" || typeof other == \"boolean\"){\n return Flag.$factory(self.value & other)\n }\n return _b_.NotImplemented\n}\n\nFlag.__index__ = function(self){\n return self.value\n}\n\nFlag.__invert__ = function(self){\n return Flag.$factory(~self.value)\n}\n\nFlag.__eq__ = function(self, other){\n return self.value == other.value\n}\n\nFlag.__or__ = function(self, other){\n if(other.__class__ === Flag){\n return Flag.$factory(self.value | other.value)\n }else if(typeof other == \"number\" || typeof other == \"boolean\"){\n return Flag.$factory(self.value | other)\n }\n return _b_.NotImplemented\n}\n\nFlag.__rand__ = function(self, other){\n if(typeof other == \"number\" || $B.$isinstance(other, _b_.int)){\n if(other == 0){\n return false // Flag.$factory(self.value)\n }\n return self.value & other\n }\n return _b_.NotImplemented\n}\n\nFlag.__ror__ = function(self, other){\n if(typeof other == \"number\" || $B.$isinstance(other, _b_.int)){\n if(other == 0){\n return self.value\n }\n return self.value | other\n }\n return _b_.NotImplemented\n}\n\nFlag.__repr__ = Flag.__str__ = function(self){\n if(self.value == 0){\n return \"re.none\"\n }\n var inverted = self.value < 0\n\n var t = [],\n value = inverted ? ~self.value : self.value\n for(var flag in inline_flags){\n if(value & inline_flags[flag].value){\n t.push('re.' + flag_names[flag])\n value &= ~inline_flags[flag].value\n }\n }\n if(value > 0){\n t.push('0x' + value.toString(16))\n }\n var res = t.join('|')\n if(inverted){\n if(t.length > 1){\n return '~(' + res + ')'\n }else{\n return '~' + res\n }\n }\n return res\n}\n\nFlag.__xor__ = function(self, other){\n return Flag.$factory(self.value ^ other.value)\n}\n\n$B.set_func_names(Flag, \"re\")\n\nvar no_flag = {}\n\nvar Scanner = $B.make_class(\"Scanner\",\n function(pattern, string, pos, endpos){\n var $ = $B.args('__init__', 4,\n {pattern: null, string: null, pos: null, endpos:null},\n ['pattern', 'string', 'pos', 'endpos'],\n arguments, {pos: 0, endpos: _b_.None}, null, null),\n endpos = endpos === _b_.None ? $.string.length : endpos\n return {\n __class__: Scanner,\n $string: $.string,\n pattern: $.pattern,\n pos: $.pos,\n endpos\n }\n }\n)\n\nScanner.match = function(self){\n return Pattern.match(self.pattern, self.$string)\n}\n\nScanner.search = function(self){\n if(! self.$iterator){\n self.$iterator = $module.finditer(self.pattern, self.$string)\n }\n // return last match\n var mo = _b_.None\n for(mo of self.$iterator.js_gen){\n // set mo\n }\n return mo\n}\n\nvar GroupIndex = $B.make_class(\"GroupIndex\",\n function(self, _default){\n var res = $B.empty_dict()\n res.__class__ = GroupIndex\n for(var key in self.$groups){\n if(isNaN(parseInt(key))){\n _b_.dict.$setitem(res, key, self.$groups[key].num)\n }\n }\n return res\n }\n)\nGroupIndex.__mro__ = [_b_.dict, _b_.object]\nGroupIndex.__setitem__ = function(){\n throw _b_.TypeError.$factory(\"read only\")\n}\n\n$B.set_func_names(GroupIndex, \"re\")\n\nvar Pattern = $B.make_class(\"Pattern\",\n function(pattern){\n var nb_groups = 0\n for(var key in pattern.groups){\n if(isFinite(key)){\n nb_groups++\n }\n }\n return {\n __class__: Pattern,\n pattern: pattern.text,\n groups: nb_groups,\n flags: pattern.flags,\n $groups: pattern.groups,\n $pattern: pattern\n }\n }\n)\n\nPattern.__copy__ = function(self){\n return self\n}\n\nPattern.__deepcopy__ = function(self){\n return self\n}\n\nPattern.__eq__ = function(self, other){\n if(other.$pattern && self.$pattern.type != other.$pattern.$type){\n // warn(_b_.BytesWarning, \"cannot compare str and bytes pattern\", 1)\n }\n return self.pattern == other.pattern &&\n self.flags.value == other.flags.value\n}\n\nPattern.__hash__ = function(self){\n // best effort ;-)\n return _b_.hash(self.pattern) + self.flags.value\n}\n\nPattern.__new__ = Pattern.$factory\n\nPattern.__reduce__ = function(self){\n return Pattern.__reduce_ex__(self, 4)\n}\n\nPattern.__reduce_ex__ = function(self, protocol){\n var res = _reconstructor,\n state = [self.__class__].concat(self.__class__.__mro__)\n var d = $B.empty_dict()\n _b_.dict.$setitem(d, 'pattern', self.pattern)\n _b_.dict.$setitem(d, 'flags', self.flags.value)\n state.push(d)\n return $B.fast_tuple([res, $B.fast_tuple(state)])\n}\n\nfunction _reconstructor(cls, base, state){\n var pattern = _b_.dict.$getitem(state, 'pattern'),\n flags = Flag.$factory(_b_.dict.$getitem(state, 'flags'))\n return $module.compile(pattern, flags)\n}\n\nPattern.__repr__ = Pattern.__str__ = function(self){\n var text = self.$pattern.text,\n s = text\n if(self.$pattern.type == \"bytes\"){\n s = _b_.str.$factory(_b_.str.encode(s, 'latin-1'))\n }else{\n s = _b_.repr(s)\n }\n s = s.substr(0, 200)\n var res = `re.compile(${s}`,\n flags = self.$pattern.flags\n if(flags === no_flag){\n return res + ')'\n }\n // mask UNICODE flag\n if(flags.__class__ === Flag){\n // copy flag, otherwise U.value would become 0\n flags = Flag.$factory(flags.value)\n flags.value &= ~U.value\n }else if(typeof flags == \"number\"){\n flags &= ~U.value\n }\n if(flags != 0 && flags.value != 0){\n res += `, ${_b_.str.$factory(flags)}`\n }\n return res + ')'\n}\n\nPattern.findall = function(self){\n var iter = Pattern.finditer.apply(null, arguments).js_gen,\n res = []\n\n while(true){\n var next = iter.next()\n if(next.done){\n return res\n }\n var bmo = next.value,\n mo = bmo.mo,\n groups = MatchObject.groups(bmo)\n\n // replace None by the empty string\n for(var i = 0, len = groups.length; i < len; i++){\n groups[i] = groups[i] === _b_.None ? \"\" : groups[i]\n }\n if(groups.length > 0){\n if(groups.length == 1){\n res.push(groups[0])\n }else{\n res.push($B.fast_tuple(groups))\n }\n }else{\n res.push(mo.string.substring(mo.start, mo.end))\n }\n }\n}\n\nPattern.finditer = function(self){\n var $ = $B.args(\"finditer\", 4,\n {self: null, string: null, pos: null, endpos: null},\n 'self string pos endpos'.split(' '), arguments,\n {pos: 0, endpos: _b_.None}, null, null)\n var original_string = $.string,\n data = prepare({string: $.string})\n var endpos = $.endpos === _b_.None ? data.string.length : $.endpos\n return $B.generator.$factory(iterator)(self.$pattern, data.string,\n no_flag, $.string, $.pos, endpos)\n}\n\nPattern.fullmatch = function(self, string){\n var $ = $B.args(\"match\", 4,\n {self: null, string: null, pos: null, endpos: null},\n [\"self\", \"string\", \"pos\", \"endpos\"], arguments,\n {pos: 0, endpos: _b_.None}, null, null)\n if($.endpos === _b_.None){\n $.endpos = $.string.length\n }\n var data = prepare({string: $.string})\n if(self.$pattern.type != data.string.type){\n throw _b_.TypeError.$factory(\"not the same type for pattern \" +\n \"and string\")\n }\n var fullmatch_pattern = create_fullmatch_pattern($.self.$pattern)\n var mo = match(fullmatch_pattern, data.string, $.pos, $.endpos)\n if(mo && mo.end - mo.start == $.endpos - $.pos){\n return MatchObject.$factory(mo)\n }else{\n return _b_.None\n }\n}\n\nPattern.groupindex = {\n __get__: function(self){\n return GroupIndex.$factory(self)\n }\n}\n\nPattern.match = function(self, string){\n var $ = $B.args(\"match\", 4,\n {self: null, string: null, pos: null, endpos: null},\n [\"self\", \"string\", \"pos\", \"endpos\"], arguments,\n {pos: 0, endpos: _b_.None}, null, null)\n if($.endpos === _b_.None){\n $.endpos = $.string.length\n }\n var data = prepare({string: $.string})\n if(self.$pattern.type != data.string.type){\n throw _b_.TypeError.$factory(\"not the same type for pattern \" +\n \"and string\")\n }\n var mo = match($.self.$pattern, data.string, $.pos,\n $.endpos)\n return mo ? MatchObject.$factory(mo) : _b_.None\n}\n\nPattern.scanner = function(self, string, pos, endpos){\n return Scanner.$factory.apply(null, arguments) // self, string, pos, endpos)\n}\n\nPattern.search = function(self, string){\n var $ = $B.args(\"match\", 4,\n {self: null, string: null, pos: null, endpos: null},\n [\"self\", \"string\", \"pos\", \"endpos\"], arguments,\n {pos: 0, endpos: _b_.None}, null, null)\n var data = prepare({string: $.string})\n if(self.$pattern.type != data.string.type){\n throw _b_.TypeError.$factory(\"not the same type for pattern \" +\n \"and string\")\n }\n if($.endpos === _b_.None){\n $.endpos = data.string.length\n }\n var pos = $.pos\n while(pos <= $.endpos){\n var mo = match(self.$pattern, data.string, pos)\n if(mo){\n return MatchObject.$factory(mo)\n }else{\n pos++\n }\n }\n return _b_.None\n}\n\nPattern.split = function(){\n return $module.split.apply(null, arguments)\n}\n\nPattern.sub = function(){\n var $ = $B.args(\"match\", 4,\n {self: null, repl: null, string: null, count: null},\n \"self repl string count\".split(' '), arguments,\n {count: 0}, null, null)\n var data = prepare({string: $.string})\n if($.self.$pattern.type != data.string.type){\n throw _b_.TypeError.$factory(\"not the same type for pattern \" +\n \"and string\")\n }\n\n return $module.sub($.self, $.repl, $.string, $.count)\n}\n\n$B.set_func_names(Pattern, \"re\")\n\nfunction Node(parent){\n this.parent = parent\n this.items = []\n}\n\nNode.prototype.add = function(item){\n this.items.push(item)\n item.parent = this\n}\n\nNode.prototype.fixed_length = function(){\n // Return the sum of items lengths if fixed, else undefined\n if(this.repeat){\n return false\n }\n var len = 0\n for(var item of this.items){\n if(item.fixed_length === undefined){\n console.log(\"pas de fixed length\", item)\n alert()\n }\n var sublen = item.fixed_length()\n if(sublen === false){\n return false\n }\n len += sublen\n }\n return len\n}\n\nfunction get_top(node){\n var top = node.parent\n while(top.parent){\n top = top.parent\n }\n return top\n}\n\nvar BackReference = function(pos, type, value){\n // for \"\\number\"\n this.name = \"BackReference\"\n this.pos = pos\n this.type = type // \"name\" or \"num\"\n this.value = value\n this.groups = []\n}\n\nBackReference.prototype.fixed_length = function(){\n // Return length of referenced group if it is fixed, else undefined\n if(this.repeat){\n return undefined\n }\n var group = this.get_group()\n if(group.fixed_length === undefined){\n console.log(\"group\", group, \"no fixed length\")\n }\n return group === undefined ? false : group.fixed_length()\n}\n\nBackReference.prototype.get_group = function(){\n var top = get_top(this)\n return top.$groups[this.value]\n}\n\nBackReference.prototype.match = function(string, pos, endpos, groups){\n this.repeat = this.repeat || {min: 1, max: 1}\n\n var group = groups[this.value]\n if(group === undefined){\n if(this.repeat.min == 0){\n return {\n nb_min: 0,\n nb_max: 0\n }\n }\n return false\n }\n\n // Get the codepoints matched by the referenced group\n group_cps = string.codepoints.slice(group.start, group.end)\n\n // search (repetitions of) the matched group codepoints\n var _pos = pos,\n nb = 0,\n group_len = group_cps.length,\n flag,\n cp\n while(string.cp_at(_pos) !== undefined && nb < this.repeat.max){\n flag = true\n for(var i = 0; i < group_len; i++){\n cp = string.cp_at(_pos + i)\n if(cp != group_cps[i]){\n flag = false\n break\n }\n }\n if(flag){\n nb++\n _pos += group_len\n }else{\n break\n }\n }\n if(nb >= this.repeat.min){\n // Returns the accepted minimum and maximum number of repeats\n // and the length of each repeat\n return {\n nb_min: this.repeat.min,\n nb_max: nb,\n group_len\n }\n }\n return false\n}\n\nBackReference.prototype.toString = function(){\n return \"BackRef to group\" + this.value\n}\n\nvar Case = function(){\n this.name = \"Case\"\n this.items = []\n this.groups = []\n this.text = 'Case '\n}\n\nCase.prototype.add = function(item){\n this.items.push(item)\n item.parent = this\n}\n\nCase.prototype.fixed_length = function(){\n var len\n for(var item of this.items){\n var fl = item.fixed_length()\n if(fl === false){\n return false\n }else if(len === undefined){\n len = fl\n }else{\n len += fl\n }\n }\n return len\n}\n\nCase.prototype.toString = function(){\n var res = 'Case '\n res += this.items.map(x => x + '').join(' ')\n return this.text = res\n}\n\nvar Choice = function(){\n this.type = \"choice\"\n this.items = []\n this.groups = []\n}\n\nChoice.prototype.add = Node.prototype.add\n\nChoice.prototype.fixed_length = function(){\n var len\n for(var item of this.items){\n var fl = item.fixed_length()\n if(fl === false){\n return false\n }else if(len === undefined){\n len = fl\n }else if(len != fl){\n return false\n }\n }\n return len\n}\n\nChoice.prototype.toString = function(){\n return 'Choice'\n}\n\nvar EmptyString = {\n toString: function(){\n return ''\n },\n match: function(string, pos, endpos){\n return {nb_min: 0, nb_max: 0}\n },\n fixed_length: function(){\n return 1\n },\n length: 0\n },\n Flags = function(flags){\n this.flags = flags\n },\n GroupEnd = function(pos){\n this.name = \"GroupEnd\"\n this.pos = pos\n this.text = ')'\n this.toString = function(){\n return '[end of group #' + this.group.num + ']'\n }\n },\n Or = function(pos){\n this.name = \"Or\"\n this.pos = pos\n this.text = '|'\n this.toString = function(){\n return '|'\n }\n },\n Repeater = function(pos, op){\n this.name = \"Repeater\"\n this.pos = pos\n this.op = op\n }\n\nfunction cased_cps(cp, ignore_case, ascii){\n // If cp is the codepoint of a cased Unicode character, return the list\n // of the codepoints that match the character in a case-insensitive way\n\n // ignore_case = this.flags && this.flags.value & IGNORECASE.value\n // ascii = this.flags.value & ASCII.value\n var cps,\n char = $B.codepoint2jsstring(cp)\n if(! ignore_case){\n return [cp]\n }\n if(ascii){\n // only test ASCII letters\n ignore_case = ignore_case && (\n (char >= 'a' && char <= 'z') ||\n (char >= 'A' && char <= 'Z'))\n }\n if(ignore_case){\n var char_up = char.toUpperCase(),\n char_low = char.toLowerCase(),\n cps = new Set([cp, $B.jsstring2codepoint(char_low),\n $B.jsstring2codepoint(char_up)])\n // special cases\n if(char.toLowerCase() == \"k\"){\n cps.add(0x212a) // Kelvin sign\n }\n if(cp == 0x212a){\n cps.add(ord('k'))\n cps.add(ord('K'))\n }\n if(char.toLowerCase() == \"s\"){\n cps.add(0x017f) // (Latin small letter long s)\n }\n if(cp == 0x017f){\n cps.add(ord('s'))\n cps.add(ord('S'))\n }\n if(char.toLowerCase() == 'i'){\n cps.add(0x0130) // (Latin capital letter I with dot above)\n cps.add(0x0131) // (Latin small letter dotless i)\n }\n if(cp == 0x0130 || cp == 0x0131){\n cps.add(ord('i'))\n cps.add(ord('I'))\n }\n return Array.from(cps)\n }else{\n cps = [cp]\n }\n return cps\n}\n\nvar Char = function(pos, cp, groups){\n // character in a regular expression or in a character set\n // pos : position of the character in the pattern string\n // cp : the character's codepoint\n // groups (optional) : the groups that contain the character\n this.pos = pos\n this.cp = cp\n this.char = chr(this.cp)\n this.text = this.char\n}\n\nChar.prototype.fixed_length = function(){\n if(this.repeat){\n return this.repeat.min\n }\n return this.char === EmptyString ? 0 : 1\n}\n\nChar.prototype.match = function(string, pos, endpos){\n // Returns {pos1, pos2} such that \"this\" matches all the substrings\n // string[pos:i] with pos1 <= i < pos2, or false if no match\n this.repeat = this.repeat || {min: 1, max: 1}\n\n var i = 0\n\n // browse string codepoints until they don't match, or the number of\n // matches is above the maximum allowed\n if(this.flags){\n if(this.flags.value & ASCII.value){\n if(this.cp > 127){\n return false\n }\n }\n if(this.flags.value & IGNORECASE.value &&\n (! this.is_bytes || this.cp <= 127)){\n // Flag IGNORECASE set\n // For bytes pattern, case insensitive matching only works\n // for ASCII characters\n var char_upper = this.char.toUpperCase(),\n char_lower = this.char.toLowerCase(),\n cp\n while(i < this.repeat.max && pos + i < endpos){\n cp = string.cp_at(pos + i)\n var char = chr(cp)\n if(char.toUpperCase() != char_upper &&\n char.toLowerCase() != char_lower){\n break\n }\n i++\n }\n }else{\n while(pos + i < endpos &&\n string.cp_at(pos + i) == this.cp &&\n i < this.repeat.max){\n i++\n }\n }\n }else{\n while(pos + i < endpos &&\n string.cp_at(pos + i) == this.cp &&\n i < this.repeat.max){\n i++\n }\n }\n var nb = i\n if(nb >= this.repeat.min){\n // Number of repeats ok\n return {\n nb_min: this.repeat.min,\n nb_max: nb\n }\n }else{\n return false\n }\n}\n\nChar.prototype.toString = function(){\n var res = 'Char ' + this.text\n if(this.repeat !== undefined){\n res += ' repeat {' + this.repeat.min + ',' + this.repeat.max + '}'\n if(this.non_greedy){\n res += '?'\n }\n }\n return res\n}\n\nfunction CharSeq(chars, flags){\n // sequence of consecutive characters\n this.chars = chars\n this.flags = flags\n this.merge_same_chars()\n}\n\nCharSeq.prototype.add_char = function(char){\n this.chars.push(char)\n this.merge_same_chars()\n}\n\nCharSeq.prototype.fixed_length = function(){\n var len = 0,\n cps = [],\n char_len\n for(var char of this.chars){\n if(! char.repeat){\n char_len = 1\n }else if(char.repeat.min == char.repeat.max){\n char_len = char.repeat.min\n }else{\n len = false\n break\n }\n for(var i = 0; i < char_len; i++){\n cps.push(char.cp)\n }\n len += char_len\n }\n this.cps = cps\n return this.len = len\n}\n\nCharSeq.prototype.match = function(string, pos, endpos){\n var mos = [],\n i = 0,\n backtrack,\n nb\n this.len = this.len === undefined ? this.fixed_length() : this.len\n // optimization if character sequence has a fixed length\n if(this.len !== false && ! (this.flags.value & IGNORECASE.value)){\n for(var i = 0; i < this.len; i++){\n if(string.cp_at(pos + i) !== this.cps[i]){\n return false\n }\n }\n return {nb_min: this.len, nb_max: this.len}\n }\n for(var i = 0, len = this.chars.length; i < len; i++){\n var char = this.chars[i],\n mo = char.match(string, pos, endpos) // form {nb_min, nb_max}\n if(_debug.value){\n console.log('CharSeq match, pos', pos, 'char', char, 'mo', mo)\n alert()\n }\n if(mo){\n nb = char.non_greedy ? mo.nb_min : mo.nb_max\n mos.push({nb,\n nb_min: mo.nb_min,\n nb_max: mo.nb_max,\n non_greedy: !!char.non_greedy\n })\n pos += nb\n }else{\n // backtrack\n backtrack = false\n while(mos.length > 0){\n i--\n mo = mos.pop()\n pos -= mo.nb\n nb = mo.nb\n if(mo.non_greedy && nb < mo.nb_max){\n nb += 1\n backtrack = true\n }else if(! mo.non_greedy && nb - 1 >= mo.nb_min){\n nb -= 1\n backtrack = true\n }\n if(backtrack){\n pos += nb\n mo.nb = nb\n mos.push(mo)\n break\n }\n }\n if(mos.length == 0){\n return false\n }\n }\n }\n var nb = 0,\n last_mo = $B.last(mos)\n for(var mo of mos.slice(0, mos.length - 1)){\n nb += mo.nb\n }\n var res = {\n nb_min: nb + last_mo.nb_min,\n nb_max: nb + last_mo.nb_max\n }\n return res\n}\n\nCharSeq.prototype.merge_same_chars = function(){\n // b?b merged into b+ etc.\n var current,\n chars = [],\n merged\n for(var item of this.chars){\n if(current && current.char == item.char &&\n current.non_greedy === item.non_greedy){\n if(! current.repeat){\n current.repeat = {min: 1, max: 1}\n }\n if(item.repeat){\n current.repeat.min += item.repeat.min\n current.repeat.max += item.repeat.max\n }else{\n current.repeat.min += 1\n current.repeat.max += 1\n }\n merged = true\n }else{\n chars.push(item)\n }\n current = item\n }\n if(merged){\n this.chars = chars\n }\n}\n\nCharSeq.prototype.toString = function(){\n var res = ''\n for(var char of this.chars){\n res += char.text\n }\n return 'CharSeq ' + res\n}\n\nfunction CharacterClass(pos, cp, length, groups){\n this.cp = cp\n this.value = chr(cp)\n this.length = length\n this.pos = pos\n\n var flags = this.flags\n\n // Test function : test(string, pos) returns:\n // - true if \"this\" matches 1 character string[pos]\n // - [true, 0] if \"this\" matches the empty string at pos\n // - false or undefined if \"this\" doesn't match\n switch(this.value){\n case 'A':\n this.test_func = function(string, pos){\n if(pos == 0){\n return [true, 0]\n }\n }\n break\n case 's':\n this.test_func = function(string, pos){\n var cp = string.cp_at(pos)\n return $B.in_unicode_category('Zs', cp) ||\n $B.unicode_bidi_whitespace.indexOf(cp) > -1\n }\n break\n case 'S':\n this.test_func = function(string, pos){\n var cp = string.cp_at(pos)\n return cp !== undefined &&\n ! $B.in_unicode_category('Zs', cp) &&\n $B.unicode_bidi_whitespace.indexOf(cp) == -1\n }\n break\n case '.':\n this.test_func = function(string, pos){\n if(string.cp_at(pos) === undefined){\n return false\n }\n if(this.flags.value & DOTALL.value){\n return true\n }else{\n return string.cp_at(pos) != 10\n }\n }\n break\n case 'd':\n this.test_func = function(string, pos){\n if(this.flags === undefined){\n console.log(\"\\\\d, no flags\", this)\n }\n var cp = string.cp_at(pos),\n tester = (this.flags.value & ASCII.value) ?\n is_ascii_digit : is_digit\n return tester(cp)\n }\n break\n case 'D':\n this.test_func = function(string, pos){\n var cp = string.cp_at(pos),\n tester = (this.flags.value & ASCII.value) ?\n is_ascii_digit : is_digit\n return ! tester(cp)\n }\n break\n case 'b':\n this.test_func = function(string, pos){\n var tester = is_word\n if(this.is_bytes || (this.flags.value & ASCII.value)){\n tester = is_ascii_word\n }\n var cp = string.cp_at(pos),\n ok = {nb_min: 0, nb_max: 0}\n\n // return true if char at pos is at the beginning or start\n // of a word\n if(pos == 0 && tester(cp)){\n return ok\n }\n if(string.cp_at(pos) === undefined && tester(string.cp_at(pos - 1))){\n return ok\n }\n if(pos > 0 && string.cp_at(pos) !== undefined){\n if((tester(string.cp_at(pos - 1))) !==\n tester(cp)){\n return ok\n }\n }\n return false\n }\n break\n case 'B':\n this.test_func = function(string, pos){\n var tester = is_word\n if(this.is_bytes || (this.flags.value & ASCII.value)){\n tester = is_ascii_word\n }\n\n var cp = string.cp_at(pos),\n ok = {nb_min: 0, nb_max: 0}\n // test is true if char at pos is not at the beginning or\n // start of a word\n if(pos == 0 && cp === undefined){\n // empty string\n return false\n }\n if(pos == 0 && tester(cp)){\n return false\n }\n if(cp === undefined &&\n tester(string.cp_at(pos - 1))){\n return false\n }\n if(pos > 0 && cp !== undefined){\n if(tester(string.cp_at(pos - 1)) !== tester(cp)){\n return false\n }\n }\n return ok\n }\n break\n case 'w':\n this.test_func = function(string, pos){\n var tester = is_word\n if(this.is_bytes || (this.flags.value & ASCII.value)){\n tester = is_ascii_word\n }\n return tester(string.cp_at(pos))\n }\n break\n case 'W':\n this.test_func = function(string, pos){\n var tester = is_word\n if(this.is_bytes || (this.flags.value & ASCII.value)){\n tester = is_ascii_word\n }\n return ! tester(string.cp_at(pos))\n }\n break\n case 'Z':\n this.test_func = function(string, pos){\n if(string.cp_at(pos) === undefined){\n return {nb_min: 0, nb_max: 0}\n }\n }\n break\n }\n}\n\nCharacterClass.prototype.fixed_length = function(){\n return this.repeat ? false : 1\n}\n\nCharacterClass.prototype.match = function(string, pos, endpos){\n // Returns {pos1, pos2} such that \"this\" matches all the substrings\n // string[pos:i] with pos1 <= i < pos2, or false if no match\n if(pos === undefined){\n console.log('no pos')\n throw Error()\n }\n var len = string.length\n this.repeat = this.repeat || {min: 1, max: 1}\n\n // browse string codepoints until they don't match, or the number of\n // matches is above the maximum allowed\n var i = 0\n while(i < this.repeat.max && i < len){\n var test = this.test_func(string, pos + i, this.flags)\n if(! test){\n break\n }\n i++\n }\n\n var nb = i\n if(nb >= this.repeat.min){\n // Number of repeats ok\n if('bBAZ'.indexOf(this.value) > -1 ){\n return {nb_min: 0, nb_max: 0}\n }\n return {\n nb_min: this.repeat.min,\n nb_max: nb\n }\n }else{\n return false\n }\n}\n\nCharacterClass.prototype.nb_repeats = Char.prototype.nb_repeats\n\nCharacterClass.prototype.toString = function(){\n return '\\\\' + this.value\n}\n\nvar CharacterSet = function(pos, set, groups){\n // character set\n this.pos = pos\n this.set = set\n this.neg = set.neg\n}\n\nCharacterSet.prototype.fixed_length = function(){\n return 1\n}\n\nCharacterSet.prototype.match = function(string, pos, endpos){\n var ignore_case = this.flags && (this.flags.value & IGNORECASE.value),\n test,\n match = false,\n i = 0,\n cp\n\n this.repeat = this.repeat || {min: 1, max: 1}\n\n while(i < this.repeat.max && (cp = string.cp_at(pos + i)) !== undefined){\n test = false\n\n if(string.cp_at(pos) === undefined){\n cp = EmptyString\n }\n try{\n $B.codepoint2jsstring(cp)\n }catch(err){\n console.log(err.message)\n console.log('cp', cp, '\\nstring', string, 'pos', pos)\n console.log($B.print_stack())\n throw _b_.Exception.$factory('bad codepoint')\n }\n var char = $B.codepoint2jsstring(cp),\n cps = cased_cps(cp, ignore_case, this.flags.value & ASCII.value),\n char_is_cased = cps.length > 1\n\n for(var cp1 of cps){\n for(var item of this.set.items){\n if(typeof item == 'string'){\n\n }\n if(Array.isArray(item.ord)){\n if(cp1 >= item.ord[0] &&\n cp1 <= item.ord[1]){\n test = true\n break\n }else if(ignore_case && char_is_cased){\n var start1 = chr(item.ord[0]).toUpperCase(),\n end1 = chr(item.ord[1]).toUpperCase(),\n char1 = char.toUpperCase()\n if(char1 >= start1 && char1 <= end1){\n test = true\n }\n var start1 = chr(item.ord[0]).toLowerCase(),\n end1 = chr(item.ord[1]).toLowerCase(),\n char1 = char.toLowerCase()\n if(char1 >= start1 && char1 <= end1){\n test = true\n }\n }\n }else if(item instanceof CharacterClass){\n test = !! item.match(string, pos + i, endpos) // boolean\n }else{\n if(item.ord == cp1){\n test = true\n break\n }\n item_str = typeof item == 'string' ? item : chr(item.ord)\n if(item_str == char){\n test = true\n break\n }\n if(ignore_case && char_is_cased &&\n (char.toUpperCase() == item_str.toUpperCase() ||\n char.toLowerCase() == item_str.toLowerCase())){\n test = true\n break\n }\n }\n }\n }\n if(this.neg){\n test = ! test\n }\n if(test){\n i++\n }else{\n break\n }\n }\n var nb = i\n if(nb >= this.repeat.min){\n // Number of repeats ok\n return {\n nb_min: this.repeat.min,\n nb_max: nb\n }\n }else{\n return false\n }\n\n}\n\nCharacterSet.prototype.nb_repeats = Char.prototype.nb_repeats\n\nCharacterSet.prototype.toString = function(){\n return 'CharSet'\n}\n\nvar ConditionalBackref = function(pos, group_ref){\n this.type = \"conditional backref\"\n this.pos = pos\n this.group_ref = group_ref\n this.chars = []\n this.match_codepoints = []\n this.nb_success = 0\n this.re_if_exists = new Group(pos)\n this.re_if_not_exists = new Group(pos)\n this.nb_options = 1\n}\n\nConditionalBackref.prototype.add = function(item){\n if(this.nb_options == 1){\n this.re_if_exists.add(item)\n }else if(this.nb_options == 2){\n this.re_if_not_exists.add(item)\n }\n item.parent = this\n}\n\nConditionalBackref.prototype.fixed_length = function(){\n var len = this.re_if_exists.fixed_length()\n if(len !== false && len == this.re_if_not_exists.fixed_length()){\n return len\n }\n return false\n}\n\nConditionalBackref.prototype.match = function(string, pos, endpos, groups){\n var re = groups[this.group_ref] ? this.re_if_exists :\n this.re_if_not_exists,\n pattern = {node: re, text: re + ''},\n mo = match(pattern, string, pos, endpos, false, groups)\n if(mo){\n return {nb_min: mo.end - mo.start, nb_max: mo.end - mo.start}\n }\n return false\n}\n\nConditionalBackref.prototype.toString = function(){\n return 'ConditionalBackref'\n}\n\nvar Group = function(pos, extension){\n this.type = \"group\"\n this.pos = pos\n this.items = []\n this.chars = []\n this.groups = []\n for(var key in extension){\n this[key] = extension[key]\n }\n if(extension && extension.type){\n if(extension.type.indexOf('lookahead') > -1){\n this.is_lookahead = true\n }else if(extension.type.indexOf('lookbehind') > -1){\n this.is_lookbehind = true\n }\n }\n}\n\nGroup.prototype.add = Node.prototype.add\n\nGroup.prototype.toString = function(){\n if(this.num === undefined){\n var res = 'Group ' + this.type + ' ' + this.pattern\n }else{\n var res = 'Group #' + this.num + ' ' + this.pattern\n }\n if(this.repeat !== undefined){\n res += ' repeat {' + this.repeat.min + ',' + this.repeat.max + '}'\n if(this.non_greedy){\n res += '?'\n }\n }\n return res\n}\n\nBackReference.prototype.nb_repeats = Group.prototype.nb_repeats\n\nGroup.prototype.fixed_length = Node.prototype.fixed_length\n\nfunction groups_in(pattern, group_list){\n if(group_list === undefined){\n group_list = new Set()\n }\n if(pattern instanceof Group && pattern.hasOwnProperty('num')){\n group_list.add(pattern.num)\n }\n if(pattern.items){\n for(var subpattern of pattern.items){\n for(var group of groups_in(subpattern, group_list)){\n group_list.add(group)\n }\n }\n }\n return group_list\n}\n\nfunction GroupRef(group_num, item){\n this.num = group_num\n this.item = item\n}\n\nGroupRef.prototype.fixed_length = function(){\n return this.item.fixed_length()\n}\n\nfunction Lookbehind(item){\n this.re = item\n this.neg = this.re.type == \"negative_lookbehind\"\n}\n\nLookbehind.prototype.match = function(string, pos, endpos, groups){\n var ok = {nb_min: 0, nb_max: 0},\n pattern = {node: this.re, text: this.re + ''},\n length = this.re.length,\n mo\n if(pos - length < 0){\n mo = false\n }else{\n mo = match(pattern, string, pos - length, endpos, false, groups)\n }\n if(mo){\n return this.neg ? false : ok\n }else{\n return this.neg ? ok : false\n }\n}\n\nLookbehind.prototype.fixed_length = function(){\n return this.re.fixed_length()\n}\n\nLookbehind.prototype.toString = function(){\n return \"Lookbehind\"\n}\n\nfunction SetFlags(pos, flags){\n this.pos = pos\n this.on_flags = flags.on_flags\n this.off_flags = flags.off_flags\n this.items = []\n}\n\nSetFlags.prototype.add = Node.prototype.add\n\nfunction StringStart(pos){\n this.pos = pos\n}\n\nStringStart.prototype.match = function(string, pos, endpos){\n var ok = {nb_min:0, nb_max: 0}\n if(this.flags.value & MULTILINE.value){\n return (pos == 0 || string.cp_at(pos - 1) == 10) ? ok : false\n }\n return pos == 0 ? ok : false\n}\n\nStringStart.prototype.fixed_length = function(){\n return 0\n}\n\nStringStart.prototype.toString = function(){\n return '^'\n}\n\nfunction StringEnd(pos){\n this.pos = pos\n}\n\nStringEnd.prototype.match = function(string, pos, endpos){\n var ok = {nb_min:0, nb_max: 0},\n cp = string.cp_at(pos)\n if(this.flags.value & MULTILINE.value){\n return (pos > string.codepoints.length - 1 ||\n cp == 10) ? ok : false\n }\n return pos > endpos - 1 ? ok :\n (pos == endpos - 1 && cp == 10) ? ok : false\n}\n\nStringEnd.prototype.fixed_length = function(){\n return 0\n}\n\nStringEnd.prototype.toString = function(){\n return '$'\n}\n\nvar cache = new Map()\n\nfunction compile(pattern, flags){\n if(pattern.__class__ === Pattern){\n if(flags !== no_flag){\n throw _b_.ValueError.$factory(\"no flags\")\n }\n return pattern\n }\n if(cache.has(pattern.py_obj)){\n if(cache.get(pattern.py_obj).has(flags.value || 0)){\n return cache.get(pattern.py_obj).get(flags.value || 0)\n }\n }\n var original_pattern = pattern,\n original_flags = flags,\n type = pattern.type,\n choices,\n allow_global_flags = true\n pattern = pattern.codepoints\n var is_bytes = type !== \"str\"\n if(is_bytes && flags && (flags.value & U.value)){\n throw _b_.ValueError.$factory(\"cannot use UNICODE flag with \" +\n \"a bytes pattern\")\n }\n if(flags && (flags.value & U.value) &&\n (flags.value & ASCII.value)){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n if(is_bytes){\n // bytes patterns ignore re.ASCII flag\n flags = Flag.$factory(flags.value || 0)\n //flags.value &= ~ASCII.value\n }\n var group_num = 0,\n group_stack = [],\n groups = {},\n pos,\n lookbehind,\n node = new Node(),\n accept_inline_flag = true,\n verbose = (flags.value || 0) & VERBOSE.value,\n comment = false,\n backrefs = {}\n node.$groups = groups\n for(var item of tokenize(pattern, type, verbose)){\n item.flags = flags\n item.is_bytes = is_bytes\n if(lookbehind){\n item.lookbehind = lookbehind\n lookbehind.parent = item\n lookbehind = false\n }\n if(allow_global_flags &&\n (group_stack.length > 0 || ! (item instanceof SetFlags))){\n allow_global_flags = false\n }\n if(item instanceof Group){\n group_stack.push(item)\n node.add(item)\n item.state = \"open\"\n group_num++\n item.num = group_num\n node = item // next items will be stored as group's items\n pos = item.pos\n if(item.non_capturing){\n delete item.num\n group_num--\n }else if(item.type == \"name_def\"){\n var value = item.value\n if(groups[value.string] !== undefined){\n fail(`redefinition of group name` +\n ` '${value.string}' as group ${group_num}; was group` +\n ` ${groups[value.string].num}`, pos)\n }\n item.name = value.string\n groups[value.string] = groups[group_num] =\n new GroupRef(group_num, item)\n }else if(item.is_lookahead){\n // a lookahead assertion is relative to the previous regexp\n group_num--\n while(node.items.length > 0){\n item.add(node.items.shift())\n }\n node = item\n }else if(item.is_lookbehind){\n // a lookbehind assertion is relative to the next regexp\n node.parent.items.pop() // remove from node items\n // temporarily create a group\n groups[group_num] = new GroupRef(group_num, item)\n }else if(item.type == \"flags\"){\n // save flags before a group with inline flags, eg \"(?i:a)\"\n item.flags_before = Flag.$factory(flags.value | 0)\n }else{\n groups[group_num] = new GroupRef(group_num, item)\n }\n }else if(item instanceof GroupEnd){\n end_pos = item.pos\n if(group_stack.length == 0){\n fail(\"unbalanced parenthesis\", end_pos, original_pattern)\n }\n var item = group_stack.pop()\n item.end_pos = end_pos\n try{\n item.pattern = from_codepoint_list(\n pattern.slice(item.pos, end_pos + 1))\n }catch(err){\n console.log(\"err avec pattern substring\", pattern)\n throw err\n }\n if(item.is_lookbehind){\n delete groups[group_num]\n group_num--\n // check that all elements have a fixed length\n item.length = item.fixed_length()\n if(item.length === false){\n fail(\"look-behind requires fixed-width pattern\", pos)\n }\n item.parent.add(new Lookbehind(item))\n item.non_capturing = true\n // store in variable \"lookbehind\", will be applied to next item\n lookbehind = item\n }else if(item.is_lookahead){\n delete item.num\n }\n if(item instanceof Group && item.items.length == 0){\n item.add(EmptyString)\n }else if(item instanceof ConditionalBackref){\n if(groups[item.group_ref] === undefined){\n // might be defined later; store in backrefs and check\n // when all items have been processed\n backrefs[item.group_ref] = backrefs[item.group_ref] | pos + 3\n }\n if(item.re_if_exists.items.length == 0){\n item.re_if_exists.add(EmptyString)\n }else if(item.re_if_not_exists.items.length == 0){\n item.re_if_not_exists.pos = pos\n item.re_if_not_exists.add(EmptyString)\n }\n }else if(item.type == \"flags\"){\n // restore flags when entering the group\n flags = Flag.$factory(item.flags_before.value)\n }\n item.state = 'closed'\n node = item.parent\n }else if(item instanceof ConditionalBackref){\n var pos = item.pos,\n group_ref = item.group_ref\n if(typeof group_ref == \"number\"){\n if(group_ref == 0){\n fail(`bad group number`, pos + 3)\n }else if(group_ref >= MAXGROUPS){\n fail(`invalid group reference ${group_ref}`, pos + 1)\n }else if(groups[group_ref] &&\n groups[group_ref].item.state == \"open\"){\n fail(\"cannot refer to an open group\", pos)\n }\n }else if(groups[group_ref] !== undefined){\n if(groups[group_ref].item.state == \"open\"){\n fail(\"cannot refer to an open group\", pos)\n }\n }else{\n fail(`unknown group name '${group_ref}'`, pos)\n }\n group_stack.push(item)\n node.add(item)\n item.state = \"open\"\n node = item // next items will be stored as group's items\n }else if(item instanceof BackReference){\n pos = item.pos\n if(item.type == \"num\" && item.value > 99){\n var head = item.value.toString().substr(0, 2)\n fail(`invalid group reference ${head}`, pos + 1)\n }\n if(groups[item.value] !== undefined){\n if(groups[item.value].item.state == \"open\"){\n fail(\"cannot refer to an open group\", pos)\n }\n var ref_item = groups[item.value].item.parent\n while(ref_item){\n if(ref_item.is_lookbehind){\n fail(\"cannot refer to group defined in the same lookbehind subpattern\", pos)\n }\n ref_item = ref_item.parent\n }\n }else if(item.type == \"name\"){\n fail(`unknown group name '${item.value}'`, pos)\n }else if(item.type == \"num\"){\n fail(`invalid group reference ${item.value}`, pos)\n }\n node.add(item)\n }else if(item instanceof Char ||\n item instanceof CharacterClass ||\n item instanceof CharacterSet){\n if(item instanceof CharacterSet){\n for(var elt of item.set.items){\n elt.flags = flags\n }\n }\n var added_to_charseq = false\n if(item instanceof Char){\n if(node.items && node.items.length > 0){\n var previous = $last(node.items)\n if(previous instanceof CharSeq){\n previous.add_char(item)\n added_to_charseq = true\n }else if(previous instanceof Char && ! previous.repeater){\n node.items.pop()\n node.items.push(new CharSeq([previous, item], flags))\n added_to_charseq = true\n }\n }\n }\n if(! added_to_charseq){\n node.add(item)\n }\n }else if(item instanceof Repeater){\n // check that item is not in a lookbehind group\n var pnode = node\n while(pnode){\n if(pnode.extension && pnode.extension.type &&\n pnode.extension.type.indexOf(\"lookbehind\") > -1){\n fail(\"look-behind requires fixed-width pattern\", pos)\n }\n pnode = pnode.parent\n }\n pos = item.pos\n if(node.items.length == 0){\n fail(\"nothing to repeat\", pos)\n }\n previous = $last(node.items)\n if(previous instanceof Char ||\n previous instanceof CharSeq ||\n previous instanceof CharacterClass ||\n previous instanceof CharacterSet ||\n previous instanceof Group ||\n previous instanceof BackReference){\n if(previous instanceof GroupEnd){\n // associate repeat with Group\n previous = previous.group\n }else if(previous instanceof CharSeq){\n previous = $last(previous.chars)\n }\n if(previous.repeater){\n if(item.op == '?' && ! previous.non_greedy){\n if(previous.possessive){\n fail('multiple repeat', pos)\n }\n previous.non_greedy = true\n if(previous instanceof CharacterClass &&\n previous.value == '.'){\n previous.min_repeat_one = true\n }\n }else{\n if(item instanceof Repeater && item.op == '+'){\n if(previous.possessive || previous.non_greedy){\n fail('multiple repeat', pos)\n }\n previous.possessive = true\n }else{\n fail(\"multiple repeat\", pos)\n }\n }\n }else{\n // convert to minimum and maximum number of repeats\n var min = 1,\n max = 1\n if(Array.isArray(item.op)){\n min = item.op[0]\n if(min >= MAXREPEAT){\n throw _b_.OverflowError.$factory(\n \"the repetition number is too large\")\n }\n max = item.op[1] === undefined ? min : item.op[1]\n if(isFinite(max) && max >= MAXREPEAT){\n throw _b_.OverflowError.$factory(\n \"the repetition number is too large\")\n }\n if(max < min){\n fail('min repeat greater than max repeat', pos)\n }\n }else if(item.op == \"?\"){\n min = 0\n max = 1\n }else if(item.op == \"*\"){\n min = 0\n max = Number.POSITIVE_INFINITY\n }else if(item.op == \"+\"){\n min = 1\n max = Number.POSITIVE_INFINITY\n }\n previous.repeater = item\n previous.repeat = {min, max}\n // mark all parents of item as no fixed length\n var parent = item\n while(parent){\n parent.fixed_length = false\n parent = parent.parent\n }\n }\n }else{\n fail(\"nothing to repeat\", pos)\n }\n }else if(item instanceof Or){\n if(group_stack.length > 0){\n item.group = group_stack[group_stack.length - 1]\n }else{\n item.group = false\n }\n pos = item.pos\n if(node instanceof ConditionalBackref){\n // case '(?(num)a|'\n if(node.nb_options == 1){\n node.nb_options++\n }else{\n fail('conditional backref with more than ' +\n 'two branches', pos)\n }\n }else if(node.items.length == 0){\n // token \"|\" in \"(|...)\" : first option is the empty string\n var choice = new Choice(),\n case1 = new Case()\n case1.add(new Char(pos, EmptyString))\n choice.add(case1)\n node.add(choice)\n var case2 = new Case()\n choice.add(case2)\n node = case2\n }else if(node instanceof Case){\n // node.parent is already a Choice\n var new_case = new Case()\n node.parent.add(new_case)\n node = new_case\n }else{\n // token \"|\" in \"(ab|...)\"\n var previous = node.items[node.items.length - 1]\n if(previous instanceof Case){\n var new_case = new Case()\n previous.add(new_case)\n node = new_case\n }else{\n var choice = new Choice(),\n case1 = new Case(),\n first_rank = node.items[0].rank\n while(node.items.length > 0){\n case1.add(node.items.shift())\n }\n case1.groups = node.$groups\n for(var group of group_stack){\n choice.groups.push(group)\n }\n choice.add(case1)\n node.add(choice)\n var case2 = new Case()\n choice.add(case2)\n node = case2\n }\n }\n }else if(item instanceof StringStart ||\n item instanceof StringEnd){\n node.add(item)\n }else if(item instanceof SetFlags){\n if(group_stack.length == 0 && ! allow_global_flags){\n // pattern like (?x) only allowed as first in reg exp\n fail('global flags not at the start of the ' +\n 'expression', item.pos)\n }\n // copy flags, otherwise re.ASCII etc might be modified\n flags = Flag.$factory(flags.value || U.value)\n if(item.on_flags.indexOf('u') > -1){\n if(is_bytes){\n fail(\"re.error: bad inline flags: cannot use 'u' flag \" +\n \"with a bytes pattern\", pos)\n }\n if(flags && flags.value & ASCII.value){\n // switch to Unicode\n flags.value ^= ASCII.value\n }\n if(group_stack.length == 0 &&\n original_flags && original_flags.value & ASCII.value){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n if(item.on_flags.indexOf('a') > -1){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n }\n if(item.on_flags.indexOf('a') > -1){\n if(group_stack.length == 0 &&\n original_flags && original_flags.value & U.value){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n if(flags && flags.value & U.value){\n // switch to ASCII\n flags.value ^= U.value\n }\n if(item.on_flags.indexOf('u') > -1){\n throw _b_.ValueError.$factory(\"ASCII and UNICODE flags \" +\n \"are incompatible\")\n }\n }\n if(flags.value === undefined){\n flags.value = 32\n }\n if(item.items.length == 0){\n if(! accept_inline_flag && group_stack.length == 0){\n var s = from_codepoint_list(pattern)\n warn(_b_.DeprecationWarning,\n `Flags not at the start of the expression '${s}'`,\n pos)\n }\n for(var on_flag of item.on_flags){\n if(! is_bytes || on_flag !== 'a'){\n flags.value |= inline_flags[on_flag].value\n }\n }\n for(var off_flag of item.off_flags){\n if(! is_bytes || off_flag !== 'a'){\n flags.value ^= inline_flags[off_flag].value\n }\n }\n }else{\n node.add(item)\n }\n }else{\n fail(\"unknown item type \" + item, pos)\n }\n if(! (item instanceof SetFlags) &&\n ! (item instanceof Group && item.type == \"flags\")){\n accept_inline_flag = false\n }\n }\n for(ref in backrefs){\n if(groups[ref] === undefined){\n fail('invalid group name ' + ref, backrefs[ref])\n }\n }\n if(group_stack.length > 0){\n var last = group_stack[group_stack.length - 1]\n fail(\"missing ), unterminated subpattern\", last.pos)\n }\n while(node.parent){\n node = node.parent\n }\n node.pattern = from_codepoint_list(pattern)\n node.groups = group_num\n flags = flags === no_flag ? 32 : flags\n node.flags = flags\n var res = {\n node,\n groups,\n flags,\n original_flags,\n text: from_codepoint_list(pattern),\n type, // \"str\" or \"bytes\"\n fixed_length: node.fixed_length()\n }\n if(! cache.has(original_pattern.py_obj)){\n cache.set(original_pattern.py_obj, new Map())\n }\n cache.get(original_pattern.py_obj).set(original_flags.value || 0, res)\n if(_debug.value){\n show(node)\n }\n return res\n}\n\nfunction show(node, indent){\n indent = indent === undefined ? 0 : indent\n if(indent == 0){\n log('root', node)\n }\n log(' '.repeat(indent) + node)\n if(node.items !== undefined){\n for(var item of node.items){\n show(item, indent + 1)\n }\n }\n}\n\nfunction to_codepoint_list(s){\n var items = []\n if(typeof s == \"string\" || $B.$isinstance(s, _b_.str)){\n if(typeof s != \"string\"){\n s = s.valueOf()\n }\n for(var char of s){\n items.push(char.codePointAt(0))\n }\n items.type = \"unicode\"\n }else if($B.$isinstance(s, [_b_.bytes, _b_.bytearray, _b_.memoryview])){\n if($B.$isinstance(s, _b_.memoryview)){\n items = s.obj.source\n }else{\n items = s.source\n }\n items.type = \"bytes\"\n }else{\n throw Error('invalid type ' + $B.class_name(s))\n }\n return items\n}\n\n$B.nb_from_cp = 0\nfunction from_codepoint_list(codepoints, type){\n $B.nb_from_cp++\n // Return a string\n if(type == \"bytes\"){\n return _b_.bytes.$factory(codepoints)\n }\n var s = ''\n for(var cp of codepoints){\n s += _b_.chr(cp)\n }\n return $B.String(s)\n}\n\nfunction string2bytes(s){\n var t = []\n for(var i = 0, len = s.length; i < len; i++){\n t.push(s.charCodeAt(i))\n }\n return _b_.bytes.$factory(t)\n}\n\nfunction check_pattern_flags(pattern, flags){\n if(pattern.__class__ === Pattern){\n if(flags !== no_flag){\n throw _b_.ValueError.$factory(\n \"cannot process flags argument with a compiled pattern\")\n }\n }\n return pattern\n}\n\nfunction StringObj(obj){\n // A StringObj object is a bridge between a Python string or bytes-like\n // object and Javascript\n // obj is the Python object\n // this.string is a Javascript string\n this.py_obj = obj\n this.codepoints = []\n this.type = \"str\"\n this.is_string = typeof obj == 'string'\n if(typeof obj == \"string\" ||\n (obj instanceof String && ! obj.codepoints)){\n // Python object represented as a Javascript string\n this.string = obj\n // Maps a position in codepoints to position in string\n this.index_map = {}\n for(var i = 0, len = obj.length; i < len; i++){\n this.index_map[this.codepoints.length] = i\n var cp = obj.codePointAt(i)\n this.codepoints.push(cp)\n if(cp >= 0x10000){\n i++\n }\n }\n this.length = _b_.str.__len__(obj)\n if(obj instanceof String){\n // store for next use\n obj.codepoints = this.codepoints\n obj.index_map = this.index_map\n }\n }else if(obj instanceof String){\n // string with surrogate pairs\n this.string = obj.string\n this.codepoints = obj.codepoints\n this.index_map = obj.index_map\n this.length = _b_.str.__len__(obj)\n }else if($B.$isinstance(obj, _b_.str)){ // str subclass\n var so = new StringObj(_b_.str.$factory(obj))\n this.string = so.string\n this.codepoints = so.codepoints\n this.length = _b_.str.__len__(obj)\n }else if($B.$isinstance(obj, [_b_.bytes, _b_.bytearray])){\n this.string = _b_.bytes.decode(obj, 'latin1')\n this.codepoints = obj.source\n this.type = \"bytes\"\n }else if($B.$isinstance(obj, _b_.memoryview)){\n this.string = _b_.bytes.decode(obj.obj, 'latin1')\n this.codepoints = obj.obj.source\n this.type = \"bytes\"\n }else if(obj.__class__ && obj.__class__.$buffer_protocol){\n // eg array.array\n this.codepoints = _b_.list.$factory(obj)\n this.string = from_codepoint_list(this.codepoints, \"bytes\")\n this.type = \"bytes\"\n }else if(Array.isArray(obj)){\n // list of codepoints\n this.codepoints = obj\n }else{\n throw _b_.TypeError.$factory(\n `expected string or bytes-like object, got '${$B.class_name(obj)}'`)\n }\n if(this.length === undefined){\n this.length = this.codepoints.length\n }\n}\n\nStringObj.prototype.cp_at = function(pos){\n if(pos >= this.length){\n return undefined\n }\n /*\n if(typeof this.string == 'string'){\n return this.string.charCodeAt(pos)\n }\n */\n var res = this.codepoints[pos]\n if(res !== undefined){\n return res\n }\n}\n\nStringObj.prototype.substring = function(start, end){\n // Returns a string\n var s\n if(this.string && this.index_map){\n if(this.index_map[start] === undefined){\n return ''\n }\n if(end === undefined){\n return this.string.substr(this.index_map[start])\n }\n return this.string.substring(this.index_map[start],\n this.index_map[end])\n }\n var codepoints,\n res = ''\n if(end === undefined){\n codepoints = this.codepoints.slice(start)\n }else{\n codepoints = this.codepoints.slice(start, end)\n }\n return from_codepoint_list(codepoints, this.type)\n}\n\nStringObj.prototype.to_str = function(){\n if(this.hasOwnProperty('string')){\n return this.string\n }\n return from_codepoint_list(this.codepoints, this.type)\n}\n\nStringObj.from_codepoints = function(cps){\n var res = new StringObj('')\n res.codepoints = cps\n for(var cp of cps){\n res.string += _b_.chr(cp)\n }\n return res\n}\n\nfunction prepare(args){\n // Check that all arguments are of the same type (string or bytes-like).\n // Return an object with all attributes transformed into StringObj\n // instances\n var res = {},\n keys = Object.keys(args),\n first = keys[0]\n res[first] = new StringObj(args[first])\n res.type = res[first].type\n for(var key of keys.slice(1)){\n res[key] = new StringObj(args[key])\n if(res[key].type != res.type){\n throw _b_.TypeError.$factory(`not the same type for ${first} and ${key}`)\n }\n }\n return res\n}\n\n\nfunction subn(pattern, repl, string, count, flags){\n // string is a StringObj instance\n // pattern is either a Pattern instance or a StringObj instance\n var t0 = window.performance.now()\n var res = '',\n pos = 0,\n nb_sub = 0\n\n if(pattern instanceof StringObj){\n pattern = compile(pattern, flags)\n }\n if(typeof repl != \"function\"){\n var data1 = transform_repl({repl}, pattern)\n repl1 = data1.repl1\n }\n pos = 0\n var s = string.to_str()\n for(var bmo of $module.finditer(Pattern.$factory(pattern), s).js_gen){\n // finditer yields instances of MatchObject\n var mo = bmo.mo // instance of MO\n res += from_codepoint_list(string.codepoints.slice(pos, mo.start))\n if(typeof repl == \"function\"){\n var x = $B.$call(repl)(bmo)\n if(x.__class__ === _b_.bytes){\n x = _b_.bytes.decode(x, 'latin-1')\n }\n res += x // $B.$call(repl)(bmo)\n }else{\n res += repl1\n }\n nb_sub++\n pos = mo.end\n if(count != 0 && nb_sub >= count){\n break\n }\n }\n if(string.is_string){\n res += string.string.substr(pos)\n }else{\n res += from_codepoint_list(string.codepoints.slice(pos))\n }\n if(pattern.type === \"bytes\"){\n res = _b_.str.encode(res, \"latin-1\")\n }\n return [res, nb_sub]\n}\n\n// escaped chars : '\\t\\n\\x0b\\x0c\\r #$&()*+-.?[\\\\]^{|}~'\nvar escaped = [9, 10, 11, 12, 13, 32, 35, 36, 38, 40, 41, 42, 43, 45, 46, 63,\n 91, 92, 93, 94, 123, 124, 125, 126]\n\nfunction starts_with_string_start(pattern){\n // returns true if the pattern starts with ^ or \\A\n if(pattern.node){\n pattern = pattern.node\n }\n if(pattern.items){\n if(pattern.items.length == 0){\n return false\n }\n return starts_with_string_start(pattern.items[0])\n }else if(pattern instanceof CharacterClass){\n return pattern.value == 'A'\n }else if(pattern instanceof StringStart){\n return true\n }else{\n return false\n }\n}\n\nfunction* iterator(pattern, string, flags, original_string, pos, endpos){\n var result = [],\n pos = pos | 0,\n cp,\n accept_one = true // used to test one position after string end\n while((cp = string.cp_at(pos)) !== undefined || accept_one){\n var mo = match(pattern, string, pos, endpos)\n if(mo){\n yield MatchObject.$factory(mo)\n if(mo.end == mo.start){\n // If match has zero with, retry at the same position but\n // with the flag no_zero_width set, to avoid infinite loops\n mo = match(pattern, string, pos, endpos, true)\n if(mo){\n yield MatchObject.$factory(mo)\n pos = mo.end\n }else{\n pos++ // at least 1, else infinite loop\n }\n }else{\n pos = mo.end\n }\n }else{\n pos++\n }\n if(cp === undefined){\n accept_one = false\n }\n if(starts_with_string_start(pattern)){\n break\n }\n }\n delete original_string.in_iteration\n}\n\n\nfunction MO(node, pos, mo, len){\n // Match Object\n this.node = node\n this.start = pos\n this.mo = mo\n this.nb_min = mo.nb_min\n this.nb_max = mo.nb_max\n this.len = len\n this.nb = this.node.non_greedy ? mo.nb_min : mo.nb_max\n this.end = pos + len * this.nb\n}\n\nMO.prototype.backtrack = function(string, groups){\n if(this.node.possessive){\n return false\n }\n if(this.node.non_greedy && this.nb < this.nb_max){\n this.nb++\n this.end = this.start + this.len * this.nb\n return true\n }else if((! this.node.non_greedy) && this.nb > this.nb_min){\n this.nb--\n this.end = this.start + this.len * this.nb\n return true\n }else{\n return false\n }\n}\n\nfunction del_groups(groups, node){\n if(node.num !== undefined){\n delete groups[node.num]\n groups.$last.splice(groups.$last.indexOf(node.num), 1)\n if(node.name !== undefined){\n delete groups[node.name]\n }\n }\n for(var child of node.items){\n if(child instanceof Group){\n del_groups(groups, child)\n }\n }\n}\n\nfunction GroupMO(node, start, matches, string, groups, endpos){\n // Match Object for Groups\n this.node = node\n this.start = start\n this.matches = matches\n this.string = string\n this.end = matches.length > 0 ? $last(matches).end : start\n this.endpos = endpos === undefined ? this.end : endpos\n this.$groups = groups\n}\n\n$B.nb_group_backtrack = 0\n$B.t_group_backtrack = 0\n\nGroupMO.prototype.backtrack = function(string, groups){\n if(_debug.value){\n console.log('group MO backtrack, this', this)\n alert()\n }\n $B.nb_group_backtrack++\n var t0 = performance.now()\n // Try backtracking in the last match\n if(this.node.possessive || this.node.atomic){\n return false\n }\n if(this.matches.length > 0){\n var _match = $last(this.matches),\n mos = _match.mos,\n nb0 = mos.length\n while(mos.length > 0){\n var mo = mos.pop()\n if(mo.node instanceof Case){\n var rank = mo.node.parent.items.indexOf(mo.node)\n for(var _case of mo.node.parent.items.slice(rank + 1)){\n var _mo = match({node: _case, text: _case.text},\n string, mo.start)\n if(_mo){\n // update GroupMO object\n mos.push(_mo)\n this.end = _mo.end\n if(this.$groups.$last.length > 0){\n var ix = this.$groups.$last[this.$groups.$last.length - 1]\n this.$groups[ix].end = _mo.end\n }\n $B.t_group_backtrack += performance.now() - t0\n return true\n }\n }\n }\n if(mo.backtrack(string, groups)){\n mos.push(mo)\n if(this.node.num !== undefined){\n groups[this.node.num].end = mo.end\n }\n this.end = mo.end\n $B.t_group_backtrack += performance.now() - t0\n return true\n }\n }\n }\n // Else, remove last match if possible\n if(this.matches.length > this.node.repeat.min &&\n this.matches.length >= 1){\n this.matches.pop()\n if(this.matches.length > 0){\n this.end = $last(this.matches).end\n }else{\n // remove this group and its children from groups\n del_groups(groups, this.node)\n this.end = this.start\n }\n $B.t_group_backtrack += performance.now() - t0\n return true\n }\n // Group fails; if some of its subgroups succeded, remove them from\n // groups\n if(this.node.repeat.min > 0){\n del_groups(groups, this.node)\n }\n $B.t_group_backtrack += performance.now() - t0\n return false\n}\n\nGroupMO.prototype.toString = function(){\n var repr = _b_.repr(this.string.substring(this.start, this.end))\n repr = repr.substring(0, 50)\n return ''\n}\n\nGroupMO.prototype.groups = function(_default){\n var res = [],\n groupobj = this.$groups\n\n for(var key in this.node.$groups){\n if(isFinite(key)){\n res[key] = groupobj[key] === undefined ? _default :\n this.string.substring(groupobj[key].start, groupobj[key].end)\n }\n }\n res.shift()\n return $B.fast_tuple(res)\n}\n\n// Brython MatchObject\nvar MatchObject = $B.make_class(\"Match\",\n function(mo){\n return {\n __class__: MatchObject,\n mo\n }\n }\n)\n\nMatchObject.__copy__ = function(self){\n return self\n}\n\nMatchObject.__deepcopy__ = function(self){\n return self\n}\n\nMatchObject.__getitem__ = function(){\n var $ = $B.args(\"__getitem__\", 2, {self: null, key: null},\n ['self', 'key'], arguments, {}, null, null),\n self = $.self,\n key = $.key\n if(Array.isArray(key)){\n throw _b_.IndexError.$factory(\"no such group\")\n }\n if(key == 0){\n return self.mo.string.substring(self.mo.start, self.mo.end)\n }\n var match = self.mo.$groups[key]\n if(match !== undefined){\n return self.mo.string.substring(match.start, match.end)\n }else if(self.mo.node.$groups[key] !== undefined){\n return _b_.None\n }\n throw _b_.IndexError.$factory(\"no such group\")\n}\n\nMatchObject.__repr__ = MatchObject.__str__ = function(self){\n return self.mo.toString()\n}\n\nMatchObject.end = function(self){\n var $ = $B.args('end', 2, {self: null, group: null}, ['self', 'group'],\n arguments, {group: 0}, null, null)\n var group = MatchObject.group(self, $.group)\n if(group === _b_.None){\n return -1\n }else if($.group == 0){\n return self.mo.end\n }else{\n return self.mo.$groups[$.group].end\n }\n}\n\nMatchObject.endpos = _b_.property.$factory(\n function(self){\n return self.mo.endpos\n }\n)\n\nMatchObject.expand = function(){\n var $ = $B.args(\"expand\", 2, {self: null, template: null},\n ['self', 'template'], arguments, {}, null, null)\n var data = {\n repl: new StringObj($.template),\n }\n data = transform_repl(data, {groups: $.self.mo.node.$groups})\n if(typeof data.repl == \"function\"){\n return $B.$call(data.repl)(MatchObject.$factory($.self.mo))\n }else{\n return data.repl1\n }\n}\n\nMatchObject.group = function(self){\n var $ = $B.args(\"group\", 1, {self: null}, ['self'], arguments,\n {}, 'args', null),\n self = $.self,\n args = $.args\n if(args.length == 0){\n args[0] = 0\n }\n var groupobj = self.mo.$groups,\n result = []\n for(var group_id of args){\n if($B.rich_comp('__eq__', group_id, 0)){\n result.push(self.mo.string.substring(self.mo.start, self.mo.end))\n continue\n }\n try{\n // Convert group_id to int if possible\n group_id = $B.PyNumber_Index(group_id) // in py_utils.js\n }catch(err){\n // group_id can be an identifier\n }\n if(self.mo.node.$groups[group_id] === undefined){\n throw _b_.IndexError.$factory(\"no such group\")\n }\n var group = groupobj[group_id] // found in match\n result.push(group === undefined ?\n _b_.None :\n self.mo.string.substring(group.start, group.end))\n }\n if(args.length == 1){\n return result[0]\n }\n return $B.fast_tuple(result)\n}\n\nMatchObject.groupdict = function(){\n /*\n Return a dictionary containing all the named subgroups of the match, keyed\n by the subgroup name. The default argument is used for groups that did not\n participate in the match; it defaults to None.\n */\n var $ = $B.args(\"groupdict\", 2, {self: null, default: null},\n ['self', 'default'], arguments, {default: _b_.None},\n null, null),\n self = $.self,\n groupobj = $.self.mo.$groups,\n d = $B.empty_dict()\n for(var key in $.self.mo.node.$groups){\n if(! isFinite(key)){\n var value = groupobj[key] === undefined ? $.default :\n groupobj[key]\n if(value !== $.default){\n value = self.mo.string.substring(value.start, value.end)\n }\n _b_.dict.$setitem(d, key, value)\n }\n }\n return d\n}\n\nMatchObject.groups = function(self){\n var $ = $B.args(\"group\", 2, {self: null, default: null},\n ['self', 'default'], arguments,\n {default: _b_.None}, null, null),\n self = $.self,\n _default = $.default\n return self.mo.groups(_default)\n}\n\nMatchObject.lastindex = _b_.property.$factory(\n function(self){\n /* The integer index of the last matched capturing group, or None if\n no group was matched at all.\n */\n var last = self.mo.$groups.$last\n if(last.length == 0){\n return _b_.None\n }\n return parseInt($last(last))\n }\n)\n\nMatchObject.lastgroup = _b_.property.$factory(\n function(self){\n /* The name of the last matched capturing group, or None if the group\n didn't have a name, or if no group was matched at all.\n */\n var lastindex = MatchObject.lastindex.fget(self)\n if(lastindex === _b_.None){\n return _b_.None\n }\n var group = self.mo.node.$groups[lastindex],\n name = group.item.name\n return name === undefined ? _b_.None : name\n }\n)\n\nMatchObject.pos = _b_.property.$factory(\n function(self){\n return self.mo.start\n }\n)\n\nMatchObject.re = _b_.property.$factory(\n function(self){\n return self.mo.node.pattern\n }\n)\n\nMatchObject.regs = _b_.property.$factory(\n function(self){\n var res = [$B.fast_tuple($B.fast_tuple([self.mo.start, self.mo.end]))]\n for(var group_num in self.mo.node.$groups){\n if(isFinite(group_num)){\n var group = self.mo.node.$groups[group_num].item\n // group.pattern includes the opening and closing brackets\n res.push($B.fast_tuple([group.pos,\n group.pos + group.pattern.length - 2]))\n }\n }\n return $B.fast_tuple(res)\n }\n)\n\nMatchObject.span = function(){\n /*\n Match.span([group])\n\n For a match m, return the 2-tuple (m.start(group), m.end(group)). Note\n that if group did not contribute to the match, this is (-1, -1). group\n defaults to zero, the entire match.\n */\n var $ = $B.args(\"span\", 2, {self: null, group: null},\n ['self', 'group'], arguments,\n {group: 0}, null, null),\n self = $.self,\n group = $.group\n if(group == 0){\n return $B.fast_tuple([self.mo.start, self.mo.end])\n }\n var span = self.mo.$groups[group]\n if(span === undefined){\n return $B.fast_tuple([-1, -1])\n }\n return $B.fast_tuple([span.start, span.end])\n}\n\nMatchObject.start = function(self){\n var $ = $B.args('end', 2, {self: null, group: null}, ['self', 'group'],\n arguments, {group: 0}, null, null)\n var group = MatchObject.group(self, $.group)\n if(group === _b_.None){\n return -1\n }else if($.group == 0){\n return self.mo.start\n }else{\n return self.mo.$groups[$.group].start\n }\n}\n\nMatchObject.string = _b_.property.$factory(\n function(self){\n return self.mo.string.to_str()\n }\n)\n\n$B.set_func_names(MatchObject, 're')\n\nfunction log(){\n if(_debug.value){\n console.log.apply(null, arguments)\n }\n}\n\nfunction create_fullmatch_pattern(pattern){\n // transform into \"(?:)$\"\n // use a new pattern object, otherwise if pattern is in cache the\n // value in cache would be changed\n var new_pattern = {}\n for(var key in pattern){\n if(key == 'node'){\n continue\n }\n new_pattern[key] = pattern[key]\n }\n\n var ncgroup = new Group() // non-capturing group\n ncgroup.pos = 0\n ncgroup.non_capturing = true\n for(var item of pattern.node.items){\n ncgroup.add(item)\n }\n var se = new StringEnd()\n se.flags = Flag.$factory(32)\n new_pattern.node = new Node()\n new_pattern.node.add(ncgroup)\n new_pattern.node.add(se)\n return new_pattern\n}\n\nfunction match(pattern, string, pos, endpos, no_zero_width, groups){\n // Follow the pattern tree structure\n if(_debug.value){\n console.log('match pattern', pattern.text, 'pos', pos, string.substring(pos))\n alert()\n }\n if(endpos !== undefined){\n if(endpos < pos){\n return false\n }\n }else{\n endpos = string.length\n }\n if(pattern.node instanceof Node){\n show(pattern.node)\n }\n if(groups === undefined){\n groups = {$last:[]}\n }\n if(pattern.text === undefined){\n console.log('no text', pattern)\n }\n var node = pattern.node,\n mo\n if(node.items){\n // node is either a Choice between several items, or a sequence of\n // items\n if(node instanceof Choice){\n mo = false\n for(var _case of node.items){\n mo = match({node: _case, text: _case.text}, string, pos,\n endpos, no_zero_width, groups)\n if(mo){\n // remove groups inside choice and before successful case\n // that did not contribute to the match\n var groups_succeed = groups_in(_case),\n min_num = Math.min(Array.from(groups_succeed))\n for(var group_num of groups_in(node)){\n if(group_num < min_num){\n delete groups[group_num]\n }\n }\n if(_debug.value){\n console.log('case', _case + '', 'of choice', node +\n ' succeeds, groups', groups)\n }\n return mo\n }else{\n if(_debug.value){\n console.log('case', _case + '', 'of choice', node +\n ' fails')\n }\n }\n }\n return false\n }else{\n // sequence of items\n node.repeat = node.repeat === undefined ? {min: 1, max: 1} :\n node.repeat\n var start = pos,\n nb_repeat = 0,\n nb_zerolength_repeat = 0,\n matches = [],\n mos,\n match_start,\n empty_matches = {}\n // loop until we get enough repetitions\n while(true){\n if(empty_matches[pos]){\n // no use trying again\n return matches.length == 0 ? false :\n new GroupMO(node, start, matches, string, groups,\n endpos)\n }\n var initial_groups = Object.keys(groups)\n mos = []\n match_start = pos\n if(_debug.value){\n console.log(\"pattern\", pattern.text,\n \"loop in group match, match start\", match_start)\n }\n var i = 0\n while(i < node.items.length){\n var item = node.items[i]\n if(_debug.value){\n console.log('item', i, '/', node.items.length - 1,\n 'of pattern', pattern.text)\n }\n var mo = match({node: item, text: item + ''}, string, pos,\n endpos, no_zero_width, groups)\n if(mo){\n if(item instanceof Group &&\n item.type == \"lookahead_assertion\"){\n log(\"lookahead assertion\", item + '',\n \"succeeds, mo\", mo)\n }else{\n mos.push(mo)\n pos = mo.end\n }\n i++\n }else if(false && item instanceof Group &&\n item.type == \"negative_lookahead_assertion\"){\n log(\"negative lookahead assertion\", item, \"fails : ok !\")\n i++\n }else{\n if(_debug.value){\n console.log('item ' + item, 'of group fails, nb_repeat',\n nb_repeat, 'node repeat', node.repeat)\n }\n var backtrack = false\n while(mos.length > 0){\n var mo = mos.pop()\n if(mo.backtrack === undefined){\n log('no backtrack for', mo)\n }\n if(_debug.value){\n console.log('try backtrack on mo', mo)\n }\n if(mo.backtrack(string, groups)){\n log('can backtrack, mo', mo)\n mos.push(mo)\n i = mos.length\n log('mos', mos, 'restart at item', i)\n pos = mo.end\n backtrack = true\n break\n }\n }\n if(backtrack){\n log('backtrack ok')\n continue\n }else{\n if(node.type == \"negative_lookahead_assertion\"){\n // If a negative lookahead assertion fails,\n // return a match\n var res = new GroupMO(node, start, matches,\n string, groups, endpos)\n return res\n }\n if(nb_repeat == 0){\n // remove the groups introduced before\n // reaching this point\n for(var key in groups){\n if(initial_groups.indexOf(key) == -1){\n delete groups[key]\n }\n }\n }\n if(nb_repeat >= node.repeat.min){\n log(\"enough repetitions for node\", node)\n if(node.type == \"negative_lookahead_assertion\"){\n return false\n }\n return new GroupMO(node, start, matches, string,\n groups, endpos)\n }\n return false\n }\n }\n }\n if(node.type == \"negative_lookahead_assertion\"){\n // If a negative lookahead succeeds, return false\n return false\n }\n nb_repeat++\n if(pos > match_start){\n nb_zerolength_repeat = 0\n }else{\n nb_zerolength_repeat++\n empty_matches[pos] = true\n }\n matches.push({start: match_start, end: pos, mos})\n if(node.num !== undefined){\n groups[node.num] = $last(matches)\n if(node.name !== undefined){\n groups[node.name] = groups[node.num]\n }\n if(node.num != $last(groups.$last)){\n var ix = groups.$last.indexOf(node.num)\n if(ix > -1){\n groups.$last.splice(ix, 1)\n }\n groups.$last.push(node.num)\n }\n }\n if(nb_repeat >= node.repeat.max){\n var res = new GroupMO(node, start, matches, string,\n groups, endpos)\n if(res.start == res.end && no_zero_width){\n // no_zero_width is set when previous match in\n // iterator() had length 0; avoids infinite loops\n return false\n }\n return res\n }\n log('loop on group', pattern.text, 'nb repeats', nb_repeat,\n 'nb zero length', nb_zerolength_repeat, 'groups', groups)\n if(nb_zerolength_repeat == 65535){\n return matches.length == 0 ? false :\n new GroupMO(node, start, matches, string, groups,\n endpos)\n }\n }\n }\n }else{\n // for BackReference, Char, CharSeq, CharacterClass, CharacterSet,\n // ConditionalBackref, Lookbehind, StringStart, StringEnd\n var mo = node.match(string, pos, endpos, groups)\n if(_debug.value){\n console.log(node + '', \"mo\", mo)\n }\n if(mo){\n var len = mo.group_len === undefined ? 1 : mo.group_len,\n ix = node.non_greedy ? mo.nb_min : mo.nb_max,\n end = pos + len * ix\n return new MO(node, pos, mo, len)\n }else{\n return false\n }\n }\n}\n\n// expose re module API\nvar $module = {\n cache: cache,\n compile: function(){\n var $ = $B.args(\"compile\", 2, {pattern: null, flags: null},\n ['pattern', 'flags'], arguments, {flags: no_flag},\n null, null)\n if($.pattern && $.pattern.__class__ === Pattern){\n if($.flags !== no_flag){\n throw _b_.ValueError.$factory(\n \"cannot process flags argument with a compiled pattern\")\n }\n return $.pattern\n }\n $.pattern = check_pattern_flags($.pattern, $.flags)\n var data = prepare({pattern: $.pattern})\n if(typeof $.flags == \"number\"){\n $.flags = Flag.$factory($.flags)\n }\n var jspat = compile(data.pattern, $.flags)\n return Pattern.$factory(jspat)\n },\n error: error,\n escape: function(){\n var $ = $B.args(\"escape\", 1, {pattern: null}, ['pattern'], arguments,\n {}, null, null),\n data = prepare({pattern: $.pattern}),\n pattern = data.pattern,\n res = []\n for(var cp of pattern.codepoints){\n if(escaped.indexOf(cp) > -1){\n res.push(BACKSLASH)\n }\n res.push(cp)\n }\n res = from_codepoint_list(res, data.type)\n if(data.type == \"bytes\" && $B.$isinstance(res, _b_.str)){\n res = _b_.str.encode(res, 'latin1')\n }\n return res\n },\n findall: function(){\n /* Return all non-overlapping matches of pattern in string, as a list\n of strings. The string is scanned left-to-right, and matches are\n returned in the order found. If one or more groups are present in\n the pattern, return a list of groups; this will be a list of tuples\n if the pattern has more than one group. Empty matches are included\n in the result.\n */\n var $ = $B.args(\"findall\", 3,\n {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags,\n data\n pattern = check_pattern_flags(pattern, flags)\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n }else{\n data = prepare({string, pattern})\n pattern = Pattern.$factory(compile(data.pattern, flags))\n }\n if(data.type === \"str\"){\n function conv(s){\n return s === EmptyString ? '' : s\n }\n }else{\n function conv(s){\n return string2bytes(s)\n }\n }\n\n var iter = $module.finditer.apply(null, arguments).js_gen,\n res = []\n while(true){\n var next = iter.next()\n if(next.done){\n return res\n }\n var bmo = next.value,\n mo = bmo.mo,\n groups = MatchObject.groups(bmo)\n\n // replace None by the empty string\n for(var i = 0, len = groups.length; i < len; i++){\n groups[i] = groups[i] === _b_.None ? \"\" : groups[i]\n }\n if(groups.length > 0){\n if(groups.length == 1){\n res.push(groups[0])\n }else{\n res.push($B.fast_tuple(groups))\n }\n }else{\n res.push(mo.string.substring(mo.start, mo.end))\n }\n }\n console.log(\"end findall\")\n },\n finditer: function(){\n var $ = $B.args(\"finditer\", 3,\n {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags\n if($B.$isinstance(string, [_b_.bytearray, _b_.memoryview])){\n string.in_iteration = true\n }\n var original_string = string,\n data\n pattern = check_pattern_flags(pattern, flags)\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n flags = pattern.flags\n }else{\n data = prepare({string, pattern})\n pattern = Pattern.$factory(compile(data.pattern, flags))\n }\n if(pattern.__class__ !== Pattern){\n throw Error(\"pattern not a Python object\")\n }\n return $B.generator.$factory(iterator)(pattern.$pattern, data.string,\n flags, original_string)\n },\n fullmatch: function(){\n var $ = $B.args(\"fullmatch\", 3, {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags\n pattern = check_pattern_flags(pattern, flags)\n var data\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n pattern = pattern.$pattern\n }else{\n data = prepare({pattern, string})\n pattern = compile(data.pattern, flags)\n }\n\n var new_pattern = create_fullmatch_pattern(pattern)\n\n // match transformed RE\n var res = match(new_pattern, data.string, 0)\n var bmo = res === false ? _b_.None : MatchObject.$factory(res)\n if(bmo !== _b_.None){\n if(bmo.mo.string.codepoints.length != bmo.mo.end - bmo.mo.start){\n return _b_.None\n }else{\n return bmo\n }\n }\n return _b_.None\n },\n Match: MatchObject,\n match: function(){\n var $ = $B.args(\"match\", 3, {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags\n pattern = check_pattern_flags(pattern, flags)\n var data\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n pattern = pattern.$pattern\n }else{\n data = prepare({pattern, string})\n pattern = compile(data.pattern, flags)\n }\n var res = match(pattern, data.string, 0)\n return res === false ? _b_.None : MatchObject.$factory(res)\n },\n Pattern,\n purge: function(){\n var $ = $B.args(\"purge\", 0, {}, [], arguments, {}, null, null)\n cache.clear()\n return _b_.None\n },\n _reconstructor,\n Scanner,\n search: function(){\n var $ = $B.args(\"search\", 3, {pattern: null, string: null, flags: null},\n ['pattern', 'string', 'flags'], arguments,\n {flags: no_flag}, null, null),\n pattern = $.pattern,\n string = $.string,\n flags = $.flags,\n data\n pattern = check_pattern_flags(pattern, flags)\n if(pattern.__class__ === Pattern){\n data = prepare({string})\n }else{\n data = prepare({string, pattern})\n pattern = Pattern.$factory(compile(data.pattern, flags))\n }\n data.pattern = pattern\n // optimizations\n if(pattern.pattern.startsWith('\\\\A') ||\n pattern.pattern.startsWith('^')){\n if(! (pattern.$pattern.node.items[0] instanceof Choice)){\n var mo = match(data.pattern.$pattern, data.string, 0)\n if(mo){\n return MatchObject.$factory(mo)\n }else if(pattern.flags.value & MULTILINE.value){\n var pos = 0,\n cp\n while((cp = data.string.cp_at(pos)) !== undefined){\n if(cp == LINEFEED){\n mo = match(data.pattern.$pattern, data.string, pos + 1)\n if(mo){\n return MatchObject.$factory(mo)\n }\n }\n pos++\n }\n }else{\n return _b_.None\n }\n }\n }\n if(pattern.$pattern.fixed_length !== false &&\n isFinite(pattern.$pattern.fixed_length) &&\n pattern.pattern.endsWith('$') &&\n ! (pattern.flags.value & MULTILINE.value)){\n var mo = match(data.pattern.$pattern, data.string,\n data.string.length - pattern.$pattern.fixed_length)\n if(mo){\n return MatchObject.$factory(mo)\n }\n return _b_.None\n }\n var pos = 0\n if(data.string.codepoints.length == 0){\n mo = match(data.pattern.$pattern, data.string, 0)\n if(mo){\n mo.start = mo.end = 0\n }\n return mo ? MatchObject.$factory(mo) : _b_.None\n }\n while(pos < data.string.codepoints.length){\n var mo = match(data.pattern.$pattern, data.string, pos)\n if(mo){\n return MatchObject.$factory(mo)\n }else{\n pos++\n }\n }\n return _b_.None\n },\n set_debug: function(value){\n _debug.value = value\n },\n split: function(){\n var $ = $B.args(\"split\", 4,\n {pattern: null, string: null, maxsplit: null, flags: null},\n ['pattern', 'string', 'maxsplit', 'flags'],\n arguments, {maxsplit: 0, flags: no_flag}, null, null)\n var res = [],\n pattern = $.pattern,\n string = $.string,\n flags = $.flags,\n pos = 0,\n nb_split = 0,\n data\n if(pattern.__class__ !== Pattern){\n data = prepare({pattern, string})\n var comp = compile(data.pattern, flags)\n pattern = Pattern.$factory(comp)\n }else{\n data = {pattern, string}\n }\n for(var bmo of $module.finditer(pattern, $.string).js_gen){\n var mo = bmo.mo, // finditer returns instances of MatchObject\n groupobj = mo.$groups\n res.push(data.string.substring(pos, mo.start))\n for(var key in mo.node.$groups){\n if(isFinite(key)){\n if(groupobj[key] !== undefined){\n res.push(data.string.substring(groupobj[key].start,\n groupobj[key].end))\n }else{\n res.push(_b_.None)\n }\n }\n }\n nb_split++\n pos = mo.end\n if(pos >= $.string.length){\n break\n }\n if($.maxsplit != 0 && nb_split >= $.maxsplit){\n break\n }\n }\n res.push(data.string.substring(pos))\n if(data.type === \"bytes\"){\n res = res.map(\n function(x){\n return $B.$isinstance(x, _b_.bytes) ?\n x :\n _b_.str.encode(x, \"latin-1\")\n }\n )\n }\n return res\n },\n sub: function(){\n var $ = $B.args(\"sub\", 5,\n {pattern: null, repl: null, string: null, count: null, flags: null},\n ['pattern', 'repl', 'string', 'count', 'flags'],\n arguments, {count: 0, flags: no_flag}, null, null),\n pattern = $.pattern,\n repl = $.repl,\n string = $.string,\n count = $.count,\n flags = $.flags,\n data\n check_pattern_flags(pattern, flags)\n if(typeof repl != \"function\"){\n if(pattern.__class__ != Pattern){\n data = prepare({pattern, string, repl})\n pattern = compile(data.pattern, flags)\n }else{\n data = prepare({string, repl})\n flags = pattern.flags\n pattern = pattern.$pattern\n }\n data = transform_repl(data, pattern)\n }else{\n if(pattern.__class__ != Pattern){\n data = prepare({pattern, string})\n pattern = compile(data.pattern, flags)\n }else{\n data = prepare({string})\n flags = pattern.flags\n pattern = pattern.$pattern\n }\n data.repl = repl\n }\n return subn(pattern, data.repl, data.string, count, flags)[0]\n },\n subn: function(){\n var $ = $B.args(\"sub\", 5,\n {pattern: null, repl: null, string: null, count: null, flags: null},\n ['pattern', 'repl', 'string', 'count', 'flags'],\n arguments, {count: 0, flags: no_flag}, null, null),\n pattern = $.pattern,\n repl = $.repl,\n string = $.string,\n count = $.count,\n flags = $.flags,\n data\n if(pattern.__class__ != Pattern){\n data = prepare({pattern, repl, string})\n }else{\n data = prepare({repl, string})\n data.pattern = pattern.$pattern\n }\n return $B.fast_tuple(subn(data.pattern, data.repl, data.string, count,\n flags))\n }\n\n}\n\nvar ASCII = $module.A = $module.ASCII = Flag.$factory(256)\nvar IGNORECASE = $module.I = $module.IGNORECASE = Flag.$factory(2)\nvar LOCALE = $module.L = $module.LOCALE = Flag.$factory(4)\nvar MULTILINE = $module.M = $module.MULTILINE = Flag.$factory(8)\nvar DOTALL = $module.S = $module.DOTALL = Flag.$factory(16)\nvar U = $module.U = $module.UNICODE = Flag.$factory(32)\nvar VERBOSE = $module.X = $module.VERBOSE = Flag.$factory(64)\n$module.cache = cache\n$module._compile = $module.compile\n\n\nvar inline_flags = {\n i: IGNORECASE,\n L: LOCALE,\n m: MULTILINE,\n s: DOTALL,\n u: U,\n x: VERBOSE,\n a: ASCII\n}\n\nvar flag_names = {\n i: 'IGNORECASE',\n L: 'LOCALE',\n m: 'MULTILINE',\n s: 'DOTALL',\n u: 'U',\n x: 'VERBOSE',\n a: 'ASCII'\n}\n"], "unicodedata": [".js", "// Implementation of unicodedata\n\nvar $module = (function($B){\n\n var _b_ = $B.builtins\n\n // Load unicode table if not already loaded\n if($B.unicodedb === undefined){\n var xhr = new XMLHttpRequest\n xhr.open(\"GET\",\n $B.brython_path + \"unicode.txt\", false)\n xhr.onreadystatechange = function(){\n if(this.readyState == 4){\n if(this.status == 200){\n $B.unicodedb = this.responseText\n }else{\n console.log(\"Warning - could not \" +\n \"load unicode.txt\")\n }\n }\n }\n xhr.send()\n }\n\n function _info(chr){\n var ord = _b_.ord(chr),\n hex = ord.toString(16).toUpperCase()\n while(hex.length < 4){hex = \"0\" + hex}\n var re = new RegExp(\"^\" + hex +\";(.+?);(.*?);(.*?);(.*?);(.*?);(.*);(.*);(.*)$\",\n \"m\"),\n search = re.exec($B.unicodedb)\n if(search === null){\n return null\n }else{\n return {\n name: search[1],\n category: search[2],\n combining: search[3],\n bidirectional: search[4],\n decomposition: search[5],\n decimal: search[6],\n digit: search[7],\n numeric: search[8]\n }\n }\n }\n\n function bidirectional(chr){\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr, hex)\n throw _b_.KeyError.$factory(chr)\n }\n return search.bidirectional\n }\n\n function category(chr){\n // Returns the general category assigned to the character chr as\n // string.\n if(/\\p{Cn}/u.test(chr.charAt(0))){\n return \"Cn\"\n }\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return search.category\n }\n\n function combining(chr){\n // Returns the general category assigned to the character chr as\n // string.\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return parseInt(search.combining)\n }\n\n function decimal(chr, _default){\n // Returns the decimal value assigned to the character chr as integer.\n // If no such value is defined, default is returned, or, if not given,\n // ValueError is raised.\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return parseInt(search.decimal)\n }\n\n function decomposition(chr, _default){\n // Returns the decimal value assigned to the character chr as integer.\n // If no such value is defined, default is returned, or, if not given,\n // ValueError is raised.\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return search.decomposition\n }\n\n function digit(chr, _default){\n // Returns the decimal value assigned to the character chr as integer.\n // If no such value is defined, default is returned, or, if not given,\n // ValueError is raised.\n var search = _info(chr)\n if(search === null){\n console.log(\"error\", chr)\n throw _b_.KeyError.$factory(chr)\n }\n return parseInt(search.digit)\n }\n\n function lookup(name){\n // Look up character by name. If a character with the given name is\n // found, return the corresponding character. If not found, KeyError\n // is raised.\n var re = new RegExp(\"^([0-9A-F]+);\" +\n name + \";(.*)$\", \"m\")\n search = re.exec($B.unicodedb)\n if(search === null){\n throw _b_.KeyError.$factory(\"undefined character name '\" +\n name + \"'\")\n }\n var res = parseInt(search[1], 16)\n return _b_.chr(res)\n }\n\n function name(chr, _default){\n // Returns the name assigned to the character chr as a string. If no\n // name is defined, default is returned, or, if not given, ValueError\n // is raised.\n var search = _info(chr)\n if(search === null){\n if(_default){return _default}\n throw _b_.KeyError.$factory(\"undefined character name '\" +\n chr + \"'\")\n }\n return search.name\n }\n\n function _norm(form, chr){\n var search = _info(chr)\n if(search === null){\n throw _b_.KeyError.$factory(chr)\n }\n switch(form){\n case \"NFC\":\n return chr\n case \"NFD\":\n var decomp = decomposition(chr),\n parts = decomp.split(\" \"),\n res = \"\"\n if(parts[0].startsWith(\"<\")){\n return chr\n }\n parts.forEach(function(part){\n if(! part.startsWith(\"<\")){\n res += _b_.chr(parseInt(part, 16))\n }\n })\n return res\n case \"NFKC\":\n var decomp = decomposition(chr),\n parts = decomp.split(\" \")\n if(parts[0] == \"\"){\n var res = \"\"\n parts.slice(1).forEach(function(part){\n res += _b_.chr(parseInt(part, 16))\n })\n return res\n }\n return chr\n case \"NFKD\":\n var decomp = decomposition(chr),\n parts = decomp.split(\" \")\n if(parts[0] == \"\"){\n var res = \"\"\n parts.slice(1).forEach(function(part){\n res += _b_.chr(parseInt(part, 16))\n })\n return res\n }\n return chr\n\n default:\n throw _b_.ValueError.$factory(\"invalid normalization form\")\n }\n }\n\n function normalize(form, unistr){\n var res = \"\"\n for(var i = 0, len = unistr.length; i < len; i++){\n res += _norm(form, unistr.charAt(i))\n }\n return res\n }\n\n function numeric(chr, _default){\n // Returns the decimal value assigned to the character chr as integer.\n // If no such value is defined, default is returned, or, if not given,\n // ValueError is raised.\n var search = _info(chr)\n if(search === null){\n if(_default){return _default}\n throw _b_.KeyError.$factory(chr)\n }\n var parts = search.numeric.split('/'),\n value\n if(parts.length == 1){\n value = parseFloat(search.numeric)\n }else{\n value = parseInt(parts[0]) / parseInt(parts[1])\n }\n return $B.fast_float(value)\n }\n\n var module = {\n bidirectional: bidirectional,\n category: category,\n combining: combining,\n decimal: decimal,\n decomposition: decomposition,\n digit: digit,\n lookup: lookup,\n name: name,\n normalize: normalize,\n numeric: numeric,\n unidata_version: \"11.0.0\"\n }\n module.ucd_3_2_0 = {}\n for(var key in module){\n if(key == \"unidata_version\"){\n module.ucd_3_2_0[key] = '3.2.0'\n }else{\n module.ucd_3_2_0[key] = module[key] // approximation...\n }\n }\n return module\n\n})(__BRYTHON__)"], "_aio": [".js", "// Replacement for asyncio.\n//\n// CPython asyncio can't be implemented for Brython because it relies on\n// blocking function (eg run(), run_until_complete()), and such functions\n// can't be defined in Javascript. It also manages an event loop, and a\n// browser only has its own built-in event loop.\n//\n// This module exposes functions whose result can be \"await\"-ed inside\n// asynchrounous functions defined by \"async def\".\n\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\n\nvar responseType = {\n \"text\": \"text\",\n \"binary\": \"arraybuffer\",\n \"dataURL\": \"arraybuffer\"\n}\n\nfunction handle_kwargs(kw, method){\n // kw was created with $B.obj_dict(), its keys/values are in kw.$jsobj\n var data,\n cache = false,\n format = \"text\",\n headers = {},\n timeout = {}\n for(var key in kw.$jsobj){\n if(key == \"data\"){\n var params = kw.$jsobj[key]\n if(typeof params == \"string\"){\n data = params\n }else if($B.$isinstance(params, _b_.bytes)){\n data = new ArrayBuffer(params.source.length)\n var array = new Int8Array(data)\n for(var i = 0, len = params.source.length; i < len; i++){\n array[i] = params.source[i]\n }\n }else{\n if(params.__class__ !== _b_.dict){\n throw _b_.TypeError.$factory(\"wrong type for data, \" +\n \"expected dict, bytes or str, got \" +\n $B.class_name(params))\n }\n var items = []\n for(var key of _b_.dict.$keys_string(params)){\n var value = _b_.dict.$getitem_string(params, key)\n items.push(encodeURIComponent(key) + \"=\" +\n encodeURIComponent($B.pyobj2jsobj(value)))\n }\n data = items.join(\"&\")\n }\n }else if(key == \"headers\"){\n var value = kw.$jsobj[key]\n if(! $B.$isinstance(value, _b_.dict)){\n throw _b_.ValueError.$factory(\n \"headers must be a dict, not \" + $B.class_name(value))\n }\n for(var key of _b_.dict.$keys_string(value)){\n headers[key.toLowerCase()] = _b_.dict.$getitem_string(value, key)\n }\n }else if(key.startsWith(\"on\")){\n var event = key.substr(2)\n if(event == \"timeout\"){\n timeout.func = kw.$jsobj[key]\n }else{\n ajax.bind(self, event, kw.$jsobj[key])\n }\n }else if(key == \"timeout\"){\n timeout.seconds = kw.$jsobj[key]\n }else if(key == \"cache\"){\n cache = kw.$jsobj[key]\n }else if(key == \"format\"){\n format = kw.$jsobj[key]\n }\n }\n if(method == \"post\"){\n // For POST requests, set default header\n if(! headers.hasOwnProperty(\"Content-type\")){\n headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\"\n }\n }\n return {\n body: data,\n cache,\n format,\n timeout,\n headers\n }\n}\n\nfunction ajax(){\n var $ = $B.args(\"ajax\", 2, {method: null, url: null},\n [\"method\", \"url\"], arguments, {},\n null, \"kw\"),\n method = $.method.toUpperCase(),\n url = $.url,\n kw = $.kw\n var args = handle_kwargs(kw, \"get\")\n if(method == \"GET\" && ! args.cache){\n url = url + \"?ts\" + (new Date()).getTime() + \"=0\"\n }\n if(args.body && method == \"GET\"){\n url = url + (args.cache ? \"?\" : \"&\") + args.body\n }\n var func = function(){\n return new Promise(function(resolve, reject){\n var xhr = new XMLHttpRequest()\n xhr.open(method, url, true)\n for(var key in args.headers){\n xhr.setRequestHeader(key, args.headers[key])\n }\n xhr.format = args.format\n xhr.responseType = responseType[args.format]\n xhr.onreadystatechange = function(){\n if(this.readyState == 4){\n this.__class__ = HTTPRequest\n resolve(this)\n }\n }\n if(args.body &&\n ['POST', 'PUT', 'DELETE', 'PATCH'].indexOf(method) > -1){\n xhr.send(args.body)\n }else{\n xhr.send()\n }\n })\n }\n func.$infos = {\n __name__: \"ajax_\" + method\n }\n return {\n __class__: $B.coroutine,\n $args: [url, args],\n $func: func\n }\n}\n\nfunction event(){\n // event(element, *names) is a Promise on the events \"names\" happening on\n // the element. This promise always resolves (never rejects) with the\n // first triggered DOM event.\n var $ = $B.args(\"event\", 1, {element: null},\n [\"element\"], arguments, {}, \"names\", null),\n element = $.element,\n names = $.names\n return new Promise(function(resolve){\n var callbacks = []\n names.forEach(function(name){\n var callback = function(evt){\n // When one of the handled events is triggered, all bindings\n // are removed\n callbacks.forEach(function(items){\n $B.DOMNode.unbind(element, items[0], items[1])\n })\n resolve($B.$DOMEvent(evt))\n }\n callbacks.push([name, callback])\n $B.DOMNode.bind(element, name, callback)\n })\n })\n}\n\nvar HTTPRequest = $B.make_class(\"Request\")\n\nHTTPRequest.data = _b_.property.$factory(function(self){\n if(self.format == \"binary\"){\n var view = new Uint8Array(self.response)\n return _b_.bytes.$factory(Array.from(view))\n }else if(self.format == \"text\"){\n return self.responseText\n }else if(self.format == \"dataURL\"){\n var base64String = btoa(String.fromCharCode.apply(null,\n new Uint8Array(self.response)))\n return \"data:\" + self.getResponseHeader(\"Content-Type\") +\n \";base64,\" + base64String\n }\n})\n\nHTTPRequest.response_headers = _b_.property.$factory(function(self){\n var headers = self.getAllResponseHeaders()\n if(headers === null){return _b_.None}\n var res = $B.empty_dict()\n if(headers.length > 0){\n // Convert the header string into an array\n // of individual headers\n var lines = headers.trim().split(/[\\r\\n]+/)\n // Create a map of header names to values\n lines.forEach(function(line){\n var parts = line.split(': ')\n var header = parts.shift()\n var value = parts.join(': ')\n _b_.dict.$setitem(res, header, value)\n })\n }\n return res\n})\n\nfunction get(){\n return ajax.bind(null, \"GET\").apply(null, arguments)\n}\n\nfunction iscoroutine(f){\n return f.__class__ === $B.coroutine\n}\n\nfunction iscoroutinefunction(f){\n return (f.$infos.__code__.co_flags & 128) != 0\n}\n\nfunction post(){\n return ajax.bind(null, \"POST\").apply(null, arguments)\n}\n\nfunction run(coro){\n var handle_success = function(){\n $B.leave_frame()\n },\n handle_error = $B.show_error\n\n var $ = $B.args(\"run\", 3, {coro: null, onsuccess: null, onerror: null},\n [\"coro\", \"onsuccess\", \"onerror\"], arguments,\n {onsuccess: handle_success, onerror: handle_error},\n null, null),\n coro = $.coro,\n onsuccess = $.onsuccess,\n onerror = $.onerror\n\n if(onerror !== handle_error){\n function error_func(exc){\n try{\n onerror(exc)\n }catch(err){\n handle_error(err)\n }\n }\n }else{\n error_func = handle_error\n }\n\n var save_frame_obj = $B.frame_obj\n $B.coroutine.send(coro).then(onsuccess).catch(error_func)\n $B.frame_obj = save_frame_obj\n return _b_.None\n}\n\nfunction sleep(seconds){\n if(seconds.__class__ === _b_.float){\n seconds = seconds.value\n }else if(typeof seconds != \"number\"){\n throw _b_.TypeError.$factory(\"'sleep' argument must be \" +\n \"int or float, not \" + $B.class_name(seconds))\n }\n var func = function(){\n return new Promise(resolve => setTimeout(\n function(){resolve(_b_.None)}, 1000 * seconds))\n }\n func.$infos = {\n __name__: \"sleep\"\n }\n return {\n __class__: $B.coroutine,\n $args: [seconds],\n $func: func\n }\n}\n\nfunction make_error(name, module){\n var error_obj = {\n $name: name,\n $qualname: module + '.' + name,\n $is_class: true,\n __module__: module\n }\n var error = $B.$class_constructor(name, error_obj,\n _b_.tuple.$factory([_b_.Exception]), [\"_b_.Exception\"], [])\n error.__doc__ = _b_.None\n error.$factory = $B.$instance_creator(error)\n $B.set_func_names(error, module)\n return error\n}\n\n\nvar InvalidStateError = $B.make_class('InvalidStateError')\nInvalidStateError.__bases__ = [_b_.Exception, _b_.object]\nInvalidStateError.__mro__ = [_b_.Exception, _b_.object]\n$B.set_func_names(InvalidStateError, 'browser.aio')\n\nvar CancelledError = $B.make_class('CancelledError')\nCancelledError.__bases__ = [_b_.Exception, _b_.object]\nCancelledError.__mro__ = [_b_.Exception, _b_.object]\n$B.set_func_names(CancelledError, 'browser.aio')\n\n\nvar Future = $B.make_class(\"Future\",\n function(){\n var methods = {}\n var promise = new Promise(function(resolve, reject){\n methods.resolve = resolve\n methods.reject = reject\n })\n promise._methods = methods\n promise._done = false\n promise.__class__ = Future\n return promise\n }\n)\n\nFuture.done = function(){\n var $ = $B.args('done', 1, {self:null},\n ['self'], arguments, {}, null, null)\n return !! self._done\n}\n\nFuture.set_result = function(self, value){\n var $ = $B.args('set_result', 2, {self:null, value: null},\n ['self', 'value'], arguments, {}, null, null)\n self._done = true\n return self._methods.resolve(value)\n}\n\nFuture.set_exception = function(self, exception){\n var $ = $B.args('set_exception', 2, {self:null, exception: null},\n ['self', 'exception'], arguments, {}, null, null)\n self._done = true\n return self._methods.reject(exception)\n}\n\n$B.set_func_names(Future, 'browser.aio')\n\nreturn {\n ajax,\n event,\n get,\n iscoroutine,\n iscoroutinefunction,\n post,\n run,\n sleep,\n Future\n}\n\n})(__BRYTHON__)\n"], "_ajax": [".js", "// ajax\nvar $module = (function($B){\n\n\nvar $N = $B.builtins.None,\n _b_ = $B.builtins\n\nvar add_to_res = function(res, key, val) {\n if($B.$isinstance(val, _b_.list)){\n for (j = 0; j < val.length; j++) {\n add_to_res(res, key, val[j])\n }\n }else if (val instanceof File || val instanceof Blob){\n res.append(key, val)\n }else{res.append(key, _b_.str.$factory(val))}\n}\n\nfunction set_timeout(self, timeout){\n if(timeout.seconds !== undefined){\n self.js.$requestTimer = setTimeout(\n function() {\n self.js.abort()\n if(timeout.func){\n timeout.func()\n }\n },\n timeout.seconds * 1000)\n }\n}\n\nfunction _read(req){\n var xhr = req.js\n if(xhr.responseType == \"json\"){\n return $B.structuredclone2pyobj(xhr.response)\n }\n if(req.charset_user_defined){\n // on blocking mode, xhr.response is a string\n var bytes = []\n for(var i = 0, len = xhr.response.length; i < len; i++){\n var cp = xhr.response.codePointAt(i)\n if(cp > 0xf700){\n bytes.push(cp - 0xf700)\n }else{\n bytes.push(cp)\n }\n }\n }else if(typeof xhr.response == \"string\"){\n if(req.mode == 'binary'){\n return _b_.str.encode(xhr.response, req.encoding || 'utf-8')\n }\n return xhr.response\n }else{\n // else it's an ArrayBuffer\n var buf = new Uint8Array(xhr.response),\n bytes = Array.from(buf.values())\n }\n var b = _b_.bytes.$factory(bytes)\n if(req.mode == \"binary\"){\n return b\n }else if(req.mode == \"document\"){\n return $B.JSObj.$factory(xhr.response)\n }else{\n var encoding = req.encoding || \"utf-8\"\n return _b_.bytes.decode(b, encoding)\n }\n}\n\nfunction stringify(d){\n var items = []\n for(var entry of $B.make_js_iterator(_b_.dict.items(d))){\n items.push(encodeURIComponent(entry[0]) + \"=\" +\n encodeURIComponent(entry[1]))\n }\n return items.join(\"&\")\n}\n\nfunction handle_kwargs(self, kw, method){\n // kw was created with $B.obj_dict(), its keys/values are in kw.$jsobj\n var data,\n encoding,\n headers={},\n cache,\n mode = \"text\",\n timeout = {}\n\n for(var key in kw.$jsobj){\n if(key == \"data\"){\n var params = kw.$jsobj[key]\n if(typeof params == \"string\" || params instanceof FormData){\n data = params\n }else if(params.__class__ === _b_.dict){\n var from_dict = []\n for(var key of $B.make_js_iterator(_b_.dict.keys(params))){\n if(typeof key !== 'string'){\n throw _b_.ValueError.$factory(\n 'data only supports string keys, got ' +\n `'${$B.class_name(key)}' object`)\n }\n from_dict.push(`${key}=${_b_.dict.$getitem(params, key)}`)\n }\n data = from_dict.join('&')\n }else{\n throw _b_.TypeError.$factory(\"wrong type for data: \" +\n $B.class_name(params))\n }\n }else if(key == \"encoding\"){\n encoding = kw.$jsobj[key]\n }else if(key == \"headers\"){\n var value = kw.$jsobj[key]\n if(! $B.$isinstance(value, _b_.dict)){\n throw _b_.ValueError.$factory(\n \"headers must be a dict, not \" + $B.class_name(value))\n }\n for(var key of _b_.dict.$keys_string(value)){\n headers[key.toLowerCase()] = _b_.dict.$getitem_string(value, key)\n }\n }else if(key.startsWith(\"on\")){\n var event = key.substr(2)\n if(event == \"timeout\"){\n timeout.func = kw.$jsobj[key]\n }else{\n var f = kw.$jsobj[key]\n ajax.bind(self, event, f)\n }\n }else if(key == \"mode\"){\n var mode = kw.$jsobj[key]\n }else if(key == \"timeout\"){\n timeout.seconds = kw.$jsobj[key]\n }else if(key == \"cache\"){\n cache = kw.$jsobj[key]\n }\n }\n if(encoding && mode != \"text\"){\n throw _b_.ValueError.$factory(\"encoding not supported for mode \" +\n mode)\n }\n if((method == \"post\" || method == \"put\") && ! headers){\n // For POST requests, set default header\n self.js.setRequestHeader(\"Content-type\",\n \"application/x-www-form-urlencoded\")\n }\n\n return {cache, data, encoding, headers, mode, timeout}\n}\n\nvar ajax = $B.make_class('ajax')\n\najax.__repr__ = function(self){\n return ''\n}\n\najax.__getattribute__ = function(self, attr){\n if(ajax[attr] !== undefined){\n return function(){\n return ajax[attr].call(null, self, ...arguments)\n }\n }else if(attr == \"text\"){\n return _read(self)\n }else if(attr == \"json\"){\n if(self.js.responseType == \"json\"){\n return _read(self)\n }else{\n var resp = _read(self)\n try{\n return $B.structuredclone2pyobj(JSON.parse(resp))\n }catch(err){\n console.log('attr json, invalid resp', resp)\n throw err\n }\n }\n }else if(self.js[attr] !== undefined){\n if(typeof self.js[attr] == \"function\"){\n return function(){\n if(attr == \"setRequestHeader\"){\n ajax.set_header.call(null, self, ...arguments)\n }else{\n if(attr == 'overrideMimeType'){\n console.log('override mime type')\n self.hasMimeType = true\n }\n return self.js[attr](...arguments)\n }\n }\n }else{\n return self.js[attr]\n }\n }else if(attr == \"xml\"){\n return $B.JSObj.$factory(self.js.responseXML)\n }\n}\n\najax.bind = function(self, evt, func){\n // req.bind(evt,func) is the same as req.onevt = func\n self.js['on' + evt] = function(){\n try{\n return func.apply(null, arguments)\n }catch(err){\n $B.handle_error(err)\n }\n }\n return _b_.None\n}\n\najax.open = function(){\n var $ = $B.args('open', 4,\n {self: null, method: null, url: null, async: null},\n ['self', 'method', 'url', 'async'], arguments,\n {async: true}, null, null),\n self = $.self,\n method = $.method,\n url = $.url,\n async = $.async\n if(typeof method !== \"string\"){\n throw _b_.TypeError.$factory(\n 'open() argument method should be string, got ' +\n $B.class_name(method))\n }\n if(typeof url !== \"string\"){\n throw _b_.TypeError.$factory(\n 'open() argument url should be string, got ' +\n $B.class_name(url))\n }\n self.$method = method\n self.blocking = ! self.async\n self.js.open(method, url, async)\n}\n\najax.read = function(self){\n return _read(self)\n}\n\najax.send = function(self, params){\n // params can be Python dictionary or string\n var content_type\n for(var key in self.headers){\n var value = self.headers[key]\n self.js.setRequestHeader(key, value)\n if(key == 'content-type'){\n content_type = value\n }\n }\n if((self.encoding || self.blocking) && ! self.hasMimeType){\n // On blocking mode, or if an encoding has been specified,\n // override Mime type so that bytes are not processed\n // (unless the Mime type has been explicitely set)\n self.js.overrideMimeType('text/plain;charset=x-user-defined')\n self.charset_user_defined = true\n }\n var res = ''\n if(! params){\n self.js.send()\n return _b_.None\n }\n if($B.$isinstance(params, _b_.str)){\n res = params\n }else if($B.$isinstance(params, _b_.dict)){\n if(content_type == 'multipart/form-data'){\n // The FormData object serializes the data in the 'multipart/form-data'\n // content-type so we may as well override that header if it was set\n // by the user.\n res = new FormData()\n var items = _b_.list.$factory(_b_.dict.items(params))\n for(var i = 0, len = items.length; i < len; i++){\n add_to_res(res, _b_.str.$factory(items[i][0]), items[i][1])\n }\n }else{\n if(self.$method && self.$method.toUpperCase() == \"POST\" &&\n ! content_type){\n // Set default Content-Type for POST requests\n self.js.setRequestHeader(\"Content-Type\",\n \"application/x-www-form-urlencoded\")\n }\n var items = _b_.list.$factory(_b_.dict.items(params))\n for(var i = 0, len = items.length; i < len; i++){\n var key = encodeURIComponent(_b_.str.$factory(items[i][0]));\n if($B.$isinstance(items[i][1], _b_.list)){\n for (j = 0; j < items[i][1].length; j++) {\n res += key +'=' +\n encodeURIComponent(_b_.str.$factory(items[i][1][j])) + '&'\n }\n }else{\n res += key + '=' +\n encodeURIComponent(_b_.str.$factory(items[i][1])) + '&'\n }\n }\n res = res.substr(0, res.length - 1)\n }\n }else if(params instanceof FormData){\n res = params\n }else{\n throw _b_.TypeError.$factory(\n \"send() argument must be string or dictionary, not '\" +\n _b_.str.$factory(params.__class__) + \"'\")\n }\n self.js.send(res)\n return _b_.None\n}\n\najax.set_header = function(self, key, value){\n self.headers[key.toLowerCase()] = value\n}\n\najax.set_timeout = function(self, seconds, func){\n self.js.$requestTimer = setTimeout(\n function() {\n self.js.abort()\n func()\n },\n seconds * 1000)\n}\n\najax.$factory = function(){\n\n if(window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari\n var xmlhttp = new XMLHttpRequest()\n }else{// code for IE6, IE5\n var xmlhttp = new ActiveXObject(\"Microsoft.XMLHTTP\")\n }\n xmlhttp.onreadystatechange = function(){\n // here, \"this\" refers to xmlhttp\n var state = this.readyState\n if(this.responseType == \"\" || this.responseType == \"text\"){\n res.js.text = this.responseText\n }\n var timer = this.$requestTimer\n if(state == 0 && this.onuninitialized){\n this.onuninitialized(res)\n }else if(state == 1 && this.onloading){\n this.onloading(res)\n }else if(state == 2 && this.onloaded){\n this.onloaded(res)\n }else if(state == 3 && this.oninteractive){\n this.oninteractive(res)\n }else if(state == 4 && this.oncomplete){\n if(timer !== null){\n window.clearTimeout(timer)\n }\n this.oncomplete(res)\n }\n }\n var res = {\n __class__: ajax,\n js: xmlhttp,\n headers: {}\n }\n return res\n}\n\nfunction _request_without_body(method){\n var $ = $B.args(method, 3, {method: null, url: null, blocking: null},\n [\"method\", \"url\", \"blocking\"], arguments, {blocking: false},\n null, \"kw\"),\n method = $.method,\n url = $.url,\n async = !$.blocking,\n kw = $.kw\n var self = ajax.$factory()\n self.blocking = $.blocking\n var items = handle_kwargs(self, kw, method),\n mode = self.mode = items.mode,\n encoding = self.encoding = items.encoding\n qs = items.data,\n timeout = items.timeout\n set_timeout(self, timeout)\n if(qs){\n url += \"?\" + qs\n }\n if(! (items.cache === true)){\n url += (qs ? \"&\" : \"?\") + (new Date()).getTime()\n }\n self.js.open(method.toUpperCase(), url, async)\n\n if(async){\n if(mode == \"json\" || mode == \"document\"){\n self.js.responseType = mode\n }else{\n self.js.responseType = \"arraybuffer\"\n if(mode != \"text\" && mode != \"binary\"){\n throw _b_.ValueError.$factory(\"invalid mode: \" + mode)\n }\n }\n }else{\n self.js.overrideMimeType('text/plain;charset=x-user-defined')\n self.charset_user_defined = true\n }\n for(var key in items.headers){\n self.js.setRequestHeader(key, items.headers[key])\n }\n // Add function read() to return str or bytes according to mode\n self.js.send()\n}\n\nfunction _request_with_body(method){\n var $ = $B.args(method, 3, {method: null, url: null, blocking: null},\n [\"method\", \"url\", \"blocking\"], arguments, {blocking: false},\n null, \"kw\"),\n method = $.method,\n url = $.url,\n async = !$.blocking,\n kw = $.kw,\n content_type\n var self = ajax.$factory()\n self.js.open(method.toUpperCase(), url, async)\n var items = handle_kwargs(self, kw, method),\n data = items.data,\n timeout = items.timeout\n if($B.$isinstance(data, _b_.dict)){\n data = stringify(data)\n }\n\n set_timeout(self, timeout)\n for(var key in items.headers){\n var value = items.headers[key]\n self.js.setRequestHeader(key, value)\n if(key == 'content-type'){\n content_type = value\n }\n }\n if(method.toUpperCase() == 'POST' && !content_type){\n // set default Content-Type for POST requests\n self.js.setRequestHeader('Content-Type',\n 'application/x-www-form-urlencoded')\n }\n\n // Add function read() to return str or bytes according to mode\n self.js.read = function(){\n return _read(self)\n }\n self.js.send(data)\n}\n\nfunction form_data(form){\n var missing = {},\n $ = $B.args('form_data', 1, {form: null}, ['form'], arguments,\n {form: missing}, null, null)\n if($.form === missing){\n return new FormData()\n }else{\n return new FormData($.form)\n }\n}\n\nfunction connect(){\n _request_without_body.call(null, \"connect\", ...arguments)\n}\n\nfunction _delete(){\n _request_without_body.call(null, \"delete\", ...arguments)\n}\n\nfunction get(){\n _request_without_body.call(null, \"get\", ...arguments)\n}\n\nfunction head(){\n _request_without_body.call(null, \"head\", ...arguments)\n}\n\nfunction options(){\n _request_without_body.call(null, \"options\", ...arguments)\n}\n\nfunction patch(){\n _request_with_body.call(null, \"put\", ...arguments)\n}\n\nfunction post(){\n _request_with_body.call(null, \"post\", ...arguments)\n}\n\nfunction put(){\n _request_with_body.call(null, \"put\", ...arguments)\n}\n\nfunction trace(){\n _request_without_body.call(null, \"trace\", ...arguments)\n}\n\nfunction file_upload(){\n // ajax.file_upload(url, file, method=\"POST\", **callbacks)\n var $ = $B.args(\"file_upload\", 2, {url: null, \"file\": file},\n [\"url\", \"file\"], arguments, {}, null, \"kw\"),\n url = $.url,\n file = $.file,\n kw = $.kw\n\n var self = ajax.$factory(),\n method = 'POST',\n field_name = 'filetosave'\n\n var items = handle_kwargs(self, kw, method),\n data = items.data,\n headers = items.headers,\n timeout = items.timeout\n\n for(var key in items.headers){\n var value = items.headers[key]\n self.js.setRequestHeader(key, value)\n if(key == 'content-type'){\n content_type = value\n }\n }\n set_timeout(self, timeout)\n\n if(kw.$jsobj.hasOwnProperty('method')){\n method = kw.$jsobj.method\n }\n\n if(kw.$jsobj.hasOwnProperty('field_name')){\n field_name = kw.$jsobj.field_name\n }\n\n var formdata = new FormData()\n formdata.append(field_name, file, file.name)\n\n if(items.data){\n if(items.data instanceof FormData){\n // append additional data\n for(var d of items.data){\n formdata.append(d[0], d[1])\n }\n }else if($B.$isinstance(items.data, _b_.dict)){\n for(var d of _b_.list.$factory(_b_.dict.items(items.data))){\n formdata.append(d[0], d[1])\n }\n }else{\n throw _b_.ValueError.$factory(\n 'data value must be a dict of form_data')\n }\n }\n\n self.js.open(method, url, _b_.True)\n self.js.send(formdata)\n\n for(var key in kw.$jsobj){\n if(key.startsWith(\"on\")){\n ajax.bind(self, key.substr(2), kw.$jsobj[key])\n }\n }\n}\n\n$B.set_func_names(ajax)\n\nreturn {\n ajax: ajax,\n Ajax: ajax,\n delete: _delete,\n file_upload: file_upload,\n connect,\n form_data,\n get,\n head,\n options,\n patch,\n post,\n put,\n trace\n}\n\n})(__BRYTHON__)\n"], "_ast": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins,\n ast = $B.ast, // created in py2js\n mod = {}\nmod.PyCF_ONLY_AST = $B.PyCF_ONLY_AST\nmod.AST = $B.AST // in builtin_modules.js\n$B.create_python_ast_classes() // in py_ast.js\nfor(var klass in ast){\n mod[klass] = $B.python_ast_classes[klass]\n}\n\nvar Load = 'Load',\n Store = 'Store',\n Del = 'Del'\n\n// Note: the ensure_literal_* functions are only used to validate a restricted\n// set of non-recursive literals that have already been checked with\n// validate_expr, so they don't accept the validator state\nfunction ensure_literal_number(exp, allow_real, allow_imaginary){\n if(exp.__class__ !== mod.Constant){\n return false\n }\n var value = exp.value\n if(allow_real && $B.$isinstance(value, [_b_.int, _b_.float])){\n return true\n }\n if(allow_imaginary && $B.$isinstance(value, _b_.complex)){\n return true\n }\n return false\n}\n\nfunction ensure_literal_negative(exp, allow_real, allow_imaginary){\n if(exp.__class__ !== mod.UnaryOp){\n return false\n }\n // Must be negation ...\n if(exp.op !== mod.USub) {\n return false\n }\n // ... of a constant ...\n var operand = exp.operand\n if(operand.__class__ !== mod.Constant){\n return false\n }\n // ... number\n return ensure_literal_number(operand, allow_real, allow_imaginary)\n}\n\nfunction ensure_literal_complex(exp){\n if(exp.__class__ !== mod.BinOp){\n return false\n }\n var left = exp.left,\n right = exp.right;\n // Ensure op is addition or subtraction\n if(exp.op !== mod.Add && exp.op !== mod.Sub){\n return false\n }\n // Check LHS is a real number (potentially signed)\n switch(left.__class__){\n case mod.Constant:\n if(!ensure_literal_number(left, true, false)){\n return false\n }\n break;\n case mod.UnaryOp:\n if(!ensure_literal_negative(left, true, false)){\n return false\n }\n break;\n default:\n return false\n }\n // Check RHS is an imaginary number (no separate sign allowed)\n switch(right.__class__){\n case mod.Constant:\n if(!ensure_literal_number(right, false, true)){\n return false\n }\n break;\n default:\n return false\n }\n return true\n}\n\nfunction validate_arguments(args){\n validate_args(args.posonlyargs)\n validate_args(args.args)\n if(args.vararg && args.vararg.annotation){\n validate_expr(args.vararg.annotation, Load)\n }\n validate_args(args.kwonlyargs)\n if(args.kwarg && args.kwarg.annotation){\n validate_expr(args.kwarg.annotation, Load)\n }\n if(args.defaults.length > args.posonlyargs.length + args.args.length){\n throw _b_.ValueError.$factory(\n \"more positional defaults than args on arguments\")\n }\n if(args.kw_defaults.length != args.kwonlyargs.length){\n throw _b_.ValueError.$factory(\n \"length of kwonlyargs is not the same as \" +\n \"kw_defaults on arguments\")\n }\n validate_exprs(args.defaults, Load, 0)\n validate_exprs(args.kw_defaults, Load, 1)\n}\n\nfunction validate_pattern(p, star_ok){\n var ret = -1\n switch(p.__class__) {\n case mod.MatchValue:\n validate_pattern_match_value(p.value)\n break;\n case mod.MatchSingleton:\n if([_b_.None, _b_.True, _b_.False].indexOf(p.value) == -1){\n throw _b_.ValueError(\n \"MatchSingleton can only contain True, False and None\")\n }\n break;\n case mod.MatchSequence:\n validate_patterns(p.patterns, 1);\n break;\n case mod.MatchMapping:\n if(p.keys.length != p.patterns.length){\n throw _b_.ValueError.$factory(\n \"MatchMapping doesn't have the same number of keys as patterns\");\n }\n if(p.rest){\n validate_capture(p.rest)\n }\n\n var keys = p.keys;\n for(var key of keys){\n if(key.__class__ === mod.Constant) {\n var literal = key.value;\n if([_b_.None, _b_.True, _b_.False].indexOf(literal) > -1){\n /* validate_pattern_match_value will ensure the key\n doesn't contain True, False and None but it is\n syntactically valid, so we will pass those on in\n a special case. */\n continue;\n }\n }\n validate_pattern_match_value(key)\n }\n validate_patterns(p.patterns, 0);\n break;\n case mod.MatchClass:\n if(p.kwd_attrs.length != p.kwd_patterns.length){\n throw _b_.ValueError.$factory(\n \"MatchClass doesn't have the same number of \" +\n \"keyword attributes as patterns\")\n }\n validate_expr(p.cls, Load)\n var cls = p.cls;\n while(true){\n if(cls.__class__ === mod.Name){\n break\n }else if(cls.__class__ === mod.Attribute) {\n cls = cls.value;\n continue;\n }else {\n throw _b_.ValueError.$factory(\n \"MatchClass cls field can only contain Name \" +\n \"or Attribute nodes.\")\n }\n }\n\n for(var identifier of p.kwd_attrs){\n validate_name(identifier)\n }\n\n validate_patterns(p.patterns, 0)\n validate_patterns(p.kwd_patterns, 0);\n break;\n case mod.MatchStar:\n if (!star_ok) {\n throw _b_.ValueError.$factory(\"can't use MatchStar here\")\n }\n if(p.name === undefined){\n validate_capture(p.name)\n }\n break;\n case mod.MatchAs:\n if(p.name){\n validate_capture(p.name)\n }\n if(p.pattern == undefined){\n ret = 1;\n }else if(p.name == undefined){\n throw _b_.ValueError.$factory(\n \"MatchAs must specify a target name if a pattern is given\")\n }else{\n validate_pattern(p.pattern, 0);\n }\n break;\n case mod.MatchOr:\n if(p.patterns.length < 2){\n throw _b_.ValueError.$factory(\n \"MatchOr requires at least 2 patterns\")\n }\n validate_patterns(p.patterns, 0)\n break;\n // No default case, so the compiler will emit a warning if new pattern\n // kinds are added without being handled here\n }\n if(ret < 0){\n throw _b_.SystemError.$factory(\"unexpected pattern\")\n }\n return true\n}\n\nfunction validate_patterns(patterns, star_ok){\n for(var pattern of patterns){\n validate_pattern(pattern, star_ok)\n }\n return true\n}\n\nfunction validate_pattern_match_value(exp){\n validate_expr(exp, Load)\n switch (exp.__class__){\n case mod.Constant:\n /* Ellipsis and immutable sequences are not allowed.\n For True, False and None, MatchSingleton() should\n be used */\n validate_expr(exp, Load)\n var literal = exp.value\n if($B.$isinstance(literal, [_b_.int, _b_.float, _b_.bytes,\n _b_.complex, _b_.str])){\n return true\n }\n throw _b_.ValueError.$factory(\n \"unexpected constant inside of a literal pattern\")\n case mod.Attribute:\n // Constants and attribute lookups are always permitted\n return true\n case mod.UnaryOp:\n // Negated numbers are permitted (whether real or imaginary)\n // Compiler will complain if AST folding doesn't create a constant\n if(ensure_literal_negative(exp, true, true)){\n return true\n }\n break;\n case mod.BinOp:\n // Complex literals are permitted\n // Compiler will complain if AST folding doesn't create a constant\n if(ensure_literal_complex(exp)){\n return true\n }\n break;\n case mod.JoinedStr:\n // Handled in the later stages\n return 1;\n default:\n break;\n }\n throw _b_.ValueError.$factory(\n \"patterns may only match literals and attribute lookups\")\n}\n\nfunction validate_capture(name){\n if(name == \"_\"){\n throw _b_.ValueError.$factory(\"can't capture name '_' in patterns\")\n }\n validate_name(name)\n}\n\nfunction validate_name(name){\n var forbidden = [\"None\", \"True\", \"False\"]\n if(forbidden.indexOf(name) > -1){\n throw _b_.ValueError.$factory(`identifier field can't represent` +\n ` '${name}' constant\", forbidden[i]`)\n }\n return true\n}\n\nfunction validate_comprehension(gens){\n if(gens.length == 0) {\n throw _b_.ValueError.$factory(\"comprehension with no generators\")\n }\n for(var comp of gens){\n validate_expr(comp.target, Store)\n validate_expr(comp.iter, Load)\n validate_exprs(comp.ifs, Load, 0)\n }\n return true\n}\n\nfunction validate_keywords(keywords){\n for(var keyword of keywords){\n validate_expr(keyword.value, Load)\n }\n return true\n}\n\nfunction validate_args(args){\n for(var arg of args){\n if(arg.annotation){\n validate_expr(arg.annotation, Load)\n }\n }\n return true\n}\n\nfunction validate_nonempty_seq(seq, what, owner){\n if(seq.length > 0){\n return true\n }\n throw _b_.ValueError.$factory(`empty ${what} on ${owner}`)\n}\n\nfunction validate_assignlist(targets, ctx){\n validate_nonempty_seq(targets, \"targets\", ctx == Del ? \"Delete\" : \"Assign\")\n validate_exprs(targets, ctx, 0)\n}\n\nfunction validate_body(body, owner){\n validate_nonempty_seq(body, \"body\", owner)\n validate_stmts(body)\n}\n\nfunction validate_exprs(exprs, ctx, null_ok){\n for(var expr of exprs){\n if(expr !== _b_.None){\n validate_expr(expr, ctx)\n }else if(!null_ok){\n throw _b_.ValueError.$factory(\n \"None disallowed in expression list\")\n }\n\n }\n return true\n}\n\nfunction validate_expr(exp, ctx){\n var check_ctx = 1,\n actual_ctx;\n\n /* First check expression context. */\n switch (exp.__class__) {\n case mod.Name:\n validate_name(exp.id)\n actual_ctx = exp.ctx\n break;\n case mod.Attribute:\n case mod.Subscript:\n case mod.Starred:\n case mod.List:\n case mod.Tuple:\n actual_ctx = exp.ctx;\n break\n default:\n if(ctx != Load){\n throw _b_.ValueError.$factory(\"expression which can't be \" +\n `assigned to in ${ctx} context`)\n }\n check_ctx = 0;\n /* set actual_ctx to prevent gcc warning */\n actual_ctx = 0;\n }\n actual_ctx = actual_ctx === 0 ? actual_ctx :\n actual_ctx.__class__.__name__\n if(check_ctx && actual_ctx != ctx){\n throw _b_.ValueError.$factory(`expression must have ` +\n `${ctx} context but has ${actual_ctx} instead`)\n }\n\n /* Now validate expression. */\n switch (exp.__class__) {\n case mod.BoolOp:\n if(exp.values.length < 2){\n throw _b_.ValueError.$factory(\"BoolOp with less than 2 values\")\n }\n validate_exprs(exp.values, Load, 0);\n break;\n case mod.BinOp:\n validate_expr(exp.left, Load)\n validate_expr(exp.right, Load)\n break;\n case mod.UnaryOp:\n validate_expr(exp.operand, Load);\n break;\n case mod.Lambda:\n validate_arguments(exp.args)\n validate_expr(exp.body, Load);\n break;\n case mod.IfExp:\n validate_expr(exp.test, Load)\n validate_expr(exp.body, Load)\n validate_expr(exp.orelse, Load)\n break;\n case mod.Dict:\n if(exp.keys.length != exp.values.length){\n throw _b_.ValueError.$factory(\n \"Dict doesn't have the same number of keys as values\");\n }\n /* null_ok=1 for keys expressions to allow dict unpacking to work in\n dict literals, i.e. ``{**{a:b}}`` */\n validate_exprs(exp.keys, Load, 1)\n validate_exprs(exp.values, Load, 0);\n break;\n case mod.Set:\n validate_exprs(exp.elts, Load, 0);\n break;\n case mod.ListComp:\n case mod.SetComp:\n case mod.GeneratorExp:\n validate_comprehension(exp.generators)\n validate_expr(exp.elt, Load)\n break;\n case mod.DictComp:\n validate_comprehension(exp.generators)\n validate_expr(exp.key, Load)\n validate_expr(exp.value, Load)\n break;\n case mod.Yield:\n if(exp.value){\n validate_expr(exp.value, Load)\n }\n break;\n case mod.YieldFrom:\n validate_expr(exp.value, Load)\n break;\n case mod.Await:\n validate_expr(exp.value, Load)\n break;\n case mod.Compare:\n if(exp.comparators.length == 0){\n throw _b_.ValueError.$factory(\"Compare with no comparators\")\n }\n if(exp.comparators.length != exp.ops){\n throw _b_.ValueError.$factory(\"Compare has a different number \" +\n \"of comparators and operands\")\n }\n validate_exprs(exp.comparators, Load, 0)\n validate_expr(exp.left, Load)\n break;\n case mod.Call:\n validate_expr(exp.func, Load)\n validate_exprs(exp.args, Load, 0)\n validate_keywords(exp.keywords)\n break;\n case mod.Constant:\n validate_constant(exp.value)\n break;\n case mod.JoinedStr:\n validate_exprs(exp.values, Load, 0)\n break;\n case mod.FormattedValue:\n validate_expr(exp.value, Load)\n if (exp.format_spec) {\n validate_expr(exp.format_spec, Load)\n break;\n }\n break;\n case mod.Attribute:\n validate_expr(exp.value, Load)\n break;\n case mod.Subscript:\n validate_expr(exp.slice, Load)\n validate_expr(exp.value, Load)\n break;\n case mod.Starred:\n validate_expr(exp.value, ctx)\n break;\n case mod.Slice:\n if(exp.lower){\n validate_expr(exp.lower, Load)\n }\n if(exp.upper){\n validate_expr(exp.upper, Load)\n }\n if(exp.step){\n validate_expr(exp.step, Load)\n }\n break;\n case mod.List:\n validate_exprs(exp.elts, ctx, 0)\n break;\n case mod.Tuple:\n validate_exprs(exp.elts, ctx, 0)\n break;\n case mod.NamedExpr:\n validate_expr(exp.value, Load)\n break;\n /* This last case doesn't have any checking. */\n case mod.Name:\n ret = 1;\n break;\n // No default case mod.so compiler emits warning for unhandled cases\n }\n return true\n}\n\nfunction validate_constant(value){\n if (value == _b_.None || value == _b_.Ellipsis){\n return true\n }\n if($B.$isinstance(value,\n [_b_.int, _b_.float, _b_.complex, _b_.bool, _b_.bytes, _b_.str])){\n return true\n }\n\n if($B.$isinstance(value, [_b_.tuple, _b_.frozenset])){\n var it = _b_.iter(value)\n while(true){\n try{\n var item = _b_.next(it)\n validate_constant(item)\n }catch(err){\n if($B.is_exc(err, [_b_.StopIteration])){\n return true\n }\n throw err\n }\n }\n }\n}\n\nfunction validate_stmts(seq){\n for(var stmt of seq) {\n if(stmt !== _b_.None){\n validate_stmt(stmt)\n }else{\n throw _b_.ValueError.$factory(\"None disallowed in statement list\");\n }\n }\n}\n\nfunction validate_stmt(stmt){\n switch (stmt.__class__) {\n case mod.FunctionDef:\n validate_body(stmt.body, \"FunctionDef\")\n validate_arguments(stmt.args)\n validate_exprs(stmt.decorator_list, Load, 0)\n if(stmt.returns){\n validate_expr(stmt.returns, Load)\n }\n break;\n case mod.ClassDef:\n validate_body(stmt.body, \"ClassDef\")\n validate_exprs(stmt.bases, Load, 0)\n validate_keywords(stmt.keywords)\n validate_exprs(stmtdecorator_list, Load, 0)\n break;\n case mod.Return:\n if(stmt.value){\n validate_expr(stmt.value, Load)\n }\n break;\n case mod.Delete:\n validate_assignlist(stmt.targets, Del);\n break;\n case mod.Assign:\n validate_assignlist(stmt.targets, Store)\n validate_expr(stmt.value, Load)\n break;\n case mod.AugAssign:\n validate_expr(stmt.target, Store) &&\n validate_expr(stmt.value, Load);\n break;\n case mod.AnnAssign:\n if(stmt.target.__class__ != mod.Name && stmt.simple){\n throw _b_.TypeError.$factory(\n \"AnnAssign with simple non-Name target\")\n }\n validate_expr(stmt.target, Store)\n if(stmt.value){\n validate_expr(stmt.value, Load)\n validate_expr(stmt.annotation, Load);\n }\n break;\n case mod.For:\n validate_expr(stmt.target, Store)\n validate_expr(stmt.iter, Load)\n validate_body(stmt.body, \"For\")\n validate_stmts(stmt.orelse)\n break;\n case mod.AsyncFor:\n validate_expr(stmt.target, Store)\n validate_expr(stmt.iter, Load)\n validate_body(stmt.body, \"AsyncFor\")\n validate_stmts(stmt.orelse)\n break;\n case mod.While:\n validate_expr(stmt.test, Load)\n validate_body(stmt.body, \"While\")\n validate_stmts(stmt.orelse)\n break;\n case mod.If:\n validate_expr(stmt.test, Load)\n validate_body(stmt.body, \"If\")\n validate_stmts(stmt.orelse)\n break;\n case mod.With:\n validate_nonempty_seq(stmt.items, \"items\", \"With\")\n for (var item of stmt.items){\n validate_expr(item.context_expr, Load) &&\n (! item.optional_vars || validate_expr(item.optional_vars, Store))\n }\n validate_body(stmt.body, \"With\");\n break;\n case mod.AsyncWith:\n validate_nonempty_seq(stmt.items, \"items\", \"AsyncWith\")\n for(var item of stmt.items){\n validate_expr(item.context_expr, Load)\n if(item.optional_vars){\n validate_expr(item.optional_vars, Store)\n }\n }\n validate_body(stmt.body, \"AsyncWith\");\n break;\n case mod.Match:\n validate_expr(stmt.subject, Load)\n validate_nonempty_seq(stmt.cases, \"cases\", \"Match\")\n for(var m of stmt.cases){\n validate_pattern(m.pattern, 0)\n if(m.guard){\n validate_expr(m.guard, Load)\n }\n validate_body(m.body, \"match_case\")\n }\n break;\n case mod.Raise:\n if(stmt.exc){\n validate_expr(stmt.exc, Load)\n if(stmt.cause){\n validate_expr(stmt.cause, Load)\n }\n break;\n }\n if(stmt.cause) {\n throw _b_.ValueError.$factory(\"Raise with cause but no exception\");\n }\n break;\n case mod.Try:\n validate_body(stmt.body, \"Try\")\n if(stmt.handlers.length == 0 + stmt.finalbody.length == 0){\n throw _b_.ValueError.$factor(\n \"Try has neither except handlers nor finalbody\");\n }\n if(stmt.handlers.length == 0 && stmt.orelse.length > 0){\n throw _b_.ValueError.$factory(\n \"Try has orelse but no except handlers\");\n }\n for(var handler of stmt.handlers){\n if(handler.type){\n validate_expr(handler.type, Load)\n validate_body(handler.body, \"ExceptHandler\")\n }\n }\n if(stmt.finalbody.length > 0){\n validate_stmts(stmt.finalbody)\n }\n if(stmt.orelse.length > 0){\n validate_stmts(stmt.orelse)\n }\n break;\n case mod.TryStar:\n validate_body(stmt.body, \"TryStar\")\n if(stmt.handlers.length + stmt.finalbody.length == 0){\n throw _b_.ValueError.$factory(\n \"TryStar has neither except handlers nor finalbody\");\n }\n if(stmt.handlers.length == 0 && stmt.orelse.length > 0){\n throw _b_.ValueError.$factory(\n \"TryStar has orelse but no except handlers\");\n }\n for(var handler of stm.handlers){\n if(handler.type){\n validate_expr(handler.type, Load)\n validate_body(handler.body, \"ExceptHandler\")\n }\n }\n if(stmt.finalbody.length > 0){\n validate_stmts(stmt.finalbody)\n }\n if(stmt.orelse.length > 0){\n validate_stmts(stmt.orelse)\n }\n break;\n case mod.Assert:\n validate_expr(stmt.test, Load)\n if(stmt.msg){\n validate_expr(stmt.msg, Load)\n }\n break;\n case mod.Import:\n validate_nonempty_seq(stmt.names, \"names\", \"Import\");\n break;\n case mod.ImportFrom:\n if(stmt.level < 0) {\n throw _b_.ValueError.$factory(\"Negative ImportFrom level\")\n }\n validate_nonempty_seq(stmt.names, \"names\", \"ImportFrom\");\n break;\n case mod.Global:\n validate_nonempty_seq(stmt.names, \"names\", \"Global\");\n break;\n case mod.Nonlocal:\n validate_nonempty_seq(stmt.names, \"names\", \"Nonlocal\");\n break;\n case mod.Expr:\n validate_expr(stmt.value, Load);\n break;\n case mod.AsyncFunctionDef:\n validate_body(stmt.body, \"AsyncFunctionDef\")\n validate_arguments(stmt.args)\n validate_exprs(stmt.decorator_list, Load, 0)\n if(stmt.returns){\n validate_expr(stmt.returns, Load)\n }\n break;\n case mod.Pass:\n case mod.Break:\n case mod.Continue:\n break;\n // No default case so compiler emits warning for unhandled cases\n }\n}\n\n\nmod._validate = function(ast_obj){\n switch (ast_obj.__class__) {\n case mod.Module:\n validate_stmts(ast_obj.body);\n break;\n case mod.Interactive:\n validate_stmts(ast_obj.body);\n break;\n case mod.Expression:\n validate_expr(ast_obj.body, Load);\n break;\n case mod.FunctionType:\n validate_exprs(ast_obj.argtypes, Load, 0) &&\n validate_expr(ast_obj.returns, Load);\n break;\n // No default case so compiler emits warning for unhandled cases\n }\n}\nreturn mod\n\n}\n)(__BRYTHON__)\n"], "_base64": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins,\n _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\n\nfunction make_alphabet(altchars){\n var alphabet = _keyStr\n if(altchars !== undefined && altchars !== _b_.None){\n // altchars is an instance of Python bytes\n var source = altchars.source\n alphabet = alphabet.substr(0,alphabet.length-3) +\n _b_.chr(source[0]) + _b_.chr(source[1]) + '='\n }\n return alphabet\n}\n\nvar Base64 = {\n error: function(){return 'binascii_error'},\n\n encode: function(bytes, altchars){\n\n var input = bytes.source,\n output = \"\",\n chr1, chr2, chr3, enc1, enc2, enc3, enc4\n var i = 0\n\n var alphabet = make_alphabet(altchars)\n\n while(i < input.length){\n\n chr1 = input[i++]\n chr2 = input[i++]\n chr3 = input[i++]\n\n enc1 = chr1 >> 2\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4)\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6)\n enc4 = chr3 & 63\n\n if(isNaN(chr2)){\n enc3 = enc4 = 64\n }else if(isNaN(chr3)){\n enc4 = 64\n }\n\n output = output + alphabet.charAt(enc1) +\n alphabet.charAt(enc2) +\n alphabet.charAt(enc3) +\n alphabet.charAt(enc4)\n\n }\n return _b_.bytes.$factory(output, 'utf-8', 'strict')\n },\n\n\n decode: function(bytes, altchars, validate){\n var output = [],\n chr1, chr2, chr3,\n enc1, enc2, enc3, enc4\n\n var alphabet = make_alphabet(altchars)\n\n var input = bytes.source\n\n // If validate is set, check that all characters in input\n // are in the alphabet\n var _input = ''\n var padding = 0\n for(var i = 0, len = input.length; i < len; i++){\n var car = String.fromCharCode(input[i])\n var char_num = alphabet.indexOf(car)\n if(char_num == -1){\n if(validate){throw Base64.error(\"Non-base64 digit found: \" +\n car)}\n }else if(char_num == 64 && i < input.length - 2){\n if(validate){throw Base64.error(\"Non-base64 digit found: \" +\n car)}\n }else if(char_num == 64 && i >= input.length - 2){\n padding++\n _input += car\n }else{\n _input += car\n }\n }\n input = _input\n if(_input.length == padding){return _b_.bytes.$factory([])}\n if( _input.length % 4 > 0){throw Base64.error(\"Incorrect padding\")}\n\n var i = 0\n while(i < input.length){\n\n enc1 = alphabet.indexOf(input.charAt(i++))\n enc2 = alphabet.indexOf(input.charAt(i++))\n enc3 = alphabet.indexOf(input.charAt(i++))\n enc4 = alphabet.indexOf(input.charAt(i++))\n\n chr1 = (enc1 << 2) | (enc2 >> 4)\n chr2 = ((enc2 & 15) << 4) | (enc3 >> 2)\n chr3 = ((enc3 & 3) << 6) | enc4\n\n output.push(chr1)\n\n if(enc3 != 64){output.push(chr2)}\n if(enc4 != 64){output.push(chr3)}\n\n }\n // return Python bytes\n return _b_.bytes.$factory(output, 'utf-8', 'strict')\n\n },\n\n _utf8_encode: function(string) {\n string = string.replace(/\\r\\n/g, \"\\n\")\n var utftext = \"\";\n\n for(var n = 0; n < string.length; n++){\n\n var c = string.charCodeAt(n)\n\n if(c < 128){\n utftext += String.fromCharCode(c)\n }else if((c > 127) && (c < 2048)){\n utftext += String.fromCharCode((c >> 6) | 192)\n utftext += String.fromCharCode((c & 63) | 128)\n }else{\n utftext += String.fromCharCode((c >> 12) | 224)\n utftext += String.fromCharCode(((c >> 6) & 63) | 128)\n utftext += String.fromCharCode((c & 63) | 128)\n }\n\n }\n\n return utftext\n },\n\n _utf8_decode: function(utftext) {\n var string = \"\",\n i = 0,\n c = c1 = c2 = 0\n\n while(i < utftext.length){\n\n c = utftext.charCodeAt(i)\n\n if(c < 128){\n string += String.fromCharCode(c)\n i++\n }else if((c > 191) && (c < 224)){\n c2 = utftext.charCodeAt(i + 1)\n string += String.fromCharCode(((c & 31) << 6) | (c2 & 63))\n i += 2\n }else{\n c2 = utftext.charCodeAt(i + 1)\n c3 = utftext.charCodeAt(i + 2)\n string += String.fromCharCode(\n ((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63))\n i += 3\n }\n\n }\n\n return string\n }\n\n}\n\nreturn {Base64:Base64}\n}\n\n)(__BRYTHON__)"], "_binascii": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins,\n _keyStr = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\"\n\nvar error = $B.make_class(\"error\", _b_.Exception.$factory)\nerror.__bases__ = [_b_.Exception]\n$B.set_func_names(error, \"binascii\")\n\nfunction decode(bytes, altchars, validate){\n var output = [],\n chr1, chr2, chr3,\n enc1, enc2, enc3, enc4\n\n var alphabet = make_alphabet(altchars)\n\n var input = bytes.source\n\n // If validate is set, check that all characters in input\n // are in the alphabet\n var _input = ''\n var padding = 0\n for(var i = 0, len = input.length; i < len; i++){\n var car = String.fromCharCode(input[i])\n var char_num = alphabet.indexOf(car)\n if(char_num == -1){\n if(validate){throw error.$factory(\"Non-base64 digit found: \" +\n car)}\n }else if(char_num == 64 && i < input.length - 2){\n if(validate){throw error.$factory(\"Non-base64 digit found: \" +\n car)}\n }else if(char_num == 64 && i >= input.length - 2){\n padding++\n _input += car\n }else{\n _input += car\n }\n }\n input = _input\n if(_input.length == padding){return _b_.bytes.$factory([])}\n if( _input.length % 4 > 0){throw error.$factory(\"Incorrect padding\")}\n\n var i = 0\n while(i < input.length){\n\n enc1 = alphabet.indexOf(input.charAt(i++))\n enc2 = alphabet.indexOf(input.charAt(i++))\n enc3 = alphabet.indexOf(input.charAt(i++))\n enc4 = alphabet.indexOf(input.charAt(i++))\n\n chr1 = (enc1 << 2) | (enc2 >> 4)\n chr2 = ((enc2 & 15) << 4) | (enc3 >> 2)\n chr3 = ((enc3 & 3) << 6) | enc4\n\n output.push(chr1)\n\n if(enc3 != 64){output.push(chr2)}\n if(enc4 != 64){output.push(chr3)}\n\n }\n // return Python bytes\n return _b_.bytes.$factory(output)\n}\n\n\nvar hex2int = {},\n hex = '0123456789abcdef'\nfor(var i = 0; i < hex.length; i++){\n hex2int[hex[i]] = i\n hex2int[hex[i].toUpperCase()] = i\n}\n\nfunction make_alphabet(altchars){\n var alphabet = _keyStr\n if(altchars !== undefined && altchars !== _b_.None){\n // altchars is an instance of Python bytes\n var source = altchars.source\n alphabet = alphabet.substr(0,alphabet.length-3) +\n _b_.chr(source[0]) + _b_.chr(source[1]) + '='\n }\n return alphabet\n}\n\nvar module = {\n a2b_base64: function(){\n var $ = $B.args(\"a2b_base64\", 2, {s: null, strict_mode: null}, \n ['s', 'strict_mode'],\n arguments, {strict_mode: false}, null, null)\n var bytes\n if($B.$isinstance($.s, _b_.str)){\n bytes = _b_.str.encode($.s, 'ascii')\n }else if($B.$isinstance($.s, [_b_.bytes, _b_.bytearray])){\n bytes = $.s\n }else{\n throw _b_.TypeError.$factory('wrong type: ' + $B.class_name($.s))\n }\n return decode(bytes)\n },\n a2b_hex: function(){\n var $ = $B.args(\"a2b_hex\", 1, {s: null}, ['s'],\n arguments, {}, null, null),\n s = $.s\n if($B.$isinstance(s, _b_.bytes)){\n s = _b_.bytes.decode(s, 'ascii')\n }\n if(typeof s !== \"string\"){\n throw _b_.TypeError.$factory(\"argument should be bytes, \" +\n \"buffer or ASCII string, not '\" + $B.class_name(s) + \"'\")\n }\n\n var len = s.length\n if(len % 2 == 1){\n throw _b_.TypeError.$factory('Odd-length string')\n }\n\n var res = []\n for(var i = 0; i < len; i += 2){\n res.push((hex2int[s.charAt(i)] << 4) + hex2int[s.charAt(i + 1)])\n }\n return _b_.bytes.$factory(res)\n },\n b2a_base64: function(){\n var $ = $B.args(\"b2a_base64\", 1, {data: null}, ['data'],\n arguments, {}, null, \"kw\")\n var newline = false\n if($.kw && $.kw.$jsobj.hasOwnProperty('newline')){\n newline = $.kw.$jsobj.newline\n }\n\n var string = $B.to_bytes($.data),\n res = btoa(String.fromCharCode.apply(null, string))\n if(newline){res += \"\\n\"}\n return _b_.bytes.$factory(res, \"ascii\")\n },\n b2a_hex: function(obj){\n var string = $B.to_bytes(obj),\n res = []\n function conv(c){\n if(c > 9){\n c = c + 'a'.charCodeAt(0) - 10\n }else{\n c = c + '0'.charCodeAt(0)\n }\n return c\n }\n string.forEach(function(char){\n res.push(conv((char >> 4) & 0xf))\n res.push(conv(char & 0xf))\n })\n return _b_.bytes.$factory(res)\n },\n b2a_uu: function(obj){\n var string = _b_.bytes.decode(obj, 'ascii')\n var len = string.length,\n res = String.fromCharCode((0x20 + len) & 0x3F)\n while(string.length > 0){\n var s = string.slice(0, 3)\n while(s.length < 3){s.push(String.fromCharCode(0))}\n var A = s[0],\n B = s[1],\n C = s[2]\n var a = (A >> 2) & 0x3F,\n b = ((A << 4) | ((B >> 4) & 0xF)) & 0x3F,\n c = (((B << 2) | ((C >> 6) & 0x3)) & 0x3F),\n d = C & 0x3F\n res += String.fromCharCode(0x20 + a, 0x20 + b, 0x20 + c, 0x20 + d)\n string = string.slice(3)\n }\n return _b_.bytes.$factory(res + \"\\n\", \"ascii\")\n },\n error: error\n}\n\nmodule.hexlify = module.b2a_hex\nmodule.unhexlify = module.a2b_hex\n\nreturn module\n}\n)(__BRYTHON__)"], "_io_classes": [".js", "var _b_ = __BRYTHON__.builtins\n\nfunction get_self(name, args){\n return $B.args(name, 1, {self: null}, [\"self\"], args, {}, null, null).self\n}\n\nvar _IOBase = $B.make_class(\"_IOBase\")\n_IOBase.__mro__ = [_b_.object]\n\n_IOBase.close = function(){\n get_self(\"close\", arguments).__closed = true\n}\n\n_IOBase.flush = function(){\n get_self(\"flush\", arguments)\n return _b_.None\n}\n\n$B.set_func_names(_IOBase, '_io')\n\n// Base class for binary streams that support some kind of buffering.\nvar _BufferedIOBase = $B.make_class(\"_BufferedIOBase\")\n_BufferedIOBase.__mro__ = [_IOBase, _b_.object]\n\n_BufferedIOBase.__enter__ = function(self){\n return self\n}\n_BufferedIOBase.__exit__ = function(self, type, value, traceback){\n try{\n $B.$call($B.$getattr(self, 'close'))()\n self.__closed = true\n return true\n }catch(err){\n return false\n }\n}\n\n$B.set_func_names(_BufferedIOBase, '_io')\n\n// Base class for raw binary I/O.\nvar _RawIOBase = $B.make_class(\"_RawIOBase\")\n\n_RawIOBase.__mro__ = [_IOBase, _b_.object]\n\n_RawIOBase.read = function(){\n var $ = $B.args(\"read\", 2, {self: null, size: null}, [\"self\", \"size\"],\n arguments, {size: -1}, null, null),\n self = $.self,\n size = $.size,\n res\n self.$pos = self.$pos || 0\n if(size == -1){\n if(self.$pos == 0){\n res = self.$content\n }else{\n res = _b_.bytes.$factory(self.$content.source.slice(self.$pos))\n }\n self.$pos = self.$content.source.length - 1\n }else{\n res = _b_.bytes.$factory(self.$content.source.slice(self.$pos, size))\n self.$pos += size\n }\n return res\n}\n\n_RawIOBase.readall = function(){\n return _RawIOBase.read(get_self(\"readall\", arguments))\n}\n\n$B.set_func_names(_RawIOBase, '_io')\n\n// Base class for text streams.\n_TextIOBase = $B.make_class(\"_TextIOBase\")\n_TextIOBase.__mro__ = [_IOBase, _b_.object]\n\nvar StringIO = $B.make_class(\"StringIO\",\n function(){\n var $ = $B.args(\"StringIO\", 2, {value: null, newline: null},\n [\"value\", \"newline\"], arguments, {value: '', newline: \"\\n\"},\n null, null)\n return {\n __class__: StringIO,\n $counter: 0,\n $content: $.value\n }\n }\n)\n\nStringIO.__mro__ = [$B.Reader, _b_.object]\n\nStringIO.getvalue = function(){\n var $ = $B.args(\"getvalue\", 1, {self: null},\n [\"self\"], arguments, {}, null, null)\n return $.self.$content.substr(0) // copy\n}\n\nStringIO.truncate = function(self, size){\n var $ = $B.args('truncate', 2, {self: null, size: null}, ['self', 'size'],\n arguments, {size: _b_.None}, null, null),\n self = $.self,\n size = $.size\n if(size === _b_.None){\n size = self.$counter\n }\n self.$content = self.$content.substr(0, size)\n self.$counter = self.$content.length\n return self.$counter\n}\n\nStringIO.write = function(){\n var $ = $B.args(\"write\", 2, {self: null, data: null},\n [\"self\", \"data\"], arguments, {}, null, null)\n if(! $B.$isinstance($.data, _b_.str)){\n throw _b_.TypeError.$factory('string argument expected, got ' +\n `'${$B.class_name($.data)}'`)\n }\n var text = $.self.$content,\n position = $.self.$counter\n text = text.substr(0, position) + $.data +\n text.substr(position + $.data.length)\n $.self.$content = text\n $.self.$counter = position + $.data.length\n return $.data.length\n}\n\n$B.set_func_names(StringIO, \"_io\")\n\nvar BytesIO = $B.make_class(\"BytesIO\",\n function(){\n var $ = $B.args(\"BytesIO\", 1, {value: null},\n [\"value\"], arguments, {value: _b_.bytes.$factory()},\n null, null)\n return {\n __class__: BytesIO,\n $binary: true,\n $content: $.value,\n $length: $.value.source.length,\n $counter: 0\n }\n }\n)\nBytesIO.__mro__ = [$B.Reader, _b_.object]\n\nBytesIO.getbuffer = function(){\n var self = get_self(\"getbuffer\", arguments)\n return self.$content\n}\n\nBytesIO.getvalue = function(){\n var self = get_self(\"getvalue\", arguments)\n return self.$content\n}\n\nBytesIO.write = function(){\n var $ = $B.args(\"write\", 2, {self: null, data: null},\n [\"self\", \"data\"], arguments, {}, null, null)\n $.self.$content.source = $.self.$content.source.concat(\n $.data.source)\n $.self.$counter += $.data.source.length\n return _b_.None\n}\n\n$B.set_func_names(BytesIO, \"_io\")\n\nvar BlockingIOError = $B.make_class('BlockingIOError')\nBlockingIOError.__bases__ = [_b_.OSError]\n\n$B.set_func_names(BlockingIOError, '_io')\n\nvar $module = (function($B){\n return {\n _BufferedIOBase,\n _IOBase,\n _RawIOBase,\n _TextIOBase: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n BlockingIOError,\n BytesIO: BytesIO,\n FileIO: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n StringIO: StringIO,\n BufferedReader: $B.BufferedReader,\n BufferedWriter: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n BufferedRWPair: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n BufferedRandom: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n IncrementalNewlineDecoder: $B.make_class(\"_TextIOBase\",\n function(){\n return \"fileio\"\n }\n ),\n TextIOWrapper: $B.TextIOWrapper\n }\n})(__BRYTHON__)\n$module._IOBase.__doc__ = \"_IOBase\""], "_json": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins\n\nfunction simple(obj){\n switch(typeof obj){\n case 'string':\n case 'number':\n case 'boolean':\n return true\n }\n if(obj instanceof Number ||\n Array.isArray(obj) ||\n $B.$isinstance(obj, [_b_.list, _b_.tuple, _b_.dict])){\n return true\n }\n return false\n}\n\nfunction to_json(obj, level){\n var $defaults = {skipkeys:_b_.False, ensure_ascii:_b_.True,\n check_circular:_b_.True, allow_nan:_b_.True, cls:_b_.None,\n indent:_b_.None, separators:_b_.None, \"default\":_b_.None,\n sort_keys:_b_.False},\n $ = $B.args(\"to_json\", 2, {obj: null, level: null}, ['obj', 'level'],\n arguments, {level: 1}, null, \"kw\")\n\n for(var key in $defaults){\n if(! $.kw.$jsobj.hasOwnProperty(key)){\n $.kw.$jsobj[key] = $defaults[key]\n }\n }\n\n // Transform Python dict into Javascript object\n var kw = $.kw.$jsobj\n\n var indent = kw.indent,\n ensure_ascii = kw.ensure_ascii,\n separators = kw.separators === _b_.None ?\n kw.indent === _b_.None ? [', ', ': '] : [',', ': '] :\n kw.separators,\n skipkeys = kw.skipkeys,\n _default = kw.default,\n sort_keys = kw.sort_keys,\n allow_nan = kw.allow_nan,\n check_circular = kw.check_circular\n var item_separator = separators[0],\n key_separator = separators[1]\n if(indent !== _b_.None){\n var indent_str\n if(typeof indent == \"string\"){\n indent_str = indent\n }else if(typeof indent == \"number\" && indent >= 1){\n indent_str = \" \".repeat(indent)\n }else{\n throw _b_.ValueError.$factory(\"invalid indent: \" +\n _b_.str.$factory(indent))\n }\n }\n var kwarg = {$kw: [{}]}\n for(var key in kw){\n kwarg.$kw[0][key] = kw[key]\n }\n\n switch(typeof obj){\n case 'string':\n var res = JSON.stringify(obj)\n if(ensure_ascii){\n var escaped = ''\n for(var i = 0, len = res.length; i < len; i++){\n var u = res.codePointAt(i)\n if(u > 127){\n u = u.toString(16)\n while(u.length < 4){\n u = \"0\" + u\n }\n escaped += '\\\\u' + u\n }else{\n escaped += res.charAt(i)\n }\n }\n return escaped\n }\n return res\n case 'boolean':\n return obj.toString()\n case 'number':\n if([Infinity, -Infinity].indexOf(obj) > -1 ||\n isNaN(obj)){\n if(! allow_nan){\n throw _b_.ValueError.$factory(\n 'Out of range float values are not JSON compliant')\n }\n }\n return obj.toString()\n }\n if(obj instanceof String){\n // string with surrogate pairs. cf. issue #1903.\n var res = ''\n if(obj.surrogates){\n var s_ix = 0,\n s_pos = obj.surrogates[s_ix]\n for(var i = 0, len = obj.length; i < len; i++){\n if(i == s_pos){\n var code = obj.codePointAt(i) - 0x10000\n res += '\\\\u' + (0xD800 | (code >> 10)).toString(16) +\n '\\\\u' + (0xDC00 | (code & 0x3FF)).toString(16)\n i++\n s_ix++\n s_pos = obj.surrogates[s_ix]\n }else{\n var code = obj.charCodeAt(i)\n if(code < 127){\n var x = _b_.repr(obj[i])\n res += x.substr(1, x.length - 2)\n }else{\n var x = code.toString(16)\n while(x.length < 4){\n x = '0' + x\n }\n res += '\\\\u' + x\n }\n }\n }\n }\n return '\"' + res.replace(new RegExp('\"', \"g\"), '\\\\\"') + '\"'\n }\n\n if($B.$isinstance(obj, _b_.list)){\n var res = []\n var sep = item_separator,\n first = '[',\n last = ']'\n if(indent !== _b_.None){\n sep += \"\\n\" + indent_str.repeat(level)\n first = '[' + '\\n' + indent_str.repeat(level)\n last = '\\n' + indent_str.repeat(level - 1) + ']'\n level++\n }\n for(var i = 0, len = obj.length; i < len; i++){\n res.push(to_json(obj[i], level, kwarg))\n }\n return first + res.join(sep) + last\n }else if($B.$isinstance(obj, _b_.float)){\n return obj.value\n }else if(obj.__class__ === $B.long_int){\n return obj.value.toString()\n }else if(obj === _b_.None){\n return \"null\"\n }else if($B.$isinstance(obj, _b_.dict)){\n var res = [],\n items = Array.from($B.make_js_iterator(_b_.dict.items(obj)))\n if(sort_keys){\n // Sort keys by alphabetical order\n items.sort()\n }\n var sep = item_separator,\n first = '{',\n last = '}'\n if(indent !== _b_.None){\n sep += \"\\n\" + indent_str.repeat(level)\n first = '{' + '\\n' + indent_str.repeat(level)\n last = '\\n' + indent_str.repeat(level - 1) + '}'\n level++\n }\n for(var i = 0, len = items.length; i < len; i++){\n var item = items[i]\n if(! simple(item[0])){\n if(! skipkeys){\n throw _b_.TypeError.$factory(\"keys must be str, int, \" +\n \"float, bool or None, not \" + $B.class_name(obj))\n }\n }else{\n // In the result, key must be a string\n var key = _b_.str.$factory(item[0])\n // Check circular reference\n if(check_circular && $B.repr.enter(item[1])){\n throw _b_.ValueError.$factory(\"Circular reference detected\")\n }\n res.push(\n [to_json(key, level, kwarg), to_json(item[1], level, kwarg)].\n join(key_separator))\n if(check_circular){\n $B.repr.leave(item[1])\n }\n }\n }\n return first + res.join(sep) + last\n }\n // For other types, use function default if provided\n if(_default == _b_.None){\n throw _b_.TypeError.$factory(\"Object of type \" + $B.class_name(obj) +\n \" is not JSON serializable\")\n }else{\n return to_json($B.$call(_default)(obj), level, kwarg)\n }\n}\n\nfunction loads(s){\n var args = []\n for(var i = 1, len = arguments.length; i < len; i++){\n args.push(arguments[i])\n }\n var decoder = JSONDecoder.$factory.apply(null, args)\n return JSONDecoder.decode(decoder, s)\n}\n\nfunction to_py(obj, kw){\n // Conversion to Python objects\n // kw are the keyword arguments to loads()\n var res\n if(obj instanceof List){\n return obj.items.map(x => to_py(x, kw))\n }else if(obj instanceof Dict){\n if(kw.object_pairs_hook !== _b_.None){\n var pairs = []\n for(var i = 0, len = obj.keys.length; i < len; i++){\n pairs.push($B.fast_tuple([obj.keys[i],\n to_py(obj.values[i], kw)]))\n }\n return $B.$call(kw.object_pairs_hook)(pairs)\n }else{\n var dict = $B.empty_dict()\n for(var i = 0, len = obj.keys.length; i < len; i++){\n _b_.dict.$setitem(dict, obj.keys[i], to_py(obj.values[i], kw))\n }\n return kw.object_hook === _b_.None ? dict :\n $B.$call(kw.object_hook)(dict)\n }\n }else if(obj.type == 'str'){\n return obj.value\n }else if(obj.type == 'num'){\n if(obj.value.search(/[.eE]/) > -1){\n // float\n if(kw.parse_float !== _b_.None){\n return $B.$call(kw.parse_float)(obj.value)\n }\n return $B.fast_float(obj.value)\n }else{\n // integer\n if(kw.parse_int !== _b_.None){\n return $B.$call(kw.parse_int)(obj.value)\n }\n var int = parseInt(obj.value)\n if(Math.abs(int) < $B.max_int){\n return int\n }else{\n return $B.fast_long_int(BigInt(obj.value))\n }\n }\n }else{\n if(obj instanceof Number && kw.parse_float !== _b_.None){\n return $B.$call(kw.parse_float)(obj)\n }else if(kw.parse_int !== _b_.None &&\n (typeof obj == 'number' || obj.__class__ === $B.long_int)){\n return $B.$call(kw.parse_int)(obj)\n }else if(kw.parse_constant !== _b_.None && ! isFinite(obj)){\n return kw.parse_constant(obj)\n }\n return obj\n }\n}\n\nvar escapes = {'n': '\\n',\n 't': '\\t',\n 'b': '\\b',\n 'r': '\\r',\n 'f': '\\f',\n '\\\\': '\\\\',\n '\"': '\\\"',\n \"'\": \"\\\\'\",\n '/': '/'\n }\n\nfunction string_at(s, i){\n var error = $B.$call($B.imported[\"json\"].JSONDecodeError)\n\n var j = i + 1,\n escaped = false,\n len = s.length,\n value = ''\n while(j < len){\n if(s[j] == '\"' && ! escaped){\n return [{type: 'str', value}, j + 1]\n }else if(! escaped && s[j] == '\\\\'){\n escaped = ! escaped\n j++\n }else if(escaped){\n var esc = escapes[s[j]]\n if(esc){\n value += esc\n j++\n escaped = false\n }else if(s[j] == 'u' &&\n s.substr(j + 1, 4).match(/[0-9a-fA-f]{4}/)){\n // unicode escape\n value += String.fromCharCode(parseInt(s.substr(j + 1, 4), 16))\n j += 5\n escaped = ! escaped\n }else{\n throw error('invalid escape \"' + s[j] + '\"', s, j)\n }\n }else{\n value += s[j]\n j++\n }\n }\n}\n\nfunction to_num(num_string, nb_dots, exp){\n // convert to correct Brython type\n if(exp || nb_dots){\n return new Number(num_string)\n }else{\n var int = parseInt(num_string)\n if(Math.abs(int) < $B.max_int){\n return int\n }else{\n if(num_string.startsWith('-')){\n return $B.fast_long_int(num_string.substr(1), false)\n }else{\n return $B.fast_long_int(num_string, true)\n }\n }\n }\n}\n\nfunction num_at(s, i){\n var res = s[i],\n j = i + 1,\n nb_dots = 0,\n exp = false,\n len = s.length\n while(j < len){\n if(s[j].match(/\\d/)){\n j++\n }else if(s[j] == '.' && nb_dots == 0){\n nb_dots++\n j++\n }else if('eE'.indexOf(s[j]) > -1 && ! exp){\n exp = ! exp\n j++\n }else{\n return [{type: 'num', value: s.substring(i, j)}, j]\n }\n }\n return [{type: 'num', value: s.substring(i, j)}, j]\n}\n\nfunction* tokenize(s){\n var i = 0,\n len = s.length,\n value,\n end\n while(i < len){\n if(s[i] == \" \" || s[i] == '\\r' || s[i] == '\\n' || s[i] == '\\t'){\n i++\n }else if('[]{}:,'.indexOf(s[i]) > -1){\n yield [s[i], i]\n i++\n }else if(s.substr(i, 4) == 'null'){\n yield [_b_.None , i]\n i += 4\n }else if(s.substr(i, 4) == 'true'){\n yield [true, i]\n i += 4\n }else if(s.substr(i, 5) == 'false'){\n yield [false, i]\n i += 5\n }else if(s.substr(i, 8) == 'Infinity'){\n yield [{type: 'num', value: 'Infinity'}, i]\n i += 8\n }else if(s.substr(i, 9) == '-Infinity'){\n yield [{type: 'num', value: '-Infinity'}, i]\n i += 9\n }else if(s.substr(i, 3) == 'NaN'){\n yield [{type: 'num', value: 'NaN'}, i]\n i += 3\n }else if(s[i] == '\"'){\n value = string_at(s, i)\n yield value\n i = value[1]\n }else if(s[i].match(/\\d/) || s[i] == '-'){\n value = num_at(s, i)\n yield value\n i = value[1]\n }else{\n throw Error('unexpected: ' + s[i] + s.charCodeAt(i))\n }\n }\n}\n\nfunction Node(parent){\n this.parent = parent\n if(parent instanceof List){\n this.list = parent.items\n }else if(parent instanceof Dict){\n this.list = parent.values\n }else if(parent === undefined){\n this.list = []\n }\n}\n\nNode.prototype.transition = function(token){\n if([true, false, _b_.None].indexOf(token) > -1 ||\n ['str', 'num'].indexOf(token.type) > -1){\n if(this.parent === undefined &&\n (this.list.length > 0 || this.content)){\n throw Error('Extra data')\n }\n this.list.push(token)\n return this.parent ? this.parent : this\n }else if(token == '{'){\n if(this.parent === undefined){\n this.content = new Dict(this)\n return this.content\n }\n return new Dict(this.parent)\n }else if(token == '['){\n if(this.parent === undefined){\n this.content = new List(this)\n return this.content\n }\n return new List(this.parent)\n }else{\n throw Error('unexpected item:' + token)\n }\n}\n\nfunction Dict(parent){\n this.parent = parent\n this.keys = []\n this.values = []\n this.expect = 'key'\n if(parent instanceof List){\n parent.items.push(this)\n }else if(parent instanceof Dict){\n parent.values.push(this)\n }\n}\n\nDict.prototype.transition = function(token){\n if(this.expect == 'key'){\n if(token.type == 'str'){\n this.keys.push(token.value)\n this.expect = ':'\n return this\n }else if(token == '}' && this.keys.length == 0){\n return this.parent\n }else{\n throw Error('expected str')\n }\n }else if(this.expect == ':'){\n if(token == ':'){\n this.expect = '}'\n return new Node(this)\n }else{\n throw Error('expected :')\n }\n }else if(this.expect == '}'){\n if(token == '}'){\n return this.parent\n }else if(token == ','){\n this.expect = 'key'\n return this\n }\n throw Error('expected }')\n }\n}\n\nfunction List(parent){\n if(parent instanceof List){\n parent.items.push(this)\n }\n this.parent = parent\n this.items = []\n this.expect = 'item'\n}\n\nList.prototype.transition = function(token){\n if(this.expect == 'item'){\n this.expect = ','\n if([true, false, _b_.None].indexOf(token) > -1){\n this.items.push(token)\n return this\n }else if(token.type == 'num' || token.type == 'str'){\n this.items.push(token)\n return this\n }else if(token == '{'){\n return new Dict(this)\n }else if(token == '['){\n return new List(this)\n }else if(token == ']'){\n if(this.items.length == 0){\n if(this.parent instanceof Dict){\n this.parent.values.push(this)\n }\n return this.parent\n }\n throw Error('unexpected ]')\n }else{\n console.log('token', token)\n throw Error('unexpected item:' + token)\n }\n\n }else if(this.expect == ','){\n this.expect = 'item'\n if(token == ','){\n return this\n }else if(token == ']'){\n if(this.parent instanceof Dict){\n this.parent.values.push(this)\n }\n return this.parent\n }else{\n throw Error('expected :')\n }\n }\n}\n\nfunction parse(s){\n var res,\n state,\n node = new Node(),\n root = node,\n token\n for(var item of tokenize(s)){\n token = item[0]\n try{\n node = node.transition(token)\n }catch(err){\n console.log('error, item', item)\n console.log(err, err.message)\n console.log('node', node)\n if(err.__class__){\n throw err\n }else{\n var error = $B.$call($B.imported[\"json\"].JSONDecodeError)\n throw error(err.message, s, item[1])\n }\n }\n }\n return root.content ? root.content : root.list[0]\n}\n\nvar JSONDecoder = $B.make_class(\"JSONDecoder\",\n function(){\n var $defaults = {cls: _b_.None, object_hook: _b_.None,\n parse_float: _b_.None, parse_int: _b_.None,\n parse_constant: _b_.None, object_pairs_hook: _b_.None},\n $ = $B.args(\"decode\", 0, {}, [], arguments, {}, null, \"kw\")\n var kw = $.kw.$jsobj\n for(var key in $defaults){\n if(kw[key] === undefined){\n kw[key] = $defaults[key]\n }\n }\n return {\n __class__: JSONDecoder,\n object_hook: kw.object_hook,\n parse_float: kw.parse_float,\n parse_int: kw.parse_int,\n parse_constant: kw.parse_constant,\n object_pairs_hook: kw.object_pairs_hook,\n memo: $B.empty_dict()\n }\n }\n)\n\nJSONDecoder.decode = function(self, s){\n return to_py(parse(s), self)\n}\n\nreturn {\n dumps: function(){\n return _b_.str.$factory(to_json.apply(null, arguments))\n },\n loads,\n JSONDecoder\n}\n\n})(__BRYTHON__)"], "_jsre": [".js", "var $module = (function($B){\n\n var _b_ = $B.builtins\n\n var MatchObject = $B.make_class(\"Match\",\n function(jsmatch, string, pattern){\n return {\n __class__: MatchObject,\n jsmatch: jsmatch,\n string: string\n }\n }\n )\n MatchObject.item = function(self, rank){\n return self.jsmatch[rank]\n }\n MatchObject.group = function(self){\n var res = []\n for(var i = 0, _len_i = arguments.length; i < _len_i; i++){\n if(self.jsmatch[arguments[i]] === undefined){res.push(_b_.None)}\n else{res.push(self.jsmatch[arguments[i]])}\n }\n if(arguments.length == 1){return res[0]}\n return _b_.tuple.$factory(res)\n }\n MatchObject.groups = function(self, _default){\n if(_default === undefined){_default = _b_.None}\n var res = []\n for(var i = 1, _len_i = self.length; i < _len_i; i++){\n if(self.jsmatch[i] === undefined){res.push(_default)}\n else{res.push(self.jsmatch[i])}\n }\n return _b_.tuple.$factory(res)\n }\n MatchObject.start = function(self){\n return self.index\n }\n MatchObject.end = function(self){\n return self.length - self.index\n }\n\n $B.set_func_names(MatchObject, '_jsre')\n\n var obj = {__class__: $module,\n __str__: function(){return \"\"}\n }\n obj.A = obj.ASCII = 256\n obj.I = obj.IGNORECASE = 2 // 'i'\n obj.L = obj.LOCALE = 4\n obj.M = obj.MULTILINE = 8 // 'm'\n obj.S = obj.DOTALL = 16\n obj.U = obj.UNICODE = 32\n obj.X = obj.VERBOSE = 64\n obj._is_valid = function(pattern) {\n if ($B.$options.re == 'pyre'){return false} //force use of python's re module\n if ($B.$options.re == 'jsre'){return true} //force use of brythons re module\n // FIXME: Improve\n\n if(! $B.$isinstance(pattern, _b_.str)){\n // this is probably a SRE_PATTERN, so return false, and let\n // python's re module handle this.\n return false\n }\n var is_valid = false\n try{\n new RegExp(pattern)\n is_valid = true\n }\n catch(e){}\n if(! is_valid){return false} //if js won't parse the pattern return false\n\n // using reference http://www.regular-expressions.info/\n // to compare python re and javascript regex libraries\n\n // look for things javascript does not support\n // check for name capturing group\n var mylist = ['?P=', '?P<', '(?#', '(?<=', '(? -1) return false\n }\n\n var re_list=['\\{,\\d+\\}']\n for(var i=0, _len_i = re_list.length; i < _len_i; i++) {\n var _re = new RegExp(re_list[i])\n if (_re.test(pattern)){return false}\n }\n\n // it looks like the pattern has passed all our tests so lets assume\n // javascript can handle this pattern.\n return true\n }\n var $SRE_PatternDict = {\n __class__:_b_.type,\n $infos:{\n __name__:'SRE_Pattern'\n }\n }\n $SRE_PatternDict.__mro__ = [_b_.object]\n $SRE_PatternDict.findall = function(self, string){\n return obj.findall(self.pattern, string, self.flags)\n }\n $SRE_PatternDict.finditer = function(self, string){\n return obj.finditer(self.pattern, string, self.flags)\n }\n $SRE_PatternDict.match = function(self, string){\n return obj.match(self.pattern, string, self.flags)\n }\n $SRE_PatternDict.search = function(self, string){\n return obj.search(self.pattern, string, self.flags)\n }\n $SRE_PatternDict.sub = function(self,repl,string){\n return obj.sub(self.pattern,repl,string,self.flags)\n }\n $B.set_func_names($SRE_PatternDict, \"_jsre\")\n // TODO: groups\n // TODO: groupindex\n function normflags(flags){\n return ((flags & obj.I)? 'i' : '') + ((flags & obj.M)? 'm' : '');\n }\n // TODO: fullmatch()\n // TODO: split()\n // TODO: subn()\n obj.compile = function(pattern, flags){\n return {\n __class__: $SRE_PatternDict,\n pattern: pattern,\n flags: normflags(flags)\n }\n }\n obj.escape = function(string){\n // Escape all the characters in pattern except ASCII letters, numbers\n // and '_'. This is useful if you want to match an arbitrary literal\n // string that may have regular expression metacharacters in it.\n var res = ''\n var ok = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'\n for(var i = 0, _len_i = string.length; i < _len_i; i++){\n if(ok.search(string.charAt(i))>-1){res += string.charAt(i)}\n }\n return res\n }\n obj.findall = function(pattern, string, flags){\n var $ns=$B.args('re.findall', 2,\n {pattern:null, string:null}, ['pattern', 'string'],\n arguments,{}, 'args', 'kw') ,\n args = $ns['args'] ,\n _flags = 0;\n if(args.length>0){var flags = args[0]}\n else{var _flags = $B.$getattr($ns['kw'], 'get')('flags', 0)}\n\n var flags = normflags()\n flags += 'gm'\n var jsp = new RegExp(pattern,flags),\n jsmatch = string.match(jsp)\n if(jsmatch === null){return []}\n return jsmatch\n }\n obj.finditer = function(pattern, string, flags){\n var $ns=$B.args('re.finditer', 2,\n {pattern:null, string:null}, ['pattern', 'string'],\n arguments,{},'args','kw'),\n args = $ns['args'],\n _flags = 0;\n if(args.length>0){var flags=args[0]}\n else{var _flags = $B.$getattr($ns['kw'], 'get')('flags', 0)}\n\n var flags = normflags()\n flags += 'gm'\n var jsp = new RegExp(pattern, flags),\n jsmatch = string.match(jsp);\n if(jsmatch === null){return []}\n\n var _list = []\n for(var j = 0, _len_j = jsmatch.length; j < _len_j; j++) {\n var mo = {}\n mo._match=jsmatch[j]\n mo.group = function(){\n var res = []\n for(var i=0, _len_i = arguments.length; i < _len_i;i++){\n if(jsmatch[arguments[i]] === undefined){res.push(_b_.None)}\n else{res.push(jsmatch[arguments[i]])}\n }\n if(arguments.length == 1){return res[0]}\n return _b_.tuple.$factory(res)\n }\n mo.groups = function(_default){\n if(_default === undefined){_default = _b_.None}\n var res = []\n for(var i = 1, _len_i = jsmatch.length; i < _len_i; i++){\n if(jsmatch[i] === undefined){res.push(_default)}\n else{res.push(jsmatch[i])}\n }\n return _b_.tuple.$factory(res)\n }\n mo.start = function(){return mo._match.index}\n mo.end = function(){return mo._match.length - mo._match.index}\n mo.string = string\n _list.push(mo)\n }\n return _list\n }\n obj.search = function(pattern, string){\n var $ns = $B.args('re.search', 2,\n {pattern:null, string:null},['pattern', 'string'],\n arguments, {}, 'args', 'kw')\n var args = $ns['args']\n if(args.length>0){var flags = args[0]}\n else{var flags = $B.$getattr($ns['kw'], 'get')('flags', '')}\n flags = normflags(flags)\n var jsp = new RegExp(pattern, flags)\n var jsmatch = string.match(jsp)\n if(jsmatch === null){return _b_.None}\n return MatchObject.$factory(jsmatch, string, pattern)\n }\n obj.sub = function(pattern, repl, string){\n var $ns=$B.args('re.search', 3,\n {pattern: null, repl: null, string: null},\n ['pattern', 'repl', 'string'],\n arguments,{}, 'args', 'kw')\n for($var in $ns){eval(\"var \" + $var + \"=$ns[$var]\")}\n var args = $ns['args']\n var count = _b_.dict.get($ns['kw'], 'count', 0)\n var flags = _b_.dict.get($ns['kw'], 'flags', '')\n if(args.length > 0){var count = args[0]}\n if(args.length > 1){var flags = args[1]}\n flags = normflags(flags)\n if(typeof repl == \"string\"){\n // backreferences are \\1, \\2... in Python but $1,$2... in Javascript\n repl = repl.replace(/\\\\(\\d+)/g, '$$$1')\n }else if(typeof repl == \"function\"){\n // the argument passed to the Python function is the match object\n // the arguments passed to the Javascript function are :\n // - the matched substring\n // - the matched groups\n // - the offset of the matched substring inside the string\n // - the string being examined\n var $repl1 = function(){\n var mo = Object()\n mo.string = arguments[arguments.length - 1]\n var matched = arguments[0];\n var start = arguments[arguments.length - 2]\n var end = start + matched.length\n mo.start = function(){return start}\n mo.end = function(){return end}\n groups = []\n for(var i = 1, _len_i = arguments.length-2; i < _len_i; i++){\n groups.push(arguments[i])\n }\n mo.groups = function(_default){\n if(_default === undefined){_default = _b_.None}\n var res = []\n for(var i = 0, _len_i = groups.length; i < _len_i; i++){\n if(groups[i] === undefined){res.push(_default)}\n else{res.push(groups[i])}\n }\n return res\n }\n mo.group = function(i){\n if(i==0){return matched}\n return groups[i-1]\n }\n return repl(mo)\n }\n }\n if(count == 0){flags += 'g'}\n var jsp = new RegExp(pattern, flags)\n if(typeof repl == 'function'){return string.replace(jsp, $repl1)}\n else{return string.replace(jsp, repl)}\n }\n obj.match = (function(search_func){\n return function(){\n // match is like search but pattern must start with ^\n var pattern = arguments[0]\n if(pattern.charAt(0) != '^'){pattern = '^'+pattern}\n var args = [pattern]\n for(var i = 1, _len_i = arguments.length; i < _len_i; i++){\n args.push(arguments[i])\n }\n return search_func.apply(null, args)\n }\n })(obj.search)\n\n return obj\n}\n)(__BRYTHON__)\n"], "_locale": [".js", "var am = {\n \"C\": \"AM\",\n \"aa\": \"saaku\",\n \"ab\": \"AM\",\n \"ae\": \"AM\",\n \"af\": \"vm.\",\n \"ak\": \"AN\",\n \"am\": \"\\u1325\\u12cb\\u1275\",\n \"an\": \"AM\",\n \"ar\": \"\\u0635\",\n \"as\": \"\\u09f0\\u09be\\u09a4\\u09bf\\u09aa\\u09c1\",\n \"av\": \"AM\",\n \"ay\": \"AM\",\n \"az\": \"AM\",\n \"ba\": \"\",\n \"be\": \"\",\n \"bg\": \"\",\n \"bh\": \"AM\",\n \"bi\": \"AM\",\n \"bm\": \"AM\",\n \"bn\": \"AM\",\n \"bo\": \"\\u0f66\\u0f94\\u0f0b\\u0f51\\u0fb2\\u0f7c\",\n \"br\": \"A.M.\",\n \"bs\": \"prijepodne\",\n \"ca\": \"a. m.\",\n \"ce\": \"AM\",\n \"ch\": \"AM\",\n \"co\": \"\",\n \"cr\": \"AM\",\n \"cs\": \"dop.\",\n \"cu\": \"\\u0414\\u041f\",\n \"cv\": \"AM\",\n \"cy\": \"yb\",\n \"da\": \"\",\n \"de\": \"\",\n \"dv\": \"\\u0789\\u0786\",\n \"dz\": \"\\u0f66\\u0f94\\u0f0b\\u0f46\\u0f0b\",\n \"ee\": \"\\u014bdi\",\n \"el\": \"\\u03c0\\u03bc\",\n \"en\": \"AM\",\n \"eo\": \"atm\",\n \"es\": \"\",\n \"et\": \"AM\",\n \"eu\": \"AM\",\n \"fa\": \"\\u0642.\\u0638\",\n \"ff\": \"\",\n \"fi\": \"ap.\",\n \"fj\": \"AM\",\n \"fo\": \"um fyr.\",\n \"fr\": \"\",\n \"fy\": \"AM\",\n \"ga\": \"r.n.\",\n \"gd\": \"m\",\n \"gl\": \"a.m.\",\n \"gn\": \"a.m.\",\n \"gu\": \"\\u0aaa\\u0ac2\\u0ab0\\u0acd\\u0ab5\\u00a0\\u0aae\\u0aa7\\u0acd\\u0aaf\\u0abe\\u0ab9\\u0acd\\u0aa8\",\n \"gv\": \"a.m.\",\n \"ha\": \"AM\",\n \"he\": \"AM\",\n \"hi\": \"\\u092a\\u0942\\u0930\\u094d\\u0935\\u093e\\u0939\\u094d\\u0928\",\n \"ho\": \"AM\",\n \"hr\": \"\",\n \"ht\": \"AM\",\n \"hu\": \"de.\",\n \"hy\": \"\",\n \"hz\": \"AM\",\n \"ia\": \"a.m.\",\n \"id\": \"AM\",\n \"ie\": \"AM\",\n \"ig\": \"A.M.\",\n \"ii\": \"\\ua0b5\\ua1aa\\ua20c\\ua210\",\n \"ik\": \"AM\",\n \"io\": \"AM\",\n \"is\": \"f.h.\",\n \"it\": \"\",\n \"iu\": \"AM\",\n \"ja\": \"\\u5348\\u524d\",\n \"jv\": \"\",\n \"ka\": \"AM\",\n \"kg\": \"AM\",\n \"ki\": \"Kiroko\",\n \"kj\": \"AM\",\n \"kk\": \"AM\",\n \"kl\": \"\",\n \"km\": \"\\u1796\\u17d2\\u179a\\u17b9\\u1780\",\n \"kn\": \"\\u0caa\\u0cc2\\u0cb0\\u0ccd\\u0cb5\\u0cbe\\u0cb9\\u0ccd\\u0ca8\",\n \"ko\": \"\\uc624\\uc804\",\n \"kr\": \"AM\",\n \"ks\": \"AM\",\n \"ku\": \"\\u067e.\\u0646\",\n \"kv\": \"AM\",\n \"kw\": \"a.m.\",\n \"ky\": \"\",\n \"la\": \"\",\n \"lb\": \"\",\n \"lg\": \"AM\",\n \"li\": \"AM\",\n \"ln\": \"nt\\u0254\\u0301ng\\u0254\\u0301\",\n \"lo\": \"\\u0e81\\u0ec8\\u0ead\\u0e99\\u0e97\\u0ec8\\u0ebd\\u0e87\",\n \"lt\": \"prie\\u0161piet\",\n \"lu\": \"Dinda\",\n \"lv\": \"priek\\u0161p.\",\n \"mg\": \"AM\",\n \"mh\": \"AM\",\n \"mi\": \"a.m.\",\n \"mk\": \"\\u043f\\u0440\\u0435\\u0442\\u043f\\u043b.\",\n \"ml\": \"AM\",\n \"mn\": \"??\",\n \"mo\": \"AM\",\n \"mr\": \"\\u092e.\\u092a\\u0942.\",\n \"ms\": \"PG\",\n \"mt\": \"AM\",\n \"my\": \"\\u1014\\u1036\\u1014\\u1000\\u103a\",\n \"na\": \"AM\",\n \"nb\": \"a.m.\",\n \"nd\": \"AM\",\n \"ne\": \"\\u092a\\u0942\\u0930\\u094d\\u0935\\u093e\\u0939\\u094d\\u0928\",\n \"ng\": \"AM\",\n \"nl\": \"\",\n \"nn\": \"f.m.\",\n \"no\": \"a.m.\",\n \"nr\": \"AM\",\n \"nv\": \"AM\",\n \"ny\": \"AM\",\n \"oc\": \"AM\",\n \"oj\": \"AM\",\n \"om\": \"WD\",\n \"or\": \"AM\",\n \"os\": \"AM\",\n \"pa\": \"\\u0a38\\u0a35\\u0a47\\u0a30\",\n \"pi\": \"AM\",\n \"pl\": \"AM\",\n \"ps\": \"\\u063a.\\u0645.\",\n \"pt\": \"\",\n \"qu\": \"a.m.\",\n \"rc\": \"AM\",\n \"rm\": \"AM\",\n \"rn\": \"Z.MU.\",\n \"ro\": \"a.m.\",\n \"ru\": \"\",\n \"rw\": \"AM\",\n \"sa\": \"\\u092e\\u0927\\u094d\\u092f\\u093e\\u0928\\u092a\\u0942\\u0930\\u094d\\u0935\",\n \"sc\": \"AM\",\n \"sd\": \"AM\",\n \"se\": \"i.b.\",\n \"sg\": \"ND\",\n \"sh\": \"AM\",\n \"si\": \"\\u0db4\\u0dd9.\\u0dc0.\",\n \"sk\": \"AM\",\n \"sl\": \"dop.\",\n \"sm\": \"AM\",\n \"sn\": \"AM\",\n \"so\": \"sn.\",\n \"sq\": \"e paradites\",\n \"sr\": \"pre podne\",\n \"ss\": \"AM\",\n \"st\": \"AM\",\n \"su\": \"AM\",\n \"sv\": \"\",\n \"sw\": \"AM\",\n \"ta\": \"\\u0b95\\u0bbe\\u0bb2\\u0bc8\",\n \"te\": \"\\u0c2a\\u0c42\\u0c30\\u0c4d\\u0c35\\u0c3e\\u0c39\\u0c4d\\u0c28\",\n \"tg\": \"\",\n \"th\": \"AM\",\n \"ti\": \"\\u1295\\u1309\\u1206 \\u1230\\u12d3\\u1270\",\n \"tk\": \"\",\n \"tl\": \"AM\",\n \"tn\": \"AM\",\n \"to\": \"AM\",\n \"tr\": \"\\u00d6\\u00d6\",\n \"ts\": \"AM\",\n \"tt\": \"\",\n \"tw\": \"AM\",\n \"ty\": \"AM\",\n \"ug\": \"\\u0686?\\u0634\\u062a\\u0649\\u0646 \\u0628?\\u0631?\\u0646\",\n \"uk\": \"AM\",\n \"ur\": \"AM\",\n \"uz\": \"TO\",\n \"ve\": \"AM\",\n \"vi\": \"SA\",\n \"vo\": \"AM\",\n \"wa\": \"AM\",\n \"wo\": \"\",\n \"xh\": \"AM\",\n \"yi\": \"\\ua0b5\\ua1aa\\ua20c\\ua210\",\n \"yo\": \"\\u00c0\\u00e1r?`\",\n \"za\": \"AM\",\n \"zh\": \"\\u4e0a\\u5348\",\n \"zu\": \"AM\"\n}\nvar pm = {\n \"C\": \"PM\",\n \"aa\": \"carra\",\n \"ab\": \"PM\",\n \"ae\": \"PM\",\n \"af\": \"nm.\",\n \"ak\": \"EW\",\n \"am\": \"\\u12a8\\u1230\\u12d3\\u1275\",\n \"an\": \"PM\",\n \"ar\": \"\\u0645\",\n \"as\": \"\\u0986\\u09ac\\u09c7\\u09b2\\u09bf\",\n \"av\": \"PM\",\n \"ay\": \"PM\",\n \"az\": \"PM\",\n \"ba\": \"\",\n \"be\": \"\",\n \"bg\": \"\",\n \"bh\": \"PM\",\n \"bi\": \"PM\",\n \"bm\": \"PM\",\n \"bn\": \"PM\",\n \"bo\": \"\\u0f55\\u0fb1\\u0f72\\u0f0b\\u0f51\\u0fb2\\u0f7c\",\n \"br\": \"G.M.\",\n \"bs\": \"popodne\",\n \"ca\": \"p. m.\",\n \"ce\": \"PM\",\n \"ch\": \"PM\",\n \"co\": \"\",\n \"cr\": \"PM\",\n \"cs\": \"odp.\",\n \"cu\": \"\\u041f\\u041f\",\n \"cv\": \"PM\",\n \"cy\": \"yh\",\n \"da\": \"\",\n \"de\": \"\",\n \"dv\": \"\\u0789\\u078a\",\n \"dz\": \"\\u0f55\\u0fb1\\u0f72\\u0f0b\\u0f46\\u0f0b\",\n \"ee\": \"\\u0263etr\\u0254\",\n \"el\": \"\\u03bc\\u03bc\",\n \"en\": \"PM\",\n \"eo\": \"ptm\",\n \"es\": \"\",\n \"et\": \"PM\",\n \"eu\": \"PM\",\n \"fa\": \"\\u0628.\\u0638\",\n \"ff\": \"\",\n \"fi\": \"ip.\",\n \"fj\": \"PM\",\n \"fo\": \"um sein.\",\n \"fr\": \"\",\n \"fy\": \"PM\",\n \"ga\": \"i.n.\",\n \"gd\": \"f\",\n \"gl\": \"p.m.\",\n \"gn\": \"p.m.\",\n \"gu\": \"\\u0a89\\u0aa4\\u0acd\\u0aa4\\u0ab0\\u00a0\\u0aae\\u0aa7\\u0acd\\u0aaf\\u0abe\\u0ab9\\u0acd\\u0aa8\",\n \"gv\": \"p.m.\",\n \"ha\": \"PM\",\n \"he\": \"PM\",\n \"hi\": \"\\u0905\\u092a\\u0930\\u093e\\u0939\\u094d\\u0928\",\n \"ho\": \"PM\",\n \"hr\": \"\",\n \"ht\": \"PM\",\n \"hu\": \"du.\",\n \"hy\": \"\",\n \"hz\": \"PM\",\n \"ia\": \"p.m.\",\n \"id\": \"PM\",\n \"ie\": \"PM\",\n \"ig\": \"P.M.\",\n \"ii\": \"\\ua0b5\\ua1aa\\ua20c\\ua248\",\n \"ik\": \"PM\",\n \"io\": \"PM\",\n \"is\": \"e.h.\",\n \"it\": \"\",\n \"iu\": \"PM\",\n \"ja\": \"\\u5348\\u5f8c\",\n \"jv\": \"\",\n \"ka\": \"PM\",\n \"kg\": \"PM\",\n \"ki\": \"Hwa\\u0129-in\\u0129\",\n \"kj\": \"PM\",\n \"kk\": \"PM\",\n \"kl\": \"\",\n \"km\": \"\\u179b\\u17d2\\u1784\\u17b6\\u1785\",\n \"kn\": \"\\u0c85\\u0caa\\u0cb0\\u0cbe\\u0cb9\\u0ccd\\u0ca8\",\n \"ko\": \"\\uc624\\ud6c4\",\n \"kr\": \"PM\",\n \"ks\": \"PM\",\n \"ku\": \"\\u062f.\\u0646\",\n \"kv\": \"PM\",\n \"kw\": \"p.m.\",\n \"ky\": \"\",\n \"la\": \"\",\n \"lb\": \"\",\n \"lg\": \"PM\",\n \"li\": \"PM\",\n \"ln\": \"mp\\u00f3kwa\",\n \"lo\": \"\\u0eab\\u0ebc\\u0eb1\\u0e87\\u0e97\\u0ec8\\u0ebd\\u0e87\",\n \"lt\": \"popiet\",\n \"lu\": \"Dilolo\",\n \"lv\": \"p\\u0113cp.\",\n \"mg\": \"PM\",\n \"mh\": \"PM\",\n \"mi\": \"p.m.\",\n \"mk\": \"\\u043f\\u043e\\u043f\\u043b.\",\n \"ml\": \"PM\",\n \"mn\": \"?\\u0425\",\n \"mo\": \"PM\",\n \"mr\": \"\\u092e.\\u0928\\u0902.\",\n \"ms\": \"PTG\",\n \"mt\": \"PM\",\n \"my\": \"\\u100a\\u1014\\u1031\",\n \"na\": \"PM\",\n \"nb\": \"p.m.\",\n \"nd\": \"PM\",\n \"ne\": \"\\u0905\\u092a\\u0930\\u093e\\u0939\\u094d\\u0928\",\n \"ng\": \"PM\",\n \"nl\": \"\",\n \"nn\": \"e.m.\",\n \"no\": \"p.m.\",\n \"nr\": \"PM\",\n \"nv\": \"PM\",\n \"ny\": \"PM\",\n \"oc\": \"PM\",\n \"oj\": \"PM\",\n \"om\": \"WB\",\n \"or\": \"PM\",\n \"os\": \"PM\",\n \"pa\": \"\\u0a36\\u0a3e\\u0a2e\",\n \"pi\": \"PM\",\n \"pl\": \"PM\",\n \"ps\": \"\\u063a.\\u0648.\",\n \"pt\": \"\",\n \"qu\": \"p.m.\",\n \"rc\": \"PM\",\n \"rm\": \"PM\",\n \"rn\": \"Z.MW.\",\n \"ro\": \"p.m.\",\n \"ru\": \"\",\n \"rw\": \"PM\",\n \"sa\": \"\\u092e\\u0927\\u094d\\u092f\\u093e\\u0928\\u092a\\u091a\\u094d\\u092f\\u093e\\u0924\",\n \"sc\": \"PM\",\n \"sd\": \"PM\",\n \"se\": \"e.b.\",\n \"sg\": \"LK\",\n \"sh\": \"PM\",\n \"si\": \"\\u0db4.\\u0dc0.\",\n \"sk\": \"PM\",\n \"sl\": \"pop.\",\n \"sm\": \"PM\",\n \"sn\": \"PM\",\n \"so\": \"gn.\",\n \"sq\": \"e pasdites\",\n \"sr\": \"po podne\",\n \"ss\": \"PM\",\n \"st\": \"PM\",\n \"su\": \"PM\",\n \"sv\": \"\",\n \"sw\": \"PM\",\n \"ta\": \"\\u0bae\\u0bbe\\u0bb2\\u0bc8\",\n \"te\": \"\\u0c05\\u0c2a\\u0c30\\u0c3e\\u0c39\\u0c4d\\u0c28\",\n \"tg\": \"\",\n \"th\": \"PM\",\n \"ti\": \"\\u12f5\\u1215\\u122d \\u1230\\u12d3\\u1275\",\n \"tk\": \"\",\n \"tl\": \"PM\",\n \"tn\": \"PM\",\n \"to\": \"PM\",\n \"tr\": \"\\u00d6S\",\n \"ts\": \"PM\",\n \"tt\": \"\",\n \"tw\": \"PM\",\n \"ty\": \"PM\",\n \"ug\": \"\\u0686?\\u0634\\u062a\\u0649\\u0646 \\u0643?\\u064a\\u0649\\u0646\",\n \"uk\": \"PM\",\n \"ur\": \"PM\",\n \"uz\": \"TK\",\n \"ve\": \"PM\",\n \"vi\": \"CH\",\n \"vo\": \"PM\",\n \"wa\": \"PM\",\n \"wo\": \"\",\n \"xh\": \"PM\",\n \"yi\": \"\\ua0b5\\ua1aa\\ua20c\\ua248\",\n \"yo\": \"?`s\\u00e1n\",\n \"za\": \"PM\",\n \"zh\": \"\\u4e0b\\u5348\",\n \"zu\": \"PM\"\n}\n\nvar X_format = {\n \"%H:%M:%S\": [\n \"C\",\n \"ab\",\n \"ae\",\n \"af\",\n \"an\",\n \"av\",\n \"ay\",\n \"az\",\n \"ba\",\n \"be\",\n \"bg\",\n \"bh\",\n \"bi\",\n \"bm\",\n \"bo\",\n \"br\",\n \"bs\",\n \"ca\",\n \"ce\",\n \"ch\",\n \"co\",\n \"cr\",\n \"cs\",\n \"cu\",\n \"cv\",\n \"cy\",\n \"da\",\n \"de\",\n \"dv\",\n \"eo\",\n \"es\",\n \"et\",\n \"eu\",\n \"ff\",\n \"fj\",\n \"fo\",\n \"fr\",\n \"fy\",\n \"ga\",\n \"gd\",\n \"gl\",\n \"gn\",\n \"gu\",\n \"gv\",\n \"ha\",\n \"he\",\n \"hi\",\n \"ho\",\n \"hr\",\n \"ht\",\n \"hu\",\n \"hy\",\n \"hz\",\n \"ia\",\n \"ie\",\n \"ig\",\n \"ik\",\n \"io\",\n \"is\",\n \"it\",\n \"ja\",\n \"ka\",\n \"kg\",\n \"ki\",\n \"kj\",\n \"kk\",\n \"kl\",\n \"km\",\n \"kn\",\n \"kv\",\n \"kw\",\n \"ky\",\n \"la\",\n \"lb\",\n \"lg\",\n \"li\",\n \"ln\",\n \"lo\",\n \"lt\",\n \"lu\",\n \"lv\",\n \"mg\",\n \"mh\",\n \"mk\",\n \"mn\",\n \"mo\",\n \"mr\",\n \"mt\",\n \"my\",\n \"na\",\n \"nb\",\n \"nd\",\n \"ng\",\n \"nl\",\n \"nn\",\n \"no\",\n \"nr\",\n \"nv\",\n \"ny\",\n \"oj\",\n \"or\",\n \"os\",\n \"pi\",\n \"pl\",\n \"ps\",\n \"pt\",\n \"rc\",\n \"rm\",\n \"rn\",\n \"ro\",\n \"ru\",\n \"rw\",\n \"sa\",\n \"sc\",\n \"se\",\n \"sg\",\n \"sh\",\n \"sk\",\n \"sl\",\n \"sm\",\n \"sn\",\n \"sr\",\n \"ss\",\n \"st\",\n \"su\",\n \"sv\",\n \"sw\",\n \"ta\",\n \"te\",\n \"tg\",\n \"th\",\n \"tk\",\n \"tl\",\n \"tn\",\n \"tr\",\n \"ts\",\n \"tt\",\n \"tw\",\n \"ty\",\n \"ug\",\n \"uk\",\n \"uz\",\n \"ve\",\n \"vo\",\n \"wa\",\n \"wo\",\n \"xh\",\n \"yo\",\n \"za\",\n \"zh\",\n \"zu\"\n ],\n \"%i:%M:%S %p\": [\n \"aa\",\n \"ak\",\n \"am\",\n \"bn\",\n \"el\",\n \"en\",\n \"iu\",\n \"kr\",\n \"ks\",\n \"mi\",\n \"ml\",\n \"ms\",\n \"ne\",\n \"om\",\n \"sd\",\n \"so\",\n \"sq\",\n \"ti\",\n \"to\",\n \"ur\",\n \"vi\"\n ],\n \"%I:%M:%S %p\": [\n \"ar\",\n \"fa\",\n \"ku\",\n \"qu\"\n ],\n \"%p %i:%M:%S\": [\n \"as\",\n \"ii\",\n \"ko\",\n \"yi\"\n ],\n \"\\u0f46\\u0f74\\u0f0b\\u0f5a\\u0f7c\\u0f51\\u0f0b%i:%M:%S %p\": [\n \"dz\"\n ],\n \"%p ga %i:%M:%S\": [\n \"ee\"\n ],\n \"%H.%M.%S\": [\n \"fi\",\n \"id\",\n \"jv\",\n \"oc\",\n \"si\"\n ],\n \"%p %I:%M:%S\": [\n \"pa\"\n ]\n}\nvar x_format = {\n \"%m/%d/%y\": [\n \"C\"\n ],\n \"%d/%m/%Y\": [\n \"aa\",\n \"am\",\n \"bm\",\n \"bn\",\n \"ca\",\n \"co\",\n \"cy\",\n \"el\",\n \"es\",\n \"ff\",\n \"fr\",\n \"ga\",\n \"gd\",\n \"gl\",\n \"gn\",\n \"gv\",\n \"ha\",\n \"he\",\n \"id\",\n \"ig\",\n \"it\",\n \"iu\",\n \"jv\",\n \"ki\",\n \"kr\",\n \"kw\",\n \"la\",\n \"lg\",\n \"ln\",\n \"lo\",\n \"lu\",\n \"mi\",\n \"ml\",\n \"ms\",\n \"mt\",\n \"nd\",\n \"oc\",\n \"om\",\n \"pt\",\n \"qu\",\n \"rn\",\n \"sd\",\n \"sg\",\n \"so\",\n \"sw\",\n \"ti\",\n \"to\",\n \"uk\",\n \"ur\",\n \"uz\",\n \"vi\",\n \"wo\",\n \"yo\"\n ],\n \"%m/%d/%Y\": [\n \"ab\",\n \"ae\",\n \"an\",\n \"av\",\n \"ay\",\n \"bh\",\n \"bi\",\n \"ch\",\n \"cr\",\n \"cv\",\n \"ee\",\n \"en\",\n \"fj\",\n \"ho\",\n \"ht\",\n \"hz\",\n \"ie\",\n \"ik\",\n \"io\",\n \"kg\",\n \"kj\",\n \"ks\",\n \"kv\",\n \"li\",\n \"mh\",\n \"mo\",\n \"na\",\n \"ne\",\n \"ng\",\n \"nv\",\n \"ny\",\n \"oj\",\n \"pi\",\n \"rc\",\n \"sc\",\n \"sh\",\n \"sm\",\n \"su\",\n \"tl\",\n \"tw\",\n \"ty\",\n \"wa\",\n \"za\",\n \"zu\"\n ],\n \"%Y-%m-%d\": [\n \"af\",\n \"br\",\n \"ce\",\n \"dz\",\n \"eo\",\n \"ko\",\n \"lt\",\n \"mg\",\n \"nr\",\n \"rw\",\n \"se\",\n \"si\",\n \"sn\",\n \"ss\",\n \"st\",\n \"sv\",\n \"tn\",\n \"ts\",\n \"ug\",\n \"ve\",\n \"vo\",\n \"xh\"\n ],\n \"%Y/%m/%d\": [\n \"ak\",\n \"bo\",\n \"eu\",\n \"ia\",\n \"ii\",\n \"ja\",\n \"ku\",\n \"yi\",\n \"zh\"\n ],\n \"null\": [\n \"ar\",\n \"fa\",\n \"ps\",\n \"th\"\n ],\n \"%d-%m-%Y\": [\n \"as\",\n \"da\",\n \"fy\",\n \"hi\",\n \"kl\",\n \"mr\",\n \"my\",\n \"nl\",\n \"rm\",\n \"sa\",\n \"ta\"\n ],\n \"%d.%m.%Y\": [\n \"az\",\n \"cs\",\n \"de\",\n \"et\",\n \"fi\",\n \"fo\",\n \"hy\",\n \"is\",\n \"ka\",\n \"kk\",\n \"lv\",\n \"mk\",\n \"nb\",\n \"nn\",\n \"no\",\n \"os\",\n \"pl\",\n \"ro\",\n \"ru\",\n \"sq\",\n \"tg\",\n \"tr\",\n \"tt\"\n ],\n \"%d.%m.%y\": [\n \"ba\",\n \"be\",\n \"lb\"\n ],\n \"%d.%m.%Y \\u0433.\": [\n \"bg\"\n ],\n \"%d.%m.%Y.\": [\n \"bs\",\n \"hr\",\n \"sr\"\n ],\n \"%Y.%m.%d\": [\n \"cu\",\n \"mn\"\n ],\n \"%d/%m/%y\": [\n \"dv\",\n \"km\"\n ],\n \"%d-%m-%y\": [\n \"gu\",\n \"kn\",\n \"or\",\n \"pa\",\n \"te\"\n ],\n \"%Y. %m. %d.\": [\n \"hu\"\n ],\n \"%d-%b %y\": [\n \"ky\"\n ],\n \"%d. %m. %Y\": [\n \"sk\",\n \"sl\"\n ],\n \"%d.%m.%y \\u00fd.\": [\n \"tk\"\n ]\n}\n\n\nvar $module=(function($B){\n var _b_ = $B.builtins\n return {\n CHAR_MAX: 127,\n LC_ALL: 6,\n LC_COLLATE: 3,\n LC_CTYPE: 0,\n LC_MESSAGES: 5,\n LC_MONETARY: 4,\n LC_NUMERIC: 1,\n LC_TIME: 2,\n Error: _b_.ValueError,\n\n _date_format: function(spec, hour){\n var t,\n locale = __BRYTHON__.locale.substr(0, 2)\n\n if(spec == \"p\"){\n var res = hours < 12 ? am[locale] : pm[locale]\n if(res === undefined){\n throw _b_.ValueError.$factory(\"no format \" + spec + \" for locale \" +\n locale)\n }\n return res\n }\n else if(spec == \"x\"){\n t = x_format\n }else if(spec == \"X\"){\n t = X_format\n }else{\n throw _b_.ValueError.$factory(\"invalid format\", spec)\n }\n for(var key in t){\n if(t[key].indexOf(locale) > -1){\n return key\n }\n }\n throw _b_.ValueError.$factory(\"no format \" + spec + \" for locale \" +\n locale)\n },\n\n localeconv: function(){\n var conv = {'grouping': [127],\n 'currency_symbol': '',\n 'n_sign_posn': 127,\n 'p_cs_precedes': 127,\n 'n_cs_precedes': 127,\n 'mon_grouping': [],\n 'n_sep_by_space': 127,\n 'decimal_point': '.',\n 'negative_sign': '',\n 'positive_sign': '',\n 'p_sep_by_space': 127,\n 'int_curr_symbol': '',\n 'p_sign_posn': 127,\n 'thousands_sep': '',\n 'mon_thousands_sep': '',\n 'frac_digits': 127,\n 'mon_decimal_point': '',\n 'int_frac_digits': 127\n }\n var res = $B.empty_dict()\n for(var key in conv){\n _b_.dict.$setitem(res, key, conv[key])\n }\n \n return res\n },\n\n setlocale : function(){\n var $ = $B.args(\"setlocale\", 2, {category: null, locale: null},\n [\"category\", \"locale\"], arguments, {locale: _b_.None},\n null, null)\n /// XXX category is currently ignored\n if($.locale == \"\"){\n // use browser language setting, if it is set\n var LANG = ($B.language || \"\").substr(0, 2)\n if(am.hasOwnProperty(LANG)){\n $B.locale = LANG\n return LANG\n }else{\n console.log(\"Unknown locale: \" + LANG)\n }\n }else if($.locale === _b_.None){\n // return current locale\n return $B.locale\n }else{\n // Only use 2 first characters\n try{$.locale.substr(0, 2)}\n catch(err){\n throw $module.Error.$factory(\"Invalid locale: \" + $.locale)\n }\n if(am.hasOwnProperty($.locale.substr(0, 2))){\n $B.locale = $.locale\n return $.locale\n }else{\n throw $module.Error.$factory(\"Unknown locale: \" + $.locale)\n }\n }\n }\n }\n})(__BRYTHON__)\n"], "_multiprocessing": [".js", "// multiprocessing\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\n\nvar Process = $B.make_class('Process')\n\nvar $convert_args=function(args) {\n var _list=[]\n for(var i=0, _len_i = args.length; i < _len_i; i++) {\n var _a=args[i]\n if($B.$isinstance(_a, _b_.str)){_list.push(\"'\"+_a+\"'\")} else {_list.push(_a)}\n }\n\n return _list.join(',')\n}\n\nProcess.is_alive = function(self){return self.$alive}\n\nProcess.join = function(self, timeout){\n // need to block until process is complete\n // could probably use a addEventListener to execute all existing code\n // after this join statement\n\n self.$worker.addEventListener('message', function (e) {\n var data=e.data\n if (data.stdout != '') { // output stdout from process\n $B.stdout.write(data.stdout)\n }\n }, false);\n}\n\nProcess.run = function(self){\n //fix me\n}\n\nProcess.start = function(self){\n self.$worker.postMessage({target: self.$target,\n args: $convert_args(self.$args),\n // kwargs: self.$kwargs\n })\n self.$worker.addEventListener('error', function(e) { throw e})\n self.$alive=true\n}\n\nProcess.terminate = function(self){\n self.$worker.terminate()\n self.$alive=false\n}\n\n// variables\n//name\n//daemon\n//pid\n//exitcode\n\nProcess. $factory = function(){\n //arguments group=None, target=None, name=None, args=(), kwargs=()\n\n var $ns=$B.args('Process',0,{},[],arguments,{},null,'kw')\n var kw=$ns['kw']\n\n var target=_b_.dict.get($ns['kw'],'target', _b_.None)\n var args=_b_.dict.get($ns['kw'],'args', _b_.tuple.$factory())\n\n var worker = new Worker('/src/web_workers/multiprocessing.js')\n\n var res = {\n __class__:Process,\n $worker: worker,\n name: $ns['name'] || _b_.None,\n $target: target+'',\n $args: args,\n //$kwargs: $ns['kw'],\n $alive: false\n }\n return res\n}\n\n$B.set_func_names(Process, \"multiprocessing\")\n\nvar Pool = $B.make_class(\"Pool\")\n\nPool.__enter__ = function(self){}\nPool.__exit__ = function(self){}\n\nPool.__str__ = Pool.toString = Pool.__repr__=function(self){\n return ''\n}\n\nPool.map = function(){\n\n var $ns=$B.args('Pool.map', 3,\n {self:null, func:null, fargs:null}, ['self', 'func', 'fargs'],\n arguments,{},'args','kw')\n var func = $ns['func']\n var fargs = $ns['fargs']\n\n var _results = []\n\n fargs = _b_.iter(fargs)\n\n var _pos = 0\n console.log(self.$processes)\n _workers =[]\n for(var i=0; i < self.$processes; i++) {\n _workers[i] = new Worker('/src/web_workers/multiprocessing.js')\n var arg\n\n try{arg = $B.$getattr(fargs, '__next__')()}\n catch(err) {\n if (err.__class__ !== _b_.StopIteration) throw err\n }\n console.log(arg)\n _workers[i].finished=false\n _workers[i].postMessage({target: func+'', pos: _pos,\n args: $convert_args([arg])})\n _pos++\n\n _workers[i].addEventListener('message', function(e) {\n _results[e.data.pos]=e.data.result\n if (_results.length == args.length) return _results\n\n try {\n arg = $B.$getattr(fargs, '__next__')()\n e.currentTarget.postMessage({target: func+'', pos: _pos,\n args: $convert_args([arg])})\n _pos++\n } catch(err) {\n if (err.__class__ !== _b_.StopIteration) throw err\n this.finished=true\n }\n }, false);\n }\n}\n\nPool.apply_async = function(){\n\n var $ns=$B.$MakeArgs('apply_async', 3,\n {self:null, func:null, fargs:null}, ['self', 'func', 'fargs'],\n arguments,{},'args','kw')\n var func = $ns['func']\n var fargs = $ns['fargs']\n\n fargs = _b_.iter(fargs)\n\n async_result = {}\n async_result.get = function(timeout){\n console.log(results)\n console.log(fargs)\n return this.results}\n async_result.results=[]\n\n var _pos=0\n\n _workers=[]\n for(var i=0; i < self.$processes; i++) {\n _workers[i] = new Worker('/src/web_workers/multiprocessing.js')\n var arg\n\n try{arg = $B.$getattr(fargs, '__next__')()}\n catch(err) {\n if (err.__class__ !== _b_.StopIteration) throw err\n }\n //console.log(arg)\n //_workers[i].finished=false\n _workers[i].postMessage({target: func+'', pos: _pos,\n args: $convert_args([arg])})\n _pos++\n\n _workers[i].addEventListener('message', function(e) {\n async_result.results[e.data.pos]=e.data.result\n //if (_results.length == args.length) return _results\n\n try {\n arg = $B.$getattr(fargs, '__next__')()\n e.currentTarget.postMessage({target: func+'', pos: _pos,\n args: $convert_args([arg])})\n _pos++\n } catch(err) {\n if (err.__class__ !== _b_.StopIteration) throw err\n this.finished=true\n }\n }, false);\n }\n\n console.log(\"return\", async_result)\n return async_result\n}\n\nPool.$factory = function(){\n console.log(\"pool\")\n console.log(arguments)\n var $ns=$B.args('Pool',1,\n {processes:null},['processes'],arguments,{},'args','kw')\n\n var processes = $ns['processes']\n\n if (processes === _b_.None) {\n // look to see if we have stored cpu_count in local storage\n // maybe we should create a brython config file with settings,etc..??\n\n // if not there use a tool such as Core Estimator to calculate number of cpu's\n // http://eligrey.com/blog/post/cpu-core-estimation-with-javascript\n }\n\n console.log(processes)\n var res = {\n __class__:Pool,\n $processes:processes\n }\n return res\n}\n\n$B.set_func_names(Pool, \"multiprocessing\")\n\nreturn {Process:Process, Pool:Pool}\n\n})(__BRYTHON__)\n"], "_posixsubprocess": [".js", "var $module=(function($B){\n\n return {\n cloexec_pipe: function() {}, // fixme\n fork_exec: function(){}\n }\n})(__BRYTHON__)\n"], "_profile": [".js", "// Private interface to the profiling instrumentation implemented in py_utils.js.\n// Uses local a copy of the eval function from py_builtin_functions.js\n\nvar $module=(function($B) {\n eval($B.InjectBuiltins());\n return {\n brython:$B,\n data:$B.$profile_data,\n start:$B.$profile.start,\n stop:$B.$profile.stop,\n pause:$B.$profile.pause,\n status:$B.$profile.status,\n clear:$B.$profile.clear,\n elapsed:$B.$profile.elapsed,\n run:function(src,_globals,_locals,nruns) {\n var current_frame = $B.frames_stack[$B.frames_stack.length-1]\n if(current_frame!==undefined){\n var current_locals_id = current_frame[0].replace(/\\./,'_'),\n current_globals_id = current_frame[2].replace(/\\./,'_')\n }\n\n var is_exec = true,\n leave = false\n\n // code will be run in a specific block\n var globals_id = '$profile_'+$B.UUID(),\n locals_id\n\n if(_locals===_globals){\n locals_id = globals_id\n }else{\n locals_id = '$profile_'+$B.UUID()\n }\n // Initialise the object for block namespaces\n eval('var $locals_'+globals_id+' = {}\\nvar $locals_'+locals_id+' = {}')\n\n // Initialise block globals\n\n // A _globals dictionary is provided, set or reuse its attribute\n // globals_id\n _globals.globals_id = _globals.globals_id || globals_id\n globals_id = _globals.globals_id\n\n if(_locals === _globals || _locals === undefined){\n locals_id = globals_id\n parent_scope = $B.builtins_scope\n }else{\n // The parent block of locals must be set to globals\n parent_scope = {\n id: globals_id,\n parent_block: $B.builtins_scope,\n binding: {}\n }\n for(var attr of _b_.dict.$keys_string(_globals)){\n parent_scope.binding[attr] = true\n }\n }\n\n // Initialise block globals\n if(_globals.$jsobj){\n var items = _globals.$jsobj\n }else{\n var items = {}\n for(var key of _b_.dict.$keys_string(_globals)){\n items[key] = _b_.dict.$getitem_string(_globals, key)\n }\n }\n for(var item in items){\n item1 = to_alias(item)\n try{\n eval('$locals_' + globals_id + '[\"' + item1 +\n '\"] = items[item]')\n }catch(err){\n console.log(err)\n console.log('error setting', item)\n break\n }\n }\n\n // Initialise block locals\n var items = _b_.dict.items(_locals), item\n if(_locals.$jsobj){\n var items = _locals.$jsobj\n }else{\n var items = {}\n for(var key of _b_.dict.$keys_string(_locals)){\n items[key] = _b_.dict.$getitem_string(_locals, key)\n } }\n for(var item in items){\n item1 = to_alias(item)\n try{\n eval('$locals_' + locals_id + '[\"' + item[0] + '\"] = item[1]')\n }catch(err){\n console.log(err)\n console.log('error setting', item)\n break\n }\n }\n //var nb_modules = Object.keys(__BRYTHON__.modules).length\n //console.log('before exec', nb_modules)\n\n console.log(\"call py2js\", src, globals_id, locals_id, parent_scope)\n var root = $B.py2js(src, globals_id, locals_id, parent_scope),\n js, gns, lns\n\n try{\n\n var js = root.to_js()\n\n var i,res,gns;\n for(i=0;i>> i) & 0x1){\n sum = addition32(sum, unsigned32(n2 << i))\n }\n }\n return sum\n }\n\n /* initializes mt[N] with a seed */\n //c//void init_genrand(unsigned long s)\n function init_genrand(s) {\n //c//mt[0]= s & 0xffffffff;\n mt[0] = unsigned32(s & 0xffffffff)\n for(mti = 1; mti < N; mti++){\n mt[mti] =\n //c//(1812433253 * (mt[mti-1] ^ (mt[mti-1] >> 30)) + mti);\n addition32(multiplication32(1812433253,\n unsigned32(mt[mti - 1] ^ (mt[mti - 1] >>> 30))), mti)\n /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */\n /* In the previous versions, MSBs of the seed affect */\n /* only MSBs of the array mt[]. */\n /* 2002/01/09 modified by Makoto Matsumoto */\n //c//mt[mti] &= 0xffffffff;\n mt[mti] = unsigned32(mt[mti] & 0xffffffff);\n /* for >32 bit machines */\n }\n }\n\n /* initialize by an array with array-length */\n /* init_key is the array for initializing keys */\n /* key_length is its length */\n /* slight change for C++, 2004/2/26 */\n //c//void init_by_array(unsigned long init_key[], int key_length)\n function init_by_array(init_key, key_length) {\n //c//int i, j, k;\n var i, j, k\n init_genrand(19650218)\n i = 1\n j = 0\n k = (N > key_length ? N : key_length)\n for(; k; k--){\n //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525))\n //c// + init_key[j] + j; /* non linear */\n mt[i] = addition32(\n addition32(unsigned32(mt[i] ^\n multiplication32(unsigned32(mt[i - 1] ^ (mt[i - 1] >>> 30)),\n 1664525)),\n init_key[j]), j)\n mt[i] =\n //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */\n unsigned32(mt[i] & 0xffffffff)\n i++\n j++\n if(i >= N){mt[0] = mt[N - 1]; i = 1}\n if(j >= key_length){j = 0}\n }\n for(k = N - 1; k; k--){\n //c//mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941))\n //c//- i; /* non linear */\n mt[i] = subtraction32(\n unsigned32(\n (mt[i]) ^\n multiplication32(\n unsigned32(mt[i - 1] ^ (mt[i - 1] >>> 30)),\n 1566083941)),\n i\n )\n //c//mt[i] &= 0xffffffff; /* for WORDSIZE > 32 machines */\n mt[i] = unsigned32(mt[i] & 0xffffffff)\n i++\n if(i >= N){mt[0] = mt[N - 1]; i = 1}\n }\n mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */\n }\n\n /* generates a random number on [0,0xffffffff]-interval */\n //c//unsigned long genrand_int32(void)\n function genrand_int32() {\n //c//unsigned long y;\n //c//static unsigned long mag01[2]={0x0UL, MATRIX_A};\n var y;\n var mag01 = [0x0, MATRIX_A];\n /* mag01[x] = x * MATRIX_A for x=0,1 */\n\n if(mti >= N){ /* generate N words at one time */\n //c//int kk;\n var kk\n\n if(mti == N + 1){ /* if init_genrand() has not been called, */\n init_genrand(Date.now()) /* a default initial seed is used */\n }\n\n for(kk = 0; kk < N - M; kk++){\n //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);\n //c//mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32((mt[kk]&UPPER_MASK) | (mt[kk + 1]&LOWER_MASK))\n mt[kk] = unsigned32(mt[kk + M] ^ (y >>> 1) ^ mag01[y & 0x1])\n }\n for(;kk < N - 1; kk++){\n //c//y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);\n //c//mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32((mt[kk]&UPPER_MASK) | (mt[kk + 1]&LOWER_MASK))\n mt[kk] = unsigned32(mt[kk + (M - N)] ^ (y >>> 1) ^ mag01[y & 0x1])\n }\n //c//y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);\n //c//mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];\n y = unsigned32((mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK))\n mt[N - 1] = unsigned32(mt[M - 1] ^ (y >>> 1) ^ mag01[y & 0x1])\n mti = 0\n }\n\n y = mt[mti++]\n\n /* Tempering */\n //c//y ^= (y >> 11);\n //c//y ^= (y << 7) & 0x9d2c5680;\n //c//y ^= (y << 15) & 0xefc60000;\n //c//y ^= (y >> 18);\n y = unsigned32(y ^ (y >>> 11))\n y = unsigned32(y ^ ((y << 7) & 0x9d2c5680))\n y = unsigned32(y ^ ((y << 15) & 0xefc60000))\n y = unsigned32(y ^ (y >>> 18))\n\n return y\n }\n\n /* generates a random number on [0,0x7fffffff]-interval */\n //c//long genrand_int31(void)\n function genrand_int31(){\n //c//return (genrand_int32()>>1);\n return (genrand_int32()>>>1)\n }\n\n /* generates a random number on [0,1]-real-interval */\n //c//double genrand_real1(void)\n function genrand_real1(){\n return genrand_int32()*(1.0/4294967295.0)\n /* divided by 2^32-1 */\n }\n\n /* generates a random number on [0,1)-real-interval */\n //c//double genrand_real2(void)\n function genrand_real2(){\n return genrand_int32() * (1.0 / 4294967296.0)\n /* divided by 2^32 */\n }\n\n /* generates a random number on (0,1)-real-interval */\n //c//double genrand_real3(void)\n function genrand_real3() {\n return ((genrand_int32()) + 0.5) * (1.0 / 4294967296.0)\n /* divided by 2^32 */\n }\n\n /* generates a random number on [0,1) with 53-bit resolution*/\n //c//double genrand_res53(void)\n function genrand_res53() {\n //c//unsigned long a=genrand_int32()>>5, b=genrand_int32()>>6;\n var a = genrand_int32() >>> 5,\n b = genrand_int32() >>> 6\n return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0)\n }\n /* These real versions are due to Isaku Wada, 2002/01/09 added */\n\n var random = genrand_res53\n\n random.seed = function(seed){\n if(seed === undefined || $B.is_none(seed)){\n const entries = new Uint32Array(N)\n crypto.getRandomValues(entries)\n init_by_array(Array.from(entries), N)\n return\n }\n\n if(!$B.$isinstance(seed, _b_.int)){\n seed = _b_.hash(seed)\n }\n\n // Transform to long integer\n if(typeof seed == \"number\"){\n seed = BigInt(seed)\n }else if(seed.__class__ === $B.long_int){\n seed = seed.value\n }else{\n return random.seed(seed.$brython_value)\n }\n\n // Take abs(seed)\n seed = seed > 0 ? seed : -seed\n\n var keys = []\n var int32_1 = 2n ** 32n - 1n\n\n // decomposition in factors of 2 ** 32\n while(seed >= int32_1){\n var quot = seed / int32_1,\n rest = seed % int32_1\n // Rest is a JS number (< 2 ** 32)\n keys.push(Number(rest))\n // Quotient is either a JS number or a instance of long_int\n // but seed must be long_int\n seed = quot\n }\n keys.push(Number(seed))\n\n init_by_array(keys, keys.length)\n }\n\n random.seed(seed)\n\n random.int31 = genrand_int31\n random.int32 = genrand_int32\n random.real1 = genrand_real1\n random.real2 = genrand_real2\n random.real3 = genrand_real3\n random.res53 = genrand_res53\n\n // Added for compatibility with Python\n random.getstate = function(){\n return $B.fast_tuple(mt.concat([mti]))\n }\n\n random.setstate = function(state){\n mt = state.slice(0, state.length - 1)\n mti = state[state.length - 1]\n }\n\n return random\n\n}\n\nvar Random = $B.make_class(\"Random\",\n function(){\n return {\n __class__: Random,\n _random: RandomStream(Date.now())\n }\n }\n)\n\nRandom.getrandbits = function(){\n var $ = $B.args(\"getrandbits\", 2, {self: null, k:null}, [\"self\", \"k\"],\n arguments, {}, null, null),\n self = $.self,\n k = $B.$GetInt($.k)\n\n if(k < 0)\n throw _b_.ValueError.$factory('number of bits must be non-negative')\n\n if(k === 0)\n return 0\n\n const words = Math.floor((k - 1) / 32) + 1\n const wordarray = new ArrayBuffer(words * 4)\n const wordarray_view = new DataView(wordarray)\n\n /* Fill-out bits of long integer, by 32-bit words, from least significant\n to most significant. */\n for(i = 0; i < words; i++, k -= 32){\n r = self._random.int32()\n if (k < 32)\n r >>>= (32 - k) /* Drop least significant bits */\n wordarray_view.setUint32(i * 4, r, true)\n }\n\n return _b_.int.from_bytes(_b_.bytes.$factory(Array.from(new Uint8Array(wordarray))), \"little\")\n}\n\nRandom.getstate = function(){\n var $ = $B.args('getstate', 1, {self: null},\n [\"self\"], arguments, {}, null, null),\n self = $.self\n return self._random.getstate()\n}\n\nRandom.random = function(){\n var $ = $B.args('random', 1, {self: null}, [\"self\"],\n arguments, {}, null, null),\n self = $.self\n return $B.fast_float(self._random())\n}\n\nRandom.seed = function(){\n var $ = $B.args('seed', 2, {self: null, n: null}, ['self', 'n'],\n arguments, {}, null, null),\n self = $.self,\n n = $.n\n\n if (self._random === undefined)\n self._random = RandomStream(n)\n else\n self._random.seed(n)\n}\n\nRandom.setstate = function(){\n var $ = $B.args('setstate', 2, {self: null, state:null}, ['self', 'state'],\n arguments, {}, null, null),\n self = $.self,\n state = $.state\n return self._random.setstate(state)\n}\n\n$B.set_func_names(Random, \"_random\")\n\nreturn { Random }\n\n})(__BRYTHON__)\n"], "_sre": [".py", "\n''\n\n\n\n\n\n\n\nMAXREPEAT=2147483648\nMAXGROUPS=2147483647\n\nimport array\nimport operator,sys\nfrom sre_constants import ATCODES,OPCODES,CHCODES\nfrom sre_constants import SRE_INFO_PREFIX,SRE_INFO_LITERAL\nfrom sre_constants import SRE_FLAG_UNICODE,SRE_FLAG_LOCALE\n\n\nfrom _sre_utils import (unicode_iscased,ascii_iscased,unicode_tolower,\nascii_tolower)\n\nimport sys\n\n\n\nMAGIC=20171005\n\n\n\n\n\n\n\n\n\n\n\n\n\nCODESIZE=4\n\ncopyright=\"_sre.py 2.4c Copyright 2005 by Nik Haldimann\"\n\n\ndef getcodesize():\n return CODESIZE\n \ndef compile(pattern,flags,code,groups=0,groupindex={},indexgroup=[None ]):\n ''\n \n return SRE_Pattern(pattern,flags,code,groups,groupindex,indexgroup)\n \ndef getlower(char_ord,flags):\n if (char_ord <128)or (flags&SRE_FLAG_UNICODE)\\\n or (flags&SRE_FLAG_LOCALE and char_ord <256):\n \n return ord(chr(char_ord).lower())\n else :\n return char_ord\n \n \nclass SRE_Pattern:\n\n def __init__(self,pattern,flags,code,groups=0,groupindex={},indexgroup=[None ]):\n self.pattern=pattern\n self.flags=flags\n self.groups=groups\n self.groupindex=groupindex\n self._indexgroup=indexgroup\n self._code=code\n \n def match(self,string,pos=0,endpos=sys.maxsize):\n ''\n\n \n state=_State(string,pos,endpos,self.flags)\n if state.match(self._code):\n return SRE_Match(self,state)\n return None\n \n def fullmatch(self,string,pos=0,endpos=sys.maxsize):\n ''\n\n \n end=\"$\"if isinstance(string,str)else b\"$\"\n if not string.endswith(end):\n string +=end\n state=_State(string,pos,endpos,self.flags)\n if state.match(self._code):\n return SRE_Match(self,state)\n return None\n \n def search(self,string,pos=0,endpos=sys.maxsize):\n ''\n\n\n \n state=_State(string,pos,endpos,self.flags)\n if state.search(self._code):\n return SRE_Match(self,state)\n else :\n return None\n \n def findall(self,string,pos=0,endpos=sys.maxsize):\n ''\n matchlist=[]\n state=_State(string,pos,endpos,self.flags)\n while state.start <=state.end:\n state.reset()\n state.string_position=state.start\n if not state.search(self._code):\n break\n match=SRE_Match(self,state)\n if self.groups ==0 or self.groups ==1:\n item=match.group(self.groups)\n else :\n item=match.groups(\"\")\n matchlist.append(item)\n if state.string_position ==state.start:\n state.start +=1\n else :\n state.start=state.string_position\n return matchlist\n \n def _subx(self,template,string,count=0,subn=False ):\n filter=template\n if not callable(template)and \"\\\\\"in template:\n \n \n \n \n import re as sre\n filter=sre._subx(self,template)\n state=_State(string,0,sys.maxsize,self.flags)\n sublist=[]\n \n n=last_pos=0\n while not count or n 0):\n \n if callable(filter):\n sublist.append(filter(SRE_Match(self,state)))\n else :\n sublist.append(filter)\n last_pos=state.string_position\n n +=1\n if state.string_position ==state.start:\n state.start +=1\n else :\n state.start=state.string_position\n \n if last_pos =0 and group <=self.re.groups:\n return group\n else :\n if group in self.re.groupindex:\n return self.re.groupindex[group]\n raise IndexError(\"no such group\")\n \n def _get_slice(self,group,default):\n group_indices=self.regs[group]\n if group_indices[0]>=0:\n return self.string[group_indices[0]:group_indices[1]]\n else :\n return default\n \n def start(self,group=0):\n ''\n\n \n return self.regs[self._get_index(group)][0]\n \n def end(self,group=0):\n ''\n\n \n return self.regs[self._get_index(group)][1]\n \n def span(self,group=0):\n ''\n return self.start(group),self.end(group)\n \n def expand(self,template):\n ''\n \n import sre\n return sre._expand(self.re,self,template)\n \n def groups(self,default=None ):\n ''\n\n \n groups=[]\n for indices in self.regs[1:]:\n if indices[0]>=0:\n groups.append(self.string[indices[0]:indices[1]])\n else :\n groups.append(default)\n return tuple(groups)\n \n def groupdict(self,default=None ):\n ''\n\n \n groupdict={}\n for key,value in self.re.groupindex.items():\n groupdict[key]=self._get_slice(value,default)\n return groupdict\n \n def group(self,*args):\n ''\n \n if len(args)==0:\n args=(0,)\n grouplist=[]\n for group in args:\n grouplist.append(self._get_slice(self._get_index(group),None ))\n if len(grouplist)==1:\n return grouplist[0]\n else :\n return tuple(grouplist)\n \n def __copy__():\n raise TypeError(\"cannot copy this pattern object\")\n \n def __deepcopy__():\n raise TypeError(\"cannot copy this pattern object\")\n \n def __str__(self):\n start,end=self.start(0),self.end(0)\n return (f\"\")\n \nclass _State:\n\n def __init__(self,string,start,end,flags):\n if isinstance(string,bytearray):\n string=str(bytes(string),\"latin1\")\n if isinstance(string,bytes):\n string=str(string,\"latin1\")\n self.string=string\n if start <0:\n start=0\n if end >len(string):\n end=len(string)\n self.start=start\n self.string_position=self.start\n self.end=end\n self.pos=start\n self.flags=flags\n self.reset()\n \n def reset(self):\n self.marks=[]\n self.lastindex=-1\n self.marks_stack=[]\n self.context_stack=[]\n self.repeat=None\n \n def match(self,pattern_codes):\n \n \n \n \n \n \n \n \n dispatcher=_OpcodeDispatcher()\n self.context_stack.append(_MatchContext(self,pattern_codes))\n has_matched=None\n while len(self.context_stack)>0:\n context=self.context_stack[-1]\n has_matched=dispatcher.match(context)\n if has_matched is not None :\n self.context_stack.pop()\n return has_matched\n \n def search(self,pattern_codes):\n flags=0\n if OPCODES[pattern_codes[0]].name ==\"info\":\n \n \n if pattern_codes[2]&SRE_INFO_PREFIX and pattern_codes[5]>1:\n return self.fast_search(pattern_codes)\n flags=pattern_codes[2]\n pattern_codes=pattern_codes[pattern_codes[1]+1:]\n \n string_position=self.start\n if OPCODES[pattern_codes[0]].name ==\"literal\":\n \n \n character=pattern_codes[1]\n while True :\n while string_position =self.end:\n return False\n self.start=string_position\n string_position +=1\n self.string_position=string_position\n if flags&SRE_INFO_LITERAL:\n return True\n if self.match(pattern_codes[2:]):\n return True\n return False\n \n \n while string_position <=self.end:\n self.reset()\n self.start=self.string_position=string_position\n if self.match(pattern_codes):\n return True\n string_position +=1\n return False\n \n def fast_search(self,pattern_codes):\n ''\n \n \n \n flags=pattern_codes[2]\n prefix_len=pattern_codes[5]\n prefix_skip=pattern_codes[6]\n prefix=pattern_codes[7:7+prefix_len]\n overlap=pattern_codes[7+prefix_len -1:pattern_codes[1]+1]\n pattern_codes=pattern_codes[pattern_codes[1]+1:]\n i=0\n string_position=self.string_position\n while string_position =len(self.marks):\n self.marks.extend([None ]*(mark_nr -len(self.marks)+1))\n self.marks[mark_nr]=position\n \n def get_marks(self,group_index):\n marks_index=2 *group_index\n if len(self.marks)>marks_index+1:\n return self.marks[marks_index],self.marks[marks_index+1]\n else :\n return None ,None\n \n def marks_push(self):\n self.marks_stack.append((self.marks[:],self.lastindex))\n \n def marks_pop(self):\n self.marks,self.lastindex=self.marks_stack.pop()\n \n def marks_pop_keep(self):\n self.marks,self.lastindex=self.marks_stack[-1]\n \n def marks_pop_discard(self):\n self.marks_stack.pop()\n \n def lower(self,char_ord):\n return getlower(char_ord,self.flags)\n \n \nclass _MatchContext:\n\n def __init__(self,state,pattern_codes):\n self.state=state\n self.pattern_codes=pattern_codes\n self.string_position=state.string_position\n self.code_position=0\n self.has_matched=None\n \n def push_new_context(self,pattern_offset):\n ''\n\n \n child_context=_MatchContext(self.state,\n self.pattern_codes[self.code_position+pattern_offset:])\n \n \n \n \n self.state.context_stack.append(child_context)\n return child_context\n \n def peek_char(self,peek=0):\n return self.state.string[self.string_position+peek]\n \n def skip_char(self,skip_count):\n self.string_position +=skip_count\n \n def remaining_chars(self):\n return self.state.end -self.string_position\n \n def peek_code(self,peek=0):\n return self.pattern_codes[self.code_position+peek]\n \n def skip_code(self,skip_count):\n self.code_position +=skip_count\n \n def remaining_codes(self):\n return len(self.pattern_codes)-self.code_position\n \n def at_beginning(self):\n return self.string_position ==0\n \n def at_end(self):\n return self.string_position ==self.state.end\n \n def at_linebreak(self):\n return not self.at_end()and _is_linebreak(self.peek_char())\n \n def at_boundary(self,word_checker):\n if self.at_beginning()and self.at_end():\n return False\n that=not self.at_beginning()and word_checker(self.peek_char(-1))\n this=not self.at_end()and word_checker(self.peek_char())\n return this !=that\n \n \nclass _RepeatContext(_MatchContext):\n\n def __init__(self,context):\n _MatchContext.__init__(self,context.state,\n context.pattern_codes[context.code_position:])\n self.count=-1\n \n self.previous=context.state.repeat\n self.last_position=None\n \n \nclass _Dispatcher:\n\n DISPATCH_TABLE=None\n \n def dispatch(self,code,context):\n method=self.DISPATCH_TABLE.get(code,self.__class__.unknown)\n return method(self,context)\n \n def unknown(self,code,ctx):\n raise NotImplementedError()\n \n def build_dispatch_table(cls,items,method_prefix):\n if cls.DISPATCH_TABLE is not None :\n return\n table={}\n for item in items:\n key,value=item.name.lower(),int(item)\n if hasattr(cls,\"%s%s\"%(method_prefix,key)):\n table[value]=getattr(cls,\"%s%s\"%(method_prefix,key))\n cls.DISPATCH_TABLE=table\n \n build_dispatch_table=classmethod(build_dispatch_table)\n \n \nclass _OpcodeDispatcher(_Dispatcher):\n\n def __init__(self):\n self.executing_contexts={}\n self.at_dispatcher=_AtcodeDispatcher()\n self.ch_dispatcher=_ChcodeDispatcher()\n self.set_dispatcher=_CharsetDispatcher()\n \n def match(self,context):\n ''\n\n \n while context.remaining_codes()>0 and context.has_matched is None :\n opcode=context.peek_code()\n if not self.dispatch(opcode,context):\n return None\n if context.has_matched is None :\n context.has_matched=False\n return context.has_matched\n \n def dispatch(self,opcode,context):\n ''\n \n \n if id(context)in self.executing_contexts:\n generator=self.executing_contexts[id(context)]\n del self.executing_contexts[id(context)]\n has_finished=next(generator)\n else :\n method=self.DISPATCH_TABLE.get(opcode,_OpcodeDispatcher.unknown)\n has_finished=method(self,context)\n if hasattr(has_finished,\"__next__\"):\n generator=has_finished\n has_finished=next(generator)\n if not has_finished:\n self.executing_contexts[id(context)]=generator\n return has_finished\n \n def op_success(self,ctx):\n \n \n ctx.state.string_position=ctx.string_position\n ctx.has_matched=True\n return True\n \n def op_failure(self,ctx):\n \n \n ctx.has_matched=False\n return True\n \n def general_op_literal(self,ctx,compare,decorate=lambda x:x):\n if ctx.at_end()or not compare(decorate(ord(ctx.peek_char())),\n decorate(ctx.peek_code(1))):\n ctx.has_matched=False\n ctx.skip_code(2)\n ctx.skip_char(1)\n \n def op_literal(self,ctx):\n \n \n \n self.general_op_literal(ctx,operator.eq)\n return True\n \n def op_not_literal(self,ctx):\n \n \n \n self.general_op_literal(ctx,operator.ne)\n return True\n \n def op_literal_ignore(self,ctx):\n \n \n \n self.general_op_literal(ctx,operator.eq,ctx.state.lower)\n return True\n \n def op_literal_uni_ignore(self,ctx):\n self.general_op_literal(ctx,operator.eq,ctx.state.lower)\n return True\n \n def op_not_literal_ignore(self,ctx):\n \n \n \n self.general_op_literal(ctx,operator.ne,ctx.state.lower)\n return True\n \n def op_at(self,ctx):\n \n \n \n if not self.at_dispatcher.dispatch(ctx.peek_code(1),ctx):\n ctx.has_matched=False\n \n return True\n ctx.skip_code(2)\n return True\n \n def op_category(self,ctx):\n \n \n \n if ctx.at_end()or not self.ch_dispatcher.dispatch(ctx.peek_code(1),ctx):\n ctx.has_matched=False\n \n return True\n ctx.skip_code(2)\n ctx.skip_char(1)\n return True\n \n def op_any(self,ctx):\n \n \n \n if ctx.at_end()or ctx.at_linebreak():\n ctx.has_matched=False\n \n return True\n ctx.skip_code(1)\n ctx.skip_char(1)\n return True\n \n def op_any_all(self,ctx):\n \n \n \n if ctx.at_end():\n ctx.has_matched=False\n \n return True\n ctx.skip_code(1)\n ctx.skip_char(1)\n return True\n \n def general_op_in(self,ctx,decorate=lambda x:x):\n \n \n if ctx.at_end():\n ctx.has_matched=False\n \n return\n skip=ctx.peek_code(1)\n ctx.skip_code(2)\n \n \n if not self.check_charset(ctx,decorate(ord(ctx.peek_char()))):\n \n ctx.has_matched=False\n return\n ctx.skip_code(skip -1)\n ctx.skip_char(1)\n \n \n def op_in(self,ctx):\n \n \n \n self.general_op_in(ctx)\n return True\n \n def op_in_ignore(self,ctx):\n \n \n \n self.general_op_in(ctx,ctx.state.lower)\n return True\n \n def op_in_uni_ignore(self,ctx):\n self.general_op_in(ctx,ctx.state.lower)\n return True\n \n def op_jump(self,ctx):\n \n \n \n ctx.skip_code(ctx.peek_code(1)+1)\n return True\n \n \n \n op_info=op_jump\n \n def op_mark(self,ctx):\n \n \n \n ctx.state.set_mark(ctx.peek_code(1),ctx.string_position)\n ctx.skip_code(2)\n return True\n \n def op_branch(self,ctx):\n \n \n \n ctx.state.marks_push()\n ctx.skip_code(1)\n current_branch_length=ctx.peek_code(0)\n while current_branch_length:\n \n \n if not (OPCODES[ctx.peek_code(1)].name ==\"literal\"and\\\n (ctx.at_end()or ctx.peek_code(2)!=ord(ctx.peek_char()))):\n ctx.state.string_position=ctx.string_position\n child_context=ctx.push_new_context(1)\n \n yield False\n if child_context.has_matched:\n ctx.has_matched=True\n yield True\n ctx.state.marks_pop_keep()\n ctx.skip_code(current_branch_length)\n current_branch_length=ctx.peek_code(0)\n ctx.state.marks_pop_discard()\n ctx.has_matched=False\n \n yield True\n \n def op_repeat_one(self,ctx):\n \n \n \n \n mincount=ctx.peek_code(2)\n maxcount=ctx.peek_code(3)\n \n \n \n if ctx.remaining_chars()=mincount and\\\n (ctx.at_end()or ord(ctx.peek_char())!=char):\n ctx.skip_char(-1)\n count -=1\n if count =mincount:\n ctx.state.string_position=ctx.string_position\n child_context=ctx.push_new_context(ctx.peek_code(1)+1)\n yield False\n if child_context.has_matched:\n ctx.has_matched=True\n yield True\n ctx.skip_char(-1)\n count -=1\n ctx.state.marks_pop_keep()\n \n ctx.state.marks_pop_discard()\n ctx.has_matched=False\n \n yield True\n \n def op_min_repeat_one(self,ctx):\n \n \n mincount=ctx.peek_code(2)\n maxcount=ctx.peek_code(3)\n \n \n if ctx.remaining_chars()=maxcount and maxcount !=MAXREPEAT:\n ctx.has_matched=False\n \n yield True\n repeat.count=count\n child_context=repeat.push_new_context(4)\n yield False\n ctx.has_matched=child_context.has_matched\n if not ctx.has_matched:\n repeat.count=count -1\n ctx.state.string_position=ctx.string_position\n yield True\n \n def general_op_groupref(self,ctx,decorate=lambda x:x):\n group_start,group_end=ctx.state.get_marks(ctx.peek_code(1))\n if group_start is None or group_end is None or group_end =0:\n child_context=ctx.push_new_context(3)\n yield False\n if child_context.has_matched:\n ctx.has_matched=False\n yield True\n ctx.skip_code(ctx.peek_code(1)+1)\n yield True\n \n def unknown(self,ctx):\n \n raise RuntimeError(\"Internal re error. Unknown opcode: %s\"%ctx.peek_code())\n \n def check_charset(self,ctx,char):\n ''\n \n self.set_dispatcher.reset(char)\n save_position=ctx.code_position\n result=None\n while result is None :\n result=self.set_dispatcher.dispatch(ctx.peek_code(),ctx)\n ctx.code_position=save_position\n \n return result\n \n def count_repetitions(self,ctx,maxcount):\n ''\n\n \n count=0\n real_maxcount=ctx.state.end -ctx.string_position\n if maxcount >4)\\\n &(1 <<(char_code&15)):\n return self.ok\n ctx.skip_code(16)\n else :\n if char_code <256 and ctx.peek_code(char_code >>5)\\\n &(1 <<(char_code&31)):\n return self.ok\n ctx.skip_code(8)\n def set_range(self,ctx):\n \n if ctx.peek_code(1)<=self.char <=ctx.peek_code(2):\n return self.ok\n ctx.skip_code(3)\n def set_negate(self,ctx):\n self.ok=not self.ok\n ctx.skip_code(1)\n \n def set_bigcharset(self,ctx):\n \n char_code=self.char\n count=ctx.peek_code(1)\n ctx.skip_code(2)\n if char_code <65536:\n block_index=char_code >>8\n \n a=array.array(\"B\")\n a.fromstring(array.array(CODESIZE ==2 and \"H\"or \"I\",\n [ctx.peek_code(block_index //CODESIZE)]).tostring())\n block=a[block_index %CODESIZE]\n ctx.skip_code(256 //CODESIZE)\n block_value=ctx.peek_code(block *(32 //CODESIZE)\n +((char_code&255)>>(CODESIZE ==2 and 4 or 5)))\n if block_value&(1 <<(char_code&((8 *CODESIZE)-1))):\n return self.ok\n else :\n ctx.skip_code(256 //CODESIZE)\n ctx.skip_code(count *(32 //CODESIZE))\n \n def unknown(self,ctx):\n return False\n \n_CharsetDispatcher.build_dispatch_table(OPCODES,\"set_\")\n\n\nclass _AtcodeDispatcher(_Dispatcher):\n\n def at_beginning(self,ctx):\n return ctx.at_beginning()\n at_beginning_string=at_beginning\n def at_beginning_line(self,ctx):\n return ctx.at_beginning()or _is_linebreak(ctx.peek_char(-1))\n def at_end(self,ctx):\n return (ctx.remaining_chars()==1 and ctx.at_linebreak())or ctx.at_end()\n def at_end_line(self,ctx):\n return ctx.at_linebreak()or ctx.at_end()\n def at_end_string(self,ctx):\n return ctx.at_end()\n def at_boundary(self,ctx):\n return ctx.at_boundary(_is_word)\n def at_non_boundary(self,ctx):\n return not ctx.at_boundary(_is_word)\n def at_loc_boundary(self,ctx):\n return ctx.at_boundary(_is_loc_word)\n def at_loc_non_boundary(self,ctx):\n return not ctx.at_boundary(_is_loc_word)\n def at_uni_boundary(self,ctx):\n return ctx.at_boundary(_is_uni_word)\n def at_uni_non_boundary(self,ctx):\n return not ctx.at_boundary(_is_uni_word)\n def unknown(self,ctx):\n return False\n \n_AtcodeDispatcher.build_dispatch_table(ATCODES,\"\")\n\n\nclass _ChcodeDispatcher(_Dispatcher):\n\n def category_digit(self,ctx):\n return _is_digit(ctx.peek_char())\n def category_not_digit(self,ctx):\n return not _is_digit(ctx.peek_char())\n def category_space(self,ctx):\n return _is_space(ctx.peek_char())\n def category_not_space(self,ctx):\n return not _is_space(ctx.peek_char())\n def category_word(self,ctx):\n return _is_word(ctx.peek_char())\n def category_not_word(self,ctx):\n return not _is_word(ctx.peek_char())\n def category_linebreak(self,ctx):\n return _is_linebreak(ctx.peek_char())\n def category_not_linebreak(self,ctx):\n return not _is_linebreak(ctx.peek_char())\n def category_loc_word(self,ctx):\n return _is_loc_word(ctx.peek_char())\n def category_loc_not_word(self,ctx):\n return not _is_loc_word(ctx.peek_char())\n def category_uni_digit(self,ctx):\n return ctx.peek_char().isdigit()\n def category_uni_not_digit(self,ctx):\n return not ctx.peek_char().isdigit()\n def category_uni_space(self,ctx):\n return ctx.peek_char().isspace()\n def category_uni_not_space(self,ctx):\n return not ctx.peek_char().isspace()\n def category_uni_word(self,ctx):\n return _is_uni_word(ctx.peek_char())\n def category_uni_not_word(self,ctx):\n return not _is_uni_word(ctx.peek_char())\n def category_uni_linebreak(self,ctx):\n return ord(ctx.peek_char())in _uni_linebreaks\n def category_uni_not_linebreak(self,ctx):\n return ord(ctx.peek_char())not in _uni_linebreaks\n def unknown(self,ctx):\n return False\n \n_ChcodeDispatcher.build_dispatch_table(CHCODES,\"\")\n\n\n_ascii_char_info=[0,0,0,0,0,0,0,0,0,2,6,2,\n2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,\n0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25,25,25,25,25,\n25,25,0,0,0,0,0,0,0,24,24,24,24,24,24,24,24,24,24,\n24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,0,0,\n0,0,16,0,24,24,24,24,24,24,24,24,24,24,24,24,24,24,\n24,24,24,24,24,24,24,24,24,24,24,24,0,0,0,0,0]\n\ndef _is_digit(char):\n code=ord(char)\n return code <128 and _ascii_char_info[code]&1\n \ndef _is_space(char):\n code=ord(char)\n return code <128 and _ascii_char_info[code]&2\n \ndef _is_word(char):\n\n code=ord(char)\n return code <128 and _ascii_char_info[code]&16\n \ndef _is_loc_word(char):\n return (not (ord(char)&~255)and char.isalnum())or char =='_'\n \ndef _is_uni_word(char):\n\n\n return chr(ord(char)).isalnum()or char =='_'\n \ndef _is_linebreak(char):\n return char ==\"\\n\"\n \n \n_uni_linebreaks=[10,13,28,29,30,133,8232,8233]\n\ndef _log(message):\n if 0:\n print(message)\n", ["_sre_utils", "array", "operator", "re", "sre", "sre_constants", "sys"]], "_sre_utils": [".js", "var $module=(function($B){\n\n function unicode_iscased(cp){\n // cp : Unicode code point\n var letter = String.fromCodePoint(cp)\n return (letter != letter.toLowerCase() ||\n letter != letter.toUpperCase())\n }\n\n function ascii_iscased(cp){\n if(cp > 255){return false}\n return unicode_iscased(cp)\n }\n\n function unicode_tolower(cp){\n var letter = String.fromCodePoint(cp),\n lower = letter.toLowerCase()\n return lower.charCodeAt(0)\n }\n\n function ascii_tolower(cp){\n return unicode_tolower(cp)\n }\n\nreturn {\n unicode_iscased: unicode_iscased,\n ascii_iscased: ascii_iscased,\n unicode_tolower: unicode_tolower,\n ascii_tolower: ascii_tolower\n}\n\n}\n\n)(__BRYTHON__)"], "_string": [".js", "var $module=(function($B){\n\nvar _b_ = $B.builtins\n\nfunction parts(format_string){\n var result = [],\n _parts = $B.split_format(format_string) // defined in py_string.js\n for(var i = 0; i < _parts.length; i+= 2){\n result.push({pre: _parts[i], fmt: _parts[i + 1]})\n }\n return result\n}\n\nfunction Tuple(){\n var args = []\n for(var i=0, len=arguments.length; i < len; i++){\n args.push(arguments[i])\n }\n return _b_.tuple.$factory(args)\n}\n\nreturn{\n\n formatter_field_name_split: function(fieldname){\n // Split the argument as a field name\n var parsed = $B.parse_format(fieldname),\n first = parsed.name,\n rest = []\n if(first.match(/\\d+/)){first = parseInt(first)}\n parsed.name_ext.forEach(function(ext){\n if(ext.startsWith(\"[\")){\n var item = ext.substr(1, ext.length - 2)\n if(item.match(/\\d+/)){\n rest.push(Tuple(false, parseInt(item)))\n }else{\n rest.push(Tuple(false, item))\n }\n }else{\n rest.push(Tuple(true, ext.substr(1)))\n }\n })\n return Tuple(first, _b_.iter(rest))\n },\n formatter_parser: function(format_string){\n // Parse the argument as a format string\n\n if(! _b_.isinstance(format_string, _b_.str)){\n throw _b_.ValueError.$factory(\"Invalid format string type: \" +\n $B.class_name(format_string))\n }\n\n var result = []\n parts(format_string).forEach(function(item){\n var pre = item.pre === undefined ? \"\" : item.pre,\n fmt = item.fmt\n if(fmt === undefined){\n result.push(Tuple(pre, _b_.None, _b_.None, _b_.None))\n }else if(fmt.string == ''){\n result.push(Tuple(pre, '', '', _b_.None))\n }else{\n result.push(Tuple(pre,\n fmt.raw_name + fmt.name_ext.join(\"\"),\n fmt.raw_spec,\n fmt.conv || _b_.None))\n }\n })\n return result\n }\n}\n})(__BRYTHON__)"], "_strptime": [".js", "var _b_ = __BRYTHON__.builtins\n\nvar $module = (function($B){\n return {\n _strptime_datetime: function(cls, s, fmt){\n var pos_s = 0,\n pos_fmt = 0,\n dt = {}\n function error(time_data, format){\n throw _b_.ValueError.$factory(\n `time data '${time_data}' does not match format '${format}'`)\n }\n\n var locale = __BRYTHON__.locale,\n shortdays = [],\n longdays = [],\n conv_func = locale == \"C\" ?\n function(d, options){\n return d.toLocaleDateString('en-EN', options)\n } :\n function(d, options){\n return d.toLocaleDateString(locale, options)\n }\n\n for(var day = 16; day < 23; day++){\n var d = new Date(Date.UTC(2012, 11, day, 3, 0, 0))\n shortdays.push(conv_func(d, {weekday: 'short'}))\n longdays.push(conv_func(d, {weekday: 'long'}))\n }\n\n var shortmonths = [],\n longmonths = []\n\n for(var month = 0; month < 12; month++){\n var d = new Date(Date.UTC(2012, month, 11, 3, 0, 0))\n shortmonths.push(conv_func(d, {month: 'short'}))\n longmonths.push(conv_func(d, {month: 'long'}))\n }\n\n var shortdays_re = new RegExp(shortdays.join(\"|\").replace(\".\", \"\\\\.\")),\n longdays_re = new RegExp(longdays.join(\"|\")),\n shortmonths_re = new RegExp(shortmonths.join(\"|\").replace(\".\", \"\\\\.\")),\n longmonths_re = new RegExp(longmonths.join(\"|\"))\n\n var regexps = {\n d: [\"day\", new RegExp(\"^[123][0-9]|0?[1-9]\")],\n f: [\"microsecond\", new RegExp(\"^\\\\d{1,6}\")],\n H: [\"hour\", new RegExp(\"^[01][0-9]|2[0-3]|\\\\d\")],\n I: [\"hour\", new RegExp(\"^1[0-2]|0?[0-9]\")],\n m: [\"month\", new RegExp(\"^1[012]|0?[1-9]\")],\n M: [\"minute\", new RegExp(\"^[1-5][0-9]|0?[0-9]\")],\n S: [\"second\", new RegExp(\"^[1-5]\\\\d|0?\\\\d\")],\n y: [\"year\", new RegExp(\"^0{0,2}\\\\d{2}\")],\n Y: [\"year\", new RegExp(\"^\\\\d{4}\")],\n z: [\"tzinfo\", new RegExp(\"Z\")]\n }\n\n for(var key in regexps){\n var re = new RegExp('%' + key, \"g\"),\n mo = fmt.match(re)\n if(mo && mo.length > 1){\n throw _b_.ValueError.$factory('strptime directive %' +\n key + ' defined more than once')\n }\n }\n\n while(pos_fmt < fmt.length){\n var car = fmt.charAt(pos_fmt)\n if(car == \"%\"){\n var spec = fmt.charAt(pos_fmt + 1),\n regexp = regexps[spec]\n if(regexp !== undefined){\n var re = regexp[1],\n attr = regexp[0],\n res = re.exec(s.substr(pos_s))\n if(res === null){\n error(s, fmt)\n }else{\n dt[attr] = parseInt(res[0])\n if(attr == \"microsecond\"){\n while(dt[attr] < 100000){\n dt[attr] *= 10\n }\n }else if(attr == \"tzinfo\"){\n // Only value supported for the moment : Z\n // (UTC)\n var dt_module = $B.imported[cls.__module__]\n dt.tzinfo = dt_module.timezone.utc\n }\n pos_fmt += 2\n pos_s += res[0].length\n }\n }else if(spec == \"a\" || spec == \"A\"){\n // Locale's abbreviated (a) or full (A) weekday name\n var attr = \"weekday\",\n re = spec == \"a\" ? shortdays_re : longdays_re,\n t = spec == \"a\" ? shortdays : longdays\n res = re.exec(s.substr(pos_s))\n if(res === null){\n console.log('error', re, 'string', s.substr(pos_s), 'fmt', fmt)\n error(s, fmt)\n }else{\n var match = res[0],\n ix = t.indexOf(match)\n }\n dt.weekday = ix\n pos_fmt += 2\n pos_s += match.length\n }else if(spec == \"b\" || spec == \"B\"){\n // Locales's abbreviated (b) or full (B) month\n var attr = \"month\",\n re = spec == \"b\" ? shortmonths_re : longmonths_re,\n t = spec == \"b\" ? shortmonths : longmonths,\n res = re.exec(s.substr(pos_s))\n if(res === null){\n error(s, fmt)\n }else{\n var match = res[0],\n ix = t.indexOf(match)\n }\n dt.month = ix + 1\n pos_fmt += 2\n pos_s += match.length\n }else if(spec == \"c\"){\n // Locale's appropriate date and time representation\n var fmt1 = fmt.substr(0, pos_fmt - 1) + _locale_c_format() +\n fmt.substr(pos_fmt + 2)\n fmt = fmt1\n }else if(spec == \"%\"){\n if(s.charAt(pos_s) == \"%\"){\n pos_fmt++\n pos_s++\n }else{\n error(s, fmt)\n }\n }else{\n pos_fmt++\n }\n }else{\n if(car == s.charAt(pos_s)){\n pos_fmt++\n pos_s++\n }else{\n error(s, fmt)\n }\n }\n }\n\n if(pos_s < s.length){\n throw _b_.ValueError.$factory('unconverted data remains: ' +\n s.substr(pos_s))\n }\n\n return $B.$call(cls)(dt.year, dt.month, dt.day,\n dt.hour || 0, dt.minute || 0, dt.second || 0,\n dt.microsecond || 0, dt.tzinfo || _b_.None)\n }\n }\n})(__BRYTHON__)\n"], "_svg": [".js", "// creation of an HTML element\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\nvar TagSum = $B.TagSum // defined in py_dom.js\n\nvar $svgNS = \"http://www.w3.org/2000/svg\"\nvar $xlinkNS = \"http://www.w3.org/1999/xlink\"\n\nfunction makeTagDict(tagName){\n // return the dictionary for the class associated with tagName\n var dict = $B.make_class(tagName)\n\n dict.__init__ = function(){\n var $ns = $B.args('__init__', 1, {self: null}, ['self'],\n arguments, {}, 'args', 'kw'),\n self = $ns['self'],\n args = $ns['args']\n if(args.length == 1){\n var first = args[0]\n if($B.$isinstance(first, [_b_.str, _b_.int, _b_.float])){\n self.appendChild(document.createTextNode(_b_.str.$factory(first)))\n }else if(first.__class__ === TagSum){\n for(var i = 0, len = first.children.length; i < len; i++){\n self.appendChild(first.children[i].elt)\n }\n }else{ // argument is another DOMNode instance\n try{self.appendChild(first.elt)}\n catch(err){throw _b_.ValueError.$factory('wrong element ' + first)}\n }\n }\n\n // attributes\n var items = _b_.list.$factory(_b_.dict.items($ns['kw']))\n for(var arg in $ns.kw.$jsobj){\n // keyword arguments\n var value = $B.py_immutable_to_js($ns.kw.$jsobj[arg])\n if(arg.toLowerCase().substr(0,2) == \"on\"){\n // Event binding passed as argument \"onclick\", \"onfocus\"...\n // Better use method bind of DOMNode objects\n $B.DOMNode.bind(self,\n arg.toLowerCase().substr(2),\n value)\n }else if(arg.toLowerCase() == \"style\"){\n $B.DOMNode.set_style(self, value)\n }else if(arg.toLowerCase().indexOf(\"href\") !== -1){ // xlink:href\n self.setAttributeNS( \"http://www.w3.org/1999/xlink\",\n \"href\",value)\n }else{\n if(value !== false){\n // option.selected=false sets it to true :-)\n try{\n arg = arg.replace('_', '-')\n self.setAttributeNS(null, arg, value)\n }catch(err){\n throw _b_.ValueError.$factory(\"can't set attribute \" + arg)\n }\n }\n }\n }\n }\n\n dict.__mro__ = [$B.DOMNode, $B.builtins.object]\n\n dict.__new__ = function(cls){\n var res = $B.DOMNode.$factory(document.createElementNS($svgNS, tagName))\n res.__class__ = cls\n return res\n }\n\n dict.$factory = function(){\n var res = $B.DOMNode.$factory(\n document.createElementNS($svgNS, tagName))\n res.__class__ = dict\n // apply __init__\n dict.__init__(res, ...arguments)\n return res\n }\n\n $B.set_func_names(dict, \"browser.svg\")\n\n return dict\n}\n\n\n// SVG\nvar $svg_tags = ['a',\n'altGlyph',\n'altGlyphDef',\n'altGlyphItem',\n'animate',\n'animateColor',\n'animateMotion',\n'animateTransform',\n'circle',\n'clipPath',\n'color_profile', // instead of color-profile\n'cursor',\n'defs',\n'desc',\n'ellipse',\n'feBlend',\n'foreignObject', //patch to enable foreign objects\n'g',\n'image',\n'line',\n'linearGradient',\n'marker',\n'mask',\n'path',\n'pattern',\n'polygon',\n'polyline',\n'radialGradient',\n'rect',\n'set',\n'stop',\n'svg',\n'text',\n'tref',\n'tspan',\n'use']\n\n// create classes\nvar obj = new Object()\nvar dicts = {}\nfor(var i = 0, len = $svg_tags.length; i < len; i++){\n var tag = $svg_tags[i]\n obj[tag] = makeTagDict(tag)\n}\n\nreturn obj\n})(__BRYTHON__)\n"], "_symtable": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\nreturn {\n CELL: 5,\n DEF_ANNOT: 256,\n DEF_BOUND: 134,\n DEF_FREE: 32,\n DEF_FREE_CLASS: 64,\n DEF_GLOBAL: 1,\n DEF_IMPORT: 128,\n DEF_LOCAL: 2,\n DEF_NONLOCAL: 8,\n DEF_PARAM: 4,\n FREE: 4,\n GLOBAL_EXPLICIT: 2,\n GLOBAL_IMPLICIT: 3,\n LOCAL: 1,\n SCOPE_MASK: 15,\n SCOPE_OFF: 11,\n TYPE_CLASS: 1,\n TYPE_FUNCTION: 0,\n TYPE_MODULE: 2,\n USE: 16,\n symtable: function(){\n var $ = $B.args('symtable', 3,\n {code: null, filename: null, compile_type: null},\n ['code', 'filename', 'compile_type'], arguments,\n {}, null, null)\n var ast = _b_.compile($.code, $.filename, $.compile_type,\n $B.PyCF_ONLY_AST)\n // ast is an instance of Python class\n // _Py_Symtable_Build in symtable.js uses the underlying JS object\n return $B._PySymtable_Build(ast.$js_ast, $.filename)\n }\n}\n\n})(__BRYTHON__)"], "_tokenize": [".js", "var $module = (function($B){\n\nvar _b_ = $B.builtins\n\n$B.$import('token')\n\n\nvar TokenizerIter = $B.make_class('TokenizerIter',\n function(it){\n return {\n __class__: TokenizerIter,\n it\n }\n }\n)\n\nTokenizerIter.__iter__ = function(self){\n var js_iter = function*(){\n var line_num = 0\n while(true){\n try{\n var bytes = self.it()\n }catch(err){\n if($B.is_exc(err, [_b_.StopIteration])){\n token = endmarker\n token.start[0]++\n token.end[0]++\n var type_code = $B.imported.token[token.type]\n yield $B.fast_tuple([type_code, token.string,\n $B.fast_tuple(token.start),\n $B.fast_tuple(token.end),\n token.line])\n }\n throw err\n }\n line_num++\n var line = _b_.bytes.decode(bytes, 'utf-8')\n for(var token of $B.tokenizer(line, 'test')){\n if(token.type == 'ENCODING'){ // skip encoding token\n continue\n }else if(token.type == 'ENDMARKER'){\n var endmarker = token\n continue\n }\n token.start[0] = line_num\n token.end[0] = line_num\n var type_code = $B.imported.token[token.type]\n yield $B.fast_tuple([type_code, token.string,\n $B.fast_tuple(token.start),\n $B.fast_tuple(token.end),\n token.line])\n }\n }\n\n }\n return $B.generator.$factory(js_iter)()\n}\n\nTokenizerIter.__next__ = function*(self){\n\n}\n\n$B.set_func_names(TokenizerIter, '_tokenize')\n\nreturn {TokenizerIter}\n\n})(__BRYTHON__)"], "_webcomponent": [".js", "// module for Web Components\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\n\nfunction define(tag_name, cls, options){\n var $ = $B.args(\"define\", 3, {tag_name: null, cls: null, options: null},\n [\"tag_name\", \"cls\", \"options\"], arguments, {options: _b_.None},\n null, null),\n tag_name = $.tag_name,\n cls = $.cls,\n options = $.options,\n _extends,\n extend_dom_name = 'HTMLElement'\n if(options !== _b_.None){\n if(! $B.$isinstance(options, _b_.dict)){\n throw _b_.TypeError.$factory('options can only be None or a ' +\n `dict, not '${$B.class_name(options)}'`)\n }\n try{\n _extends = _b_.dict.$getitem(options, 'extends')\n }catch(err){\n // ignore\n }\n }else{\n for(var base of cls.__bases__){\n if(base.__module__ == 'browser.html'){\n _extends = base.__name__.toLowerCase()\n break\n }\n }\n }\n\n if(_extends){\n if(typeof _extends != 'string'){\n throw _b_.TypeError.$factory('value for extends must be a ' +\n `string, not '${$B.class_name(_extends)}'`)\n }\n var elt = document.createElement(_extends)\n if(elt instanceof HTMLUnknownElement){\n throw _b_.ValueError.$factory(`'${_extends}' is not a valid ` +\n 'tag name')\n }\n var extend_tag = _extends.toLowerCase()\n extend_dom_name = Object.getPrototypeOf(elt).constructor.name\n }\n if(typeof tag_name != \"string\"){\n throw _b_.TypeError.$factory(\"first argument of define() \" +\n \"must be a string, not '\" + $B.class_name(tag_name) + \"'\")\n }else if(tag_name.indexOf(\"-\") == -1){\n throw _b_.ValueError.$factory(\"custom tag name must \" +\n \"contain a hyphen (-)\")\n }\n if(!$B.$isinstance(cls, _b_.type)){\n throw _b_.TypeError.$factory(\"second argument of define() \" +\n \"must be a class, not '\" + $B.class_name(tag_name) + \"'\")\n }\n cls.$webcomponent = true\n\n // Create the Javascript class used for the component. It must have\n // the same name as the Python class\n var src = String.raw`var WebComponent = class extends HTMLElement {\n constructor(){\n // Always call super first in constructor\n super()\n var html = $B.imported['browser.html']\n // Create tag in module html\n if(html['tag_name'] === undefined){\n html.maketag('tag_name', WebComponent)\n }\n var init = $B.$getattr(cls, \"__init__\", _b_.None)\n if(init !== _b_.None){\n try{\n var _self = $B.DOMNode.$factory(this),\n attrs_before_init = []\n for(var i = 0, len = _self.attributes.length; i < len; i++){\n attrs_before_init.push(_self.attributes.item(i))\n }\n _self.__class__ = cls\n $B.$call(init)(_self)\n if(WebComponent.initialized){\n // Check that init() did not introduce new attributes,\n // which is illegal\n // cf. https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-conformance\n for(var i = 0, len = _self.attributes.length; i < len; i++){\n var item = _self.attributes.item(i)\n if(attrs_before_init.indexOf(item) == -1){\n throw _b_.TypeError.$factory(\"Custom element \" +\n \"must not create attributes, found: \" +\n item.name + '=\"' + item.value + '\"')\n }\n }\n }\n }catch(err){\n $B.handle_error(err)\n }\n }\n }\n static get observedAttributes(){\n var obs_attr = $B.$getattr(cls, \"observedAttributes\", null)\n if(obs_attr === null){\n return []\n }else if(typeof obs_attr == \"function\"){\n var warning = _b_.DeprecationWarning.$factory(\n \"Setting observedAttributes as a method \" +\n \"is deprecated. Set it as a class attribute.\")\n // module _warning is in builtin_modules.js\n $B.imported._warnings.warn(warning)\n return $B.$call(obs_attr)(this)\n }else if(Array.isArray(obs_attr)){\n return obs_attr\n }else{\n throw _b_.TypeError.$factory(\n \"wrong type for observedAttributes: \" +\n $B.class_name(obs_attr))\n }\n }\n }\n `\n var name = cls.__name__,\n code = src.replace(/WebComponent/g, name).\n replace(/tag_name/g, tag_name).\n replace(/HTMLElement/, extend_dom_name)\n var src = eval(code)\n var webcomp = eval(name) // JS class for component\n webcomp.$cls = cls\n\n // Override __getattribute__ to handle DOMNode attributes such as\n // attachShadow\n cls.__getattribute__ = function(self, attr){\n try{\n return $B.DOMNode.__getattribute__(self, attr)\n }catch(err){\n if($B.DOMNode[attr]){\n if(typeof $B.DOMNode[attr] == 'function'){\n return function(){\n var args = [self]\n for(var i = 0, len = arguments.length; i < len; i++){\n args.push(arguments[i])\n }\n return $B.DOMNode[attr].apply(null, args)\n }\n }else{\n return $B.DOMNode[attr]\n }\n }\n throw err\n }\n }\n\n var mro = [cls].concat(cls.__mro__).reverse()\n for(var i = 0, len = mro.length; i < len; i++){\n var pcls = mro[i]\n for(var key in pcls){\n if((! webcomp.hasOwnProperty(key)) &&\n typeof pcls[key] == \"function\" &&\n // don't set $factory (would make it a class)\n key !== '$factory'\n ){\n webcomp.prototype[key] = (function(attr, klass){\n return function(){\n try{\n return $B.$call(klass[attr])($B.DOMNode.$factory(this), ...arguments)\n }catch(err){\n $B.show_error(err)\n }\n }\n })(key, pcls)\n }\n }\n }\n\n // define WebComp as the class to use for the specified tag name\n if(_extends){\n customElements.define(tag_name, webcomp, {extends: extend_tag})\n }else{\n customElements.define(tag_name, webcomp)\n }\n webcomp.initialized = true\n}\n\nfunction get(name){\n var ce = customElements.get(name)\n if(ce && ce.$cls){return ce.$cls}\n return _b_.None\n}\n\nreturn {\n define: define,\n get: get\n}\n\n})(__BRYTHON__)"], "_webworker": [".js", "// Web Worker implementation\n\nvar $module = (function($B){\n\nvar _b_ = $B.builtins\n\nvar VFS = $B.brython_modules ? 'brython_modules' :\n $B.use_VFS ? 'brython_stdlib' : null\n\nfunction scripts_to_load(debug_level){\n if(debug_level > 2){\n var brython_scripts = [\n 'brython_builtins',\n\n 'py_ast_classes',\n 'unicode_data',\n 'stdlib_paths',\n 'version_info',\n\n 'python_tokenizer',\n 'py_ast',\n 'py2js',\n 'loaders',\n 'py_utils',\n 'py_object',\n 'py_type',\n 'py_builtin_functions',\n 'py_sort',\n 'py_exceptions',\n 'py_range_slice',\n 'py_bytes',\n 'py_set',\n 'js_objects',\n 'py_import',\n 'py_string',\n 'py_int',\n 'py_long_int',\n 'py_float',\n 'py_complex',\n 'py_dict',\n 'py_list',\n 'py_generator',\n 'py_dom',\n 'py_pattern_matching',\n 'async',\n 'py_flags',\n 'builtin_modules',\n 'ast_to_js',\n 'symtable',\n 'builtins_docstrings'\n ]\n }else{\n var brython_scripts = ['brython']\n }\n\n if(VFS !== null){\n brython_scripts.push(VFS)\n }\n return brython_scripts\n}\n\nvar wclass = $B.make_class(\"Worker\",\n function(worker){\n var res = worker\n res.send = function(){\n var args = []\n for(var arg of arguments){\n args.push($B.pyobj2structuredclone(arg))\n }\n return res.postMessage.apply(this, args)\n }\n return res\n }\n)\n\nwclass.__mro__ = [$B.JSObj, _b_.object]\n\n$B.set_func_names(wclass, \"browser.worker\")\n\n\nvar _Worker = $B.make_class(\"Worker\", function(id, onmessage, onerror){\n $B.warn(_b_.DeprecationWarning,\n \"worker.Worker is deprecated in version 3.12. \" +\n \"Use worker.create_worker instead\")\n var $ = $B.args(\"__init__\", 3, {id: null, onmessage: null, onerror: null},\n ['id', 'onmessage', 'onerror'], arguments,\n {onmessage: _b_.None, onerror: _b_.None}, null, null),\n id = $.id,\n worker_script = $B.webworkers[id]\n\n if(worker_script === undefined){\n throw _b_.KeyError.$factory(id)\n }\n var filename = worker_script.src ? worker_script.src : $B.script_path + \"#\" + id,\n src = $B.file_cache[filename]\n var indexedDB = worker_script.attributes &&\n worker_script.attributes.getNamedItem('indexedDB')\n var script_id = \"worker\" + $B.UUID(),\n filename = $B.script_path + \"#\" + id\n $B.url2name[filename] = script_id\n\n var js = $B.py2js({src, filename}, script_id).to_js(),\n header = '';\n var brython_scripts = scripts_to_load(\n $B.get_option_from_filename('debug', filename))\n brython_scripts.forEach(function(script){\n if(script != VFS || VFS == \"brython_stdlib\"){\n var url = $B.brython_path + script + \".js\"\n }else{\n // attribute $B.brython_modules is set to the path of\n // brython_modules.js by the script itself\n var url = $B.brython_modules\n }\n if(! $B.get_option('cache')){ // cf. issue 1954\n url += '?' + (new Date()).getTime()\n }\n header += 'importScripts(\"' + url + '\")\\n'\n })\n // set __BRYTHON__.imported[script_id]\n header += `\n var $B = __BRYTHON__,\n _b_ = $B.builtins\n var module = $B.module.$factory(\"${script_id}\")\n module.__file__ = \"${filename}\"\n module.__doc__ = _b_.None\n $B.imported[\"${script_id}\"] = module\\n`\n // restore brython_path\n header += `$B.brython_path = \"${$B.brython_path}\"\\n`\n // restore path for imports (cf. issue #1305)\n header += `$B.make_import_paths(\"${filename}\")\\n`\n // Call brython() to initialize internal Brython values\n header += `brython(${JSON.stringify($B.$options)})\\n`\n js = header + js\n js = `try{${js}}catch(err){$B.handle_error(err)}`\n var blob = new Blob([js], {type: \"application/js\"}),\n url = URL.createObjectURL(blob),\n w = new Worker(url),\n res = wclass.$factory(w)\n return res\n})\n\nfunction create_worker(){\n var $ = $B.args(\"__init__\", 4,\n {id: null, onready: null, onmessage: null, onerror: null},\n ['id', 'onready', 'onmessage', 'onerror'], arguments,\n {onready: _b_.None, onmessage: _b_.None, onerror: _b_.None},\n null, null),\n id = $.id,\n worker_script = $B.webworkers[id],\n onready = $.onready === _b_.None ? _b_.None : $B.$call($.onready),\n onmessage = $.onmessage === _b_.None ? _b_.None : $B.$call($.onmessage),\n onerror = $.onerror === _b_.None ? _b_.None : $B.$call($.onerror)\n\n if(worker_script === undefined){\n throw _b_.RuntimeError.$factory(`No webworker with id '${id}'`)\n }\n var script_id = \"worker\" + $B.UUID(),\n filename = worker_script.src ? worker_script.src : $B.script_path + \"#\" + id,\n src = $B.file_cache[filename]\n $B.url2name[filename] = script_id\n\n var brython_scripts = scripts_to_load(\n $B.get_option_from_filename('debug', filename))\n\n var js = $B.py2js({src, filename}, script_id).to_js(),\n header = '';\n for(var script of brython_scripts){\n if(script != VFS || VFS == \"brython_stdlib\"){\n var url = $B.brython_path + script + \".js\"\n }else{\n // attribute $B.brython_modules is set to the path of\n // brython_modules.js by the script itself\n var url = $B.brython_modules\n }\n if(! $B.get_option('cache')){ // cf. issue 1954\n url += '?' + (new Date()).getTime()\n }\n header += 'importScripts(\"' + url + '\")\\n'\n }\n // set __BRYTHON__.imported[script_id]\n header += `\n var $B = __BRYTHON__,\n _b_ = $B.builtins\n var module = $B.module.$factory(\"${script_id}\")\n module.__file__ = \"${filename}\"\n module.__doc__ = _b_.None\n $B.imported[\"${script_id}\"] = module\\n`\n\n header += '$B.file_cache[module.__file__] = `' + src + '`\\n'\n // restore brython_path\n header += `$B.brython_path = \"${$B.brython_path}\"\\n`\n // restore path for imports (cf. issue #1305)\n header += `$B.make_import_paths(\"${filename}\")\\n`\n\n // Call brython() to initialize internal Brython values\n var save_option = JSON.stringify($B.save_options)\n header += `brython(${save_option})\\n`\n\n // send dummy message to trigger resolution of Promise\n var ok_token = Math.random().toString(36).substr(2, 8),\n error_token = Math.random().toString(36).substr(2, 8)\n\n // open indexedDB cache before running worker code\n js = `$B.idb_open_promise().then(function(){\\n` +\n `try{\\n` +\n `${js}\\n` +\n `self.postMessage('${ok_token}')\\n` +\n `}catch(err){\\n` +\n `self.postMessage(\"${error_token}Error in worker ${id}\\\\n\" + $B.error_trace(err))\\n` +\n `}\\n})`\n js = header + js\n\n var p = new Promise(function(resolve, reject){\n try{\n var blob = new Blob([js], {type: \"application/js\"}),\n url = URL.createObjectURL(blob),\n w = new Worker(url),\n res = wclass.$factory(w)\n }catch(err){\n reject(err)\n }\n\n w.onmessage = function(ev){\n if(ev.data == ok_token){\n resolve(res)\n }else if(typeof ev.data == 'string' &&\n ev.data.startsWith(error_token)){\n reject(ev.data.substr(error_token.length))\n }else{\n if(onmessage !== _b_.None){\n onmessage(ev)\n }\n resolve(res)\n }\n }\n\n return res\n })\n\n var error_func = onerror === _b_.None ? console.debug : onerror\n\n if(onready !== _b_.None){\n p.then(onready).catch(error_func)\n }else{\n p.catch(error_func)\n }\n return _b_.None\n}\n\nreturn {\n Worker: _Worker,\n create_worker\n}\n\n})(__BRYTHON__)\n"], "_zlib_utils": [".js", "\nfunction rfind(buf, seq){\n var buflen = buf.length,\n len = seq.length\n for(var i = buflen - len; i >= 0; i--){\n var chunk = buf.slice(i, i + len),\n found = true\n for(var j = 0; j < len; j++){\n if(chunk[j] != seq[j]){\n found = false\n break\n }\n }\n if(found){return i}\n }\n return -1\n}\n\n\nvar c;\nvar crcTable = [];\nfor(var n =0; n < 256; n++){\n c = n;\n for(var k =0; k < 8; k++){\n c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));\n }\n crcTable[n] = c;\n}\n\nvar $module = (function($B){\n\n return {\n crc32: function(bytes, crc) {\n var crc = crc ^ (-1);\n\n for (var byte of bytes.source) {\n crc = (crc >>> 8) ^ crcTable[(crc ^ byte) & 0xFF];\n }\n\n return (crc ^ (-1)) >>> 0;\n },\n\n lz_generator: function(text, size, min_len){\n /*\n Returns a list of items based on the LZ algorithm, using the\n specified window size and a minimum match length.\n The items are a tuple (length, distance) if a match has been\n found, and a byte otherwise.\n */\n // 'text' is an instance of Python 'bytes' class, the actual\n // bytes are in text.source\n text = text.source\n if(min_len === undefined){\n min_len = 3\n }\n var pos = 0, // position in text\n items = [] // returned items\n while(pos < text.length){\n sequence = text.slice(pos, pos + min_len)\n if(sequence.length < 3){\n for(var i = pos; i < text.length; i++){\n items.push(text[i])\n }\n break\n }\n // Search the sequence in the 'size' previous bytes\n buf = text.slice(pos - size, pos)\n buf_pos = rfind(buf, sequence)\n if(buf_pos > -1){\n // Match of length 3 found; search a longer one\n var len = 1\n while(len < 259 &&\n buf_pos + len < buf.length &&\n pos + len < text.length &&\n text[pos + len] == buf[buf_pos + len]){\n len += 1\n }\n match = text.slice(pos, pos + len)\n // \"Lazy matching\": search longer match starting at next\n // position\n longer_match = false\n if(pos + len < text.length - 2){\n match2 = text.slice(pos + 1, pos + len + 2)\n longer_buf_pos = rfind(buf, match2)\n if(longer_buf_pos > -1){\n // found longer match : emit current byte as\n // literal and move 1 byte forward\n longer_match = true\n char = text[pos]\n items.push(char)\n pos += 1\n }\n }\n if(! longer_match){\n distance = buf.length - buf_pos\n items.push($B.fast_tuple([len, distance]))\n if(pos + len == text.length){\n break\n }else{\n pos += len\n items.push(text[pos])\n pos += 1\n }\n }\n }else{\n char = text[pos]\n items.push(char)\n pos += 1\n }\n }\n return items\n }\n }\n})(__BRYTHON__)"], "crypto_js": [".py", "", [], 1], "crypto_js.rollups": [".py", "", [], 1], "crypto_js.rollups.md5": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(s,p){var m={},l=m.lib={},n=function(){},r=l.Base={extend:function(b){n.prototype=this;var h=new n;b&&h.mixIn(b);h.hasOwnProperty(\"init\")||(h.init=function(){h.$super.init.apply(this,arguments)});h.init.prototype=h;h.$super=this;return h},create:function(){var b=this.extend();b.init.apply(b,arguments);return b},init:function(){},mixIn:function(b){for(var h in b)b.hasOwnProperty(h)&&(this[h]=b[h]);b.hasOwnProperty(\"toString\")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}},\nq=l.WordArray=r.extend({init:function(b,h){b=this.words=b||[];this.sigBytes=h!=p?h:4*b.length},toString:function(b){return(b||t).stringify(this)},concat:function(b){var h=this.words,a=b.words,j=this.sigBytes;b=b.sigBytes;this.clamp();if(j%4)for(var g=0;g>>2]|=(a[g>>>2]>>>24-8*(g%4)&255)<<24-8*((j+g)%4);else if(65535>>2]=a[g>>>2];else h.push.apply(h,a);this.sigBytes+=b;return this},clamp:function(){var b=this.words,h=this.sigBytes;b[h>>>2]&=4294967295<<\n32-8*(h%4);b.length=s.ceil(h/4)},clone:function(){var b=r.clone.call(this);b.words=this.words.slice(0);return b},random:function(b){for(var h=[],a=0;a>>2]>>>24-8*(j%4)&255;g.push((k>>>4).toString(16));g.push((k&15).toString(16))}return g.join(\"\")},parse:function(b){for(var a=b.length,g=[],j=0;j>>3]|=parseInt(b.substr(j,\n2),16)<<24-4*(j%8);return new q.init(g,a/2)}},a=v.Latin1={stringify:function(b){var a=b.words;b=b.sigBytes;for(var g=[],j=0;j>>2]>>>24-8*(j%4)&255));return g.join(\"\")},parse:function(b){for(var a=b.length,g=[],j=0;j>>2]|=(b.charCodeAt(j)&255)<<24-8*(j%4);return new q.init(g,a)}},u=v.Utf8={stringify:function(b){try{return decodeURIComponent(escape(a.stringify(b)))}catch(g){throw Error(\"Malformed UTF-8 data\");}},parse:function(b){return a.parse(unescape(encodeURIComponent(b)))}},\ng=l.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(b){\"string\"==typeof b&&(b=u.parse(b));this._data.concat(b);this._nDataBytes+=b.sigBytes},_process:function(b){var a=this._data,g=a.words,j=a.sigBytes,k=this.blockSize,m=j/(4*k),m=b?s.ceil(m):s.max((m|0)-this._minBufferSize,0);b=m*k;j=s.min(4*b,j);if(b){for(var l=0;l>>32-j)+k}function m(a,k,b,h,l,j,m){a=a+(k&h|b&~h)+l+m;return(a<>>32-j)+k}function l(a,k,b,h,l,j,m){a=a+(k^b^h)+l+m;return(a<>>32-j)+k}function n(a,k,b,h,l,j,m){a=a+(b^(k|~h))+l+m;return(a<>>32-j)+k}for(var r=CryptoJS,q=r.lib,v=q.WordArray,t=q.Hasher,q=r.algo,a=[],u=0;64>u;u++)a[u]=4294967296*s.abs(s.sin(u+1))|0;q=q.MD5=t.extend({_doReset:function(){this._hash=new v.init([1732584193,4023233417,2562383102,271733878])},\n_doProcessBlock:function(g,k){for(var b=0;16>b;b++){var h=k+b,w=g[h];g[h]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var b=this._hash.words,h=g[k+0],w=g[k+1],j=g[k+2],q=g[k+3],r=g[k+4],s=g[k+5],t=g[k+6],u=g[k+7],v=g[k+8],x=g[k+9],y=g[k+10],z=g[k+11],A=g[k+12],B=g[k+13],C=g[k+14],D=g[k+15],c=b[0],d=b[1],e=b[2],f=b[3],c=p(c,d,e,f,h,7,a[0]),f=p(f,c,d,e,w,12,a[1]),e=p(e,f,c,d,j,17,a[2]),d=p(d,e,f,c,q,22,a[3]),c=p(c,d,e,f,r,7,a[4]),f=p(f,c,d,e,s,12,a[5]),e=p(e,f,c,d,t,17,a[6]),d=p(d,e,f,c,u,22,a[7]),\nc=p(c,d,e,f,v,7,a[8]),f=p(f,c,d,e,x,12,a[9]),e=p(e,f,c,d,y,17,a[10]),d=p(d,e,f,c,z,22,a[11]),c=p(c,d,e,f,A,7,a[12]),f=p(f,c,d,e,B,12,a[13]),e=p(e,f,c,d,C,17,a[14]),d=p(d,e,f,c,D,22,a[15]),c=m(c,d,e,f,w,5,a[16]),f=m(f,c,d,e,t,9,a[17]),e=m(e,f,c,d,z,14,a[18]),d=m(d,e,f,c,h,20,a[19]),c=m(c,d,e,f,s,5,a[20]),f=m(f,c,d,e,y,9,a[21]),e=m(e,f,c,d,D,14,a[22]),d=m(d,e,f,c,r,20,a[23]),c=m(c,d,e,f,x,5,a[24]),f=m(f,c,d,e,C,9,a[25]),e=m(e,f,c,d,q,14,a[26]),d=m(d,e,f,c,v,20,a[27]),c=m(c,d,e,f,B,5,a[28]),f=m(f,c,\nd,e,j,9,a[29]),e=m(e,f,c,d,u,14,a[30]),d=m(d,e,f,c,A,20,a[31]),c=l(c,d,e,f,s,4,a[32]),f=l(f,c,d,e,v,11,a[33]),e=l(e,f,c,d,z,16,a[34]),d=l(d,e,f,c,C,23,a[35]),c=l(c,d,e,f,w,4,a[36]),f=l(f,c,d,e,r,11,a[37]),e=l(e,f,c,d,u,16,a[38]),d=l(d,e,f,c,y,23,a[39]),c=l(c,d,e,f,B,4,a[40]),f=l(f,c,d,e,h,11,a[41]),e=l(e,f,c,d,q,16,a[42]),d=l(d,e,f,c,t,23,a[43]),c=l(c,d,e,f,x,4,a[44]),f=l(f,c,d,e,A,11,a[45]),e=l(e,f,c,d,D,16,a[46]),d=l(d,e,f,c,j,23,a[47]),c=n(c,d,e,f,h,6,a[48]),f=n(f,c,d,e,u,10,a[49]),e=n(e,f,c,d,\nC,15,a[50]),d=n(d,e,f,c,s,21,a[51]),c=n(c,d,e,f,A,6,a[52]),f=n(f,c,d,e,q,10,a[53]),e=n(e,f,c,d,y,15,a[54]),d=n(d,e,f,c,w,21,a[55]),c=n(c,d,e,f,v,6,a[56]),f=n(f,c,d,e,D,10,a[57]),e=n(e,f,c,d,t,15,a[58]),d=n(d,e,f,c,B,21,a[59]),c=n(c,d,e,f,r,6,a[60]),f=n(f,c,d,e,z,10,a[61]),e=n(e,f,c,d,j,15,a[62]),d=n(d,e,f,c,x,21,a[63]);b[0]=b[0]+c|0;b[1]=b[1]+d|0;b[2]=b[2]+e|0;b[3]=b[3]+f|0},_doFinalize:function(){var a=this._data,k=a.words,b=8*this._nDataBytes,h=8*a.sigBytes;k[h>>>5]|=128<<24-h%32;var l=s.floor(b/\n4294967296);k[(h+64>>>9<<4)+15]=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360;k[(h+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360;a.sigBytes=4*(k.length+1);this._process();a=this._hash;k=a.words;for(b=0;4>b;b++)h=k[b],k[b]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360;return a},clone:function(){var a=t.clone.call(this);a._hash=this._hash.clone();return a}});r.MD5=t._createHelper(q);r.HmacMD5=t._createHmacHelper(q)})(Math);\n"], "crypto_js.rollups.sha1": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(e,m){var p={},j=p.lib={},l=function(){},f=j.Base={extend:function(a){l.prototype=this;var c=new l;a&&c.mixIn(a);c.hasOwnProperty(\"init\")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\nn=j.WordArray=f.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=m?c:4*a.length},toString:function(a){return(a||h).stringify(this)},concat:function(a){var c=this.words,q=a.words,d=this.sigBytes;a=a.sigBytes;this.clamp();if(d%4)for(var b=0;b>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((d+b)%4);else if(65535>>2]=q[b>>>2];else c.push.apply(c,q);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<\n32-8*(c%4);a.length=e.ceil(c/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b>>2]>>>24-8*(d%4)&255;b.push((f>>>4).toString(16));b.push((f&15).toString(16))}return b.join(\"\")},parse:function(a){for(var c=a.length,b=[],d=0;d>>3]|=parseInt(a.substr(d,\n2),16)<<24-4*(d%8);return new n.init(b,c/2)}},g=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],d=0;d>>2]>>>24-8*(d%4)&255));return b.join(\"\")},parse:function(a){for(var c=a.length,b=[],d=0;d>>2]|=(a.charCodeAt(d)&255)<<24-8*(d%4);return new n.init(b,c)}},r=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(g.stringify(a)))}catch(c){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return g.parse(unescape(encodeURIComponent(a)))}},\nk=j.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new n.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=r.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,b=c.words,d=c.sigBytes,f=this.blockSize,h=d/(4*f),h=a?e.ceil(h):e.max((h|0)-this._minBufferSize,0);a=h*f;d=e.min(4*a,d);if(a){for(var g=0;ga;a++){if(16>a)l[a]=f[n+a]|0;else{var c=l[a-3]^l[a-8]^l[a-14]^l[a-16];l[a]=c<<1|c>>>31}c=(h<<5|h>>>27)+j+l[a];c=20>a?c+((g&e|~g&k)+1518500249):40>a?c+((g^e^k)+1859775393):60>a?c+((g&e|g&k|e&k)-1894007588):c+((g^e^\nk)-899497514);j=k;k=e;e=g<<30|g>>>2;g=h;h=c}b[0]=b[0]+h|0;b[1]=b[1]+g|0;b[2]=b[2]+e|0;b[3]=b[3]+k|0;b[4]=b[4]+j|0},_doFinalize:function(){var f=this._data,e=f.words,b=8*this._nDataBytes,h=8*f.sigBytes;e[h>>>5]|=128<<24-h%32;e[(h+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(h+64>>>9<<4)+15]=b;f.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=j.clone.call(this);e._hash=this._hash.clone();return e}});e.SHA1=j._createHelper(m);e.HmacSHA1=j._createHmacHelper(m)})();\n"], "crypto_js.rollups.sha224": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(g,l){var f={},k=f.lib={},h=function(){},m=k.Base={extend:function(a){h.prototype=this;var c=new h;a&&c.mixIn(a);c.hasOwnProperty(\"init\")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\nq=k.WordArray=m.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=l?c:4*a.length},toString:function(a){return(a||s).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<\n32-8*(c%4);a.length=g.ceil(c/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join(\"\")},parse:function(a){for(var c=a.length,d=[],b=0;b>>3]|=parseInt(a.substr(b,\n2),16)<<24-4*(b%8);return new q.init(d,c/2)}},n=t.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b>>2]>>>24-8*(b%4)&255));return d.join(\"\")},parse:function(a){for(var c=a.length,d=[],b=0;b>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new q.init(d,c)}},j=t.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(c){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}},\nw=k.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=j.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?g.ceil(f):g.max((f|0)-this._minBufferSize,0);a=f*e;b=g.min(4*a,b);if(a){for(var u=0;un;){var j;a:{j=s;for(var w=g.sqrt(j),v=2;v<=w;v++)if(!(j%v)){j=!1;break a}j=!0}j&&(8>n&&(m[n]=t(g.pow(s,0.5))),q[n]=t(g.pow(s,1/3)),n++);s++}var a=[],f=f.SHA256=h.extend({_doReset:function(){this._hash=new k.init(m.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],g=b[2],k=b[3],h=b[4],l=b[5],m=b[6],n=b[7],p=0;64>p;p++){if(16>p)a[p]=\nc[d+p]|0;else{var j=a[p-15],r=a[p-2];a[p]=((j<<25|j>>>7)^(j<<14|j>>>18)^j>>>3)+a[p-7]+((r<<15|r>>>17)^(r<<13|r>>>19)^r>>>10)+a[p-16]}j=n+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&l^~h&m)+q[p]+a[p];r=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&g^f&g);n=m;m=l;l=h;h=k+j|0;k=g;g=f;f=e;e=j+r|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+g|0;b[3]=b[3]+k|0;b[4]=b[4]+h|0;b[5]=b[5]+l|0;b[6]=b[6]+m|0;b[7]=b[7]+n|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;\nd[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=g.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=h.clone.call(this);a._hash=this._hash.clone();return a}});l.SHA256=h._createHelper(f);l.HmacSHA256=h._createHmacHelper(f)})(Math);\n(function(){var g=CryptoJS,l=g.lib.WordArray,f=g.algo,k=f.SHA256,f=f.SHA224=k.extend({_doReset:function(){this._hash=new l.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var f=k._doFinalize.call(this);f.sigBytes-=4;return f}});g.SHA224=k._createHelper(f);g.HmacSHA224=k._createHmacHelper(f)})();\n"], "crypto_js.rollups.sha256": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(h,s){var f={},t=f.lib={},g=function(){},j=t.Base={extend:function(a){g.prototype=this;var c=new g;a&&c.mixIn(a);c.hasOwnProperty(\"init\")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\nq=t.WordArray=j.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length},toString:function(a){return(a||u).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<\n32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=j.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join(\"\")},parse:function(a){for(var c=a.length,d=[],b=0;b>>3]|=parseInt(a.substr(b,\n2),16)<<24-4*(b%8);return new q.init(d,c/2)}},k=v.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b>>2]>>>24-8*(b%4)&255));return d.join(\"\")},parse:function(a){for(var c=a.length,d=[],b=0;b>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new q.init(d,c)}},l=v.Utf8={stringify:function(a){try{return decodeURIComponent(escape(k.stringify(a)))}catch(c){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return k.parse(unescape(encodeURIComponent(a)))}},\nx=t.BufferedBlockAlgorithm=j.extend({reset:function(){this._data=new q.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=l.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var m=0;mk;){var l;a:{l=u;for(var x=h.sqrt(l),w=2;w<=x;w++)if(!(l%w)){l=!1;break a}l=!0}l&&(8>k&&(j[k]=v(h.pow(u,0.5))),q[k]=v(h.pow(u,1/3)),k++);u++}var a=[],f=f.SHA256=g.extend({_doReset:function(){this._hash=new t.init(j.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],m=b[2],h=b[3],p=b[4],j=b[5],k=b[6],l=b[7],n=0;64>n;n++){if(16>n)a[n]=\nc[d+n]|0;else{var r=a[n-15],g=a[n-2];a[n]=((r<<25|r>>>7)^(r<<14|r>>>18)^r>>>3)+a[n-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+a[n-16]}r=l+((p<<26|p>>>6)^(p<<21|p>>>11)^(p<<7|p>>>25))+(p&j^~p&k)+q[n]+a[n];g=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&m^f&m);l=k;k=j;j=p;p=h+r|0;h=m;m=f;f=e;e=r+g|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+m|0;b[3]=b[3]+h|0;b[4]=b[4]+p|0;b[5]=b[5]+j|0;b[6]=b[6]+k|0;b[7]=b[7]+l|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes;\nd[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=g.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=g._createHelper(f);s.HmacSHA256=g._createHmacHelper(f)})(Math);\n"], "crypto_js.rollups.sha3": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(v,p){var d={},u=d.lib={},r=function(){},f=u.Base={extend:function(a){r.prototype=this;var b=new r;a&&b.mixIn(a);b.hasOwnProperty(\"init\")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\ns=u.WordArray=f.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=p?b:4*a.length},toString:function(a){return(a||y).stringify(this)},concat:function(a){var b=this.words,c=a.words,j=this.sigBytes;a=a.sigBytes;this.clamp();if(j%4)for(var n=0;n>>2]|=(c[n>>>2]>>>24-8*(n%4)&255)<<24-8*((j+n)%4);else if(65535>>2]=c[n>>>2];else b.push.apply(b,c);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<\n32-8*(b%4);a.length=v.ceil(b/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],c=0;c>>2]>>>24-8*(j%4)&255;c.push((n>>>4).toString(16));c.push((n&15).toString(16))}return c.join(\"\")},parse:function(a){for(var b=a.length,c=[],j=0;j>>3]|=parseInt(a.substr(j,\n2),16)<<24-4*(j%8);return new s.init(c,b/2)}},e=x.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],j=0;j>>2]>>>24-8*(j%4)&255));return c.join(\"\")},parse:function(a){for(var b=a.length,c=[],j=0;j>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new s.init(c,b)}},q=x.Utf8={stringify:function(a){try{return decodeURIComponent(escape(e.stringify(a)))}catch(b){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return e.parse(unescape(encodeURIComponent(a)))}},\nt=u.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new s.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=q.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,c=b.words,j=b.sigBytes,n=this.blockSize,e=j/(4*n),e=a?v.ceil(e):v.max((e|0)-this._minBufferSize,0);a=e*n;j=v.min(4*a,j);if(a){for(var f=0;ft;t++){s[e+5*q]=(t+1)*(t+2)/2%64;var w=(2*e+3*q)%5,e=q%5,q=w}for(e=0;5>e;e++)for(q=0;5>q;q++)x[e+5*q]=q+5*((2*e+3*q)%5);e=1;for(q=0;24>q;q++){for(var a=w=t=0;7>a;a++){if(e&1){var b=(1<b?w^=1<e;e++)c[e]=f.create();d=d.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var a=this._state=\n[],b=0;25>b;b++)a[b]=new f.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(a,b){for(var e=this._state,f=this.blockSize/2,h=0;h>>24)&16711935|(l<<24|l>>>8)&4278255360,m=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360,g=e[h];g.high^=m;g.low^=l}for(f=0;24>f;f++){for(h=0;5>h;h++){for(var d=l=0,k=0;5>k;k++)g=e[h+5*k],l^=g.high,d^=g.low;g=c[h];g.high=l;g.low=d}for(h=0;5>h;h++){g=c[(h+4)%5];l=c[(h+1)%5];m=l.high;k=l.low;l=g.high^\n(m<<1|k>>>31);d=g.low^(k<<1|m>>>31);for(k=0;5>k;k++)g=e[h+5*k],g.high^=l,g.low^=d}for(m=1;25>m;m++)g=e[m],h=g.high,g=g.low,k=s[m],32>k?(l=h<>>32-k,d=g<>>32-k):(l=g<>>64-k,d=h<>>64-k),g=c[x[m]],g.high=l,g.low=d;g=c[0];h=e[0];g.high=h.high;g.low=h.low;for(h=0;5>h;h++)for(k=0;5>k;k++)m=h+5*k,g=e[m],l=c[m],m=c[(h+1)%5+5*k],d=c[(h+2)%5+5*k],g.high=l.high^~m.high&d.high,g.low=l.low^~m.low&d.low;g=e[0];h=y[f];g.high^=h.high;g.low^=h.low}},_doFinalize:function(){var a=this._data,\nb=a.words,c=8*a.sigBytes,e=32*this.blockSize;b[c>>>5]|=1<<24-c%32;b[(v.ceil((c+1)/e)*e>>>5)-1]|=128;a.sigBytes=4*b.length;this._process();for(var a=this._state,b=this.cfg.outputLength/8,c=b/8,e=[],h=0;h>>24)&16711935|(f<<24|f>>>8)&4278255360,d=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;e.push(d);e.push(f)}return new u.init(e,b)},clone:function(){for(var a=r.clone.call(this),b=a._state=this._state.slice(0),c=0;25>c;c++)b[c]=b[c].clone();return a}});\np.SHA3=r._createHelper(d);p.HmacSHA3=r._createHmacHelper(d)})(Math);\n"], "crypto_js.rollups.sha384": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(a,c){var d={},j=d.lib={},f=function(){},m=j.Base={extend:function(a){f.prototype=this;var b=new f;a&&b.mixIn(a);b.hasOwnProperty(\"init\")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\nB=j.WordArray=m.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=c?b:4*a.length},toString:function(a){return(a||y).stringify(this)},concat:function(a){var b=this.words,g=a.words,e=this.sigBytes;a=a.sigBytes;this.clamp();if(e%4)for(var k=0;k>>2]|=(g[k>>>2]>>>24-8*(k%4)&255)<<24-8*((e+k)%4);else if(65535>>2]=g[k>>>2];else b.push.apply(b,g);this.sigBytes+=a;return this},clamp:function(){var n=this.words,b=this.sigBytes;n[b>>>2]&=4294967295<<\n32-8*(b%4);n.length=a.ceil(b/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(n){for(var b=[],g=0;g>>2]>>>24-8*(e%4)&255;g.push((k>>>4).toString(16));g.push((k&15).toString(16))}return g.join(\"\")},parse:function(a){for(var b=a.length,g=[],e=0;e>>3]|=parseInt(a.substr(e,\n2),16)<<24-4*(e%8);return new B.init(g,b/2)}},F=v.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var g=[],e=0;e>>2]>>>24-8*(e%4)&255));return g.join(\"\")},parse:function(a){for(var b=a.length,g=[],e=0;e>>2]|=(a.charCodeAt(e)&255)<<24-8*(e%4);return new B.init(g,b)}},ha=v.Utf8={stringify:function(a){try{return decodeURIComponent(escape(F.stringify(a)))}catch(b){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return F.parse(unescape(encodeURIComponent(a)))}},\nZ=j.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new B.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=ha.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(n){var b=this._data,g=b.words,e=b.sigBytes,k=this.blockSize,m=e/(4*k),m=n?a.ceil(m):a.max((m|0)-this._minBufferSize,0);n=m*k;e=a.min(4*n,e);if(n){for(var c=0;cy;y++)v[y]=a();j=j.SHA512=d.extend({_doReset:function(){this._hash=new m.init([new f.init(1779033703,4089235720),new f.init(3144134277,2227873595),new f.init(1013904242,4271175723),new f.init(2773480762,1595750129),new f.init(1359893119,2917565137),new f.init(2600822924,725511199),new f.init(528734635,4215389547),new f.init(1541459225,327033209)])},_doProcessBlock:function(a,c){for(var d=this._hash.words,\nf=d[0],j=d[1],b=d[2],g=d[3],e=d[4],k=d[5],m=d[6],d=d[7],y=f.high,M=f.low,$=j.high,N=j.low,aa=b.high,O=b.low,ba=g.high,P=g.low,ca=e.high,Q=e.low,da=k.high,R=k.low,ea=m.high,S=m.low,fa=d.high,T=d.low,s=y,p=M,G=$,D=N,H=aa,E=O,W=ba,I=P,t=ca,q=Q,U=da,J=R,V=ea,K=S,X=fa,L=T,u=0;80>u;u++){var z=v[u];if(16>u)var r=z.high=a[c+2*u]|0,h=z.low=a[c+2*u+1]|0;else{var r=v[u-15],h=r.high,w=r.low,r=(h>>>1|w<<31)^(h>>>8|w<<24)^h>>>7,w=(w>>>1|h<<31)^(w>>>8|h<<24)^(w>>>7|h<<25),C=v[u-2],h=C.high,l=C.low,C=(h>>>19|l<<\n13)^(h<<3|l>>>29)^h>>>6,l=(l>>>19|h<<13)^(l<<3|h>>>29)^(l>>>6|h<<26),h=v[u-7],Y=h.high,A=v[u-16],x=A.high,A=A.low,h=w+h.low,r=r+Y+(h>>>0>>0?1:0),h=h+l,r=r+C+(h>>>0>>0?1:0),h=h+A,r=r+x+(h>>>0>>0?1:0);z.high=r;z.low=h}var Y=t&U^~t&V,A=q&J^~q&K,z=s&G^s&H^G&H,ja=p&D^p&E^D&E,w=(s>>>28|p<<4)^(s<<30|p>>>2)^(s<<25|p>>>7),C=(p>>>28|s<<4)^(p<<30|s>>>2)^(p<<25|s>>>7),l=B[u],ka=l.high,ga=l.low,l=L+((q>>>14|t<<18)^(q>>>18|t<<14)^(q<<23|t>>>9)),x=X+((t>>>14|q<<18)^(t>>>18|q<<14)^(t<<23|q>>>9))+(l>>>0<\nL>>>0?1:0),l=l+A,x=x+Y+(l>>>0>>0?1:0),l=l+ga,x=x+ka+(l>>>0>>0?1:0),l=l+h,x=x+r+(l>>>0>>0?1:0),h=C+ja,z=w+z+(h>>>0>>0?1:0),X=V,L=K,V=U,K=J,U=t,J=q,q=I+l|0,t=W+x+(q>>>0>>0?1:0)|0,W=H,I=E,H=G,E=D,G=s,D=p,p=l+h|0,s=x+z+(p>>>0>>0?1:0)|0}M=f.low=M+p;f.high=y+s+(M>>>0

>>0?1:0);N=j.low=N+D;j.high=$+G+(N>>>0>>0?1:0);O=b.low=O+E;b.high=aa+H+(O>>>0>>0?1:0);P=g.low=P+I;g.high=ba+W+(P>>>0>>0?1:0);Q=e.low=Q+q;e.high=ca+t+(Q>>>0>>0?1:0);R=k.low=R+J;k.high=da+U+(R>>>0>>0?1:0);\nS=m.low=S+K;m.high=ea+V+(S>>>0>>0?1:0);T=d.low=T+L;d.high=fa+X+(T>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,c=a.words,d=8*this._nDataBytes,f=8*a.sigBytes;c[f>>>5]|=128<<24-f%32;c[(f+128>>>10<<5)+30]=Math.floor(d/4294967296);c[(f+128>>>10<<5)+31]=d;a.sigBytes=4*c.length;this._process();return this._hash.toX32()},clone:function(){var a=d.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});c.SHA512=d._createHelper(j);c.HmacSHA512=d._createHmacHelper(j)})();\n(function(){var a=CryptoJS,c=a.x64,d=c.Word,j=c.WordArray,c=a.algo,f=c.SHA512,c=c.SHA384=f.extend({_doReset:function(){this._hash=new j.init([new d.init(3418070365,3238371032),new d.init(1654270250,914150663),new d.init(2438529370,812702999),new d.init(355462360,4144912697),new d.init(1731405415,4290775857),new d.init(2394180231,1750603025),new d.init(3675008525,1694076839),new d.init(1203062813,3204075428)])},_doFinalize:function(){var a=f._doFinalize.call(this);a.sigBytes-=16;return a}});a.SHA384=\nf._createHelper(c);a.HmacSHA384=f._createHmacHelper(c)})();\n"], "crypto_js.rollups.sha512": [".js", "/*\nCryptoJS v3.1.2\ncode.google.com/p/crypto-js\n(c) 2009-2013 by Jeff Mott. All rights reserved.\ncode.google.com/p/crypto-js/wiki/License\n*/\nvar CryptoJS=CryptoJS||function(a,m){var r={},f=r.lib={},g=function(){},l=f.Base={extend:function(a){g.prototype=this;var b=new g;a&&b.mixIn(a);b.hasOwnProperty(\"init\")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty(\"toString\")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},\np=f.WordArray=l.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=m?b:4*a.length},toString:function(a){return(a||q).stringify(this)},concat:function(a){var b=this.words,d=a.words,c=this.sigBytes;a=a.sigBytes;this.clamp();if(c%4)for(var j=0;j>>2]|=(d[j>>>2]>>>24-8*(j%4)&255)<<24-8*((c+j)%4);else if(65535>>2]=d[j>>>2];else b.push.apply(b,d);this.sigBytes+=a;return this},clamp:function(){var n=this.words,b=this.sigBytes;n[b>>>2]&=4294967295<<\n32-8*(b%4);n.length=a.ceil(b/4)},clone:function(){var a=l.clone.call(this);a.words=this.words.slice(0);return a},random:function(n){for(var b=[],d=0;d>>2]>>>24-8*(c%4)&255;d.push((j>>>4).toString(16));d.push((j&15).toString(16))}return d.join(\"\")},parse:function(a){for(var b=a.length,d=[],c=0;c>>3]|=parseInt(a.substr(c,\n2),16)<<24-4*(c%8);return new p.init(d,b/2)}},G=y.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var d=[],c=0;c>>2]>>>24-8*(c%4)&255));return d.join(\"\")},parse:function(a){for(var b=a.length,d=[],c=0;c>>2]|=(a.charCodeAt(c)&255)<<24-8*(c%4);return new p.init(d,b)}},fa=y.Utf8={stringify:function(a){try{return decodeURIComponent(escape(G.stringify(a)))}catch(b){throw Error(\"Malformed UTF-8 data\");}},parse:function(a){return G.parse(unescape(encodeURIComponent(a)))}},\nh=f.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new p.init;this._nDataBytes=0},_append:function(a){\"string\"==typeof a&&(a=fa.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(n){var b=this._data,d=b.words,c=b.sigBytes,j=this.blockSize,l=c/(4*j),l=n?a.ceil(l):a.max((l|0)-this._minBufferSize,0);n=l*j;c=a.min(4*n,c);if(n){for(var h=0;hq;q++)y[q]=a();f=f.SHA512=r.extend({_doReset:function(){this._hash=new l.init([new g.init(1779033703,4089235720),new g.init(3144134277,2227873595),new g.init(1013904242,4271175723),new g.init(2773480762,1595750129),new g.init(1359893119,2917565137),new g.init(2600822924,725511199),new g.init(528734635,4215389547),new g.init(1541459225,327033209)])},_doProcessBlock:function(a,f){for(var h=this._hash.words,\ng=h[0],n=h[1],b=h[2],d=h[3],c=h[4],j=h[5],l=h[6],h=h[7],q=g.high,m=g.low,r=n.high,N=n.low,Z=b.high,O=b.low,$=d.high,P=d.low,aa=c.high,Q=c.low,ba=j.high,R=j.low,ca=l.high,S=l.low,da=h.high,T=h.low,v=q,s=m,H=r,E=N,I=Z,F=O,W=$,J=P,w=aa,t=Q,U=ba,K=R,V=ca,L=S,X=da,M=T,x=0;80>x;x++){var B=y[x];if(16>x)var u=B.high=a[f+2*x]|0,e=B.low=a[f+2*x+1]|0;else{var u=y[x-15],e=u.high,z=u.low,u=(e>>>1|z<<31)^(e>>>8|z<<24)^e>>>7,z=(z>>>1|e<<31)^(z>>>8|e<<24)^(z>>>7|e<<25),D=y[x-2],e=D.high,k=D.low,D=(e>>>19|k<<13)^\n(e<<3|k>>>29)^e>>>6,k=(k>>>19|e<<13)^(k<<3|e>>>29)^(k>>>6|e<<26),e=y[x-7],Y=e.high,C=y[x-16],A=C.high,C=C.low,e=z+e.low,u=u+Y+(e>>>0>>0?1:0),e=e+k,u=u+D+(e>>>0>>0?1:0),e=e+C,u=u+A+(e>>>0>>0?1:0);B.high=u;B.low=e}var Y=w&U^~w&V,C=t&K^~t&L,B=v&H^v&I^H&I,ha=s&E^s&F^E&F,z=(v>>>28|s<<4)^(v<<30|s>>>2)^(v<<25|s>>>7),D=(s>>>28|v<<4)^(s<<30|v>>>2)^(s<<25|v>>>7),k=p[x],ia=k.high,ea=k.low,k=M+((t>>>14|w<<18)^(t>>>18|w<<14)^(t<<23|w>>>9)),A=X+((w>>>14|t<<18)^(w>>>18|t<<14)^(w<<23|t>>>9))+(k>>>0>>\n0?1:0),k=k+C,A=A+Y+(k>>>0>>0?1:0),k=k+ea,A=A+ia+(k>>>0>>0?1:0),k=k+e,A=A+u+(k>>>0>>0?1:0),e=D+ha,B=z+B+(e>>>0>>0?1:0),X=V,M=L,V=U,L=K,U=w,K=t,t=J+k|0,w=W+A+(t>>>0>>0?1:0)|0,W=I,J=F,I=H,F=E,H=v,E=s,s=k+e|0,v=A+B+(s>>>0>>0?1:0)|0}m=g.low=m+s;g.high=q+v+(m>>>0>>0?1:0);N=n.low=N+E;n.high=r+H+(N>>>0>>0?1:0);O=b.low=O+F;b.high=Z+I+(O>>>0>>0?1:0);P=d.low=P+J;d.high=$+W+(P>>>0>>0?1:0);Q=c.low=Q+t;c.high=aa+w+(Q>>>0>>0?1:0);R=j.low=R+K;j.high=ba+U+(R>>>0>>0?1:0);S=l.low=\nS+L;l.high=ca+V+(S>>>0>>0?1:0);T=h.low=T+M;h.high=da+X+(T>>>0>>0?1:0)},_doFinalize:function(){var a=this._data,f=a.words,h=8*this._nDataBytes,g=8*a.sigBytes;f[g>>>5]|=128<<24-g%32;f[(g+128>>>10<<5)+30]=Math.floor(h/4294967296);f[(g+128>>>10<<5)+31]=h;a.sigBytes=4*f.length;this._process();return this._hash.toX32()},clone:function(){var a=r.clone.call(this);a._hash=this._hash.clone();return a},blockSize:32});m.SHA512=r._createHelper(f);m.HmacSHA512=r._createHmacHelper(f)})();\n"], "abc": [".py", "\n\n\n\"\"\"Abstract Base Classes (ABCs) according to PEP 3119.\"\"\"\n\n\ndef abstractmethod(funcobj):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n funcobj.__isabstractmethod__=True\n return funcobj\n \n \nclass abstractclassmethod(classmethod):\n ''\n\n\n\n\n\n\n\n\n\n \n \n __isabstractmethod__=True\n \n def __init__(self,callable):\n callable.__isabstractmethod__=True\n super().__init__(callable)\n \n \nclass abstractstaticmethod(staticmethod):\n ''\n\n\n\n\n\n\n\n\n\n \n \n __isabstractmethod__=True\n \n def __init__(self,callable):\n callable.__isabstractmethod__=True\n super().__init__(callable)\n \n \nclass abstractproperty(property):\n ''\n\n\n\n\n\n\n\n\n\n \n \n __isabstractmethod__=True\n \n \ntry:\n from _abc import(get_cache_token,_abc_init,_abc_register,\n _abc_instancecheck,_abc_subclasscheck,_get_dump,\n _reset_registry,_reset_caches)\nexcept ImportError:\n from _py_abc import ABCMeta,get_cache_token\n ABCMeta.__module__='abc'\nelse:\n class ABCMeta(type):\n ''\n\n\n\n\n\n\n\n\n\n\n \n def __new__(mcls,name,bases,namespace,/,**kwargs):\n cls=super().__new__(mcls,name,bases,namespace,**kwargs)\n _abc_init(cls)\n return cls\n \n def register(cls,subclass):\n ''\n\n\n \n return _abc_register(cls,subclass)\n \n def __instancecheck__(cls,instance):\n ''\n return _abc_instancecheck(cls,instance)\n \n def __subclasscheck__(cls,subclass):\n ''\n return _abc_subclasscheck(cls,subclass)\n \n def _dump_registry(cls,file=None):\n ''\n print(f\"Class: {cls.__module__}.{cls.__qualname__}\",file=file)\n print(f\"Inv. counter: {get_cache_token()}\",file=file)\n (_abc_registry,_abc_cache,_abc_negative_cache,\n _abc_negative_cache_version)=_get_dump(cls)\n print(f\"_abc_registry: {_abc_registry !r}\",file=file)\n print(f\"_abc_cache: {_abc_cache !r}\",file=file)\n print(f\"_abc_negative_cache: {_abc_negative_cache !r}\",file=file)\n print(f\"_abc_negative_cache_version: {_abc_negative_cache_version !r}\",\n file=file)\n \n def _abc_registry_clear(cls):\n ''\n _reset_registry(cls)\n \n def _abc_caches_clear(cls):\n ''\n _reset_caches(cls)\n \n \ndef update_abstractmethods(cls):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not hasattr(cls,'__abstractmethods__'):\n \n \n \n return cls\n \n abstracts=set()\n \n \n for scls in cls.__bases__:\n for name in getattr(scls,'__abstractmethods__',()):\n value=getattr(cls,name,None)\n if getattr(value,\"__isabstractmethod__\",False):\n abstracts.add(name)\n \n for name,value in cls.__dict__.items():\n if getattr(value,\"__isabstractmethod__\",False):\n abstracts.add(name)\n cls.__abstractmethods__=frozenset(abstracts)\n return cls\n \n \nclass ABC(metaclass=ABCMeta):\n ''\n\n \n __slots__=()\n", ["_abc", "_py_abc"]], "antigravity": [".py", "\nimport webbrowser\nimport hashlib\n\nwebbrowser.open(\"https://xkcd.com/353/\")\n\ndef geohash(latitude,longitude,datedow):\n ''\n\n\n\n\n \n \n h=hashlib.md5(datedow,usedforsecurity=False ).hexdigest()\n p,q=[('%f'%float.fromhex('0.'+x))for x in (h[:16],h[16:32])]\n print('%d%s %d%s'%(latitude,p[1:],longitude,q[1:]))\n", ["hashlib", "webbrowser"]], "argparse": [".py", "\n\n\n\"\"\"Command-line parsing library\n\nThis module is an optparse-inspired command-line parsing library that:\n\n - handles both optional and positional arguments\n - produces highly informative usage messages\n - supports parsers that dispatch to sub-parsers\n\nThe following is a simple usage example that sums integers from the\ncommand-line and writes the result to a file::\n\n parser = argparse.ArgumentParser(\n description='sum the integers at the command line')\n parser.add_argument(\n 'integers', metavar='int', nargs='+', type=int,\n help='an integer to be summed')\n parser.add_argument(\n '--log', default=sys.stdout, type=argparse.FileType('w'),\n help='the file where the sum should be written')\n args = parser.parse_args()\n args.log.write('%s' % sum(args.integers))\n args.log.close()\n\nThe module contains the following public classes:\n\n - ArgumentParser -- The main entry point for command-line parsing. As the\n example above shows, the add_argument() method is used to populate\n the parser with actions for optional and positional arguments. Then\n the parse_args() method is invoked to convert the args at the\n command-line into an object with attributes.\n\n - ArgumentError -- The exception raised by ArgumentParser objects when\n there are errors with the parser's actions. Errors raised while\n parsing the command-line are caught by ArgumentParser and emitted\n as command-line messages.\n\n - FileType -- A factory for defining types of files to be created. As the\n example above shows, instances of FileType are typically passed as\n the type= argument of add_argument() calls.\n\n - Action -- The base class for parser actions. Typically actions are\n selected by passing strings like 'store_true' or 'append_const' to\n the action= argument of add_argument(). However, for greater\n customization of ArgumentParser actions, subclasses of Action may\n be defined and passed as the action= argument.\n\n - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter,\n ArgumentDefaultsHelpFormatter -- Formatter classes which\n may be passed as the formatter_class= argument to the\n ArgumentParser constructor. HelpFormatter is the default,\n RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser\n not to change the formatting for help text, and\n ArgumentDefaultsHelpFormatter adds information about argument defaults\n to the help.\n\nAll other classes in this module are considered implementation details.\n(Also note that HelpFormatter and RawDescriptionHelpFormatter are only\nconsidered public as object names -- the API of the formatter objects is\nstill considered an implementation detail.)\n\"\"\"\n\n__version__='1.1'\n__all__=[\n'ArgumentParser',\n'ArgumentError',\n'ArgumentTypeError',\n'BooleanOptionalAction',\n'FileType',\n'HelpFormatter',\n'ArgumentDefaultsHelpFormatter',\n'RawDescriptionHelpFormatter',\n'RawTextHelpFormatter',\n'MetavarTypeHelpFormatter',\n'Namespace',\n'Action',\n'ONE_OR_MORE',\n'OPTIONAL',\n'PARSER',\n'REMAINDER',\n'SUPPRESS',\n'ZERO_OR_MORE',\n]\n\n\nimport os as _os\nimport re as _re\nimport sys as _sys\n\nimport warnings\n\nfrom gettext import gettext as _,ngettext\n\nSUPPRESS='==SUPPRESS=='\n\nOPTIONAL='?'\nZERO_OR_MORE='*'\nONE_OR_MORE='+'\nPARSER='A...'\nREMAINDER='...'\n_UNRECOGNIZED_ARGS_ATTR='_unrecognized_args'\n\n\n\n\n\nclass _AttributeHolder(object):\n ''\n\n\n\n\n\n \n \n def __repr__(self):\n type_name=type(self).__name__\n arg_strings=[]\n star_args={}\n for arg in self._get_args():\n arg_strings.append(repr(arg))\n for name,value in self._get_kwargs():\n if name.isidentifier():\n arg_strings.append('%s=%r'%(name,value))\n else:\n star_args[name]=value\n if star_args:\n arg_strings.append('**%s'%repr(star_args))\n return '%s(%s)'%(type_name,', '.join(arg_strings))\n \n def _get_kwargs(self):\n return list(self.__dict__.items())\n \n def _get_args(self):\n return[]\n \n \ndef _copy_items(items):\n if items is None:\n return[]\n \n \n \n if type(items)is list:\n return items[:]\n import copy\n return copy.copy(items)\n \n \n \n \n \n \n \nclass HelpFormatter(object):\n ''\n\n\n\n \n \n def __init__(self,\n prog,\n indent_increment=2,\n max_help_position=24,\n width=None):\n \n \n if width is None:\n import shutil\n width=shutil.get_terminal_size().columns\n width -=2\n \n self._prog=prog\n self._indent_increment=indent_increment\n self._max_help_position=min(max_help_position,\n max(width -20,indent_increment *2))\n self._width=width\n \n self._current_indent=0\n self._level=0\n self._action_max_length=0\n \n self._root_section=self._Section(self,None)\n self._current_section=self._root_section\n \n self._whitespace_matcher=_re.compile(r'\\s+',_re.ASCII)\n self._long_break_matcher=_re.compile(r'\\n\\n\\n+')\n \n \n \n \n def _indent(self):\n self._current_indent +=self._indent_increment\n self._level +=1\n \n def _dedent(self):\n self._current_indent -=self._indent_increment\n assert self._current_indent >=0,'Indent decreased below 0.'\n self._level -=1\n \n class _Section(object):\n \n def __init__(self,formatter,parent,heading=None):\n self.formatter=formatter\n self.parent=parent\n self.heading=heading\n self.items=[]\n \n def format_help(self):\n \n if self.parent is not None:\n self.formatter._indent()\n join=self.formatter._join_parts\n item_help=join([func(*args)for func,args in self.items])\n if self.parent is not None:\n self.formatter._dedent()\n \n \n if not item_help:\n return ''\n \n \n if self.heading is not SUPPRESS and self.heading is not None:\n current_indent=self.formatter._current_indent\n heading='%*s%s:\\n'%(current_indent,'',self.heading)\n else:\n heading=''\n \n \n return join(['\\n',heading,item_help,'\\n'])\n \n def _add_item(self,func,args):\n self._current_section.items.append((func,args))\n \n \n \n \n def start_section(self,heading):\n self._indent()\n section=self._Section(self,self._current_section,heading)\n self._add_item(section.format_help,[])\n self._current_section=section\n \n def end_section(self):\n self._current_section=self._current_section.parent\n self._dedent()\n \n def add_text(self,text):\n if text is not SUPPRESS and text is not None:\n self._add_item(self._format_text,[text])\n \n def add_usage(self,usage,actions,groups,prefix=None):\n if usage is not SUPPRESS:\n args=usage,actions,groups,prefix\n self._add_item(self._format_usage,args)\n \n def add_argument(self,action):\n if action.help is not SUPPRESS:\n \n \n get_invocation=self._format_action_invocation\n invocations=[get_invocation(action)]\n for subaction in self._iter_indented_subactions(action):\n invocations.append(get_invocation(subaction))\n \n \n invocation_length=max(map(len,invocations))\n action_length=invocation_length+self._current_indent\n self._action_max_length=max(self._action_max_length,\n action_length)\n \n \n self._add_item(self._format_action,[action])\n \n def add_arguments(self,actions):\n for action in actions:\n self.add_argument(action)\n \n \n \n \n def format_help(self):\n help=self._root_section.format_help()\n if help:\n help=self._long_break_matcher.sub('\\n\\n',help)\n help=help.strip('\\n')+'\\n'\n return help\n \n def _join_parts(self,part_strings):\n return ''.join([part\n for part in part_strings\n if part and part is not SUPPRESS])\n \n def _format_usage(self,usage,actions,groups,prefix):\n if prefix is None:\n prefix=_('usage: ')\n \n \n if usage is not None:\n usage=usage %dict(prog=self._prog)\n \n \n elif usage is None and not actions:\n usage='%(prog)s'%dict(prog=self._prog)\n \n \n elif usage is None:\n prog='%(prog)s'%dict(prog=self._prog)\n \n \n optionals=[]\n positionals=[]\n for action in actions:\n if action.option_strings:\n optionals.append(action)\n else:\n positionals.append(action)\n \n \n format=self._format_actions_usage\n action_usage=format(optionals+positionals,groups)\n usage=' '.join([s for s in[prog,action_usage]if s])\n \n \n text_width=self._width -self._current_indent\n if len(prefix)+len(usage)>text_width:\n \n \n part_regexp=(\n r'\\(.*?\\)+(?=\\s|$)|'\n r'\\[.*?\\]+(?=\\s|$)|'\n r'\\S+'\n )\n opt_usage=format(optionals,groups)\n pos_usage=format(positionals,groups)\n opt_parts=_re.findall(part_regexp,opt_usage)\n pos_parts=_re.findall(part_regexp,pos_usage)\n assert ' '.join(opt_parts)==opt_usage\n assert ' '.join(pos_parts)==pos_usage\n \n \n def get_lines(parts,indent,prefix=None):\n lines=[]\n line=[]\n indent_length=len(indent)\n if prefix is not None:\n line_len=len(prefix)-1\n else:\n line_len=indent_length -1\n for part in parts:\n if line_len+1+len(part)>text_width and line:\n lines.append(indent+' '.join(line))\n line=[]\n line_len=indent_length -1\n line.append(part)\n line_len +=len(part)+1\n if line:\n lines.append(indent+' '.join(line))\n if prefix is not None:\n lines[0]=lines[0][indent_length:]\n return lines\n \n \n if len(prefix)+len(prog)<=0.75 *text_width:\n indent=' '*(len(prefix)+len(prog)+1)\n if opt_parts:\n lines=get_lines([prog]+opt_parts,indent,prefix)\n lines.extend(get_lines(pos_parts,indent))\n elif pos_parts:\n lines=get_lines([prog]+pos_parts,indent,prefix)\n else:\n lines=[prog]\n \n \n else:\n indent=' '*len(prefix)\n parts=opt_parts+pos_parts\n lines=get_lines(parts,indent)\n if len(lines)>1:\n lines=[]\n lines.extend(get_lines(opt_parts,indent))\n lines.extend(get_lines(pos_parts,indent))\n lines=[prog]+lines\n \n \n usage='\\n'.join(lines)\n \n \n return '%s%s\\n\\n'%(prefix,usage)\n \n def _format_actions_usage(self,actions,groups):\n \n group_actions=set()\n inserts={}\n for group in groups:\n if not group._group_actions:\n raise ValueError(f'empty group {group}')\n \n try:\n start=actions.index(group._group_actions[0])\n except ValueError:\n continue\n else:\n group_action_count=len(group._group_actions)\n end=start+group_action_count\n if actions[start:end]==group._group_actions:\n \n suppressed_actions_count=0\n for action in group._group_actions:\n group_actions.add(action)\n if action.help is SUPPRESS:\n suppressed_actions_count +=1\n \n exposed_actions_count=group_action_count -suppressed_actions_count\n \n if not group.required:\n if start in inserts:\n inserts[start]+=' ['\n else:\n inserts[start]='['\n if end in inserts:\n inserts[end]+=']'\n else:\n inserts[end]=']'\n elif exposed_actions_count >1:\n if start in inserts:\n inserts[start]+=' ('\n else:\n inserts[start]='('\n if end in inserts:\n inserts[end]+=')'\n else:\n inserts[end]=')'\n for i in range(start+1,end):\n inserts[i]='|'\n \n \n parts=[]\n for i,action in enumerate(actions):\n \n \n \n if action.help is SUPPRESS:\n parts.append(None)\n if inserts.get(i)=='|':\n inserts.pop(i)\n elif inserts.get(i+1)=='|':\n inserts.pop(i+1)\n \n \n elif not action.option_strings:\n default=self._get_default_metavar_for_positional(action)\n part=self._format_args(action,default)\n \n \n if action in group_actions:\n if part[0]=='['and part[-1]==']':\n part=part[1:-1]\n \n \n parts.append(part)\n \n \n else:\n option_string=action.option_strings[0]\n \n \n \n if action.nargs ==0:\n part=action.format_usage()\n \n \n \n else:\n default=self._get_default_metavar_for_optional(action)\n args_string=self._format_args(action,default)\n part='%s %s'%(option_string,args_string)\n \n \n if not action.required and action not in group_actions:\n part='[%s]'%part\n \n \n parts.append(part)\n \n \n for i in sorted(inserts,reverse=True):\n parts[i:i]=[inserts[i]]\n \n \n text=' '.join([item for item in parts if item is not None])\n \n \n open=r'[\\[(]'\n close=r'[\\])]'\n text=_re.sub(r'(%s) '%open,r'\\1',text)\n text=_re.sub(r' (%s)'%close,r'\\1',text)\n text=_re.sub(r'%s *%s'%(open,close),r'',text)\n text=text.strip()\n \n \n return text\n \n def _format_text(self,text):\n if '%(prog)'in text:\n text=text %dict(prog=self._prog)\n text_width=max(self._width -self._current_indent,11)\n indent=' '*self._current_indent\n return self._fill_text(text,text_width,indent)+'\\n\\n'\n \n def _format_action(self,action):\n \n help_position=min(self._action_max_length+2,\n self._max_help_position)\n help_width=max(self._width -help_position,11)\n action_width=help_position -self._current_indent -2\n action_header=self._format_action_invocation(action)\n \n \n if not action.help:\n tup=self._current_indent,'',action_header\n action_header='%*s%s\\n'%tup\n \n \n elif len(action_header)<=action_width:\n tup=self._current_indent,'',action_width,action_header\n action_header='%*s%-*s '%tup\n indent_first=0\n \n \n else:\n tup=self._current_indent,'',action_header\n action_header='%*s%s\\n'%tup\n indent_first=help_position\n \n \n parts=[action_header]\n \n \n if action.help and action.help.strip():\n help_text=self._expand_help(action)\n if help_text:\n help_lines=self._split_lines(help_text,help_width)\n parts.append('%*s%s\\n'%(indent_first,'',help_lines[0]))\n for line in help_lines[1:]:\n parts.append('%*s%s\\n'%(help_position,'',line))\n \n \n elif not action_header.endswith('\\n'):\n parts.append('\\n')\n \n \n for subaction in self._iter_indented_subactions(action):\n parts.append(self._format_action(subaction))\n \n \n return self._join_parts(parts)\n \n def _format_action_invocation(self,action):\n if not action.option_strings:\n default=self._get_default_metavar_for_positional(action)\n metavar,=self._metavar_formatter(action,default)(1)\n return metavar\n \n else:\n parts=[]\n \n \n \n if action.nargs ==0:\n parts.extend(action.option_strings)\n \n \n \n else:\n default=self._get_default_metavar_for_optional(action)\n args_string=self._format_args(action,default)\n for option_string in action.option_strings:\n parts.append('%s %s'%(option_string,args_string))\n \n return ', '.join(parts)\n \n def _metavar_formatter(self,action,default_metavar):\n if action.metavar is not None:\n result=action.metavar\n elif action.choices is not None:\n choice_strs=[str(choice)for choice in action.choices]\n result='{%s}'%','.join(choice_strs)\n else:\n result=default_metavar\n \n def format(tuple_size):\n if isinstance(result,tuple):\n return result\n else:\n return(result,)*tuple_size\n return format\n \n def _format_args(self,action,default_metavar):\n get_metavar=self._metavar_formatter(action,default_metavar)\n if action.nargs is None:\n result='%s'%get_metavar(1)\n elif action.nargs ==OPTIONAL:\n result='[%s]'%get_metavar(1)\n elif action.nargs ==ZERO_OR_MORE:\n metavar=get_metavar(1)\n if len(metavar)==2:\n result='[%s [%s ...]]'%metavar\n else:\n result='[%s ...]'%metavar\n elif action.nargs ==ONE_OR_MORE:\n result='%s [%s ...]'%get_metavar(2)\n elif action.nargs ==REMAINDER:\n result='...'\n elif action.nargs ==PARSER:\n result='%s ...'%get_metavar(1)\n elif action.nargs ==SUPPRESS:\n result=''\n else:\n try:\n formats=['%s'for _ in range(action.nargs)]\n except TypeError:\n raise ValueError(\"invalid nargs value\")from None\n result=' '.join(formats)%get_metavar(action.nargs)\n return result\n \n def _expand_help(self,action):\n params=dict(vars(action),prog=self._prog)\n for name in list(params):\n if params[name]is SUPPRESS:\n del params[name]\n for name in list(params):\n if hasattr(params[name],'__name__'):\n params[name]=params[name].__name__\n if params.get('choices')is not None:\n choices_str=', '.join([str(c)for c in params['choices']])\n params['choices']=choices_str\n return self._get_help_string(action)%params\n \n def _iter_indented_subactions(self,action):\n try:\n get_subactions=action._get_subactions\n except AttributeError:\n pass\n else:\n self._indent()\n yield from get_subactions()\n self._dedent()\n \n def _split_lines(self,text,width):\n text=self._whitespace_matcher.sub(' ',text).strip()\n \n \n import textwrap\n return textwrap.wrap(text,width)\n \n def _fill_text(self,text,width,indent):\n text=self._whitespace_matcher.sub(' ',text).strip()\n import textwrap\n return textwrap.fill(text,width,\n initial_indent=indent,\n subsequent_indent=indent)\n \n def _get_help_string(self,action):\n return action.help\n \n def _get_default_metavar_for_optional(self,action):\n return action.dest.upper()\n \n def _get_default_metavar_for_positional(self,action):\n return action.dest\n \n \nclass RawDescriptionHelpFormatter(HelpFormatter):\n ''\n\n\n\n \n \n def _fill_text(self,text,width,indent):\n return ''.join(indent+line for line in text.splitlines(keepends=True))\n \n \nclass RawTextHelpFormatter(RawDescriptionHelpFormatter):\n ''\n\n\n\n \n \n def _split_lines(self,text,width):\n return text.splitlines()\n \n \nclass ArgumentDefaultsHelpFormatter(HelpFormatter):\n ''\n\n\n\n \n \n def _get_help_string(self,action):\n ''\n\n\n\n\n\n\n \n help=action.help\n if help is None:\n help=''\n \n if '%(default)'not in help:\n if action.default is not SUPPRESS:\n defaulting_nargs=[OPTIONAL,ZERO_OR_MORE]\n if action.option_strings or action.nargs in defaulting_nargs:\n help +=' (default: %(default)s)'\n return help\n \n \n \nclass MetavarTypeHelpFormatter(HelpFormatter):\n ''\n\n\n\n\n \n \n def _get_default_metavar_for_optional(self,action):\n return action.type.__name__\n \n def _get_default_metavar_for_positional(self,action):\n return action.type.__name__\n \n \n \n \n \n \ndef _get_action_name(argument):\n if argument is None:\n return None\n elif argument.option_strings:\n return '/'.join(argument.option_strings)\n elif argument.metavar not in(None,SUPPRESS):\n return argument.metavar\n elif argument.dest not in(None,SUPPRESS):\n return argument.dest\n elif argument.choices:\n return '{'+','.join(argument.choices)+'}'\n else:\n return None\n \n \nclass ArgumentError(Exception):\n ''\n\n\n\n \n \n def __init__(self,argument,message):\n self.argument_name=_get_action_name(argument)\n self.message=message\n \n def __str__(self):\n if self.argument_name is None:\n format='%(message)s'\n else:\n format=_('argument %(argument_name)s: %(message)s')\n return format %dict(message=self.message,\n argument_name=self.argument_name)\n \n \nclass ArgumentTypeError(Exception):\n ''\n pass\n \n \n \n \n \n \nclass Action(_AttributeHolder):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,\n option_strings,\n dest,\n nargs=None,\n const=None,\n default=None,\n type=None,\n choices=None,\n required=False,\n help=None,\n metavar=None):\n self.option_strings=option_strings\n self.dest=dest\n self.nargs=nargs\n self.const=const\n self.default=default\n self.type=type\n self.choices=choices\n self.required=required\n self.help=help\n self.metavar=metavar\n \n def _get_kwargs(self):\n names=[\n 'option_strings',\n 'dest',\n 'nargs',\n 'const',\n 'default',\n 'type',\n 'choices',\n 'required',\n 'help',\n 'metavar',\n ]\n return[(name,getattr(self,name))for name in names]\n \n def format_usage(self):\n return self.option_strings[0]\n \n def __call__(self,parser,namespace,values,option_string=None):\n raise NotImplementedError(_('.__call__() not defined'))\n \n \n \n_deprecated_default=object()\n\nclass BooleanOptionalAction(Action):\n def __init__(self,\n option_strings,\n dest,\n default=None,\n type=_deprecated_default,\n choices=_deprecated_default,\n required=False,\n help=None,\n metavar=_deprecated_default):\n \n _option_strings=[]\n for option_string in option_strings:\n _option_strings.append(option_string)\n \n if option_string.startswith('--'):\n option_string='--no-'+option_string[2:]\n _option_strings.append(option_string)\n \n \n \n \n for field_name in('type','choices','metavar'):\n if locals()[field_name]is not _deprecated_default:\n warnings._deprecated(\n field_name,\n \"{name!r} is deprecated as of Python 3.12 and will be \"\n \"removed in Python {remove}.\",\n remove=(3,14))\n \n if type is _deprecated_default:\n type=None\n if choices is _deprecated_default:\n choices=None\n if metavar is _deprecated_default:\n metavar=None\n \n super().__init__(\n option_strings=_option_strings,\n dest=dest,\n nargs=0,\n default=default,\n type=type,\n choices=choices,\n required=required,\n help=help,\n metavar=metavar)\n \n \n def __call__(self,parser,namespace,values,option_string=None):\n if option_string in self.option_strings:\n setattr(namespace,self.dest,not option_string.startswith('--no-'))\n \n def format_usage(self):\n return ' | '.join(self.option_strings)\n \n \nclass _StoreAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n nargs=None,\n const=None,\n default=None,\n type=None,\n choices=None,\n required=False,\n help=None,\n metavar=None):\n if nargs ==0:\n raise ValueError('nargs for store actions must be != 0; if you '\n 'have nothing to store, actions such as store '\n 'true or store const may be more appropriate')\n if const is not None and nargs !=OPTIONAL:\n raise ValueError('nargs must be %r to supply const'%OPTIONAL)\n super(_StoreAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=nargs,\n const=const,\n default=default,\n type=type,\n choices=choices,\n required=required,\n help=help,\n metavar=metavar)\n \n def __call__(self,parser,namespace,values,option_string=None):\n setattr(namespace,self.dest,values)\n \n \nclass _StoreConstAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n const=None,\n default=None,\n required=False,\n help=None,\n metavar=None):\n super(_StoreConstAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=0,\n const=const,\n default=default,\n required=required,\n help=help)\n \n def __call__(self,parser,namespace,values,option_string=None):\n setattr(namespace,self.dest,self.const)\n \n \nclass _StoreTrueAction(_StoreConstAction):\n\n def __init__(self,\n option_strings,\n dest,\n default=False,\n required=False,\n help=None):\n super(_StoreTrueAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n const=True,\n default=default,\n required=required,\n help=help)\n \n \nclass _StoreFalseAction(_StoreConstAction):\n\n def __init__(self,\n option_strings,\n dest,\n default=True,\n required=False,\n help=None):\n super(_StoreFalseAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n const=False,\n default=default,\n required=required,\n help=help)\n \n \nclass _AppendAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n nargs=None,\n const=None,\n default=None,\n type=None,\n choices=None,\n required=False,\n help=None,\n metavar=None):\n if nargs ==0:\n raise ValueError('nargs for append actions must be != 0; if arg '\n 'strings are not supplying the value to append, '\n 'the append const action may be more appropriate')\n if const is not None and nargs !=OPTIONAL:\n raise ValueError('nargs must be %r to supply const'%OPTIONAL)\n super(_AppendAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=nargs,\n const=const,\n default=default,\n type=type,\n choices=choices,\n required=required,\n help=help,\n metavar=metavar)\n \n def __call__(self,parser,namespace,values,option_string=None):\n items=getattr(namespace,self.dest,None)\n items=_copy_items(items)\n items.append(values)\n setattr(namespace,self.dest,items)\n \n \nclass _AppendConstAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n const=None,\n default=None,\n required=False,\n help=None,\n metavar=None):\n super(_AppendConstAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=0,\n const=const,\n default=default,\n required=required,\n help=help,\n metavar=metavar)\n \n def __call__(self,parser,namespace,values,option_string=None):\n items=getattr(namespace,self.dest,None)\n items=_copy_items(items)\n items.append(self.const)\n setattr(namespace,self.dest,items)\n \n \nclass _CountAction(Action):\n\n def __init__(self,\n option_strings,\n dest,\n default=None,\n required=False,\n help=None):\n super(_CountAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=0,\n default=default,\n required=required,\n help=help)\n \n def __call__(self,parser,namespace,values,option_string=None):\n count=getattr(namespace,self.dest,None)\n if count is None:\n count=0\n setattr(namespace,self.dest,count+1)\n \n \nclass _HelpAction(Action):\n\n def __init__(self,\n option_strings,\n dest=SUPPRESS,\n default=SUPPRESS,\n help=None):\n super(_HelpAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n default=default,\n nargs=0,\n help=help)\n \n def __call__(self,parser,namespace,values,option_string=None):\n parser.print_help()\n parser.exit()\n \n \nclass _VersionAction(Action):\n\n def __init__(self,\n option_strings,\n version=None,\n dest=SUPPRESS,\n default=SUPPRESS,\n help=\"show program's version number and exit\"):\n super(_VersionAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n default=default,\n nargs=0,\n help=help)\n self.version=version\n \n def __call__(self,parser,namespace,values,option_string=None):\n version=self.version\n if version is None:\n version=parser.version\n formatter=parser._get_formatter()\n formatter.add_text(version)\n parser._print_message(formatter.format_help(),_sys.stdout)\n parser.exit()\n \n \nclass _SubParsersAction(Action):\n\n class _ChoicesPseudoAction(Action):\n \n def __init__(self,name,aliases,help):\n metavar=dest=name\n if aliases:\n metavar +=' (%s)'%', '.join(aliases)\n sup=super(_SubParsersAction._ChoicesPseudoAction,self)\n sup.__init__(option_strings=[],dest=dest,help=help,\n metavar=metavar)\n \n def __init__(self,\n option_strings,\n prog,\n parser_class,\n dest=SUPPRESS,\n required=False,\n help=None,\n metavar=None):\n \n self._prog_prefix=prog\n self._parser_class=parser_class\n self._name_parser_map={}\n self._choices_actions=[]\n \n super(_SubParsersAction,self).__init__(\n option_strings=option_strings,\n dest=dest,\n nargs=PARSER,\n choices=self._name_parser_map,\n required=required,\n help=help,\n metavar=metavar)\n \n def add_parser(self,name,**kwargs):\n \n if kwargs.get('prog')is None:\n kwargs['prog']='%s %s'%(self._prog_prefix,name)\n \n aliases=kwargs.pop('aliases',())\n \n if name in self._name_parser_map:\n raise ArgumentError(self,_('conflicting subparser: %s')%name)\n for alias in aliases:\n if alias in self._name_parser_map:\n raise ArgumentError(\n self,_('conflicting subparser alias: %s')%alias)\n \n \n if 'help'in kwargs:\n help=kwargs.pop('help')\n choice_action=self._ChoicesPseudoAction(name,aliases,help)\n self._choices_actions.append(choice_action)\n \n \n parser=self._parser_class(**kwargs)\n self._name_parser_map[name]=parser\n \n \n for alias in aliases:\n self._name_parser_map[alias]=parser\n \n return parser\n \n def _get_subactions(self):\n return self._choices_actions\n \n def __call__(self,parser,namespace,values,option_string=None):\n parser_name=values[0]\n arg_strings=values[1:]\n \n \n if self.dest is not SUPPRESS:\n setattr(namespace,self.dest,parser_name)\n \n \n try:\n parser=self._name_parser_map[parser_name]\n except KeyError:\n args={'parser_name':parser_name,\n 'choices':', '.join(self._name_parser_map)}\n msg=_('unknown parser %(parser_name)r (choices: %(choices)s)')%args\n raise ArgumentError(self,msg)\n \n \n \n \n \n \n \n \n subnamespace,arg_strings=parser.parse_known_args(arg_strings,None)\n for key,value in vars(subnamespace).items():\n setattr(namespace,key,value)\n \n if arg_strings:\n vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR,[])\n getattr(namespace,_UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)\n \nclass _ExtendAction(_AppendAction):\n def __call__(self,parser,namespace,values,option_string=None):\n items=getattr(namespace,self.dest,None)\n items=_copy_items(items)\n items.extend(values)\n setattr(namespace,self.dest,items)\n \n \n \n \n \nclass FileType(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,mode='r',bufsize=-1,encoding=None,errors=None):\n self._mode=mode\n self._bufsize=bufsize\n self._encoding=encoding\n self._errors=errors\n \n def __call__(self,string):\n \n if string =='-':\n if 'r'in self._mode:\n return _sys.stdin.buffer if 'b'in self._mode else _sys.stdin\n elif any(c in self._mode for c in 'wax'):\n return _sys.stdout.buffer if 'b'in self._mode else _sys.stdout\n else:\n msg=_('argument \"-\" with mode %r')%self._mode\n raise ValueError(msg)\n \n \n try:\n return open(string,self._mode,self._bufsize,self._encoding,\n self._errors)\n except OSError as e:\n args={'filename':string,'error':e}\n message=_(\"can't open '%(filename)s': %(error)s\")\n raise ArgumentTypeError(message %args)\n \n def __repr__(self):\n args=self._mode,self._bufsize\n kwargs=[('encoding',self._encoding),('errors',self._errors)]\n args_str=', '.join([repr(arg)for arg in args if arg !=-1]+\n ['%s=%r'%(kw,arg)for kw,arg in kwargs\n if arg is not None])\n return '%s(%s)'%(type(self).__name__,args_str)\n \n \n \n \n \nclass Namespace(_AttributeHolder):\n ''\n\n\n\n \n \n def __init__(self,**kwargs):\n for name in kwargs:\n setattr(self,name,kwargs[name])\n \n def __eq__(self,other):\n if not isinstance(other,Namespace):\n return NotImplemented\n return vars(self)==vars(other)\n \n def __contains__(self,key):\n return key in self.__dict__\n \n \nclass _ActionsContainer(object):\n\n def __init__(self,\n description,\n prefix_chars,\n argument_default,\n conflict_handler):\n super(_ActionsContainer,self).__init__()\n \n self.description=description\n self.argument_default=argument_default\n self.prefix_chars=prefix_chars\n self.conflict_handler=conflict_handler\n \n \n self._registries={}\n \n \n self.register('action',None,_StoreAction)\n self.register('action','store',_StoreAction)\n self.register('action','store_const',_StoreConstAction)\n self.register('action','store_true',_StoreTrueAction)\n self.register('action','store_false',_StoreFalseAction)\n self.register('action','append',_AppendAction)\n self.register('action','append_const',_AppendConstAction)\n self.register('action','count',_CountAction)\n self.register('action','help',_HelpAction)\n self.register('action','version',_VersionAction)\n self.register('action','parsers',_SubParsersAction)\n self.register('action','extend',_ExtendAction)\n \n \n self._get_handler()\n \n \n self._actions=[]\n self._option_string_actions={}\n \n \n self._action_groups=[]\n self._mutually_exclusive_groups=[]\n \n \n self._defaults={}\n \n \n self._negative_number_matcher=_re.compile(r'^-\\d+$|^-\\d*\\.\\d+$')\n \n \n \n self._has_negative_number_optionals=[]\n \n \n \n \n def register(self,registry_name,value,object):\n registry=self._registries.setdefault(registry_name,{})\n registry[value]=object\n \n def _registry_get(self,registry_name,value,default=None):\n return self._registries[registry_name].get(value,default)\n \n \n \n \n def set_defaults(self,**kwargs):\n self._defaults.update(kwargs)\n \n \n \n for action in self._actions:\n if action.dest in kwargs:\n action.default=kwargs[action.dest]\n \n def get_default(self,dest):\n for action in self._actions:\n if action.dest ==dest and action.default is not None:\n return action.default\n return self._defaults.get(dest,None)\n \n \n \n \n \n def add_argument(self,*args,**kwargs):\n ''\n\n\n \n \n \n \n \n chars=self.prefix_chars\n if not args or len(args)==1 and args[0][0]not in chars:\n if args and 'dest'in kwargs:\n raise ValueError('dest supplied twice for positional argument')\n kwargs=self._get_positional_kwargs(*args,**kwargs)\n \n \n else:\n kwargs=self._get_optional_kwargs(*args,**kwargs)\n \n \n if 'default'not in kwargs:\n dest=kwargs['dest']\n if dest in self._defaults:\n kwargs['default']=self._defaults[dest]\n elif self.argument_default is not None:\n kwargs['default']=self.argument_default\n \n \n action_class=self._pop_action_class(kwargs)\n if not callable(action_class):\n raise ValueError('unknown action \"%s\"'%(action_class,))\n action=action_class(**kwargs)\n \n \n type_func=self._registry_get('type',action.type,action.type)\n if not callable(type_func):\n raise ValueError('%r is not callable'%(type_func,))\n \n if type_func is FileType:\n raise ValueError('%r is a FileType class object, instance of it'\n ' must be passed'%(type_func,))\n \n \n if hasattr(self,\"_get_formatter\"):\n try:\n self._get_formatter()._format_args(action,None)\n except TypeError:\n raise ValueError(\"length of metavar tuple does not match nargs\")\n \n return self._add_action(action)\n \n def add_argument_group(self,*args,**kwargs):\n group=_ArgumentGroup(self,*args,**kwargs)\n self._action_groups.append(group)\n return group\n \n def add_mutually_exclusive_group(self,**kwargs):\n group=_MutuallyExclusiveGroup(self,**kwargs)\n self._mutually_exclusive_groups.append(group)\n return group\n \n def _add_action(self,action):\n \n self._check_conflict(action)\n \n \n self._actions.append(action)\n action.container=self\n \n \n for option_string in action.option_strings:\n self._option_string_actions[option_string]=action\n \n \n for option_string in action.option_strings:\n if self._negative_number_matcher.match(option_string):\n if not self._has_negative_number_optionals:\n self._has_negative_number_optionals.append(True)\n \n \n return action\n \n def _remove_action(self,action):\n self._actions.remove(action)\n \n def _add_container_actions(self,container):\n \n title_group_map={}\n for group in self._action_groups:\n if group.title in title_group_map:\n msg=_('cannot merge actions - two groups are named %r')\n raise ValueError(msg %(group.title))\n title_group_map[group.title]=group\n \n \n group_map={}\n for group in container._action_groups:\n \n \n \n if group.title not in title_group_map:\n title_group_map[group.title]=self.add_argument_group(\n title=group.title,\n description=group.description,\n conflict_handler=group.conflict_handler)\n \n \n for action in group._group_actions:\n group_map[action]=title_group_map[group.title]\n \n \n \n \n for group in container._mutually_exclusive_groups:\n mutex_group=self.add_mutually_exclusive_group(\n required=group.required)\n \n \n for action in group._group_actions:\n group_map[action]=mutex_group\n \n \n for action in container._actions:\n group_map.get(action,self)._add_action(action)\n \n def _get_positional_kwargs(self,dest,**kwargs):\n \n if 'required'in kwargs:\n msg=_(\"'required' is an invalid argument for positionals\")\n raise TypeError(msg)\n \n \n \n if kwargs.get('nargs')not in[OPTIONAL,ZERO_OR_MORE]:\n kwargs['required']=True\n if kwargs.get('nargs')==ZERO_OR_MORE and 'default'not in kwargs:\n kwargs['required']=True\n \n \n return dict(kwargs,dest=dest,option_strings=[])\n \n def _get_optional_kwargs(self,*args,**kwargs):\n \n option_strings=[]\n long_option_strings=[]\n for option_string in args:\n \n if not option_string[0]in self.prefix_chars:\n args={'option':option_string,\n 'prefix_chars':self.prefix_chars}\n msg=_('invalid option string %(option)r: '\n 'must start with a character %(prefix_chars)r')\n raise ValueError(msg %args)\n \n \n option_strings.append(option_string)\n if len(option_string)>1 and option_string[1]in self.prefix_chars:\n long_option_strings.append(option_string)\n \n \n dest=kwargs.pop('dest',None)\n if dest is None:\n if long_option_strings:\n dest_option_string=long_option_strings[0]\n else:\n dest_option_string=option_strings[0]\n dest=dest_option_string.lstrip(self.prefix_chars)\n if not dest:\n msg=_('dest= is required for options like %r')\n raise ValueError(msg %option_string)\n dest=dest.replace('-','_')\n \n \n return dict(kwargs,dest=dest,option_strings=option_strings)\n \n def _pop_action_class(self,kwargs,default=None):\n action=kwargs.pop('action',default)\n return self._registry_get('action',action,action)\n \n def _get_handler(self):\n \n handler_func_name='_handle_conflict_%s'%self.conflict_handler\n try:\n return getattr(self,handler_func_name)\n except AttributeError:\n msg=_('invalid conflict_resolution value: %r')\n raise ValueError(msg %self.conflict_handler)\n \n def _check_conflict(self,action):\n \n \n confl_optionals=[]\n for option_string in action.option_strings:\n if option_string in self._option_string_actions:\n confl_optional=self._option_string_actions[option_string]\n confl_optionals.append((option_string,confl_optional))\n \n \n if confl_optionals:\n conflict_handler=self._get_handler()\n conflict_handler(action,confl_optionals)\n \n def _handle_conflict_error(self,action,conflicting_actions):\n message=ngettext('conflicting option string: %s',\n 'conflicting option strings: %s',\n len(conflicting_actions))\n conflict_string=', '.join([option_string\n for option_string,action\n in conflicting_actions])\n raise ArgumentError(action,message %conflict_string)\n \n def _handle_conflict_resolve(self,action,conflicting_actions):\n \n \n for option_string,action in conflicting_actions:\n \n \n action.option_strings.remove(option_string)\n self._option_string_actions.pop(option_string,None)\n \n \n \n if not action.option_strings:\n action.container._remove_action(action)\n \n \nclass _ArgumentGroup(_ActionsContainer):\n\n def __init__(self,container,title=None,description=None,**kwargs):\n \n update=kwargs.setdefault\n update('conflict_handler',container.conflict_handler)\n update('prefix_chars',container.prefix_chars)\n update('argument_default',container.argument_default)\n super_init=super(_ArgumentGroup,self).__init__\n super_init(description=description,**kwargs)\n \n \n self.title=title\n self._group_actions=[]\n \n \n self._registries=container._registries\n self._actions=container._actions\n self._option_string_actions=container._option_string_actions\n self._defaults=container._defaults\n self._has_negative_number_optionals=\\\n container._has_negative_number_optionals\n self._mutually_exclusive_groups=container._mutually_exclusive_groups\n \n def _add_action(self,action):\n action=super(_ArgumentGroup,self)._add_action(action)\n self._group_actions.append(action)\n return action\n \n def _remove_action(self,action):\n super(_ArgumentGroup,self)._remove_action(action)\n self._group_actions.remove(action)\n \n def add_argument_group(self,*args,**kwargs):\n warnings.warn(\n \"Nesting argument groups is deprecated.\",\n category=DeprecationWarning,\n stacklevel=2\n )\n return super().add_argument_group(*args,**kwargs)\n \n \nclass _MutuallyExclusiveGroup(_ArgumentGroup):\n\n def __init__(self,container,required=False):\n super(_MutuallyExclusiveGroup,self).__init__(container)\n self.required=required\n self._container=container\n \n def _add_action(self,action):\n if action.required:\n msg=_('mutually exclusive arguments must be optional')\n raise ValueError(msg)\n action=self._container._add_action(action)\n self._group_actions.append(action)\n return action\n \n def _remove_action(self,action):\n self._container._remove_action(action)\n self._group_actions.remove(action)\n \n def add_mutually_exclusive_group(self,*args,**kwargs):\n warnings.warn(\n \"Nesting mutually exclusive groups is deprecated.\",\n category=DeprecationWarning,\n stacklevel=2\n )\n return super().add_mutually_exclusive_group(*args,**kwargs)\n \n \nclass ArgumentParser(_AttributeHolder,_ActionsContainer):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,\n prog=None,\n usage=None,\n description=None,\n epilog=None,\n parents=[],\n formatter_class=HelpFormatter,\n prefix_chars='-',\n fromfile_prefix_chars=None,\n argument_default=None,\n conflict_handler='error',\n add_help=True,\n allow_abbrev=True,\n exit_on_error=True):\n \n superinit=super(ArgumentParser,self).__init__\n superinit(description=description,\n prefix_chars=prefix_chars,\n argument_default=argument_default,\n conflict_handler=conflict_handler)\n \n \n if prog is None:\n prog=_os.path.basename(_sys.argv[0])\n \n self.prog=prog\n self.usage=usage\n self.epilog=epilog\n self.formatter_class=formatter_class\n self.fromfile_prefix_chars=fromfile_prefix_chars\n self.add_help=add_help\n self.allow_abbrev=allow_abbrev\n self.exit_on_error=exit_on_error\n \n add_group=self.add_argument_group\n self._positionals=add_group(_('positional arguments'))\n self._optionals=add_group(_('options'))\n self._subparsers=None\n \n \n def identity(string):\n return string\n self.register('type',None,identity)\n \n \n \n default_prefix='-'if '-'in prefix_chars else prefix_chars[0]\n if self.add_help:\n self.add_argument(\n default_prefix+'h',default_prefix *2+'help',\n action='help',default=SUPPRESS,\n help=_('show this help message and exit'))\n \n \n for parent in parents:\n self._add_container_actions(parent)\n try:\n defaults=parent._defaults\n except AttributeError:\n pass\n else:\n self._defaults.update(defaults)\n \n \n \n \n def _get_kwargs(self):\n names=[\n 'prog',\n 'usage',\n 'description',\n 'formatter_class',\n 'conflict_handler',\n 'add_help',\n ]\n return[(name,getattr(self,name))for name in names]\n \n \n \n \n def add_subparsers(self,**kwargs):\n if self._subparsers is not None:\n self.error(_('cannot have multiple subparser arguments'))\n \n \n kwargs.setdefault('parser_class',type(self))\n \n if 'title'in kwargs or 'description'in kwargs:\n title=_(kwargs.pop('title','subcommands'))\n description=_(kwargs.pop('description',None))\n self._subparsers=self.add_argument_group(title,description)\n else:\n self._subparsers=self._positionals\n \n \n \n if kwargs.get('prog')is None:\n formatter=self._get_formatter()\n positionals=self._get_positional_actions()\n groups=self._mutually_exclusive_groups\n formatter.add_usage(self.usage,positionals,groups,'')\n kwargs['prog']=formatter.format_help().strip()\n \n \n parsers_class=self._pop_action_class(kwargs,'parsers')\n action=parsers_class(option_strings=[],**kwargs)\n self._subparsers._add_action(action)\n \n \n return action\n \n def _add_action(self,action):\n if action.option_strings:\n self._optionals._add_action(action)\n else:\n self._positionals._add_action(action)\n return action\n \n def _get_optional_actions(self):\n return[action\n for action in self._actions\n if action.option_strings]\n \n def _get_positional_actions(self):\n return[action\n for action in self._actions\n if not action.option_strings]\n \n \n \n \n def parse_args(self,args=None,namespace=None):\n args,argv=self.parse_known_args(args,namespace)\n if argv:\n msg=_('unrecognized arguments: %s')\n self.error(msg %' '.join(argv))\n return args\n \n def parse_known_args(self,args=None,namespace=None):\n if args is None:\n \n args=_sys.argv[1:]\n else:\n \n args=list(args)\n \n \n if namespace is None:\n namespace=Namespace()\n \n \n for action in self._actions:\n if action.dest is not SUPPRESS:\n if not hasattr(namespace,action.dest):\n if action.default is not SUPPRESS:\n setattr(namespace,action.dest,action.default)\n \n \n for dest in self._defaults:\n if not hasattr(namespace,dest):\n setattr(namespace,dest,self._defaults[dest])\n \n \n if self.exit_on_error:\n try:\n namespace,args=self._parse_known_args(args,namespace)\n except ArgumentError as err:\n self.error(str(err))\n else:\n namespace,args=self._parse_known_args(args,namespace)\n \n if hasattr(namespace,_UNRECOGNIZED_ARGS_ATTR):\n args.extend(getattr(namespace,_UNRECOGNIZED_ARGS_ATTR))\n delattr(namespace,_UNRECOGNIZED_ARGS_ATTR)\n return namespace,args\n \n def _parse_known_args(self,arg_strings,namespace):\n \n if self.fromfile_prefix_chars is not None:\n arg_strings=self._read_args_from_files(arg_strings)\n \n \n \n action_conflicts={}\n for mutex_group in self._mutually_exclusive_groups:\n group_actions=mutex_group._group_actions\n for i,mutex_action in enumerate(mutex_group._group_actions):\n conflicts=action_conflicts.setdefault(mutex_action,[])\n conflicts.extend(group_actions[:i])\n conflicts.extend(group_actions[i+1:])\n \n \n \n \n option_string_indices={}\n arg_string_pattern_parts=[]\n arg_strings_iter=iter(arg_strings)\n for i,arg_string in enumerate(arg_strings_iter):\n \n \n if arg_string =='--':\n arg_string_pattern_parts.append('-')\n for arg_string in arg_strings_iter:\n arg_string_pattern_parts.append('A')\n \n \n \n else:\n option_tuple=self._parse_optional(arg_string)\n if option_tuple is None:\n pattern='A'\n else:\n option_string_indices[i]=option_tuple\n pattern='O'\n arg_string_pattern_parts.append(pattern)\n \n \n arg_strings_pattern=''.join(arg_string_pattern_parts)\n \n \n seen_actions=set()\n seen_non_default_actions=set()\n \n def take_action(action,argument_strings,option_string=None):\n seen_actions.add(action)\n argument_values=self._get_values(action,argument_strings)\n \n \n \n \n if argument_values is not action.default:\n seen_non_default_actions.add(action)\n for conflict_action in action_conflicts.get(action,[]):\n if conflict_action in seen_non_default_actions:\n msg=_('not allowed with argument %s')\n action_name=_get_action_name(conflict_action)\n raise ArgumentError(action,msg %action_name)\n \n \n \n if argument_values is not SUPPRESS:\n action(self,namespace,argument_values,option_string)\n \n \n def consume_optional(start_index):\n \n \n option_tuple=option_string_indices[start_index]\n action,option_string,explicit_arg=option_tuple\n \n \n \n match_argument=self._match_argument\n action_tuples=[]\n while True:\n \n \n if action is None:\n extras.append(arg_strings[start_index])\n return start_index+1\n \n \n \n if explicit_arg is not None:\n arg_count=match_argument(action,'A')\n \n \n \n \n chars=self.prefix_chars\n if(\n arg_count ==0\n and option_string[1]not in chars\n and explicit_arg !=''\n ):\n action_tuples.append((action,[],option_string))\n char=option_string[0]\n option_string=char+explicit_arg[0]\n new_explicit_arg=explicit_arg[1:]or None\n optionals_map=self._option_string_actions\n if option_string in optionals_map:\n action=optionals_map[option_string]\n explicit_arg=new_explicit_arg\n else:\n msg=_('ignored explicit argument %r')\n raise ArgumentError(action,msg %explicit_arg)\n \n \n \n elif arg_count ==1:\n stop=start_index+1\n args=[explicit_arg]\n action_tuples.append((action,args,option_string))\n break\n \n \n \n else:\n msg=_('ignored explicit argument %r')\n raise ArgumentError(action,msg %explicit_arg)\n \n \n \n \n else:\n start=start_index+1\n selected_patterns=arg_strings_pattern[start:]\n arg_count=match_argument(action,selected_patterns)\n stop=start+arg_count\n args=arg_strings[start:stop]\n action_tuples.append((action,args,option_string))\n break\n \n \n \n assert action_tuples\n for action,args,option_string in action_tuples:\n take_action(action,args,option_string)\n return stop\n \n \n \n positionals=self._get_positional_actions()\n \n \n def consume_positionals(start_index):\n \n match_partial=self._match_arguments_partial\n selected_pattern=arg_strings_pattern[start_index:]\n arg_counts=match_partial(positionals,selected_pattern)\n \n \n \n for action,arg_count in zip(positionals,arg_counts):\n args=arg_strings[start_index:start_index+arg_count]\n start_index +=arg_count\n take_action(action,args)\n \n \n \n positionals[:]=positionals[len(arg_counts):]\n return start_index\n \n \n \n extras=[]\n start_index=0\n if option_string_indices:\n max_option_string_index=max(option_string_indices)\n else:\n max_option_string_index=-1\n while start_index <=max_option_string_index:\n \n \n next_option_string_index=min([\n index\n for index in option_string_indices\n if index >=start_index])\n if start_index !=next_option_string_index:\n positionals_end_index=consume_positionals(start_index)\n \n \n \n if positionals_end_index >start_index:\n start_index=positionals_end_index\n continue\n else:\n start_index=positionals_end_index\n \n \n \n if start_index not in option_string_indices:\n strings=arg_strings[start_index:next_option_string_index]\n extras.extend(strings)\n start_index=next_option_string_index\n \n \n start_index=consume_optional(start_index)\n \n \n stop_index=consume_positionals(start_index)\n \n \n extras.extend(arg_strings[stop_index:])\n \n \n \n required_actions=[]\n for action in self._actions:\n if action not in seen_actions:\n if action.required:\n required_actions.append(_get_action_name(action))\n else:\n \n \n \n \n if(action.default is not None and\n isinstance(action.default,str)and\n hasattr(namespace,action.dest)and\n action.default is getattr(namespace,action.dest)):\n setattr(namespace,action.dest,\n self._get_value(action,action.default))\n \n if required_actions:\n self.error(_('the following arguments are required: %s')%\n ', '.join(required_actions))\n \n \n for group in self._mutually_exclusive_groups:\n if group.required:\n for action in group._group_actions:\n if action in seen_non_default_actions:\n break\n \n \n else:\n names=[_get_action_name(action)\n for action in group._group_actions\n if action.help is not SUPPRESS]\n msg=_('one of the arguments %s is required')\n self.error(msg %' '.join(names))\n \n \n return namespace,extras\n \n def _read_args_from_files(self,arg_strings):\n \n new_arg_strings=[]\n for arg_string in arg_strings:\n \n \n if not arg_string or arg_string[0]not in self.fromfile_prefix_chars:\n new_arg_strings.append(arg_string)\n \n \n else:\n try:\n with open(arg_string[1:],\n encoding=_sys.getfilesystemencoding(),\n errors=_sys.getfilesystemencodeerrors())as args_file:\n arg_strings=[]\n for arg_line in args_file.read().splitlines():\n for arg in self.convert_arg_line_to_args(arg_line):\n arg_strings.append(arg)\n arg_strings=self._read_args_from_files(arg_strings)\n new_arg_strings.extend(arg_strings)\n except OSError as err:\n self.error(str(err))\n \n \n return new_arg_strings\n \n def convert_arg_line_to_args(self,arg_line):\n return[arg_line]\n \n def _match_argument(self,action,arg_strings_pattern):\n \n nargs_pattern=self._get_nargs_pattern(action)\n match=_re.match(nargs_pattern,arg_strings_pattern)\n \n \n if match is None:\n nargs_errors={\n None:_('expected one argument'),\n OPTIONAL:_('expected at most one argument'),\n ONE_OR_MORE:_('expected at least one argument'),\n }\n msg=nargs_errors.get(action.nargs)\n if msg is None:\n msg=ngettext('expected %s argument',\n 'expected %s arguments',\n action.nargs)%action.nargs\n raise ArgumentError(action,msg)\n \n \n return len(match.group(1))\n \n def _match_arguments_partial(self,actions,arg_strings_pattern):\n \n \n result=[]\n for i in range(len(actions),0,-1):\n actions_slice=actions[:i]\n pattern=''.join([self._get_nargs_pattern(action)\n for action in actions_slice])\n match=_re.match(pattern,arg_strings_pattern)\n if match is not None:\n result.extend([len(string)for string in match.groups()])\n break\n \n \n return result\n \n def _parse_optional(self,arg_string):\n \n if not arg_string:\n return None\n \n \n if not arg_string[0]in self.prefix_chars:\n return None\n \n \n if arg_string in self._option_string_actions:\n action=self._option_string_actions[arg_string]\n return action,arg_string,None\n \n \n if len(arg_string)==1:\n return None\n \n \n if '='in arg_string:\n option_string,explicit_arg=arg_string.split('=',1)\n if option_string in self._option_string_actions:\n action=self._option_string_actions[option_string]\n return action,option_string,explicit_arg\n \n \n \n option_tuples=self._get_option_tuples(arg_string)\n \n \n if len(option_tuples)>1:\n options=', '.join([option_string\n for action,option_string,explicit_arg in option_tuples])\n args={'option':arg_string,'matches':options}\n msg=_('ambiguous option: %(option)s could match %(matches)s')\n self.error(msg %args)\n \n \n \n elif len(option_tuples)==1:\n option_tuple,=option_tuples\n return option_tuple\n \n \n \n \n if self._negative_number_matcher.match(arg_string):\n if not self._has_negative_number_optionals:\n return None\n \n \n if ' 'in arg_string:\n return None\n \n \n \n return None,arg_string,None\n \n def _get_option_tuples(self,option_string):\n result=[]\n \n \n \n chars=self.prefix_chars\n if option_string[0]in chars and option_string[1]in chars:\n if self.allow_abbrev:\n if '='in option_string:\n option_prefix,explicit_arg=option_string.split('=',1)\n else:\n option_prefix=option_string\n explicit_arg=None\n for option_string in self._option_string_actions:\n if option_string.startswith(option_prefix):\n action=self._option_string_actions[option_string]\n tup=action,option_string,explicit_arg\n result.append(tup)\n \n \n \n \n elif option_string[0]in chars and option_string[1]not in chars:\n option_prefix=option_string\n explicit_arg=None\n short_option_prefix=option_string[:2]\n short_explicit_arg=option_string[2:]\n \n for option_string in self._option_string_actions:\n if option_string ==short_option_prefix:\n action=self._option_string_actions[option_string]\n tup=action,option_string,short_explicit_arg\n result.append(tup)\n elif option_string.startswith(option_prefix):\n action=self._option_string_actions[option_string]\n tup=action,option_string,explicit_arg\n result.append(tup)\n \n \n else:\n self.error(_('unexpected option string: %s')%option_string)\n \n \n return result\n \n def _get_nargs_pattern(self,action):\n \n \n nargs=action.nargs\n \n \n if nargs is None:\n nargs_pattern='(-*A-*)'\n \n \n elif nargs ==OPTIONAL:\n nargs_pattern='(-*A?-*)'\n \n \n elif nargs ==ZERO_OR_MORE:\n nargs_pattern='(-*[A-]*)'\n \n \n elif nargs ==ONE_OR_MORE:\n nargs_pattern='(-*A[A-]*)'\n \n \n elif nargs ==REMAINDER:\n nargs_pattern='([-AO]*)'\n \n \n elif nargs ==PARSER:\n nargs_pattern='(-*A[-AO]*)'\n \n \n elif nargs ==SUPPRESS:\n nargs_pattern='(-*-*)'\n \n \n else:\n nargs_pattern='(-*%s-*)'%'-*'.join('A'*nargs)\n \n \n if action.option_strings:\n nargs_pattern=nargs_pattern.replace('-*','')\n nargs_pattern=nargs_pattern.replace('-','')\n \n \n return nargs_pattern\n \n \n \n \n \n def parse_intermixed_args(self,args=None,namespace=None):\n args,argv=self.parse_known_intermixed_args(args,namespace)\n if argv:\n msg=_('unrecognized arguments: %s')\n self.error(msg %' '.join(argv))\n return args\n \n def parse_known_intermixed_args(self,args=None,namespace=None):\n \n \n \n \n \n \n \n \n \n \n \n \n positionals=self._get_positional_actions()\n a=[action for action in positionals\n if action.nargs in[PARSER,REMAINDER]]\n if a:\n raise TypeError('parse_intermixed_args: positional arg'\n ' with nargs=%s'%a[0].nargs)\n \n if[action.dest for group in self._mutually_exclusive_groups\n for action in group._group_actions if action in positionals]:\n raise TypeError('parse_intermixed_args: positional in'\n ' mutuallyExclusiveGroup')\n \n try:\n save_usage=self.usage\n try:\n if self.usage is None:\n \n self.usage=self.format_usage()[7:]\n for action in positionals:\n \n action.save_nargs=action.nargs\n \n action.nargs=SUPPRESS\n action.save_default=action.default\n action.default=SUPPRESS\n namespace,remaining_args=self.parse_known_args(args,\n namespace)\n for action in positionals:\n \n if(hasattr(namespace,action.dest)\n and getattr(namespace,action.dest)==[]):\n from warnings import warn\n warn('Do not expect %s in %s'%(action.dest,namespace))\n delattr(namespace,action.dest)\n finally:\n \n for action in positionals:\n action.nargs=action.save_nargs\n action.default=action.save_default\n optionals=self._get_optional_actions()\n try:\n \n \n for action in optionals:\n action.save_required=action.required\n action.required=False\n for group in self._mutually_exclusive_groups:\n group.save_required=group.required\n group.required=False\n namespace,extras=self.parse_known_args(remaining_args,\n namespace)\n finally:\n \n for action in optionals:\n action.required=action.save_required\n for group in self._mutually_exclusive_groups:\n group.required=group.save_required\n finally:\n self.usage=save_usage\n return namespace,extras\n \n \n \n \n def _get_values(self,action,arg_strings):\n \n if action.nargs not in[PARSER,REMAINDER]:\n try:\n arg_strings.remove('--')\n except ValueError:\n pass\n \n \n if not arg_strings and action.nargs ==OPTIONAL:\n if action.option_strings:\n value=action.const\n else:\n value=action.default\n if isinstance(value,str):\n value=self._get_value(action,value)\n self._check_value(action,value)\n \n \n \n elif(not arg_strings and action.nargs ==ZERO_OR_MORE and\n not action.option_strings):\n if action.default is not None:\n value=action.default\n self._check_value(action,value)\n else:\n \n \n value=arg_strings\n \n \n elif len(arg_strings)==1 and action.nargs in[None,OPTIONAL]:\n arg_string,=arg_strings\n value=self._get_value(action,arg_string)\n self._check_value(action,value)\n \n \n elif action.nargs ==REMAINDER:\n value=[self._get_value(action,v)for v in arg_strings]\n \n \n elif action.nargs ==PARSER:\n value=[self._get_value(action,v)for v in arg_strings]\n self._check_value(action,value[0])\n \n \n elif action.nargs ==SUPPRESS:\n value=SUPPRESS\n \n \n else:\n value=[self._get_value(action,v)for v in arg_strings]\n for v in value:\n self._check_value(action,v)\n \n \n return value\n \n def _get_value(self,action,arg_string):\n type_func=self._registry_get('type',action.type,action.type)\n if not callable(type_func):\n msg=_('%r is not callable')\n raise ArgumentError(action,msg %type_func)\n \n \n try:\n result=type_func(arg_string)\n \n \n except ArgumentTypeError as err:\n msg=str(err)\n raise ArgumentError(action,msg)\n \n \n except(TypeError,ValueError):\n name=getattr(action.type,'__name__',repr(action.type))\n args={'type':name,'value':arg_string}\n msg=_('invalid %(type)s value: %(value)r')\n raise ArgumentError(action,msg %args)\n \n \n return result\n \n def _check_value(self,action,value):\n \n if action.choices is not None and value not in action.choices:\n args={'value':value,\n 'choices':', '.join(map(repr,action.choices))}\n msg=_('invalid choice: %(value)r (choose from %(choices)s)')\n raise ArgumentError(action,msg %args)\n \n \n \n \n def format_usage(self):\n formatter=self._get_formatter()\n formatter.add_usage(self.usage,self._actions,\n self._mutually_exclusive_groups)\n return formatter.format_help()\n \n def format_help(self):\n formatter=self._get_formatter()\n \n \n formatter.add_usage(self.usage,self._actions,\n self._mutually_exclusive_groups)\n \n \n formatter.add_text(self.description)\n \n \n for action_group in self._action_groups:\n formatter.start_section(action_group.title)\n formatter.add_text(action_group.description)\n formatter.add_arguments(action_group._group_actions)\n formatter.end_section()\n \n \n formatter.add_text(self.epilog)\n \n \n return formatter.format_help()\n \n def _get_formatter(self):\n return self.formatter_class(prog=self.prog)\n \n \n \n \n def print_usage(self,file=None):\n if file is None:\n file=_sys.stdout\n self._print_message(self.format_usage(),file)\n \n def print_help(self,file=None):\n if file is None:\n file=_sys.stdout\n self._print_message(self.format_help(),file)\n \n def _print_message(self,message,file=None):\n if message:\n file=file or _sys.stderr\n try:\n file.write(message)\n except(AttributeError,OSError):\n pass\n \n \n \n \n def exit(self,status=0,message=None):\n if message:\n self._print_message(message,_sys.stderr)\n _sys.exit(status)\n \n def error(self,message):\n ''\n\n\n\n\n\n\n \n self.print_usage(_sys.stderr)\n args={'prog':self.prog,'message':message}\n self.exit(2,_('%(prog)s: error: %(message)s\\n')%args)\n", ["copy", "gettext", "os", "re", "shutil", "sys", "textwrap", "warnings"]], "ast": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport sys\nimport re\nfrom _ast import *\nfrom contextlib import contextmanager,nullcontext\nfrom enum import IntEnum,auto,_simple_enum\n\n\ndef parse(source,filename='',mode='exec',*,\ntype_comments=False,feature_version=None):\n ''\n\n\n\n \n flags=PyCF_ONLY_AST\n if type_comments:\n flags |=PyCF_TYPE_COMMENTS\n if feature_version is None:\n feature_version=-1\n elif isinstance(feature_version,tuple):\n major,minor=feature_version\n if major !=3:\n raise ValueError(f\"Unsupported major version: {major}\")\n feature_version=minor\n \n return compile(source,filename,mode,flags,\n _feature_version=feature_version)\n \n \ndef literal_eval(node_or_string):\n ''\n\n\n\n\n\n\n \n if isinstance(node_or_string,str):\n node_or_string=parse(node_or_string.lstrip(\" \\t\"),mode='eval')\n if isinstance(node_or_string,Expression):\n node_or_string=node_or_string.body\n def _raise_malformed_node(node):\n msg=\"malformed node or string\"\n if lno :=getattr(node,'lineno',None):\n msg +=f' on line {lno}'\n raise ValueError(msg+f': {node !r}')\n def _convert_num(node):\n if not isinstance(node,Constant)or type(node.value)not in(int,float,complex):\n _raise_malformed_node(node)\n return node.value\n def _convert_signed_num(node):\n if isinstance(node,UnaryOp)and isinstance(node.op,(UAdd,USub)):\n operand=_convert_num(node.operand)\n if isinstance(node.op,UAdd):\n return+operand\n else:\n return -operand\n return _convert_num(node)\n def _convert(node):\n if isinstance(node,Constant):\n return node.value\n elif isinstance(node,Tuple):\n return tuple(map(_convert,node.elts))\n elif isinstance(node,List):\n return list(map(_convert,node.elts))\n elif isinstance(node,Set):\n return set(map(_convert,node.elts))\n elif(isinstance(node,Call)and isinstance(node.func,Name)and\n node.func.id =='set'and node.args ==node.keywords ==[]):\n return set()\n elif isinstance(node,Dict):\n if len(node.keys)!=len(node.values):\n _raise_malformed_node(node)\n return dict(zip(map(_convert,node.keys),\n map(_convert,node.values)))\n elif isinstance(node,BinOp)and isinstance(node.op,(Add,Sub)):\n left=_convert_signed_num(node.left)\n right=_convert_num(node.right)\n if isinstance(left,(int,float))and isinstance(right,complex):\n if isinstance(node.op,Add):\n return left+right\n else:\n return left -right\n return _convert_signed_num(node)\n return _convert(node_or_string)\n \n \ndef dump(node,annotate_fields=True,include_attributes=False,*,indent=None):\n ''\n\n\n\n\n\n\n\n\n\n \n def _format(node,level=0):\n if indent is not None:\n level +=1\n prefix='\\n'+indent *level\n sep=',\\n'+indent *level\n else:\n prefix=''\n sep=', '\n if isinstance(node,AST):\n cls=type(node)\n args=[]\n allsimple=True\n keywords=annotate_fields\n for name in node._fields:\n try:\n value=getattr(node,name)\n except AttributeError:\n keywords=True\n continue\n if value is None and getattr(cls,name,...)is None:\n keywords=True\n continue\n value,simple=_format(value,level)\n allsimple=allsimple and simple\n if keywords:\n args.append('%s=%s'%(name,value))\n else:\n args.append(value)\n if include_attributes and node._attributes:\n for name in node._attributes:\n try:\n value=getattr(node,name)\n except AttributeError:\n continue\n if value is None and getattr(cls,name,...)is None:\n continue\n value,simple=_format(value,level)\n allsimple=allsimple and simple\n args.append('%s=%s'%(name,value))\n if allsimple and len(args)<=3:\n return '%s(%s)'%(node.__class__.__name__,', '.join(args)),not args\n return '%s(%s%s)'%(node.__class__.__name__,prefix,sep.join(args)),False\n elif isinstance(node,list):\n if not node:\n return '[]',True\n return '[%s%s]'%(prefix,sep.join(_format(x,level)[0]for x in node)),False\n return repr(node),True\n \n if not isinstance(node,AST):\n raise TypeError('expected AST, got %r'%node.__class__.__name__)\n if indent is not None and not isinstance(indent,str):\n indent=' '*indent\n return _format(node)[0]\n \n \ndef copy_location(new_node,old_node):\n ''\n\n\n \n for attr in 'lineno','col_offset','end_lineno','end_col_offset':\n if attr in old_node._attributes and attr in new_node._attributes:\n value=getattr(old_node,attr,None)\n \n \n if value is not None or(\n hasattr(old_node,attr)and attr.startswith(\"end_\")\n ):\n setattr(new_node,attr,value)\n return new_node\n \n \ndef fix_missing_locations(node):\n ''\n\n\n\n\n\n \n def _fix(node,lineno,col_offset,end_lineno,end_col_offset):\n if 'lineno'in node._attributes:\n if not hasattr(node,'lineno'):\n node.lineno=lineno\n else:\n lineno=node.lineno\n if 'end_lineno'in node._attributes:\n if getattr(node,'end_lineno',None)is None:\n node.end_lineno=end_lineno\n else:\n end_lineno=node.end_lineno\n if 'col_offset'in node._attributes:\n if not hasattr(node,'col_offset'):\n node.col_offset=col_offset\n else:\n col_offset=node.col_offset\n if 'end_col_offset'in node._attributes:\n if getattr(node,'end_col_offset',None)is None:\n node.end_col_offset=end_col_offset\n else:\n end_col_offset=node.end_col_offset\n for child in iter_child_nodes(node):\n _fix(child,lineno,col_offset,end_lineno,end_col_offset)\n _fix(node,1,0,1,0)\n return node\n \n \ndef increment_lineno(node,n=1):\n ''\n\n\n\n \n for child in walk(node):\n \n \n if isinstance(child,TypeIgnore):\n child.lineno=getattr(child,'lineno',0)+n\n continue\n \n if 'lineno'in child._attributes:\n child.lineno=getattr(child,'lineno',0)+n\n if(\n \"end_lineno\"in child._attributes\n and(end_lineno :=getattr(child,\"end_lineno\",0))is not None\n ):\n child.end_lineno=end_lineno+n\n return node\n \n \ndef iter_fields(node):\n ''\n\n\n \n for field in node._fields:\n try:\n yield field,getattr(node,field)\n except AttributeError:\n pass\n \n \ndef iter_child_nodes(node):\n ''\n\n\n \n for name,field in iter_fields(node):\n if isinstance(field,AST):\n yield field\n elif isinstance(field,list):\n for item in field:\n if isinstance(item,AST):\n yield item\n \n \ndef get_docstring(node,clean=True):\n ''\n\n\n\n\n\n\n \n if not isinstance(node,(AsyncFunctionDef,FunctionDef,ClassDef,Module)):\n raise TypeError(\"%r can't have docstrings\"%node.__class__.__name__)\n if not(node.body and isinstance(node.body[0],Expr)):\n return None\n node=node.body[0].value\n if isinstance(node,Constant)and isinstance(node.value,str):\n text=node.value\n else:\n return None\n if clean:\n import inspect\n text=inspect.cleandoc(text)\n return text\n \n \n_line_pattern=re.compile(r\"(.*?(?:\\r\\n|\\n|\\r|$))\")\ndef _splitlines_no_ff(source,maxlines=None):\n ''\n\n\n \n lines=[]\n for lineno,match in enumerate(_line_pattern.finditer(source),1):\n if maxlines is not None and lineno >maxlines:\n break\n lines.append(match[0])\n return lines\n \n \ndef _pad_whitespace(source):\n ''\n result=''\n for c in source:\n if c in '\\f\\t':\n result +=c\n else:\n result +=' '\n return result\n \n \ndef get_source_segment(source,node,*,padded=False):\n ''\n\n\n\n\n\n\n \n try:\n if node.end_lineno is None or node.end_col_offset is None:\n return None\n lineno=node.lineno -1\n end_lineno=node.end_lineno -1\n col_offset=node.col_offset\n end_col_offset=node.end_col_offset\n except AttributeError:\n return None\n \n lines=_splitlines_no_ff(source,maxlines=end_lineno+1)\n if end_lineno ==lineno:\n return lines[lineno].encode()[col_offset:end_col_offset].decode()\n \n if padded:\n padding=_pad_whitespace(lines[lineno].encode()[:col_offset].decode())\n else:\n padding=''\n \n first=padding+lines[lineno].encode()[col_offset:].decode()\n last=lines[end_lineno].encode()[:end_col_offset].decode()\n lines=lines[lineno+1:end_lineno]\n \n lines.insert(0,first)\n lines.append(last)\n return ''.join(lines)\n \n \ndef walk(node):\n ''\n\n\n\n \n from collections import deque\n todo=deque([node])\n while todo:\n node=todo.popleft()\n todo.extend(iter_child_nodes(node))\n yield node\n \n \nclass NodeVisitor(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def visit(self,node):\n ''\n method='visit_'+node.__class__.__name__\n visitor=getattr(self,method,self.generic_visit)\n return visitor(node)\n \n def generic_visit(self,node):\n ''\n for field,value in iter_fields(node):\n if isinstance(value,list):\n for item in value:\n if isinstance(item,AST):\n self.visit(item)\n elif isinstance(value,AST):\n self.visit(value)\n \n def visit_Constant(self,node):\n value=node.value\n type_name=_const_node_type_names.get(type(value))\n if type_name is None:\n for cls,name in _const_node_type_names.items():\n if isinstance(value,cls):\n type_name=name\n break\n if type_name is not None:\n method='visit_'+type_name\n try:\n visitor=getattr(self,method)\n except AttributeError:\n pass\n else:\n import warnings\n warnings.warn(f\"{method} is deprecated; add visit_Constant\",\n DeprecationWarning,2)\n return visitor(node)\n return self.generic_visit(node)\n \n \nclass NodeTransformer(NodeVisitor):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def generic_visit(self,node):\n for field,old_value in iter_fields(node):\n if isinstance(old_value,list):\n new_values=[]\n for value in old_value:\n if isinstance(value,AST):\n value=self.visit(value)\n if value is None:\n continue\n elif not isinstance(value,AST):\n new_values.extend(value)\n continue\n new_values.append(value)\n old_value[:]=new_values\n elif isinstance(old_value,AST):\n new_node=self.visit(old_value)\n if new_node is None:\n delattr(node,field)\n else:\n setattr(node,field,new_node)\n return node\n \n \n_DEPRECATED_VALUE_ALIAS_MESSAGE=(\n\"{name} is deprecated and will be removed in Python {remove}; use value instead\"\n)\n_DEPRECATED_CLASS_MESSAGE=(\n\"{name} is deprecated and will be removed in Python {remove}; \"\n\"use ast.Constant instead\"\n)\n\n\n\nif not hasattr(Constant,'n'):\n\n\n\n def _n_getter(self):\n ''\n import warnings\n warnings._deprecated(\n \"Attribute n\",message=_DEPRECATED_VALUE_ALIAS_MESSAGE,remove=(3,14)\n )\n return self.value\n \n def _n_setter(self,value):\n import warnings\n warnings._deprecated(\n \"Attribute n\",message=_DEPRECATED_VALUE_ALIAS_MESSAGE,remove=(3,14)\n )\n self.value=value\n \n def _s_getter(self):\n ''\n import warnings\n warnings._deprecated(\n \"Attribute s\",message=_DEPRECATED_VALUE_ALIAS_MESSAGE,remove=(3,14)\n )\n return self.value\n \n def _s_setter(self,value):\n import warnings\n warnings._deprecated(\n \"Attribute s\",message=_DEPRECATED_VALUE_ALIAS_MESSAGE,remove=(3,14)\n )\n self.value=value\n \n Constant.n=property(_n_getter,_n_setter)\n Constant.s=property(_s_getter,_s_setter)\n \nclass _ABC(type):\n\n def __init__(cls,*args):\n cls.__doc__=\"\"\"Deprecated AST node class. Use ast.Constant instead\"\"\"\n \n def __instancecheck__(cls,inst):\n if cls in _const_types:\n import warnings\n warnings._deprecated(\n f\"ast.{cls.__qualname__}\",\n message=_DEPRECATED_CLASS_MESSAGE,\n remove=(3,14)\n )\n if not isinstance(inst,Constant):\n return False\n if cls in _const_types:\n try:\n value=inst.value\n except AttributeError:\n return False\n else:\n return(\n isinstance(value,_const_types[cls])and\n not isinstance(value,_const_types_not.get(cls,()))\n )\n return type.__instancecheck__(cls,inst)\n \ndef _new(cls,*args,**kwargs):\n for key in kwargs:\n if key not in cls._fields:\n \n continue\n pos=cls._fields.index(key)\n if pos precedence)\n \n def get_precedence(self,node):\n return self._precedences.get(node,_Precedence.TEST)\n \n def set_precedence(self,precedence,*nodes):\n for node in nodes:\n self._precedences[node]=precedence\n \n def get_raw_docstring(self,node):\n ''\n\n\n \n if not isinstance(\n node,(AsyncFunctionDef,FunctionDef,ClassDef,Module)\n )or len(node.body)<1:\n return None\n node=node.body[0]\n if not isinstance(node,Expr):\n return None\n node=node.value\n if isinstance(node,Constant)and isinstance(node.value,str):\n return node\n \n def get_type_comment(self,node):\n comment=self._type_ignores.get(node.lineno)or node.type_comment\n if comment is not None:\n return f\" # type: {comment}\"\n \n def traverse(self,node):\n if isinstance(node,list):\n for item in node:\n self.traverse(item)\n else:\n super().visit(node)\n \n \n \n \n def visit(self,node):\n ''\n \n self._source=[]\n self.traverse(node)\n return \"\".join(self._source)\n \n def _write_docstring_and_traverse_body(self,node):\n if(docstring :=self.get_raw_docstring(node)):\n self._write_docstring(docstring)\n self.traverse(node.body[1:])\n else:\n self.traverse(node.body)\n \n def visit_Module(self,node):\n self._type_ignores={\n ignore.lineno:f\"ignore{ignore.tag}\"\n for ignore in node.type_ignores\n }\n self._write_docstring_and_traverse_body(node)\n self._type_ignores.clear()\n \n def visit_FunctionType(self,node):\n with self.delimit(\"(\",\")\"):\n self.interleave(\n lambda:self.write(\", \"),self.traverse,node.argtypes\n )\n \n self.write(\" -> \")\n self.traverse(node.returns)\n \n def visit_Expr(self,node):\n self.fill()\n self.set_precedence(_Precedence.YIELD,node.value)\n self.traverse(node.value)\n \n def visit_NamedExpr(self,node):\n with self.require_parens(_Precedence.NAMED_EXPR,node):\n self.set_precedence(_Precedence.ATOM,node.target,node.value)\n self.traverse(node.target)\n self.write(\" := \")\n self.traverse(node.value)\n \n def visit_Import(self,node):\n self.fill(\"import \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.names)\n \n def visit_ImportFrom(self,node):\n self.fill(\"from \")\n self.write(\".\"*(node.level or 0))\n if node.module:\n self.write(node.module)\n self.write(\" import \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.names)\n \n def visit_Assign(self,node):\n self.fill()\n for target in node.targets:\n self.set_precedence(_Precedence.TUPLE,target)\n self.traverse(target)\n self.write(\" = \")\n self.traverse(node.value)\n if type_comment :=self.get_type_comment(node):\n self.write(type_comment)\n \n def visit_AugAssign(self,node):\n self.fill()\n self.traverse(node.target)\n self.write(\" \"+self.binop[node.op.__class__.__name__]+\"= \")\n self.traverse(node.value)\n \n def visit_AnnAssign(self,node):\n self.fill()\n with self.delimit_if(\"(\",\")\",not node.simple and isinstance(node.target,Name)):\n self.traverse(node.target)\n self.write(\": \")\n self.traverse(node.annotation)\n if node.value:\n self.write(\" = \")\n self.traverse(node.value)\n \n def visit_Return(self,node):\n self.fill(\"return\")\n if node.value:\n self.write(\" \")\n self.traverse(node.value)\n \n def visit_Pass(self,node):\n self.fill(\"pass\")\n \n def visit_Break(self,node):\n self.fill(\"break\")\n \n def visit_Continue(self,node):\n self.fill(\"continue\")\n \n def visit_Delete(self,node):\n self.fill(\"del \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.targets)\n \n def visit_Assert(self,node):\n self.fill(\"assert \")\n self.traverse(node.test)\n if node.msg:\n self.write(\", \")\n self.traverse(node.msg)\n \n def visit_Global(self,node):\n self.fill(\"global \")\n self.interleave(lambda:self.write(\", \"),self.write,node.names)\n \n def visit_Nonlocal(self,node):\n self.fill(\"nonlocal \")\n self.interleave(lambda:self.write(\", \"),self.write,node.names)\n \n def visit_Await(self,node):\n with self.require_parens(_Precedence.AWAIT,node):\n self.write(\"await\")\n if node.value:\n self.write(\" \")\n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n \n def visit_Yield(self,node):\n with self.require_parens(_Precedence.YIELD,node):\n self.write(\"yield\")\n if node.value:\n self.write(\" \")\n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n \n def visit_YieldFrom(self,node):\n with self.require_parens(_Precedence.YIELD,node):\n self.write(\"yield from \")\n if not node.value:\n raise ValueError(\"Node can't be used without a value attribute.\")\n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n \n def visit_Raise(self,node):\n self.fill(\"raise\")\n if not node.exc:\n if node.cause:\n raise ValueError(f\"Node can't use cause without an exception.\")\n return\n self.write(\" \")\n self.traverse(node.exc)\n if node.cause:\n self.write(\" from \")\n self.traverse(node.cause)\n \n def do_visit_try(self,node):\n self.fill(\"try\")\n with self.block():\n self.traverse(node.body)\n for ex in node.handlers:\n self.traverse(ex)\n if node.orelse:\n self.fill(\"else\")\n with self.block():\n self.traverse(node.orelse)\n if node.finalbody:\n self.fill(\"finally\")\n with self.block():\n self.traverse(node.finalbody)\n \n def visit_Try(self,node):\n prev_in_try_star=self._in_try_star\n try:\n self._in_try_star=False\n self.do_visit_try(node)\n finally:\n self._in_try_star=prev_in_try_star\n \n def visit_TryStar(self,node):\n prev_in_try_star=self._in_try_star\n try:\n self._in_try_star=True\n self.do_visit_try(node)\n finally:\n self._in_try_star=prev_in_try_star\n \n def visit_ExceptHandler(self,node):\n self.fill(\"except*\"if self._in_try_star else \"except\")\n if node.type:\n self.write(\" \")\n self.traverse(node.type)\n if node.name:\n self.write(\" as \")\n self.write(node.name)\n with self.block():\n self.traverse(node.body)\n \n def visit_ClassDef(self,node):\n self.maybe_newline()\n for deco in node.decorator_list:\n self.fill(\"@\")\n self.traverse(deco)\n self.fill(\"class \"+node.name)\n self._type_params_helper(node.type_params)\n with self.delimit_if(\"(\",\")\",condition=node.bases or node.keywords):\n comma=False\n for e in node.bases:\n if comma:\n self.write(\", \")\n else:\n comma=True\n self.traverse(e)\n for e in node.keywords:\n if comma:\n self.write(\", \")\n else:\n comma=True\n self.traverse(e)\n \n with self.block():\n self._write_docstring_and_traverse_body(node)\n \n def visit_FunctionDef(self,node):\n self._function_helper(node,\"def\")\n \n def visit_AsyncFunctionDef(self,node):\n self._function_helper(node,\"async def\")\n \n def _function_helper(self,node,fill_suffix):\n self.maybe_newline()\n for deco in node.decorator_list:\n self.fill(\"@\")\n self.traverse(deco)\n def_str=fill_suffix+\" \"+node.name\n self.fill(def_str)\n self._type_params_helper(node.type_params)\n with self.delimit(\"(\",\")\"):\n self.traverse(node.args)\n if node.returns:\n self.write(\" -> \")\n self.traverse(node.returns)\n with self.block(extra=self.get_type_comment(node)):\n self._write_docstring_and_traverse_body(node)\n \n def _type_params_helper(self,type_params):\n if type_params is not None and len(type_params)>0:\n with self.delimit(\"[\",\"]\"):\n self.interleave(lambda:self.write(\", \"),self.traverse,type_params)\n \n def visit_TypeVar(self,node):\n self.write(node.name)\n if node.bound:\n self.write(\": \")\n self.traverse(node.bound)\n \n def visit_TypeVarTuple(self,node):\n self.write(\"*\"+node.name)\n \n def visit_ParamSpec(self,node):\n self.write(\"**\"+node.name)\n \n def visit_TypeAlias(self,node):\n self.fill(\"type \")\n self.traverse(node.name)\n self._type_params_helper(node.type_params)\n self.write(\" = \")\n self.traverse(node.value)\n \n def visit_For(self,node):\n self._for_helper(\"for \",node)\n \n def visit_AsyncFor(self,node):\n self._for_helper(\"async for \",node)\n \n def _for_helper(self,fill,node):\n self.fill(fill)\n self.set_precedence(_Precedence.TUPLE,node.target)\n self.traverse(node.target)\n self.write(\" in \")\n self.traverse(node.iter)\n with self.block(extra=self.get_type_comment(node)):\n self.traverse(node.body)\n if node.orelse:\n self.fill(\"else\")\n with self.block():\n self.traverse(node.orelse)\n \n def visit_If(self,node):\n self.fill(\"if \")\n self.traverse(node.test)\n with self.block():\n self.traverse(node.body)\n \n while node.orelse and len(node.orelse)==1 and isinstance(node.orelse[0],If):\n node=node.orelse[0]\n self.fill(\"elif \")\n self.traverse(node.test)\n with self.block():\n self.traverse(node.body)\n \n if node.orelse:\n self.fill(\"else\")\n with self.block():\n self.traverse(node.orelse)\n \n def visit_While(self,node):\n self.fill(\"while \")\n self.traverse(node.test)\n with self.block():\n self.traverse(node.body)\n if node.orelse:\n self.fill(\"else\")\n with self.block():\n self.traverse(node.orelse)\n \n def visit_With(self,node):\n self.fill(\"with \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.items)\n with self.block(extra=self.get_type_comment(node)):\n self.traverse(node.body)\n \n def visit_AsyncWith(self,node):\n self.fill(\"async with \")\n self.interleave(lambda:self.write(\", \"),self.traverse,node.items)\n with self.block(extra=self.get_type_comment(node)):\n self.traverse(node.body)\n \n def _str_literal_helper(\n self,string,*,quote_types=_ALL_QUOTES,escape_special_whitespace=False\n ):\n ''\n\n \n def escape_char(c):\n \n \n if not escape_special_whitespace and c in \"\\n\\t\":\n return c\n \n if c ==\"\\\\\"or not c.isprintable():\n return c.encode(\"unicode_escape\").decode(\"ascii\")\n return c\n \n escaped_string=\"\".join(map(escape_char,string))\n possible_quotes=quote_types\n if \"\\n\"in escaped_string:\n possible_quotes=[q for q in possible_quotes if q in _MULTI_QUOTES]\n possible_quotes=[q for q in possible_quotes if q not in escaped_string]\n if not possible_quotes:\n \n \n \n string=repr(string)\n quote=next((q for q in quote_types if string[0]in q),string[0])\n return string[1:-1],[quote]\n if escaped_string:\n \n possible_quotes.sort(key=lambda q:q[0]==escaped_string[-1])\n \n \n if possible_quotes[0][0]==escaped_string[-1]:\n assert len(possible_quotes[0])==3\n escaped_string=escaped_string[:-1]+\"\\\\\"+escaped_string[-1]\n return escaped_string,possible_quotes\n \n def _write_str_avoiding_backslashes(self,string,*,quote_types=_ALL_QUOTES):\n ''\n string,quote_types=self._str_literal_helper(string,quote_types=quote_types)\n quote_type=quote_types[0]\n self.write(f\"{quote_type}{string}{quote_type}\")\n \n def visit_JoinedStr(self,node):\n self.write(\"f\")\n if self._avoid_backslashes:\n with self.buffered()as buffer:\n self._write_fstring_inner(node)\n return self._write_str_avoiding_backslashes(\"\".join(buffer))\n \n \n \n \n \n \n \n fstring_parts=[]\n for value in node.values:\n with self.buffered()as buffer:\n self._write_fstring_inner(value)\n fstring_parts.append(\n (\"\".join(buffer),isinstance(value,Constant))\n )\n \n new_fstring_parts=[]\n quote_types=list(_ALL_QUOTES)\n for value,is_constant in fstring_parts:\n value,quote_types=self._str_literal_helper(\n value,\n quote_types=quote_types,\n escape_special_whitespace=is_constant,\n )\n new_fstring_parts.append(value)\n \n value=\"\".join(new_fstring_parts)\n quote_type=quote_types[0]\n self.write(f\"{quote_type}{value}{quote_type}\")\n \n def _write_fstring_inner(self,node):\n if isinstance(node,JoinedStr):\n \n for value in node.values:\n self._write_fstring_inner(value)\n elif isinstance(node,Constant)and isinstance(node.value,str):\n value=node.value.replace(\"{\",\"{{\").replace(\"}\",\"}}\")\n self.write(value)\n elif isinstance(node,FormattedValue):\n self.visit_FormattedValue(node)\n else:\n raise ValueError(f\"Unexpected node inside JoinedStr, {node !r}\")\n \n def visit_FormattedValue(self,node):\n def unparse_inner(inner):\n unparser=type(self)(_avoid_backslashes=True)\n unparser.set_precedence(_Precedence.TEST.next(),inner)\n return unparser.visit(inner)\n \n with self.delimit(\"{\",\"}\"):\n expr=unparse_inner(node.value)\n if \"\\\\\"in expr:\n raise ValueError(\n \"Unable to avoid backslash in f-string expression part\"\n )\n if expr.startswith(\"{\"):\n \n self.write(\" \")\n self.write(expr)\n if node.conversion !=-1:\n self.write(f\"!{chr(node.conversion)}\")\n if node.format_spec:\n self.write(\":\")\n self._write_fstring_inner(node.format_spec)\n \n def visit_Name(self,node):\n self.write(node.id)\n \n def _write_docstring(self,node):\n self.fill()\n if node.kind ==\"u\":\n self.write(\"u\")\n self._write_str_avoiding_backslashes(node.value,quote_types=_MULTI_QUOTES)\n \n def _write_constant(self,value):\n if isinstance(value,(float,complex)):\n \n \n self.write(\n repr(value)\n .replace(\"inf\",_INFSTR)\n .replace(\"nan\",f\"({_INFSTR}-{_INFSTR})\")\n )\n elif self._avoid_backslashes and isinstance(value,str):\n self._write_str_avoiding_backslashes(value)\n else:\n self.write(repr(value))\n \n def visit_Constant(self,node):\n value=node.value\n if isinstance(value,tuple):\n with self.delimit(\"(\",\")\"):\n self.items_view(self._write_constant,value)\n elif value is ...:\n self.write(\"...\")\n else:\n if node.kind ==\"u\":\n self.write(\"u\")\n self._write_constant(node.value)\n \n def visit_List(self,node):\n with self.delimit(\"[\",\"]\"):\n self.interleave(lambda:self.write(\", \"),self.traverse,node.elts)\n \n def visit_ListComp(self,node):\n with self.delimit(\"[\",\"]\"):\n self.traverse(node.elt)\n for gen in node.generators:\n self.traverse(gen)\n \n def visit_GeneratorExp(self,node):\n with self.delimit(\"(\",\")\"):\n self.traverse(node.elt)\n for gen in node.generators:\n self.traverse(gen)\n \n def visit_SetComp(self,node):\n with self.delimit(\"{\",\"}\"):\n self.traverse(node.elt)\n for gen in node.generators:\n self.traverse(gen)\n \n def visit_DictComp(self,node):\n with self.delimit(\"{\",\"}\"):\n self.traverse(node.key)\n self.write(\": \")\n self.traverse(node.value)\n for gen in node.generators:\n self.traverse(gen)\n \n def visit_comprehension(self,node):\n if node.is_async:\n self.write(\" async for \")\n else:\n self.write(\" for \")\n self.set_precedence(_Precedence.TUPLE,node.target)\n self.traverse(node.target)\n self.write(\" in \")\n self.set_precedence(_Precedence.TEST.next(),node.iter,*node.ifs)\n self.traverse(node.iter)\n for if_clause in node.ifs:\n self.write(\" if \")\n self.traverse(if_clause)\n \n def visit_IfExp(self,node):\n with self.require_parens(_Precedence.TEST,node):\n self.set_precedence(_Precedence.TEST.next(),node.body,node.test)\n self.traverse(node.body)\n self.write(\" if \")\n self.traverse(node.test)\n self.write(\" else \")\n self.set_precedence(_Precedence.TEST,node.orelse)\n self.traverse(node.orelse)\n \n def visit_Set(self,node):\n if node.elts:\n with self.delimit(\"{\",\"}\"):\n self.interleave(lambda:self.write(\", \"),self.traverse,node.elts)\n else:\n \n \n self.write('{*()}')\n \n def visit_Dict(self,node):\n def write_key_value_pair(k,v):\n self.traverse(k)\n self.write(\": \")\n self.traverse(v)\n \n def write_item(item):\n k,v=item\n if k is None:\n \n \n self.write(\"**\")\n self.set_precedence(_Precedence.EXPR,v)\n self.traverse(v)\n else:\n write_key_value_pair(k,v)\n \n with self.delimit(\"{\",\"}\"):\n self.interleave(\n lambda:self.write(\", \"),write_item,zip(node.keys,node.values)\n )\n \n def visit_Tuple(self,node):\n with self.delimit_if(\n \"(\",\n \")\",\n len(node.elts)==0 or self.get_precedence(node)>_Precedence.TUPLE\n ):\n self.items_view(self.traverse,node.elts)\n \n unop={\"Invert\":\"~\",\"Not\":\"not\",\"UAdd\":\"+\",\"USub\":\"-\"}\n unop_precedence={\n \"not\":_Precedence.NOT,\n \"~\":_Precedence.FACTOR,\n \"+\":_Precedence.FACTOR,\n \"-\":_Precedence.FACTOR,\n }\n \n def visit_UnaryOp(self,node):\n operator=self.unop[node.op.__class__.__name__]\n operator_precedence=self.unop_precedence[operator]\n with self.require_parens(operator_precedence,node):\n self.write(operator)\n \n \n if operator_precedence is not _Precedence.FACTOR:\n self.write(\" \")\n self.set_precedence(operator_precedence,node.operand)\n self.traverse(node.operand)\n \n binop={\n \"Add\":\"+\",\n \"Sub\":\"-\",\n \"Mult\":\"*\",\n \"MatMult\":\"@\",\n \"Div\":\"/\",\n \"Mod\":\"%\",\n \"LShift\":\"<<\",\n \"RShift\":\">>\",\n \"BitOr\":\"|\",\n \"BitXor\":\"^\",\n \"BitAnd\":\"&\",\n \"FloorDiv\":\"//\",\n \"Pow\":\"**\",\n }\n \n binop_precedence={\n \"+\":_Precedence.ARITH,\n \"-\":_Precedence.ARITH,\n \"*\":_Precedence.TERM,\n \"@\":_Precedence.TERM,\n \"/\":_Precedence.TERM,\n \"%\":_Precedence.TERM,\n \"<<\":_Precedence.SHIFT,\n \">>\":_Precedence.SHIFT,\n \"|\":_Precedence.BOR,\n \"^\":_Precedence.BXOR,\n \"&\":_Precedence.BAND,\n \"//\":_Precedence.TERM,\n \"**\":_Precedence.POWER,\n }\n \n binop_rassoc=frozenset((\"**\",))\n def visit_BinOp(self,node):\n operator=self.binop[node.op.__class__.__name__]\n operator_precedence=self.binop_precedence[operator]\n with self.require_parens(operator_precedence,node):\n if operator in self.binop_rassoc:\n left_precedence=operator_precedence.next()\n right_precedence=operator_precedence\n else:\n left_precedence=operator_precedence\n right_precedence=operator_precedence.next()\n \n self.set_precedence(left_precedence,node.left)\n self.traverse(node.left)\n self.write(f\" {operator} \")\n self.set_precedence(right_precedence,node.right)\n self.traverse(node.right)\n \n cmpops={\n \"Eq\":\"==\",\n \"NotEq\":\"!=\",\n \"Lt\":\"<\",\n \"LtE\":\"<=\",\n \"Gt\":\">\",\n \"GtE\":\">=\",\n \"Is\":\"is\",\n \"IsNot\":\"is not\",\n \"In\":\"in\",\n \"NotIn\":\"not in\",\n }\n \n def visit_Compare(self,node):\n with self.require_parens(_Precedence.CMP,node):\n self.set_precedence(_Precedence.CMP.next(),node.left,*node.comparators)\n self.traverse(node.left)\n for o,e in zip(node.ops,node.comparators):\n self.write(\" \"+self.cmpops[o.__class__.__name__]+\" \")\n self.traverse(e)\n \n boolops={\"And\":\"and\",\"Or\":\"or\"}\n boolop_precedence={\"and\":_Precedence.AND,\"or\":_Precedence.OR}\n \n def visit_BoolOp(self,node):\n operator=self.boolops[node.op.__class__.__name__]\n operator_precedence=self.boolop_precedence[operator]\n \n def increasing_level_traverse(node):\n nonlocal operator_precedence\n operator_precedence=operator_precedence.next()\n self.set_precedence(operator_precedence,node)\n self.traverse(node)\n \n with self.require_parens(operator_precedence,node):\n s=f\" {operator} \"\n self.interleave(lambda:self.write(s),increasing_level_traverse,node.values)\n \n def visit_Attribute(self,node):\n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n \n \n \n if isinstance(node.value,Constant)and isinstance(node.value.value,int):\n self.write(\" \")\n self.write(\".\")\n self.write(node.attr)\n \n def visit_Call(self,node):\n self.set_precedence(_Precedence.ATOM,node.func)\n self.traverse(node.func)\n with self.delimit(\"(\",\")\"):\n comma=False\n for e in node.args:\n if comma:\n self.write(\", \")\n else:\n comma=True\n self.traverse(e)\n for e in node.keywords:\n if comma:\n self.write(\", \")\n else:\n comma=True\n self.traverse(e)\n \n def visit_Subscript(self,node):\n def is_non_empty_tuple(slice_value):\n return(\n isinstance(slice_value,Tuple)\n and slice_value.elts\n )\n \n self.set_precedence(_Precedence.ATOM,node.value)\n self.traverse(node.value)\n with self.delimit(\"[\",\"]\"):\n if is_non_empty_tuple(node.slice):\n \n self.items_view(self.traverse,node.slice.elts)\n else:\n self.traverse(node.slice)\n \n def visit_Starred(self,node):\n self.write(\"*\")\n self.set_precedence(_Precedence.EXPR,node.value)\n self.traverse(node.value)\n \n def visit_Ellipsis(self,node):\n self.write(\"...\")\n \n def visit_Slice(self,node):\n if node.lower:\n self.traverse(node.lower)\n self.write(\":\")\n if node.upper:\n self.traverse(node.upper)\n if node.step:\n self.write(\":\")\n self.traverse(node.step)\n \n def visit_Match(self,node):\n self.fill(\"match \")\n self.traverse(node.subject)\n with self.block():\n for case in node.cases:\n self.traverse(case)\n \n def visit_arg(self,node):\n self.write(node.arg)\n if node.annotation:\n self.write(\": \")\n self.traverse(node.annotation)\n \n def visit_arguments(self,node):\n first=True\n \n all_args=node.posonlyargs+node.args\n defaults=[None]*(len(all_args)-len(node.defaults))+node.defaults\n for index,elements in enumerate(zip(all_args,defaults),1):\n a,d=elements\n if first:\n first=False\n else:\n self.write(\", \")\n self.traverse(a)\n if d:\n self.write(\"=\")\n self.traverse(d)\n if index ==len(node.posonlyargs):\n self.write(\", /\")\n \n \n if node.vararg or node.kwonlyargs:\n if first:\n first=False\n else:\n self.write(\", \")\n self.write(\"*\")\n if node.vararg:\n self.write(node.vararg.arg)\n if node.vararg.annotation:\n self.write(\": \")\n self.traverse(node.vararg.annotation)\n \n \n if node.kwonlyargs:\n for a,d in zip(node.kwonlyargs,node.kw_defaults):\n self.write(\", \")\n self.traverse(a)\n if d:\n self.write(\"=\")\n self.traverse(d)\n \n \n if node.kwarg:\n if first:\n first=False\n else:\n self.write(\", \")\n self.write(\"**\"+node.kwarg.arg)\n if node.kwarg.annotation:\n self.write(\": \")\n self.traverse(node.kwarg.annotation)\n \n def visit_keyword(self,node):\n if node.arg is None:\n self.write(\"**\")\n else:\n self.write(node.arg)\n self.write(\"=\")\n self.traverse(node.value)\n \n def visit_Lambda(self,node):\n with self.require_parens(_Precedence.TEST,node):\n self.write(\"lambda\")\n with self.buffered()as buffer:\n self.traverse(node.args)\n if buffer:\n self.write(\" \",*buffer)\n self.write(\": \")\n self.set_precedence(_Precedence.TEST,node.body)\n self.traverse(node.body)\n \n def visit_alias(self,node):\n self.write(node.name)\n if node.asname:\n self.write(\" as \"+node.asname)\n \n def visit_withitem(self,node):\n self.traverse(node.context_expr)\n if node.optional_vars:\n self.write(\" as \")\n self.traverse(node.optional_vars)\n \n def visit_match_case(self,node):\n self.fill(\"case \")\n self.traverse(node.pattern)\n if node.guard:\n self.write(\" if \")\n self.traverse(node.guard)\n with self.block():\n self.traverse(node.body)\n \n def visit_MatchValue(self,node):\n self.traverse(node.value)\n \n def visit_MatchSingleton(self,node):\n self._write_constant(node.value)\n \n def visit_MatchSequence(self,node):\n with self.delimit(\"[\",\"]\"):\n self.interleave(\n lambda:self.write(\", \"),self.traverse,node.patterns\n )\n \n def visit_MatchStar(self,node):\n name=node.name\n if name is None:\n name=\"_\"\n self.write(f\"*{name}\")\n \n def visit_MatchMapping(self,node):\n def write_key_pattern_pair(pair):\n k,p=pair\n self.traverse(k)\n self.write(\": \")\n self.traverse(p)\n \n with self.delimit(\"{\",\"}\"):\n keys=node.keys\n self.interleave(\n lambda:self.write(\", \"),\n write_key_pattern_pair,\n zip(keys,node.patterns,strict=True),\n )\n rest=node.rest\n if rest is not None:\n if keys:\n self.write(\", \")\n self.write(f\"**{rest}\")\n \n def visit_MatchClass(self,node):\n self.set_precedence(_Precedence.ATOM,node.cls)\n self.traverse(node.cls)\n with self.delimit(\"(\",\")\"):\n patterns=node.patterns\n self.interleave(\n lambda:self.write(\", \"),self.traverse,patterns\n )\n attrs=node.kwd_attrs\n if attrs:\n def write_attr_pattern(pair):\n attr,pattern=pair\n self.write(f\"{attr}=\")\n self.traverse(pattern)\n \n if patterns:\n self.write(\", \")\n self.interleave(\n lambda:self.write(\", \"),\n write_attr_pattern,\n zip(attrs,node.kwd_patterns,strict=True),\n )\n \n def visit_MatchAs(self,node):\n name=node.name\n pattern=node.pattern\n if name is None:\n self.write(\"_\")\n elif pattern is None:\n self.write(node.name)\n else:\n with self.require_parens(_Precedence.TEST,node):\n self.set_precedence(_Precedence.BOR,node.pattern)\n self.traverse(node.pattern)\n self.write(f\" as {node.name}\")\n \n def visit_MatchOr(self,node):\n with self.require_parens(_Precedence.BOR,node):\n self.set_precedence(_Precedence.BOR.next(),*node.patterns)\n self.interleave(lambda:self.write(\" | \"),self.traverse,node.patterns)\n \ndef unparse(ast_obj):\n unparser=_Unparser()\n return unparser.visit(ast_obj)\n \n \n_deprecated_globals={\nname:globals().pop(name)\nfor name in('Num','Str','Bytes','NameConstant','Ellipsis')\n}\n\ndef __getattr__(name):\n if name in _deprecated_globals:\n globals()[name]=value=_deprecated_globals[name]\n import warnings\n warnings._deprecated(\n f\"ast.{name}\",message=_DEPRECATED_CLASS_MESSAGE,remove=(3,14)\n )\n return value\n raise AttributeError(f\"module 'ast' has no attribute '{name}'\")\n \n \ndef main():\n import argparse\n \n parser=argparse.ArgumentParser(prog='python -m ast')\n parser.add_argument('infile',type=argparse.FileType(mode='rb'),nargs='?',\n default='-',\n help='the file to parse; defaults to stdin')\n parser.add_argument('-m','--mode',default='exec',\n choices=('exec','single','eval','func_type'),\n help='specify what kind of code must be parsed')\n parser.add_argument('--no-type-comments',default=True,action='store_false',\n help=\"don't add information about type comments\")\n parser.add_argument('-a','--include-attributes',action='store_true',\n help='include attributes such as line numbers and '\n 'column offsets')\n parser.add_argument('-i','--indent',type=int,default=3,\n help='indentation of nodes (number of spaces)')\n args=parser.parse_args()\n \n with args.infile as infile:\n source=infile.read()\n tree=parse(source,args.infile.name,args.mode,type_comments=args.no_type_comments)\n print(dump(tree,include_attributes=args.include_attributes,indent=args.indent))\n \nif __name__ =='__main__':\n main()\n", ["_ast", "argparse", "collections", "contextlib", "enum", "inspect", "re", "sys", "warnings"]], "asyncio": [".py", "print('Brython implementation of asyncio is present to avoid ImportError '+\n'in some modules, but does not implement the asyncio features '+\n'because of browser limitations.\\nFor asynchronous programming, use '+\n'browser.aio instead')\n\nALL_COMPLETED=\"\"\"ALL_COMPLETED\"\"\"\n\n\nclass AbstractEventLoop:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n \nclass AbstractEventLoopPolicy:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n def get_child_watcher(*args,**kw):\n pass\n \n def get_event_loop(*args,**kw):\n pass\n \n def new_event_loop(*args,**kw):\n pass\n \n def set_child_watcher(*args,**kw):\n pass\n \n def set_event_loop(*args,**kw):\n pass\n \nclass AbstractServer:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n def close(*args,**kw):\n pass\n \n def get_loop(*args,**kw):\n pass\n \n def is_serving(*args,**kw):\n pass\n \n def serve_forever(*args,**kw):\n pass\n \n def start_serving(*args,**kw):\n pass\n \n def wait_closed(*args,**kw):\n pass\n \nclass Barrier:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _block(*args,**kw):\n pass\n \n def _exit(*args,**kw):\n pass\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def _release(*args,**kw):\n pass\n \n def _wait(*args,**kw):\n pass\n \n def abort(*args,**kw):\n pass\n \n broken=\"\"\n \n n_waiting=\"\"\n \n parties=\"\"\n \n def reset(*args,**kw):\n pass\n \n def wait(*args,**kw):\n pass\n \nclass BaseEventLoop:\n\n __module__=\"\"\"asyncio.base_events\"\"\"\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n \nclass BaseProtocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass BaseTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \nclass BoundedSemaphore:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def _wake_up_next(*args,**kw):\n pass\n \n def acquire(*args,**kw):\n pass\n \n def locked(*args,**kw):\n pass\n \n def release(*args,**kw):\n pass\n \nclass BrokenBarrierError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass BufferedProtocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def buffer_updated(*args,**kw):\n pass\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def eof_received(*args,**kw):\n pass\n \n def get_buffer(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass CancelledError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass Condition:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def notify(*args,**kw):\n pass\n \n def notify_all(*args,**kw):\n pass\n \n def wait(*args,**kw):\n pass\n \n def wait_for(*args,**kw):\n pass\n \nclass DatagramProtocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def datagram_received(*args,**kw):\n pass\n \n def error_received(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass DatagramTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def abort(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def sendto(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \nclass DefaultEventLoopPolicy:\n\n\n class _Local:\n \n __module__=\"\"\"asyncio.events\"\"\"\n \n _loop=None\n \n _set_called=False\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n \n class _loop_factory:\n \n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _loop_self_reading(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_duplex_pipe_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_accept_futures(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_pipe_connection(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_serving_pipe(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n def get_child_watcher(*args,**kw):\n pass\n \n def get_event_loop(*args,**kw):\n pass\n \n def new_event_loop(*args,**kw):\n pass\n \n def set_child_watcher(*args,**kw):\n pass\n \n def set_event_loop(*args,**kw):\n pass\n \nclass Event:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def clear(*args,**kw):\n pass\n \n def is_set(*args,**kw):\n pass\n \n def set(*args,**kw):\n pass\n \n def wait(*args,**kw):\n pass\nFIRST_COMPLETED=\"\"\"FIRST_COMPLETED\"\"\"\n\nFIRST_EXCEPTION=\"\"\"FIRST_EXCEPTION\"\"\"\n\n\nclass Future:\n\n _asyncio_future_blocking=\"\"\n \n _callbacks=\"\"\n \n _cancel_message=\"\"\n \n _exception=\"\"\n \n _log_traceback=\"\"\n \n _loop=\"\"\n \n _make_cancelled_error=\"\"\n \n _result=\"\"\n \n _source_traceback=\"\"\n \n _state=\"\"\n \n add_done_callback=\"\"\n \n cancel=\"\"\n \n cancelled=\"\"\n \n done=\"\"\n \n exception=\"\"\n \n get_loop=\"\"\n \n remove_done_callback=\"\"\n \n result=\"\"\n \n set_exception=\"\"\n \n set_result=\"\"\n \nclass Handle:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n _args=\"\"\n \n _callback=\"\"\n \n _cancelled=\"\"\n \n _context=\"\"\n \n _loop=\"\"\n \n _repr=\"\"\n \n def _repr_info(*args,**kw):\n pass\n \n def _run(*args,**kw):\n pass\n \n _source_traceback=\"\"\n \n def cancel(*args,**kw):\n pass\n \n def cancelled(*args,**kw):\n pass\n \nclass IncompleteReadError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass InvalidStateError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass IocpProactor:\n\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _check_closed(*args,**kw):\n pass\n \n def _get_accept_socket(*args,**kw):\n pass\n \n def _poll(*args,**kw):\n pass\n \n def _register(*args,**kw):\n pass\n \n def _register_with_iocp(*args,**kw):\n pass\n \n def _result(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _unregister(*args,**kw):\n pass\n \n def _wait_cancel(*args,**kw):\n pass\n \n def _wait_for_handle(*args,**kw):\n pass\n \n def accept(*args,**kw):\n pass\n \n def accept_pipe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect(*args,**kw):\n pass\n \n def connect_pipe(*args,**kw):\n pass\n \n def recv(*args,**kw):\n pass\n \n def recv_into(*args,**kw):\n pass\n \n def recvfrom(*args,**kw):\n pass\n \n def recvfrom_into(*args,**kw):\n pass\n \n def select(*args,**kw):\n pass\n \n def send(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def sendto(*args,**kw):\n pass\n \n def set_loop(*args,**kw):\n pass\n \n def wait_for_handle(*args,**kw):\n pass\n \nclass LifoQueue:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n def _format(*args,**kw):\n pass\n \n def _get(*args,**kw):\n pass\n \n def _get_loop(*args,**kw):\n pass\n \n def _init(*args,**kw):\n pass\n \n _loop=None\n \n def _put(*args,**kw):\n pass\n \n def _wakeup_next(*args,**kw):\n pass\n \n def empty(*args,**kw):\n pass\n \n def full(*args,**kw):\n pass\n \n def get(*args,**kw):\n pass\n \n def get_nowait(*args,**kw):\n pass\n \n def join(*args,**kw):\n pass\n \n maxsize=\"\"\n \n def put(*args,**kw):\n pass\n \n def put_nowait(*args,**kw):\n pass\n \n def qsize(*args,**kw):\n pass\n \n def task_done(*args,**kw):\n pass\n \nclass LimitOverrunError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass Lock:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def _wake_up_first(*args,**kw):\n pass\n \n def acquire(*args,**kw):\n pass\n \n def locked(*args,**kw):\n pass\n \n def release(*args,**kw):\n pass\n \nclass PriorityQueue:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n def _format(*args,**kw):\n pass\n \n def _get(*args,**kw):\n pass\n \n def _get_loop(*args,**kw):\n pass\n \n def _init(*args,**kw):\n pass\n \n _loop=None\n \n def _put(*args,**kw):\n pass\n \n def _wakeup_next(*args,**kw):\n pass\n \n def empty(*args,**kw):\n pass\n \n def full(*args,**kw):\n pass\n \n def get(*args,**kw):\n pass\n \n def get_nowait(*args,**kw):\n pass\n \n def join(*args,**kw):\n pass\n \n maxsize=\"\"\n \n def put(*args,**kw):\n pass\n \n def put_nowait(*args,**kw):\n pass\n \n def qsize(*args,**kw):\n pass\n \n def task_done(*args,**kw):\n pass\n \nclass ProactorEventLoop:\n\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _loop_self_reading(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_duplex_pipe_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_accept_futures(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_pipe_connection(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_serving_pipe(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n \nclass Protocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def data_received(*args,**kw):\n pass\n \n def eof_received(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass Queue:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n def _format(*args,**kw):\n pass\n \n def _get(*args,**kw):\n pass\n \n def _get_loop(*args,**kw):\n pass\n \n def _init(*args,**kw):\n pass\n \n _loop=None\n \n def _put(*args,**kw):\n pass\n \n def _wakeup_next(*args,**kw):\n pass\n \n def empty(*args,**kw):\n pass\n \n def full(*args,**kw):\n pass\n \n def get(*args,**kw):\n pass\n \n def get_nowait(*args,**kw):\n pass\n \n def join(*args,**kw):\n pass\n \n maxsize=\"\"\n \n def put(*args,**kw):\n pass\n \n def put_nowait(*args,**kw):\n pass\n \n def qsize(*args,**kw):\n pass\n \n def task_done(*args,**kw):\n pass\n \nclass QueueEmpty:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass QueueFull:\n\n __module__=\"\"\"asyncio.queues\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass ReadTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def is_reading(*args,**kw):\n pass\n \n def pause_reading(*args,**kw):\n pass\n \n def resume_reading(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \nclass Runner:\n\n __module__=\"\"\"asyncio.runners\"\"\"\n \n def _lazy_init(*args,**kw):\n pass\n \n def _on_sigint(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_loop(*args,**kw):\n pass\n \n def run(*args,**kw):\n pass\n \nclass SelectorEventLoop:\n\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _accept_connection(*args,**kw):\n pass\n \n def _accept_connection2(*args,**kw):\n pass\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _add_reader(*args,**kw):\n pass\n \n def _add_writer(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_fd_no_transport(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _process_self_data(*args,**kw):\n pass\n \n def _read_from_self(*args,**kw):\n pass\n \n def _remove_reader(*args,**kw):\n pass\n \n def _remove_writer(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_accept(*args,**kw):\n pass\n \n def _sock_connect(*args,**kw):\n pass\n \n def _sock_connect_cb(*args,**kw):\n pass\n \n def _sock_read_done(*args,**kw):\n pass\n \n def _sock_recv(*args,**kw):\n pass\n \n def _sock_recv_into(*args,**kw):\n pass\n \n def _sock_recvfrom(*args,**kw):\n pass\n \n def _sock_recvfrom_into(*args,**kw):\n pass\n \n def _sock_sendall(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _sock_sendto(*args,**kw):\n pass\n \n def _sock_write_done(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n \nclass Semaphore:\n\n __module__=\"\"\"asyncio.locks\"\"\"\n \n def _get_loop(*args,**kw):\n pass\n \n _loop=None\n \n def _wake_up_next(*args,**kw):\n pass\n \n def acquire(*args,**kw):\n pass\n \n def locked(*args,**kw):\n pass\n \n def release(*args,**kw):\n pass\n \nclass SendfileNotAvailableError:\n\n __module__=\"\"\"asyncio.exceptions\"\"\"\n \n add_note=\"\"\n \n args=\"\"\n \n with_traceback=\"\"\n \nclass Server:\n\n __module__=\"\"\"asyncio.base_events\"\"\"\n \n def _attach(*args,**kw):\n pass\n \n def _detach(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _wakeup(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_loop(*args,**kw):\n pass\n \n def is_serving(*args,**kw):\n pass\n \n def serve_forever(*args,**kw):\n pass\n \n sockets=\"\"\n \n def start_serving(*args,**kw):\n pass\n \n def wait_closed(*args,**kw):\n pass\n \nclass StreamReader:\n\n __module__=\"\"\"asyncio.streams\"\"\"\n \n def _maybe_resume_transport(*args,**kw):\n pass\n \n _source_traceback=None\n \n def _wait_for_data(*args,**kw):\n pass\n \n def _wakeup_waiter(*args,**kw):\n pass\n \n def at_eof(*args,**kw):\n pass\n \n def exception(*args,**kw):\n pass\n \n def feed_data(*args,**kw):\n pass\n \n def feed_eof(*args,**kw):\n pass\n \n def read(*args,**kw):\n pass\n \n def readexactly(*args,**kw):\n pass\n \n def readline(*args,**kw):\n pass\n \n def readuntil(*args,**kw):\n pass\n \n def set_exception(*args,**kw):\n pass\n \n def set_transport(*args,**kw):\n pass\n \nclass StreamReaderProtocol:\n\n __module__=\"\"\"asyncio.streams\"\"\"\n \n def _drain_helper(*args,**kw):\n pass\n \n def _get_close_waiter(*args,**kw):\n pass\n \n def _replace_writer(*args,**kw):\n pass\n \n _source_traceback=None\n \n _stream_reader=\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def data_received(*args,**kw):\n pass\n \n def eof_received(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass StreamWriter:\n\n __module__=\"\"\"asyncio.streams\"\"\"\n \n def can_write_eof(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def drain(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n transport=\"\"\n \n def wait_closed(*args,**kw):\n pass\n \n def write(*args,**kw):\n pass\n \n def write_eof(*args,**kw):\n pass\n \n def writelines(*args,**kw):\n pass\n \nclass SubprocessProtocol:\n\n __module__=\"\"\"asyncio.protocols\"\"\"\n \n def connection_lost(*args,**kw):\n pass\n \n def connection_made(*args,**kw):\n pass\n \n def pause_writing(*args,**kw):\n pass\n \n def pipe_connection_lost(*args,**kw):\n pass\n \n def pipe_data_received(*args,**kw):\n pass\n \n def process_exited(*args,**kw):\n pass\n \n def resume_writing(*args,**kw):\n pass\n \nclass SubprocessTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_pid(*args,**kw):\n pass\n \n def get_pipe_transport(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def get_returncode(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def kill(*args,**kw):\n pass\n \n def send_signal(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \n def terminate(*args,**kw):\n pass\n \nclass Task:\n\n _asyncio_future_blocking=\"\"\n \n _callbacks=\"\"\n \n _cancel_message=\"\"\n \n _check_future=\"\"\n \n _coro=\"\"\n \n _exception=\"\"\n \n _fut_waiter=\"\"\n \n _log_destroy_pending=\"\"\n \n _log_traceback=\"\"\n \n _loop=\"\"\n \n _make_cancelled_error=\"\"\n \n _must_cancel=\"\"\n \n _result=\"\"\n \n _source_traceback=\"\"\n \n _state=\"\"\n \n add_done_callback=\"\"\n \n cancel=\"\"\n \n cancelled=\"\"\n \n cancelling=\"\"\n \n done=\"\"\n \n exception=\"\"\n \n get_coro=\"\"\n \n get_loop=\"\"\n \n get_name=\"\"\n \n get_stack=\"\"\n \n print_stack=\"\"\n \n remove_done_callback=\"\"\n \n result=\"\"\n \n set_exception=\"\"\n \n set_name=\"\"\n \n set_result=\"\"\n \n uncancel=\"\"\n \nclass TaskGroup:\n\n __module__=\"\"\"asyncio.taskgroups\"\"\"\n \n def _abort(*args,**kw):\n pass\n \n def _is_base_error(*args,**kw):\n pass\n \n def _on_task_done(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \nclass Timeout:\n\n __module__=\"\"\"asyncio.timeouts\"\"\"\n \n def _on_timeout(*args,**kw):\n pass\n \n def expired(*args,**kw):\n pass\n \n def reschedule(*args,**kw):\n pass\n \n def when(*args,**kw):\n pass\n \nclass TimeoutError:\n\n add_note=\"\"\n \n args=\"\"\n \n characters_written=\"\"\n \n errno=\"\"\n \n filename=\"\"\n \n filename2=\"\"\n \n strerror=\"\"\n \n winerror=\"\"\n \n with_traceback=\"\"\n \nclass TimerHandle:\n\n __module__=\"\"\"asyncio.events\"\"\"\n \n _args=\"\"\n \n _callback=\"\"\n \n _cancelled=\"\"\n \n _context=\"\"\n \n _loop=\"\"\n \n _repr=\"\"\n \n def _repr_info(*args,**kw):\n pass\n \n def _run(*args,**kw):\n pass\n \n _scheduled=\"\"\n \n _source_traceback=\"\"\n \n _when=\"\"\n \n def cancel(*args,**kw):\n pass\n \n def cancelled(*args,**kw):\n pass\n \n def when(*args,**kw):\n pass\n \nclass Transport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def abort(*args,**kw):\n pass\n \n def can_write_eof(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def get_write_buffer_limits(*args,**kw):\n pass\n \n def get_write_buffer_size(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def is_reading(*args,**kw):\n pass\n \n def pause_reading(*args,**kw):\n pass\n \n def resume_reading(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \n def set_write_buffer_limits(*args,**kw):\n pass\n \n def write(*args,**kw):\n pass\n \n def write_eof(*args,**kw):\n pass\n \n def writelines(*args,**kw):\n pass\n \nclass WindowsProactorEventLoopPolicy:\n\n\n class _Local:\n \n __module__=\"\"\"asyncio.events\"\"\"\n \n _loop=None\n \n _set_called=False\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n \n class _loop_factory:\n \n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _loop_self_reading(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_duplex_pipe_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_accept_futures(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_pipe_connection(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_serving_pipe(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n def get_child_watcher(*args,**kw):\n pass\n \n def get_event_loop(*args,**kw):\n pass\n \n def new_event_loop(*args,**kw):\n pass\n \n def set_child_watcher(*args,**kw):\n pass\n \n def set_event_loop(*args,**kw):\n pass\n \nclass WindowsSelectorEventLoopPolicy:\n\n\n class _Local:\n \n __module__=\"\"\"asyncio.events\"\"\"\n \n _loop=None\n \n _set_called=False\n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n \n class _loop_factory:\n \n __module__=\"\"\"asyncio.windows_events\"\"\"\n \n def _accept_connection(*args,**kw):\n pass\n \n def _accept_connection2(*args,**kw):\n pass\n \n def _add_callback(*args,**kw):\n pass\n \n def _add_callback_signalsafe(*args,**kw):\n pass\n \n def _add_reader(*args,**kw):\n pass\n \n def _add_writer(*args,**kw):\n pass\n \n def _asyncgen_finalizer_hook(*args,**kw):\n pass\n \n def _asyncgen_firstiter_hook(*args,**kw):\n pass\n \n def _call_soon(*args,**kw):\n pass\n \n def _check_callback(*args,**kw):\n pass\n \n def _check_closed(*args,**kw):\n pass\n \n def _check_default_executor(*args,**kw):\n pass\n \n def _check_running(*args,**kw):\n pass\n \n def _check_sendfile_params(*args,**kw):\n pass\n \n def _check_thread(*args,**kw):\n pass\n \n def _close_self_pipe(*args,**kw):\n pass\n \n def _connect_sock(*args,**kw):\n pass\n \n def _create_connection_transport(*args,**kw):\n pass\n \n def _create_server_getaddrinfo(*args,**kw):\n pass\n \n def _do_shutdown(*args,**kw):\n pass\n \n def _ensure_fd_no_transport(*args,**kw):\n pass\n \n def _ensure_resolved(*args,**kw):\n pass\n \n def _getaddrinfo_debug(*args,**kw):\n pass\n \n def _log_subprocess(*args,**kw):\n pass\n \n def _make_datagram_transport(*args,**kw):\n pass\n \n def _make_read_pipe_transport(*args,**kw):\n pass\n \n def _make_self_pipe(*args,**kw):\n pass\n \n def _make_socket_transport(*args,**kw):\n pass\n \n def _make_ssl_transport(*args,**kw):\n pass\n \n def _make_subprocess_transport(*args,**kw):\n pass\n \n def _make_write_pipe_transport(*args,**kw):\n pass\n \n def _process_events(*args,**kw):\n pass\n \n def _process_self_data(*args,**kw):\n pass\n \n def _read_from_self(*args,**kw):\n pass\n \n def _remove_reader(*args,**kw):\n pass\n \n def _remove_writer(*args,**kw):\n pass\n \n def _run_once(*args,**kw):\n pass\n \n def _sendfile_fallback(*args,**kw):\n pass\n \n def _sendfile_native(*args,**kw):\n pass\n \n def _set_coroutine_origin_tracking(*args,**kw):\n pass\n \n def _sock_accept(*args,**kw):\n pass\n \n def _sock_connect(*args,**kw):\n pass\n \n def _sock_connect_cb(*args,**kw):\n pass\n \n def _sock_read_done(*args,**kw):\n pass\n \n def _sock_recv(*args,**kw):\n pass\n \n def _sock_recv_into(*args,**kw):\n pass\n \n def _sock_recvfrom(*args,**kw):\n pass\n \n def _sock_recvfrom_into(*args,**kw):\n pass\n \n def _sock_sendall(*args,**kw):\n pass\n \n def _sock_sendfile_fallback(*args,**kw):\n pass\n \n def _sock_sendfile_native(*args,**kw):\n pass\n \n def _sock_sendto(*args,**kw):\n pass\n \n def _sock_write_done(*args,**kw):\n pass\n \n def _start_serving(*args,**kw):\n pass\n \n def _stop_serving(*args,**kw):\n pass\n \n def _timer_handle_cancelled(*args,**kw):\n pass\n \n def _write_to_self(*args,**kw):\n pass\n \n def add_reader(*args,**kw):\n pass\n \n def add_signal_handler(*args,**kw):\n pass\n \n def add_writer(*args,**kw):\n pass\n \n def call_at(*args,**kw):\n pass\n \n def call_exception_handler(*args,**kw):\n pass\n \n def call_later(*args,**kw):\n pass\n \n def call_soon(*args,**kw):\n pass\n \n def call_soon_threadsafe(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def connect_accepted_socket(*args,**kw):\n pass\n \n def connect_read_pipe(*args,**kw):\n pass\n \n def connect_write_pipe(*args,**kw):\n pass\n \n def create_connection(*args,**kw):\n pass\n \n def create_datagram_endpoint(*args,**kw):\n pass\n \n def create_future(*args,**kw):\n pass\n \n def create_server(*args,**kw):\n pass\n \n def create_task(*args,**kw):\n pass\n \n def create_unix_connection(*args,**kw):\n pass\n \n def create_unix_server(*args,**kw):\n pass\n \n def default_exception_handler(*args,**kw):\n pass\n \n def get_debug(*args,**kw):\n pass\n \n def get_exception_handler(*args,**kw):\n pass\n \n def get_task_factory(*args,**kw):\n pass\n \n def getaddrinfo(*args,**kw):\n pass\n \n def getnameinfo(*args,**kw):\n pass\n \n def is_closed(*args,**kw):\n pass\n \n def is_running(*args,**kw):\n pass\n \n def remove_reader(*args,**kw):\n pass\n \n def remove_signal_handler(*args,**kw):\n pass\n \n def remove_writer(*args,**kw):\n pass\n \n def run_forever(*args,**kw):\n pass\n \n def run_in_executor(*args,**kw):\n pass\n \n def run_until_complete(*args,**kw):\n pass\n \n def sendfile(*args,**kw):\n pass\n \n def set_debug(*args,**kw):\n pass\n \n def set_default_executor(*args,**kw):\n pass\n \n def set_exception_handler(*args,**kw):\n pass\n \n def set_task_factory(*args,**kw):\n pass\n \n def shutdown_asyncgens(*args,**kw):\n pass\n \n def shutdown_default_executor(*args,**kw):\n pass\n \n def sock_accept(*args,**kw):\n pass\n \n def sock_connect(*args,**kw):\n pass\n \n def sock_recv(*args,**kw):\n pass\n \n def sock_recv_into(*args,**kw):\n pass\n \n def sock_recvfrom(*args,**kw):\n pass\n \n def sock_recvfrom_into(*args,**kw):\n pass\n \n def sock_sendall(*args,**kw):\n pass\n \n def sock_sendfile(*args,**kw):\n pass\n \n def sock_sendto(*args,**kw):\n pass\n \n def start_tls(*args,**kw):\n pass\n \n def stop(*args,**kw):\n pass\n \n def subprocess_exec(*args,**kw):\n pass\n \n def subprocess_shell(*args,**kw):\n pass\n \n def time(*args,**kw):\n pass\n def get_child_watcher(*args,**kw):\n pass\n \n def get_event_loop(*args,**kw):\n pass\n \n def new_event_loop(*args,**kw):\n pass\n \n def set_child_watcher(*args,**kw):\n pass\n \n def set_event_loop(*args,**kw):\n pass\n \nclass WriteTransport:\n\n __module__=\"\"\"asyncio.transports\"\"\"\n \n _extra=\"\"\n \n def abort(*args,**kw):\n pass\n \n def can_write_eof(*args,**kw):\n pass\n \n def close(*args,**kw):\n pass\n \n def get_extra_info(*args,**kw):\n pass\n \n def get_protocol(*args,**kw):\n pass\n \n def get_write_buffer_limits(*args,**kw):\n pass\n \n def get_write_buffer_size(*args,**kw):\n pass\n \n def is_closing(*args,**kw):\n pass\n \n def set_protocol(*args,**kw):\n pass\n \n def set_write_buffer_limits(*args,**kw):\n pass\n \n def write(*args,**kw):\n pass\n \n def write_eof(*args,**kw):\n pass\n \n def writelines(*args,**kw):\n pass\ndef _enter_task(*args,**kw):\n pass\n \ndef _get_running_loop(*args,**kw):\n pass\n \ndef _leave_task(*args,**kw):\n pass\n \ndef _register_task(*args,**kw):\n pass\n \ndef _set_running_loop(*args,**kw):\n pass\n \ndef _unregister_task(*args,**kw):\n pass\n \ndef all_tasks(*args,**kw):\n pass\n \ndef as_completed(*args,**kw):\n pass\n \nbase_events=\"\"\n\nbase_futures=\"\"\n\nbase_subprocess=\"\"\n\nbase_tasks=\"\"\n\nconstants=\"\"\n\ncoroutines=\"\"\n\ndef create_subprocess_exec(*args,**kw):\n pass\n \ndef create_subprocess_shell(*args,**kw):\n pass\n \ndef create_task(*args,**kw):\n pass\n \ndef current_task(*args,**kw):\n pass\n \ndef ensure_future(*args,**kw):\n pass\n \nevents=\"\"\n\nexceptions=\"\"\n\nformat_helpers=\"\"\n\nfutures=\"\"\n\ndef gather(*args,**kw):\n pass\n \ndef get_child_watcher(*args,**kw):\n pass\n \ndef get_event_loop(*args,**kw):\n pass\n \ndef get_event_loop_policy(*args,**kw):\n pass\n \ndef get_running_loop(*args,**kw):\n pass\n \ndef iscoroutine(*args,**kw):\n pass\n \ndef iscoroutinefunction(*args,**kw):\n pass\n \ndef isfuture(*args,**kw):\n pass\n \nlocks=\"\"\n\nlog=\"\"\n\nmixins=\"\"\n\ndef new_event_loop(*args,**kw):\n pass\n \ndef open_connection(*args,**kw):\n pass\n \nproactor_events=\"\"\n\nprotocols=\"\"\n\nqueues=\"\"\n\ndef run(*args,**kw):\n pass\n \ndef run_coroutine_threadsafe(*args,**kw):\n pass\n \nrunners=\"\"\n\nselector_events=\"\"\n\ndef set_child_watcher(*args,**kw):\n pass\n \ndef set_event_loop(*args,**kw):\n pass\n \ndef set_event_loop_policy(*args,**kw):\n pass\n \ndef shield(*args,**kw):\n pass\n \ndef sleep(*args,**kw):\n pass\n \nsslproto=\"\"\n\nstaggered=\"\"\n\ndef start_server(*args,**kw):\n pass\n \nstreams=\"\"\n\nsubprocess=\"\"\n\nsys=\"\"\n\ntaskgroups=\"\"\n\ntasks=\"\"\n\nthreads=\"\"\n\ndef timeout(*args,**kw):\n pass\n \ndef timeout_at(*args,**kw):\n pass\n \ntimeouts=\"\"\n\ndef to_thread(*args,**kw):\n pass\n \ntransports=\"\"\n\ntrsock=\"\"\n\ndef wait(*args,**kw):\n pass\n \ndef wait_for(*args,**kw):\n pass\n \nwindows_events=\"\"\n\nwindows_utils=\"\"\n\ndef wrap_future(*args,**kw):\n pass\n \n", []], "atexit": [".py", "''\n\n\n\n\n\nclass __loader__(object):\n pass\n \ndef _clear(*args,**kw):\n ''\n \n pass\n \ndef _run_exitfuncs(*args,**kw):\n ''\n \n pass\n \ndef register(*args,**kw):\n ''\n\n\n\n\n\n\n \n pass\n \ndef unregister(*args,**kw):\n ''\n\n\n\n \n pass\n", []], "base64": [".py", "#! /usr/bin/env python3\n\n\"\"\"Base16, Base32, Base64 (RFC 3548), Base85 and Ascii85 data encodings\"\"\"\n\n\n\n\n\nimport re\nimport struct\nimport binascii\n\n\n__all__=[\n\n'encode','decode','encodebytes','decodebytes',\n\n'b64encode','b64decode','b32encode','b32decode',\n'b32hexencode','b32hexdecode','b16encode','b16decode',\n\n'b85encode','b85decode','a85encode','a85decode',\n\n'standard_b64encode','standard_b64decode',\n\n\n\n\n'urlsafe_b64encode','urlsafe_b64decode',\n]\n\n\nbytes_types=(bytes,bytearray)\n\ndef _bytes_from_decode_data(s):\n if isinstance(s,str):\n try:\n return s.encode('ascii')\n except UnicodeEncodeError:\n raise ValueError('string argument should contain only ASCII characters')\n if isinstance(s,bytes_types):\n return s\n try:\n return memoryview(s).tobytes()\n except TypeError:\n raise TypeError(\"argument should be a bytes-like object or ASCII \"\n \"string, not %r\"%s.__class__.__name__)from None\n \n \n \n \ndef b64encode(s,altchars=None):\n ''\n\n\n\n\n \n encoded=binascii.b2a_base64(s,newline=False)\n if altchars is not None:\n assert len(altchars)==2,repr(altchars)\n return encoded.translate(bytes.maketrans(b'+/',altchars))\n return encoded\n \n \ndef b64decode(s,altchars=None,validate=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n s=_bytes_from_decode_data(s)\n if altchars is not None:\n altchars=_bytes_from_decode_data(altchars)\n assert len(altchars)==2,repr(altchars)\n s=s.translate(bytes.maketrans(altchars,b'+/'))\n return binascii.a2b_base64(s,strict_mode=validate)\n \n \ndef standard_b64encode(s):\n ''\n\n\n \n return b64encode(s)\n \ndef standard_b64decode(s):\n ''\n\n\n\n\n\n \n return b64decode(s)\n \n \n_urlsafe_encode_translation=bytes.maketrans(b'+/',b'-_')\n_urlsafe_decode_translation=bytes.maketrans(b'-_',b'+/')\n\ndef urlsafe_b64encode(s):\n ''\n\n\n\n\n \n return b64encode(s).translate(_urlsafe_encode_translation)\n \ndef urlsafe_b64decode(s):\n ''\n\n\n\n\n\n\n\n\n \n s=_bytes_from_decode_data(s)\n s=s.translate(_urlsafe_decode_translation)\n return b64decode(s)\n \n \n \n \n_B32_ENCODE_DOCSTRING='''\nEncode the bytes-like objects using {encoding} and return a bytes object.\n'''\n_B32_DECODE_DOCSTRING='''\nDecode the {encoding} encoded bytes-like object or ASCII string s.\n\nOptional casefold is a flag specifying whether a lowercase alphabet is\nacceptable as input. For security purposes, the default is False.\n{extra_args}\nThe result is returned as a bytes object. A binascii.Error is raised if\nthe input is incorrectly padded or if there are non-alphabet\ncharacters present in the input.\n'''\n_B32_DECODE_MAP01_DOCSTRING='''\nRFC 3548 allows for optional mapping of the digit 0 (zero) to the\nletter O (oh), and for optional mapping of the digit 1 (one) to\neither the letter I (eye) or letter L (el). The optional argument\nmap01 when not None, specifies which letter the digit 1 should be\nmapped to (when map01 is not None, the digit 0 is always mapped to\nthe letter O). For security purposes the default is None, so that\n0 and 1 are not allowed in the input.\n'''\n_b32alphabet=b'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'\n_b32hexalphabet=b'0123456789ABCDEFGHIJKLMNOPQRSTUV'\n_b32tab2={}\n_b32rev={}\n\ndef _b32encode(alphabet,s):\n global _b32tab2\n \n \n if alphabet not in _b32tab2:\n b32tab=[bytes((i,))for i in alphabet]\n _b32tab2[alphabet]=[a+b for a in b32tab for b in b32tab]\n b32tab=None\n \n if not isinstance(s,bytes_types):\n s=memoryview(s).tobytes()\n leftover=len(s)%5\n \n if leftover:\n s=s+b'\\0'*(5 -leftover)\n encoded=bytearray()\n from_bytes=int.from_bytes\n b32tab2=_b32tab2[alphabet]\n for i in range(0,len(s),5):\n c=from_bytes(s[i:i+5])\n encoded +=(b32tab2[c >>30]+\n b32tab2[(c >>20)&0x3ff]+\n b32tab2[(c >>10)&0x3ff]+\n b32tab2[c&0x3ff]\n )\n \n if leftover ==1:\n encoded[-6:]=b'======'\n elif leftover ==2:\n encoded[-4:]=b'===='\n elif leftover ==3:\n encoded[-3:]=b'==='\n elif leftover ==4:\n encoded[-1:]=b'='\n return bytes(encoded)\n \ndef _b32decode(alphabet,s,casefold=False,map01=None):\n global _b32rev\n \n \n if alphabet not in _b32rev:\n _b32rev[alphabet]={v:k for k,v in enumerate(alphabet)}\n s=_bytes_from_decode_data(s)\n if len(s)%8:\n raise binascii.Error('Incorrect padding')\n \n \n \n if map01 is not None:\n map01=_bytes_from_decode_data(map01)\n assert len(map01)==1,repr(map01)\n s=s.translate(bytes.maketrans(b'01',b'O'+map01))\n if casefold:\n s=s.upper()\n \n \n \n l=len(s)\n s=s.rstrip(b'=')\n padchars=l -len(s)\n \n decoded=bytearray()\n b32rev=_b32rev[alphabet]\n for i in range(0,len(s),8):\n quanta=s[i:i+8]\n acc=0\n try:\n for c in quanta:\n acc=(acc <<5)+b32rev[c]\n except KeyError:\n raise binascii.Error('Non-base32 digit found')from None\n decoded +=acc.to_bytes(5)\n \n if l %8 or padchars not in{0,1,3,4,6}:\n raise binascii.Error('Incorrect padding')\n if padchars and decoded:\n acc <<=5 *padchars\n last=acc.to_bytes(5)\n leftover=(43 -5 *padchars)//8\n decoded[-5:]=last[:leftover]\n return bytes(decoded)\n \n \ndef b32encode(s):\n return _b32encode(_b32alphabet,s)\nb32encode.__doc__=_B32_ENCODE_DOCSTRING.format(encoding='base32')\n\ndef b32decode(s,casefold=False,map01=None):\n return _b32decode(_b32alphabet,s,casefold,map01)\nb32decode.__doc__=_B32_DECODE_DOCSTRING.format(encoding='base32',\nextra_args=_B32_DECODE_MAP01_DOCSTRING)\n\ndef b32hexencode(s):\n return _b32encode(_b32hexalphabet,s)\nb32hexencode.__doc__=_B32_ENCODE_DOCSTRING.format(encoding='base32hex')\n\ndef b32hexdecode(s,casefold=False):\n\n return _b32decode(_b32hexalphabet,s,casefold)\nb32hexdecode.__doc__=_B32_DECODE_DOCSTRING.format(encoding='base32hex',\nextra_args='')\n\n\n\n\n\ndef b16encode(s):\n ''\n \n return binascii.hexlify(s).upper()\n \n \ndef b16decode(s,casefold=False):\n ''\n\n\n\n\n\n\n\n \n s=_bytes_from_decode_data(s)\n if casefold:\n s=s.upper()\n if re.search(b'[^0-9A-F]',s):\n raise binascii.Error('Non-base16 digit found')\n return binascii.unhexlify(s)\n \n \n \n \n \n_a85chars=None\n_a85chars2=None\n_A85START=b\"<~\"\n_A85END=b\"~>\"\n\ndef _85encode(b,chars,chars2,pad=False,foldnuls=False,foldspaces=False):\n\n if not isinstance(b,bytes_types):\n b=memoryview(b).tobytes()\n \n padding=(-len(b))%4\n if padding:\n b=b+b'\\0'*padding\n words=struct.Struct('!%dI'%(len(b)//4)).unpack(b)\n \n chunks=[b'z'if foldnuls and not word else\n b'y'if foldspaces and word ==0x20202020 else\n (chars2[word //614125]+\n chars2[word //85 %7225]+\n chars[word %85])\n for word in words]\n \n if padding and not pad:\n if chunks[-1]==b'z':\n chunks[-1]=chars[0]*5\n chunks[-1]=chunks[-1][:-padding]\n \n return b''.join(chunks)\n \ndef a85encode(b,*,foldspaces=False,wrapcol=0,pad=False,adobe=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global _a85chars,_a85chars2\n \n \n if _a85chars2 is None:\n _a85chars=[bytes((i,))for i in range(33,118)]\n _a85chars2=[(a+b)for a in _a85chars for b in _a85chars]\n \n result=_85encode(b,_a85chars,_a85chars2,pad,True,foldspaces)\n \n if adobe:\n result=_A85START+result\n if wrapcol:\n wrapcol=max(2 if adobe else 1,wrapcol)\n chunks=[result[i:i+wrapcol]\n for i in range(0,len(result),wrapcol)]\n if adobe:\n if len(chunks[-1])+2 >wrapcol:\n chunks.append(b'')\n result=b'\\n'.join(chunks)\n if adobe:\n result +=_A85END\n \n return result\n \ndef a85decode(b,*,foldspaces=False,adobe=False,ignorechars=b' \\t\\n\\r\\v'):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n b=_bytes_from_decode_data(b)\n if adobe:\n if not b.endswith(_A85END):\n raise ValueError(\n \"Ascii85 encoded byte sequences must end \"\n \"with {!r}\".format(_A85END)\n )\n if b.startswith(_A85START):\n b=b[2:-2]\n else:\n b=b[:-2]\n \n \n \n \n packI=struct.Struct('!I').pack\n decoded=[]\n decoded_append=decoded.append\n curr=[]\n curr_append=curr.append\n curr_clear=curr.clear\n for x in b+b'u'*4:\n if b'!'[0]<=x <=b'u'[0]:\n curr_append(x)\n if len(curr)==5:\n acc=0\n for x in curr:\n acc=85 *acc+(x -33)\n try:\n decoded_append(packI(acc))\n except struct.error:\n raise ValueError('Ascii85 overflow')from None\n curr_clear()\n elif x ==b'z'[0]:\n if curr:\n raise ValueError('z inside Ascii85 5-tuple')\n decoded_append(b'\\0\\0\\0\\0')\n elif foldspaces and x ==b'y'[0]:\n if curr:\n raise ValueError('y inside Ascii85 5-tuple')\n decoded_append(b'\\x20\\x20\\x20\\x20')\n elif x in ignorechars:\n \n continue\n else:\n raise ValueError('Non-Ascii85 digit found: %c'%x)\n \n result=b''.join(decoded)\n padding=4 -len(curr)\n if padding:\n \n result=result[:-padding]\n return result\n \n \n \n_b85alphabet=(b\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\"\nb\"abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~\")\n_b85chars=None\n_b85chars2=None\n_b85dec=None\n\ndef b85encode(b,pad=False):\n ''\n\n\n\n \n global _b85chars,_b85chars2\n \n \n if _b85chars2 is None:\n _b85chars=[bytes((i,))for i in _b85alphabet]\n _b85chars2=[(a+b)for a in _b85chars for b in _b85chars]\n return _85encode(b,_b85chars,_b85chars2,pad)\n \ndef b85decode(b):\n ''\n\n\n \n global _b85dec\n \n \n if _b85dec is None:\n _b85dec=[None]*256\n for i,c in enumerate(_b85alphabet):\n _b85dec[c]=i\n \n b=_bytes_from_decode_data(b)\n padding=(-len(b))%5\n b=b+b'~'*padding\n out=[]\n packI=struct.Struct('!I').pack\n for i in range(0,len(b),5):\n chunk=b[i:i+5]\n acc=0\n try:\n for c in chunk:\n acc=acc *85+_b85dec[c]\n except TypeError:\n for j,c in enumerate(chunk):\n if _b85dec[c]is None:\n raise ValueError('bad base85 character at position %d'\n %(i+j))from None\n raise\n try:\n out.append(packI(acc))\n except struct.error:\n raise ValueError('base85 overflow in hunk starting at byte %d'\n %i)from None\n \n result=b''.join(out)\n if padding:\n result=result[:-padding]\n return result\n \n \n \n \n \nMAXLINESIZE=76\nMAXBINSIZE=(MAXLINESIZE //4)*3\n\ndef encode(input,output):\n ''\n while s :=input.read(MAXBINSIZE):\n while len(s)\":\n return filename\n canonic=self.fncache.get(filename)\n if not canonic:\n canonic=os.path.abspath(filename)\n canonic=os.path.normcase(canonic)\n self.fncache[filename]=canonic\n return canonic\n \n def reset(self):\n ''\n import linecache\n linecache.checkcache()\n self.botframe=None\n self._set_stopinfo(None,None)\n \n def trace_dispatch(self,frame,event,arg):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self.quitting:\n return\n if event =='line':\n return self.dispatch_line(frame)\n if event =='call':\n return self.dispatch_call(frame,arg)\n if event =='return':\n return self.dispatch_return(frame,arg)\n if event =='exception':\n return self.dispatch_exception(frame,arg)\n if event =='c_call':\n return self.trace_dispatch\n if event =='c_exception':\n return self.trace_dispatch\n if event =='c_return':\n return self.trace_dispatch\n print('bdb.Bdb.dispatch: unknown debugging event:',repr(event))\n return self.trace_dispatch\n \n def dispatch_line(self,frame):\n ''\n\n\n\n\n \n if self.stop_here(frame)or self.break_here(frame):\n self.user_line(frame)\n if self.quitting:raise BdbQuit\n return self.trace_dispatch\n \n def dispatch_call(self,frame,arg):\n ''\n\n\n\n\n \n \n if self.botframe is None:\n \n self.botframe=frame.f_back\n return self.trace_dispatch\n if not(self.stop_here(frame)or self.break_anywhere(frame)):\n \n return\n \n if self.stopframe and frame.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS:\n return self.trace_dispatch\n self.user_call(frame,arg)\n if self.quitting:raise BdbQuit\n return self.trace_dispatch\n \n def dispatch_return(self,frame,arg):\n ''\n\n\n\n\n \n if self.stop_here(frame)or frame ==self.returnframe:\n \n if self.stopframe and frame.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS:\n return self.trace_dispatch\n try:\n self.frame_returning=frame\n self.user_return(frame,arg)\n finally:\n self.frame_returning=None\n if self.quitting:raise BdbQuit\n \n if self.stopframe is frame and self.stoplineno !=-1:\n self._set_stopinfo(None,None)\n return self.trace_dispatch\n \n def dispatch_exception(self,frame,arg):\n ''\n\n\n\n\n \n if self.stop_here(frame):\n \n \n \n if not(frame.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS\n and arg[0]is StopIteration and arg[2]is None):\n self.user_exception(frame,arg)\n if self.quitting:raise BdbQuit\n \n \n \n \n elif(self.stopframe and frame is not self.stopframe\n and self.stopframe.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS\n and arg[0]in(StopIteration,GeneratorExit)):\n self.user_exception(frame,arg)\n if self.quitting:raise BdbQuit\n \n return self.trace_dispatch\n \n \n \n \n \n def is_skipped_module(self,module_name):\n ''\n if module_name is None:\n return False\n for pattern in self.skip:\n if fnmatch.fnmatch(module_name,pattern):\n return True\n return False\n \n def stop_here(self,frame):\n ''\n \n \n if self.skip and\\\n self.is_skipped_module(frame.f_globals.get('__name__')):\n return False\n if frame is self.stopframe:\n if self.stoplineno ==-1:\n return False\n return frame.f_lineno >=self.stoplineno\n if not self.stopframe:\n return True\n return False\n \n def break_here(self,frame):\n ''\n\n\n\n \n filename=self.canonic(frame.f_code.co_filename)\n if filename not in self.breaks:\n return False\n lineno=frame.f_lineno\n if lineno not in self.breaks[filename]:\n \n \n lineno=frame.f_code.co_firstlineno\n if lineno not in self.breaks[filename]:\n return False\n \n \n (bp,flag)=effective(filename,lineno,frame)\n if bp:\n self.currentbp=bp.number\n if(flag and bp.temporary):\n self.do_clear(str(bp.number))\n return True\n else:\n return False\n \n def do_clear(self,arg):\n ''\n\n\n \n raise NotImplementedError(\"subclass of bdb must implement do_clear()\")\n \n def break_anywhere(self,frame):\n ''\n \n return self.canonic(frame.f_code.co_filename)in self.breaks\n \n \n \n \n def user_call(self,frame,argument_list):\n ''\n pass\n \n def user_line(self,frame):\n ''\n pass\n \n def user_return(self,frame,return_value):\n ''\n pass\n \n def user_exception(self,frame,exc_info):\n ''\n pass\n \n def _set_stopinfo(self,stopframe,returnframe,stoplineno=0):\n ''\n\n\n\n\n \n self.stopframe=stopframe\n self.returnframe=returnframe\n self.quitting=False\n \n \n self.stoplineno=stoplineno\n \n \n \n \n def set_until(self,frame,lineno=None):\n ''\n \n \n if lineno is None:\n lineno=frame.f_lineno+1\n self._set_stopinfo(frame,frame,lineno)\n \n def set_step(self):\n ''\n \n \n \n \n if self.frame_returning:\n caller_frame=self.frame_returning.f_back\n if caller_frame and not caller_frame.f_trace:\n caller_frame.f_trace=self.trace_dispatch\n self._set_stopinfo(None,None)\n \n def set_next(self,frame):\n ''\n self._set_stopinfo(frame,None)\n \n def set_return(self,frame):\n ''\n if frame.f_code.co_flags&GENERATOR_AND_COROUTINE_FLAGS:\n self._set_stopinfo(frame,None,-1)\n else:\n self._set_stopinfo(frame.f_back,frame)\n \n def set_trace(self,frame=None):\n ''\n\n\n \n if frame is None:\n frame=sys._getframe().f_back\n self.reset()\n while frame:\n frame.f_trace=self.trace_dispatch\n self.botframe=frame\n frame=frame.f_back\n self.set_step()\n sys.settrace(self.trace_dispatch)\n \n def set_continue(self):\n ''\n\n\n \n \n self._set_stopinfo(self.botframe,None,-1)\n if not self.breaks:\n \n sys.settrace(None)\n frame=sys._getframe().f_back\n while frame and frame is not self.botframe:\n del frame.f_trace\n frame=frame.f_back\n \n def set_quit(self):\n ''\n\n\n \n self.stopframe=self.botframe\n self.returnframe=None\n self.quitting=True\n sys.settrace(None)\n \n \n \n \n \n \n \n \n def _add_to_breaks(self,filename,lineno):\n ''\n bp_linenos=self.breaks.setdefault(filename,[])\n if lineno not in bp_linenos:\n bp_linenos.append(lineno)\n \n def set_break(self,filename,lineno,temporary=False,cond=None,\n funcname=None):\n ''\n\n\n\n \n filename=self.canonic(filename)\n import linecache\n line=linecache.getline(filename,lineno)\n if not line:\n return 'Line %s:%d does not exist'%(filename,lineno)\n self._add_to_breaks(filename,lineno)\n bp=Breakpoint(filename,lineno,temporary,cond,funcname)\n return None\n \n def _load_breaks(self):\n ''\n\n\n\n\n\n \n for(filename,lineno)in Breakpoint.bplist.keys():\n self._add_to_breaks(filename,lineno)\n \n def _prune_breaks(self,filename,lineno):\n ''\n\n\n\n\n\n \n if(filename,lineno)not in Breakpoint.bplist:\n self.breaks[filename].remove(lineno)\n if not self.breaks[filename]:\n del self.breaks[filename]\n \n def clear_break(self,filename,lineno):\n ''\n\n\n \n filename=self.canonic(filename)\n if filename not in self.breaks:\n return 'There are no breakpoints in %s'%filename\n if lineno not in self.breaks[filename]:\n return 'There is no breakpoint at %s:%d'%(filename,lineno)\n \n \n for bp in Breakpoint.bplist[filename,lineno][:]:\n bp.deleteMe()\n self._prune_breaks(filename,lineno)\n return None\n \n def clear_bpbynumber(self,arg):\n ''\n\n\n \n try:\n bp=self.get_bpbynumber(arg)\n except ValueError as err:\n return str(err)\n bp.deleteMe()\n self._prune_breaks(bp.file,bp.line)\n return None\n \n def clear_all_file_breaks(self,filename):\n ''\n\n\n \n filename=self.canonic(filename)\n if filename not in self.breaks:\n return 'There are no breakpoints in %s'%filename\n for line in self.breaks[filename]:\n blist=Breakpoint.bplist[filename,line]\n for bp in blist:\n bp.deleteMe()\n del self.breaks[filename]\n return None\n \n def clear_all_breaks(self):\n ''\n\n\n \n if not self.breaks:\n return 'There are no breakpoints'\n for bp in Breakpoint.bpbynumber:\n if bp:\n bp.deleteMe()\n self.breaks={}\n return None\n \n def get_bpbynumber(self,arg):\n ''\n\n\n\n \n if not arg:\n raise ValueError('Breakpoint number expected')\n try:\n number=int(arg)\n except ValueError:\n raise ValueError('Non-numeric breakpoint number %s'%arg)from None\n try:\n bp=Breakpoint.bpbynumber[number]\n except IndexError:\n raise ValueError('Breakpoint number %d out of range'%number)from None\n if bp is None:\n raise ValueError('Breakpoint %d already deleted'%number)\n return bp\n \n def get_break(self,filename,lineno):\n ''\n filename=self.canonic(filename)\n return filename in self.breaks and\\\n lineno in self.breaks[filename]\n \n def get_breaks(self,filename,lineno):\n ''\n\n\n \n filename=self.canonic(filename)\n return filename in self.breaks and\\\n lineno in self.breaks[filename]and\\\n Breakpoint.bplist[filename,lineno]or[]\n \n def get_file_breaks(self,filename):\n ''\n\n\n \n filename=self.canonic(filename)\n if filename in self.breaks:\n return self.breaks[filename]\n else:\n return[]\n \n def get_all_breaks(self):\n ''\n return self.breaks\n \n \n \n \n def get_stack(self,f,t):\n ''\n\n\n\n \n stack=[]\n if t and t.tb_frame is f:\n t=t.tb_next\n while f is not None:\n stack.append((f,f.f_lineno))\n if f is self.botframe:\n break\n f=f.f_back\n stack.reverse()\n i=max(0,len(stack)-1)\n while t is not None:\n stack.append((t.tb_frame,t.tb_lineno))\n t=t.tb_next\n if f is None:\n i=max(0,len(stack)-1)\n return stack,i\n \n def format_stack_entry(self,frame_lineno,lprefix=': '):\n ''\n\n\n\n\n\n\n \n import linecache,reprlib\n frame,lineno=frame_lineno\n filename=self.canonic(frame.f_code.co_filename)\n s='%s(%r)'%(filename,lineno)\n if frame.f_code.co_name:\n s +=frame.f_code.co_name\n else:\n s +=\"\"\n s +='()'\n if '__return__'in frame.f_locals:\n rv=frame.f_locals['__return__']\n s +='->'\n s +=reprlib.repr(rv)\n if lineno is not None:\n line=linecache.getline(filename,lineno,frame.f_globals)\n if line:\n s +=lprefix+line.strip()\n else:\n s +=f'{lprefix}Warning: lineno is None'\n return s\n \n \n \n \n \n def run(self,cmd,globals=None,locals=None):\n ''\n\n\n \n if globals is None:\n import __main__\n globals=__main__.__dict__\n if locals is None:\n locals=globals\n self.reset()\n if isinstance(cmd,str):\n cmd=compile(cmd,\"\",\"exec\")\n sys.settrace(self.trace_dispatch)\n try:\n exec(cmd,globals,locals)\n except BdbQuit:\n pass\n finally:\n self.quitting=True\n sys.settrace(None)\n \n def runeval(self,expr,globals=None,locals=None):\n ''\n\n\n \n if globals is None:\n import __main__\n globals=__main__.__dict__\n if locals is None:\n locals=globals\n self.reset()\n sys.settrace(self.trace_dispatch)\n try:\n return eval(expr,globals,locals)\n except BdbQuit:\n pass\n finally:\n self.quitting=True\n sys.settrace(None)\n \n def runctx(self,cmd,globals,locals):\n ''\n \n self.run(cmd,globals,locals)\n \n \n \n def runcall(self,func,/,*args,**kwds):\n ''\n\n\n \n self.reset()\n sys.settrace(self.trace_dispatch)\n res=None\n try:\n res=func(*args,**kwds)\n except BdbQuit:\n pass\n finally:\n self.quitting=True\n sys.settrace(None)\n return res\n \n \ndef set_trace():\n ''\n Bdb().set_trace()\n \n \nclass Breakpoint:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n next=1\n bplist={}\n bpbynumber=[None]\n \n \n \n def __init__(self,file,line,temporary=False,cond=None,funcname=None):\n self.funcname=funcname\n \n self.func_first_executable_line=None\n self.file=file\n self.line=line\n self.temporary=temporary\n self.cond=cond\n self.enabled=True\n self.ignore=0\n self.hits=0\n self.number=Breakpoint.next\n Breakpoint.next +=1\n \n self.bpbynumber.append(self)\n if(file,line)in self.bplist:\n self.bplist[file,line].append(self)\n else:\n self.bplist[file,line]=[self]\n \n @staticmethod\n def clearBreakpoints():\n Breakpoint.next=1\n Breakpoint.bplist={}\n Breakpoint.bpbynumber=[None]\n \n def deleteMe(self):\n ''\n\n\n\n \n \n index=(self.file,self.line)\n self.bpbynumber[self.number]=None\n self.bplist[index].remove(self)\n if not self.bplist[index]:\n \n del self.bplist[index]\n \n def enable(self):\n ''\n self.enabled=True\n \n def disable(self):\n ''\n self.enabled=False\n \n def bpprint(self,out=None):\n ''\n\n\n\n \n if out is None:\n out=sys.stdout\n print(self.bpformat(),file=out)\n \n def bpformat(self):\n ''\n\n\n\n\n\n \n if self.temporary:\n disp='del '\n else:\n disp='keep '\n if self.enabled:\n disp=disp+'yes '\n else:\n disp=disp+'no '\n ret='%-4dbreakpoint %s at %s:%d'%(self.number,disp,\n self.file,self.line)\n if self.cond:\n ret +='\\n\\tstop only if %s'%(self.cond,)\n if self.ignore:\n ret +='\\n\\tignore next %d hits'%(self.ignore,)\n if self.hits:\n if self.hits >1:\n ss='s'\n else:\n ss=''\n ret +='\\n\\tbreakpoint already hit %d time%s'%(self.hits,ss)\n return ret\n \n def __str__(self):\n ''\n return 'breakpoint %s at %s:%s'%(self.number,self.file,self.line)\n \n \n \n \ndef checkfuncname(b,frame):\n ''\n\n\n\n\n\n \n if not b.funcname:\n \n if b.line !=frame.f_lineno:\n \n \n return False\n return True\n \n \n if frame.f_code.co_name !=b.funcname:\n \n return False\n \n \n if not b.func_first_executable_line:\n \n b.func_first_executable_line=frame.f_lineno\n \n if b.func_first_executable_line !=frame.f_lineno:\n \n return False\n return True\n \n \ndef effective(file,line,frame):\n ''\n\n\n\n\n\n\n\n\n\n\n \n possibles=Breakpoint.bplist[file,line]\n for b in possibles:\n if not b.enabled:\n continue\n if not checkfuncname(b,frame):\n continue\n \n b.hits +=1\n if not b.cond:\n \n if b.ignore >0:\n b.ignore -=1\n continue\n else:\n \n return(b,True)\n else:\n \n \n \n try:\n val=eval(b.cond,frame.f_globals,frame.f_locals)\n if val:\n if b.ignore >0:\n b.ignore -=1\n \n else:\n return(b,True)\n \n \n except:\n \n \n \n return(b,False)\n return(None,None)\n \n \n \n \nclass Tdb(Bdb):\n def user_call(self,frame,args):\n name=frame.f_code.co_name\n if not name:name='???'\n print('+++ call',name,args)\n def user_line(self,frame):\n import linecache\n name=frame.f_code.co_name\n if not name:name='???'\n fn=self.canonic(frame.f_code.co_filename)\n line=linecache.getline(fn,frame.f_lineno,frame.f_globals)\n print('+++',fn,frame.f_lineno,name,':',line.strip())\n def user_return(self,frame,retval):\n print('+++ return',retval)\n def user_exception(self,frame,exc_stuff):\n print('+++ exception',exc_stuff)\n self.set_continue()\n \ndef foo(n):\n print('foo(',n,')')\n x=bar(n *10)\n print('bar returned',x)\n \ndef bar(a):\n print('bar(',a,')')\n return a /2\n \ndef test():\n t=Tdb()\n t.run('import bdb; bdb.foo(10)')\n", ["__main__", "fnmatch", "inspect", "linecache", "os", "reprlib", "sys"]], "binascii": [".py", "''\n\n\n\n\n\n\n\nimport _base64\n\nfrom _binascii import *\n\nclass Error(ValueError):\n def __init__(self,msg=''):\n self._msg=msg\n \n def __str__(self):\n return \" binascii.Error: \"+self._msg\n \n \nclass Done(Exception):\n pass\n \nclass Incomplete(Error):\n pass\n \ndef a2b_uu(s):\n if not s:\n return ''\n \n length=(ord(s[0])-0x20)%64\n \n def quadruplets_gen(s):\n while s:\n try :\n yield ord(s[0]),ord(s[1]),ord(s[2]),ord(s[3])\n except IndexError:\n s +=' '\n yield ord(s[0]),ord(s[1]),ord(s[2]),ord(s[3])\n return\n s=s[4:]\n \n try :\n result=[''.join(\n [chr((A -0x20)<<2 |(((B -0x20)>>4)&0x3)),\n chr(((B -0x20)&0xf)<<4 |(((C -0x20)>>2)&0xf)),\n chr(((C -0x20)&0x3)<<6 |((D -0x20)&0x3f))\n ])for A,B,C,D in quadruplets_gen(s[1:].rstrip())]\n except ValueError:\n raise Error('Illegal char')\n result=''.join(result)\n trailingdata=result[length:]\n if trailingdata.strip('\\x00'):\n raise Error('Trailing garbage')\n result=result[:length]\n if len(result)>2)&0x3F],\n table_b2a_base64[((A <<4)|((B >>4)&0xF))&0x3F],\n table_b2a_base64[((B <<2)|((C >>6)&0x3))&0x3F],\n table_b2a_base64[(C)&0x3F]])\n for A,B,C in a]\n \n final=s[length -final_length:]\n if final_length ==0:\n snippet=''\n elif final_length ==1:\n a=final[0]\n snippet=table_b2a_base64[(a >>2)&0x3F]+\\\n table_b2a_base64[(a <<4)&0x3F]+'=='\n else :\n a=final[0]\n b=final[1]\n snippet=table_b2a_base64[(a >>2)&0x3F]+\\\n table_b2a_base64[((a <<4)|(b >>4)&0xF)&0x3F]+\\\n table_b2a_base64[(b <<2)&0x3F]+'='\n \n result=''.join(result)+snippet\n if newline:\n result +='\\n'\n return bytes(result,__BRYTHON__.charset)\n \ndef a2b_qp(s,header=False ):\n inp=0\n odata=[]\n while inp =len(s):\n break\n \n if (s[inp]=='\\n')or (s[inp]=='\\r'):\n if s[inp]!='\\n':\n while inp 0 and data[lf -1]=='\\r'\n \n inp=0\n linelen=0\n odata=[]\n while inp '~'or\n c =='='or\n (header and c =='_')or\n (c =='.'and linelen ==0 and (inp+1 ==len(data)or\n data[inp+1]=='\\n'or\n data[inp+1]=='\\r'))or\n (not istext and (c =='\\r'or c =='\\n'))or\n ((c =='\\t'or c ==' ')and (inp+1 ==len(data)))or\n (c <=' 'and c !='\\r'and c !='\\n'and\n (quotetabs or (not quotetabs and (c !='\\t'and c !=' '))))):\n linelen +=3\n if linelen >=MAXLINESIZE:\n odata.append('=')\n if crlf:odata.append('\\r')\n odata.append('\\n')\n linelen=3\n odata.append('='+two_hex_digits(ord(c)))\n inp +=1\n else :\n if (istext and\n (c =='\\n'or (inp+1 0 and\n (odata[-1]==' 'or odata[-1]=='\\t')):\n ch=ord(odata[-1])\n odata[-1]='='\n odata.append(two_hex_digits(ch))\n \n if crlf:odata.append('\\r')\n odata.append('\\n')\n if c =='\\r':\n inp +=2\n else :\n inp +=1\n else :\n if (inp+1 =MAXLINESIZE):\n odata.append('=')\n if crlf:odata.append('\\r')\n odata.append('\\n')\n linelen=0\n \n linelen +=1\n if header and c ==' ':\n c='_'\n odata.append(c)\n inp +=1\n return ''.join(odata)\n \nhex_numbers='0123456789ABCDEF'\ndef hex(n):\n if n ==0:\n return '0'\n \n if n <0:\n n=-n\n sign='-'\n else :\n sign=''\n arr=[]\n \n def hex_gen(n):\n ''\n while n:\n yield n %0x10\n n=n /0x10\n \n for nibble in hex_gen(n):\n arr=[hex_numbers[nibble]]+arr\n return sign+''.join(arr)\n \ndef two_hex_digits(n):\n return hex_numbers[n /0x10]+hex_numbers[n %0x10]\n \n \ndef strhex_to_int(s):\n i=0\n for c in s:\n i=i *0x10+hex_numbers.index(c)\n return i\n \nhqx_encoding='!\"#$%&\\'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr'\n\nDONE=0x7f\nSKIP=0x7e\nFAIL=0x7d\n\ntable_a2b_hqx=[\n\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\n\nFAIL,FAIL,SKIP,FAIL,FAIL,SKIP,FAIL,FAIL,\n\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\n\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\n\nFAIL,0x00,0x01,0x02,0x03,0x04,0x05,0x06,\n\n0x07,0x08,0x09,0x0A,0x0B,0x0C,FAIL,FAIL,\n\n0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,FAIL,\n\n0x14,0x15,DONE,FAIL,FAIL,FAIL,FAIL,FAIL,\n\n0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,\n\n0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,FAIL,\n\n0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,FAIL,\n\n0x2C,0x2D,0x2E,0x2F,FAIL,FAIL,FAIL,FAIL,\n\n0x30,0x31,0x32,0x33,0x34,0x35,0x36,FAIL,\n\n0x37,0x38,0x39,0x3A,0x3B,0x3C,FAIL,FAIL,\n\n0x3D,0x3E,0x3F,FAIL,FAIL,FAIL,FAIL,FAIL,\n\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\nFAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,\n]\n\ndef a2b_hqx(s):\n result=[]\n \n def quadruples_gen(s):\n t=[]\n for c in s:\n res=table_a2b_hqx[ord(c)]\n if res ==SKIP:\n continue\n elif res ==FAIL:\n raise Error('Illegal character')\n elif res ==DONE:\n yield t\n raise Done\n else :\n t.append(res)\n if len(t)==4:\n yield t\n t=[]\n yield t\n \n done=0\n try :\n for snippet in quadruples_gen(s):\n length=len(snippet)\n if length ==4:\n result.append(chr(((snippet[0]&0x3f)<<2)|(snippet[1]>>4)))\n result.append(chr(((snippet[1]&0x0f)<<4)|(snippet[2]>>2)))\n result.append(chr(((snippet[2]&0x03)<<6)|(snippet[3])))\n elif length ==3:\n result.append(chr(((snippet[0]&0x3f)<<2)|(snippet[1]>>4)))\n result.append(chr(((snippet[1]&0x0f)<<4)|(snippet[2]>>2)))\n elif length ==2:\n result.append(chr(((snippet[0]&0x3f)<<2)|(snippet[1]>>4)))\n except Done:\n done=1\n except Error:\n raise\n return (''.join(result),done)\n \n \n \ndef b2a_hqx(s):\n result=[]\n \n def triples_gen(s):\n while s:\n try :\n yield ord(s[0]),ord(s[1]),ord(s[2])\n except IndexError:\n yield tuple([ord(c)for c in s])\n s=s[3:]\n \n for snippet in triples_gen(s):\n length=len(snippet)\n if length ==3:\n result.append(\n hqx_encoding[(snippet[0]&0xfc)>>2])\n result.append(hqx_encoding[\n ((snippet[0]&0x03)<<4)|((snippet[1]&0xf0)>>4)])\n result.append(hqx_encoding[\n (snippet[1]&0x0f)<<2 |((snippet[2]&0xc0)>>6)])\n result.append(hqx_encoding[snippet[2]&0x3f])\n elif length ==2:\n result.append(\n hqx_encoding[(snippet[0]&0xfc)>>2])\n result.append(hqx_encoding[\n ((snippet[0]&0x03)<<4)|((snippet[1]&0xf0)>>4)])\n result.append(hqx_encoding[\n (snippet[1]&0x0f)<<2])\n elif length ==1:\n result.append(\n hqx_encoding[(snippet[0]&0xfc)>>2])\n result.append(hqx_encoding[\n ((snippet[0]&0x03)<<4)])\n return ''.join(result)\n \ncrctab_hqx=[\n0x0000,0x1021,0x2042,0x3063,0x4084,0x50a5,0x60c6,0x70e7,\n0x8108,0x9129,0xa14a,0xb16b,0xc18c,0xd1ad,0xe1ce,0xf1ef,\n0x1231,0x0210,0x3273,0x2252,0x52b5,0x4294,0x72f7,0x62d6,\n0x9339,0x8318,0xb37b,0xa35a,0xd3bd,0xc39c,0xf3ff,0xe3de,\n0x2462,0x3443,0x0420,0x1401,0x64e6,0x74c7,0x44a4,0x5485,\n0xa56a,0xb54b,0x8528,0x9509,0xe5ee,0xf5cf,0xc5ac,0xd58d,\n0x3653,0x2672,0x1611,0x0630,0x76d7,0x66f6,0x5695,0x46b4,\n0xb75b,0xa77a,0x9719,0x8738,0xf7df,0xe7fe,0xd79d,0xc7bc,\n0x48c4,0x58e5,0x6886,0x78a7,0x0840,0x1861,0x2802,0x3823,\n0xc9cc,0xd9ed,0xe98e,0xf9af,0x8948,0x9969,0xa90a,0xb92b,\n0x5af5,0x4ad4,0x7ab7,0x6a96,0x1a71,0x0a50,0x3a33,0x2a12,\n0xdbfd,0xcbdc,0xfbbf,0xeb9e,0x9b79,0x8b58,0xbb3b,0xab1a,\n0x6ca6,0x7c87,0x4ce4,0x5cc5,0x2c22,0x3c03,0x0c60,0x1c41,\n0xedae,0xfd8f,0xcdec,0xddcd,0xad2a,0xbd0b,0x8d68,0x9d49,\n0x7e97,0x6eb6,0x5ed5,0x4ef4,0x3e13,0x2e32,0x1e51,0x0e70,\n0xff9f,0xefbe,0xdfdd,0xcffc,0xbf1b,0xaf3a,0x9f59,0x8f78,\n0x9188,0x81a9,0xb1ca,0xa1eb,0xd10c,0xc12d,0xf14e,0xe16f,\n0x1080,0x00a1,0x30c2,0x20e3,0x5004,0x4025,0x7046,0x6067,\n0x83b9,0x9398,0xa3fb,0xb3da,0xc33d,0xd31c,0xe37f,0xf35e,\n0x02b1,0x1290,0x22f3,0x32d2,0x4235,0x5214,0x6277,0x7256,\n0xb5ea,0xa5cb,0x95a8,0x8589,0xf56e,0xe54f,0xd52c,0xc50d,\n0x34e2,0x24c3,0x14a0,0x0481,0x7466,0x6447,0x5424,0x4405,\n0xa7db,0xb7fa,0x8799,0x97b8,0xe75f,0xf77e,0xc71d,0xd73c,\n0x26d3,0x36f2,0x0691,0x16b0,0x6657,0x7676,0x4615,0x5634,\n0xd94c,0xc96d,0xf90e,0xe92f,0x99c8,0x89e9,0xb98a,0xa9ab,\n0x5844,0x4865,0x7806,0x6827,0x18c0,0x08e1,0x3882,0x28a3,\n0xcb7d,0xdb5c,0xeb3f,0xfb1e,0x8bf9,0x9bd8,0xabbb,0xbb9a,\n0x4a75,0x5a54,0x6a37,0x7a16,0x0af1,0x1ad0,0x2ab3,0x3a92,\n0xfd2e,0xed0f,0xdd6c,0xcd4d,0xbdaa,0xad8b,0x9de8,0x8dc9,\n0x7c26,0x6c07,0x5c64,0x4c45,0x3ca2,0x2c83,0x1ce0,0x0cc1,\n0xef1f,0xff3e,0xcf5d,0xdf7c,0xaf9b,0xbfba,0x8fd9,0x9ff8,\n0x6e17,0x7e36,0x4e55,0x5e74,0x2e93,0x3eb2,0x0ed1,0x1ef0,\n]\n\ndef crc_hqx(s,crc):\n for c in s:\n crc=((crc <<8)&0xff00)^crctab_hqx[((crc >>8)&0xff)^ord(c)]\n \n return crc\n \ndef rlecode_hqx(s):\n ''\n\n\n\n \n if not s:\n return ''\n result=[]\n prev=s[0]\n count=1\n \n \n \n \n if s[-1]=='!':\n s=s[1:]+'?'\n else :\n s=s[1:]+'!'\n \n for c in s:\n if c ==prev and count <255:\n count +=1\n else :\n if count ==1:\n if prev !='\\x90':\n result.append(prev)\n else :\n result.extend(['\\x90','\\x00'])\n elif count <4:\n if prev !='\\x90':\n result.extend([prev]*count)\n else :\n result.extend(['\\x90','\\x00']*count)\n else :\n if prev !='\\x90':\n result.extend([prev,'\\x90',chr(count)])\n else :\n result.extend(['\\x90','\\x00','\\x90',chr(count)])\n count=1\n prev=c\n \n return ''.join(result)\n \ndef rledecode_hqx(s):\n s=s.split('\\x90')\n result=[s[0]]\n prev=s[0]\n for snippet in s[1:]:\n count=ord(snippet[0])\n if count >0:\n result.append(prev[-1]*(count -1))\n prev=snippet\n else :\n result.append('\\x90')\n prev='\\x90'\n result.append(snippet[1:])\n \n return ''.join(result)\n \ncrc_32_tab=[\n0x00000000,0x77073096,0xee0e612c,0x990951ba,0x076dc419,\n0x706af48f,0xe963a535,0x9e6495a3,0x0edb8832,0x79dcb8a4,\n0xe0d5e91e,0x97d2d988,0x09b64c2b,0x7eb17cbd,0xe7b82d07,\n0x90bf1d91,0x1db71064,0x6ab020f2,0xf3b97148,0x84be41de,\n0x1adad47d,0x6ddde4eb,0xf4d4b551,0x83d385c7,0x136c9856,\n0x646ba8c0,0xfd62f97a,0x8a65c9ec,0x14015c4f,0x63066cd9,\n0xfa0f3d63,0x8d080df5,0x3b6e20c8,0x4c69105e,0xd56041e4,\n0xa2677172,0x3c03e4d1,0x4b04d447,0xd20d85fd,0xa50ab56b,\n0x35b5a8fa,0x42b2986c,0xdbbbc9d6,0xacbcf940,0x32d86ce3,\n0x45df5c75,0xdcd60dcf,0xabd13d59,0x26d930ac,0x51de003a,\n0xc8d75180,0xbfd06116,0x21b4f4b5,0x56b3c423,0xcfba9599,\n0xb8bda50f,0x2802b89e,0x5f058808,0xc60cd9b2,0xb10be924,\n0x2f6f7c87,0x58684c11,0xc1611dab,0xb6662d3d,0x76dc4190,\n0x01db7106,0x98d220bc,0xefd5102a,0x71b18589,0x06b6b51f,\n0x9fbfe4a5,0xe8b8d433,0x7807c9a2,0x0f00f934,0x9609a88e,\n0xe10e9818,0x7f6a0dbb,0x086d3d2d,0x91646c97,0xe6635c01,\n0x6b6b51f4,0x1c6c6162,0x856530d8,0xf262004e,0x6c0695ed,\n0x1b01a57b,0x8208f4c1,0xf50fc457,0x65b0d9c6,0x12b7e950,\n0x8bbeb8ea,0xfcb9887c,0x62dd1ddf,0x15da2d49,0x8cd37cf3,\n0xfbd44c65,0x4db26158,0x3ab551ce,0xa3bc0074,0xd4bb30e2,\n0x4adfa541,0x3dd895d7,0xa4d1c46d,0xd3d6f4fb,0x4369e96a,\n0x346ed9fc,0xad678846,0xda60b8d0,0x44042d73,0x33031de5,\n0xaa0a4c5f,0xdd0d7cc9,0x5005713c,0x270241aa,0xbe0b1010,\n0xc90c2086,0x5768b525,0x206f85b3,0xb966d409,0xce61e49f,\n0x5edef90e,0x29d9c998,0xb0d09822,0xc7d7a8b4,0x59b33d17,\n0x2eb40d81,0xb7bd5c3b,0xc0ba6cad,0xedb88320,0x9abfb3b6,\n0x03b6e20c,0x74b1d29a,0xead54739,0x9dd277af,0x04db2615,\n0x73dc1683,0xe3630b12,0x94643b84,0x0d6d6a3e,0x7a6a5aa8,\n0xe40ecf0b,0x9309ff9d,0x0a00ae27,0x7d079eb1,0xf00f9344,\n0x8708a3d2,0x1e01f268,0x6906c2fe,0xf762575d,0x806567cb,\n0x196c3671,0x6e6b06e7,0xfed41b76,0x89d32be0,0x10da7a5a,\n0x67dd4acc,0xf9b9df6f,0x8ebeeff9,0x17b7be43,0x60b08ed5,\n0xd6d6a3e8,0xa1d1937e,0x38d8c2c4,0x4fdff252,0xd1bb67f1,\n0xa6bc5767,0x3fb506dd,0x48b2364b,0xd80d2bda,0xaf0a1b4c,\n0x36034af6,0x41047a60,0xdf60efc3,0xa867df55,0x316e8eef,\n0x4669be79,0xcb61b38c,0xbc66831a,0x256fd2a0,0x5268e236,\n0xcc0c7795,0xbb0b4703,0x220216b9,0x5505262f,0xc5ba3bbe,\n0xb2bd0b28,0x2bb45a92,0x5cb36a04,0xc2d7ffa7,0xb5d0cf31,\n0x2cd99e8b,0x5bdeae1d,0x9b64c2b0,0xec63f226,0x756aa39c,\n0x026d930a,0x9c0906a9,0xeb0e363f,0x72076785,0x05005713,\n0x95bf4a82,0xe2b87a14,0x7bb12bae,0x0cb61b38,0x92d28e9b,\n0xe5d5be0d,0x7cdcefb7,0x0bdbdf21,0x86d3d2d4,0xf1d4e242,\n0x68ddb3f8,0x1fda836e,0x81be16cd,0xf6b9265b,0x6fb077e1,\n0x18b74777,0x88085ae6,0xff0f6a70,0x66063bca,0x11010b5c,\n0x8f659eff,0xf862ae69,0x616bffd3,0x166ccf45,0xa00ae278,\n0xd70dd2ee,0x4e048354,0x3903b3c2,0xa7672661,0xd06016f7,\n0x4969474d,0x3e6e77db,0xaed16a4a,0xd9d65adc,0x40df0b66,\n0x37d83bf0,0xa9bcae53,0xdebb9ec5,0x47b2cf7f,0x30b5ffe9,\n0xbdbdf21c,0xcabac28a,0x53b39330,0x24b4a3a6,0xbad03605,\n0xcdd70693,0x54de5729,0x23d967bf,0xb3667a2e,0xc4614ab8,\n0x5d681b02,0x2a6f2b94,0xb40bbe37,0xc30c8ea1,0x5a05df1b,\n0x2d02ef8d\n]\n\ndef crc32(s,crc=0):\n result=0\n crc=~int(crc)&0xffffffff\n \n for c in s:\n crc=crc_32_tab[(crc ^int(ord(c)))&0xff]^(crc >>8)\n \n \n \n result=crc ^0xffffffff\n \n if result >2 **31:\n result=((result+2 **31)%2 **32)-2 **31\n \n return result\n", ["_base64", "_binascii"]], "bisect": [".py", "''\n\n\ndef insort_right(a,x,lo=0,hi=None,*,key=None):\n ''\n\n\n\n\n\n\n\n \n if key is None:\n lo=bisect_right(a,x,lo,hi)\n else:\n lo=bisect_right(a,key(x),lo,hi,key=key)\n a.insert(lo,x)\n \n \ndef bisect_right(a,x,lo=0,hi=None,*,key=None):\n ''\n\n\n\n\n\n\n\n\n\n \n \n if lo <0:\n raise ValueError('lo must be non-negative')\n if hi is None:\n hi=len(a)\n \n \n if key is None:\n while lo =9:\n names=day_name\n else:\n names=day_abbr\n return names[day][:width].center(width)\n \n def formatweekheader(self,width):\n ''\n\n \n return ' '.join(self.formatweekday(i,width)for i in self.iterweekdays())\n \n def formatmonthname(self,theyear,themonth,width,withyear=True):\n ''\n\n \n s=month_name[themonth]\n if withyear:\n s=\"%s %r\"%(s,theyear)\n return s.center(width)\n \n def prmonth(self,theyear,themonth,w=0,l=0):\n ''\n\n \n print(self.formatmonth(theyear,themonth,w,l),end='')\n \n def formatmonth(self,theyear,themonth,w=0,l=0):\n ''\n\n \n w=max(2,w)\n l=max(1,l)\n s=self.formatmonthname(theyear,themonth,7 *(w+1)-1)\n s=s.rstrip()\n s +='\\n'*l\n s +=self.formatweekheader(w).rstrip()\n s +='\\n'*l\n for week in self.monthdays2calendar(theyear,themonth):\n s +=self.formatweek(week,w).rstrip()\n s +='\\n'*l\n return s\n \n def formatyear(self,theyear,w=2,l=1,c=6,m=3):\n ''\n\n \n w=max(2,w)\n l=max(1,l)\n c=max(2,c)\n colwidth=(w+1)*7 -1\n v=[]\n a=v.append\n a(repr(theyear).center(colwidth *m+c *(m -1)).rstrip())\n a('\\n'*l)\n header=self.formatweekheader(w)\n for(i,row)in enumerate(self.yeardays2calendar(theyear,m)):\n \n months=range(m *i+1,min(m *(i+1)+1,13))\n a('\\n'*l)\n names=(self.formatmonthname(theyear,k,colwidth,False)\n for k in months)\n a(formatstring(names,colwidth,c).rstrip())\n a('\\n'*l)\n headers=(header for k in months)\n a(formatstring(headers,colwidth,c).rstrip())\n a('\\n'*l)\n \n height=max(len(cal)for cal in row)\n for j in range(height):\n weeks=[]\n for cal in row:\n if j >=len(cal):\n weeks.append('')\n else:\n weeks.append(self.formatweek(cal[j],w))\n a(formatstring(weeks,colwidth,c).rstrip())\n a('\\n'*l)\n return ''.join(v)\n \n def pryear(self,theyear,w=0,l=0,c=6,m=3):\n ''\n print(self.formatyear(theyear,w,l,c,m),end='')\n \n \nclass HTMLCalendar(Calendar):\n ''\n\n \n \n \n cssclasses=[\"mon\",\"tue\",\"wed\",\"thu\",\"fri\",\"sat\",\"sun\"]\n \n \n cssclasses_weekday_head=cssclasses\n \n \n cssclass_noday=\"noday\"\n \n \n cssclass_month_head=\"month\"\n \n \n cssclass_month=\"month\"\n \n \n cssclass_year_head=\"year\"\n \n \n cssclass_year=\"year\"\n \n def formatday(self,day,weekday):\n ''\n\n \n if day ==0:\n \n return ' '%self.cssclass_noday\n else:\n return '%d'%(self.cssclasses[weekday],day)\n \n def formatweek(self,theweek):\n ''\n\n \n s=''.join(self.formatday(d,wd)for(d,wd)in theweek)\n return '%s'%s\n \n def formatweekday(self,day):\n ''\n\n \n return '%s'%(\n self.cssclasses_weekday_head[day],day_abbr[day])\n \n def formatweekheader(self):\n ''\n\n \n s=''.join(self.formatweekday(i)for i in self.iterweekdays())\n return '%s'%s\n \n def formatmonthname(self,theyear,themonth,withyear=True):\n ''\n\n \n if withyear:\n s='%s %s'%(month_name[themonth],theyear)\n else:\n s='%s'%month_name[themonth]\n return '%s'%(\n self.cssclass_month_head,s)\n \n def formatmonth(self,theyear,themonth,withyear=True):\n ''\n\n \n v=[]\n a=v.append\n a(''%(\n self.cssclass_month))\n a('\\n')\n a(self.formatmonthname(theyear,themonth,withyear=withyear))\n a('\\n')\n a(self.formatweekheader())\n a('\\n')\n for week in self.monthdays2calendar(theyear,themonth):\n a(self.formatweek(week))\n a('\\n')\n a('
')\n a('\\n')\n return ''.join(v)\n \n def formatyear(self,theyear,width=3):\n ''\n\n \n v=[]\n a=v.append\n width=max(width,1)\n a(''%\n self.cssclass_year)\n a('\\n')\n a(''%(\n width,self.cssclass_year_head,theyear))\n for i in range(JANUARY,JANUARY+12,width):\n \n months=range(i,min(i+width,13))\n a('')\n for m in months:\n a('')\n a('')\n a('
%s
')\n a(self.formatmonth(theyear,m,withyear=False))\n a('
')\n return ''.join(v)\n \n def formatyearpage(self,theyear,width=3,css='calendar.css',encoding=None):\n ''\n\n \n if encoding is None:\n encoding=sys.getdefaultencoding()\n v=[]\n a=v.append\n a('\\n'%encoding)\n a('\\n')\n a('\\n')\n a('\\n')\n a('\\n'%encoding)\n if css is not None:\n a('\\n'%css)\n a('Calendar for %d\\n'%theyear)\n a('\\n')\n a('\\n')\n a(self.formatyear(theyear,width))\n a('\\n')\n a('\\n')\n return ''.join(v).encode(encoding,\"xmlcharrefreplace\")\n \n \nclass different_locale:\n def __init__(self,locale):\n self.locale=locale\n self.oldlocale=None\n \n def __enter__(self):\n self.oldlocale=_locale.setlocale(_locale.LC_TIME,None)\n _locale.setlocale(_locale.LC_TIME,self.locale)\n \n def __exit__(self,*args):\n if self.oldlocale is None:\n return\n _locale.setlocale(_locale.LC_TIME,self.oldlocale)\n \n \ndef _get_default_locale():\n locale=_locale.setlocale(_locale.LC_TIME,None)\n if locale ==\"C\":\n with different_locale(\"\"):\n \n \n locale=_locale.setlocale(_locale.LC_TIME,None)\n return locale\n \n \nclass LocaleTextCalendar(TextCalendar):\n ''\n\n\n \n \n def __init__(self,firstweekday=0,locale=None):\n TextCalendar.__init__(self,firstweekday)\n if locale is None:\n locale=_get_default_locale()\n self.locale=locale\n \n def formatweekday(self,day,width):\n with different_locale(self.locale):\n return super().formatweekday(day,width)\n \n def formatmonthname(self,theyear,themonth,width,withyear=True):\n with different_locale(self.locale):\n return super().formatmonthname(theyear,themonth,width,withyear)\n \n \nclass LocaleHTMLCalendar(HTMLCalendar):\n ''\n\n\n \n def __init__(self,firstweekday=0,locale=None):\n HTMLCalendar.__init__(self,firstweekday)\n if locale is None:\n locale=_get_default_locale()\n self.locale=locale\n \n def formatweekday(self,day):\n with different_locale(self.locale):\n return super().formatweekday(day)\n \n def formatmonthname(self,theyear,themonth,withyear=True):\n with different_locale(self.locale):\n return super().formatmonthname(theyear,themonth,withyear)\n \n \nc=TextCalendar()\n\nfirstweekday=c.getfirstweekday\n\ndef setfirstweekday(firstweekday):\n if not MONDAY <=firstweekday <=SUNDAY:\n raise IllegalWeekdayError(firstweekday)\n c.firstweekday=firstweekday\n \nmonthcalendar=c.monthdayscalendar\nprweek=c.prweek\nweek=c.formatweek\nweekheader=c.formatweekheader\nprmonth=c.prmonth\nmonth=c.formatmonth\ncalendar=c.formatyear\nprcal=c.pryear\n\n\n\n_colwidth=7 *3 -1\n_spacing=6\n\n\ndef format(cols,colwidth=_colwidth,spacing=_spacing):\n ''\n print(formatstring(cols,colwidth,spacing))\n \n \ndef formatstring(cols,colwidth=_colwidth,spacing=_spacing):\n ''\n spacing *=' '\n return spacing.join(c.center(colwidth)for c in cols)\n \n \nEPOCH=1970\n_EPOCH_ORD=datetime.date(EPOCH,1,1).toordinal()\n\n\ndef timegm(tuple):\n ''\n year,month,day,hour,minute,second=tuple[:6]\n days=datetime.date(year,month,1).toordinal()-_EPOCH_ORD+day -1\n hours=days *24+hour\n minutes=hours *60+minute\n seconds=minutes *60+second\n return seconds\n \n \ndef main(args):\n import argparse\n parser=argparse.ArgumentParser()\n textgroup=parser.add_argument_group('text only arguments')\n htmlgroup=parser.add_argument_group('html only arguments')\n textgroup.add_argument(\n \"-w\",\"--width\",\n type=int,default=2,\n help=\"width of date column (default 2)\"\n )\n textgroup.add_argument(\n \"-l\",\"--lines\",\n type=int,default=1,\n help=\"number of lines for each week (default 1)\"\n )\n textgroup.add_argument(\n \"-s\",\"--spacing\",\n type=int,default=6,\n help=\"spacing between months (default 6)\"\n )\n textgroup.add_argument(\n \"-m\",\"--months\",\n type=int,default=3,\n help=\"months per row (default 3)\"\n )\n htmlgroup.add_argument(\n \"-c\",\"--css\",\n default=\"calendar.css\",\n help=\"CSS to use for page\"\n )\n parser.add_argument(\n \"-L\",\"--locale\",\n default=None,\n help=\"locale to be used from month and weekday names\"\n )\n parser.add_argument(\n \"-e\",\"--encoding\",\n default=None,\n help=\"encoding to use for output\"\n )\n parser.add_argument(\n \"-t\",\"--type\",\n default=\"text\",\n choices=(\"text\",\"html\"),\n help=\"output type (text or html)\"\n )\n parser.add_argument(\n \"year\",\n nargs='?',type=int,\n help=\"year number (1-9999)\"\n )\n parser.add_argument(\n \"month\",\n nargs='?',type=int,\n help=\"month number (1-12, text only)\"\n )\n \n options=parser.parse_args(args[1:])\n \n if options.locale and not options.encoding:\n parser.error(\"if --locale is specified --encoding is required\")\n sys.exit(1)\n \n locale=options.locale,options.encoding\n \n if options.type ==\"html\":\n if options.locale:\n cal=LocaleHTMLCalendar(locale=locale)\n else:\n cal=HTMLCalendar()\n encoding=options.encoding\n if encoding is None:\n encoding=sys.getdefaultencoding()\n optdict=dict(encoding=encoding,css=options.css)\n write=sys.stdout.buffer.write\n if options.year is None:\n write(cal.formatyearpage(datetime.date.today().year,**optdict))\n elif options.month is None:\n write(cal.formatyearpage(options.year,**optdict))\n else:\n parser.error(\"incorrect number of arguments\")\n sys.exit(1)\n else:\n if options.locale:\n cal=LocaleTextCalendar(locale=locale)\n else:\n cal=TextCalendar()\n optdict=dict(w=options.width,l=options.lines)\n if options.month is None:\n optdict[\"c\"]=options.spacing\n optdict[\"m\"]=options.months\n if options.year is None:\n result=cal.formatyear(datetime.date.today().year,**optdict)\n elif options.month is None:\n result=cal.formatyear(options.year,**optdict)\n else:\n result=cal.formatmonth(options.year,options.month,**optdict)\n write=sys.stdout.write\n if options.encoding:\n result=result.encode(options.encoding)\n write=sys.stdout.buffer.write\n write(result)\n \n \nif __name__ ==\"__main__\":\n main(sys.argv)\n", ["argparse", "datetime", "enum", "itertools", "locale", "sys", "warnings"]], "cmath": [".py", "\n\n\n\n\n\n\n\n\n\nimport math\nimport sys\n\ndef _takes_complex(func):\n def decorated(x):\n if isinstance(x,complex):\n return func(x)\n elif type(x)in [int,float]:\n return func(complex(x))\n elif hasattr(x,'__complex__'):\n c=x.__complex__()\n if not isinstance(c,complex):\n raise TypeError(\"A complex number is required\")\n else :\n return func(c)\n elif hasattr(x,'__float__'):\n try :\n c=complex(x.__float__(),0)\n except :\n raise TypeError(\"A complex number is required\")\n return func(c)\n elif hasattr(x,'__index__'):\n try :\n c=complex(x.__index__(),0)\n except :\n raise TypeError(\"A complex number is required\")\n return func(c)\n else :\n raise TypeError(\"A complex number is required\")\n if hasattr(func,'__doc__'):\n decorated.__doc__=func.__doc__\n if hasattr(func,'__name__'):\n decorated.__name__=func.__name__\n return decorated\n \n@_takes_complex\ndef isfinite(x):\n return math.isfinite(x.imag)and math.isfinite(x.real)\n \n@_takes_complex\ndef phase(x):\n ''\n return math.atan2(x.imag,x.real)\n \n@_takes_complex\ndef polar(x):\n ''\n\n\n\n\n \n phi=math.atan2(x.imag,x.real)\n if math.isnan(x.imag):\n if math.isinf(x.real):\n return abs(x.real),nan\n return nan,nan\n elif math.isinf(x.imag):\n r=inf\n elif math.isinf(x.real):\n r=inf\n else :\n r=math.sqrt(x.real **2+x.imag **2)\n if math.isinf(r):\n raise OverflowError(\"math range error\")\n return r,phi\n \ndef rect(r,phi):\n ''\n\n \n if math.isnan(r):\n if not math.isnan(phi)and not phi:\n return complex(nan,0)\n return complex(nan,nan)\n elif math.isnan(phi):\n if not r:\n return complex(0,0)\n elif math.isinf(r):\n return complex(inf,nan)\n return complex(nan,nan)\n if math.isinf(r)or math.isinf(phi):\n \n \n if math.isinf(phi)and r !=.0 and not math.isnan(r):\n raise ValueError(\"math domain error\")\n \n \n \n \n if -inf 0:\n _real=math.copysign(inf,math.cos(phi))\n _imag=math.copysign(inf,math.sin(phi))\n else :\n _real=-math.copysign(inf,math.cos(phi));\n _imag=-math.copysign(inf,math.sin(phi));\n return complex(_real,_imag)\n return _SPECIAL_VALUE(complex(r,phi),_rect_special_values)\n \n else :\n if phi ==.0:\n \n \n \n return complex(r,phi *r)\n else :\n return complex(r *math.cos(phi),r *math.sin(phi))\n \n@_takes_complex\ndef sqrt(x):\n ''\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n s,d,ax,ay=.0,.0,math.fabs(x.real),math.fabs(x.imag)\n \n ret=_SPECIAL_VALUE(x,_sqrt_special_values)\n if ret is not None :\n return ret\n \n if math.isinf(x.imag):\n return complex(inf,x.imag)\n \n if x.real ==.0 and x.imag ==.0:\n _real=.0\n _imag=x.imag\n return complex(_real,_imag)\n \n if ay ==0:\n s=math.sqrt(ax)\n d=0\n elif ax 0. or ay >0.):\n \n AX=math.ldexp(ax,_CM_SCALE_UP)\n AY=math.ldexp(ay,_CM_SCALE_UP)\n S=math.sqrt((AX+math.hypot(AX,AY))/2.0)\n D=AY /(2 *S)\n s=math.ldexp(S,_CM_SCALE_DOWN)\n d=math.ldexp(D,_CM_SCALE_DOWN)\n else :\n ax /=8.0 ;\n s=2.0 *math.sqrt(ax+math.hypot(ax,ay /8.0));\n d=ay /(2.0 *s)\n \n if x.real >=.0:\n _real=s ;\n _imag=math.copysign(d,x.imag)\n else :\n _real=d ;\n _imag=math.copysign(s,x.imag)\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef acos(x):\n ''\n\n\n\n\n \n \n ret=_SPECIAL_VALUE(x,_acos_special_values)\n if ret is not None :\n if isinstance(ret,Exception):\n raise ret\n return ret\n \n if math.fabs(x.real)>_CM_LARGE_DOUBLE or math.fabs(x.imag)>_CM_LARGE_DOUBLE:\n \n _real=math.atan2(math.fabs(x.imag),x.real)\n \n \n \n if x.real <0:\n _imag=-math.copysign(math.log(math.hypot(x.real /2.,x.imag /2.))+_M_LN2 *2.,x.imag);\n else :\n _imag=math.copysign(math.log(math.hypot(x.real /2.,x.imag /2.))+_M_LN2 *2.,-x.imag);\n elif math.isnan(x.real):\n return complex(nan,nan)\n elif math.isnan(x.imag):\n if x.real ==0:\n return complex(pi /2,nan)\n return complex(nan,nan)\n else :\n s1=complex(float(1 -x.real),-x.imag)\n s1=sqrt(s1)\n s2=complex(1.0+x.real,x.imag)\n s2=sqrt(s2)\n _real=2.0 *math.atan2(s1.real,s2.real)\n _imag=math.asinh(s2.real *s1.imag -s2.imag *s1.real)\n if not x.imag:\n if x.real >1:\n _real=0\n elif x.real <-1:\n _real=math.pi\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef acosh(x):\n ''\n\n\n\n \n ret=_SPECIAL_VALUE(x,_acosh_special_values)\n if ret is not None :\n return ret\n \n if math.fabs(x.real)>_CM_LARGE_DOUBLE or math.fabs(x.imag)>_CM_LARGE_DOUBLE:\n \n _real=math.log(math.hypot(x.real /2.0,x.imag /2.0))+_M_LN2 *2.0\n _imag=math.atan2(x.imag,x.real);\n else :\n s1=sqrt(complex(x.real -1.0,x.imag))\n s2=sqrt(complex(x.real+1.0,x.imag))\n _real=math.asinh(s1.real *s2.real+s1.imag *s2.imag)\n _imag=2. *math.atan2(s1.imag,s2.real)\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef asin(x):\n ''\n\n\n\n \n \n s=complex(-x.imag,x.real)\n s=asinh(s)\n return complex(s.imag,-s.real)\n \n@_takes_complex\ndef asinh(x):\n ''\n\n\n\n\n \n ret=_SPECIAL_VALUE(x,_asinh_special_values)\n if ret is not None :\n return ret\n \n if math.fabs(x.real)>_CM_LARGE_DOUBLE or math.fabs(x.imag)>_CM_LARGE_DOUBLE:\n if x.imag >=.0:\n _real=math.copysign(math.log(math.hypot(x.real /2.,x.imag /2.))+_M_LN2 *2.,x.real)\n else :\n _real=-math.copysign(math.log(math.hypot(x.real /2.,x.imag /2.))+_M_LN2 *2.,-x.real)\n _imag=math.atan2(x.imag,math.fabs(x.real))\n else :\n s1=sqrt(complex(1.0+x.imag,-x.real))\n s2=sqrt(complex(1.0 -x.imag,x.real))\n _real=math.asinh(s1.real *s2.imag -s2.real *s1.imag)\n _imag=math.atan2(x.imag,s1.real *s2.real -s1.imag *s2.imag)\n return complex(_real,_imag)\n \n@_takes_complex\ndef atan(x):\n ''\n\n\n\n\n \n ret=_SPECIAL_VALUE(x,_atan_special_values)\n if ret is not None :\n return ret\n \n if isinf(x):\n return complex(math.copysign(1,x.real)*pi /2,\n math.copysign(0,x.imag))\n s=atanh(complex(-x.imag,x.real))\n return complex(s.imag,-s.real)\n \n@_takes_complex\ndef atanh(x):\n ''\n\n\n\n\n \n \n ret=_SPECIAL_VALUE(x,_atanh_special_values)\n if ret is not None :\n return ret\n \n if isinf(x):\n return complex(math.copysign(0,x.real),\n math.copysign(1,x.imag)*pi /2)\n \n \n if x.real <.0:\n return -(atanh(-x))\n \n ay=math.fabs(x.imag)\n \n if x.real >_CM_SQRT_LARGE_DOUBLE or ay >_CM_SQRT_LARGE_DOUBLE:\n \n \n \n \n \n h=math.hypot(x.real /2.,x.imag /2.)\n _real=x.real /4. /h /h\n \n \n \n \n \n \n _imag=-math.copysign(math.pi /2.,-x.imag)\n \n elif x.real ==1.0 and ay <_CM_SQRT_DBL_MIN:\n \n \n if (ay ==.0):\n raise ValueError(\"math domain error\")\n else :\n _real=-math.log(math.sqrt(ay)/math.sqrt(math.hypot(ay,2.)))\n _imag=math.copysign(math.atan2(2.0,-ay)/2,x.imag)\n \n else :\n \n _real=math.log1p(4. *x.real /((1 -x.real)*(1 -x.real)+ay *ay))/4.\n _imag=-math.atan2(-2. *x.imag,(1 -x.real)*(1+x.real)-ay *ay)/2.\n errno=0\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef cos(x):\n ''\n return cosh(complex(-x.imag,x.real))\n \n@_takes_complex\ndef cosh(x):\n ''\n \n ret=_SPECIAL_VALUE(x,_cosh_special_values)\n if ret is not None :\n if isinstance(ret,Exception):\n raise ret\n return ret\n \n if not math.isinf(x.real)and math.fabs(x.real)>_CM_LOG_LARGE_DOUBLE:\n \n \n x_minus_one=x.real -math.copysign(1.0,x.real)\n _real=cos(x.imag)*math.cosh(x_minus_one)*math.e\n _imag=sin(x.imag)*math.sinh(x_minus_one)*math.e\n elif math.isinf(x.real)and x.imag ==0:\n if x.real >0:\n return x\n else :\n return complex(inf,-x.imag)\n elif math.isinf(x.imag):\n raise ValueError(\"math domain error\")\n else :\n _real=math.cos(x.imag)*math.cosh(x.real)\n _imag=math.sin(x.imag)*math.sinh(x.real)\n \n ret=complex(_real,_imag)\n return ret\n \n@_takes_complex\ndef exp(x):\n ''\n if math.isinf(x.real)or math.isinf(x.imag):\n \n if math.isinf(x.imag)and (-inf 0):\n raise ValueError(\"math domain error\")\n \n if math.isinf(x.real)and -inf 0:\n _real=math.copysign(inf,math.cos(x.imag))\n _imag=math.copysign(inf,math.sin(x.imag))\n else :\n _real=math.copysign(.0,math.cos(x.imag))\n _imag=math.copysign(.0,math.sin(x.imag))\n return complex(_real,_imag)\n \n return _SPECIAL_VALUE(x,_exp_special_values)\n \n if math.isnan(x.real)and x.imag ==0:\n return x\n \n if x.real >_CM_LOG_LARGE_DOUBLE:\n l=math.exp(x.real -1.);\n _real=l *math.cos(x.imag)*math.e\n _imag=l *math.sin(x.imag)*math.e\n else :\n l=math.exp(x.real);\n _real=l *math.cos(x.imag)\n _imag=l *math.sin(x.imag)\n \n if math.isinf(_real)or math.isinf(_imag):\n raise OverflowError()\n \n return complex(_real,_imag)\n \ndef isclose(x,y,*,rel_tol=1e-09,abs_tol=0.0):\n try :\n complex(x)\n except ValueError:\n raise TypeError(f\"must be a number, not {x.__class__.__name__}\")\n try :\n complex(y)\n except ValueError:\n raise TypeError(f\"must be a number, not {y.__class__.__name__}\")\n rel_tol=float(rel_tol)\n abs_tol=float(abs_tol)\n if rel_tol <0.0 or abs_tol <0.0:\n raise ValueError('tolerances must be non-negative')\n if x is inf or x is _NINF or y is inf or y is _NINF:\n return y is x\n if x is nan or y is nan:\n return False\n return abs(x -y)<=max(rel_tol *float(max(abs(x),abs(y))),abs_tol)\n \n@_takes_complex\ndef isinf(x):\n ''\n return math.isinf(x.real)or math.isinf(x.imag)\n \n@_takes_complex\ndef isnan(x):\n ''\n return math.isnan(x.real)or math.isnan(x.imag)\n \n \n@_takes_complex\ndef _to_complex(x):\n return x\n \ndef log(x,base=None ):\n ''\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n x=_to_complex(x)\n \n \n \n \n \n \n denom=1 if base is None else log(base)\n ''\n\n\n\n \n \n ret=_SPECIAL_VALUE(x,_log_special_values)\n if ret is not None :\n return ret\n \n if math.isnan(x.real):\n return complex(inf if math.isinf(x.imag)else nan,nan)\n elif math.isnan(x.imag):\n return complex(inf if math.isinf(x.real)else nan,nan)\n \n ax=math.fabs(x.real)\n ay=math.fabs(x.imag)\n \n if ax >_CM_LARGE_DOUBLE or ay >_CM_LARGE_DOUBLE:\n _real=math.log(math.hypot(ax /2.0,ay /2.0))+_M_LN2\n elif ax .0 or ay >.0:\n \n _real=math.log(math.hypot(math.ldexp(ax,sys.float_info.mant_dig),math.ldexp(ay,sys.float_info.mant_dig)))-sys.float_info.mant_dig *_M_LN2\n else :\n \n raise ValueError(\"math domain error\")\n _real=-inf\n _imag=math.atan2(x.imag,x.real)\n else :\n h=math.hypot(ax,ay)\n _real=math.log(h)/denom\n if not ay:\n if type(_real)==complex:\n return _real\n if x.real <0:\n return complex(_real,math.copysign(math.pi,x.imag))\n return complex(_real,x.imag)\n _imag=math.atan2(x.imag,x.real)\n return complex(_real,_imag)\n \n@_takes_complex\ndef log10(x):\n ''\n\n\n\n \n ret=log(x)\n _real=ret.real /_M_LN10\n _imag=ret.imag /_M_LN10\n return complex(_real,_imag)\n \n@_takes_complex\ndef sin(x):\n ''\n \n s=complex(-x.imag,x.real)\n s=sinh(s)\n return complex(s.imag,-s.real)\n \n@_takes_complex\ndef sinh(x):\n ''\n \n ret=_SPECIAL_VALUE(x,_sinh_special_values)\n if ret is not None :\n if isinstance(ret,Exception):\n raise ret\n return ret\n \n if math.isinf(x.real)or math.isinf(x.imag):\n \n \n if math.isinf(x.imag)and not math.isnan(x.real):\n raise ValueError(\"math domain error\")\n \n if math.isinf(x.real)and -inf 0:\n _real=math.copysign(inf,math.cos(x.imag))\n _imag=math.copysign(inf,math.sin(x.imag))\n else :\n _real=-math.copysign(inf,math.cos(x.imag))\n _imag=math.copysign(inf,math.sin(x.imag))\n return complex(_real,_imag)\n \n return _SPECIAL_VALUE(x,_sinh_special_values)\n \n if math.fabs(x.real)>_CM_LOG_LARGE_DOUBLE:\n x_minus_one=x.real -math.copysign(1.0,x.real)\n z=complex(x_minus_one,x.imag)\n _real=math.cos(z.imag)*math.sinh(z.real)*math.e\n _imag=math.sin(z.imag)*math.cosh(z.real)*math.e\n else :\n _real=math.cos(x.imag)*math.sinh(x.real)\n _imag=math.sin(x.imag)*math.cosh(x.real)\n \n if math.isinf(_real)or math.isinf(_imag):\n raise OverflowError()\n \n return complex(_real,_imag)\n \n@_takes_complex\ndef tan(x):\n ''\n if math.isnan(x.real):\n if math.isinf(x.imag):\n return complex(0,math.copysign(1,x.imag))\n return complex(nan,nan)\n elif math.isnan(x.imag):\n if not x.real:\n return complex(math.copysign(0,x.real),nan)\n return complex(nan,nan)\n s=tanh(complex(-x.imag,x.real))\n return complex(s.imag,-s.real)\n \n@_takes_complex\ndef tanh(x):\n ''\n ''\n\n\n \n \n \n \n \n \n \n \n \n \n if math.isnan(x.real):\n if x.imag ==0:\n return complex(nan,math.copysign(0,x.imag))\n return complex(nan,nan)\n elif math.isnan(x.imag):\n if math.isinf(x.real):\n return complex(math.copysign(1,x.real),0)\n return complex(nan,nan)\n \n if isinf(x):\n if math.isinf(x.imag)and -inf 0:\n _real=1.0\n _imag=math.copysign(.0,2.0 *math.sin(x.imag)*math.cos(x.imag))\n else :\n _real=-1.0\n _imag=math.copysign(.0,2. *math.sin(x.imag)*math.cos(x.imag))\n return complex(_real,_imag)\n return _SPECIAL_VALUE(x,_tanh_special_values)\n \n \n if math.fabs(x.real)>_CM_LOG_LARGE_DOUBLE:\n _real=math.copysign(1.,x.real)\n _imag=4. *math.sin(x.imag)*math.cos(x.imag)*math.exp(-2. *math.fabs(x.real))\n else :\n tx=math.tanh(x.real)\n ty=math.tan(x.imag)\n cx=1.0 /math.cosh(x.real)\n txty=tx *ty\n denom=1.+txty *txty\n _real=tx *(1.+ty *ty)/denom\n _imag=((ty /denom)*cx)*cx\n return complex(_real,_imag)\n \n \nFunctionType=type(_takes_complex)\nlocs=locals()\nkeys=list(locs.keys())\nfor f in keys:\n if type(locs[f])is FunctionType and not f.startswith(\"_\"):\n locals()[f]=type(abs)(locals()[f])\n \npi=math.pi\ne=math.e\ntau=math.tau\n\n_CM_LARGE_DOUBLE=sys.float_info.max /4\n_CM_SQRT_LARGE_DOUBLE=math.sqrt(_CM_LARGE_DOUBLE)\n_CM_LOG_LARGE_DOUBLE=math.log(_CM_LARGE_DOUBLE)\n_CM_SQRT_DBL_MIN=math.sqrt(sys.float_info.min)\n_M_LN2=0.6931471805599453094\n_M_LN10=2.302585092994045684\n\nif sys.float_info.radix ==2:\n _CM_SCALE_UP=int((2 *(sys.float_info.mant_dig /2)+1))\nelif sys.float_info.radix ==16:\n _CM_SCALE_UP=int((4 *sys.float_info.mant_dig+1))\nelse :\n raise (\"cmath implementation expects the float base to be either 2 or 16, got \"+str(sys.float_info.radix)+\" instead.\")\n_CM_SCALE_DOWN=int((-(_CM_SCALE_UP+1)/2))\n\ninf=float('inf')\ninfj=complex(0.0,inf)\n_NINF=float('-inf')\nnan=float('nan')\nnanj=complex(0.0,float('nan'))\n\n_P14=0.25 *pi\n_P12=0.5 *pi\n_P34=0.75 *pi\n_U=-9.5426319407711027e33\n\n\n_ST_NINF=0\n_ST_NEG=1\n_ST_NZERO=2\n_ST_PZERO=3\n_ST_POS=4\n_ST_PINF=5\n_ST_NAN=6\n\n\ndef _SPECIAL_VALUE(z,table):\n if not math.isfinite(z.real)or not math.isfinite(z.imag):\n return table[_special_type(z.real)][_special_type(z.imag)]\n else :\n return None\n \ndef _special_type(x):\n if -inf ):\"\n misc_header=\"Miscellaneous help topics:\"\n undoc_header=\"Undocumented commands:\"\n nohelp=\"*** No help on %s\"\n use_rawinput=1\n \n def __init__(self,completekey='tab',stdin=None ,stdout=None ):\n ''\n\n\n\n\n\n\n\n\n \n if stdin is not None :\n self.stdin=stdin\n else :\n self.stdin=sys.stdin\n if stdout is not None :\n self.stdout=stdout\n else :\n self.stdout=sys.stdout\n self.cmdqueue=[]\n self.completekey=completekey\n \n def cmdloop(self,intro=None ):\n ''\n\n\n\n \n \n self.preloop()\n if self.use_rawinput and self.completekey:\n try :\n import readline\n self.old_completer=readline.get_completer()\n readline.set_completer(self.complete)\n readline.parse_and_bind(self.completekey+\": complete\")\n except ImportError:\n pass\n try :\n if intro is not None :\n self.intro=intro\n if self.intro:\n self.stdout.write(str(self.intro)+\"\\n\")\n stop=None\n while not stop:\n if self.cmdqueue:\n line=self.cmdqueue.pop(0)\n else :\n if self.use_rawinput:\n try :\n line=input(self.prompt)\n except EOFError:\n line='EOF'\n else :\n self.stdout.write(self.prompt)\n self.stdout.flush()\n line=self.stdin.readline()\n if not len(line):\n line='EOF'\n else :\n line=line.rstrip('\\r\\n')\n line=self.precmd(line)\n stop=self.onecmd(line)\n stop=self.postcmd(stop,line)\n self.postloop()\n finally :\n if self.use_rawinput and self.completekey:\n try :\n import readline\n readline.set_completer(self.old_completer)\n except ImportError:\n pass\n \n \n def precmd(self,line):\n ''\n\n\n \n return line\n \n def postcmd(self,stop,line):\n ''\n return stop\n \n def preloop(self):\n ''\n pass\n \n def postloop(self):\n ''\n\n\n \n pass\n \n def parseline(self,line):\n ''\n\n\n \n line=line.strip()\n if not line:\n return None ,None ,line\n elif line[0]=='?':\n line='help '+line[1:]\n elif line[0]=='!':\n if hasattr(self,'do_shell'):\n line='shell '+line[1:]\n else :\n return None ,None ,line\n i,n=0,len(line)\n while i 0:\n cmd,args,foo=self.parseline(line)\n if cmd =='':\n compfunc=self.completedefault\n else :\n try :\n compfunc=getattr(self,'complete_'+cmd)\n except AttributeError:\n compfunc=self.completedefault\n else :\n compfunc=self.completenames\n self.completion_matches=compfunc(text,line,begidx,endidx)\n try :\n return self.completion_matches[state]\n except IndexError:\n return None\n \n def get_names(self):\n \n \n return dir(self.__class__)\n \n def complete_help(self,*args):\n commands=set(self.completenames(*args))\n topics=set(a[5:]for a in self.get_names()\n if a.startswith('help_'+args[0]))\n return list(commands |topics)\n \n def do_help(self,arg):\n ''\n if arg:\n \n try :\n func=getattr(self,'help_'+arg)\n except AttributeError:\n try :\n doc=getattr(self,'do_'+arg).__doc__\n if doc:\n self.stdout.write(\"%s\\n\"%str(doc))\n return\n except AttributeError:\n pass\n self.stdout.write(\"%s\\n\"%str(self.nohelp %(arg,)))\n return\n func()\n else :\n names=self.get_names()\n cmds_doc=[]\n cmds_undoc=[]\n topics=set()\n for name in names:\n if name[:5]=='help_':\n topics.add(name[5:])\n names.sort()\n \n prevname=''\n for name in names:\n if name[:3]=='do_':\n if name ==prevname:\n continue\n prevname=name\n cmd=name[3:]\n if cmd in topics:\n cmds_doc.append(cmd)\n topics.remove(cmd)\n elif getattr(self,name).__doc__:\n cmds_doc.append(cmd)\n else :\n cmds_undoc.append(cmd)\n self.stdout.write(\"%s\\n\"%str(self.doc_leader))\n self.print_topics(self.doc_header,cmds_doc,15,80)\n self.print_topics(self.misc_header,sorted(topics),15,80)\n self.print_topics(self.undoc_header,cmds_undoc,15,80)\n \n def print_topics(self,header,cmds,cmdlen,maxcol):\n if cmds:\n self.stdout.write(\"%s\\n\"%str(header))\n if self.ruler:\n self.stdout.write(\"%s\\n\"%str(self.ruler *len(header)))\n self.columnize(cmds,maxcol -1)\n self.stdout.write(\"\\n\")\n \n def columnize(self,list,displaywidth=80):\n ''\n\n\n\n \n if not list:\n self.stdout.write(\"\\n\")\n return\n \n nonstrings=[i for i in range(len(list))\n if not isinstance(list[i],str)]\n if nonstrings:\n raise TypeError(\"list[i] not a string for i in %s\"\n %\", \".join(map(str,nonstrings)))\n size=len(list)\n if size ==1:\n self.stdout.write('%s\\n'%str(list[0]))\n return\n \n for nrows in range(1,len(list)):\n ncols=(size+nrows -1)//nrows\n colwidths=[]\n totwidth=-2\n for col in range(ncols):\n colwidth=0\n for row in range(nrows):\n i=row+nrows *col\n if i >=size:\n break\n x=list[i]\n colwidth=max(colwidth,len(x))\n colwidths.append(colwidth)\n totwidth +=colwidth+2\n if totwidth >displaywidth:\n break\n if totwidth <=displaywidth:\n break\n else :\n nrows=len(list)\n ncols=1\n colwidths=[0]\n for row in range(nrows):\n texts=[]\n for col in range(ncols):\n i=row+nrows *col\n if i >=size:\n x=\"\"\n else :\n x=list[i]\n texts.append(x)\n while texts and not texts[-1]:\n del texts[-1]\n for col in range(len(texts)):\n texts[col]=texts[col].ljust(colwidths[col])\n self.stdout.write(\"%s\\n\"%str(\" \".join(texts)))\n", ["readline", "string", "sys"]], "code": [".py", "''\n\n\n\n\n\n\nimport sys\nimport traceback\nfrom codeop import CommandCompiler,compile_command\n\n__all__=[\"InteractiveInterpreter\",\"InteractiveConsole\",\"interact\",\n\"compile_command\"]\n\nclass InteractiveInterpreter:\n ''\n\n\n\n\n\n \n \n def __init__(self,locals=None):\n ''\n\n\n\n\n\n\n \n if locals is None:\n locals={\"__name__\":\"__console__\",\"__doc__\":None}\n self.locals=locals\n self.compile=CommandCompiler()\n \n def runsource(self,source,filename=\"\",symbol=\"single\"):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n code=self.compile(source,filename,symbol)\n except(OverflowError,SyntaxError,ValueError):\n \n self.showsyntaxerror(filename)\n return False\n \n if code is None:\n \n return True\n \n \n self.runcode(code)\n return False\n \n def runcode(self,code):\n ''\n\n\n\n\n\n\n\n\n\n \n try:\n exec(code,self.locals)\n except SystemExit:\n raise\n except:\n self.showtraceback()\n \n def showsyntaxerror(self,filename=None):\n ''\n\n\n\n\n\n\n\n\n\n \n type,value,tb=sys.exc_info()\n sys.last_exc=value\n sys.last_type=type\n sys.last_value=value\n sys.last_traceback=tb\n if filename and type is SyntaxError:\n \n try:\n msg,(dummy_filename,lineno,offset,line)=value.args\n except ValueError:\n \n pass\n else:\n \n value=SyntaxError(msg,(filename,lineno,offset,line))\n sys.last_exc=sys.last_value=value\n if sys.excepthook is sys.__excepthook__:\n lines=traceback.format_exception_only(type,value)\n self.write(''.join(lines))\n else:\n \n \n sys.excepthook(type,value,tb)\n \n def showtraceback(self):\n ''\n\n\n\n\n\n \n sys.last_type,sys.last_value,last_tb=ei=sys.exc_info()\n sys.last_traceback=last_tb\n sys.last_exc=ei[1]\n try:\n lines=traceback.format_exception(ei[0],ei[1],last_tb.tb_next)\n if sys.excepthook is sys.__excepthook__:\n self.write(''.join(lines))\n else:\n \n \n sys.excepthook(ei[0],ei[1],last_tb)\n finally:\n last_tb=ei=None\n \n def write(self,data):\n ''\n\n\n\n\n \n sys.stderr.write(data)\n \n \nclass InteractiveConsole(InteractiveInterpreter):\n ''\n\n\n\n\n \n \n def __init__(self,locals=None,filename=\"\"):\n ''\n\n\n\n\n\n\n\n \n InteractiveInterpreter.__init__(self,locals)\n self.filename=filename\n self.resetbuffer()\n \n def resetbuffer(self):\n ''\n self.buffer=[]\n \n def interact(self,banner=None,exitmsg=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n sys.ps1\n except AttributeError:\n sys.ps1=\">>> \"\n try:\n sys.ps2\n except AttributeError:\n sys.ps2=\"... \"\n cprt='Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.'\n if banner is None:\n self.write(\"Python %s on %s\\n%s\\n(%s)\\n\"%\n (sys.version,sys.platform,cprt,\n self.__class__.__name__))\n elif banner:\n self.write(\"%s\\n\"%str(banner))\n more=0\n while 1:\n try:\n if more:\n prompt=sys.ps2\n else:\n prompt=sys.ps1\n try:\n line=self.raw_input(prompt)\n except EOFError:\n self.write(\"\\n\")\n break\n else:\n more=self.push(line)\n except KeyboardInterrupt:\n self.write(\"\\nKeyboardInterrupt\\n\")\n self.resetbuffer()\n more=0\n if exitmsg is None:\n self.write('now exiting %s...\\n'%self.__class__.__name__)\n elif exitmsg !='':\n self.write('%s\\n'%exitmsg)\n \n def push(self,line):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n self.buffer.append(line)\n source=\"\\n\".join(self.buffer)\n more=self.runsource(source,self.filename)\n if not more:\n self.resetbuffer()\n return more\n \n def raw_input(self,prompt=\"\"):\n ''\n\n\n\n\n\n\n\n\n \n return input(prompt)\n \n \n \ndef interact(banner=None,readfunc=None,local=None,exitmsg=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n console=InteractiveConsole(local)\n if readfunc is not None:\n console.raw_input=readfunc\n else:\n try:\n import readline\n except ImportError:\n pass\n console.interact(banner,exitmsg)\n \n \nif __name__ ==\"__main__\":\n import argparse\n \n parser=argparse.ArgumentParser()\n parser.add_argument('-q',action='store_true',\n help=\"don't print version and copyright messages\")\n args=parser.parse_args()\n if args.q or sys.flags.quiet:\n banner=''\n else:\n banner=None\n interact(banner)\n", ["argparse", "codeop", "readline", "sys", "traceback"]], "codecs": [".py", "''\n\n\n\n\n\n\n\n\nimport builtins\nimport sys\n\n\n\ntry:\n from _codecs import *\nexcept ImportError as why:\n raise SystemError('Failed to load the builtin codecs: %s'%why)\n \n__all__=[\"register\",\"lookup\",\"open\",\"EncodedFile\",\"BOM\",\"BOM_BE\",\n\"BOM_LE\",\"BOM32_BE\",\"BOM32_LE\",\"BOM64_BE\",\"BOM64_LE\",\n\"BOM_UTF8\",\"BOM_UTF16\",\"BOM_UTF16_LE\",\"BOM_UTF16_BE\",\n\"BOM_UTF32\",\"BOM_UTF32_LE\",\"BOM_UTF32_BE\",\n\"CodecInfo\",\"Codec\",\"IncrementalEncoder\",\"IncrementalDecoder\",\n\"StreamReader\",\"StreamWriter\",\n\"StreamReaderWriter\",\"StreamRecoder\",\n\"getencoder\",\"getdecoder\",\"getincrementalencoder\",\n\"getincrementaldecoder\",\"getreader\",\"getwriter\",\n\"encode\",\"decode\",\"iterencode\",\"iterdecode\",\n\"strict_errors\",\"ignore_errors\",\"replace_errors\",\n\"xmlcharrefreplace_errors\",\n\"backslashreplace_errors\",\"namereplace_errors\",\n\"register_error\",\"lookup_error\"]\n\n\n\n\n\n\n\n\n\n\nBOM_UTF8=b'\\xef\\xbb\\xbf'\n\n\nBOM_LE=BOM_UTF16_LE=b'\\xff\\xfe'\n\n\nBOM_BE=BOM_UTF16_BE=b'\\xfe\\xff'\n\n\nBOM_UTF32_LE=b'\\xff\\xfe\\x00\\x00'\n\n\nBOM_UTF32_BE=b'\\x00\\x00\\xfe\\xff'\n\nif sys.byteorder =='little':\n\n\n BOM=BOM_UTF16=BOM_UTF16_LE\n \n \n BOM_UTF32=BOM_UTF32_LE\n \nelse:\n\n\n BOM=BOM_UTF16=BOM_UTF16_BE\n \n \n BOM_UTF32=BOM_UTF32_BE\n \n \nBOM32_LE=BOM_UTF16_LE\nBOM32_BE=BOM_UTF16_BE\nBOM64_LE=BOM_UTF32_LE\nBOM64_BE=BOM_UTF32_BE\n\n\n\n\nclass CodecInfo(tuple):\n ''\n \n \n \n \n \n \n \n _is_text_encoding=True\n \n def __new__(cls,encode,decode,streamreader=None,streamwriter=None,\n incrementalencoder=None,incrementaldecoder=None,name=None,\n *,_is_text_encoding=None):\n self=tuple.__new__(cls,(encode,decode,streamreader,streamwriter))\n self.name=name\n self.encode=encode\n self.decode=decode\n self.incrementalencoder=incrementalencoder\n self.incrementaldecoder=incrementaldecoder\n self.streamwriter=streamwriter\n self.streamreader=streamreader\n if _is_text_encoding is not None:\n self._is_text_encoding=_is_text_encoding\n return self\n \n def __repr__(self):\n return \"<%s.%s object for encoding %s at %#x>\"%\\\n (self.__class__.__module__,self.__class__.__qualname__,\n self.name,id(self))\n \nclass Codec:\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def encode(self,input,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n def decode(self,input,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \nclass IncrementalEncoder(object):\n ''\n\n\n\n \n def __init__(self,errors='strict'):\n ''\n\n\n\n\n\n \n self.errors=errors\n self.buffer=\"\"\n \n def encode(self,input,final=False):\n ''\n\n \n raise NotImplementedError\n \n def reset(self):\n ''\n\n \n \n def getstate(self):\n ''\n\n \n return 0\n \n def setstate(self,state):\n ''\n\n\n \n \nclass BufferedIncrementalEncoder(IncrementalEncoder):\n ''\n\n\n\n \n def __init__(self,errors='strict'):\n IncrementalEncoder.__init__(self,errors)\n \n self.buffer=\"\"\n \n def _buffer_encode(self,input,errors,final):\n \n \n raise NotImplementedError\n \n def encode(self,input,final=False):\n \n data=self.buffer+input\n (result,consumed)=self._buffer_encode(data,self.errors,final)\n \n self.buffer=data[consumed:]\n return result\n \n def reset(self):\n IncrementalEncoder.reset(self)\n self.buffer=\"\"\n \n def getstate(self):\n return self.buffer or 0\n \n def setstate(self,state):\n self.buffer=state or \"\"\n \nclass IncrementalDecoder(object):\n ''\n\n\n\n \n def __init__(self,errors='strict'):\n ''\n\n\n\n\n\n \n self.errors=errors\n \n def decode(self,input,final=False):\n ''\n\n \n raise NotImplementedError\n \n def reset(self):\n ''\n\n \n \n def getstate(self):\n ''\n\n\n\n\n\n\n\n\n\n \n return(b\"\",0)\n \n def setstate(self,state):\n ''\n\n\n\n\n \n \nclass BufferedIncrementalDecoder(IncrementalDecoder):\n ''\n\n\n\n \n def __init__(self,errors='strict'):\n IncrementalDecoder.__init__(self,errors)\n \n self.buffer=b\"\"\n \n def _buffer_decode(self,input,errors,final):\n \n \n raise NotImplementedError\n \n def decode(self,input,final=False):\n \n data=self.buffer+input\n (result,consumed)=self._buffer_decode(data,self.errors,final)\n \n self.buffer=data[consumed:]\n return result\n \n def reset(self):\n IncrementalDecoder.reset(self)\n self.buffer=b\"\"\n \n def getstate(self):\n \n return(self.buffer,0)\n \n def setstate(self,state):\n \n self.buffer=state[0]\n \n \n \n \n \n \n \n \nclass StreamWriter(Codec):\n\n def __init__(self,stream,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.stream=stream\n self.errors=errors\n \n def write(self,object):\n \n ''\n \n data,consumed=self.encode(object,self.errors)\n self.stream.write(data)\n \n def writelines(self,list):\n \n ''\n\n \n self.write(''.join(list))\n \n def reset(self):\n \n ''\n\n\n\n\n\n\n \n pass\n \n def seek(self,offset,whence=0):\n self.stream.seek(offset,whence)\n if whence ==0 and offset ==0:\n self.reset()\n \n def __getattr__(self,name,\n getattr=getattr):\n \n ''\n \n return getattr(self.stream,name)\n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,tb):\n self.stream.close()\n \n \n \nclass StreamReader(Codec):\n\n charbuffertype=str\n \n def __init__(self,stream,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.stream=stream\n self.errors=errors\n self.bytebuffer=b\"\"\n self._empty_charbuffer=self.charbuffertype()\n self.charbuffer=self._empty_charbuffer\n self.linebuffer=None\n \n def decode(self,input,errors='strict'):\n raise NotImplementedError\n \n def read(self,size=-1,chars=-1,firstline=False):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if self.linebuffer:\n self.charbuffer=self._empty_charbuffer.join(self.linebuffer)\n self.linebuffer=None\n \n if chars <0:\n \n \n chars=size\n \n \n while True:\n \n if chars >=0:\n if len(self.charbuffer)>=chars:\n break\n \n if size <0:\n newdata=self.stream.read()\n else:\n newdata=self.stream.read(size)\n \n data=self.bytebuffer+newdata\n if not data:\n break\n try:\n newchars,decodedbytes=self.decode(data,self.errors)\n except UnicodeDecodeError as exc:\n if firstline:\n newchars,decodedbytes=\\\n self.decode(data[:exc.start],self.errors)\n lines=newchars.splitlines(keepends=True)\n if len(lines)<=1:\n raise\n else:\n raise\n \n self.bytebuffer=data[decodedbytes:]\n \n self.charbuffer +=newchars\n \n if not newdata:\n break\n if chars <0:\n \n result=self.charbuffer\n self.charbuffer=self._empty_charbuffer\n else:\n \n result=self.charbuffer[:chars]\n self.charbuffer=self.charbuffer[chars:]\n return result\n \n def readline(self,size=None,keepends=True):\n \n ''\n\n\n\n\n\n \n \n \n if self.linebuffer:\n line=self.linebuffer[0]\n del self.linebuffer[0]\n if len(self.linebuffer)==1:\n \n \n self.charbuffer=self.linebuffer[0]\n self.linebuffer=None\n if not keepends:\n line=line.splitlines(keepends=False)[0]\n return line\n \n readsize=size or 72\n line=self._empty_charbuffer\n \n while True:\n data=self.read(readsize,firstline=True)\n if data:\n \n \n \n if(isinstance(data,str)and data.endswith(\"\\r\"))or\\\n (isinstance(data,bytes)and data.endswith(b\"\\r\")):\n data +=self.read(size=1,chars=1)\n \n line +=data\n lines=line.splitlines(keepends=True)\n if lines:\n if len(lines)>1:\n \n \n line=lines[0]\n del lines[0]\n if len(lines)>1:\n \n lines[-1]+=self.charbuffer\n self.linebuffer=lines\n self.charbuffer=None\n else:\n \n self.charbuffer=lines[0]+self.charbuffer\n if not keepends:\n line=line.splitlines(keepends=False)[0]\n break\n line0withend=lines[0]\n line0withoutend=lines[0].splitlines(keepends=False)[0]\n if line0withend !=line0withoutend:\n \n self.charbuffer=self._empty_charbuffer.join(lines[1:])+\\\n self.charbuffer\n if keepends:\n line=line0withend\n else:\n line=line0withoutend\n break\n \n if not data or size is not None:\n if line and not keepends:\n line=line.splitlines(keepends=False)[0]\n break\n if readsize <8000:\n readsize *=2\n return line\n \n def readlines(self,sizehint=None,keepends=True):\n \n ''\n\n\n\n\n\n\n\n\n \n data=self.read()\n return data.splitlines(keepends)\n \n def reset(self):\n \n ''\n\n\n\n\n\n \n self.bytebuffer=b\"\"\n self.charbuffer=self._empty_charbuffer\n self.linebuffer=None\n \n def seek(self,offset,whence=0):\n ''\n\n\n \n self.stream.seek(offset,whence)\n self.reset()\n \n def __next__(self):\n \n ''\n line=self.readline()\n if line:\n return line\n raise StopIteration\n \n def __iter__(self):\n return self\n \n def __getattr__(self,name,\n getattr=getattr):\n \n ''\n \n return getattr(self.stream,name)\n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,tb):\n self.stream.close()\n \n \n \nclass StreamReaderWriter:\n\n ''\n\n\n\n\n\n\n \n \n encoding='unknown'\n \n def __init__(self,stream,Reader,Writer,errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n \n self.stream=stream\n self.reader=Reader(stream,errors)\n self.writer=Writer(stream,errors)\n self.errors=errors\n \n def read(self,size=-1):\n \n return self.reader.read(size)\n \n def readline(self,size=None):\n \n return self.reader.readline(size)\n \n def readlines(self,sizehint=None):\n \n return self.reader.readlines(sizehint)\n \n def __next__(self):\n \n ''\n return next(self.reader)\n \n def __iter__(self):\n return self\n \n def write(self,data):\n \n return self.writer.write(data)\n \n def writelines(self,list):\n \n return self.writer.writelines(list)\n \n def reset(self):\n \n self.reader.reset()\n self.writer.reset()\n \n def seek(self,offset,whence=0):\n self.stream.seek(offset,whence)\n self.reader.reset()\n if whence ==0 and offset ==0:\n self.writer.reset()\n \n def __getattr__(self,name,\n getattr=getattr):\n \n ''\n \n return getattr(self.stream,name)\n \n \n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,tb):\n self.stream.close()\n \n \n \nclass StreamRecoder:\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n data_encoding='unknown'\n file_encoding='unknown'\n \n def __init__(self,stream,encode,decode,Reader,Writer,\n errors='strict'):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.stream=stream\n self.encode=encode\n self.decode=decode\n self.reader=Reader(stream,errors)\n self.writer=Writer(stream,errors)\n self.errors=errors\n \n def read(self,size=-1):\n \n data=self.reader.read(size)\n data,bytesencoded=self.encode(data,self.errors)\n return data\n \n def readline(self,size=None):\n \n if size is None:\n data=self.reader.readline()\n else:\n data=self.reader.readline(size)\n data,bytesencoded=self.encode(data,self.errors)\n return data\n \n def readlines(self,sizehint=None):\n \n data=self.reader.read()\n data,bytesencoded=self.encode(data,self.errors)\n return data.splitlines(keepends=True)\n \n def __next__(self):\n \n ''\n data=next(self.reader)\n data,bytesencoded=self.encode(data,self.errors)\n return data\n \n def __iter__(self):\n return self\n \n def write(self,data):\n \n data,bytesdecoded=self.decode(data,self.errors)\n return self.writer.write(data)\n \n def writelines(self,list):\n \n data=b''.join(list)\n data,bytesdecoded=self.decode(data,self.errors)\n return self.writer.write(data)\n \n def reset(self):\n \n self.reader.reset()\n self.writer.reset()\n \n def seek(self,offset,whence=0):\n \n \n self.reader.seek(offset,whence)\n self.writer.seek(offset,whence)\n \n def __getattr__(self,name,\n getattr=getattr):\n \n ''\n \n return getattr(self.stream,name)\n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,tb):\n self.stream.close()\n \n \n \ndef open(filename,mode='r',encoding=None,errors='strict',buffering=-1):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if encoding is not None and\\\n 'b'not in mode:\n \n mode=mode+'b'\n file=builtins.open(filename,mode,buffering)\n if encoding is None:\n return file\n \n try:\n info=lookup(encoding)\n srw=StreamReaderWriter(file,info.streamreader,info.streamwriter,errors)\n \n srw.encoding=encoding\n return srw\n except:\n file.close()\n raise\n \ndef EncodedFile(file,data_encoding,file_encoding=None,errors='strict'):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if file_encoding is None:\n file_encoding=data_encoding\n data_info=lookup(data_encoding)\n file_info=lookup(file_encoding)\n sr=StreamRecoder(file,data_info.encode,data_info.decode,\n file_info.streamreader,file_info.streamwriter,errors)\n \n sr.data_encoding=data_encoding\n sr.file_encoding=file_encoding\n return sr\n \n \n \ndef getencoder(encoding):\n\n ''\n\n\n\n\n \n return lookup(encoding).encode\n \ndef getdecoder(encoding):\n\n ''\n\n\n\n\n \n return lookup(encoding).decode\n \ndef getincrementalencoder(encoding):\n\n ''\n\n\n\n\n\n \n encoder=lookup(encoding).incrementalencoder\n if encoder is None:\n raise LookupError(encoding)\n return encoder\n \ndef getincrementaldecoder(encoding):\n\n ''\n\n\n\n\n\n \n decoder=lookup(encoding).incrementaldecoder\n if decoder is None:\n raise LookupError(encoding)\n return decoder\n \ndef getreader(encoding):\n\n ''\n\n\n\n\n \n return lookup(encoding).streamreader\n \ndef getwriter(encoding):\n\n ''\n\n\n\n\n \n return lookup(encoding).streamwriter\n \ndef iterencode(iterator,encoding,errors='strict',**kwargs):\n ''\n\n\n\n\n\n\n \n encoder=getincrementalencoder(encoding)(errors,**kwargs)\n for input in iterator:\n output=encoder.encode(input)\n if output:\n yield output\n output=encoder.encode(\"\",True)\n if output:\n yield output\n \ndef iterdecode(iterator,encoding,errors='strict',**kwargs):\n ''\n\n\n\n\n\n\n \n decoder=getincrementaldecoder(encoding)(errors,**kwargs)\n for input in iterator:\n output=decoder.decode(input)\n if output:\n yield output\n output=decoder.decode(b\"\",True)\n if output:\n yield output\n \n \n \ndef make_identity_dict(rng):\n\n ''\n\n\n\n\n \n return{i:i for i in rng}\n \ndef make_encoding_map(decoding_map):\n\n ''\n\n\n\n\n\n\n\n\n\n \n m={}\n for k,v in decoding_map.items():\n if not v in m:\n m[v]=k\n else:\n m[v]=None\n return m\n \n \n \ntry:\n strict_errors=lookup_error(\"strict\")\n ignore_errors=lookup_error(\"ignore\")\n replace_errors=lookup_error(\"replace\")\n xmlcharrefreplace_errors=lookup_error(\"xmlcharrefreplace\")\n backslashreplace_errors=lookup_error(\"backslashreplace\")\n namereplace_errors=lookup_error(\"namereplace\")\nexcept LookupError:\n\n strict_errors=None\n ignore_errors=None\n replace_errors=None\n xmlcharrefreplace_errors=None\n backslashreplace_errors=None\n namereplace_errors=None\n \n \n \n_false=0\nif _false:\n import encodings\n", ["_codecs", "builtins", "encodings", "sys"]], "codeop": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport __future__\nimport warnings\n\n_features=[getattr(__future__,fname)\nfor fname in __future__.all_feature_names]\n\n__all__=[\"compile_command\",\"Compile\",\"CommandCompiler\"]\n\n\n\n\nPyCF_DONT_IMPLY_DEDENT=0x200\nPyCF_ALLOW_INCOMPLETE_INPUT=0x4000\n\ndef _maybe_compile(compiler,source,filename,symbol):\n\n for line in source.split(\"\\n\"):\n line=line.strip()\n if line and line[0]!='#':\n break\n else :\n if symbol !=\"eval\":\n source=\"pass\"\n \n \n with warnings.catch_warnings():\n warnings.simplefilter(\"ignore\",(SyntaxWarning,DeprecationWarning))\n try :\n compiler(source,filename,symbol)\n except SyntaxError:\n try :\n compiler(source+\"\\n\",filename,symbol)\n return None\n except SyntaxError as e:\n if \"incomplete input\"in str(e):\n return None\n \n \n return compiler(source,filename,symbol)\n \n \ndef _is_syntax_error(err1,err2):\n rep1=repr(err1)\n rep2=repr(err2)\n if \"was never closed\"in rep1 and \"was never closed\"in rep2:\n return False\n if rep1 ==rep2:\n return True\n return False\n \ndef _compile(source,filename,symbol):\n return compile(source,filename,symbol,PyCF_DONT_IMPLY_DEDENT |PyCF_ALLOW_INCOMPLETE_INPUT)\n \ndef compile_command(source,filename=\"\",symbol=\"single\"):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return _maybe_compile(_compile,source,filename,symbol)\n \nclass Compile:\n ''\n\n\n \n def __init__(self):\n self.flags=PyCF_DONT_IMPLY_DEDENT |PyCF_ALLOW_INCOMPLETE_INPUT\n \n def __call__(self,source,filename,symbol):\n codeob=compile(source,filename,symbol,self.flags,True )\n for feature in _features:\n if codeob.co_flags&feature.compiler_flag:\n self.flags |=feature.compiler_flag\n return codeob\n \nclass CommandCompiler:\n ''\n\n\n\n \n \n def __init__(self,):\n self.compiler=Compile()\n \n def __call__(self,source,filename=\"\",symbol=\"single\"):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return _maybe_compile(self.compiler,source,filename,symbol)\n", ["__future__", "warnings"]], "colorsys": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\"rgb_to_yiq\",\"yiq_to_rgb\",\"rgb_to_hls\",\"hls_to_rgb\",\n\"rgb_to_hsv\",\"hsv_to_rgb\"]\n\n\n\nONE_THIRD=1.0 /3.0\nONE_SIXTH=1.0 /6.0\nTWO_THIRD=2.0 /3.0\n\n\n\n\n\n\n\n\ndef rgb_to_yiq(r,g,b):\n y=0.30 *r+0.59 *g+0.11 *b\n i=0.74 *(r -y)-0.27 *(b -y)\n q=0.48 *(r -y)+0.41 *(b -y)\n return (y,i,q)\n \ndef yiq_to_rgb(y,i,q):\n\n\n\n\n r=y+0.9468822170900693 *i+0.6235565819861433 *q\n g=y -0.27478764629897834 *i -0.6356910791873801 *q\n b=y -1.1085450346420322 *i+1.7090069284064666 *q\n \n if r <0.0:\n r=0.0\n if g <0.0:\n g=0.0\n if b <0.0:\n b=0.0\n if r >1.0:\n r=1.0\n if g >1.0:\n g=1.0\n if b >1.0:\n b=1.0\n return (r,g,b)\n \n \n \n \n \n \n \ndef rgb_to_hls(r,g,b):\n maxc=max(r,g,b)\n minc=min(r,g,b)\n sumc=(maxc+minc)\n rangec=(maxc -minc)\n l=sumc /2.0\n if minc ==maxc:\n return 0.0,l,0.0\n if l <=0.5:\n s=rangec /sumc\n else :\n s=rangec /(2.0 -sumc)\n rc=(maxc -r)/rangec\n gc=(maxc -g)/rangec\n bc=(maxc -b)/rangec\n if r ==maxc:\n h=bc -gc\n elif g ==maxc:\n h=2.0+rc -bc\n else :\n h=4.0+gc -rc\n h=(h /6.0)%1.0\n return h,l,s\n \ndef hls_to_rgb(h,l,s):\n if s ==0.0:\n return l,l,l\n if l <=0.5:\n m2=l *(1.0+s)\n else :\n m2=l+s -(l *s)\n m1=2.0 *l -m2\n return (_v(m1,m2,h+ONE_THIRD),_v(m1,m2,h),_v(m1,m2,h -ONE_THIRD))\n \ndef _v(m1,m2,hue):\n hue=hue %1.0\n if hue MAX_INTERPOLATION_DEPTH:\n raise InterpolationDepthError(option,section,rawval)\n while rest:\n p=rest.find(\"%\")\n if p <0:\n accum.append(rest)\n return\n if p >0:\n accum.append(rest[:p])\n rest=rest[p:]\n \n c=rest[1:2]\n if c ==\"%\":\n accum.append(\"%\")\n rest=rest[2:]\n elif c ==\"(\":\n m=self._KEYCRE.match(rest)\n if m is None:\n raise InterpolationSyntaxError(option,section,\n \"bad interpolation variable reference %r\"%rest)\n var=parser.optionxform(m.group(1))\n rest=rest[m.end():]\n try:\n v=map[var]\n except KeyError:\n raise InterpolationMissingOptionError(\n option,section,rawval,var)from None\n if \"%\"in v:\n self._interpolate_some(parser,option,accum,v,\n section,map,depth+1)\n else:\n accum.append(v)\n else:\n raise InterpolationSyntaxError(\n option,section,\n \"'%%' must be followed by '%%' or '(', \"\n \"found: %r\"%(rest,))\n \n \nclass ExtendedInterpolation(Interpolation):\n ''\n \n \n _KEYCRE=re.compile(r\"\\$\\{([^}]+)\\}\")\n \n def before_get(self,parser,section,option,value,defaults):\n L=[]\n self._interpolate_some(parser,option,L,value,section,defaults,1)\n return ''.join(L)\n \n def before_set(self,parser,section,option,value):\n tmp_value=value.replace('$$','')\n tmp_value=self._KEYCRE.sub('',tmp_value)\n if '$'in tmp_value:\n raise ValueError(\"invalid interpolation syntax in %r at \"\n \"position %d\"%(value,tmp_value.find('$')))\n return value\n \n def _interpolate_some(self,parser,option,accum,rest,section,map,\n depth):\n rawval=parser.get(section,option,raw=True,fallback=rest)\n if depth >MAX_INTERPOLATION_DEPTH:\n raise InterpolationDepthError(option,section,rawval)\n while rest:\n p=rest.find(\"$\")\n if p <0:\n accum.append(rest)\n return\n if p >0:\n accum.append(rest[:p])\n rest=rest[p:]\n \n c=rest[1:2]\n if c ==\"$\":\n accum.append(\"$\")\n rest=rest[2:]\n elif c ==\"{\":\n m=self._KEYCRE.match(rest)\n if m is None:\n raise InterpolationSyntaxError(option,section,\n \"bad interpolation variable reference %r\"%rest)\n path=m.group(1).split(':')\n rest=rest[m.end():]\n sect=section\n opt=option\n try:\n if len(path)==1:\n opt=parser.optionxform(path[0])\n v=map[opt]\n elif len(path)==2:\n sect=path[0]\n opt=parser.optionxform(path[1])\n v=parser.get(sect,opt,raw=True)\n else:\n raise InterpolationSyntaxError(\n option,section,\n \"More than one ':' found: %r\"%(rest,))\n except(KeyError,NoSectionError,NoOptionError):\n raise InterpolationMissingOptionError(\n option,section,rawval,\":\".join(path))from None\n if \"$\"in v:\n self._interpolate_some(parser,opt,accum,v,sect,\n dict(parser.items(sect,raw=True)),\n depth+1)\n else:\n accum.append(v)\n else:\n raise InterpolationSyntaxError(\n option,section,\n \"'$' must be followed by '$' or '{', \"\n \"found: %r\"%(rest,))\n \n \nclass LegacyInterpolation(Interpolation):\n ''\n \n \n _KEYCRE=re.compile(r\"%\\(([^)]*)\\)s|.\")\n \n def __init__(self,*args,**kwargs):\n super().__init__(*args,**kwargs)\n warnings.warn(\n \"LegacyInterpolation has been deprecated since Python 3.2 \"\n \"and will be removed from the configparser module in Python 3.13. \"\n \"Use BasicInterpolation or ExtendedInterpolation instead.\",\n DeprecationWarning,stacklevel=2\n )\n \n def before_get(self,parser,section,option,value,vars):\n rawval=value\n depth=MAX_INTERPOLATION_DEPTH\n while depth:\n depth -=1\n if value and \"%(\"in value:\n replace=functools.partial(self._interpolation_replace,\n parser=parser)\n value=self._KEYCRE.sub(replace,value)\n try:\n value=value %vars\n except KeyError as e:\n raise InterpolationMissingOptionError(\n option,section,rawval,e.args[0])from None\n else:\n break\n if value and \"%(\"in value:\n raise InterpolationDepthError(option,section,rawval)\n return value\n \n def before_set(self,parser,section,option,value):\n return value\n \n @staticmethod\n def _interpolation_replace(match,parser):\n s=match.group(1)\n if s is None:\n return match.group()\n else:\n return \"%%(%s)s\"%parser.optionxform(s)\n \n \nclass RawConfigParser(MutableMapping):\n ''\n \n \n _SECT_TMPL=r\"\"\"\n \\[ # [\n (?P

.+) # very permissive!\n \\] # ]\n \"\"\"\n _OPT_TMPL=r\"\"\"\n (?Pn'%(\n toprefix,num_chg)\n else :\n in_change=False\n \n if not flaglist:\n flaglist=[False ]\n next_id=['']\n next_href=['']\n last=0\n if context:\n fromlist=[' No Differences Found ']\n tolist=fromlist\n else :\n fromlist=tolist=[' Empty File ']\n \n if not flaglist[0]:\n next_href[0]='f'%toprefix\n \n next_href[last]='t'%(toprefix)\n \n return fromlist,tolist,flaglist,next_href,next_id\n \n def make_table(self,fromlines,tolines,fromdesc='',todesc='',context=False ,\n numlines=5):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n self._make_prefix()\n \n \n \n fromlines,tolines=self._tab_newline_replace(fromlines,tolines)\n \n \n if context:\n context_lines=numlines\n else :\n context_lines=None\n diffs=_mdiff(fromlines,tolines,context_lines,linejunk=self._linejunk,\n charjunk=self._charjunk)\n \n \n if self._wrapcolumn:\n diffs=self._line_wrapper(diffs)\n \n \n fromlist,tolist,flaglist=self._collect_lines(diffs)\n \n \n fromlist,tolist,flaglist,next_href,next_id=self._convert_flags(\n fromlist,tolist,flaglist,context,numlines)\n \n s=[]\n fmt=' %s%s'+\\\n '%s%s\\n'\n for i in range(len(flaglist)):\n if flaglist[i]is None :\n \n \n if i >0:\n s.append(' \\n \\n')\n else :\n s.append(fmt %(next_id[i],next_href[i],fromlist[i],\n next_href[i],tolist[i]))\n if fromdesc or todesc:\n header_row='%s%s%s%s'%(\n '
',\n '%s'%fromdesc,\n '
',\n '%s'%todesc)\n else :\n header_row=''\n \n table=self._table_template %dict(\n data_rows=''.join(s),\n header_row=header_row,\n prefix=self._prefix[1])\n \n return table.replace('\\0+','').\\\n replace('\\0-','').\\\n replace('\\0^','').\\\n replace('\\1','').\\\n replace('\\t',' ')\n \ndel re\n\ndef restore(delta,which):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n tag={1:\"- \",2:\"+ \"}[int(which)]\n except KeyError:\n raise ValueError('unknown delta choice (must be 1 or 2): %r'\n %which)from None\n prefixes=(\" \",tag)\n for line in delta:\n if line[:2]in prefixes:\n yield line[2:]\n \ndef _test():\n import doctest,difflib\n return doctest.testmod(difflib)\n \nif __name__ ==\"__main__\":\n _test()\n", ["collections", "difflib", "doctest", "heapq", "re", "types"]], "doctest": [".py", "\n\n\n\n\n\n\n\nr\"\"\"Module doctest -- a framework for running examples in docstrings.\n\nIn simplest use, end each module M to be tested with:\n\ndef _test():\n import doctest\n doctest.testmod()\n\nif __name__ == \"__main__\":\n _test()\n\nThen running the module as a script will cause the examples in the\ndocstrings to get executed and verified:\n\npython M.py\n\nThis won't display anything unless an example fails, in which case the\nfailing example(s) and the cause(s) of the failure(s) are printed to stdout\n(why not stderr? because stderr is a lame hack <0.2 wink>), and the final\nline of output is \"Test failed.\".\n\nRun it with the -v switch instead:\n\npython M.py -v\n\nand a detailed report of all examples tried is printed to stdout, along\nwith assorted summaries at the end.\n\nYou can force verbose mode by passing \"verbose=True\" to testmod, or prohibit\nit by passing \"verbose=False\". In either of those cases, sys.argv is not\nexamined by testmod.\n\nThere are a variety of other ways to run doctests, including integration\nwith the unittest framework, and support for running non-Python text\nfiles containing doctests. There are also many ways to override parts\nof doctest's default behaviors. See the Library Reference Manual for\ndetails.\n\"\"\"\n\n__docformat__='reStructuredText en'\n\n__all__=[\n\n'register_optionflag',\n'DONT_ACCEPT_TRUE_FOR_1',\n'DONT_ACCEPT_BLANKLINE',\n'NORMALIZE_WHITESPACE',\n'ELLIPSIS',\n'SKIP',\n'IGNORE_EXCEPTION_DETAIL',\n'COMPARISON_FLAGS',\n'REPORT_UDIFF',\n'REPORT_CDIFF',\n'REPORT_NDIFF',\n'REPORT_ONLY_FIRST_FAILURE',\n'REPORTING_FLAGS',\n'FAIL_FAST',\n\n\n'Example',\n'DocTest',\n\n'DocTestParser',\n\n'DocTestFinder',\n\n'DocTestRunner',\n'OutputChecker',\n'DocTestFailure',\n'UnexpectedException',\n'DebugRunner',\n\n'testmod',\n'testfile',\n'run_docstring_examples',\n\n'DocTestSuite',\n'DocFileSuite',\n'set_unittest_reportflags',\n\n'script_from_examples',\n'testsource',\n'debug_src',\n'debug',\n]\n\nimport __future__\nimport difflib\nimport inspect\nimport linecache\nimport os\nimport pdb\nimport re\nimport sys\nimport traceback\nimport unittest\nfrom io import StringIO,IncrementalNewlineDecoder\nfrom collections import namedtuple\n\nTestResults=namedtuple('TestResults','failed attempted')\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nOPTIONFLAGS_BY_NAME={}\ndef register_optionflag(name):\n\n return OPTIONFLAGS_BY_NAME.setdefault(name,1 <=2\n \n \n startpos,endpos=0,len(got)\n w=ws[0]\n if w:\n if got.startswith(w):\n startpos=len(w)\n del ws[0]\n else:\n return False\n w=ws[-1]\n if w:\n if got.endswith(w):\n endpos -=len(w)\n del ws[-1]\n else:\n return False\n \n if startpos >endpos:\n \n \n return False\n \n \n \n \n for w in ws:\n \n \n \n startpos=got.find(w,startpos,endpos)\n if startpos <0:\n return False\n startpos +=len(w)\n \n return True\n \ndef _comment_line(line):\n ''\n line=line.rstrip()\n if line:\n return '# '+line\n else:\n return '#'\n \ndef _strip_exception_details(msg):\n\n\n\n\n\n\n\n\n\n\n start,end=0,len(msg)\n \n i=msg.find(\"\\n\")\n if i >=0:\n end=i\n \n i=msg.find(':',0,end)\n if i >=0:\n end=i\n \n i=msg.rfind('.',0,end)\n if i >=0:\n start=i+1\n return msg[start:end]\n \nclass _OutputRedirectingPdb(pdb.Pdb):\n ''\n\n\n\n \n def __init__(self,out):\n self.__out=out\n self.__debugger_used=False\n \n pdb.Pdb.__init__(self,stdout=out,nosigint=True)\n \n self.use_rawinput=1\n \n def set_trace(self,frame=None):\n self.__debugger_used=True\n if frame is None:\n frame=sys._getframe().f_back\n pdb.Pdb.set_trace(self,frame)\n \n def set_continue(self):\n \n \n if self.__debugger_used:\n pdb.Pdb.set_continue(self)\n \n def trace_dispatch(self,*args):\n \n save_stdout=sys.stdout\n sys.stdout=self.__out\n \n try:\n return pdb.Pdb.trace_dispatch(self,*args)\n finally:\n sys.stdout=save_stdout\n \n \ndef _module_relative_path(module,test_path):\n if not inspect.ismodule(module):\n raise TypeError('Expected a module: %r'%module)\n if test_path.startswith('/'):\n raise ValueError('Module-relative files may not have absolute paths')\n \n \n test_path=os.path.join(*(test_path.split('/')))\n \n \n if hasattr(module,'__file__'):\n \n basedir=os.path.split(module.__file__)[0]\n elif module.__name__ =='__main__':\n \n if len(sys.argv)>0 and sys.argv[0]!='':\n basedir=os.path.split(sys.argv[0])[0]\n else:\n basedir=os.curdir\n else:\n if hasattr(module,'__path__'):\n for directory in module.__path__:\n fullpath=os.path.join(directory,test_path)\n if os.path.exists(fullpath):\n return fullpath\n \n \n raise ValueError(\"Can't resolve paths relative to the module \"\n \"%r (it has no __file__)\"\n %module.__name__)\n \n \n return os.path.join(basedir,test_path)\n \n \n \n \n \n \n \n \n \n \n \n \n \nclass Example:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,source,want,exc_msg=None,lineno=0,indent=0,\n options=None):\n \n if not source.endswith('\\n'):\n source +='\\n'\n if want and not want.endswith('\\n'):\n want +='\\n'\n if exc_msg is not None and not exc_msg.endswith('\\n'):\n exc_msg +='\\n'\n \n self.source=source\n self.want=want\n self.lineno=lineno\n self.indent=indent\n if options is None:options={}\n self.options=options\n self.exc_msg=exc_msg\n \n def __eq__(self,other):\n if type(self)is not type(other):\n return NotImplemented\n \n return self.source ==other.source and\\\n self.want ==other.want and\\\n self.lineno ==other.lineno and\\\n self.indent ==other.indent and\\\n self.options ==other.options and\\\n self.exc_msg ==other.exc_msg\n \n def __hash__(self):\n return hash((self.source,self.want,self.lineno,self.indent,\n self.exc_msg))\n \nclass DocTest:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,examples,globs,name,filename,lineno,docstring):\n ''\n\n\n \n assert not isinstance(examples,str),\\\n \"DocTest no longer accepts str; use DocTestParser instead\"\n self.examples=examples\n self.docstring=docstring\n self.globs=globs.copy()\n self.name=name\n self.filename=filename\n self.lineno=lineno\n \n def __repr__(self):\n if len(self.examples)==0:\n examples='no examples'\n elif len(self.examples)==1:\n examples='1 example'\n else:\n examples='%d examples'%len(self.examples)\n return('<%s %s from %s:%s (%s)>'%\n (self.__class__.__name__,\n self.name,self.filename,self.lineno,examples))\n \n def __eq__(self,other):\n if type(self)is not type(other):\n return NotImplemented\n \n return self.examples ==other.examples and\\\n self.docstring ==other.docstring and\\\n self.globs ==other.globs and\\\n self.name ==other.name and\\\n self.filename ==other.filename and\\\n self.lineno ==other.lineno\n \n def __hash__(self):\n return hash((self.docstring,self.name,self.filename,self.lineno))\n \n \n def __lt__(self,other):\n if not isinstance(other,DocTest):\n return NotImplemented\n return((self.name,self.filename,self.lineno,id(self))\n <\n (other.name,other.filename,other.lineno,id(other)))\n \n \n \n \n \nclass DocTestParser:\n ''\n\n \n \n \n \n \n \n _EXAMPLE_RE=re.compile(r'''\n # Source consists of a PS1 line followed by zero or more PS2 lines.\n (?P\n (?:^(?P [ ]*) >>> .*) # PS1 line\n (?:\\n [ ]* \\.\\.\\. .*)*) # PS2 lines\n \\n?\n # Want consists of any non-blank lines that do not start with PS1.\n (?P (?:(?![ ]*$) # Not a blank line\n (?![ ]*>>>) # Not a line starting with PS1\n .+$\\n? # But any other line\n )*)\n ''',re.MULTILINE |re.VERBOSE)\n \n \n \n \n \n \n \n \n \n \n _EXCEPTION_RE=re.compile(r\"\"\"\n # Grab the traceback header. Different versions of Python have\n # said different things on the first traceback line.\n ^(?P Traceback\\ \\(\n (?: most\\ recent\\ call\\ last\n | innermost\\ last\n ) \\) :\n )\n \\s* $ # toss trailing whitespace on the header.\n (?P .*?) # don't blink: absorb stuff until...\n ^ (?P \\w+ .*) # a line *starts* with alphanum.\n \"\"\",re.VERBOSE |re.MULTILINE |re.DOTALL)\n \n \n \n _IS_BLANK_OR_COMMENT=re.compile(r'^[ ]*(#.*)?$').match\n \n def parse(self,string,name=''):\n ''\n\n\n\n\n\n \n string=string.expandtabs()\n \n min_indent=self._min_indent(string)\n if min_indent >0:\n string='\\n'.join([l[min_indent:]for l in string.split('\\n')])\n \n output=[]\n charno,lineno=0,0\n \n for m in self._EXAMPLE_RE.finditer(string):\n \n output.append(string[charno:m.start()])\n \n lineno +=string.count('\\n',charno,m.start())\n \n (source,options,want,exc_msg)=\\\n self._parse_example(m,name,lineno)\n \n if not self._IS_BLANK_OR_COMMENT(source):\n output.append(Example(source,want,exc_msg,\n lineno=lineno,\n indent=min_indent+len(m.group('indent')),\n options=options))\n \n lineno +=string.count('\\n',m.start(),m.end())\n \n charno=m.end()\n \n output.append(string[charno:])\n return output\n \n def get_doctest(self,string,globs,name,filename,lineno):\n ''\n\n\n\n\n\n\n \n return DocTest(self.get_examples(string,name),globs,\n name,filename,lineno,string)\n \n def get_examples(self,string,name=''):\n ''\n\n\n\n\n\n\n\n\n \n return[x for x in self.parse(string,name)\n if isinstance(x,Example)]\n \n def _parse_example(self,m,name,lineno):\n ''\n\n\n\n\n\n\n\n\n \n \n indent=len(m.group('indent'))\n \n \n \n source_lines=m.group('source').split('\\n')\n self._check_prompt_blank(source_lines,indent,name,lineno)\n self._check_prefix(source_lines[1:],' '*indent+'.',name,lineno)\n source='\\n'.join([sl[indent+4:]for sl in source_lines])\n \n \n \n \n want=m.group('want')\n want_lines=want.split('\\n')\n if len(want_lines)>1 and re.match(r' *$',want_lines[-1]):\n del want_lines[-1]\n self._check_prefix(want_lines,' '*indent,name,\n lineno+len(source_lines))\n want='\\n'.join([wl[indent:]for wl in want_lines])\n \n \n m=self._EXCEPTION_RE.match(want)\n if m:\n exc_msg=m.group('msg')\n else:\n exc_msg=None\n \n \n options=self._find_options(source,name,lineno)\n \n return source,options,want,exc_msg\n \n \n \n \n \n \n \n \n _OPTION_DIRECTIVE_RE=re.compile(r'#\\s*doctest:\\s*([^\\n\\'\"]*)$',\n re.MULTILINE)\n \n def _find_options(self,source,name,lineno):\n ''\n\n\n\n\n\n \n options={}\n \n for m in self._OPTION_DIRECTIVE_RE.finditer(source):\n option_strings=m.group(1).replace(',',' ').split()\n for option in option_strings:\n if(option[0]not in '+-'or\n option[1:]not in OPTIONFLAGS_BY_NAME):\n raise ValueError('line %r of the doctest for %s '\n 'has an invalid option: %r'%\n (lineno+1,name,option))\n flag=OPTIONFLAGS_BY_NAME[option[1:]]\n options[flag]=(option[0]=='+')\n if options and self._IS_BLANK_OR_COMMENT(source):\n raise ValueError('line %r of the doctest for %s has an option '\n 'directive on a line with no example: %r'%\n (lineno,name,source))\n return options\n \n \n \n _INDENT_RE=re.compile(r'^([ ]*)(?=\\S)',re.MULTILINE)\n \n def _min_indent(self,s):\n ''\n indents=[len(indent)for indent in self._INDENT_RE.findall(s)]\n if len(indents)>0:\n return min(indents)\n else:\n return 0\n \n def _check_prompt_blank(self,lines,indent,name,lineno):\n ''\n\n\n\n\n \n for i,line in enumerate(lines):\n if len(line)>=indent+4 and line[indent+3]!=' ':\n raise ValueError('line %r of the docstring for %s '\n 'lacks blank after %s: %r'%\n (lineno+i+1,name,\n line[indent:indent+3],line))\n \n def _check_prefix(self,lines,prefix,name,lineno):\n ''\n\n\n \n for i,line in enumerate(lines):\n if line and not line.startswith(prefix):\n raise ValueError('line %r of the docstring for %s has '\n 'inconsistent leading whitespace: %r'%\n (lineno+i+1,name,line))\n \n \n \n \n \n \nclass DocTestFinder:\n ''\n\n\n\n\n\n \n \n def __init__(self,verbose=False,parser=DocTestParser(),\n recurse=True,exclude_empty=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self._parser=parser\n self._verbose=verbose\n self._recurse=recurse\n self._exclude_empty=exclude_empty\n \n def find(self,obj,name=None,module=None,globs=None,extraglobs=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if name is None:\n name=getattr(obj,'__name__',None)\n if name is None:\n raise ValueError(\"DocTestFinder.find: name must be given \"\n \"when obj.__name__ doesn't exist: %r\"%\n (type(obj),))\n \n \n \n \n if module is False:\n module=None\n elif module is None:\n module=inspect.getmodule(obj)\n \n \n \n \n try:\n file=inspect.getsourcefile(obj)\n except TypeError:\n source_lines=None\n else:\n if not file:\n \n \n file=inspect.getfile(obj)\n if not file[0]+file[-2:]=='<]>':file=None\n if file is None:\n source_lines=None\n else:\n if module is not None:\n \n \n \n source_lines=linecache.getlines(file,module.__dict__)\n else:\n \n \n source_lines=linecache.getlines(file)\n if not source_lines:\n source_lines=None\n \n \n if globs is None:\n if module is None:\n globs={}\n else:\n globs=module.__dict__.copy()\n else:\n globs=globs.copy()\n if extraglobs is not None:\n globs.update(extraglobs)\n if '__name__'not in globs:\n globs['__name__']='__main__'\n \n \n tests=[]\n self._find(tests,obj,name,module,source_lines,globs,{})\n \n \n \n \n tests.sort()\n return tests\n \n def _from_module(self,module,object):\n ''\n\n\n \n if module is None:\n return True\n elif inspect.getmodule(object)is not None:\n return module is inspect.getmodule(object)\n elif inspect.isfunction(object):\n return module.__dict__ is object.__globals__\n elif(inspect.ismethoddescriptor(object)or\n inspect.ismethodwrapper(object)):\n if hasattr(object,'__objclass__'):\n obj_mod=object.__objclass__.__module__\n elif hasattr(object,'__module__'):\n obj_mod=object.__module__\n else:\n return True\n return module.__name__ ==obj_mod\n elif inspect.isclass(object):\n return module.__name__ ==object.__module__\n elif hasattr(object,'__module__'):\n return module.__name__ ==object.__module__\n elif isinstance(object,property):\n return True\n else:\n raise ValueError(\"object must be a class or function\")\n \n def _is_routine(self,obj):\n ''\n\n \n maybe_routine=obj\n try:\n maybe_routine=inspect.unwrap(maybe_routine)\n except ValueError:\n pass\n return inspect.isroutine(maybe_routine)\n \n def _find(self,tests,obj,name,module,source_lines,globs,seen):\n ''\n\n\n \n if self._verbose:\n print('Finding tests in %s'%name)\n \n \n if id(obj)in seen:\n return\n seen[id(obj)]=1\n \n \n test=self._get_test(obj,name,module,globs,source_lines)\n if test is not None:\n tests.append(test)\n \n \n if inspect.ismodule(obj)and self._recurse:\n for valname,val in obj.__dict__.items():\n valname='%s.%s'%(name,valname)\n \n \n if((self._is_routine(val)or inspect.isclass(val))and\n self._from_module(module,val)):\n self._find(tests,val,valname,module,source_lines,\n globs,seen)\n \n \n if inspect.ismodule(obj)and self._recurse:\n for valname,val in getattr(obj,'__test__',{}).items():\n if not isinstance(valname,str):\n raise ValueError(\"DocTestFinder.find: __test__ keys \"\n \"must be strings: %r\"%\n (type(valname),))\n if not(inspect.isroutine(val)or inspect.isclass(val)or\n inspect.ismodule(val)or isinstance(val,str)):\n raise ValueError(\"DocTestFinder.find: __test__ values \"\n \"must be strings, functions, methods, \"\n \"classes, or modules: %r\"%\n (type(val),))\n valname='%s.__test__.%s'%(name,valname)\n self._find(tests,val,valname,module,source_lines,\n globs,seen)\n \n \n if inspect.isclass(obj)and self._recurse:\n for valname,val in obj.__dict__.items():\n \n if isinstance(val,(staticmethod,classmethod)):\n val=val.__func__\n \n \n if((inspect.isroutine(val)or inspect.isclass(val)or\n isinstance(val,property))and\n self._from_module(module,val)):\n valname='%s.%s'%(name,valname)\n self._find(tests,val,valname,module,source_lines,\n globs,seen)\n \n def _get_test(self,obj,name,module,globs,source_lines):\n ''\n\n\n \n \n \n if isinstance(obj,str):\n docstring=obj\n else:\n try:\n if obj.__doc__ is None:\n docstring=''\n else:\n docstring=obj.__doc__\n if not isinstance(docstring,str):\n docstring=str(docstring)\n except(TypeError,AttributeError):\n docstring=''\n \n \n lineno=self._find_lineno(obj,source_lines)\n \n \n if self._exclude_empty and not docstring:\n return None\n \n \n if module is None:\n filename=None\n else:\n \n filename=getattr(module,'__file__',None)or module.__name__\n if filename[-4:]==\".pyc\":\n filename=filename[:-1]\n return self._parser.get_doctest(docstring,globs,name,\n filename,lineno)\n \n def _find_lineno(self,obj,source_lines):\n ''\n\n\n\n \n lineno=None\n docstring=getattr(obj,'__doc__',None)\n \n \n if inspect.ismodule(obj)and docstring is not None:\n lineno=0\n \n \n \n \n if inspect.isclass(obj)and docstring is not None:\n if source_lines is None:\n return None\n pat=re.compile(r'^\\s*class\\s*%s\\b'%\n getattr(obj,'__name__','-'))\n for i,line in enumerate(source_lines):\n if pat.match(line):\n lineno=i\n break\n \n \n if inspect.ismethod(obj):obj=obj.__func__\n if inspect.isfunction(obj)and getattr(obj,'__doc__',None):\n \n obj=obj.__code__\n if inspect.istraceback(obj):obj=obj.tb_frame\n if inspect.isframe(obj):obj=obj.f_code\n if inspect.iscode(obj):\n lineno=obj.co_firstlineno -1\n \n \n \n \n \n \n if lineno is not None:\n if source_lines is None:\n return lineno+1\n pat=re.compile(r'(^|.*:)\\s*\\w*(\"|\\')')\n for lineno in range(lineno,len(source_lines)):\n if pat.match(source_lines[lineno]):\n return lineno\n \n \n return None\n \n \n \n \n \nclass DocTestRunner:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n DIVIDER=\"*\"*70\n \n def __init__(self,checker=None,verbose=None,optionflags=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self._checker=checker or OutputChecker()\n if verbose is None:\n verbose='-v'in sys.argv\n self._verbose=verbose\n self.optionflags=optionflags\n self.original_optionflags=optionflags\n \n \n self.tries=0\n self.failures=0\n self._name2ft={}\n \n \n self._fakeout=_SpoofOut()\n \n \n \n \n \n def report_start(self,out,test,example):\n ''\n\n\n \n if self._verbose:\n if example.want:\n out('Trying:\\n'+_indent(example.source)+\n 'Expecting:\\n'+_indent(example.want))\n else:\n out('Trying:\\n'+_indent(example.source)+\n 'Expecting nothing\\n')\n \n def report_success(self,out,test,example,got):\n ''\n\n\n \n if self._verbose:\n out(\"ok\\n\")\n \n def report_failure(self,out,test,example,got):\n ''\n\n \n out(self._failure_header(test,example)+\n self._checker.output_difference(example,got,self.optionflags))\n \n def report_unexpected_exception(self,out,test,example,exc_info):\n ''\n\n \n out(self._failure_header(test,example)+\n 'Exception raised:\\n'+_indent(_exception_traceback(exc_info)))\n \n def _failure_header(self,test,example):\n out=[self.DIVIDER]\n if test.filename:\n if test.lineno is not None and example.lineno is not None:\n lineno=test.lineno+example.lineno+1\n else:\n lineno='?'\n out.append('File \"%s\", line %s, in %s'%\n (test.filename,lineno,test.name))\n else:\n out.append('Line %s, in %s'%(example.lineno+1,test.name))\n out.append('Failed example:')\n source=example.source\n out.append(_indent(source))\n return '\\n'.join(out)\n \n \n \n \n \n def __run(self,test,compileflags,out):\n ''\n\n\n\n\n\n\n\n \n \n failures=tries=0\n \n \n \n original_optionflags=self.optionflags\n \n SUCCESS,FAILURE,BOOM=range(3)\n \n check=self._checker.check_output\n \n \n for examplenum,example in enumerate(test.examples):\n \n \n \n quiet=(self.optionflags&REPORT_ONLY_FIRST_FAILURE and\n failures >0)\n \n \n self.optionflags=original_optionflags\n if example.options:\n for(optionflag,val)in example.options.items():\n if val:\n self.optionflags |=optionflag\n else:\n self.optionflags &=~optionflag\n \n \n if self.optionflags&SKIP:\n continue\n \n \n tries +=1\n if not quiet:\n self.report_start(out,test,example)\n \n \n \n \n filename=''%(test.name,examplenum)\n \n \n \n \n try:\n \n exec(compile(example.source,filename,\"single\",\n compileflags,True),test.globs)\n self.debugger.set_continue()\n exception=None\n except KeyboardInterrupt:\n raise\n except:\n exception=sys.exc_info()\n self.debugger.set_continue()\n \n got=self._fakeout.getvalue()\n self._fakeout.truncate(0)\n outcome=FAILURE\n \n \n \n if exception is None:\n if check(example.want,got,self.optionflags):\n outcome=SUCCESS\n \n \n else:\n exc_msg=traceback.format_exception_only(*exception[:2])[-1]\n if not quiet:\n got +=_exception_traceback(exception)\n \n \n \n if example.exc_msg is None:\n outcome=BOOM\n \n \n elif check(example.exc_msg,exc_msg,self.optionflags):\n outcome=SUCCESS\n \n \n elif self.optionflags&IGNORE_EXCEPTION_DETAIL:\n if check(_strip_exception_details(example.exc_msg),\n _strip_exception_details(exc_msg),\n self.optionflags):\n outcome=SUCCESS\n \n \n if outcome is SUCCESS:\n if not quiet:\n self.report_success(out,test,example,got)\n elif outcome is FAILURE:\n if not quiet:\n self.report_failure(out,test,example,got)\n failures +=1\n elif outcome is BOOM:\n if not quiet:\n self.report_unexpected_exception(out,test,example,\n exception)\n failures +=1\n else:\n assert False,(\"unknown outcome\",outcome)\n \n if failures and self.optionflags&FAIL_FAST:\n break\n \n \n self.optionflags=original_optionflags\n \n \n self.__record_outcome(test,failures,tries)\n return TestResults(failures,tries)\n \n def __record_outcome(self,test,f,t):\n ''\n\n\n \n f2,t2=self._name2ft.get(test.name,(0,0))\n self._name2ft[test.name]=(f+f2,t+t2)\n self.failures +=f\n self.tries +=t\n \n __LINECACHE_FILENAME_RE=re.compile(r'.+)'\n r'\\[(?P\\d+)\\]>$')\n def __patched_linecache_getlines(self,filename,module_globals=None):\n m=self.__LINECACHE_FILENAME_RE.match(filename)\n if m and m.group('name')==self.test.name:\n example=self.test.examples[int(m.group('examplenum'))]\n return example.source.splitlines(keepends=True)\n else:\n return self.save_linecache_getlines(filename,module_globals)\n \n def run(self,test,compileflags=None,out=None,clear_globs=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.test=test\n \n if compileflags is None:\n compileflags=_extract_future_flags(test.globs)\n \n save_stdout=sys.stdout\n if out is None:\n encoding=save_stdout.encoding\n if encoding is None or encoding.lower()=='utf-8':\n out=save_stdout.write\n else:\n \n def out(s):\n s=str(s.encode(encoding,'backslashreplace'),encoding)\n save_stdout.write(s)\n sys.stdout=self._fakeout\n \n \n \n \n \n \n save_trace=sys.gettrace()\n save_set_trace=pdb.set_trace\n self.debugger=_OutputRedirectingPdb(save_stdout)\n self.debugger.reset()\n pdb.set_trace=self.debugger.set_trace\n \n \n \n self.save_linecache_getlines=linecache.getlines\n linecache.getlines=self.__patched_linecache_getlines\n \n \n save_displayhook=sys.displayhook\n sys.displayhook=sys.__displayhook__\n \n try:\n return self.__run(test,compileflags,out)\n finally:\n sys.stdout=save_stdout\n pdb.set_trace=save_set_trace\n sys.settrace(save_trace)\n linecache.getlines=self.save_linecache_getlines\n sys.displayhook=save_displayhook\n if clear_globs:\n test.globs.clear()\n import builtins\n builtins._=None\n \n \n \n \n def summarize(self,verbose=None):\n ''\n\n\n\n\n\n\n\n\n \n if verbose is None:\n verbose=self._verbose\n notests=[]\n passed=[]\n failed=[]\n totalt=totalf=0\n for x in self._name2ft.items():\n name,(f,t)=x\n assert f <=t\n totalt +=t\n totalf +=f\n if t ==0:\n notests.append(name)\n elif f ==0:\n passed.append((name,t))\n else:\n failed.append(x)\n if verbose:\n if notests:\n print(len(notests),\"items had no tests:\")\n notests.sort()\n for thing in notests:\n print(\" \",thing)\n if passed:\n print(len(passed),\"items passed all tests:\")\n passed.sort()\n for thing,count in passed:\n print(\" %3d tests in %s\"%(count,thing))\n if failed:\n print(self.DIVIDER)\n print(len(failed),\"items had failures:\")\n failed.sort()\n for thing,(f,t)in failed:\n print(\" %3d of %3d in %s\"%(f,t,thing))\n if verbose:\n print(totalt,\"tests in\",len(self._name2ft),\"items.\")\n print(totalt -totalf,\"passed and\",totalf,\"failed.\")\n if totalf:\n print(\"***Test Failed***\",totalf,\"failures.\")\n elif verbose:\n print(\"Test passed.\")\n return TestResults(totalf,totalt)\n \n \n \n \n def merge(self,other):\n d=self._name2ft\n for name,(f,t)in other._name2ft.items():\n if name in d:\n \n \n \n \n f2,t2=d[name]\n f=f+f2\n t=t+t2\n d[name]=f,t\n \nclass OutputChecker:\n ''\n\n\n\n\n\n \n def _toAscii(self,s):\n ''\n\n \n return str(s.encode('ASCII','backslashreplace'),\"ASCII\")\n \n def check_output(self,want,got,optionflags):\n ''\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n got=self._toAscii(got)\n want=self._toAscii(want)\n \n \n \n if got ==want:\n return True\n \n \n \n if not(optionflags&DONT_ACCEPT_TRUE_FOR_1):\n if(got,want)==(\"True\\n\",\"1\\n\"):\n return True\n if(got,want)==(\"False\\n\",\"0\\n\"):\n return True\n \n \n \n if not(optionflags&DONT_ACCEPT_BLANKLINE):\n \n want=re.sub(r'(?m)^%s\\s*?$'%re.escape(BLANKLINE_MARKER),\n '',want)\n \n \n got=re.sub(r'(?m)^[^\\S\\n]+$','',got)\n if got ==want:\n return True\n \n \n \n \n if optionflags&NORMALIZE_WHITESPACE:\n got=' '.join(got.split())\n want=' '.join(want.split())\n if got ==want:\n return True\n \n \n \n if optionflags&ELLIPSIS:\n if _ellipsis_match(want,got):\n return True\n \n \n return False\n \n \n def _do_a_fancy_diff(self,want,got,optionflags):\n \n if not optionflags&(REPORT_UDIFF |\n REPORT_CDIFF |\n REPORT_NDIFF):\n return False\n \n \n \n \n \n \n \n \n \n \n \n if optionflags&REPORT_NDIFF:\n return True\n \n \n return want.count('\\n')>2 and got.count('\\n')>2\n \n def output_difference(self,example,got,optionflags):\n ''\n\n\n\n\n \n want=example.want\n \n \n if not(optionflags&DONT_ACCEPT_BLANKLINE):\n got=re.sub('(?m)^[ ]*(?=\\n)',BLANKLINE_MARKER,got)\n \n \n if self._do_a_fancy_diff(want,got,optionflags):\n \n want_lines=want.splitlines(keepends=True)\n got_lines=got.splitlines(keepends=True)\n \n if optionflags&REPORT_UDIFF:\n diff=difflib.unified_diff(want_lines,got_lines,n=2)\n diff=list(diff)[2:]\n kind='unified diff with -expected +actual'\n elif optionflags&REPORT_CDIFF:\n diff=difflib.context_diff(want_lines,got_lines,n=2)\n diff=list(diff)[2:]\n kind='context diff with expected followed by actual'\n elif optionflags&REPORT_NDIFF:\n engine=difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK)\n diff=list(engine.compare(want_lines,got_lines))\n kind='ndiff with -expected +actual'\n else:\n assert 0,'Bad diff option'\n return 'Differences (%s):\\n'%kind+_indent(''.join(diff))\n \n \n \n if want and got:\n return 'Expected:\\n%sGot:\\n%s'%(_indent(want),_indent(got))\n elif want:\n return 'Expected:\\n%sGot nothing\\n'%_indent(want)\n elif got:\n return 'Expected nothing\\nGot:\\n%s'%_indent(got)\n else:\n return 'Expected nothing\\nGot nothing\\n'\n \nclass DocTestFailure(Exception):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,test,example,got):\n self.test=test\n self.example=example\n self.got=got\n \n def __str__(self):\n return str(self.test)\n \nclass UnexpectedException(Exception):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,test,example,exc_info):\n self.test=test\n self.example=example\n self.exc_info=exc_info\n \n def __str__(self):\n return str(self.test)\n \nclass DebugRunner(DocTestRunner):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def run(self,test,compileflags=None,out=None,clear_globs=True):\n r=DocTestRunner.run(self,test,compileflags,out,False)\n if clear_globs:\n test.globs.clear()\n return r\n \n def report_unexpected_exception(self,out,test,example,exc_info):\n raise UnexpectedException(test,example,exc_info)\n \n def report_failure(self,out,test,example,got):\n raise DocTestFailure(test,example,got)\n \n \n \n \n \n \n \n \nmaster=None\n\ndef testmod(m=None,name=None,globs=None,verbose=None,\nreport=True,optionflags=0,extraglobs=None,\nraise_on_error=False,exclude_empty=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global master\n \n \n if m is None:\n \n \n \n m=sys.modules.get('__main__')\n \n \n if not inspect.ismodule(m):\n raise TypeError(\"testmod: module required; %r\"%(m,))\n \n \n if name is None:\n name=m.__name__\n \n \n finder=DocTestFinder(exclude_empty=exclude_empty)\n \n if raise_on_error:\n runner=DebugRunner(verbose=verbose,optionflags=optionflags)\n else:\n runner=DocTestRunner(verbose=verbose,optionflags=optionflags)\n \n for test in finder.find(m,name,globs=globs,extraglobs=extraglobs):\n runner.run(test)\n \n if report:\n runner.summarize()\n \n if master is None:\n master=runner\n else:\n master.merge(runner)\n \n return TestResults(runner.failures,runner.tries)\n \ndef testfile(filename,module_relative=True,name=None,package=None,\nglobs=None,verbose=None,report=True,optionflags=0,\nextraglobs=None,raise_on_error=False,parser=DocTestParser(),\nencoding=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global master\n \n if package and not module_relative:\n raise ValueError(\"Package may only be specified for module-\"\n \"relative paths.\")\n \n \n text,filename=_load_testfile(filename,package,module_relative,\n encoding or \"utf-8\")\n \n \n if name is None:\n name=os.path.basename(filename)\n \n \n if globs is None:\n globs={}\n else:\n globs=globs.copy()\n if extraglobs is not None:\n globs.update(extraglobs)\n if '__name__'not in globs:\n globs['__name__']='__main__'\n \n if raise_on_error:\n runner=DebugRunner(verbose=verbose,optionflags=optionflags)\n else:\n runner=DocTestRunner(verbose=verbose,optionflags=optionflags)\n \n \n test=parser.get_doctest(text,globs,name,filename,0)\n runner.run(test)\n \n if report:\n runner.summarize()\n \n if master is None:\n master=runner\n else:\n master.merge(runner)\n \n return TestResults(runner.failures,runner.tries)\n \ndef run_docstring_examples(f,globs,verbose=False,name=\"NoName\",\ncompileflags=None,optionflags=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n finder=DocTestFinder(verbose=verbose,recurse=False)\n runner=DocTestRunner(verbose=verbose,optionflags=optionflags)\n for test in finder.find(f,name,globs=globs):\n runner.run(test,compileflags=compileflags)\n \n \n \n \n \n_unittest_reportflags=0\n\ndef set_unittest_reportflags(flags):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global _unittest_reportflags\n \n if(flags&REPORTING_FLAGS)!=flags:\n raise ValueError(\"Only reporting flags allowed\",flags)\n old=_unittest_reportflags\n _unittest_reportflags=flags\n return old\n \n \nclass DocTestCase(unittest.TestCase):\n\n def __init__(self,test,optionflags=0,setUp=None,tearDown=None,\n checker=None):\n \n unittest.TestCase.__init__(self)\n self._dt_optionflags=optionflags\n self._dt_checker=checker\n self._dt_globs=test.globs.copy()\n self._dt_test=test\n self._dt_setUp=setUp\n self._dt_tearDown=tearDown\n \n def setUp(self):\n test=self._dt_test\n \n if self._dt_setUp is not None:\n self._dt_setUp(test)\n \n def tearDown(self):\n test=self._dt_test\n \n if self._dt_tearDown is not None:\n self._dt_tearDown(test)\n \n \n test.globs.clear()\n test.globs.update(self._dt_globs)\n \n def runTest(self):\n test=self._dt_test\n old=sys.stdout\n new=StringIO()\n optionflags=self._dt_optionflags\n \n if not(optionflags&REPORTING_FLAGS):\n \n \n optionflags |=_unittest_reportflags\n \n runner=DocTestRunner(optionflags=optionflags,\n checker=self._dt_checker,verbose=False)\n \n try:\n runner.DIVIDER=\"-\"*70\n failures,tries=runner.run(\n test,out=new.write,clear_globs=False)\n finally:\n sys.stdout=old\n \n if failures:\n raise self.failureException(self.format_failure(new.getvalue()))\n \n def format_failure(self,err):\n test=self._dt_test\n if test.lineno is None:\n lineno='unknown line number'\n else:\n lineno='%s'%test.lineno\n lname='.'.join(test.name.split('.')[-1:])\n return('Failed doctest test for %s\\n'\n ' File \"%s\", line %s, in %s\\n\\n%s'\n %(test.name,test.filename,lineno,lname,err)\n )\n \n def debug(self):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n self.setUp()\n runner=DebugRunner(optionflags=self._dt_optionflags,\n checker=self._dt_checker,verbose=False)\n runner.run(self._dt_test,clear_globs=False)\n self.tearDown()\n \n def id(self):\n return self._dt_test.name\n \n def __eq__(self,other):\n if type(self)is not type(other):\n return NotImplemented\n \n return self._dt_test ==other._dt_test and\\\n self._dt_optionflags ==other._dt_optionflags and\\\n self._dt_setUp ==other._dt_setUp and\\\n self._dt_tearDown ==other._dt_tearDown and\\\n self._dt_checker ==other._dt_checker\n \n def __hash__(self):\n return hash((self._dt_optionflags,self._dt_setUp,self._dt_tearDown,\n self._dt_checker))\n \n def __repr__(self):\n name=self._dt_test.name.split('.')\n return \"%s (%s)\"%(name[-1],'.'.join(name[:-1]))\n \n __str__=object.__str__\n \n def shortDescription(self):\n return \"Doctest: \"+self._dt_test.name\n \nclass SkipDocTestCase(DocTestCase):\n def __init__(self,module):\n self.module=module\n DocTestCase.__init__(self,None)\n \n def setUp(self):\n self.skipTest(\"DocTestSuite will not work with -O2 and above\")\n \n def test_skip(self):\n pass\n \n def shortDescription(self):\n return \"Skipping tests from %s\"%self.module.__name__\n \n __str__=shortDescription\n \n \nclass _DocTestSuite(unittest.TestSuite):\n\n def _removeTestAtIndex(self,index):\n pass\n \n \ndef DocTestSuite(module=None,globs=None,extraglobs=None,test_finder=None,\n**options):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if test_finder is None:\n test_finder=DocTestFinder()\n \n module=_normalize_module(module)\n tests=test_finder.find(module,globs=globs,extraglobs=extraglobs)\n \n if not tests and sys.flags.optimize >=2:\n \n suite=_DocTestSuite()\n suite.addTest(SkipDocTestCase(module))\n return suite\n \n tests.sort()\n suite=_DocTestSuite()\n \n for test in tests:\n if len(test.examples)==0:\n continue\n if not test.filename:\n filename=module.__file__\n if filename[-4:]==\".pyc\":\n filename=filename[:-1]\n test.filename=filename\n suite.addTest(DocTestCase(test,**options))\n \n return suite\n \nclass DocFileCase(DocTestCase):\n\n def id(self):\n return '_'.join(self._dt_test.name.split('.'))\n \n def __repr__(self):\n return self._dt_test.filename\n \n def format_failure(self,err):\n return('Failed doctest test for %s\\n File \"%s\", line 0\\n\\n%s'\n %(self._dt_test.name,self._dt_test.filename,err)\n )\n \ndef DocFileTest(path,module_relative=True,package=None,\nglobs=None,parser=DocTestParser(),\nencoding=None,**options):\n if globs is None:\n globs={}\n else:\n globs=globs.copy()\n \n if package and not module_relative:\n raise ValueError(\"Package may only be specified for module-\"\n \"relative paths.\")\n \n \n doc,path=_load_testfile(path,package,module_relative,\n encoding or \"utf-8\")\n \n if \"__file__\"not in globs:\n globs[\"__file__\"]=path\n \n \n name=os.path.basename(path)\n \n \n test=parser.get_doctest(doc,globs,name,path,0)\n return DocFileCase(test,**options)\n \ndef DocFileSuite(*paths,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n suite=_DocTestSuite()\n \n \n \n \n if kw.get('module_relative',True):\n kw['package']=_normalize_module(kw.get('package'))\n \n for path in paths:\n suite.addTest(DocFileTest(path,**kw))\n \n return suite\n \n \n \n \n \ndef script_from_examples(s):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n output=[]\n for piece in DocTestParser().parse(s):\n if isinstance(piece,Example):\n \n output.append(piece.source[:-1])\n \n want=piece.want\n if want:\n output.append('# Expected:')\n output +=['## '+l for l in want.split('\\n')[:-1]]\n else:\n \n output +=[_comment_line(l)\n for l in piece.split('\\n')[:-1]]\n \n \n while output and output[-1]=='#':\n output.pop()\n while output and output[0]=='#':\n output.pop(0)\n \n \n return '\\n'.join(output)+'\\n'\n \ndef testsource(module,name):\n ''\n\n\n\n\n \n module=_normalize_module(module)\n tests=DocTestFinder().find(module)\n test=[t for t in tests if t.name ==name]\n if not test:\n raise ValueError(name,\"not found in tests\")\n test=test[0]\n testsrc=script_from_examples(test.docstring)\n return testsrc\n \ndef debug_src(src,pm=False,globs=None):\n ''\n testsrc=script_from_examples(src)\n debug_script(testsrc,pm,globs)\n \ndef debug_script(src,pm=False,globs=None):\n ''\n import pdb\n \n if globs:\n globs=globs.copy()\n else:\n globs={}\n \n if pm:\n try:\n exec(src,globs,globs)\n except:\n print(sys.exc_info()[1])\n p=pdb.Pdb(nosigint=True)\n p.reset()\n p.interaction(None,sys.exc_info()[2])\n else:\n pdb.Pdb(nosigint=True).run(\"exec(%r)\"%src,globs,globs)\n \ndef debug(module,name,pm=False):\n ''\n\n\n\n\n \n module=_normalize_module(module)\n testsrc=testsource(module,name)\n debug_script(testsrc,pm,module.__dict__)\n \n \n \n \nclass _TestClass:\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,val):\n ''\n\n\n\n\n \n \n self.val=val\n \n def square(self):\n ''\n\n\n\n \n \n self.val=self.val **2\n return self\n \n def get(self):\n ''\n\n\n\n\n \n \n return self.val\n \n__test__={\"_TestClass\":_TestClass,\n\"string\":r\"\"\"\n Example of a string object, searched as-is.\n >>> x = 1; y = 2\n >>> x + y, x * y\n (3, 2)\n \"\"\",\n\n\"bool-int equivalence\":r\"\"\"\n In 2.2, boolean expressions displayed\n 0 or 1. By default, we still accept\n them. This can be disabled by passing\n DONT_ACCEPT_TRUE_FOR_1 to the new\n optionflags argument.\n >>> 4 == 4\n 1\n >>> 4 == 4\n True\n >>> 4 > 4\n 0\n >>> 4 > 4\n False\n \"\"\",\n\n\"blank lines\":r\"\"\"\n Blank lines can be marked with :\n >>> print('foo\\n\\nbar\\n')\n foo\n \n bar\n \n \"\"\",\n\n\"ellipsis\":r\"\"\"\n If the ellipsis flag is used, then '...' can be used to\n elide substrings in the desired output:\n >>> print(list(range(1000))) #doctest: +ELLIPSIS\n [0, 1, 2, ..., 999]\n \"\"\",\n\n\"whitespace normalization\":r\"\"\"\n If the whitespace normalization flag is used, then\n differences in whitespace are ignored.\n >>> print(list(range(30))) #doctest: +NORMALIZE_WHITESPACE\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\n 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\n 27, 28, 29]\n \"\"\",\n}\n\n\ndef _test():\n import argparse\n \n parser=argparse.ArgumentParser(description=\"doctest runner\")\n parser.add_argument('-v','--verbose',action='store_true',default=False,\n help='print very verbose output for all tests')\n parser.add_argument('-o','--option',action='append',\n choices=OPTIONFLAGS_BY_NAME.keys(),default=[],\n help=('specify a doctest option flag to apply'\n ' to the test run; may be specified more'\n ' than once to apply multiple options'))\n parser.add_argument('-f','--fail-fast',action='store_true',\n help=('stop running tests after first failure (this'\n ' is a shorthand for -o FAIL_FAST, and is'\n ' in addition to any other -o options)'))\n parser.add_argument('file',nargs='+',\n help='file containing the tests to run')\n args=parser.parse_args()\n testfiles=args.file\n \n \n verbose=args.verbose\n options=0\n for option in args.option:\n options |=OPTIONFLAGS_BY_NAME[option]\n if args.fail_fast:\n options |=FAIL_FAST\n for filename in testfiles:\n if filename.endswith(\".py\"):\n \n \n \n dirname,filename=os.path.split(filename)\n sys.path.insert(0,dirname)\n m=__import__(filename[:-3])\n del sys.path[0]\n failures,_=testmod(m,verbose=verbose,optionflags=options)\n else:\n failures,_=testfile(filename,module_relative=False,\n verbose=verbose,optionflags=options)\n if failures:\n return 1\n return 0\n \n \nif __name__ ==\"__main__\":\n sys.exit(_test())\n", ["__future__", "argparse", "builtins", "collections", "difflib", "inspect", "io", "linecache", "os", "pdb", "re", "sys", "traceback", "unittest"]], "enum": [".py", "import sys\nimport builtins as bltns\nfrom types import MappingProxyType,DynamicClassAttribute\nfrom operator import or_ as _or_\nfrom functools import reduce\n\n\n__all__=[\n'EnumType','EnumMeta',\n'Enum','IntEnum','StrEnum','Flag','IntFlag','ReprEnum',\n'auto','unique','property','verify','member','nonmember',\n'FlagBoundary','STRICT','CONFORM','EJECT','KEEP',\n'global_flag_repr','global_enum_repr','global_str','global_enum',\n'EnumCheck','CONTINUOUS','NAMED_FLAGS','UNIQUE',\n]\n\n\n\n\n\nEnum=Flag=EJECT=_stdlib_enums=ReprEnum=None\n\nclass nonmember(object):\n ''\n\n \n def __init__(self,value):\n self.value=value\n \nclass member(object):\n ''\n\n \n def __init__(self,value):\n self.value=value\n \ndef _is_descriptor(obj):\n ''\n\n \n return(\n hasattr(obj,'__get__')or\n hasattr(obj,'__set__')or\n hasattr(obj,'__delete__')\n )\n \ndef _is_dunder(name):\n ''\n\n \n return(\n len(name)>4 and\n name[:2]==name[-2:]=='__'and\n name[2]!='_'and\n name[-3]!='_'\n )\n \ndef _is_sunder(name):\n ''\n\n \n return(\n len(name)>2 and\n name[0]==name[-1]=='_'and\n name[1:2]!='_'and\n name[-2:-1]!='_'\n )\n \ndef _is_internal_class(cls_name,obj):\n\n if not isinstance(obj,type):\n return False\n qualname=getattr(obj,'__qualname__','')\n s_pattern=cls_name+'.'+getattr(obj,'__name__','')\n e_pattern='.'+s_pattern\n return qualname ==s_pattern or qualname.endswith(e_pattern)\n \ndef _is_private(cls_name,name):\n\n pattern='_%s__'%(cls_name,)\n pat_len=len(pattern)\n if(\n len(name)>pat_len\n and name.startswith(pattern)\n and name[pat_len:pat_len+1]!=['_']\n and(name[-1]!='_'or name[-2]!='_')\n ):\n return True\n else:\n return False\n \ndef _is_single_bit(num):\n ''\n\n \n if num ==0:\n return False\n num &=num -1\n return num ==0\n \ndef _make_class_unpicklable(obj):\n ''\n\n\n\n \n def _break_on_call_reduce(self,proto):\n raise TypeError('%r cannot be pickled'%self)\n if isinstance(obj,dict):\n obj['__reduce_ex__']=_break_on_call_reduce\n obj['__module__']=''\n else:\n setattr(obj,'__reduce_ex__',_break_on_call_reduce)\n setattr(obj,'__module__','')\n \ndef _iter_bits_lsb(num):\n\n original=num\n if isinstance(num,Enum):\n num=num.value\n if num <0:\n raise ValueError('%r is not a positive integer'%original)\n while num:\n b=num&(~num+1)\n yield b\n num ^=b\n \ndef show_flag_values(value):\n return list(_iter_bits_lsb(value))\n \ndef bin(num,max_bits=None):\n ''\n\n\n\n\n\n\n\n\n \n \n ceiling=2 **(num).bit_length()\n if num >=0:\n s=bltns.bin(num+ceiling).replace('1','0',1)\n else:\n s=bltns.bin(~num ^(ceiling -1)+ceiling)\n sign=s[:3]\n digits=s[3:]\n if max_bits is not None:\n if len(digits) cannot set attribute %r\"%(self.clsname,self.name)\n )\n \n def __delete__(self,instance):\n if self.fdel is not None:\n return self.fdel(instance)\n raise AttributeError(\n \" cannot delete attribute %r\"%(self.clsname,self.name)\n )\n \n def __set_name__(self,ownerclass,name):\n self.name=name\n self.clsname=ownerclass.__name__\n \n \nclass _proto_member:\n ''\n\n \n \n def __init__(self,value):\n self.value=value\n \n def __set_name__(self,enum_class,member_name):\n ''\n\n \n \n delattr(enum_class,member_name)\n \n value=self.value\n if not isinstance(value,tuple):\n args=(value,)\n else:\n args=value\n if enum_class._member_type_ is tuple:\n args=(args,)\n if not enum_class._use_args_:\n enum_member=enum_class._new_member_(enum_class)\n else:\n enum_member=enum_class._new_member_(enum_class,*args)\n if not hasattr(enum_member,'_value_'):\n if enum_class._member_type_ is object:\n enum_member._value_=value\n else:\n try:\n enum_member._value_=enum_class._member_type_(*args)\n except Exception as exc:\n new_exc=TypeError(\n '_value_ not set in __new__, unable to create it'\n )\n new_exc.__cause__=exc\n raise new_exc\n value=enum_member._value_\n enum_member._name_=member_name\n enum_member.__objclass__=enum_class\n enum_member.__init__(*args)\n enum_member._sort_order_=len(enum_class._member_names_)\n \n if Flag is not None and issubclass(enum_class,Flag):\n enum_class._flag_mask_ |=value\n if _is_single_bit(value):\n enum_class._singles_mask_ |=value\n enum_class._all_bits_=2 **((enum_class._flag_mask_).bit_length())-1\n \n \n \n try:\n try:\n \n enum_member=enum_class._value2member_map_[value]\n except TypeError:\n for name,canonical_member in enum_class._member_map_.items():\n if canonical_member._value_ ==value:\n enum_member=canonical_member\n break\n else:\n raise KeyError\n except KeyError:\n \n \n if(\n Flag is None\n or not issubclass(enum_class,Flag)\n ):\n \n enum_class._member_names_.append(member_name)\n elif(\n Flag is not None\n and issubclass(enum_class,Flag)\n and _is_single_bit(value)\n ):\n \n enum_class._member_names_.append(member_name)\n \n found_descriptor=None\n descriptor_type=None\n class_type=None\n for base in enum_class.__mro__[1:]:\n attr=base.__dict__.get(member_name)\n if attr is not None:\n if isinstance(attr,(property,DynamicClassAttribute)):\n found_descriptor=attr\n class_type=base\n descriptor_type='enum'\n break\n elif _is_descriptor(attr):\n found_descriptor=attr\n descriptor_type=descriptor_type or 'desc'\n class_type=class_type or base\n continue\n else:\n descriptor_type='attr'\n class_type=base\n if found_descriptor:\n redirect=property()\n redirect.member=enum_member\n redirect.__set_name__(enum_class,member_name)\n if descriptor_type in('enum','desc'):\n \n redirect.fget=getattr(found_descriptor,'fget',None)\n redirect._get=getattr(found_descriptor,'__get__',None)\n redirect.fset=getattr(found_descriptor,'fset',None)\n redirect._set=getattr(found_descriptor,'__set__',None)\n redirect.fdel=getattr(found_descriptor,'fdel',None)\n redirect._del=getattr(found_descriptor,'__delete__',None)\n redirect._attr_type=descriptor_type\n redirect._cls_type=class_type\n setattr(enum_class,member_name,redirect)\n else:\n setattr(enum_class,member_name,enum_member)\n \n enum_class._member_map_[member_name]=enum_member\n try:\n \n \n \n enum_class._value2member_map_.setdefault(value,enum_member)\n except TypeError:\n \n enum_class._unhashable_values_.append(value)\n \n \nclass _EnumDict(dict):\n ''\n\n\n\n\n \n def __init__(self):\n super().__init__()\n self._member_names={}\n self._last_values=[]\n self._ignore=[]\n self._auto_called=False\n \n def __setitem__(self,key,value):\n ''\n\n\n\n\n\n\n \n if _is_internal_class(self._cls_name,value):\n import warnings\n warnings.warn(\n \"In 3.13 classes created inside an enum will not become a member. \"\n \"Use the `member` decorator to keep the current behavior.\",\n DeprecationWarning,\n stacklevel=2,\n )\n if _is_private(self._cls_name,key):\n \n pass\n elif _is_sunder(key):\n if key not in(\n '_order_',\n '_generate_next_value_','_numeric_repr_','_missing_','_ignore_',\n '_iter_member_','_iter_member_by_value_','_iter_member_by_def_',\n ):\n raise ValueError(\n '_sunder_ names, such as %r, are reserved for future Enum use'\n %(key,)\n )\n if key =='_generate_next_value_':\n \n if self._auto_called:\n raise TypeError(\"_generate_next_value_ must be defined before members\")\n _gnv=value.__func__ if isinstance(value,staticmethod)else value\n setattr(self,'_generate_next_value',_gnv)\n elif key =='_ignore_':\n if isinstance(value,str):\n value=value.replace(',',' ').split()\n else:\n value=list(value)\n self._ignore=value\n already=set(value)&set(self._member_names)\n if already:\n raise ValueError(\n '_ignore_ cannot specify already set names: %r'\n %(already,)\n )\n elif _is_dunder(key):\n if key =='__order__':\n key='_order_'\n elif key in self._member_names:\n \n raise TypeError('%r already defined as %r'%(key,self[key]))\n elif key in self._ignore:\n pass\n elif isinstance(value,nonmember):\n \n value=value.value\n elif _is_descriptor(value):\n pass\n \n \n \n \n else:\n if key in self:\n \n raise TypeError('%r already defined as %r'%(key,self[key]))\n elif isinstance(value,member):\n \n value=value.value\n non_auto_store=True\n single=False\n if isinstance(value,auto):\n single=True\n value=(value,)\n if type(value)is tuple and any(isinstance(v,auto)for v in value):\n \n \n auto_valued=[]\n for v in value:\n if isinstance(v,auto):\n non_auto_store=False\n if v.value ==_auto_null:\n v.value=self._generate_next_value(\n key,1,len(self._member_names),self._last_values[:],\n )\n self._auto_called=True\n v=v.value\n self._last_values.append(v)\n auto_valued.append(v)\n if single:\n value=auto_valued[0]\n else:\n value=tuple(auto_valued)\n self._member_names[key]=None\n if non_auto_store:\n self._last_values.append(value)\n super().__setitem__(key,value)\n \n def update(self,members,**more_members):\n try:\n for name in members.keys():\n self[name]=members[name]\n except AttributeError:\n for name,value in members:\n self[name]=value\n for name,value in more_members.items():\n self[name]=value\n \n \nclass EnumType(type):\n ''\n\n \n \n @classmethod\n def __prepare__(metacls,cls,bases,**kwds):\n \n metacls._check_for_existing_members_(cls,bases)\n \n enum_dict=_EnumDict()\n enum_dict._cls_name=cls\n \n member_type,first_enum=metacls._get_mixins_(cls,bases)\n if first_enum is not None:\n enum_dict['_generate_next_value_']=getattr(\n first_enum,'_generate_next_value_',None,\n )\n return enum_dict\n \n def __new__(metacls,cls,bases,classdict,*,boundary=None,_simple=False,**kwds):\n \n \n \n \n \n if _simple:\n return super().__new__(metacls,cls,bases,classdict,**kwds)\n \n \n classdict.setdefault('_ignore_',[]).append('_ignore_')\n ignore=classdict['_ignore_']\n for key in ignore:\n classdict.pop(key,None)\n \n \n member_names=classdict._member_names\n \n \n invalid_names=set(member_names)&{'mro',''}\n if invalid_names:\n raise ValueError('invalid enum member name(s) %s'%(\n ','.join(repr(n)for n in invalid_names)\n ))\n \n \n _order_=classdict.pop('_order_',None)\n _gnv=classdict.get('_generate_next_value_')\n if _gnv is not None and type(_gnv)is not staticmethod:\n _gnv=staticmethod(_gnv)\n \n classdict=dict(classdict.items())\n if _gnv is not None:\n classdict['_generate_next_value_']=_gnv\n \n \n member_type,first_enum=metacls._get_mixins_(cls,bases)\n __new__,save_new,use_args=metacls._find_new_(\n classdict,member_type,first_enum,\n )\n classdict['_new_member_']=__new__\n classdict['_use_args_']=use_args\n \n \n for name in member_names:\n value=classdict[name]\n classdict[name]=_proto_member(value)\n \n \n classdict['_member_names_']=[]\n classdict['_member_map_']={}\n classdict['_value2member_map_']={}\n classdict['_unhashable_values_']=[]\n classdict['_member_type_']=member_type\n \n classdict['_value_repr_']=metacls._find_data_repr_(cls,bases)\n \n \n classdict['_boundary_']=(\n boundary\n or getattr(first_enum,'_boundary_',None)\n )\n classdict['_flag_mask_']=0\n classdict['_singles_mask_']=0\n classdict['_all_bits_']=0\n classdict['_inverted_']=None\n try:\n exc=None\n enum_class=super().__new__(metacls,cls,bases,classdict,**kwds)\n except RuntimeError as e:\n \n \n exc=e.__cause__ or e\n if exc is not None:\n raise exc\n \n \n classdict.update(enum_class.__dict__)\n \n \n \n \n \n \n \n if ReprEnum is not None and ReprEnum in bases:\n if member_type is object:\n raise TypeError(\n 'ReprEnum subclasses must be mixed with a data type (i.e.'\n ' int, str, float, etc.)'\n )\n if '__format__'not in classdict:\n enum_class.__format__=member_type.__format__\n classdict['__format__']=enum_class.__format__\n if '__str__'not in classdict:\n method=member_type.__str__\n if method is object.__str__:\n \n \n method=member_type.__repr__\n enum_class.__str__=method\n classdict['__str__']=enum_class.__str__\n for name in('__repr__','__str__','__format__','__reduce_ex__'):\n if name not in classdict:\n \n enum_method=getattr(first_enum,name)\n found_method=getattr(enum_class,name)\n object_method=getattr(object,name)\n data_type_method=getattr(member_type,name)\n if found_method in(data_type_method,object_method):\n setattr(enum_class,name,enum_method)\n \n \n if Flag is not None and issubclass(enum_class,Flag):\n for name in(\n '__or__','__and__','__xor__',\n '__ror__','__rand__','__rxor__',\n '__invert__'\n ):\n if name not in classdict:\n enum_method=getattr(Flag,name)\n setattr(enum_class,name,enum_method)\n classdict[name]=enum_method\n \n \n \n if Enum is not None:\n \n \n if save_new:\n enum_class.__new_member__=__new__\n enum_class.__new__=Enum.__new__\n \n \n \n \n \n \n \n \n \n \n if _order_ is not None:\n if isinstance(_order_,str):\n _order_=_order_.replace(',',' ').split()\n \n \n if(\n Flag is None and cls !='Flag'\n or Flag is not None and not issubclass(enum_class,Flag)\n ):\n delattr(enum_class,'_boundary_')\n delattr(enum_class,'_flag_mask_')\n delattr(enum_class,'_singles_mask_')\n delattr(enum_class,'_all_bits_')\n delattr(enum_class,'_inverted_')\n elif Flag is not None and issubclass(enum_class,Flag):\n \n member_list=[m._value_ for m in enum_class]\n if member_list !=sorted(member_list):\n enum_class._iter_member_=enum_class._iter_member_by_def_\n if _order_:\n \n _order_=[\n o\n for o in _order_\n if o not in enum_class._member_map_ or _is_single_bit(enum_class[o]._value_)\n ]\n \n if _order_:\n \n _order_=[\n o\n for o in _order_\n if(\n o not in enum_class._member_map_\n or\n (o in enum_class._member_map_ and o in enum_class._member_names_)\n )]\n \n if _order_ !=enum_class._member_names_:\n raise TypeError(\n 'member order does not match _order_:\\n %r\\n %r'\n %(enum_class._member_names_,_order_)\n )\n \n return enum_class\n \n def __bool__(cls):\n ''\n\n \n return True\n \n def __call__(cls,value,names=None,*values,module=None,qualname=None,type=None,start=1,boundary=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if cls._member_map_:\n \n if names:\n value=(value,names)+values\n return cls.__new__(cls,value)\n \n return cls._create_(\n class_name=value,\n names=names,\n module=module,\n qualname=qualname,\n type=type,\n start=start,\n boundary=boundary,\n )\n \n def __contains__(cls,value):\n ''\n\n\n\n\n \n if isinstance(value,cls):\n return True\n return value in cls._value2member_map_ or value in cls._unhashable_values_\n \n def __delattr__(cls,attr):\n \n \n if attr in cls._member_map_:\n raise AttributeError(\"%r cannot delete member %r.\"%(cls.__name__,attr))\n super().__delattr__(attr)\n \n def __dir__(cls):\n interesting=set([\n '__class__','__contains__','__doc__','__getitem__',\n '__iter__','__len__','__members__','__module__',\n '__name__','__qualname__',\n ]\n +cls._member_names_\n )\n if cls._new_member_ is not object.__new__:\n interesting.add('__new__')\n if cls.__init_subclass__ is not object.__init_subclass__:\n interesting.add('__init_subclass__')\n if cls._member_type_ is object:\n return sorted(interesting)\n else:\n \n return sorted(set(dir(cls._member_type_))|interesting)\n \n def __getitem__(cls,name):\n ''\n\n \n return cls._member_map_[name]\n \n def __iter__(cls):\n ''\n\n \n return(cls._member_map_[name]for name in cls._member_names_)\n \n def __len__(cls):\n ''\n\n \n return len(cls._member_names_)\n \n @bltns.property\n def __members__(cls):\n ''\n\n\n\n\n \n return MappingProxyType(cls._member_map_)\n \n def __repr__(cls):\n if Flag is not None and issubclass(cls,Flag):\n return \"\"%cls.__name__\n else:\n return \"\"%cls.__name__\n \n def __reversed__(cls):\n ''\n\n \n return(cls._member_map_[name]for name in reversed(cls._member_names_))\n \n def __setattr__(cls,name,value):\n ''\n\n\n\n\n\n \n member_map=cls.__dict__.get('_member_map_',{})\n if name in member_map:\n raise AttributeError('cannot reassign member %r'%(name,))\n super().__setattr__(name,value)\n \n def _create_(cls,class_name,names,*,module=None,qualname=None,type=None,start=1,boundary=None):\n ''\n\n\n\n\n\n\n\n\n\n \n metacls=cls.__class__\n bases=(cls,)if type is None else(type,cls)\n _,first_enum=cls._get_mixins_(class_name,bases)\n classdict=metacls.__prepare__(class_name,bases)\n \n \n if isinstance(names,str):\n names=names.replace(',',' ').split()\n if isinstance(names,(tuple,list))and names and isinstance(names[0],str):\n original_names,names=names,[]\n last_values=[]\n for count,name in enumerate(original_names):\n value=first_enum._generate_next_value_(name,start,count,last_values[:])\n last_values.append(value)\n names.append((name,value))\n \n \n for item in names:\n if isinstance(item,str):\n member_name,member_value=item,names[item]\n else:\n member_name,member_value=item\n classdict[member_name]=member_value\n \n if module is None:\n try:\n module=sys._getframemodulename(2)\n except AttributeError:\n \n try:\n module=sys._getframe(2).f_globals['__name__']\n except(AttributeError,ValueError,KeyError):\n pass\n if module is None:\n _make_class_unpicklable(classdict)\n else:\n classdict['__module__']=module\n if qualname is not None:\n classdict['__qualname__']=qualname\n \n return metacls.__new__(metacls,class_name,bases,classdict,boundary=boundary)\n \n def _convert_(cls,name,module,filter,source=None,*,boundary=None,as_global=False):\n ''\n\n \n \n \n \n \n \n module_globals=sys.modules[module].__dict__\n if source:\n source=source.__dict__\n else:\n source=module_globals\n \n \n \n members=[\n (name,value)\n for name,value in source.items()\n if filter(name)]\n try:\n \n members.sort(key=lambda t:(t[1],t[0]))\n except TypeError:\n \n members.sort(key=lambda t:t[0])\n body={t[0]:t[1]for t in members}\n body['__module__']=module\n tmp_cls=type(name,(object,),body)\n cls=_simple_enum(etype=cls,boundary=boundary or KEEP)(tmp_cls)\n cls.__reduce_ex__=_reduce_ex_by_global_name\n if as_global:\n global_enum(cls)\n else:\n sys.modules[cls.__module__].__dict__.update(cls.__members__)\n module_globals[name]=cls\n return cls\n \n @classmethod\n def _check_for_existing_members_(mcls,class_name,bases):\n for chain in bases:\n for base in chain.__mro__:\n if isinstance(base,EnumType)and base._member_names_:\n raise TypeError(\n \" cannot extend %r\"\n %(class_name,base)\n )\n \n @classmethod\n def _get_mixins_(mcls,class_name,bases):\n ''\n\n\n\n\n \n if not bases:\n return object,Enum\n \n \n first_enum=bases[-1]\n if not isinstance(first_enum,EnumType):\n raise TypeError(\"new enumerations should be created as \"\n \"`EnumName([mixin_type, ...] [data_type,] enum_type)`\")\n member_type=mcls._find_data_type_(class_name,bases)or object\n return member_type,first_enum\n \n @classmethod\n def _find_data_repr_(mcls,class_name,bases):\n for chain in bases:\n for base in chain.__mro__:\n if base is object:\n continue\n elif isinstance(base,EnumType):\n \n return base._value_repr_\n elif '__repr__'in base.__dict__:\n \n \n if(\n '__dataclass_fields__'in base.__dict__\n and '__dataclass_params__'in base.__dict__\n and base.__dict__['__dataclass_params__'].repr\n ):\n return _dataclass_repr\n else:\n return base.__dict__['__repr__']\n return None\n \n @classmethod\n def _find_data_type_(mcls,class_name,bases):\n \n data_types=set()\n base_chain=set()\n for chain in bases:\n candidate=None\n for base in chain.__mro__:\n base_chain.add(base)\n if base is object:\n continue\n elif isinstance(base,EnumType):\n if base._member_type_ is not object:\n data_types.add(base._member_type_)\n break\n elif '__new__'in base.__dict__ or '__dataclass_fields__'in base.__dict__:\n data_types.add(candidate or base)\n break\n else:\n candidate=candidate or base\n if len(data_types)>1:\n raise TypeError('too many data types for %r: %r'%(class_name,data_types))\n elif data_types:\n return data_types.pop()\n else:\n return None\n \n @classmethod\n def _find_new_(mcls,classdict,member_type,first_enum):\n ''\n\n\n\n\n\n \n \n \n \n __new__=classdict.get('__new__',None)\n \n \n save_new=first_enum is not None and __new__ is not None\n \n if __new__ is None:\n \n \n for method in('__new_member__','__new__'):\n for possible in(member_type,first_enum):\n target=getattr(possible,method,None)\n if target not in{\n None,\n None.__new__,\n object.__new__,\n Enum.__new__,\n }:\n __new__=target\n break\n if __new__ is not None:\n break\n else:\n __new__=object.__new__\n \n \n \n \n if first_enum is None or __new__ in(Enum.__new__,object.__new__):\n use_args=False\n else:\n use_args=True\n return __new__,save_new,use_args\nEnumMeta=EnumType\n\n\nclass Enum(metaclass=EnumType):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n @classmethod\n def __signature__(cls):\n if cls._member_names_:\n return '(*values)'\n else:\n return '(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)'\n \n def __new__(cls,value):\n \n \n \n if type(value)is cls:\n \n return value\n \n \n try:\n return cls._value2member_map_[value]\n except KeyError:\n \n pass\n except TypeError:\n \n for member in cls._member_map_.values():\n if member._value_ ==value:\n return member\n \n try:\n exc=None\n result=cls._missing_(value)\n except Exception as e:\n exc=e\n result=None\n try:\n if isinstance(result,cls):\n return result\n elif(\n Flag is not None and issubclass(cls,Flag)\n and cls._boundary_ is EJECT and isinstance(result,int)\n ):\n return result\n else:\n ve_exc=ValueError(\"%r is not a valid %s\"%(value,cls.__qualname__))\n if result is None and exc is None:\n raise ve_exc\n elif exc is None:\n exc=TypeError(\n 'error in %s._missing_: returned %r instead of None or a valid member'\n %(cls.__name__,result)\n )\n if not isinstance(exc,ValueError):\n exc.__context__=ve_exc\n raise exc\n finally:\n \n exc=None\n ve_exc=None\n \n def __init__(self,*args,**kwds):\n pass\n \n @staticmethod\n def _generate_next_value_(name,start,count,last_values):\n ''\n\n\n\n\n\n\n \n if not last_values:\n return start\n try:\n last=last_values[-1]\n last_values.sort()\n if last ==last_values[-1]:\n \n return last+1\n else:\n \n raise TypeError\n except TypeError:\n import warnings\n warnings.warn(\n \"In 3.13 the default `auto()`/`_generate_next_value_` will require all values to be sortable and support adding +1\\n\"\n \"and the value returned will be the largest value in the enum incremented by 1\",\n DeprecationWarning,\n stacklevel=3,\n )\n for v in reversed(last_values):\n try:\n return v+1\n except TypeError:\n pass\n return start\n \n @classmethod\n def _missing_(cls,value):\n return None\n \n def __repr__(self):\n v_repr=self.__class__._value_repr_ or repr\n return \"<%s.%s: %s>\"%(self.__class__.__name__,self._name_,v_repr(self._value_))\n \n def __str__(self):\n return \"%s.%s\"%(self.__class__.__name__,self._name_,)\n \n def __dir__(self):\n ''\n\n \n if self.__class__._member_type_ is object:\n interesting=set(['__class__','__doc__','__eq__','__hash__','__module__','name','value'])\n else:\n interesting=set(object.__dir__(self))\n for name in getattr(self,'__dict__',[]):\n if name[0]!='_':\n interesting.add(name)\n for cls in self.__class__.mro():\n for name,obj in cls.__dict__.items():\n if name[0]=='_':\n continue\n if isinstance(obj,property):\n \n if obj.fget is not None or name not in self._member_map_:\n interesting.add(name)\n else:\n \n interesting.discard(name)\n else:\n interesting.add(name)\n names=sorted(\n set(['__class__','__doc__','__eq__','__hash__','__module__'])\n |interesting\n )\n return names\n \n def __format__(self,format_spec):\n return str.__format__(str(self),format_spec)\n \n def __hash__(self):\n return hash(self._name_)\n \n def __reduce_ex__(self,proto):\n return getattr,(self.__class__,self._name_)\n \n \n \n \n \n \n \n \n \n @property\n def name(self):\n ''\n return self._name_\n \n @property\n def value(self):\n ''\n return self._value_\n \n \nclass ReprEnum(Enum):\n ''\n\n \n \n \nclass IntEnum(int,ReprEnum):\n ''\n\n \n \n \nclass StrEnum(str,ReprEnum):\n ''\n\n \n \n def __new__(cls,*values):\n ''\n if len(values)>3:\n raise TypeError('too many arguments for str(): %r'%(values,))\n if len(values)==1:\n \n if not isinstance(values[0],str):\n raise TypeError('%r is not a string'%(values[0],))\n if len(values)>=2:\n \n if not isinstance(values[1],str):\n raise TypeError('encoding must be a string, not %r'%(values[1],))\n if len(values)==3:\n \n if not isinstance(values[2],str):\n raise TypeError('errors must be a string, not %r'%(values[2]))\n value=str(*values)\n member=str.__new__(cls,value)\n member._value_=value\n return member\n \n @staticmethod\n def _generate_next_value_(name,start,count,last_values):\n ''\n\n \n return name.lower()\n \n \ndef _reduce_ex_by_global_name(self,proto):\n return self.name\n \nclass FlagBoundary(StrEnum):\n ''\n\n\n\n\n\n \n STRICT=auto()\n CONFORM=auto()\n EJECT=auto()\n KEEP=auto()\nSTRICT,CONFORM,EJECT,KEEP=FlagBoundary\n\n\nclass Flag(Enum,boundary=STRICT):\n ''\n\n \n \n def __reduce_ex__(self,proto):\n cls=self.__class__\n unknown=self._value_&~cls._flag_mask_\n member_value=self._value_&cls._flag_mask_\n if unknown and member_value:\n return _or_,(cls(member_value),unknown)\n for val in _iter_bits_lsb(member_value):\n rest=member_value&~val\n if rest:\n return _or_,(cls(rest),cls._value2member_map_.get(val))\n else:\n break\n if self._name_ is None:\n return cls,(self._value_,)\n else:\n return getattr,(cls,self._name_)\n \n _numeric_repr_=repr\n \n @staticmethod\n def _generate_next_value_(name,start,count,last_values):\n ''\n\n\n\n\n\n\n \n if not count:\n return start if start is not None else 1\n last_value=max(last_values)\n try:\n high_bit=_high_bit(last_value)\n except Exception:\n raise TypeError('invalid flag value %r'%last_value)from None\n return 2 **(high_bit+1)\n \n @classmethod\n def _iter_member_by_value_(cls,value):\n ''\n\n \n for val in _iter_bits_lsb(value&cls._flag_mask_):\n yield cls._value2member_map_.get(val)\n \n _iter_member_=_iter_member_by_value_\n \n @classmethod\n def _iter_member_by_def_(cls,value):\n ''\n\n \n yield from sorted(\n cls._iter_member_by_value_(value),\n key=lambda m:m._sort_order_,\n )\n \n @classmethod\n def _missing_(cls,value):\n ''\n\n\n\n \n if not isinstance(value,int):\n raise ValueError(\n \"%r is not a valid %s\"%(value,cls.__qualname__)\n )\n \n \n \n \n flag_mask=cls._flag_mask_\n singles_mask=cls._singles_mask_\n all_bits=cls._all_bits_\n neg_value=None\n if(\n not ~all_bits <=value <=all_bits\n or value&(all_bits ^flag_mask)\n ):\n if cls._boundary_ is STRICT:\n max_bits=max(value.bit_length(),flag_mask.bit_length())\n raise ValueError(\n \"%r invalid value %r\\n given %s\\n allowed %s\"%(\n cls,value,bin(value,max_bits),bin(flag_mask,max_bits),\n ))\n elif cls._boundary_ is CONFORM:\n value=value&flag_mask\n elif cls._boundary_ is EJECT:\n return value\n elif cls._boundary_ is KEEP:\n if value <0:\n value=(\n max(all_bits+1,2 **(value.bit_length()))\n +value\n )\n else:\n raise ValueError(\n '%r unknown flag boundary %r'%(cls,cls._boundary_,)\n )\n if value <0:\n neg_value=value\n value=all_bits+1+value\n \n unknown=value&~flag_mask\n aliases=value&~singles_mask\n member_value=value&singles_mask\n if unknown and cls._boundary_ is not KEEP:\n raise ValueError(\n '%s(%r) --> unknown values %r [%s]'\n %(cls.__name__,value,unknown,bin(unknown))\n )\n \n if cls._member_type_ is object:\n \n pseudo_member=object.__new__(cls)\n else:\n pseudo_member=cls._member_type_.__new__(cls,value)\n if not hasattr(pseudo_member,'_value_'):\n pseudo_member._value_=value\n if member_value or aliases:\n members=[]\n combined_value=0\n for m in cls._iter_member_(member_value):\n members.append(m)\n combined_value |=m._value_\n if aliases:\n value=member_value |aliases\n for n,pm in cls._member_map_.items():\n if pm not in members and pm._value_ and pm._value_&value ==pm._value_:\n members.append(pm)\n combined_value |=pm._value_\n unknown=value ^combined_value\n pseudo_member._name_='|'.join([m._name_ for m in members])\n if not combined_value:\n pseudo_member._name_=None\n elif unknown and cls._boundary_ is STRICT:\n raise ValueError('%r: no members with value %r'%(cls,unknown))\n elif unknown:\n pseudo_member._name_ +='|%s'%cls._numeric_repr_(unknown)\n else:\n pseudo_member._name_=None\n \n \n \n if not unknown:\n pseudo_member=cls._value2member_map_.setdefault(value,pseudo_member)\n if neg_value is not None:\n cls._value2member_map_[neg_value]=pseudo_member\n return pseudo_member\n \n def __contains__(self,other):\n ''\n\n \n if not isinstance(other,self.__class__):\n raise TypeError(\n \"unsupported operand type(s) for 'in': %r and %r\"%(\n type(other).__qualname__,self.__class__.__qualname__))\n return other._value_&self._value_ ==other._value_\n \n def __iter__(self):\n ''\n\n \n yield from self._iter_member_(self._value_)\n \n def __len__(self):\n return self._value_.bit_count()\n \n def __repr__(self):\n cls_name=self.__class__.__name__\n v_repr=self.__class__._value_repr_ or repr\n if self._name_ is None:\n return \"<%s: %s>\"%(cls_name,v_repr(self._value_))\n else:\n return \"<%s.%s: %s>\"%(cls_name,self._name_,v_repr(self._value_))\n \n def __str__(self):\n cls_name=self.__class__.__name__\n if self._name_ is None:\n return '%s(%r)'%(cls_name,self._value_)\n else:\n return \"%s.%s\"%(cls_name,self._name_)\n \n def __bool__(self):\n return bool(self._value_)\n \n def __or__(self,other):\n if isinstance(other,self.__class__):\n other=other._value_\n elif self._member_type_ is not object and isinstance(other,self._member_type_):\n other=other\n else:\n return NotImplemented\n value=self._value_\n return self.__class__(value |other)\n \n def __and__(self,other):\n if isinstance(other,self.__class__):\n other=other._value_\n elif self._member_type_ is not object and isinstance(other,self._member_type_):\n other=other\n else:\n return NotImplemented\n value=self._value_\n return self.__class__(value&other)\n \n def __xor__(self,other):\n if isinstance(other,self.__class__):\n other=other._value_\n elif self._member_type_ is not object and isinstance(other,self._member_type_):\n other=other\n else:\n return NotImplemented\n value=self._value_\n return self.__class__(value ^other)\n \n def __invert__(self):\n if self._inverted_ is None:\n if self._boundary_ is KEEP:\n \n self._inverted_=self.__class__(~self._value_)\n else:\n \n self._inverted_=self.__class__(self._flag_mask_ ^self._value_)\n if isinstance(self._inverted_,self.__class__):\n self._inverted_._inverted_=self\n return self._inverted_\n \n __rand__=__and__\n __ror__=__or__\n __rxor__=__xor__\n \n \nclass IntFlag(int,ReprEnum,Flag,boundary=KEEP):\n ''\n\n \n \n \ndef _high_bit(value):\n ''\n\n \n return value.bit_length()-1\n \ndef unique(enumeration):\n ''\n\n \n duplicates=[]\n for name,member in enumeration.__members__.items():\n if name !=member.name:\n duplicates.append((name,member.name))\n if duplicates:\n alias_details=', '.join(\n [\"%s -> %s\"%(alias,name)for(alias,name)in duplicates])\n raise ValueError('duplicate values found in %r: %s'%\n (enumeration,alias_details))\n return enumeration\n \ndef _dataclass_repr(self):\n dcf=self.__dataclass_fields__\n return ', '.join(\n '%s=%r'%(k,getattr(self,k))\n for k in dcf.keys()\n if dcf[k].repr\n )\n \ndef global_enum_repr(self):\n ''\n\n\n\n \n module=self.__class__.__module__.split('.')[-1]\n return '%s.%s'%(module,self._name_)\n \ndef global_flag_repr(self):\n ''\n\n\n\n \n module=self.__class__.__module__.split('.')[-1]\n cls_name=self.__class__.__name__\n if self._name_ is None:\n return \"%s.%s(%r)\"%(module,cls_name,self._value_)\n if _is_single_bit(self):\n return '%s.%s'%(module,self._name_)\n if self._boundary_ is not FlagBoundary.KEEP:\n return '|'.join(['%s.%s'%(module,name)for name in self.name.split('|')])\n else:\n name=[]\n for n in self._name_.split('|'):\n if n[0].isdigit():\n name.append(n)\n else:\n name.append('%s.%s'%(module,n))\n return '|'.join(name)\n \ndef global_str(self):\n ''\n\n \n if self._name_ is None:\n cls_name=self.__class__.__name__\n return \"%s(%r)\"%(cls_name,self._value_)\n else:\n return self._name_\n \ndef global_enum(cls,update_str=False):\n ''\n\n\n\n \n if issubclass(cls,Flag):\n cls.__repr__=global_flag_repr\n else:\n cls.__repr__=global_enum_repr\n if not issubclass(cls,ReprEnum)or update_str:\n cls.__str__=global_str\n sys.modules[cls.__module__].__dict__.update(cls.__members__)\n return cls\n \ndef _simple_enum(etype=Enum,*,boundary=None,use_args=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def convert_class(cls):\n nonlocal use_args\n cls_name=cls.__name__\n if use_args is None:\n use_args=etype._use_args_\n __new__=cls.__dict__.get('__new__')\n if __new__ is not None:\n new_member=__new__.__func__\n else:\n new_member=etype._member_type_.__new__\n attrs={}\n body={}\n if __new__ is not None:\n body['__new_member__']=new_member\n body['_new_member_']=new_member\n body['_use_args_']=use_args\n body['_generate_next_value_']=gnv=etype._generate_next_value_\n body['_member_names_']=member_names=[]\n body['_member_map_']=member_map={}\n body['_value2member_map_']=value2member_map={}\n body['_unhashable_values_']=[]\n body['_member_type_']=member_type=etype._member_type_\n body['_value_repr_']=etype._value_repr_\n if issubclass(etype,Flag):\n body['_boundary_']=boundary or etype._boundary_\n body['_flag_mask_']=None\n body['_all_bits_']=None\n body['_singles_mask_']=None\n body['_inverted_']=None\n body['__or__']=Flag.__or__\n body['__xor__']=Flag.__xor__\n body['__and__']=Flag.__and__\n body['__ror__']=Flag.__ror__\n body['__rxor__']=Flag.__rxor__\n body['__rand__']=Flag.__rand__\n body['__invert__']=Flag.__invert__\n for name,obj in cls.__dict__.items():\n if name in('__dict__','__weakref__'):\n continue\n if _is_dunder(name)or _is_private(cls_name,name)or _is_sunder(name)or _is_descriptor(obj):\n body[name]=obj\n else:\n attrs[name]=obj\n if cls.__dict__.get('__doc__')is None:\n body['__doc__']='An enumeration.'\n \n \n \n \n \n enum_class=type(cls_name,(etype,),body,boundary=boundary,_simple=True)\n for name in('__repr__','__str__','__format__','__reduce_ex__'):\n if name not in body:\n \n enum_method=getattr(etype,name)\n found_method=getattr(enum_class,name)\n object_method=getattr(object,name)\n data_type_method=getattr(member_type,name)\n if found_method in(data_type_method,object_method):\n setattr(enum_class,name,enum_method)\n gnv_last_values=[]\n if issubclass(enum_class,Flag):\n \n single_bits=multi_bits=0\n for name,value in attrs.items():\n if isinstance(value,auto)and auto.value is _auto_null:\n value=gnv(name,1,len(member_names),gnv_last_values)\n if value in value2member_map:\n \n member=value2member_map[value]\n redirect=property()\n redirect.member=member\n redirect.__set_name__(enum_class,name)\n setattr(enum_class,name,redirect)\n member_map[name]=member\n else:\n \n if use_args:\n if not isinstance(value,tuple):\n value=(value,)\n member=new_member(enum_class,*value)\n value=value[0]\n else:\n member=new_member(enum_class)\n if __new__ is None:\n member._value_=value\n member._name_=name\n member.__objclass__=enum_class\n member.__init__(value)\n redirect=property()\n redirect.member=member\n redirect.__set_name__(enum_class,name)\n setattr(enum_class,name,redirect)\n member_map[name]=member\n member._sort_order_=len(member_names)\n value2member_map[value]=member\n if _is_single_bit(value):\n \n member_names.append(name)\n single_bits |=value\n else:\n multi_bits |=value\n gnv_last_values.append(value)\n enum_class._flag_mask_=single_bits |multi_bits\n enum_class._singles_mask_=single_bits\n enum_class._all_bits_=2 **((single_bits |multi_bits).bit_length())-1\n \n member_list=[m._value_ for m in enum_class]\n if member_list !=sorted(member_list):\n enum_class._iter_member_=enum_class._iter_member_by_def_\n else:\n \n for name,value in attrs.items():\n if isinstance(value,auto):\n if value.value is _auto_null:\n value.value=gnv(name,1,len(member_names),gnv_last_values)\n value=value.value\n if value in value2member_map:\n \n member=value2member_map[value]\n redirect=property()\n redirect.member=member\n redirect.__set_name__(enum_class,name)\n setattr(enum_class,name,redirect)\n member_map[name]=member\n else:\n \n if use_args:\n if not isinstance(value,tuple):\n value=(value,)\n member=new_member(enum_class,*value)\n value=value[0]\n else:\n member=new_member(enum_class)\n if __new__ is None:\n member._value_=value\n member._name_=name\n member.__objclass__=enum_class\n member.__init__(value)\n member._sort_order_=len(member_names)\n redirect=property()\n redirect.member=member\n redirect.__set_name__(enum_class,name)\n setattr(enum_class,name,redirect)\n member_map[name]=member\n value2member_map[value]=member\n member_names.append(name)\n gnv_last_values.append(value)\n if '__new__'in body:\n enum_class.__new_member__=enum_class.__new__\n enum_class.__new__=Enum.__new__\n return enum_class\n return convert_class\n \n@_simple_enum(StrEnum)\nclass EnumCheck:\n ''\n\n \n CONTINUOUS=\"no skipped integer values\"\n NAMED_FLAGS=\"multi-flag aliases may not contain unnamed flags\"\n UNIQUE=\"one name per value\"\nCONTINUOUS,NAMED_FLAGS,UNIQUE=EnumCheck\n\n\nclass verify:\n ''\n\n \n def __init__(self,*checks):\n self.checks=checks\n def __call__(self,enumeration):\n checks=self.checks\n cls_name=enumeration.__name__\n if Flag is not None and issubclass(enumeration,Flag):\n enum_type='flag'\n elif issubclass(enumeration,Enum):\n enum_type='enum'\n else:\n raise TypeError(\"the 'verify' decorator only works with Enum and Flag\")\n for check in checks:\n if check is UNIQUE:\n \n duplicates=[]\n for name,member in enumeration.__members__.items():\n if name !=member.name:\n duplicates.append((name,member.name))\n if duplicates:\n alias_details=', '.join(\n [\"%s -> %s\"%(alias,name)for(alias,name)in duplicates])\n raise ValueError('aliases found in %r: %s'%\n (enumeration,alias_details))\n elif check is CONTINUOUS:\n values=set(e.value for e in enumeration)\n if len(values)<2:\n continue\n low,high=min(values),max(values)\n missing=[]\n if enum_type =='flag':\n \n for i in range(_high_bit(low)+1,_high_bit(high)):\n if 2 **i not in values:\n missing.append(2 **i)\n elif enum_type =='enum':\n \n for i in range(low+1,high):\n if i not in values:\n missing.append(i)\n else:\n raise Exception('verify: unknown type %r'%enum_type)\n if missing:\n raise ValueError(('invalid %s %r: missing values %s'%(\n enum_type,cls_name,', '.join((str(m)for m in missing)))\n )[:256])\n \n elif check is NAMED_FLAGS:\n \n member_names=enumeration._member_names_\n member_values=[m.value for m in enumeration]\n missing_names=[]\n missing_value=0\n for name,alias in enumeration._member_map_.items():\n if name in member_names:\n \n continue\n if alias.value <0:\n \n continue\n values=list(_iter_bits_lsb(alias.value))\n missed=[v for v in values if v not in member_values]\n if missed:\n missing_names.append(name)\n missing_value |=reduce(_or_,missed)\n if missing_names:\n if len(missing_names)==1:\n alias='alias %s is missing'%missing_names[0]\n else:\n alias='aliases %s and %s are missing'%(\n ', '.join(missing_names[:-1]),missing_names[-1]\n )\n if _is_single_bit(missing_value):\n value='value 0x%x'%missing_value\n else:\n value='combined values of 0x%x'%missing_value\n raise ValueError(\n 'invalid Flag %r: %s %s [use enum.show_flag_values(value) for details]'\n %(cls_name,alias,value)\n )\n return enumeration\n \ndef _test_simple_enum(checked_enum,simple_enum):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n failed=[]\n if checked_enum.__dict__ !=simple_enum.__dict__:\n checked_dict=checked_enum.__dict__\n checked_keys=list(checked_dict.keys())\n simple_dict=simple_enum.__dict__\n simple_keys=list(simple_dict.keys())\n member_names=set(\n list(checked_enum._member_map_.keys())\n +list(simple_enum._member_map_.keys())\n )\n for key in set(checked_keys+simple_keys):\n if key in('__module__','_member_map_','_value2member_map_','__doc__'):\n \n continue\n elif key in member_names:\n \n continue\n elif key not in simple_keys:\n failed.append(\"missing key: %r\"%(key,))\n elif key not in checked_keys:\n failed.append(\"extra key: %r\"%(key,))\n else:\n checked_value=checked_dict[key]\n simple_value=simple_dict[key]\n if callable(checked_value)or isinstance(checked_value,bltns.property):\n continue\n if key =='__doc__':\n \n compressed_checked_value=checked_value.replace(' ','').replace('\\t','')\n compressed_simple_value=simple_value.replace(' ','').replace('\\t','')\n if compressed_checked_value !=compressed_simple_value:\n failed.append(\"%r:\\n %s\\n %s\"%(\n key,\n \"checked -> %r\"%(checked_value,),\n \"simple -> %r\"%(simple_value,),\n ))\n elif checked_value !=simple_value:\n failed.append(\"%r:\\n %s\\n %s\"%(\n key,\n \"checked -> %r\"%(checked_value,),\n \"simple -> %r\"%(simple_value,),\n ))\n failed.sort()\n for name in member_names:\n failed_member=[]\n if name not in simple_keys:\n failed.append('missing member from simple enum: %r'%name)\n elif name not in checked_keys:\n failed.append('extra member in simple enum: %r'%name)\n else:\n checked_member_dict=checked_enum[name].__dict__\n checked_member_keys=list(checked_member_dict.keys())\n simple_member_dict=simple_enum[name].__dict__\n simple_member_keys=list(simple_member_dict.keys())\n for key in set(checked_member_keys+simple_member_keys):\n if key in('__module__','__objclass__','_inverted_'):\n \n continue\n elif key not in simple_member_keys:\n failed_member.append(\"missing key %r not in the simple enum member %r\"%(key,name))\n elif key not in checked_member_keys:\n failed_member.append(\"extra key %r in simple enum member %r\"%(key,name))\n else:\n checked_value=checked_member_dict[key]\n simple_value=simple_member_dict[key]\n if checked_value !=simple_value:\n failed_member.append(\"%r:\\n %s\\n %s\"%(\n key,\n \"checked member -> %r\"%(checked_value,),\n \"simple member -> %r\"%(simple_value,),\n ))\n if failed_member:\n failed.append('%r member mismatch:\\n %s'%(\n name,'\\n '.join(failed_member),\n ))\n for method in(\n '__str__','__repr__','__reduce_ex__','__format__',\n '__getnewargs_ex__','__getnewargs__','__reduce_ex__','__reduce__'\n ):\n if method in simple_keys and method in checked_keys:\n \n continue\n elif method not in simple_keys and method not in checked_keys:\n \n checked_method=getattr(checked_enum,method,None)\n simple_method=getattr(simple_enum,method,None)\n if hasattr(checked_method,'__func__'):\n checked_method=checked_method.__func__\n simple_method=simple_method.__func__\n if checked_method !=simple_method:\n failed.append(\"%r: %-30s %s\"%(\n method,\n \"checked -> %r\"%(checked_method,),\n \"simple -> %r\"%(simple_method,),\n ))\n else:\n \n \n pass\n if failed:\n raise TypeError('enum mismatch:\\n %s'%'\\n '.join(failed))\n \ndef _old_convert_(etype,name,module,filter,source=None,*,boundary=None):\n ''\n\n \n \n \n \n \n \n module_globals=sys.modules[module].__dict__\n if source:\n source=source.__dict__\n else:\n source=module_globals\n \n \n \n members=[\n (name,value)\n for name,value in source.items()\n if filter(name)]\n try:\n \n members.sort(key=lambda t:(t[1],t[0]))\n except TypeError:\n \n members.sort(key=lambda t:t[0])\n cls=etype(name,members,module=module,boundary=boundary or KEEP)\n cls.__reduce_ex__=_reduce_ex_by_global_name\n return cls\n \n_stdlib_enums=IntEnum,StrEnum,IntFlag\n", ["builtins", "functools", "operator", "sys", "types", "warnings"]], "errno": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\nE2BIG=7\n\nEACCES=13\n\nEADDRINUSE=10048\n\nEADDRNOTAVAIL=10049\n\nEAFNOSUPPORT=10047\n\nEAGAIN=11\n\nEALREADY=10037\n\nEBADF=9\n\nEBADMSG=104\n\nEBUSY=16\n\nECANCELED=105\n\nECHILD=10\n\nECONNABORTED=10053\n\nECONNREFUSED=10061\n\nECONNRESET=10054\n\nEDEADLK=36\n\nEDEADLOCK=36\n\nEDESTADDRREQ=10039\n\nEDOM=33\n\nEDQUOT=10069\n\nEEXIST=17\n\nEFAULT=14\n\nEFBIG=27\n\nEHOSTDOWN=10064\n\nEHOSTUNREACH=10065\n\nEIDRM=111\n\nEILSEQ=42\n\nEINPROGRESS=10036\n\nEINTR=4\n\nEINVAL=22\n\nEIO=5\n\nEISCONN=10056\n\nEISDIR=21\n\nELOOP=10062\n\nEMFILE=24\n\nEMLINK=31\n\nEMSGSIZE=10040\n\nENAMETOOLONG=38\n\nENETDOWN=10050\n\nENETRESET=10052\n\nENETUNREACH=10051\n\nENFILE=23\n\nENOBUFS=10055\n\nENODATA=120\n\nENODEV=19\n\nENOENT=2\n\nENOEXEC=8\n\nENOLCK=39\n\nENOLINK=121\n\nENOMEM=12\n\nENOMSG=122\n\nENOPROTOOPT=10042\n\nENOSPC=28\n\nENOSR=124\n\nENOSTR=125\n\nENOSYS=40\n\nENOTCONN=10057\n\nENOTDIR=20\n\nENOTEMPTY=41\n\nENOTRECOVERABLE=127\n\nENOTSOCK=10038\n\nENOTSUP=129\n\nENOTTY=25\n\nENXIO=6\n\nEOPNOTSUPP=10045\n\nEOVERFLOW=132\n\nEOWNERDEAD=133\n\nEPERM=1\n\nEPFNOSUPPORT=10046\n\nEPIPE=32\n\nEPROTO=134\n\nEPROTONOSUPPORT=10043\n\nEPROTOTYPE=10041\n\nERANGE=34\n\nEREMOTE=10071\n\nEROFS=30\n\nESHUTDOWN=10058\n\nESOCKTNOSUPPORT=10044\n\nESPIPE=29\n\nESRCH=3\n\nESTALE=10070\n\nETIME=137\n\nETIMEDOUT=10060\n\nETOOMANYREFS=10059\n\nETXTBSY=139\n\nEUSERS=10068\n\nEWOULDBLOCK=10035\n\nEXDEV=18\n\nWSABASEERR=10000\n\nWSAEACCES=10013\n\nWSAEADDRINUSE=10048\n\nWSAEADDRNOTAVAIL=10049\n\nWSAEAFNOSUPPORT=10047\n\nWSAEALREADY=10037\n\nWSAEBADF=10009\n\nWSAECONNABORTED=10053\n\nWSAECONNREFUSED=10061\n\nWSAECONNRESET=10054\n\nWSAEDESTADDRREQ=10039\n\nWSAEDISCON=10101\n\nWSAEDQUOT=10069\n\nWSAEFAULT=10014\n\nWSAEHOSTDOWN=10064\n\nWSAEHOSTUNREACH=10065\n\nWSAEINPROGRESS=10036\n\nWSAEINTR=10004\n\nWSAEINVAL=10022\n\nWSAEISCONN=10056\n\nWSAELOOP=10062\n\nWSAEMFILE=10024\n\nWSAEMSGSIZE=10040\n\nWSAENAMETOOLONG=10063\n\nWSAENETDOWN=10050\n\nWSAENETRESET=10052\n\nWSAENETUNREACH=10051\n\nWSAENOBUFS=10055\n\nWSAENOPROTOOPT=10042\n\nWSAENOTCONN=10057\n\nWSAENOTEMPTY=10066\n\nWSAENOTSOCK=10038\n\nWSAEOPNOTSUPP=10045\n\nWSAEPFNOSUPPORT=10046\n\nWSAEPROCLIM=10067\n\nWSAEPROTONOSUPPORT=10043\n\nWSAEPROTOTYPE=10041\n\nWSAEREMOTE=10071\n\nWSAESHUTDOWN=10058\n\nWSAESOCKTNOSUPPORT=10044\n\nWSAESTALE=10070\n\nWSAETIMEDOUT=10060\n\nWSAETOOMANYREFS=10059\n\nWSAEUSERS=10068\n\nWSAEWOULDBLOCK=10035\n\nWSANOTINITIALISED=10093\n\nWSASYSNOTREADY=10091\n\nWSAVERNOTSUPPORTED=10092\n\nerrorcode={v:k for (k,v)in globals().items()if k ==k.upper()}\n", []], "external_import": [".py", "import os\nimport sys\nfrom browser import doc\nimport urllib.request\n\n\n\n\n\nclass ModuleFinder:\n def __init__(self,path_entry):\n print(\"external_import here..\")\n \n self._module=None\n if path_entry.startswith('http://'):\n self.path_entry=path_entry\n else :\n raise ImportError()\n \n def __str__(self):\n return '<%s for \"%s\">'%(self.__class__.__name__,self.path_entry)\n \n def find_module(self,fullname,path=None ):\n path=path or self.path_entry\n \n for _ext in ['js','pyj','py']:\n _fp,_url,_headers=urllib.request.urlopen(path+'/'+'%s.%s'%(fullname,_ext))\n self._module=_fp.read()\n _fp.close()\n if self._module is not None :\n print(\"module found at %s:%s\"%(path,fullname))\n return ModuleLoader(path,fullname,self._module)\n \n print('module %s not found'%fullname)\n raise ImportError()\n return None\n \nclass ModuleLoader:\n ''\n \n def __init__(self,filepath,name,module_source):\n self._filepath=filepath\n self._name=name\n self._module_source=module_source\n \n def get_source(self):\n return self._module_source\n \n def is_package(self):\n return '.'in self._name\n \n def load_module(self):\n if self._name in sys.modules:\n \n mod=sys.modules[self._name]\n return mod\n \n _src=self.get_source()\n if self._filepath.endswith('.js'):\n mod=JSObject(import_js_module(_src,self._filepath,self._name))\n elif self._filepath.endswith('.py'):\n mod=JSObject(import_py_module(_src,self._filepath,self._name))\n elif self._filepath.endswith('.pyj'):\n mod=JSObject(import_pyj_module(_src,self._filepath,self._name))\n else :\n raise ImportError('Invalid Module: %s'%self._filepath)\n \n \n mod.__file__=self._filepath\n mod.__name__=self._name\n mod.__path__=os.path.abspath(self._filepath)\n mod.__loader__=self\n mod.__package__='.'.join(self._name.split('.')[:-1])\n \n if self.is_package():\n print('adding path for package')\n \n \n mod.__path__=[self._filepath]\n else :\n print('imported as regular module')\n \n print('creating a new module object for \"%s\"'%self._name)\n sys.modules.setdefault(self._name,mod)\n JSObject(__BRYTHON__.imported)[self._name]=mod\n \n return mod\n", ["browser", "os", "sys", "urllib.request"]], "faulthandler": [".py", "''\n\n\n_EXCEPTION_ACCESS_VIOLATION=-1073741819\n\n_EXCEPTION_INT_DIVIDE_BY_ZERO=-1073741676\n\n_EXCEPTION_NONCONTINUABLE=1\n\n_EXCEPTION_NONCONTINUABLE_EXCEPTION=-1073741787\n\n_EXCEPTION_STACK_OVERFLOW=-1073741571\n\nclass __loader__(object):\n ''\n\n\n\n\n \n \n \n __delattr__=\"\"\n \n __dict__=\"{'__module__': '_frozen_importlib', '__doc__': 'Meta path import for built-in modules.\\n\\n All methods are either class or static methods to avoid the need to\\n instantiate the class.\\n\\n ', 'module_repr': , 'find_spec': , 'find_module': , 'create_module': , 'exec_module': , 'get_code': , 'get_source': , 'is_package': , 'load_module': , '__dict__': , '__weakref__': }\"\n \n __dir__=\"\"\n \n __eq__=\"\"\n \n __format__=\"\"\n \n __ge__=\"\"\n \n __getattribute__=\"\"\n \n __gt__=\"\"\n \n __hash__=\"\"\n \n __init__=\"\"\n \n def __init_subclass__(*args,**kw):\n ''\n\n\n \n pass\n \n __le__=\"\"\n \n __lt__=\"\"\n \n __module__=\"\"\"_frozen_importlib\"\"\"\n \n __ne__=\"\"\n \n def __new__(*args,**kw):\n ''\n pass\n \n __reduce__=\"\"\n \n __reduce_ex__=\"\"\n \n __repr__=\"\"\n \n __setattr__=\"\"\n \n __sizeof__=\"\"\n \n __str__=\"\"\n \n def __subclasshook__(*args,**kw):\n ''\n\n\n\n\n \n pass\n \n __weakref__=\"\"\n \n create_module=\">\"\n \n exec_module=\">\"\n \n find_module=\">\"\n \n find_spec=\">\"\n \n get_code=\">\"\n \n get_source=\">\"\n \n is_package=\">\"\n \n load_module=\">\"\n \n def module_repr(*args,**kw):\n ''\n\n\n \n pass\n__spec__=\"ModuleSpec(name='faulthandler', loader=, origin='built-in')\"\n\ndef _fatal_error(*args,**kw):\n ''\n pass\n \ndef _fatal_error_c_thread(*args,**kw):\n ''\n pass\n \ndef _raise_exception(*args,**kw):\n ''\n pass\n \ndef _read_null(*args,**kw):\n ''\n pass\n \ndef _sigabrt(*args,**kw):\n ''\n pass\n \ndef _sigfpe(*args,**kw):\n ''\n pass\n \ndef _sigsegv(*args,**kw):\n ''\n pass\n \ndef cancel_dump_traceback_later(*args,**kw):\n ''\n pass\n \ndef disable(*args,**kw):\n ''\n pass\n \ndef dump_traceback(*args,**kw):\n ''\n pass\n \ndef dump_traceback_later(*args,**kw):\n ''\n \n pass\n \ndef enable(*args,**kw):\n ''\n pass\n \ndef is_enabled(*args,**kw):\n ''\n pass\n", []], "fnmatch": [".py", "''\n\n\n\n\n\n\n\n\n\n\nimport os\nimport posixpath\nimport re\nimport functools\n\n__all__=[\"filter\",\"fnmatch\",\"fnmatchcase\",\"translate\"]\n\ndef fnmatch(name,pat):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n name=os.path.normcase(name)\n pat=os.path.normcase(pat)\n return fnmatchcase(name,pat)\n \n@functools.lru_cache(maxsize=32768,typed=True )\ndef _compile_pattern(pat):\n if isinstance(pat,bytes):\n pat_str=str(pat,'ISO-8859-1')\n res_str=translate(pat_str)\n res=bytes(res_str,'ISO-8859-1')\n else :\n res=translate(pat)\n return re.compile(res).match\n \ndef filter(names,pat):\n ''\n result=[]\n pat=os.path.normcase(pat)\n match=_compile_pattern(pat)\n if os.path is posixpath:\n \n for name in names:\n if match(name):\n result.append(name)\n else :\n for name in names:\n if match(os.path.normcase(name)):\n result.append(name)\n return result\n \ndef fnmatchcase(name,pat):\n ''\n\n\n\n \n match=_compile_pattern(pat)\n return match(name)is not None\n \n \ndef translate(pat):\n ''\n\n\n \n \n STAR=object()\n res=[]\n add=res.append\n i,n=0,len(pat)\n while i =n:\n add('\\\\[')\n else :\n stuff=pat[i:j]\n if '-'not in stuff:\n stuff=stuff.replace('\\\\',r'\\\\')\n else :\n chunks=[]\n k=i+2 if pat[i]=='!'else i+1\n while True :\n k=pat.find('-',k,j)\n if k <0:\n break\n chunks.append(pat[i:k])\n i=k+1\n k=k+3\n chunk=pat[i:j]\n if chunk:\n chunks.append(chunk)\n else :\n chunks[-1]+='-'\n \n for k in range(len(chunks)-1,0,-1):\n if chunks[k -1][-1]>chunks[k][0]:\n chunks[k -1]=chunks[k -1][:-1]+chunks[k][1:]\n del chunks[k]\n \n \n stuff='-'.join(s.replace('\\\\',r'\\\\').replace('-',r'\\-')\n for s in chunks)\n \n stuff=re.sub(r'([&~|])',r'\\\\\\1',stuff)\n i=j+1\n if not stuff:\n \n add('(?!)')\n elif stuff =='!':\n \n add('.')\n else :\n if stuff[0]=='!':\n stuff='^'+stuff[1:]\n elif stuff[0]in ('^','['):\n stuff='\\\\'+stuff\n add(f'[{stuff}]')\n else :\n add(re.escape(c))\n assert i ==n\n \n \n inp=res\n res=[]\n add=res.append\n i,n=0,len(inp)\n \n while i .*?{fixed})\")\n assert i ==n\n res=\"\".join(res)\n return fr'(?s:{res})\\Z'\n", ["functools", "os", "posixpath", "re"]], "formatter": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport sys\nimport warnings\nwarnings.warn('the formatter module is deprecated',DeprecationWarning,\nstacklevel=2)\n\n\nAS_IS=None\n\n\nclass NullFormatter:\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,writer=None ):\n if writer is None :\n writer=NullWriter()\n self.writer=writer\n def end_paragraph(self,blankline):pass\n def add_line_break(self):pass\n def add_hor_rule(self,*args,**kw):pass\n def add_label_data(self,format,counter,blankline=None ):pass\n def add_flowing_data(self,data):pass\n def add_literal_data(self,data):pass\n def flush_softspace(self):pass\n def push_alignment(self,align):pass\n def pop_alignment(self):pass\n def push_font(self,x):pass\n def pop_font(self):pass\n def push_margin(self,margin):pass\n def pop_margin(self):pass\n def set_spacing(self,spacing):pass\n def push_style(self,*styles):pass\n def pop_style(self,n=1):pass\n def assert_line_data(self,flag=1):pass\n \n \nclass AbstractFormatter:\n ''\n\n\n\n\n\n \n \n \n \n \n \n \n def __init__(self,writer):\n self.writer=writer\n self.align=None\n self.align_stack=[]\n self.font_stack=[]\n self.margin_stack=[]\n self.spacing=None\n self.style_stack=[]\n self.nospace=1\n self.softspace=0\n self.para_end=1\n self.parskip=0\n self.hard_break=1\n self.have_label=0\n \n def end_paragraph(self,blankline):\n if not self.hard_break:\n self.writer.send_line_break()\n self.have_label=0\n if self.parskip 0:\n label=label+self.format_letter(c,counter)\n elif c in 'iI':\n if counter >0:\n label=label+self.format_roman(c,counter)\n else :\n label=label+c\n return label\n \n def format_letter(self,case,counter):\n label=''\n while counter >0:\n counter,x=divmod(counter -1,26)\n \n \n \n s=chr(ord(case)+x)\n label=s+label\n return label\n \n def format_roman(self,case,counter):\n ones=['i','x','c','m']\n fives=['v','l','d']\n label,index='',0\n \n while counter >0:\n counter,x=divmod(counter,10)\n if x ==9:\n label=ones[index]+ones[index+1]+label\n elif x ==4:\n label=ones[index]+fives[index]+label\n else :\n if x >=5:\n s=fives[index]\n x=x -5\n else :\n s=''\n s=s+ones[index]*x\n label=s+label\n index=index+1\n if case =='I':\n return label.upper()\n return label\n \n def add_flowing_data(self,data):\n if not data:return\n prespace=data[:1].isspace()\n postspace=data[-1:].isspace()\n data=\" \".join(data.split())\n if self.nospace and not data:\n return\n elif prespace or self.softspace:\n if not data:\n if not self.nospace:\n self.softspace=1\n self.parskip=0\n return\n if not self.nospace:\n data=' '+data\n self.hard_break=self.nospace=self.para_end=\\\n self.parskip=self.have_label=0\n self.softspace=postspace\n self.writer.send_flowing_data(data)\n \n def add_literal_data(self,data):\n if not data:return\n if self.softspace:\n self.writer.send_flowing_data(\" \")\n self.hard_break=data[-1:]=='\\n'\n self.nospace=self.para_end=self.softspace=\\\n self.parskip=self.have_label=0\n self.writer.send_literal_data(data)\n \n def flush_softspace(self):\n if self.softspace:\n self.hard_break=self.para_end=self.parskip=\\\n self.have_label=self.softspace=0\n self.nospace=1\n self.writer.send_flowing_data(' ')\n \n def push_alignment(self,align):\n if align and align !=self.align:\n self.writer.new_alignment(align)\n self.align=align\n self.align_stack.append(align)\n else :\n self.align_stack.append(self.align)\n \n def pop_alignment(self):\n if self.align_stack:\n del self.align_stack[-1]\n if self.align_stack:\n self.align=align=self.align_stack[-1]\n self.writer.new_alignment(align)\n else :\n self.align=None\n self.writer.new_alignment(None )\n \n def push_font(self,font):\n size,i,b,tt=font\n if self.softspace:\n self.hard_break=self.para_end=self.softspace=0\n self.nospace=1\n self.writer.send_flowing_data(' ')\n if self.font_stack:\n csize,ci,cb,ctt=self.font_stack[-1]\n if size is AS_IS:size=csize\n if i is AS_IS:i=ci\n if b is AS_IS:b=cb\n if tt is AS_IS:tt=ctt\n font=(size,i,b,tt)\n self.font_stack.append(font)\n self.writer.new_font(font)\n \n def pop_font(self):\n if self.font_stack:\n del self.font_stack[-1]\n if self.font_stack:\n font=self.font_stack[-1]\n else :\n font=None\n self.writer.new_font(font)\n \n def push_margin(self,margin):\n self.margin_stack.append(margin)\n fstack=[m for m in self.margin_stack if m]\n if not margin and fstack:\n margin=fstack[-1]\n self.writer.new_margin(margin,len(fstack))\n \n def pop_margin(self):\n if self.margin_stack:\n del self.margin_stack[-1]\n fstack=[m for m in self.margin_stack if m]\n if fstack:\n margin=fstack[-1]\n else :\n margin=None\n self.writer.new_margin(margin,len(fstack))\n \n def set_spacing(self,spacing):\n self.spacing=spacing\n self.writer.new_spacing(spacing)\n \n def push_style(self,*styles):\n if self.softspace:\n self.hard_break=self.para_end=self.softspace=0\n self.nospace=1\n self.writer.send_flowing_data(' ')\n for style in styles:\n self.style_stack.append(style)\n self.writer.new_styles(tuple(self.style_stack))\n \n def pop_style(self,n=1):\n del self.style_stack[-n:]\n self.writer.new_styles(tuple(self.style_stack))\n \n def assert_line_data(self,flag=1):\n self.nospace=self.hard_break=not flag\n self.para_end=self.parskip=self.have_label=0\n \n \nclass NullWriter:\n ''\n\n\n\n\n\n \n def __init__(self):pass\n def flush(self):pass\n def new_alignment(self,align):pass\n def new_font(self,font):pass\n def new_margin(self,margin,level):pass\n def new_spacing(self,spacing):pass\n def new_styles(self,styles):pass\n def send_paragraph(self,blankline):pass\n def send_line_break(self):pass\n def send_hor_rule(self,*args,**kw):pass\n def send_label_data(self,data):pass\n def send_flowing_data(self,data):pass\n def send_literal_data(self,data):pass\n \n \nclass AbstractWriter(NullWriter):\n ''\n\n\n\n\n \n \n def new_alignment(self,align):\n print(\"new_alignment(%r)\"%(align,))\n \n def new_font(self,font):\n print(\"new_font(%r)\"%(font,))\n \n def new_margin(self,margin,level):\n print(\"new_margin(%r, %d)\"%(margin,level))\n \n def new_spacing(self,spacing):\n print(\"new_spacing(%r)\"%(spacing,))\n \n def new_styles(self,styles):\n print(\"new_styles(%r)\"%(styles,))\n \n def send_paragraph(self,blankline):\n print(\"send_paragraph(%r)\"%(blankline,))\n \n def send_line_break(self):\n print(\"send_line_break()\")\n \n def send_hor_rule(self,*args,**kw):\n print(\"send_hor_rule()\")\n \n def send_label_data(self,data):\n print(\"send_label_data(%r)\"%(data,))\n \n def send_flowing_data(self,data):\n print(\"send_flowing_data(%r)\"%(data,))\n \n def send_literal_data(self,data):\n print(\"send_literal_data(%r)\"%(data,))\n \n \nclass DumbWriter(NullWriter):\n ''\n\n\n\n\n\n \n \n def __init__(self,file=None ,maxcol=72):\n self.file=file or sys.stdout\n self.maxcol=maxcol\n NullWriter.__init__(self)\n self.reset()\n \n def reset(self):\n self.col=0\n self.atbreak=0\n \n def send_paragraph(self,blankline):\n self.file.write('\\n'*blankline)\n self.col=0\n self.atbreak=0\n \n def send_line_break(self):\n self.file.write('\\n')\n self.col=0\n self.atbreak=0\n \n def send_hor_rule(self,*args,**kw):\n self.file.write('\\n')\n self.file.write('-'*self.maxcol)\n self.file.write('\\n')\n self.col=0\n self.atbreak=0\n \n def send_literal_data(self,data):\n self.file.write(data)\n i=data.rfind('\\n')\n if i >=0:\n self.col=0\n data=data[i+1:]\n data=data.expandtabs()\n self.col=self.col+len(data)\n self.atbreak=0\n \n def send_flowing_data(self,data):\n if not data:return\n atbreak=self.atbreak or data[0].isspace()\n col=self.col\n maxcol=self.maxcol\n write=self.file.write\n for word in data.split():\n if atbreak:\n if col+len(word)>=maxcol:\n write('\\n')\n col=0\n else :\n write(' ')\n col=col+1\n write(word)\n col=col+len(word)\n atbreak=1\n self.col=col\n self.atbreak=data[-1].isspace()\n \n \ndef test(file=None ):\n w=DumbWriter()\n f=AbstractFormatter(w)\n if file is not None :\n fp=open(file)\n elif sys.argv[1:]:\n fp=open(sys.argv[1])\n else :\n fp=sys.stdin\n try :\n for line in fp:\n if line =='\\n':\n f.end_paragraph(1)\n else :\n f.add_flowing_data(line)\n finally :\n if fp is not sys.stdin:\n fp.close()\n f.end_paragraph(0)\n \n \nif __name__ =='__main__':\n test()\n", ["sys", "warnings"]], "fractions": [".py", "\n\n\n\"\"\"Fraction, infinite-precision, rational numbers.\"\"\"\n\nfrom decimal import Decimal\nimport functools\nimport math\nimport numbers\nimport operator\nimport re\nimport sys\n\n__all__=['Fraction']\n\n\n\n\n_PyHASH_MODULUS=sys.hash_info.modulus\n\n\n_PyHASH_INF=sys.hash_info.inf\n\n@functools.lru_cache(maxsize=1 <<14)\ndef _hash_algorithm(numerator,denominator):\n\n\n\n\n\n\n try:\n dinv=pow(denominator,-1,_PyHASH_MODULUS)\n except ValueError:\n \n hash_=_PyHASH_INF\n else:\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n hash_=hash(hash(abs(numerator))*dinv)\n result=hash_ if numerator >=0 else -hash_\n return -2 if result ==-1 else result\n \n_RATIONAL_FORMAT=re.compile(r\"\"\"\n \\A\\s* # optional whitespace at the start,\n (?P[-+]?) # an optional sign, then\n (?=\\d|\\.\\d) # lookahead for digit or .digit\n (?P\\d*|\\d+(_\\d+)*) # numerator (possibly empty)\n (?: # followed by\n (?:\\s*/\\s*(?P\\d+(_\\d+)*))? # an optional denominator\n | # or\n (?:\\.(?Pd*|\\d+(_\\d+)*))? # an optional fractional part\n (?:E(?P[-+]?\\d+(_\\d+)*))? # and optional exponent\n )\n \\s*\\Z # and optional whitespace to finish\n\"\"\",re.VERBOSE |re.IGNORECASE)\n\n\n\n\ndef _round_to_exponent(n,d,exponent,no_neg_zero=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if exponent >=0:\n d *=10 **exponent\n else:\n n *=10 **-exponent\n \n \n \n q,r=divmod(n+(d >>1),d)\n if r ==0 and d&1 ==0:\n q &=-2\n \n sign=q <0 if no_neg_zero else n <0\n return sign,abs(q)\n \n \ndef _round_to_figures(n,d,figures):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if n ==0:\n return False,0,1 -figures\n \n \n \n str_n,str_d=str(abs(n)),str(d)\n m=len(str_n)-len(str_d)+(str_d <=str_n)\n \n \n \n exponent=m -figures\n sign,significand=_round_to_exponent(n,d,exponent)\n \n \n \n if len(str(significand))==figures+1:\n significand //=10\n exponent +=1\n \n return sign,significand,exponent\n \n \n \n \n_FLOAT_FORMAT_SPECIFICATION_MATCHER=re.compile(r\"\"\"\n (?:\n (?P.)?\n (?P[<>=^])\n )?\n (?P[-+ ]?)\n (?Pz)?\n (?P\\#)?\n # A '0' that's *not* followed by another digit is parsed as a minimum width\n # rather than a zeropad flag.\n (?P0(?=[0-9]))?\n (?P0|[1-9][0-9]*)?\n (?P[,_])?\n (?:\\.(?P0|[1-9][0-9]*))?\n (?P[eEfFgG%])\n\"\"\",re.DOTALL |re.VERBOSE).fullmatch\n\n\nclass Fraction(numbers.Rational):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('_numerator','_denominator')\n \n \n def __new__(cls,numerator=0,denominator=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self=super(Fraction,cls).__new__(cls)\n \n if denominator is None:\n if type(numerator)is int:\n self._numerator=numerator\n self._denominator=1\n return self\n \n elif isinstance(numerator,numbers.Rational):\n self._numerator=numerator.numerator\n self._denominator=numerator.denominator\n return self\n \n elif isinstance(numerator,(float,Decimal)):\n \n self._numerator,self._denominator=numerator.as_integer_ratio()\n return self\n \n elif isinstance(numerator,str):\n \n m=_RATIONAL_FORMAT.match(numerator)\n if m is None:\n raise ValueError('Invalid literal for Fraction: %r'%\n numerator)\n numerator=int(m.group('num')or '0')\n denom=m.group('denom')\n if denom:\n denominator=int(denom)\n else:\n denominator=1\n decimal=m.group('decimal')\n if decimal:\n decimal=decimal.replace('_','')\n scale=10 **len(decimal)\n numerator=numerator *scale+int(decimal)\n denominator *=scale\n exp=m.group('exp')\n if exp:\n exp=int(exp)\n if exp >=0:\n numerator *=10 **exp\n else:\n denominator *=10 **-exp\n if m.group('sign')=='-':\n numerator=-numerator\n \n else:\n raise TypeError(\"argument should be a string \"\n \"or a Rational instance\")\n \n elif type(numerator)is int is type(denominator):\n pass\n \n elif(isinstance(numerator,numbers.Rational)and\n isinstance(denominator,numbers.Rational)):\n numerator,denominator=(\n numerator.numerator *denominator.denominator,\n denominator.numerator *numerator.denominator\n )\n else:\n raise TypeError(\"both arguments should be \"\n \"Rational instances\")\n \n if denominator ==0:\n raise ZeroDivisionError('Fraction(%s, 0)'%numerator)\n g=math.gcd(numerator,denominator)\n if denominator <0:\n g=-g\n numerator //=g\n denominator //=g\n self._numerator=numerator\n self._denominator=denominator\n return self\n \n @classmethod\n def from_float(cls,f):\n ''\n\n\n\n \n if isinstance(f,numbers.Integral):\n return cls(f)\n elif not isinstance(f,float):\n raise TypeError(\"%s.from_float() only takes floats, not %r (%s)\"%\n (cls.__name__,f,type(f).__name__))\n return cls._from_coprime_ints(*f.as_integer_ratio())\n \n @classmethod\n def from_decimal(cls,dec):\n ''\n from decimal import Decimal\n if isinstance(dec,numbers.Integral):\n dec=Decimal(int(dec))\n elif not isinstance(dec,Decimal):\n raise TypeError(\n \"%s.from_decimal() only takes Decimals, not %r (%s)\"%\n (cls.__name__,dec,type(dec).__name__))\n return cls._from_coprime_ints(*dec.as_integer_ratio())\n \n @classmethod\n def _from_coprime_ints(cls,numerator,denominator,/):\n ''\n\n\n\n \n obj=super(Fraction,cls).__new__(cls)\n obj._numerator=numerator\n obj._denominator=denominator\n return obj\n \n def is_integer(self):\n ''\n return self._denominator ==1\n \n def as_integer_ratio(self):\n ''\n\n\n \n return(self._numerator,self._denominator)\n \n def limit_denominator(self,max_denominator=1000000):\n ''\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if max_denominator <1:\n raise ValueError(\"max_denominator should be at least 1\")\n if self._denominator <=max_denominator:\n return Fraction(self)\n \n p0,q0,p1,q1=0,1,1,0\n n,d=self._numerator,self._denominator\n while True:\n a=n //d\n q2=q0+a *q1\n if q2 >max_denominator:\n break\n p0,q0,p1,q1=p1,q1,p0+a *p1,q2\n n,d=d,n -a *d\n k=(max_denominator -q0)//q1\n \n \n \n \n \n if 2 *d *(q0+k *q1)<=self._denominator:\n return Fraction._from_coprime_ints(p1,q1)\n else:\n return Fraction._from_coprime_ints(p0+k *p1,q0+k *q1)\n \n @property\n def numerator(a):\n return a._numerator\n \n @property\n def denominator(a):\n return a._denominator\n \n def __repr__(self):\n ''\n return '%s(%s, %s)'%(self.__class__.__name__,\n self._numerator,self._denominator)\n \n def __str__(self):\n ''\n if self._denominator ==1:\n return str(self._numerator)\n else:\n return '%s/%s'%(self._numerator,self._denominator)\n \n def __format__(self,format_spec,/):\n ''\n \n \n if not format_spec:\n return str(self)\n \n \n match=_FLOAT_FORMAT_SPECIFICATION_MATCHER(format_spec)\n if match is None:\n raise ValueError(\n f\"Invalid format specifier {format_spec !r} \"\n f\"for object of type {type(self).__name__ !r}\"\n )\n elif match[\"align\"]is not None and match[\"zeropad\"]is not None:\n \n raise ValueError(\n f\"Invalid format specifier {format_spec !r} \"\n f\"for object of type {type(self).__name__ !r}; \"\n \"can't use explicit alignment when zero-padding\"\n )\n fill=match[\"fill\"]or \" \"\n align=match[\"align\"]or \">\"\n pos_sign=\"\"if match[\"sign\"]==\"-\"else match[\"sign\"]\n no_neg_zero=bool(match[\"no_neg_zero\"])\n alternate_form=bool(match[\"alt\"])\n zeropad=bool(match[\"zeropad\"])\n minimumwidth=int(match[\"minimumwidth\"]or \"0\")\n thousands_sep=match[\"thousands_sep\"]\n precision=int(match[\"precision\"]or \"6\")\n presentation_type=match[\"presentation_type\"]\n trim_zeros=presentation_type in \"gG\"and not alternate_form\n trim_point=not alternate_form\n exponent_indicator=\"E\"if presentation_type in \"EFG\"else \"e\"\n \n \n \n \n \n if presentation_type in \"fF%\":\n exponent=-precision\n if presentation_type ==\"%\":\n exponent -=2\n negative,significand=_round_to_exponent(\n self._numerator,self._denominator,exponent,no_neg_zero)\n scientific=False\n point_pos=precision\n else:\n figures=(\n max(precision,1)\n if presentation_type in \"gG\"\n else precision+1\n )\n negative,significand,exponent=_round_to_figures(\n self._numerator,self._denominator,figures)\n scientific=(\n presentation_type in \"eE\"\n or exponent >0\n or exponent+figures <=-4\n )\n point_pos=figures -1 if scientific else -exponent\n \n \n if presentation_type ==\"%\":\n suffix=\"%\"\n elif scientific:\n suffix=f\"{exponent_indicator}{exponent+point_pos:+03d}\"\n else:\n suffix=\"\"\n \n \n \n digits=f\"{significand:0{point_pos+1}d}\"\n \n \n \n \n sign=\"-\"if negative else pos_sign\n leading=digits[:len(digits)-point_pos]\n frac_part=digits[len(digits)-point_pos:]\n if trim_zeros:\n frac_part=frac_part.rstrip(\"0\")\n separator=\"\"if trim_point and not frac_part else \".\"\n trailing=separator+frac_part+suffix\n \n \n if zeropad:\n min_leading=minimumwidth -len(sign)-len(trailing)\n \n \n leading=leading.zfill(\n 3 *min_leading //4+1 if thousands_sep else min_leading\n )\n \n \n if thousands_sep:\n first_pos=1+(len(leading)-1)%3\n leading=leading[:first_pos]+\"\".join(\n thousands_sep+leading[pos:pos+3]\n for pos in range(first_pos,len(leading),3)\n )\n \n \n \n body=leading+trailing\n padding=fill *(minimumwidth -len(sign)-len(body))\n if align ==\">\":\n return padding+sign+body\n elif align ==\"<\":\n return sign+body+padding\n elif align ==\"^\":\n half=len(padding)//2\n return padding[:half]+sign+body+padding[half:]\n else:\n return sign+padding+body\n \n def _operator_fallbacks(monomorphic_operator,fallback_operator):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def forward(a,b):\n if isinstance(b,Fraction):\n return monomorphic_operator(a,b)\n elif isinstance(b,int):\n return monomorphic_operator(a,Fraction(b))\n elif isinstance(b,float):\n return fallback_operator(float(a),b)\n elif isinstance(b,complex):\n return fallback_operator(complex(a),b)\n else:\n return NotImplemented\n forward.__name__='__'+fallback_operator.__name__+'__'\n forward.__doc__=monomorphic_operator.__doc__\n \n def reverse(b,a):\n if isinstance(a,numbers.Rational):\n \n return monomorphic_operator(Fraction(a),b)\n elif isinstance(a,numbers.Real):\n return fallback_operator(float(a),float(b))\n elif isinstance(a,numbers.Complex):\n return fallback_operator(complex(a),complex(b))\n else:\n return NotImplemented\n reverse.__name__='__r'+fallback_operator.__name__+'__'\n reverse.__doc__=monomorphic_operator.__doc__\n \n return forward,reverse\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def _add(a,b):\n ''\n na,da=a._numerator,a._denominator\n nb,db=b._numerator,b._denominator\n g=math.gcd(da,db)\n if g ==1:\n return Fraction._from_coprime_ints(na *db+da *nb,da *db)\n s=da //g\n t=na *(db //g)+nb *s\n g2=math.gcd(t,g)\n if g2 ==1:\n return Fraction._from_coprime_ints(t,s *db)\n return Fraction._from_coprime_ints(t //g2,s *(db //g2))\n \n __add__,__radd__=_operator_fallbacks(_add,operator.add)\n \n def _sub(a,b):\n ''\n na,da=a._numerator,a._denominator\n nb,db=b._numerator,b._denominator\n g=math.gcd(da,db)\n if g ==1:\n return Fraction._from_coprime_ints(na *db -da *nb,da *db)\n s=da //g\n t=na *(db //g)-nb *s\n g2=math.gcd(t,g)\n if g2 ==1:\n return Fraction._from_coprime_ints(t,s *db)\n return Fraction._from_coprime_ints(t //g2,s *(db //g2))\n \n __sub__,__rsub__=_operator_fallbacks(_sub,operator.sub)\n \n def _mul(a,b):\n ''\n na,da=a._numerator,a._denominator\n nb,db=b._numerator,b._denominator\n g1=math.gcd(na,db)\n if g1 >1:\n na //=g1\n db //=g1\n g2=math.gcd(nb,da)\n if g2 >1:\n nb //=g2\n da //=g2\n return Fraction._from_coprime_ints(na *nb,db *da)\n \n __mul__,__rmul__=_operator_fallbacks(_mul,operator.mul)\n \n def _div(a,b):\n ''\n \n nb,db=b._numerator,b._denominator\n if nb ==0:\n raise ZeroDivisionError('Fraction(%s, 0)'%db)\n na,da=a._numerator,a._denominator\n g1=math.gcd(na,nb)\n if g1 >1:\n na //=g1\n nb //=g1\n g2=math.gcd(db,da)\n if g2 >1:\n da //=g2\n db //=g2\n n,d=na *db,nb *da\n if d <0:\n n,d=-n,-d\n return Fraction._from_coprime_ints(n,d)\n \n __truediv__,__rtruediv__=_operator_fallbacks(_div,operator.truediv)\n \n def _floordiv(a,b):\n ''\n return(a.numerator *b.denominator)//(a.denominator *b.numerator)\n \n __floordiv__,__rfloordiv__=_operator_fallbacks(_floordiv,operator.floordiv)\n \n def _divmod(a,b):\n ''\n da,db=a.denominator,b.denominator\n div,n_mod=divmod(a.numerator *db,da *b.numerator)\n return div,Fraction(n_mod,da *db)\n \n __divmod__,__rdivmod__=_operator_fallbacks(_divmod,divmod)\n \n def _mod(a,b):\n ''\n da,db=a.denominator,b.denominator\n return Fraction((a.numerator *db)%(b.numerator *da),da *db)\n \n __mod__,__rmod__=_operator_fallbacks(_mod,operator.mod)\n \n def __pow__(a,b):\n ''\n\n\n\n\n\n \n if isinstance(b,numbers.Rational):\n if b.denominator ==1:\n power=b.numerator\n if power >=0:\n return Fraction._from_coprime_ints(a._numerator **power,\n a._denominator **power)\n elif a._numerator >0:\n return Fraction._from_coprime_ints(a._denominator **-power,\n a._numerator **-power)\n elif a._numerator ==0:\n raise ZeroDivisionError('Fraction(%s, 0)'%\n a._denominator **-power)\n else:\n return Fraction._from_coprime_ints((-a._denominator)**-power,\n (-a._numerator)**-power)\n else:\n \n \n return float(a)**float(b)\n else:\n return float(a)**b\n \n def __rpow__(b,a):\n ''\n if b._denominator ==1 and b._numerator >=0:\n \n return a **b._numerator\n \n if isinstance(a,numbers.Rational):\n return Fraction(a.numerator,a.denominator)**b\n \n if b._denominator ==1:\n return a **b._numerator\n \n return a **float(b)\n \n def __pos__(a):\n ''\n return Fraction._from_coprime_ints(a._numerator,a._denominator)\n \n def __neg__(a):\n ''\n return Fraction._from_coprime_ints(-a._numerator,a._denominator)\n \n def __abs__(a):\n ''\n return Fraction._from_coprime_ints(abs(a._numerator),a._denominator)\n \n def __int__(a,_index=operator.index):\n ''\n if a._numerator <0:\n return _index(-(-a._numerator //a._denominator))\n else:\n return _index(a._numerator //a._denominator)\n \n def __trunc__(a):\n ''\n if a._numerator <0:\n return -(-a._numerator //a._denominator)\n else:\n return a._numerator //a._denominator\n \n def __floor__(a):\n ''\n return a._numerator //a._denominator\n \n def __ceil__(a):\n ''\n \n return -(-a._numerator //a._denominator)\n \n def __round__(self,ndigits=None):\n ''\n\n\n \n if ndigits is None:\n d=self._denominator\n floor,remainder=divmod(self._numerator,d)\n if remainder *2 d:\n return floor+1\n \n elif floor %2 ==0:\n return floor\n else:\n return floor+1\n shift=10 **abs(ndigits)\n \n \n \n if ndigits >0:\n return Fraction(round(self *shift),shift)\n else:\n return Fraction(round(self /shift)*shift)\n \n def __hash__(self):\n ''\n return _hash_algorithm(self._numerator,self._denominator)\n \n def __eq__(a,b):\n ''\n if type(b)is int:\n return a._numerator ==b and a._denominator ==1\n if isinstance(b,numbers.Rational):\n return(a._numerator ==b.numerator and\n a._denominator ==b.denominator)\n if isinstance(b,numbers.Complex)and b.imag ==0:\n b=b.real\n if isinstance(b,float):\n if math.isnan(b)or math.isinf(b):\n \n \n return 0.0 ==b\n else:\n return a ==a.from_float(b)\n else:\n \n \n return NotImplemented\n \n def _richcmp(self,other,op):\n ''\n\n\n\n\n\n\n\n \n \n if isinstance(other,numbers.Rational):\n return op(self._numerator *other.denominator,\n self._denominator *other.numerator)\n if isinstance(other,float):\n if math.isnan(other)or math.isinf(other):\n return op(0.0,other)\n else:\n return op(self,self.from_float(other))\n else:\n return NotImplemented\n \n def __lt__(a,b):\n ''\n return a._richcmp(b,operator.lt)\n \n def __gt__(a,b):\n ''\n return a._richcmp(b,operator.gt)\n \n def __le__(a,b):\n ''\n return a._richcmp(b,operator.le)\n \n def __ge__(a,b):\n ''\n return a._richcmp(b,operator.ge)\n \n def __bool__(a):\n ''\n \n \n return bool(a._numerator)\n \n \n \n def __reduce__(self):\n return(self.__class__,(self._numerator,self._denominator))\n \n def __copy__(self):\n if type(self)==Fraction:\n return self\n return self.__class__(self._numerator,self._denominator)\n \n def __deepcopy__(self,memo):\n if type(self)==Fraction:\n return self\n return self.__class__(self._numerator,self._denominator)\n", ["decimal", "functools", "math", "numbers", "operator", "re", "sys"]], "functools": [".py", "''\n\n\n\n\n\n\n\n\n\n\n__all__=['update_wrapper','wraps','WRAPPER_ASSIGNMENTS','WRAPPER_UPDATES',\n'total_ordering','cache','cmp_to_key','lru_cache','reduce',\n'partial','partialmethod','singledispatch','singledispatchmethod',\n'cached_property']\n\nfrom abc import get_cache_token\nfrom collections import namedtuple\n\nfrom reprlib import recursive_repr\nfrom _thread import RLock\nfrom types import GenericAlias\n\n\n\n\n\n\n\n\n\nWRAPPER_ASSIGNMENTS=('__module__','__name__','__qualname__','__doc__',\n'__annotations__','__type_params__')\nWRAPPER_UPDATES=('__dict__',)\ndef update_wrapper(wrapper,\nwrapped,\nassigned=WRAPPER_ASSIGNMENTS,\nupdated=WRAPPER_UPDATES):\n ''\n\n\n\n\n\n\n\n\n\n \n for attr in assigned:\n try:\n value=getattr(wrapped,attr)\n except AttributeError:\n pass\n else:\n setattr(wrapper,attr,value)\n for attr in updated:\n getattr(wrapper,attr).update(getattr(wrapped,attr,{}))\n \n \n wrapper.__wrapped__=wrapped\n \n return wrapper\n \ndef wraps(wrapped,\nassigned=WRAPPER_ASSIGNMENTS,\nupdated=WRAPPER_UPDATES):\n ''\n\n\n\n\n\n\n \n return partial(update_wrapper,wrapped=wrapped,\n assigned=assigned,updated=updated)\n \n \n \n \n \n \n \n \n \n \n \ndef _gt_from_lt(self,other):\n ''\n op_result=type(self).__lt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result and self !=other\n \ndef _le_from_lt(self,other):\n ''\n op_result=type(self).__lt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return op_result or self ==other\n \ndef _ge_from_lt(self,other):\n ''\n op_result=type(self).__lt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result\n \ndef _ge_from_le(self,other):\n ''\n op_result=type(self).__le__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result or self ==other\n \ndef _lt_from_le(self,other):\n ''\n op_result=type(self).__le__(self,other)\n if op_result is NotImplemented:\n return op_result\n return op_result and self !=other\n \ndef _gt_from_le(self,other):\n ''\n op_result=type(self).__le__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result\n \ndef _lt_from_gt(self,other):\n ''\n op_result=type(self).__gt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result and self !=other\n \ndef _ge_from_gt(self,other):\n ''\n op_result=type(self).__gt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return op_result or self ==other\n \ndef _le_from_gt(self,other):\n ''\n op_result=type(self).__gt__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result\n \ndef _le_from_ge(self,other):\n ''\n op_result=type(self).__ge__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result or self ==other\n \ndef _gt_from_ge(self,other):\n ''\n op_result=type(self).__ge__(self,other)\n if op_result is NotImplemented:\n return op_result\n return op_result and self !=other\n \ndef _lt_from_ge(self,other):\n ''\n op_result=type(self).__ge__(self,other)\n if op_result is NotImplemented:\n return op_result\n return not op_result\n \n_convert={\n'__lt__':[('__gt__',_gt_from_lt),\n('__le__',_le_from_lt),\n('__ge__',_ge_from_lt)],\n'__le__':[('__ge__',_ge_from_le),\n('__lt__',_lt_from_le),\n('__gt__',_gt_from_le)],\n'__gt__':[('__lt__',_lt_from_gt),\n('__ge__',_ge_from_gt),\n('__le__',_le_from_gt)],\n'__ge__':[('__le__',_le_from_ge),\n('__gt__',_gt_from_ge),\n('__lt__',_lt_from_ge)]\n}\n\ndef total_ordering(cls):\n ''\n \n roots={op for op in _convert if getattr(cls,op,None)is not getattr(object,op,None)}\n if not roots:\n raise ValueError('must define at least one ordering operation: < > <= >=')\n root=max(roots)\n for opname,opfunc in _convert[root]:\n if opname not in roots:\n opfunc.__name__=opname\n setattr(cls,opname,opfunc)\n return cls\n \n \n \n \n \n \ndef cmp_to_key(mycmp):\n ''\n class K(object):\n __slots__=['obj']\n def __init__(self,obj):\n self.obj=obj\n def __lt__(self,other):\n return mycmp(self.obj,other.obj)<0\n def __gt__(self,other):\n return mycmp(self.obj,other.obj)>0\n def __eq__(self,other):\n return mycmp(self.obj,other.obj)==0\n def __le__(self,other):\n return mycmp(self.obj,other.obj)<=0\n def __ge__(self,other):\n return mycmp(self.obj,other.obj)>=0\n __hash__=None\n return K\n \ntry:\n from _functools import cmp_to_key\nexcept ImportError:\n pass\n \n \n \n \n \n \n_initial_missing=object()\n\ndef reduce(function,sequence,initial=_initial_missing):\n ''\n\n\n\n\n\n\n\n\n \n \n it=iter(sequence)\n \n if initial is _initial_missing:\n try:\n value=next(it)\n except StopIteration:\n raise TypeError(\n \"reduce() of empty iterable with no initial value\")from None\n else:\n value=initial\n \n for element in it:\n value=function(value,element)\n \n return value\n \ntry:\n from _functools import reduce\nexcept ImportError:\n pass\n \n \n \n \n \n \n \nclass partial:\n ''\n\n \n \n __slots__=\"func\",\"args\",\"keywords\",\"__dict__\",\"__weakref__\"\n \n def __new__(cls,func,/,*args,**keywords):\n if not callable(func):\n raise TypeError(\"the first argument must be callable\")\n \n if hasattr(func,\"func\"):\n args=func.args+args\n keywords={**func.keywords,**keywords}\n func=func.func\n \n self=super(partial,cls).__new__(cls)\n \n self.func=func\n self.args=args\n self.keywords=keywords\n return self\n \n def __call__(self,/,*args,**keywords):\n keywords={**self.keywords,**keywords}\n return self.func(*self.args,*args,**keywords)\n \n @recursive_repr()\n def __repr__(self):\n qualname=type(self).__qualname__\n args=[repr(self.func)]\n args.extend(repr(x)for x in self.args)\n args.extend(f\"{k}={v !r}\"for(k,v)in self.keywords.items())\n if type(self).__module__ ==\"functools\":\n return f\"functools.{qualname}({', '.join(args)})\"\n return f\"{qualname}({', '.join(args)})\"\n \n def __reduce__(self):\n return type(self),(self.func,),(self.func,self.args,\n self.keywords or None,self.__dict__ or None)\n \n def __setstate__(self,state):\n if not isinstance(state,tuple):\n raise TypeError(\"argument to __setstate__ must be a tuple\")\n if len(state)!=4:\n raise TypeError(f\"expected 4 items in state, got {len(state)}\")\n func,args,kwds,namespace=state\n if(not callable(func)or not isinstance(args,tuple)or\n (kwds is not None and not isinstance(kwds,dict))or\n (namespace is not None and not isinstance(namespace,dict))):\n raise TypeError(\"invalid partial state\")\n \n args=tuple(args)\n if kwds is None:\n kwds={}\n elif type(kwds)is not dict:\n kwds=dict(kwds)\n if namespace is None:\n namespace={}\n \n self.__dict__=namespace\n self.func=func\n self.args=args\n self.keywords=kwds\n \ntry:\n from _functools import partial\nexcept ImportError:\n pass\n \n \nclass partialmethod(object):\n ''\n\n\n\n\n \n \n def __init__(self,func,/,*args,**keywords):\n if not callable(func)and not hasattr(func,\"__get__\"):\n raise TypeError(\"{!r} is not callable or a descriptor\"\n .format(func))\n \n \n \n if isinstance(func,partialmethod):\n \n \n \n self.func=func.func\n self.args=func.args+args\n self.keywords={**func.keywords,**keywords}\n else:\n self.func=func\n self.args=args\n self.keywords=keywords\n \n def __repr__(self):\n args=\", \".join(map(repr,self.args))\n keywords=\", \".join(\"{}={!r}\".format(k,v)\n for k,v in self.keywords.items())\n format_string=\"{module}.{cls}({func}, {args}, {keywords})\"\n return format_string.format(module=self.__class__.__module__,\n cls=self.__class__.__qualname__,\n func=self.func,\n args=args,\n keywords=keywords)\n \n def _make_unbound_method(self):\n def _method(cls_or_self,/,*args,**keywords):\n keywords={**self.keywords,**keywords}\n return self.func(cls_or_self,*self.args,*args,**keywords)\n _method.__isabstractmethod__=self.__isabstractmethod__\n _method._partialmethod=self\n return _method\n \n def __get__(self,obj,cls=None):\n get=getattr(self.func,\"__get__\",None)\n result=None\n if get is not None:\n new_func=get(obj,cls)\n if new_func is not self.func:\n \n \n result=partial(new_func,*self.args,**self.keywords)\n try:\n result.__self__=new_func.__self__\n except AttributeError:\n pass\n if result is None:\n \n \n result=self._make_unbound_method().__get__(obj,cls)\n return result\n \n @property\n def __isabstractmethod__(self):\n return getattr(self.func,\"__isabstractmethod__\",False)\n \n __class_getitem__=classmethod(GenericAlias)\n \n \n \n \ndef _unwrap_partial(func):\n while isinstance(func,partial):\n func=func.func\n return func\n \n \n \n \n \n_CacheInfo=namedtuple(\"CacheInfo\",[\"hits\",\"misses\",\"maxsize\",\"currsize\"])\n\nclass _HashedSeq(list):\n ''\n\n\n\n \n \n __slots__='hashvalue'\n \n def __init__(self,tup,hash=hash):\n self[:]=tup\n self.hashvalue=hash(tup)\n \n def __hash__(self):\n return self.hashvalue\n \ndef _make_key(args,kwds,typed,\nkwd_mark=(object(),),\nfasttypes={int,str},\ntuple=tuple,type=type,len=len):\n ''\n\n\n\n\n\n\n\n\n \n \n \n \n \n key=args\n if kwds:\n key +=kwd_mark\n for item in kwds.items():\n key +=item\n if typed:\n key +=tuple(type(v)for v in args)\n if kwds:\n key +=tuple(type(v)for v in kwds.values())\n elif len(key)==1 and type(key[0])in fasttypes:\n return key[0]\n return _HashedSeq(key)\n \ndef lru_cache(maxsize=128,typed=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n if isinstance(maxsize,int):\n \n if maxsize <0:\n maxsize=0\n elif callable(maxsize)and isinstance(typed,bool):\n \n user_function,maxsize=maxsize,128\n wrapper=_lru_cache_wrapper(user_function,maxsize,typed,_CacheInfo)\n wrapper.cache_parameters=lambda:{'maxsize':maxsize,'typed':typed}\n return update_wrapper(wrapper,user_function)\n elif maxsize is not None:\n raise TypeError(\n 'Expected first argument to be an integer, a callable, or None')\n \n def decorating_function(user_function):\n wrapper=_lru_cache_wrapper(user_function,maxsize,typed,_CacheInfo)\n wrapper.cache_parameters=lambda:{'maxsize':maxsize,'typed':typed}\n return update_wrapper(wrapper,user_function)\n \n return decorating_function\n \ndef _lru_cache_wrapper(user_function,maxsize,typed,_CacheInfo):\n\n sentinel=object()\n make_key=_make_key\n PREV,NEXT,KEY,RESULT=0,1,2,3\n \n cache={}\n hits=misses=0\n full=False\n cache_get=cache.get\n cache_len=cache.__len__\n lock=RLock()\n root=[]\n root[:]=[root,root,None,None]\n \n if maxsize ==0:\n \n def wrapper(*args,**kwds):\n \n nonlocal misses\n misses +=1\n result=user_function(*args,**kwds)\n return result\n \n elif maxsize is None:\n \n def wrapper(*args,**kwds):\n \n nonlocal hits,misses\n key=make_key(args,kwds,typed)\n result=cache_get(key,sentinel)\n if result is not sentinel:\n hits +=1\n return result\n misses +=1\n result=user_function(*args,**kwds)\n cache[key]=result\n return result\n \n else:\n \n def wrapper(*args,**kwds):\n \n nonlocal root,hits,misses,full\n key=make_key(args,kwds,typed)\n with lock:\n link=cache_get(key)\n if link is not None:\n \n link_prev,link_next,_key,result=link\n link_prev[NEXT]=link_next\n link_next[PREV]=link_prev\n last=root[PREV]\n last[NEXT]=root[PREV]=link\n link[PREV]=last\n link[NEXT]=root\n hits +=1\n return result\n misses +=1\n result=user_function(*args,**kwds)\n with lock:\n if key in cache:\n \n \n \n \n pass\n elif full:\n \n oldroot=root\n oldroot[KEY]=key\n oldroot[RESULT]=result\n \n \n \n \n \n \n root=oldroot[NEXT]\n oldkey=root[KEY]\n oldresult=root[RESULT]\n root[KEY]=root[RESULT]=None\n \n del cache[oldkey]\n \n \n \n cache[key]=oldroot\n else:\n \n last=root[PREV]\n link=[last,root,key,result]\n last[NEXT]=root[PREV]=cache[key]=link\n \n \n full=(cache_len()>=maxsize)\n return result\n \n def cache_info():\n ''\n with lock:\n return _CacheInfo(hits,misses,maxsize,cache_len())\n \n def cache_clear():\n ''\n nonlocal hits,misses,full\n with lock:\n cache.clear()\n root[:]=[root,root,None,None]\n hits=misses=0\n full=False\n \n wrapper.cache_info=cache_info\n wrapper.cache_clear=cache_clear\n return wrapper\n \ntry:\n from _functools import _lru_cache_wrapper\nexcept ImportError:\n pass\n \n \n \n \n \n \ndef cache(user_function,/):\n ''\n return lru_cache(maxsize=None)(user_function)\n \n \n \n \n \n \ndef _c3_merge(sequences):\n ''\n\n\n\n \n result=[]\n while True:\n sequences=[s for s in sequences if s]\n if not sequences:\n return result\n for s1 in sequences:\n candidate=s1[0]\n for s2 in sequences:\n if candidate in s2[1:]:\n candidate=None\n break\n else:\n break\n if candidate is None:\n raise RuntimeError(\"Inconsistent hierarchy\")\n result.append(candidate)\n \n for seq in sequences:\n if seq[0]==candidate:\n del seq[0]\n \ndef _c3_mro(cls,abcs=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n for i,base in enumerate(reversed(cls.__bases__)):\n if hasattr(base,'__abstractmethods__'):\n boundary=len(cls.__bases__)-i\n break\n else:\n boundary=0\n abcs=list(abcs)if abcs else[]\n explicit_bases=list(cls.__bases__[:boundary])\n abstract_bases=[]\n other_bases=list(cls.__bases__[boundary:])\n for base in abcs:\n if issubclass(cls,base)and not any(\n issubclass(b,base)for b in cls.__bases__\n ):\n \n \n abstract_bases.append(base)\n for base in abstract_bases:\n abcs.remove(base)\n explicit_c3_mros=[_c3_mro(base,abcs=abcs)for base in explicit_bases]\n abstract_c3_mros=[_c3_mro(base,abcs=abcs)for base in abstract_bases]\n other_c3_mros=[_c3_mro(base,abcs=abcs)for base in other_bases]\n return _c3_merge(\n [[cls]]+\n explicit_c3_mros+abstract_c3_mros+other_c3_mros+\n [explicit_bases]+[abstract_bases]+[other_bases]\n )\n \ndef _compose_mro(cls,types):\n ''\n\n\n\n\n \n bases=set(cls.__mro__)\n \n def is_related(typ):\n return(typ not in bases and hasattr(typ,'__mro__')\n and not isinstance(typ,GenericAlias)\n and issubclass(cls,typ))\n types=[n for n in types if is_related(n)]\n \n \n def is_strict_base(typ):\n for other in types:\n if typ !=other and typ in other.__mro__:\n return True\n return False\n types=[n for n in types if not is_strict_base(n)]\n \n \n type_set=set(types)\n mro=[]\n for typ in types:\n found=[]\n for sub in typ.__subclasses__():\n if sub not in bases and issubclass(cls,sub):\n found.append([s for s in sub.__mro__ if s in type_set])\n if not found:\n mro.append(typ)\n continue\n \n found.sort(key=len,reverse=True)\n for sub in found:\n for subcls in sub:\n if subcls not in mro:\n mro.append(subcls)\n return _c3_mro(cls,abcs=mro)\n \ndef _find_impl(cls,registry):\n ''\n\n\n\n\n\n\n\n \n mro=_compose_mro(cls,registry.keys())\n match=None\n for t in mro:\n if match is not None:\n \n \n if(t in registry and t not in cls.__mro__\n and match not in cls.__mro__\n and not issubclass(match,t)):\n raise RuntimeError(\"Ambiguous dispatch: {} or {}\".format(\n match,t))\n break\n if t in registry:\n match=t\n return registry.get(match)\n \ndef singledispatch(func):\n ''\n\n\n\n\n\n\n \n \n \n \n import types,weakref\n \n registry={}\n dispatch_cache=weakref.WeakKeyDictionary()\n cache_token=None\n \n def dispatch(cls):\n ''\n\n\n\n\n \n nonlocal cache_token\n if cache_token is not None:\n current_token=get_cache_token()\n if cache_token !=current_token:\n dispatch_cache.clear()\n cache_token=current_token\n try:\n impl=dispatch_cache[cls]\n except KeyError:\n try:\n impl=registry[cls]\n except KeyError:\n impl=_find_impl(cls,registry)\n dispatch_cache[cls]=impl\n return impl\n \n def _is_union_type(cls):\n from typing import get_origin,Union\n return get_origin(cls)in{Union,types.UnionType}\n \n def _is_valid_dispatch_type(cls):\n if isinstance(cls,type):\n return True\n from typing import get_args\n return(_is_union_type(cls)and\n all(isinstance(arg,type)for arg in get_args(cls)))\n \n def register(cls,func=None):\n ''\n\n\n\n \n nonlocal cache_token\n if _is_valid_dispatch_type(cls):\n if func is None:\n return lambda f:register(cls,f)\n else:\n if func is not None:\n raise TypeError(\n f\"Invalid first argument to `register()`. \"\n f\"{cls !r} is not a class or union type.\"\n )\n ann=getattr(cls,'__annotations__',{})\n if not ann:\n raise TypeError(\n f\"Invalid first argument to `register()`: {cls !r}. \"\n f\"Use either `@register(some_class)` or plain `@register` \"\n f\"on an annotated function.\"\n )\n func=cls\n \n \n from typing import get_type_hints\n argname,cls=next(iter(get_type_hints(func).items()))\n if not _is_valid_dispatch_type(cls):\n if _is_union_type(cls):\n raise TypeError(\n f\"Invalid annotation for {argname !r}. \"\n f\"{cls !r} not all arguments are classes.\"\n )\n else:\n raise TypeError(\n f\"Invalid annotation for {argname !r}. \"\n f\"{cls !r} is not a class.\"\n )\n \n if _is_union_type(cls):\n from typing import get_args\n \n for arg in get_args(cls):\n registry[arg]=func\n else:\n registry[cls]=func\n if cache_token is None and hasattr(cls,'__abstractmethods__'):\n cache_token=get_cache_token()\n dispatch_cache.clear()\n return func\n \n def wrapper(*args,**kw):\n if not args:\n raise TypeError(f'{funcname} requires at least '\n '1 positional argument')\n \n return dispatch(args[0].__class__)(*args,**kw)\n \n funcname=getattr(func,'__name__','singledispatch function')\n registry[object]=func\n wrapper.register=register\n wrapper.dispatch=dispatch\n wrapper.registry=types.MappingProxyType(registry)\n wrapper._clear_cache=dispatch_cache.clear\n update_wrapper(wrapper,func)\n return wrapper\n \n \n \nclass singledispatchmethod:\n ''\n\n\n\n \n \n def __init__(self,func):\n if not callable(func)and not hasattr(func,\"__get__\"):\n raise TypeError(f\"{func !r} is not callable or a descriptor\")\n \n self.dispatcher=singledispatch(func)\n self.func=func\n \n def register(self,cls,method=None):\n ''\n\n\n \n return self.dispatcher.register(cls,func=method)\n \n def __get__(self,obj,cls=None):\n def _method(*args,**kwargs):\n method=self.dispatcher.dispatch(args[0].__class__)\n return method.__get__(obj,cls)(*args,**kwargs)\n \n _method.__isabstractmethod__=self.__isabstractmethod__\n _method.register=self.register\n update_wrapper(_method,self.func)\n return _method\n \n @property\n def __isabstractmethod__(self):\n return getattr(self.func,'__isabstractmethod__',False)\n \n \n \n \n \n \n \nclass cached_property:\n def __init__(self,func):\n self.func=func\n self.attrname=None\n self.__doc__=func.__doc__\n \n def __set_name__(self,owner,name):\n if self.attrname is None:\n self.attrname=name\n elif name !=self.attrname:\n raise TypeError(\n \"Cannot assign the same cached_property to two different names \"\n f\"({self.attrname !r} and {name !r}).\"\n )\n \n def __get__(self,instance,owner=None):\n if instance is None:\n return self\n if self.attrname is None:\n raise TypeError(\n \"Cannot use cached_property instance without calling __set_name__ on it.\")\n try:\n cache=instance.__dict__\n except AttributeError:\n msg=(\n f\"No '__dict__' attribute on {type(instance).__name__ !r} \"\n f\"instance to cache {self.attrname !r} property.\"\n )\n raise TypeError(msg)from None\n val=self.func(instance)\n try:\n cache[self.attrname]=val\n except TypeError:\n msg=(\n f\"The '__dict__' attribute on {type(instance).__name__ !r} instance \"\n f\"does not support item assignment for caching {self.attrname !r} property.\"\n )\n raise TypeError(msg)from None\n return val\n \n __class_getitem__=classmethod(GenericAlias)\n", ["_functools", "_thread", "abc", "collections", "reprlib", "types", "typing", "weakref"]], "gc": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nDEBUG_COLLECTABLE=2\n\nDEBUG_LEAK=38\n\nDEBUG_SAVEALL=32\n\nDEBUG_STATS=1\n\nDEBUG_UNCOLLECTABLE=4\n\nclass __loader__:\n pass\n \ncallbacks=[]\n\ndef collect(*args,**kw):\n ''\n\n\n\n\n\n \n pass\n \ndef disable(*args,**kw):\n ''\n\n \n pass\n \ndef enable(*args,**kw):\n ''\n\n \n pass\n \ngarbage=[]\n\ndef get_count(*args,**kw):\n ''\n\n \n pass\n \ndef get_debug(*args,**kw):\n ''\n\n \n pass\n \ndef get_objects(*args,**kw):\n ''\n\n\n \n pass\n \ndef get_referents(*args,**kw):\n ''\n pass\n \ndef get_referrers(*args,**kw):\n ''\n pass\n \ndef get_threshold(*args,**kw):\n ''\n\n \n pass\n \ndef is_tracked(*args,**kw):\n ''\n\n\n \n pass\n \ndef isenabled(*args,**kw):\n ''\n\n \n pass\n \ndef set_debug(*args,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n \n pass\n \ndef set_threshold(*args,**kw):\n ''\n\n\n \n pass\n", []], "genericpath": [".py", "''\n\n\n\n\nimport os\nimport stat\n\n__all__=['commonprefix','exists','getatime','getctime','getmtime',\n'getsize','isdir','isfile','islink','samefile','sameopenfile',\n'samestat']\n\n\n\n\ndef exists(path):\n ''\n try:\n os.stat(path)\n except(OSError,ValueError):\n return False\n return True\n \n \n \n \ndef isfile(path):\n ''\n try:\n st=os.stat(path)\n except(OSError,ValueError):\n return False\n return stat.S_ISREG(st.st_mode)\n \n \n \n \n \ndef isdir(s):\n ''\n try:\n st=os.stat(s)\n except(OSError,ValueError):\n return False\n return stat.S_ISDIR(st.st_mode)\n \n \n \n \n \ndef islink(path):\n ''\n try:\n st=os.lstat(path)\n except(OSError,ValueError,AttributeError):\n return False\n return stat.S_ISLNK(st.st_mode)\n \n \ndef getsize(filename):\n ''\n return os.stat(filename).st_size\n \n \ndef getmtime(filename):\n ''\n return os.stat(filename).st_mtime\n \n \ndef getatime(filename):\n ''\n return os.stat(filename).st_atime\n \n \ndef getctime(filename):\n ''\n return os.stat(filename).st_ctime\n \n \n \ndef commonprefix(m):\n ''\n if not m:return ''\n \n \n \n \n if not isinstance(m[0],(list,tuple)):\n m=tuple(map(os.fspath,m))\n s1=min(m)\n s2=max(m)\n for i,c in enumerate(s1):\n if c !=s2[i]:\n return s1[:i]\n return s1\n \n \n \ndef samestat(s1,s2):\n ''\n return(s1.st_ino ==s2.st_ino and\n s1.st_dev ==s2.st_dev)\n \n \n \ndef samefile(f1,f2):\n ''\n\n\n\n \n s1=os.stat(f1)\n s2=os.stat(f2)\n return samestat(s1,s2)\n \n \n \n \ndef sameopenfile(fp1,fp2):\n ''\n s1=os.fstat(fp1)\n s2=os.fstat(fp2)\n return samestat(s1,s2)\n \n \n \n \n \n \n \n \n \ndef _splitext(p,sep,altsep,extsep):\n ''\n\n\n \n \n \n sepIndex=p.rfind(sep)\n if altsep:\n altsepIndex=p.rfind(altsep)\n sepIndex=max(sepIndex,altsepIndex)\n \n dotIndex=p.rfind(extsep)\n if dotIndex >sepIndex:\n \n filenameIndex=sepIndex+1\n while filenameIndex [ \\t]+) | # spaces and horizontal tabs\n (?P[0-9]+\\b) | # decimal integer\n (?Pn\\b) | # only n is allowed\n (?P[()]) |\n (?P[-*/%+?:]|[>,\n # <=, >=, ==, !=, &&, ||,\n # ? :\n # unary and bitwise ops\n # not allowed\n (?P\\w+|.) # invalid token\n \"\"\",re.VERBOSE |re.DOTALL)\n\n\ndef _tokenize(plural):\n for mo in re.finditer(_token_pattern,plural):\n kind=mo.lastgroup\n if kind =='WHITESPACES':\n continue\n value=mo.group(kind)\n if kind =='INVALID':\n raise ValueError('invalid token in plural form: %s'%value)\n yield value\n yield ''\n \n \ndef _error(value):\n if value:\n return ValueError('unexpected token in plural form: %s'%value)\n else :\n return ValueError('unexpected end of plural form')\n \n \n_binary_ops=(\n('||',),\n('&&',),\n('==','!='),\n('<','>','<=','>='),\n('+','-'),\n('*','/','%'),\n)\n_binary_ops={op:i for i,ops in enumerate(_binary_ops,1)for op in ops}\n_c2py_ops={'||':'or','&&':'and','/':'//'}\n\n\ndef _parse(tokens,priority=-1):\n result=''\n nexttok=next(tokens)\n while nexttok =='!':\n result +='not '\n nexttok=next(tokens)\n \n if nexttok =='(':\n sub,nexttok=_parse(tokens)\n result='%s(%s)'%(result,sub)\n if nexttok !=')':\n raise ValueError('unbalanced parenthesis in plural form')\n elif nexttok =='n':\n result='%s%s'%(result,nexttok)\n else :\n try :\n value=int(nexttok,10)\n except ValueError:\n raise _error(nexttok)from None\n result='%s%d'%(result,value)\n nexttok=next(tokens)\n \n j=100\n while nexttok in _binary_ops:\n i=_binary_ops[nexttok]\n if i 1000:\n raise ValueError('plural form expression is too long')\n try :\n result,nexttok=_parse(_tokenize(plural))\n if nexttok:\n raise _error(nexttok)\n \n depth=0\n for c in result:\n if c =='(':\n depth +=1\n if depth >20:\n \n \n raise ValueError('plural form expression is too complex')\n elif c ==')':\n depth -=1\n \n ns={'_as_int':_as_int}\n exec('''if True:\n def func(n):\n if not isinstance(n, int):\n n = _as_int(n)\n return int(%s)\n '''%result,ns)\n return ns['func']\n except RecursionError:\n \n raise ValueError('plural form expression is too complex')\n \n \ndef _expand_lang(loc):\n import locale\n loc=locale.normalize(loc)\n COMPONENT_CODESET=1 <<0\n COMPONENT_TERRITORY=1 <<1\n COMPONENT_MODIFIER=1 <<2\n \n mask=0\n pos=loc.find('@')\n if pos >=0:\n modifier=loc[pos:]\n loc=loc[:pos]\n mask |=COMPONENT_MODIFIER\n else :\n modifier=''\n pos=loc.find('.')\n if pos >=0:\n codeset=loc[pos:]\n loc=loc[:pos]\n mask |=COMPONENT_CODESET\n else :\n codeset=''\n pos=loc.find('_')\n if pos >=0:\n territory=loc[pos:]\n loc=loc[:pos]\n mask |=COMPONENT_TERRITORY\n else :\n territory=''\n language=loc\n ret=[]\n for i in range(mask+1):\n if not (i&~mask):\n val=language\n if i&COMPONENT_TERRITORY:val +=territory\n if i&COMPONENT_CODESET:val +=codeset\n if i&COMPONENT_MODIFIER:val +=modifier\n ret.append(val)\n ret.reverse()\n return ret\n \n \nclass NullTranslations:\n def __init__(self,fp=None ):\n self._info={}\n self._charset=None\n self._fallback=None\n if fp is not None :\n self._parse(fp)\n \n def _parse(self,fp):\n pass\n \n def add_fallback(self,fallback):\n if self._fallback:\n self._fallback.add_fallback(fallback)\n else :\n self._fallback=fallback\n \n def gettext(self,message):\n if self._fallback:\n return self._fallback.gettext(message)\n return message\n \n def ngettext(self,msgid1,msgid2,n):\n if self._fallback:\n return self._fallback.ngettext(msgid1,msgid2,n)\n if n ==1:\n return msgid1\n else :\n return msgid2\n \n def pgettext(self,context,message):\n if self._fallback:\n return self._fallback.pgettext(context,message)\n return message\n \n def npgettext(self,context,msgid1,msgid2,n):\n if self._fallback:\n return self._fallback.npgettext(context,msgid1,msgid2,n)\n if n ==1:\n return msgid1\n else :\n return msgid2\n \n def info(self):\n return self._info\n \n def charset(self):\n return self._charset\n \n def install(self,names=None ):\n import builtins\n builtins.__dict__['_']=self.gettext\n if names is not None :\n allowed={'gettext','ngettext','npgettext','pgettext'}\n for name in allowed&set(names):\n builtins.__dict__[name]=getattr(self,name)\n \n \nclass GNUTranslations(NullTranslations):\n\n LE_MAGIC=0x950412de\n BE_MAGIC=0xde120495\n \n \n \n CONTEXT=\"%s\\x04%s\"\n \n \n VERSIONS=(0,1)\n \n def _get_versions(self,version):\n ''\n return (version >>16,version&0xffff)\n \n def _parse(self,fp):\n ''\n \n \n from struct import unpack\n filename=getattr(fp,'name','')\n \n \n self._catalog=catalog={}\n self.plural=lambda n:int(n !=1)\n buf=fp.read()\n buflen=len(buf)\n \n magic=unpack('4I',buf[4:20])\n ii='>II'\n else :\n raise OSError(0,'Bad magic number',filename)\n \n major_version,minor_version=self._get_versions(version)\n \n if major_version not in self.VERSIONS:\n raise OSError(0,'Bad version number '+str(major_version),filename)\n \n \n \n for i in range(0,msgcount):\n mlen,moff=unpack(ii,buf[masteridx:masteridx+8])\n mend=moff+mlen\n tlen,toff=unpack(ii,buf[transidx:transidx+8])\n tend=toff+tlen\n if mend '\n \n def _init_write(self,filename):\n self.name=filename\n self.crc=zlib.crc32(b\"\")\n self.size=0\n self.writebuf=[]\n self.bufsize=0\n self.offset=0\n \n def _write_gzip_header(self,compresslevel):\n self.fileobj.write(b'\\037\\213')\n self.fileobj.write(b'\\010')\n try :\n \n \n fname=os.path.basename(self.name)\n if not isinstance(fname,bytes):\n fname=fname.encode('latin-1')\n if fname.endswith(b'.gz'):\n fname=fname[:-3]\n except UnicodeEncodeError:\n fname=b''\n flags=0\n if fname:\n flags=FNAME\n self.fileobj.write(chr(flags).encode('latin-1'))\n mtime=self._write_mtime\n if mtime is None :\n mtime=time.time()\n write32u(self.fileobj,int(mtime))\n if compresslevel ==_COMPRESS_LEVEL_BEST:\n xfl=b'\\002'\n elif compresslevel ==_COMPRESS_LEVEL_FAST:\n xfl=b'\\004'\n else :\n xfl=b'\\000'\n self.fileobj.write(xfl)\n self.fileobj.write(b'\\377')\n if fname:\n self.fileobj.write(fname+b'\\000')\n \n def write(self,data):\n self._check_not_closed()\n if self.mode !=WRITE:\n import errno\n raise OSError(errno.EBADF,\"write() on read-only GzipFile object\")\n \n if self.fileobj is None :\n raise ValueError(\"write() on closed GzipFile object\")\n \n if isinstance(data,(bytes,bytearray)):\n length=len(data)\n else :\n \n data=memoryview(data)\n length=data.nbytes\n \n if length >0:\n self.fileobj.write(self.compress.compress(data))\n self.size +=length\n self.crc=zlib.crc32(data,self.crc)\n self.offset +=length\n \n return length\n \n def read(self,size=-1):\n self._check_not_closed()\n if self.mode !=READ:\n import errno\n raise OSError(errno.EBADF,\"read() on write-only GzipFile object\")\n return self._buffer.read(size)\n \n def read1(self,size=-1):\n ''\n\n \n self._check_not_closed()\n if self.mode !=READ:\n import errno\n raise OSError(errno.EBADF,\"read1() on write-only GzipFile object\")\n \n if size <0:\n size=io.DEFAULT_BUFFER_SIZE\n return self._buffer.read1(size)\n \n def peek(self,n):\n self._check_not_closed()\n if self.mode !=READ:\n import errno\n raise OSError(errno.EBADF,\"peek() on write-only GzipFile object\")\n return self._buffer.peek(n)\n \n @property\n def closed(self):\n return self.fileobj is None\n \n def close(self):\n fileobj=self.fileobj\n if fileobj is None :\n return\n self.fileobj=None\n try :\n if self.mode ==WRITE:\n fileobj.write(self.compress.flush())\n write32u(fileobj,self.crc)\n \n write32u(fileobj,self.size&0xffffffff)\n elif self.mode ==READ:\n self._buffer.close()\n finally :\n myfileobj=self.myfileobj\n if myfileobj:\n self.myfileobj=None\n myfileobj.close()\n \n def flush(self,zlib_mode=zlib.Z_SYNC_FLUSH):\n self._check_not_closed()\n if self.mode ==WRITE:\n \n self.fileobj.write(self.compress.flush(zlib_mode))\n self.fileobj.flush()\n \n def fileno(self):\n ''\n\n\n\n \n return self.fileobj.fileno()\n \n def rewind(self):\n ''\n \n if self.mode !=READ:\n raise OSError(\"Can't rewind in write mode\")\n self._buffer.seek(0)\n \n def readable(self):\n return self.mode ==READ\n \n def writable(self):\n return self.mode ==WRITE\n \n def seekable(self):\n return True\n \n def seek(self,offset,whence=io.SEEK_SET):\n if self.mode ==WRITE:\n if whence !=io.SEEK_SET:\n if whence ==io.SEEK_CUR:\n offset=self.offset+offset\n else :\n raise ValueError('Seek from end not supported')\n if offset startpos:\n parentpos=(pos -1)>>1\n parent=heap[parentpos]\n if newitem startpos:\n parentpos=(pos -1)>>1\n parent=heap[parentpos]\n if parent 1:\n try :\n while True :\n value,order,next=s=h[0]\n yield value\n s[0]=next()\n _heapreplace(h,s)\n except StopIteration:\n _heappop(h)\n if h:\n \n value,order,next=h[0]\n yield value\n yield from next.__self__\n return\n \n for order,it in enumerate(map(iter,iterables)):\n try :\n next=it.__next__\n value=next()\n h_append([key(value),order *direction,value,next])\n except StopIteration:\n pass\n _heapify(h)\n while len(h)>1:\n try :\n while True :\n key_value,order,value,next=s=h[0]\n yield value\n value=next()\n s[0]=key(value)\n s[2]=value\n _heapreplace(h,s)\n except StopIteration:\n _heappop(h)\n if h:\n key_value,order,value,next=h[0]\n yield value\n yield from next.__self__\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \ndef nsmallest(n,iterable,key=None ):\n ''\n\n\n \n \n \n if n ==1:\n it=iter(iterable)\n sentinel=object()\n result=min(it,default=sentinel,key=key)\n return []if result is sentinel else [result]\n \n \n try :\n size=len(iterable)\n except (TypeError,AttributeError):\n pass\n else :\n if n >=size:\n return sorted(iterable,key=key)[:n]\n \n \n if key is None :\n it=iter(iterable)\n \n \n result=[(elem,i)for i,elem in zip(range(n),it)]\n if not result:\n return result\n _heapify_max(result)\n top=result[0][0]\n order=n\n _heapreplace=_heapreplace_max\n for elem in it:\n if elem =size:\n return sorted(iterable,key=key,reverse=True )[:n]\n \n \n if key is None :\n it=iter(iterable)\n result=[(elem,i)for i,elem in zip(range(0,-n,-1),it)]\n if not result:\n return result\n heapify(result)\n top=result[0][0]\n order=-n\n _heapreplace=heapreplace\n for elem in it:\n if top blocksize:\n key=digest_cons(key).digest()\n \n \n \n self.block_size=blocksize\n \n key=key.ljust(blocksize,b'\\0')\n self._outer.update(key.translate(trans_5C))\n self._inner.update(key.translate(trans_36))\n if msg is not None :\n self.update(msg)\n \n @property\n def name(self):\n if self._hmac:\n return self._hmac.name\n else :\n return f\"hmac-{self._inner.name}\"\n \n def update(self,msg):\n ''\n inst=self._hmac or self._inner\n inst.update(msg)\n \n def copy(self):\n ''\n\n\n \n \n other=self.__class__.__new__(self.__class__)\n other.digest_size=self.digest_size\n if self._hmac:\n other._hmac=self._hmac.copy()\n other._inner=other._outer=None\n else :\n other._hmac=None\n other._inner=self._inner.copy()\n other._outer=self._outer.copy()\n return other\n \n def _current(self):\n ''\n\n\n \n if self._hmac:\n return self._hmac\n else :\n h=self._outer.copy()\n h.update(self._inner.digest())\n return h\n \n def digest(self):\n ''\n\n\n\n\n \n h=self._current()\n return h.digest()\n \n def hexdigest(self):\n ''\n \n h=self._current()\n return h.hexdigest()\n \ndef new(key,msg=None ,digestmod=''):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return HMAC(key,msg,digestmod)\n \n \ndef digest(key,msg,digest):\n ''\n\n\n\n\n\n\n \n if _hashopenssl is not None and isinstance(digest,(str,_functype)):\n try :\n return _hashopenssl.hmac_digest(key,msg,digest)\n except _hashopenssl.UnsupportedDigestmodError:\n pass\n \n if callable(digest):\n digest_cons=digest\n elif isinstance(digest,str):\n digest_cons=lambda d=b'':_hashlib.new(digest,d)\n else :\n digest_cons=lambda d=b'':digest.new(d)\n \n inner=digest_cons()\n outer=digest_cons()\n blocksize=getattr(inner,'block_size',64)\n if len(key)>blocksize:\n key=digest_cons(key).digest()\n key=key+b'\\x00'*(blocksize -len(key))\n inner.update(key.translate(trans_36))\n outer.update(key.translate(trans_5C))\n inner.update(msg)\n outer.update(inner.digest())\n return outer.digest()\n", ["_hashlib", "_operator", "hashlib", "warnings"]], "imp": [".py", "''\n\n\n\n\n\n\n\nfrom _imp import (lock_held,acquire_lock,release_lock,\nget_frozen_object,is_frozen_package,\ninit_frozen,is_builtin,is_frozen,\n_fix_co_filename,_frozen_module_names)\ntry :\n from _imp import create_dynamic\nexcept ImportError:\n\n create_dynamic=None\n \nfrom importlib._bootstrap import _ERR_MSG,_exec,_load,_builtin_from_name\nfrom importlib._bootstrap_external import SourcelessFileLoader\n\nfrom importlib import machinery\nfrom importlib import util\nimport importlib\nimport os\nimport sys\nimport tokenize\nimport types\nimport warnings\n\nwarnings.warn(\"the imp module is deprecated in favour of importlib and slated \"\n\"for removal in Python 3.12; \"\n\"see the module's documentation for alternative uses\",\nDeprecationWarning,stacklevel=2)\n\n\nSEARCH_ERROR=0\nPY_SOURCE=1\nPY_COMPILED=2\nC_EXTENSION=3\nPY_RESOURCE=4\nPKG_DIRECTORY=5\nC_BUILTIN=6\nPY_FROZEN=7\nPY_CODERESOURCE=8\nIMP_HOOK=9\n\n\ndef new_module(name):\n ''\n\n\n\n\n\n \n return types.ModuleType(name)\n \n \ndef get_magic():\n ''\n\n\n \n return util.MAGIC_NUMBER\n \n \ndef get_tag():\n ''\n return sys.implementation.cache_tag\n \n \ndef cache_from_source(path,debug_override=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n with warnings.catch_warnings():\n warnings.simplefilter('ignore')\n return util.cache_from_source(path,debug_override)\n \n \ndef source_from_cache(path):\n ''\n\n\n\n\n\n\n\n\n \n return util.source_from_cache(path)\n \n \ndef get_suffixes():\n ''\n extensions=[(s,'rb',C_EXTENSION)for s in machinery.EXTENSION_SUFFIXES]\n source=[(s,'r',PY_SOURCE)for s in machinery.SOURCE_SUFFIXES]\n bytecode=[(s,'rb',PY_COMPILED)for s in machinery.BYTECODE_SUFFIXES]\n \n return extensions+source+bytecode\n \n \nclass NullImporter:\n\n ''\n\n\n\n \n \n def __init__(self,path):\n if path =='':\n raise ImportError('empty pathname',path='')\n elif os.path.isdir(path):\n raise ImportError('existing directory',path=path)\n \n def find_module(self,fullname):\n ''\n return None\n \n \nclass _HackedGetData:\n\n ''\n \n \n def __init__(self,fullname,path,file=None ):\n super().__init__(fullname,path)\n self.file=file\n \n def get_data(self,path):\n ''\n if self.file and path ==self.path:\n \n \n if not self.file.closed:\n file=self.file\n if 'b'not in file.mode:\n file.close()\n if self.file.closed:\n self.file=file=open(self.path,'rb')\n \n with file:\n return file.read()\n else :\n return super().get_data(path)\n \n \nclass _LoadSourceCompatibility(_HackedGetData,machinery.SourceFileLoader):\n\n ''\n \n \ndef load_source(name,pathname,file=None ):\n loader=_LoadSourceCompatibility(name,pathname,file)\n spec=util.spec_from_file_location(name,pathname,loader=loader)\n if name in sys.modules:\n module=_exec(spec,sys.modules[name])\n else :\n module=_load(spec)\n \n \n module.__loader__=machinery.SourceFileLoader(name,pathname)\n module.__spec__.loader=module.__loader__\n return module\n \n \nclass _LoadCompiledCompatibility(_HackedGetData,SourcelessFileLoader):\n\n ''\n \n \ndef load_compiled(name,pathname,file=None ):\n ''\n loader=_LoadCompiledCompatibility(name,pathname,file)\n spec=util.spec_from_file_location(name,pathname,loader=loader)\n if name in sys.modules:\n module=_exec(spec,sys.modules[name])\n else :\n module=_load(spec)\n \n \n module.__loader__=SourcelessFileLoader(name,pathname)\n module.__spec__.loader=module.__loader__\n return module\n \n \ndef load_package(name,path):\n ''\n if os.path.isdir(path):\n extensions=(machinery.SOURCE_SUFFIXES[:]+\n machinery.BYTECODE_SUFFIXES[:])\n for extension in extensions:\n init_path=os.path.join(path,'__init__'+extension)\n if os.path.exists(init_path):\n path=init_path\n break\n else :\n raise ValueError('{!r} is not a package'.format(path))\n spec=util.spec_from_file_location(name,path,\n submodule_search_locations=[])\n if name in sys.modules:\n return _exec(spec,sys.modules[name])\n else :\n return _load(spec)\n \n \ndef load_module(name,file,filename,details):\n ''\n\n\n\n\n\n \n suffix,mode,type_=details\n if mode and (not mode.startswith('r')or '+'in mode):\n raise ValueError('invalid file open mode {!r}'.format(mode))\n elif file is None and type_ in {PY_SOURCE,PY_COMPILED}:\n msg='file object required for import (type code {})'.format(type_)\n raise ValueError(msg)\n elif type_ ==PY_SOURCE:\n return load_source(name,filename,file)\n elif type_ ==PY_COMPILED:\n return load_compiled(name,filename,file)\n elif type_ ==C_EXTENSION and load_dynamic is not None :\n if file is None :\n with open(filename,'rb')as opened_file:\n return load_dynamic(name,filename,opened_file)\n else :\n return load_dynamic(name,filename,file)\n elif type_ ==PKG_DIRECTORY:\n return load_package(name,filename)\n elif type_ ==C_BUILTIN:\n return init_builtin(name)\n elif type_ ==PY_FROZEN:\n return init_frozen(name)\n else :\n msg=\"Don't know how to import {} (type code {})\".format(name,type_)\n raise ImportError(msg,name=name)\n \n \ndef find_module(name,path=None ):\n ''\n\n\n\n\n\n\n\n\n \n if not isinstance(name,str):\n raise TypeError(\"'name' must be a str, not {}\".format(type(name)))\n elif not isinstance(path,(type(None ),list)):\n \n raise RuntimeError(\"'path' must be None or a list, \"\n \"not {}\".format(type(path)))\n \n if path is None :\n if is_builtin(name):\n return None ,None ,('','',C_BUILTIN)\n elif is_frozen(name):\n return None ,None ,('','',PY_FROZEN)\n else :\n path=sys.path\n \n for entry in path:\n package_directory=os.path.join(entry,name)\n for suffix in ['.py',machinery.BYTECODE_SUFFIXES[0]]:\n package_file_name='__init__'+suffix\n file_path=os.path.join(package_directory,package_file_name)\n if os.path.isfile(file_path):\n return None ,package_directory,('','',PKG_DIRECTORY)\n for suffix,mode,type_ in get_suffixes():\n file_name=name+suffix\n file_path=os.path.join(entry,file_name)\n if os.path.isfile(file_path):\n break\n else :\n continue\n break\n else :\n raise ImportError(_ERR_MSG.format(name),name=name)\n \n encoding=None\n if 'b'not in mode:\n with open(file_path,'rb')as file:\n encoding=tokenize.detect_encoding(file.readline)[0]\n file=open(file_path,mode,encoding=encoding)\n return file,file_path,(suffix,mode,type_)\n \n \ndef reload(module):\n ''\n\n\n\n\n\n \n return importlib.reload(module)\n \n \ndef init_builtin(name):\n ''\n\n\n\n \n try :\n return _builtin_from_name(name)\n except ImportError:\n return None\n \n \nif create_dynamic:\n def load_dynamic(name,path,file=None ):\n ''\n\n\n \n import importlib.machinery\n loader=importlib.machinery.ExtensionFileLoader(name,path)\n \n \n \n spec=importlib.machinery.ModuleSpec(\n name=name,loader=loader,origin=path)\n return _load(spec)\n \nelse :\n load_dynamic=None\n", ["_imp", "importlib", "importlib._bootstrap", "importlib._bootstrap_external", "importlib.machinery", "importlib.util", "os", "sys", "tokenize", "types", "warnings"]], "inspect": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__author__=('Ka-Ping Yee ',\n'Yury Selivanov ')\n\n__all__=[\n\"ArgInfo\",\n\"Arguments\",\n\"Attribute\",\n\"BlockFinder\",\n\"BoundArguments\",\n\"CORO_CLOSED\",\n\"CORO_CREATED\",\n\"CORO_RUNNING\",\n\"CORO_SUSPENDED\",\n\"CO_ASYNC_GENERATOR\",\n\"CO_COROUTINE\",\n\"CO_GENERATOR\",\n\"CO_ITERABLE_COROUTINE\",\n\"CO_NESTED\",\n\"CO_NEWLOCALS\",\n\"CO_NOFREE\",\n\"CO_OPTIMIZED\",\n\"CO_VARARGS\",\n\"CO_VARKEYWORDS\",\n\"ClassFoundException\",\n\"ClosureVars\",\n\"EndOfBlock\",\n\"FrameInfo\",\n\"FullArgSpec\",\n\"GEN_CLOSED\",\n\"GEN_CREATED\",\n\"GEN_RUNNING\",\n\"GEN_SUSPENDED\",\n\"Parameter\",\n\"Signature\",\n\"TPFLAGS_IS_ABSTRACT\",\n\"Traceback\",\n\"classify_class_attrs\",\n\"cleandoc\",\n\"currentframe\",\n\"findsource\",\n\"formatannotation\",\n\"formatannotationrelativeto\",\n\"formatargvalues\",\n\"get_annotations\",\n\"getabsfile\",\n\"getargs\",\n\"getargvalues\",\n\"getattr_static\",\n\"getblock\",\n\"getcallargs\",\n\"getclasstree\",\n\"getclosurevars\",\n\"getcomments\",\n\"getcoroutinelocals\",\n\"getcoroutinestate\",\n\"getdoc\",\n\"getfile\",\n\"getframeinfo\",\n\"getfullargspec\",\n\"getgeneratorlocals\",\n\"getgeneratorstate\",\n\"getinnerframes\",\n\"getlineno\",\n\"getmembers\",\n\"getmembers_static\",\n\"getmodule\",\n\"getmodulename\",\n\"getmro\",\n\"getouterframes\",\n\"getsource\",\n\"getsourcefile\",\n\"getsourcelines\",\n\"indentsize\",\n\"isabstract\",\n\"isasyncgen\",\n\"isasyncgenfunction\",\n\"isawaitable\",\n\"isbuiltin\",\n\"isclass\",\n\"iscode\",\n\"iscoroutine\",\n\"iscoroutinefunction\",\n\"isdatadescriptor\",\n\"isframe\",\n\"isfunction\",\n\"isgenerator\",\n\"isgeneratorfunction\",\n\"isgetsetdescriptor\",\n\"ismemberdescriptor\",\n\"ismethod\",\n\"ismethoddescriptor\",\n\"ismethodwrapper\",\n\"ismodule\",\n\"isroutine\",\n\"istraceback\",\n\"signature\",\n\"stack\",\n\"trace\",\n\"unwrap\",\n\"walktree\",\n]\n\n\nimport abc\nimport ast\nimport dis\nimport collections.abc\nimport enum\nimport importlib.machinery\nimport itertools\nimport linecache\nimport os\nimport re\nimport sys\nimport tokenize\nimport token\nimport types\nimport functools\nimport builtins\nfrom keyword import iskeyword\nfrom operator import attrgetter\nfrom collections import namedtuple,OrderedDict\n\n\n\nmod_dict=globals()\nfor k,v in dis.COMPILER_FLAG_NAMES.items():\n mod_dict[\"CO_\"+v]=k\ndel k,v,mod_dict\n\n\nTPFLAGS_IS_ABSTRACT=1 <<20\n\n\ndef get_annotations(obj,*,globals=None ,locals=None ,eval_str=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(obj,type):\n \n obj_dict=getattr(obj,'__dict__',None )\n if obj_dict and hasattr(obj_dict,'get'):\n ann=obj_dict.get('__annotations__',None )\n if isinstance(ann,types.GetSetDescriptorType):\n ann=None\n else :\n ann=None\n \n obj_globals=None\n module_name=getattr(obj,'__module__',None )\n if module_name:\n module=sys.modules.get(module_name,None )\n if module:\n obj_globals=getattr(module,'__dict__',None )\n obj_locals=dict(vars(obj))\n unwrap=obj\n elif isinstance(obj,types.ModuleType):\n \n ann=getattr(obj,'__annotations__',None )\n obj_globals=getattr(obj,'__dict__')\n obj_locals=None\n unwrap=None\n elif callable(obj):\n \n \n \n ann=getattr(obj,'__annotations__',None )\n obj_globals=getattr(obj,'__globals__',None )\n obj_locals=None\n unwrap=obj\n else :\n raise TypeError(f\"{obj!r} is not a module, class, or callable.\")\n \n if ann is None :\n return {}\n \n if not isinstance(ann,dict):\n raise ValueError(f\"{obj!r}.__annotations__ is neither a dict nor None\")\n \n if not ann:\n return {}\n \n if not eval_str:\n return dict(ann)\n \n if unwrap is not None :\n while True :\n if hasattr(unwrap,'__wrapped__'):\n unwrap=unwrap.__wrapped__\n continue\n if isinstance(unwrap,functools.partial):\n unwrap=unwrap.func\n continue\n break\n if hasattr(unwrap,\"__globals__\"):\n obj_globals=unwrap.__globals__\n \n if globals is None :\n globals=obj_globals\n if locals is None :\n locals=obj_locals\n \n return_value={key:\n value if not isinstance(value,str)else eval(value,globals,locals)\n for key,value in ann.items()}\n return return_value\n \n \n \ndef ismodule(object):\n ''\n\n\n\n\n \n return isinstance(object,types.ModuleType)\n \ndef isclass(object):\n ''\n\n\n\n \n return isinstance(object,type)\n \ndef ismethod(object):\n ''\n\n\n\n\n\n \n return isinstance(object,types.MethodType)\n \ndef ismethoddescriptor(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if isclass(object)or ismethod(object)or isfunction(object):\n \n return False\n tp=type(object)\n return hasattr(tp,\"__get__\")and not hasattr(tp,\"__set__\")\n \ndef isdatadescriptor(object):\n ''\n\n\n\n\n\n \n if isclass(object)or ismethod(object)or isfunction(object):\n \n return False\n tp=type(object)\n return hasattr(tp,\"__set__\")or hasattr(tp,\"__delete__\")\n \nif hasattr(types,'MemberDescriptorType'):\n\n def ismemberdescriptor(object):\n ''\n\n\n \n return isinstance(object,types.MemberDescriptorType)\nelse :\n\n def ismemberdescriptor(object):\n ''\n\n\n \n return False\n \nif hasattr(types,'GetSetDescriptorType'):\n\n def isgetsetdescriptor(object):\n ''\n\n\n \n return isinstance(object,types.GetSetDescriptorType)\nelse :\n\n def isgetsetdescriptor(object):\n ''\n\n\n \n return False\n \ndef isfunction(object):\n ''\n\n\n\n\n\n\n\n\n \n return isinstance(object,types.FunctionType)\n \ndef _has_code_flag(f,flag):\n ''\n\n \n while ismethod(f):\n f=f.__func__\n f=functools._unwrap_partial(f)\n if not (isfunction(f)or _signature_is_functionlike(f)):\n return False\n return bool(f.__code__.co_flags&flag)\n \ndef isgeneratorfunction(obj):\n ''\n\n\n \n return _has_code_flag(obj,CO_GENERATOR)\n \ndef iscoroutinefunction(obj):\n ''\n\n\n \n return _has_code_flag(obj,CO_COROUTINE)\n \ndef isasyncgenfunction(obj):\n ''\n\n\n\n \n return _has_code_flag(obj,CO_ASYNC_GENERATOR)\n \ndef isasyncgen(object):\n ''\n return isinstance(object,types.AsyncGeneratorType)\n \ndef isgenerator(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n return isinstance(object,types.GeneratorType)\n \ndef iscoroutine(object):\n ''\n return isinstance(object,types.CoroutineType)\n \ndef isawaitable(object):\n ''\n return (isinstance(object,types.CoroutineType)or\n isinstance(object,types.GeneratorType)and\n bool(object.gi_code.co_flags&CO_ITERABLE_COROUTINE)or\n isinstance(object,collections.abc.Awaitable))\n \ndef istraceback(object):\n ''\n\n\n\n\n\n \n return isinstance(object,types.TracebackType)\n \ndef isframe(object):\n ''\n\n\n\n\n\n\n\n\n\n \n return isinstance(object,types.FrameType)\n \ndef iscode(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return isinstance(object,types.CodeType)\n \ndef isbuiltin(object):\n ''\n\n\n\n\n \n return isinstance(object,types.BuiltinFunctionType)\n \ndef ismethodwrapper(object):\n ''\n return isinstance(object,types.MethodWrapperType)\n \ndef isroutine(object):\n ''\n return (isbuiltin(object)\n or isfunction(object)\n or ismethod(object)\n or ismethoddescriptor(object)\n or ismethodwrapper(object))\n \ndef isabstract(object):\n ''\n if not isinstance(object,type):\n return False\n if object.__flags__&TPFLAGS_IS_ABSTRACT:\n return True\n if not issubclass(type(object),abc.ABCMeta):\n return False\n if hasattr(object,'__abstractmethods__'):\n \n \n return False\n \n \n for name,value in object.__dict__.items():\n if getattr(value,\"__isabstractmethod__\",False ):\n return True\n for base in object.__bases__:\n for name in getattr(base,\"__abstractmethods__\",()):\n value=getattr(object,name,None )\n if getattr(value,\"__isabstractmethod__\",False ):\n return True\n return False\n \ndef _getmembers(object,predicate,getter):\n results=[]\n processed=set()\n names=dir(object)\n if isclass(object):\n mro=(object,)+getmro(object)\n \n \n \n try :\n for base in object.__bases__:\n for k,v in base.__dict__.items():\n if isinstance(v,types.DynamicClassAttribute):\n names.append(k)\n except AttributeError:\n pass\n else :\n mro=()\n for key in names:\n \n \n \n try :\n value=getter(object,key)\n \n if key in processed:\n raise AttributeError\n except AttributeError:\n for base in mro:\n if key in base.__dict__:\n value=base.__dict__[key]\n break\n else :\n \n \n continue\n if not predicate or predicate(value):\n results.append((key,value))\n processed.add(key)\n results.sort(key=lambda pair:pair[0])\n return results\n \ndef getmembers(object,predicate=None ):\n ''\n \n return _getmembers(object,predicate,getattr)\n \ndef getmembers_static(object,predicate=None ):\n ''\n\n\n\n\n\n\n\n\n\n \n return _getmembers(object,predicate,getattr_static)\n \nAttribute=namedtuple('Attribute','name kind defining_class object')\n\ndef classify_class_attrs(cls):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n mro=getmro(cls)\n metamro=getmro(type(cls))\n metamro=tuple(cls for cls in metamro if cls not in (type,object))\n class_bases=(cls,)+mro\n all_bases=class_bases+metamro\n names=dir(cls)\n \n \n \n for base in mro:\n for k,v in base.__dict__.items():\n if isinstance(v,types.DynamicClassAttribute)and v.fget is not None :\n names.append(k)\n result=[]\n processed=set()\n \n for name in names:\n \n \n \n \n \n \n \n \n \n homecls=None\n get_obj=None\n dict_obj=None\n if name not in processed:\n try :\n if name =='__dict__':\n raise Exception(\"__dict__ is special, don't want the proxy\")\n get_obj=getattr(cls,name)\n except Exception as exc:\n pass\n else :\n homecls=getattr(get_obj,\"__objclass__\",homecls)\n if homecls not in class_bases:\n \n \n homecls=None\n last_cls=None\n \n for srch_cls in class_bases:\n srch_obj=getattr(srch_cls,name,None )\n if srch_obj is get_obj:\n last_cls=srch_cls\n \n for srch_cls in metamro:\n try :\n srch_obj=srch_cls.__getattr__(cls,name)\n except AttributeError:\n continue\n if srch_obj is get_obj:\n last_cls=srch_cls\n if last_cls is not None :\n homecls=last_cls\n for base in all_bases:\n if name in base.__dict__:\n dict_obj=base.__dict__[name]\n if homecls not in metamro:\n homecls=base\n break\n if homecls is None :\n \n \n continue\n obj=get_obj if get_obj is not None else dict_obj\n \n if isinstance(dict_obj,(staticmethod,types.BuiltinMethodType)):\n kind=\"static method\"\n obj=dict_obj\n elif isinstance(dict_obj,(classmethod,types.ClassMethodDescriptorType)):\n kind=\"class method\"\n obj=dict_obj\n elif isinstance(dict_obj,property):\n kind=\"property\"\n obj=dict_obj\n elif isroutine(obj):\n kind=\"method\"\n else :\n kind=\"data\"\n result.append(Attribute(name,kind,homecls,obj))\n processed.add(name)\n return result\n \n \n \ndef getmro(cls):\n ''\n return cls.__mro__\n \n \n \ndef unwrap(func,*,stop=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if stop is None :\n def _is_wrapper(f):\n return hasattr(f,'__wrapped__')\n else :\n def _is_wrapper(f):\n return hasattr(f,'__wrapped__')and not stop(f)\n f=func\n \n \n memo={id(f):f}\n recursion_limit=sys.getrecursionlimit()\n while _is_wrapper(func):\n func=func.__wrapped__\n id_func=id(func)\n if (id_func in memo)or (len(memo)>=recursion_limit):\n raise ValueError('wrapper loop when unwrapping {!r}'.format(f))\n memo[id_func]=func\n return func\n \n \ndef indentsize(line):\n ''\n expline=line.expandtabs()\n return len(expline)-len(expline.lstrip())\n \ndef _findclass(func):\n cls=sys.modules.get(func.__module__)\n if cls is None :\n return None\n for name in func.__qualname__.split('.')[:-1]:\n cls=getattr(cls,name)\n if not isclass(cls):\n return None\n return cls\n \ndef _finddoc(obj):\n if isclass(obj):\n for base in obj.__mro__:\n if base is not object:\n try :\n doc=base.__doc__\n except AttributeError:\n continue\n if doc is not None :\n return doc\n return None\n \n if ismethod(obj):\n name=obj.__func__.__name__\n self=obj.__self__\n if (isclass(self)and\n getattr(getattr(self,name,None ),'__func__')is obj.__func__):\n \n cls=self\n else :\n cls=self.__class__\n elif isfunction(obj):\n name=obj.__name__\n cls=_findclass(obj)\n if cls is None or getattr(cls,name)is not obj:\n return None\n elif isbuiltin(obj):\n name=obj.__name__\n self=obj.__self__\n if (isclass(self)and\n self.__qualname__+'.'+name ==obj.__qualname__):\n \n cls=self\n else :\n cls=self.__class__\n \n elif isinstance(obj,property):\n func=obj.fget\n name=func.__name__\n cls=_findclass(func)\n if cls is None or getattr(cls,name)is not obj:\n return None\n elif ismethoddescriptor(obj)or isdatadescriptor(obj):\n name=obj.__name__\n cls=obj.__objclass__\n if getattr(cls,name)is not obj:\n return None\n if ismemberdescriptor(obj):\n slots=getattr(cls,'__slots__',None )\n if isinstance(slots,dict)and name in slots:\n return slots[name]\n else :\n return None\n for base in cls.__mro__:\n try :\n doc=getattr(base,name).__doc__\n except AttributeError:\n continue\n if doc is not None :\n return doc\n return None\n \ndef getdoc(object):\n ''\n\n\n\n \n try :\n doc=object.__doc__\n except AttributeError:\n return None\n if doc is None :\n try :\n doc=_finddoc(object)\n except (AttributeError,TypeError):\n return None\n if not isinstance(doc,str):\n return None\n return cleandoc(doc)\n \ndef cleandoc(doc):\n ''\n\n\n \n try :\n lines=doc.expandtabs().split('\\n')\n except UnicodeError:\n return None\n else :\n \n margin=sys.maxsize\n for line in lines[1:]:\n content=len(line.lstrip())\n if content:\n indent=len(line)-content\n margin=min(margin,indent)\n \n if lines:\n lines[0]=lines[0].lstrip()\n if margin ')\n self.generic_visit(node)\n self.stack.pop()\n self.stack.pop()\n \n visit_AsyncFunctionDef=visit_FunctionDef\n \n def visit_ClassDef(self,node):\n self.stack.append(node.name)\n if self.qualname =='.'.join(self.stack):\n \n if node.decorator_list:\n line_number=node.decorator_list[0].lineno\n else :\n line_number=node.lineno\n \n \n line_number -=1\n raise ClassFoundException(line_number)\n self.generic_visit(node)\n self.stack.pop()\n \n \ndef findsource(object):\n ''\n\n\n\n\n \n \n file=getsourcefile(object)\n if file:\n \n linecache.checkcache(file)\n else :\n file=getfile(object)\n \n \n \n if not (file.startswith('<')and file.endswith('>')):\n raise OSError('source code not available')\n \n module=getmodule(object,file)\n if module:\n lines=linecache.getlines(file,module.__dict__)\n else :\n lines=linecache.getlines(file)\n if not lines:\n raise OSError('could not get source code')\n \n if ismodule(object):\n return lines,0\n \n if isclass(object):\n qualname=object.__qualname__\n source=''.join(lines)\n tree=ast.parse(source)\n class_finder=_ClassFinder(qualname)\n try :\n class_finder.visit(tree)\n except ClassFoundException as e:\n line_number=e.args[0]\n return lines,line_number\n else :\n raise OSError('could not find class definition')\n \n if ismethod(object):\n object=object.__func__\n if isfunction(object):\n object=object.__code__\n if istraceback(object):\n object=object.tb_frame\n if isframe(object):\n object=object.f_code\n if iscode(object):\n if not hasattr(object,'co_firstlineno'):\n raise OSError('could not find function definition')\n lnum=object.co_firstlineno -1\n pat=re.compile(r'^(\\s*def\\s)|(\\s*async\\s+def\\s)|(.*(?0:\n try :\n line=lines[lnum]\n except IndexError:\n raise OSError('lineno is out of bounds')\n if pat.match(line):\n break\n lnum=lnum -1\n return lines,lnum\n raise OSError('could not find code object')\n \ndef getcomments(object):\n ''\n\n\n \n try :\n lines,lnum=findsource(object)\n except (OSError,TypeError):\n return None\n \n if ismodule(object):\n \n start=0\n if lines and lines[0][:2]=='#!':start=1\n while start 0:\n indent=indentsize(lines[lnum])\n end=lnum -1\n if end >=0 and lines[end].lstrip()[:1]=='#'and\\\n indentsize(lines[end])==indent:\n comments=[lines[end].expandtabs().lstrip()]\n if end >0:\n end=end -1\n comment=lines[end].expandtabs().lstrip()\n while comment[:1]=='#'and indentsize(lines[end])==indent:\n comments[:0]=[comment]\n end=end -1\n if end <0:break\n comment=lines[end].expandtabs().lstrip()\n while comments and comments[0].strip()=='#':\n comments[:1]=[]\n while comments and comments[-1].strip()=='#':\n comments[-1:]=[]\n return ''.join(comments)\n \nclass EndOfBlock(Exception):pass\n\nclass BlockFinder:\n ''\n def __init__(self):\n self.indent=0\n self.islambda=False\n self.started=False\n self.passline=False\n self.indecorator=False\n self.decoratorhasargs=False\n self.last=1\n self.body_col0=None\n \n def tokeneater(self,type,token,srowcol,erowcol,line):\n if not self.started and not self.indecorator:\n \n if token ==\"@\":\n self.indecorator=True\n \n elif token in (\"def\",\"class\",\"lambda\"):\n if token ==\"lambda\":\n self.islambda=True\n self.started=True\n self.passline=True\n elif token ==\"(\":\n if self.indecorator:\n self.decoratorhasargs=True\n elif token ==\")\":\n if self.indecorator:\n self.indecorator=False\n self.decoratorhasargs=False\n elif type ==tokenize.NEWLINE:\n self.passline=False\n self.last=srowcol[0]\n if self.islambda:\n raise EndOfBlock\n \n \n if self.indecorator and not self.decoratorhasargs:\n self.indecorator=False\n elif self.passline:\n pass\n elif type ==tokenize.INDENT:\n if self.body_col0 is None and self.started:\n self.body_col0=erowcol[1]\n self.indent=self.indent+1\n self.passline=True\n elif type ==tokenize.DEDENT:\n self.indent=self.indent -1\n \n \n \n if self.indent <=0:\n raise EndOfBlock\n elif type ==tokenize.COMMENT:\n if self.body_col0 is not None and srowcol[1]>=self.body_col0:\n \n self.last=srowcol[0]\n elif self.indent ==0 and type not in (tokenize.COMMENT,tokenize.NL):\n \n \n raise EndOfBlock\n \ndef getblock(lines):\n ''\n blockfinder=BlockFinder()\n try :\n tokens=tokenize.generate_tokens(iter(lines).__next__)\n for _token in tokens:\n blockfinder.tokeneater(*_token)\n except (EndOfBlock,IndentationError):\n pass\n return lines[:blockfinder.last]\n \ndef getsourcelines(object):\n ''\n\n\n\n\n\n \n object=unwrap(object)\n lines,lnum=findsource(object)\n \n if istraceback(object):\n object=object.tb_frame\n \n \n if (ismodule(object)or\n (isframe(object)and object.f_code.co_name ==\"\")):\n return lines,0\n else :\n return getblock(lines[lnum:]),lnum+1\n \ndef getsource(object):\n ''\n\n\n\n \n lines,lnum=getsourcelines(object)\n return ''.join(lines)\n \n \ndef walktree(classes,children,parent):\n ''\n results=[]\n classes.sort(key=attrgetter('__module__','__name__'))\n for c in classes:\n results.append((c,c.__bases__))\n if c in children:\n results.append(walktree(children[c],children,c))\n return results\n \ndef getclasstree(classes,unique=False ):\n ''\n\n\n\n\n\n\n \n children={}\n roots=[]\n for c in classes:\n if c.__bases__:\n for parent in c.__bases__:\n if parent not in children:\n children[parent]=[]\n if c not in children[parent]:\n children[parent].append(c)\n if unique and parent in classes:break\n elif c not in roots:\n roots.append(c)\n for parent in children:\n if parent not in classes:\n roots.append(parent)\n return walktree(roots,children,None )\n \n \nArguments=namedtuple('Arguments','args, varargs, varkw')\n\ndef getargs(co):\n ''\n\n\n\n\n \n if not iscode(co):\n raise TypeError('{!r} is not a code object'.format(co))\n \n names=co.co_varnames\n nargs=co.co_argcount\n nkwargs=co.co_kwonlyargcount\n args=list(names[:nargs])\n kwonlyargs=list(names[nargs:nargs+nkwargs])\n step=0\n \n nargs +=nkwargs\n varargs=None\n if co.co_flags&CO_VARARGS:\n varargs=co.co_varnames[nargs]\n nargs=nargs+1\n varkw=None\n if co.co_flags&CO_VARKEYWORDS:\n varkw=co.co_varnames[nargs]\n return Arguments(args+kwonlyargs,varargs,varkw)\n \n \nFullArgSpec=namedtuple('FullArgSpec',\n'args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations')\n\ndef getfullargspec(func):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n sig=_signature_from_callable(func,\n follow_wrapper_chains=False ,\n skip_bound_arg=False ,\n sigcls=Signature,\n eval_str=False )\n except Exception as ex:\n \n \n \n \n raise TypeError('unsupported callable')from ex\n \n args=[]\n varargs=None\n varkw=None\n posonlyargs=[]\n kwonlyargs=[]\n annotations={}\n defaults=()\n kwdefaults={}\n \n if sig.return_annotation is not sig.empty:\n annotations['return']=sig.return_annotation\n \n for param in sig.parameters.values():\n kind=param.kind\n name=param.name\n \n if kind is _POSITIONAL_ONLY:\n posonlyargs.append(name)\n if param.default is not param.empty:\n defaults +=(param.default,)\n elif kind is _POSITIONAL_OR_KEYWORD:\n args.append(name)\n if param.default is not param.empty:\n defaults +=(param.default,)\n elif kind is _VAR_POSITIONAL:\n varargs=name\n elif kind is _KEYWORD_ONLY:\n kwonlyargs.append(name)\n if param.default is not param.empty:\n kwdefaults[name]=param.default\n elif kind is _VAR_KEYWORD:\n varkw=name\n \n if param.annotation is not param.empty:\n annotations[name]=param.annotation\n \n if not kwdefaults:\n \n kwdefaults=None\n \n if not defaults:\n \n defaults=None\n \n return FullArgSpec(posonlyargs+args,varargs,varkw,defaults,\n kwonlyargs,kwdefaults,annotations)\n \n \nArgInfo=namedtuple('ArgInfo','args varargs keywords locals')\n\ndef getargvalues(frame):\n ''\n\n\n\n\n \n args,varargs,varkw=getargs(frame.f_code)\n return ArgInfo(args,varargs,varkw,frame.f_locals)\n \ndef formatannotation(annotation,base_module=None ):\n if getattr(annotation,'__module__',None )=='typing':\n return repr(annotation).replace('typing.','')\n if isinstance(annotation,types.GenericAlias):\n return str(annotation)\n if isinstance(annotation,type):\n if annotation.__module__ in ('builtins',base_module):\n return annotation.__qualname__\n return annotation.__module__+'.'+annotation.__qualname__\n return repr(annotation)\n \ndef formatannotationrelativeto(object):\n module=getattr(object,'__module__',None )\n def _formatannotation(annotation):\n return formatannotation(annotation,module)\n return _formatannotation\n \n \ndef formatargvalues(args,varargs,varkw,locals,\nformatarg=str,\nformatvarargs=lambda name:'*'+name,\nformatvarkw=lambda name:'**'+name,\nformatvalue=lambda value:'='+repr(value)):\n ''\n\n\n\n\n \n def convert(name,locals=locals,\n formatarg=formatarg,formatvalue=formatvalue):\n return formatarg(name)+formatvalue(locals[name])\n specs=[]\n for i in range(len(args)):\n specs.append(convert(args[i]))\n if varargs:\n specs.append(formatvarargs(varargs)+formatvalue(locals[varargs]))\n if varkw:\n specs.append(formatvarkw(varkw)+formatvalue(locals[varkw]))\n return '('+', '.join(specs)+')'\n \ndef _missing_arguments(f_name,argnames,pos,values):\n names=[repr(name)for name in argnames if name not in values]\n missing=len(names)\n if missing ==1:\n s=names[0]\n elif missing ==2:\n s=\"{} and {}\".format(*names)\n else :\n tail=\", {} and {}\".format(*names[-2:])\n del names[-2:]\n s=\", \".join(names)+tail\n raise TypeError(\"%s() missing %i required %s argument%s: %s\"%\n (f_name,missing,\n \"positional\"if pos else \"keyword-only\",\n \"\"if missing ==1 else \"s\",s))\n \ndef _too_many(f_name,args,kwonly,varargs,defcount,given,values):\n atleast=len(args)-defcount\n kwonly_given=len([arg for arg in kwonly if arg in values])\n if varargs:\n plural=atleast !=1\n sig=\"at least %d\"%(atleast,)\n elif defcount:\n plural=True\n sig=\"from %d to %d\"%(atleast,len(args))\n else :\n plural=len(args)!=1\n sig=str(len(args))\n kwonly_sig=\"\"\n if kwonly_given:\n msg=\" positional argument%s (and %d keyword-only argument%s)\"\n kwonly_sig=(msg %(\"s\"if given !=1 else \"\",kwonly_given,\n \"s\"if kwonly_given !=1 else \"\"))\n raise TypeError(\"%s() takes %s positional argument%s but %d%s %s given\"%\n (f_name,sig,\"s\"if plural else \"\",given,kwonly_sig,\n \"was\"if given ==1 and not kwonly_given else \"were\"))\n \ndef getcallargs(func,/,*positional,**named):\n ''\n\n\n\n \n spec=getfullargspec(func)\n args,varargs,varkw,defaults,kwonlyargs,kwonlydefaults,ann=spec\n f_name=func.__name__\n arg2value={}\n \n \n if ismethod(func)and func.__self__ is not None :\n \n positional=(func.__self__,)+positional\n num_pos=len(positional)\n num_args=len(args)\n num_defaults=len(defaults)if defaults else 0\n \n n=min(num_pos,num_args)\n for i in range(n):\n arg2value[args[i]]=positional[i]\n if varargs:\n arg2value[varargs]=tuple(positional[n:])\n possible_kwargs=set(args+kwonlyargs)\n if varkw:\n arg2value[varkw]={}\n for kw,value in named.items():\n if kw not in possible_kwargs:\n if not varkw:\n raise TypeError(\"%s() got an unexpected keyword argument %r\"%\n (f_name,kw))\n arg2value[varkw][kw]=value\n continue\n if kw in arg2value:\n raise TypeError(\"%s() got multiple values for argument %r\"%\n (f_name,kw))\n arg2value[kw]=value\n if num_pos >num_args and not varargs:\n _too_many(f_name,args,kwonlyargs,varargs,num_defaults,\n num_pos,arg2value)\n if num_pos 0:\n start=lineno -1 -context //2\n try :\n lines,lnum=findsource(frame)\n except OSError:\n lines=index=None\n else :\n start=max(0,min(start,len(lines)-context))\n lines=lines[start:start+context]\n index=lineno -1 -start\n else :\n lines=index=None\n \n return Traceback(filename,lineno,frame.f_code.co_name,lines,\n index,positions=dis.Positions(*positions))\n \ndef getlineno(frame):\n ''\n \n return frame.f_lineno\n \n_FrameInfo=namedtuple('_FrameInfo',('frame',)+Traceback._fields)\nclass FrameInfo(_FrameInfo):\n def __new__(cls,frame,filename,lineno,function,code_context,index,*,positions=None ):\n instance=super().__new__(cls,frame,filename,lineno,function,code_context,index)\n instance.positions=positions\n return instance\n \n def __repr__(self):\n return ('FrameInfo(frame={!r}, filename={!r}, lineno={!r}, function={!r}, '\n 'code_context={!r}, index={!r}, positions={!r})'.format(\n self.frame,self.filename,self.lineno,self.function,\n self.code_context,self.index,self.positions))\n \ndef getouterframes(frame,context=1):\n ''\n\n\n \n framelist=[]\n while frame:\n traceback_info=getframeinfo(frame,context)\n frameinfo=(frame,)+traceback_info\n framelist.append(FrameInfo(*frameinfo,positions=traceback_info.positions))\n frame=frame.f_back\n return framelist\n \ndef getinnerframes(tb,context=1):\n ''\n\n\n \n framelist=[]\n while tb:\n traceback_info=getframeinfo(tb,context)\n frameinfo=(tb.tb_frame,)+traceback_info\n framelist.append(FrameInfo(*frameinfo,positions=traceback_info.positions))\n tb=tb.tb_next\n return framelist\n \ndef currentframe():\n ''\n return sys._getframe(1)if hasattr(sys,\"_getframe\")else None\n \ndef stack(context=1):\n ''\n return getouterframes(sys._getframe(1),context)\n \ndef trace(context=1):\n ''\n return getinnerframes(sys.exc_info()[2],context)\n \n \n \n \n_sentinel=object()\n\ndef _static_getmro(klass):\n return type.__dict__['__mro__'].__get__(klass)\n \ndef _check_instance(obj,attr):\n instance_dict={}\n try :\n instance_dict=object.__getattribute__(obj,\"__dict__\")\n except AttributeError:\n pass\n return dict.get(instance_dict,attr,_sentinel)\n \n \ndef _check_class(klass,attr):\n for entry in _static_getmro(klass):\n if _shadowed_dict(type(entry))is _sentinel:\n try :\n return entry.__dict__[attr]\n except KeyError:\n pass\n return _sentinel\n \ndef _is_type(obj):\n try :\n _static_getmro(obj)\n except TypeError:\n return False\n return True\n \ndef _shadowed_dict(klass):\n dict_attr=type.__dict__[\"__dict__\"]\n for entry in _static_getmro(klass):\n try :\n class_dict=dict_attr.__get__(entry)[\"__dict__\"]\n except KeyError:\n pass\n else :\n if not (type(class_dict)is types.GetSetDescriptorType and\n class_dict.__name__ ==\"__dict__\"and\n class_dict.__objclass__ is entry):\n return class_dict\n return _sentinel\n \ndef getattr_static(obj,attr,default=_sentinel):\n ''\n\n\n\n\n\n\n\n\n \n instance_result=_sentinel\n if not _is_type(obj):\n klass=type(obj)\n dict_attr=_shadowed_dict(klass)\n if (dict_attr is _sentinel or\n type(dict_attr)is types.MemberDescriptorType):\n instance_result=_check_instance(obj,attr)\n else :\n klass=obj\n \n klass_result=_check_class(klass,attr)\n \n if instance_result is not _sentinel and klass_result is not _sentinel:\n if (_check_class(type(klass_result),'__get__')is not _sentinel and\n _check_class(type(klass_result),'__set__')is not _sentinel):\n return klass_result\n \n if instance_result is not _sentinel:\n return instance_result\n if klass_result is not _sentinel:\n return klass_result\n \n if obj is klass:\n \n for entry in _static_getmro(type(klass)):\n if _shadowed_dict(type(entry))is _sentinel:\n try :\n return entry.__dict__[attr]\n except KeyError:\n pass\n if default is not _sentinel:\n return default\n raise AttributeError(attr)\n \n \n \n \nGEN_CREATED='GEN_CREATED'\nGEN_RUNNING='GEN_RUNNING'\nGEN_SUSPENDED='GEN_SUSPENDED'\nGEN_CLOSED='GEN_CLOSED'\n\ndef getgeneratorstate(generator):\n ''\n\n\n\n\n\n\n \n if generator.gi_running:\n return GEN_RUNNING\n if generator.gi_suspended:\n return GEN_SUSPENDED\n if generator.gi_frame is None :\n return GEN_CLOSED\n return GEN_CREATED\n \n \ndef getgeneratorlocals(generator):\n ''\n\n\n\n \n \n if not isgenerator(generator):\n raise TypeError(\"{!r} is not a Python generator\".format(generator))\n \n frame=getattr(generator,\"gi_frame\",None )\n if frame is not None :\n return generator.gi_frame.f_locals\n else :\n return {}\n \n \n \n \nCORO_CREATED='CORO_CREATED'\nCORO_RUNNING='CORO_RUNNING'\nCORO_SUSPENDED='CORO_SUSPENDED'\nCORO_CLOSED='CORO_CLOSED'\n\ndef getcoroutinestate(coroutine):\n ''\n\n\n\n\n\n\n \n if coroutine.cr_running:\n return CORO_RUNNING\n if coroutine.cr_suspended:\n return CORO_SUSPENDED\n if coroutine.cr_frame is None :\n return CORO_CLOSED\n return CORO_CREATED\n \n \ndef getcoroutinelocals(coroutine):\n ''\n\n\n\n \n frame=getattr(coroutine,\"cr_frame\",None )\n if frame is not None :\n return frame.f_locals\n else :\n return {}\n \n \n \n \n \n \n \n_NonUserDefinedCallables=(types.WrapperDescriptorType,\ntypes.MethodWrapperType,\ntypes.ClassMethodDescriptorType,\ntypes.BuiltinFunctionType)\n\n\ndef _signature_get_user_defined_method(cls,method_name):\n ''\n\n\n \n try :\n meth=getattr(cls,method_name)\n except AttributeError:\n return\n else :\n if not isinstance(meth,_NonUserDefinedCallables):\n \n \n return meth\n \n \ndef _signature_get_partial(wrapped_sig,partial,extra_args=()):\n ''\n\n\n \n \n old_params=wrapped_sig.parameters\n new_params=OrderedDict(old_params.items())\n \n partial_args=partial.args or ()\n partial_keywords=partial.keywords or {}\n \n if extra_args:\n partial_args=extra_args+partial_args\n \n try :\n ba=wrapped_sig.bind_partial(*partial_args,**partial_keywords)\n except TypeError as ex:\n msg='partial object {!r} has incorrect arguments'.format(partial)\n raise ValueError(msg)from ex\n \n \n transform_to_kwonly=False\n for param_name,param in old_params.items():\n try :\n arg_value=ba.arguments[param_name]\n except KeyError:\n pass\n else :\n if param.kind is _POSITIONAL_ONLY:\n \n \n new_params.pop(param_name)\n continue\n \n if param.kind is _POSITIONAL_OR_KEYWORD:\n if param_name in partial_keywords:\n \n \n \n \n \n \n \n \n \n \n \n \n transform_to_kwonly=True\n \n new_params[param_name]=param.replace(default=arg_value)\n else :\n \n new_params.pop(param.name)\n continue\n \n if param.kind is _KEYWORD_ONLY:\n \n new_params[param_name]=param.replace(default=arg_value)\n \n if transform_to_kwonly:\n assert param.kind is not _POSITIONAL_ONLY\n \n if param.kind is _POSITIONAL_OR_KEYWORD:\n new_param=new_params[param_name].replace(kind=_KEYWORD_ONLY)\n new_params[param_name]=new_param\n new_params.move_to_end(param_name)\n elif param.kind in (_KEYWORD_ONLY,_VAR_KEYWORD):\n new_params.move_to_end(param_name)\n elif param.kind is _VAR_POSITIONAL:\n new_params.pop(param.name)\n \n return wrapped_sig.replace(parameters=new_params.values())\n \n \ndef _signature_bound_method(sig):\n ''\n\n \n \n params=tuple(sig.parameters.values())\n \n if not params or params[0].kind in (_VAR_KEYWORD,_KEYWORD_ONLY):\n raise ValueError('invalid method signature')\n \n kind=params[0].kind\n if kind in (_POSITIONAL_OR_KEYWORD,_POSITIONAL_ONLY):\n \n \n params=params[1:]\n else :\n if kind is not _VAR_POSITIONAL:\n \n \n raise ValueError('invalid argument type')\n \n \n \n return sig.replace(parameters=params)\n \n \ndef _signature_is_builtin(obj):\n ''\n\n \n return (isbuiltin(obj)or\n ismethoddescriptor(obj)or\n isinstance(obj,_NonUserDefinedCallables)or\n \n \n obj in (type,object))\n \n \ndef _signature_is_functionlike(obj):\n ''\n\n\n\n \n \n if not callable(obj)or isclass(obj):\n \n \n return False\n \n name=getattr(obj,'__name__',None )\n code=getattr(obj,'__code__',None )\n defaults=getattr(obj,'__defaults__',_void)\n kwdefaults=getattr(obj,'__kwdefaults__',_void)\n annotations=getattr(obj,'__annotations__',None )\n \n return (isinstance(code,types.CodeType)and\n isinstance(name,str)and\n (defaults is None or isinstance(defaults,tuple))and\n (kwdefaults is None or isinstance(kwdefaults,dict))and\n (isinstance(annotations,(dict))or annotations is None ))\n \n \ndef _signature_strip_non_python_syntax(signature):\n ''\n\n\n\n\n\n\n\n\n\n \n \n if not signature:\n return signature,None ,None\n \n self_parameter=None\n last_positional_only=None\n \n lines=[l.encode('ascii')for l in signature.split('\\n')]\n generator=iter(lines).__next__\n token_stream=tokenize.tokenize(generator)\n \n delayed_comma=False\n skip_next_comma=False\n text=[]\n add=text.append\n \n current_parameter=0\n OP=token.OP\n ERRORTOKEN=token.ERRORTOKEN\n \n \n t=next(token_stream)\n assert t.type ==tokenize.ENCODING\n \n for t in token_stream:\n type,string=t.type,t.string\n \n if type ==OP:\n if string ==',':\n if skip_next_comma:\n skip_next_comma=False\n else :\n assert not delayed_comma\n delayed_comma=True\n current_parameter +=1\n continue\n \n if string =='/':\n assert not skip_next_comma\n assert last_positional_only is None\n skip_next_comma=True\n last_positional_only=current_parameter -1\n continue\n \n if (type ==ERRORTOKEN)and (string =='$'):\n assert self_parameter is None\n self_parameter=current_parameter\n continue\n \n if delayed_comma:\n delayed_comma=False\n if not ((type ==OP)and (string ==')')):\n add(', ')\n add(string)\n if (string ==','):\n add(' ')\n clean_signature=''.join(text)\n return clean_signature,self_parameter,last_positional_only\n \n \ndef _signature_fromstr(cls,obj,s,skip_bound_arg=True ):\n ''\n\n \n Parameter=cls._parameter_cls\n \n clean_signature,self_parameter,last_positional_only=\\\n _signature_strip_non_python_syntax(s)\n \n program=\"def foo\"+clean_signature+\": pass\"\n \n try :\n module=ast.parse(program)\n except SyntaxError:\n module=None\n \n if not isinstance(module,ast.Module):\n raise ValueError(\"{!r} builtin has invalid signature\".format(obj))\n \n f=module.body[0]\n \n parameters=[]\n empty=Parameter.empty\n invalid=object()\n \n module=None\n module_dict={}\n module_name=getattr(obj,'__module__',None )\n if module_name:\n module=sys.modules.get(module_name,None )\n if module:\n module_dict=module.__dict__\n sys_module_dict=sys.modules.copy()\n \n def parse_name(node):\n assert isinstance(node,ast.arg)\n if node.annotation is not None :\n raise ValueError(\"Annotations are not currently supported\")\n return node.arg\n \n def wrap_value(s):\n try :\n value=eval(s,module_dict)\n except NameError:\n try :\n value=eval(s,sys_module_dict)\n except NameError:\n raise RuntimeError()\n \n if isinstance(value,(str,int,float,bytes,bool,type(None ))):\n return ast.Constant(value)\n raise RuntimeError()\n \n class RewriteSymbolics(ast.NodeTransformer):\n def visit_Attribute(self,node):\n a=[]\n n=node\n while isinstance(n,ast.Attribute):\n a.append(n.attr)\n n=n.value\n if not isinstance(n,ast.Name):\n raise RuntimeError()\n a.append(n.id)\n value=\".\".join(reversed(a))\n return wrap_value(value)\n \n def visit_Name(self,node):\n if not isinstance(node.ctx,ast.Load):\n raise ValueError()\n return wrap_value(node.id)\n \n def p(name_node,default_node,default=empty):\n name=parse_name(name_node)\n if name is invalid:\n return None\n if default_node and default_node is not _empty:\n try :\n default_node=RewriteSymbolics().visit(default_node)\n o=ast.literal_eval(default_node)\n except ValueError:\n o=invalid\n if o is invalid:\n return None\n default=o if o is not invalid else default\n parameters.append(Parameter(name,kind,default=default,annotation=empty))\n \n \n args=reversed(f.args.args)\n defaults=reversed(f.args.defaults)\n iter=itertools.zip_longest(args,defaults,fillvalue=None )\n if last_positional_only is not None :\n kind=Parameter.POSITIONAL_ONLY\n else :\n kind=Parameter.POSITIONAL_OR_KEYWORD\n for i,(name,default)in enumerate(reversed(list(iter))):\n p(name,default)\n if i ==last_positional_only:\n kind=Parameter.POSITIONAL_OR_KEYWORD\n \n \n if f.args.vararg:\n kind=Parameter.VAR_POSITIONAL\n p(f.args.vararg,empty)\n \n \n kind=Parameter.KEYWORD_ONLY\n for name,default in zip(f.args.kwonlyargs,f.args.kw_defaults):\n p(name,default)\n \n \n if f.args.kwarg:\n kind=Parameter.VAR_KEYWORD\n p(f.args.kwarg,empty)\n \n if self_parameter is not None :\n \n \n \n \n \n assert parameters\n _self=getattr(obj,'__self__',None )\n self_isbound=_self is not None\n self_ismodule=ismodule(_self)\n if self_isbound and (self_ismodule or skip_bound_arg):\n parameters.pop(0)\n else :\n \n p=parameters[0].replace(kind=Parameter.POSITIONAL_ONLY)\n parameters[0]=p\n \n return cls(parameters,return_annotation=cls.empty)\n \n \ndef _signature_from_builtin(cls,func,skip_bound_arg=True ):\n ''\n\n \n \n if not _signature_is_builtin(func):\n raise TypeError(\"{!r} is not a Python builtin \"\n \"function\".format(func))\n \n s=getattr(func,\"__text_signature__\",None )\n if not s:\n raise ValueError(\"no signature found for builtin {!r}\".format(func))\n \n return _signature_fromstr(cls,func,s,skip_bound_arg)\n \n \ndef _signature_from_function(cls,func,skip_bound_arg=True ,\nglobals=None ,locals=None ,eval_str=False ):\n ''\n \n is_duck_function=False\n if not isfunction(func):\n if _signature_is_functionlike(func):\n is_duck_function=True\n else :\n \n \n raise TypeError('{!r} is not a Python function'.format(func))\n \n s=getattr(func,\"__text_signature__\",None )\n if s:\n return _signature_fromstr(cls,func,s,skip_bound_arg)\n \n Parameter=cls._parameter_cls\n \n \n func_code=func.__code__\n pos_count=func_code.co_argcount\n arg_names=func_code.co_varnames\n posonly_count=func_code.co_posonlyargcount\n positional=arg_names[:pos_count]\n keyword_only_count=func_code.co_kwonlyargcount\n keyword_only=arg_names[pos_count:pos_count+keyword_only_count]\n annotations=get_annotations(func,globals=globals,locals=locals,eval_str=eval_str)\n defaults=func.__defaults__\n kwdefaults=func.__kwdefaults__\n \n if defaults:\n pos_default_count=len(defaults)\n else :\n pos_default_count=0\n \n parameters=[]\n \n non_default_count=pos_count -pos_default_count\n posonly_left=posonly_count\n \n \n for name in positional[:non_default_count]:\n kind=_POSITIONAL_ONLY if posonly_left else _POSITIONAL_OR_KEYWORD\n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=kind))\n if posonly_left:\n posonly_left -=1\n \n \n for offset,name in enumerate(positional[non_default_count:]):\n kind=_POSITIONAL_ONLY if posonly_left else _POSITIONAL_OR_KEYWORD\n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=kind,\n default=defaults[offset]))\n if posonly_left:\n posonly_left -=1\n \n \n if func_code.co_flags&CO_VARARGS:\n name=arg_names[pos_count+keyword_only_count]\n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=_VAR_POSITIONAL))\n \n \n for name in keyword_only:\n default=_empty\n if kwdefaults is not None :\n default=kwdefaults.get(name,_empty)\n \n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=_KEYWORD_ONLY,\n default=default))\n \n if func_code.co_flags&CO_VARKEYWORDS:\n index=pos_count+keyword_only_count\n if func_code.co_flags&CO_VARARGS:\n index +=1\n \n name=arg_names[index]\n annotation=annotations.get(name,_empty)\n parameters.append(Parameter(name,annotation=annotation,\n kind=_VAR_KEYWORD))\n \n \n \n return cls(parameters,\n return_annotation=annotations.get('return',_empty),\n __validate_parameters__=is_duck_function)\n \n \ndef _signature_from_callable(obj,*,\nfollow_wrapper_chains=True ,\nskip_bound_arg=True ,\nglobals=None ,\nlocals=None ,\neval_str=False ,\nsigcls):\n\n ''\n\n \n \n _get_signature_of=functools.partial(_signature_from_callable,\n follow_wrapper_chains=follow_wrapper_chains,\n skip_bound_arg=skip_bound_arg,\n globals=globals,\n locals=locals,\n sigcls=sigcls,\n eval_str=eval_str)\n \n if not callable(obj):\n raise TypeError('{!r} is not a callable object'.format(obj))\n \n if isinstance(obj,types.MethodType):\n \n \n sig=_get_signature_of(obj.__func__)\n \n if skip_bound_arg:\n return _signature_bound_method(sig)\n else :\n return sig\n \n \n if follow_wrapper_chains:\n obj=unwrap(obj,stop=(lambda f:hasattr(f,\"__signature__\")))\n if isinstance(obj,types.MethodType):\n \n \n \n return _get_signature_of(obj)\n \n try :\n sig=obj.__signature__\n except AttributeError:\n pass\n else :\n if sig is not None :\n if not isinstance(sig,Signature):\n raise TypeError(\n 'unexpected object {!r} in __signature__ '\n 'attribute'.format(sig))\n return sig\n \n try :\n partialmethod=obj._partialmethod\n except AttributeError:\n pass\n else :\n if isinstance(partialmethod,functools.partialmethod):\n \n \n \n \n \n \n \n wrapped_sig=_get_signature_of(partialmethod.func)\n \n sig=_signature_get_partial(wrapped_sig,partialmethod,(None ,))\n first_wrapped_param=tuple(wrapped_sig.parameters.values())[0]\n if first_wrapped_param.kind is Parameter.VAR_POSITIONAL:\n \n \n return sig\n else :\n sig_params=tuple(sig.parameters.values())\n assert (not sig_params or\n first_wrapped_param is not sig_params[0])\n new_params=(first_wrapped_param,)+sig_params\n return sig.replace(parameters=new_params)\n \n if isfunction(obj)or _signature_is_functionlike(obj):\n \n \n return _signature_from_function(sigcls,obj,\n skip_bound_arg=skip_bound_arg,\n globals=globals,locals=locals,eval_str=eval_str)\n \n if _signature_is_builtin(obj):\n return _signature_from_builtin(sigcls,obj,\n skip_bound_arg=skip_bound_arg)\n \n if isinstance(obj,functools.partial):\n wrapped_sig=_get_signature_of(obj.func)\n return _signature_get_partial(wrapped_sig,obj)\n \n sig=None\n if isinstance(obj,type):\n \n \n \n \n call=_signature_get_user_defined_method(type(obj),'__call__')\n if call is not None :\n sig=_get_signature_of(call)\n else :\n factory_method=None\n new=_signature_get_user_defined_method(obj,'__new__')\n init=_signature_get_user_defined_method(obj,'__init__')\n \n if '__new__'in obj.__dict__:\n factory_method=new\n \n elif '__init__'in obj.__dict__:\n factory_method=init\n \n elif new is not None :\n factory_method=new\n elif init is not None :\n factory_method=init\n \n if factory_method is not None :\n sig=_get_signature_of(factory_method)\n \n if sig is None :\n \n \n \n for base in obj.__mro__[:-1]:\n \n \n \n \n \n \n \n try :\n text_sig=base.__text_signature__\n except AttributeError:\n pass\n else :\n if text_sig:\n \n \n return _signature_fromstr(sigcls,base,text_sig)\n \n \n \n \n if type not in obj.__mro__:\n \n \n if (obj.__init__ is object.__init__ and\n obj.__new__ is object.__new__):\n \n return sigcls.from_callable(object)\n else :\n raise ValueError(\n 'no signature found for builtin type {!r}'.format(obj))\n \n elif not isinstance(obj,_NonUserDefinedCallables):\n \n \n \n \n call=_signature_get_user_defined_method(type(obj),'__call__')\n if call is not None :\n try :\n sig=_get_signature_of(call)\n except ValueError as ex:\n msg='no signature found for {!r}'.format(obj)\n raise ValueError(msg)from ex\n \n if sig is not None :\n \n \n if skip_bound_arg:\n return _signature_bound_method(sig)\n else :\n return sig\n \n if isinstance(obj,types.BuiltinFunctionType):\n \n msg='no signature found for builtin function {!r}'.format(obj)\n raise ValueError(msg)\n \n raise ValueError('callable {!r} is not supported by signature'.format(obj))\n \n \nclass _void:\n ''\n \n \nclass _empty:\n ''\n \n \nclass _ParameterKind(enum.IntEnum):\n POSITIONAL_ONLY='positional-only'\n POSITIONAL_OR_KEYWORD='positional or keyword'\n VAR_POSITIONAL='variadic positional'\n KEYWORD_ONLY='keyword-only'\n VAR_KEYWORD='variadic keyword'\n \n def __new__(cls,description):\n value=len(cls.__members__)\n member=int.__new__(cls,value)\n member._value_=value\n member.description=description\n return member\n \n def __str__(self):\n return self.name\n \n_POSITIONAL_ONLY=_ParameterKind.POSITIONAL_ONLY\n_POSITIONAL_OR_KEYWORD=_ParameterKind.POSITIONAL_OR_KEYWORD\n_VAR_POSITIONAL=_ParameterKind.VAR_POSITIONAL\n_KEYWORD_ONLY=_ParameterKind.KEYWORD_ONLY\n_VAR_KEYWORD=_ParameterKind.VAR_KEYWORD\n\n\nclass Parameter:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('_name','_kind','_default','_annotation')\n \n POSITIONAL_ONLY=_POSITIONAL_ONLY\n POSITIONAL_OR_KEYWORD=_POSITIONAL_OR_KEYWORD\n VAR_POSITIONAL=_VAR_POSITIONAL\n KEYWORD_ONLY=_KEYWORD_ONLY\n VAR_KEYWORD=_VAR_KEYWORD\n \n empty=_empty\n \n def __init__(self,name,kind,*,default=_empty,annotation=_empty):\n try :\n self._kind=_ParameterKind(kind)\n except ValueError:\n raise ValueError(f'value {kind!r} is not a valid Parameter.kind')\n if default is not _empty:\n if self._kind in (_VAR_POSITIONAL,_VAR_KEYWORD):\n msg='{} parameters cannot have default values'\n msg=msg.format(self._kind.description)\n raise ValueError(msg)\n self._default=default\n self._annotation=annotation\n \n if name is _empty:\n raise ValueError('name is a required attribute for Parameter')\n \n if not isinstance(name,str):\n msg='name must be a str, not a {}'.format(type(name).__name__)\n raise TypeError(msg)\n \n if name[0]=='.'and name[1:].isdigit():\n \n \n \n \n if self._kind !=_POSITIONAL_OR_KEYWORD:\n msg=(\n 'implicit arguments must be passed as '\n 'positional or keyword arguments, not {}'\n )\n msg=msg.format(self._kind.description)\n raise ValueError(msg)\n self._kind=_POSITIONAL_ONLY\n name='implicit{}'.format(name[1:])\n \n \n \n is_keyword=iskeyword(name)and self._kind is not _POSITIONAL_ONLY\n if is_keyword or not name.isidentifier():\n raise ValueError('{!r} is not a valid parameter name'.format(name))\n \n self._name=name\n \n def __reduce__(self):\n return (type(self),\n (self._name,self._kind),\n {'_default':self._default,\n '_annotation':self._annotation})\n \n def __setstate__(self,state):\n self._default=state['_default']\n self._annotation=state['_annotation']\n \n @property\n def name(self):\n return self._name\n \n @property\n def default(self):\n return self._default\n \n @property\n def annotation(self):\n return self._annotation\n \n @property\n def kind(self):\n return self._kind\n \n def replace(self,*,name=_void,kind=_void,\n annotation=_void,default=_void):\n ''\n \n if name is _void:\n name=self._name\n \n if kind is _void:\n kind=self._kind\n \n if annotation is _void:\n annotation=self._annotation\n \n if default is _void:\n default=self._default\n \n return type(self)(name,kind,default=default,annotation=annotation)\n \n def __str__(self):\n kind=self.kind\n formatted=self._name\n \n \n if self._annotation is not _empty:\n formatted='{}: {}'.format(formatted,\n formatannotation(self._annotation))\n \n if self._default is not _empty:\n if self._annotation is not _empty:\n formatted='{} = {}'.format(formatted,repr(self._default))\n else :\n formatted='{}={}'.format(formatted,repr(self._default))\n \n if kind ==_VAR_POSITIONAL:\n formatted='*'+formatted\n elif kind ==_VAR_KEYWORD:\n formatted='**'+formatted\n \n return formatted\n \n def __repr__(self):\n return '<{} \"{}\">'.format(self.__class__.__name__,self)\n \n def __hash__(self):\n return hash((self.name,self.kind,self.annotation,self.default))\n \n def __eq__(self,other):\n if self is other:\n return True\n if not isinstance(other,Parameter):\n return NotImplemented\n return (self._name ==other._name and\n self._kind ==other._kind and\n self._default ==other._default and\n self._annotation ==other._annotation)\n \n \nclass BoundArguments:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('arguments','_signature','__weakref__')\n \n def __init__(self,signature,arguments):\n self.arguments=arguments\n self._signature=signature\n \n @property\n def signature(self):\n return self._signature\n \n @property\n def args(self):\n args=[]\n for param_name,param in self._signature.parameters.items():\n if param.kind in (_VAR_KEYWORD,_KEYWORD_ONLY):\n break\n \n try :\n arg=self.arguments[param_name]\n except KeyError:\n \n \n break\n else :\n if param.kind ==_VAR_POSITIONAL:\n \n args.extend(arg)\n else :\n \n args.append(arg)\n \n return tuple(args)\n \n @property\n def kwargs(self):\n kwargs={}\n kwargs_started=False\n for param_name,param in self._signature.parameters.items():\n if not kwargs_started:\n if param.kind in (_VAR_KEYWORD,_KEYWORD_ONLY):\n kwargs_started=True\n else :\n if param_name not in self.arguments:\n kwargs_started=True\n continue\n \n if not kwargs_started:\n continue\n \n try :\n arg=self.arguments[param_name]\n except KeyError:\n pass\n else :\n if param.kind ==_VAR_KEYWORD:\n \n kwargs.update(arg)\n else :\n \n kwargs[param_name]=arg\n \n return kwargs\n \n def apply_defaults(self):\n ''\n\n\n\n\n\n\n \n arguments=self.arguments\n new_arguments=[]\n for name,param in self._signature.parameters.items():\n try :\n new_arguments.append((name,arguments[name]))\n except KeyError:\n if param.default is not _empty:\n val=param.default\n elif param.kind is _VAR_POSITIONAL:\n val=()\n elif param.kind is _VAR_KEYWORD:\n val={}\n else :\n \n \n continue\n new_arguments.append((name,val))\n self.arguments=dict(new_arguments)\n \n def __eq__(self,other):\n if self is other:\n return True\n if not isinstance(other,BoundArguments):\n return NotImplemented\n return (self.signature ==other.signature and\n self.arguments ==other.arguments)\n \n def __setstate__(self,state):\n self._signature=state['_signature']\n self.arguments=state['arguments']\n \n def __getstate__(self):\n return {'_signature':self._signature,'arguments':self.arguments}\n \n def __repr__(self):\n args=[]\n for arg,value in self.arguments.items():\n args.append('{}={!r}'.format(arg,value))\n return '<{} ({})>'.format(self.__class__.__name__,', '.join(args))\n \n \nclass Signature:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('_return_annotation','_parameters')\n \n _parameter_cls=Parameter\n _bound_arguments_cls=BoundArguments\n \n empty=_empty\n \n def __init__(self,parameters=None ,*,return_annotation=_empty,\n __validate_parameters__=True ):\n ''\n\n \n \n if parameters is None :\n params=OrderedDict()\n else :\n if __validate_parameters__:\n params=OrderedDict()\n top_kind=_POSITIONAL_ONLY\n kind_defaults=False\n \n for param in parameters:\n kind=param.kind\n name=param.name\n \n if kind top_kind:\n kind_defaults=False\n top_kind=kind\n \n if kind in (_POSITIONAL_ONLY,_POSITIONAL_OR_KEYWORD):\n if param.default is _empty:\n if kind_defaults:\n \n \n \n msg='non-default argument follows default '\\\n 'argument'\n raise ValueError(msg)\n else :\n \n kind_defaults=True\n \n if name in params:\n msg='duplicate parameter name: {!r}'.format(name)\n raise ValueError(msg)\n \n params[name]=param\n else :\n params=OrderedDict((param.name,param)for param in parameters)\n \n self._parameters=types.MappingProxyType(params)\n self._return_annotation=return_annotation\n \n @classmethod\n def from_callable(cls,obj,*,\n follow_wrapped=True ,globals=None ,locals=None ,eval_str=False ):\n ''\n return _signature_from_callable(obj,sigcls=cls,\n follow_wrapper_chains=follow_wrapped,\n globals=globals,locals=locals,eval_str=eval_str)\n \n @property\n def parameters(self):\n return self._parameters\n \n @property\n def return_annotation(self):\n return self._return_annotation\n \n def replace(self,*,parameters=_void,return_annotation=_void):\n ''\n\n\n \n \n if parameters is _void:\n parameters=self.parameters.values()\n \n if return_annotation is _void:\n return_annotation=self._return_annotation\n \n return type(self)(parameters,\n return_annotation=return_annotation)\n \n def _hash_basis(self):\n params=tuple(param for param in self.parameters.values()\n if param.kind !=_KEYWORD_ONLY)\n \n kwo_params={param.name:param for param in self.parameters.values()\n if param.kind ==_KEYWORD_ONLY}\n \n return params,kwo_params,self.return_annotation\n \n def __hash__(self):\n params,kwo_params,return_annotation=self._hash_basis()\n kwo_params=frozenset(kwo_params.values())\n return hash((params,kwo_params,return_annotation))\n \n def __eq__(self,other):\n if self is other:\n return True\n if not isinstance(other,Signature):\n return NotImplemented\n return self._hash_basis()==other._hash_basis()\n \n def _bind(self,args,kwargs,*,partial=False ):\n ''\n \n arguments={}\n \n parameters=iter(self.parameters.values())\n parameters_ex=()\n arg_vals=iter(args)\n \n while True :\n \n \n try :\n arg_val=next(arg_vals)\n except StopIteration:\n \n try :\n param=next(parameters)\n except StopIteration:\n \n \n break\n else :\n if param.kind ==_VAR_POSITIONAL:\n \n \n break\n elif param.name in kwargs:\n if param.kind ==_POSITIONAL_ONLY:\n msg='{arg!r} parameter is positional only, '\\\n 'but was passed as a keyword'\n msg=msg.format(arg=param.name)\n raise TypeError(msg)from None\n parameters_ex=(param,)\n break\n elif (param.kind ==_VAR_KEYWORD or\n param.default is not _empty):\n \n \n \n parameters_ex=(param,)\n break\n else :\n \n \n if partial:\n parameters_ex=(param,)\n break\n else :\n msg='missing a required argument: {arg!r}'\n msg=msg.format(arg=param.name)\n raise TypeError(msg)from None\n else :\n \n try :\n param=next(parameters)\n except StopIteration:\n raise TypeError('too many positional arguments')from None\n else :\n if param.kind in (_VAR_KEYWORD,_KEYWORD_ONLY):\n \n \n raise TypeError(\n 'too many positional arguments')from None\n \n if param.kind ==_VAR_POSITIONAL:\n \n \n \n values=[arg_val]\n values.extend(arg_vals)\n arguments[param.name]=tuple(values)\n break\n \n if param.name in kwargs and param.kind !=_POSITIONAL_ONLY:\n raise TypeError(\n 'multiple values for argument {arg!r}'.format(\n arg=param.name))from None\n \n arguments[param.name]=arg_val\n \n \n \n kwargs_param=None\n for param in itertools.chain(parameters_ex,parameters):\n if param.kind ==_VAR_KEYWORD:\n \n kwargs_param=param\n continue\n \n if param.kind ==_VAR_POSITIONAL:\n \n \n \n continue\n \n param_name=param.name\n try :\n arg_val=kwargs.pop(param_name)\n except KeyError:\n \n \n \n \n if (not partial and param.kind !=_VAR_POSITIONAL and\n param.default is _empty):\n raise TypeError('missing a required argument: {arg!r}'.\\\n format(arg=param_name))from None\n \n else :\n if param.kind ==_POSITIONAL_ONLY:\n \n \n \n raise TypeError('{arg!r} parameter is positional only, '\n 'but was passed as a keyword'.\\\n format(arg=param.name))\n \n arguments[param_name]=arg_val\n \n if kwargs:\n if kwargs_param is not None :\n \n arguments[kwargs_param.name]=kwargs\n else :\n raise TypeError(\n 'got an unexpected keyword argument {arg!r}'.format(\n arg=next(iter(kwargs))))\n \n return self._bound_arguments_cls(self,arguments)\n \n def bind(self,/,*args,**kwargs):\n ''\n\n\n \n return self._bind(args,kwargs)\n \n def bind_partial(self,/,*args,**kwargs):\n ''\n\n\n \n return self._bind(args,kwargs,partial=True )\n \n def __reduce__(self):\n return (type(self),\n (tuple(self._parameters.values()),),\n {'_return_annotation':self._return_annotation})\n \n def __setstate__(self,state):\n self._return_annotation=state['_return_annotation']\n \n def __repr__(self):\n return '<{} {}>'.format(self.__class__.__name__,self)\n \n def __str__(self):\n result=[]\n render_pos_only_separator=False\n render_kw_only_separator=True\n for param in self.parameters.values():\n formatted=str(param)\n \n kind=param.kind\n \n if kind ==_POSITIONAL_ONLY:\n render_pos_only_separator=True\n elif render_pos_only_separator:\n \n \n result.append('/')\n render_pos_only_separator=False\n \n if kind ==_VAR_POSITIONAL:\n \n \n render_kw_only_separator=False\n elif kind ==_KEYWORD_ONLY and render_kw_only_separator:\n \n \n \n result.append('*')\n \n \n render_kw_only_separator=False\n \n result.append(formatted)\n \n if render_pos_only_separator:\n \n \n result.append('/')\n \n rendered='({})'.format(', '.join(result))\n \n if self.return_annotation is not _empty:\n anno=formatannotation(self.return_annotation)\n rendered +=' -> {}'.format(anno)\n \n return rendered\n \n \ndef signature(obj,*,follow_wrapped=True ,globals=None ,locals=None ,eval_str=False ):\n ''\n return Signature.from_callable(obj,follow_wrapped=follow_wrapped,\n globals=globals,locals=locals,eval_str=eval_str)\n \n \ndef _main():\n ''\n import argparse\n import importlib\n \n parser=argparse.ArgumentParser()\n parser.add_argument(\n 'object',\n help=\"The object to be analysed. \"\n \"It supports the 'module:qualname' syntax\")\n parser.add_argument(\n '-d','--details',action='store_true',\n help='Display info about the module rather than its source code')\n \n args=parser.parse_args()\n \n target=args.object\n mod_name,has_attrs,attrs=target.partition(\":\")\n try :\n obj=module=importlib.import_module(mod_name)\n except Exception as exc:\n msg=\"Failed to import {} ({}: {})\".format(mod_name,\n type(exc).__name__,\n exc)\n print(msg,file=sys.stderr)\n sys.exit(2)\n \n if has_attrs:\n parts=attrs.split(\".\")\n obj=module\n for part in parts:\n obj=getattr(obj,part)\n \n if module.__name__ in sys.builtin_module_names:\n print(\"Can't get info for builtin modules.\",file=sys.stderr)\n sys.exit(1)\n \n if args.details:\n print('Target: {}'.format(target))\n print('Origin: {}'.format(getsourcefile(module)))\n print('Cached: {}'.format(module.__cached__))\n if obj is module:\n print('Loader: {}'.format(repr(module.__loader__)))\n if hasattr(module,'__path__'):\n print('Submodule search path: {}'.format(module.__path__))\n else :\n try :\n __,lineno=findsource(obj)\n except Exception:\n pass\n else :\n print('Line: {}'.format(lineno))\n \n print('\\n')\n else :\n print(getsource(obj))\n \n \nif __name__ ==\"__main__\":\n _main()\n", ["abc", "argparse", "ast", "builtins", "collections", "collections.abc", "dis", "enum", "functools", "importlib", "importlib.machinery", "itertools", "keyword", "linecache", "operator", "os", "re", "sys", "token", "tokenize", "types"]], "interpreter": [".py", "import sys\nimport builtins\nimport re\n\nimport tb as traceback\n\nfrom browser import console,document,window,html,DOMNode\nfrom browser.widgets.dialog import Dialog\n\n_credits=\"\"\" Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands\n for supporting Python development. See www.python.org for more information.\"\"\"\n\n_copyright=\"\"\"Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com\nAll Rights Reserved.\n\nCopyright (c) 2001-2022 Python Software Foundation.\nAll Rights Reserved.\n\nCopyright (c) 2000 BeOpen.com.\nAll Rights Reserved.\n\nCopyright (c) 1995-2001 Corporation for National Research Initiatives.\nAll Rights Reserved.\n\nCopyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\nAll Rights Reserved.\"\"\"\n\n_help=\"Type help() for interactive help, or help(object) for help about object.\"\n\n_license=\"\"\"Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer. Redistributions in binary\nform must reproduce the above copyright notice, this list of conditions and\nthe following disclaimer in the documentation and/or other materials provided\nwith the distribution.\nNeither the name of the nor the names of its contributors may\nbe used to endorse or promote products derived from this software without\nspecific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\"\"\"\n\nclass Info:\n\n def __init__(self,msg):\n self.msg=msg\n \n def __repr__(self):\n return self.msg\n \n \n \neditor_ns={\n'credits':Info(_credits),\n'copyright':Info(_copyright),\n'license':Info(_license),\n'__annotations__':{},\n'__builtins__':builtins,\n'__doc__':None,\n'__file__':'',\n'__name__':'__main__'\n}\n\n\nstyle_sheet=\"\"\"\n.brython-interpreter {\n background-color: #000;\n color: #fff;\n font-family: consolas, courier;\n caret-color: #fff;\n overflow-y: auto;\n overflow-x: hidden;\n}\n\n@keyframes blinker {\n 50% {\n opacity: 0;\n }\n}\n\npre{\n display:inline;\n}\n\"\"\"\n\nactive=[]\n\nclass Output:\n\n def __init__(self,interpreter):\n self.interpreter=interpreter\n \n def write(self,*args,**kw):\n self.interpreter.write(*args,**kw)\n \n def __len__(self):\n return len(self.interpreter.buffer)\n \n \n \n \ncolor_character_pattern=re.compile(r'^\\033\\[([0-9;]*)m')\n\ndef swap_color_bgcolor(element):\n ''\n element.style.color,element.style.backgroundColor=\\\n element.style.backgroundColor,element.style.color\n \ncc_styles={\n0:[\"fontStyle\",\"normal\"],\n1:[\"fontWeight\",\"bold\"],\n2:[\"fontWeight\",\"lighter\"],\n3:[\"fontStyle\",\"italic\"],\n4:[\"textDecoration\",\"underline\"],\n5:[\"animation\",\"blinker 1s step-start infinite\"],\n6:[\"animation\",\"blinker 0.5s step-start infinite\"],\n7:swap_color_bgcolor\n}\n\ncc_colors={\n30:\"Black\",\n31:\"Red\",\n32:\"Green\",\n33:\"Yellow\",\n34:\"Blue\",\n35:\"Magenta\",\n36:\"Cyan\",\n37:\"White\"\n}\n\ncc_bgcolors={k+10:v for(k,v)in cc_colors.items()}\n\n\nclass Trace:\n\n def __init__(self,exc):\n self.buf=\"\"\n self.is_syntax_error=exc.__name__ in['SyntaxError',\n 'IndentationError']\n \n def write(self,data):\n self.buf +=str(data)\n \n def format(self):\n ''\n lines=self.buf.strip().split(\"\\n\")\n stripped=[lines[0]]if not self.is_syntax_error else['']\n for i in range(1,len(lines),2):\n if __file__ in lines[i]:\n continue\n stripped +=lines[i:i+2]\n return \"\\n\".join(stripped)\n \n \nclass Interpreter:\n ''\n \n def __init__(self,elt_id=None,title=\"Interactive Interpreter\",\n globals=None,locals=None,history=None,\n rows=30,cols=120,default_css=True,\n clear_zone=True,banner=True):\n ''\n\n\n\n\n\n \n if default_css:\n \n for stylesheet in document.styleSheets:\n if stylesheet.ownerNode.id ==\"brython-interpreter\":\n break\n else:\n document <=html.STYLE(style_sheet,id=\"brython-interpreter\")\n \n self.cc_style=None\n self.cc_color=None\n self.cc_bgcolor=None\n self.default_cc_color='#fff'\n self.default_cc_bgcolor='#000'\n \n if elt_id is None:\n self.dialog=Dialog(title=title,top=10,left=10,\n default_css=default_css)\n self.dialog.bind('blur',self.blur)\n self.dialog.bind('click',self.focus)\n self.dialog.close_button.bind('click',self.close)\n self.zone=html.DIV(Class=\"brython-interpreter\",\n contenteditable=True)\n self.zone.style.width=f'{cols}ch'\n self.zone.style.height=f'{rows}ch'\n self.dialog.panel <=self.zone\n else:\n if isinstance(elt_id,str):\n try:\n elt=document[elt_id]\n if elt.tagName !=\"DIV\":\n raise ValueError(\n f\"element {elt_id} is a {elt.tagName}, \"+\n \"not a DIV\")\n self.zone=elt\n except KeyError:\n raise KeyError(f\"no element with id '{elt_id}'\")\n elif isinstance(elt_id,DOMNode):\n if elt_id.tagName ==\"DIV\":\n self.zone=elt_id\n else:\n raise ValueError(\"element is not a DIV\")\n else:\n raise ValueError(\"element should be a string or \"+\n f\"a DIV, got '{elt_id.__class__.__name__}'\")\n if self.zone.contentEditable !='true':\n raise ValueError(\"DIV element must be contenteditable\")\n v=sys.implementation.version\n if clear_zone:\n self.clear()\n if banner:\n self.insert(\n f\"Brython {v[0]}.{v[1]}.{v[2]} on \"\n f\"{window.navigator.appName} {window.navigator.appVersion}\"\n \"\\n\"\n )\n self.insert('Type \"help\", \"copyright\", \"credits\" '\n 'or \"license\" for more information.'+'\\n')\n self.insert_prompt()\n \n self._status=\"main\"\n self.history=history or[]\n self.current=len(self.history)\n \n self.globals={}if globals is None else globals\n self.globals.update(editor_ns)\n self.locals=self.globals if locals is None else locals\n \n self.zone.bind('keypress',self.keypress)\n self.zone.bind('keydown',self.keydown)\n self.zone.bind('mouseup',self.mouseup)\n \n self.zone.bind('focus',self.focus)\n self.zone.bind('blur',self.blur)\n self.focus()\n \n self.cursor_to_end()\n \n active.append(self)\n \n def clear(self):\n self.zone.text=''\n \n def insert(self,text):\n \n pre=html.PRE(style=\"display:inline;white-space:pre-wrap;\")\n pre.text=text\n if self.cc_color is not None:\n pre.style.color=self.cc_color\n if self.cc_bgcolor is not None:\n pre.style.backgroundColor=self.cc_bgcolor\n if self.cc_style is not None:\n style=cc_styles[self.cc_style]\n if isinstance(style,list):\n attr,value=style\n setattr(pre.style,attr,value)\n else:\n style(pre)\n self.zone <=pre\n \n def insert_prompt(self):\n self.insert('>>> ')\n \n def insert_continuation(self):\n self.insert('\\n... ')\n \n def insert_cr(self):\n self.insert('\\n')\n \n def get_content(self):\n return self.zone.text\n \n def blur(self,ev):\n if hasattr(self,'dialog'):\n self.dialog.style.zIndex=0\n \n def close(self,ev):\n active.remove(self)\n \n def cursor_to_end(self,*args):\n \n sel=window.getSelection()\n \n last_child=self.zone.lastChild.firstChild\n if last_child is None:\n last_child=self.zone.lastChild\n pos=len(last_child.text)\n \n sel.setBaseAndExtent(last_child,pos,last_child,pos)\n \n self.zone.lastChild.scrollIntoView()\n \n def focus(self,*args):\n ''\n if hasattr(self,'dialog'):\n \n for w in active:\n if w is not self:\n w.dialog.style.zIndex=0\n self.dialog.style.zIndex=1\n sys.stdout=sys.stderr=Output(self)\n self.zone.focus()\n \n def keypress(self,event):\n if event.key ==\"Tab\":\n event.preventDefault()\n self.insert(\" \")\n elif event.key ==\"Enter\":\n event.preventDefault()\n selection=window.getSelection().toString()\n if selection:\n \n self.cursor_to_end()\n return\n self.handle_line(event)\n \n def feed(self,src):\n ''\n\n\n \n current_indent=0\n lines=src.strip().split('\\n')\n for line in lines:\n self.insert(line)\n self.handle_line()\n \n def handle_line(self,event=None):\n src=self.get_content().strip()\n if self._status ==\"main\":\n currentLine=src[src.rfind('\\n>>>')+5:]\n elif self._status ==\"3string\":\n currentLine=src[src.rfind('\\n>>>')+5:]\n currentLine=currentLine.replace('\\n... ','\\n')\n else:\n currentLine=src[src.rfind('\\n...')+5:]\n if self._status =='main'and not currentLine.strip():\n self.insert_cr()\n self.insert_prompt()\n self.cursor_to_end()\n if event is not None:\n event.preventDefault()\n return\n self.history.append(currentLine)\n self.current=len(self.history)\n if self._status in[\"main\",\"3string\"]:\n \n if currentLine ==\"help\":\n self.write(_help)\n self.insert_prompt()\n if event is not None:\n event.preventDefault()\n return\n try:\n code=compile(currentLine,'','eval')\n except IndentationError:\n self.insert_continuation()\n self._status=\"block\"\n except SyntaxError as msg:\n if str(msg).startswith('unterminated triple-quoted string literal'):\n self.insert_continuation()\n self._status=\"3string\"\n elif str(msg)=='decorator expects function':\n self.insert_continuation()\n self._status=\"block\"\n elif str(msg).endswith('was never closed'):\n self.insert_continuation()\n self._status=\"parenth_expr\"\n else:\n self.insert_cr()\n try:\n code=compile(currentLine,'','exec')\n exec(code,self.globals,self.locals)\n except Exception as exc:\n self.print_tb(msg)\n self.insert_prompt()\n self._status=\"main\"\n except Exception as exc:\n \n \n \n self.print_tb(exc)\n self.insert_prompt()\n self._status=\"main\"\n else:\n self.insert_cr()\n try:\n self.globals['_']=eval(code,\n self.globals,\n self.locals)\n if self.globals['_']is not None:\n self.write(repr(self.globals['_'])+'\\n')\n self.insert_prompt()\n self._status=\"main\"\n except Exception as exc:\n self.print_tb(exc)\n self.insert_prompt()\n self._status=\"main\"\n \n elif currentLine ==\"\":\n block=src[src.rfind('\\n>>>')+5:].splitlines()\n block=[block[0]]+[b[4:]for b in block[1:]]\n block_src='\\n'.join(block)\n self.insert_cr()\n mode=eval if self._status ==\"parenth_expr\"else exec\n \n self._status=\"main\"\n if mode is eval:\n try:\n self.globals['_']=eval(block_src,\n self.globals,\n self.locals)\n if self.globals['_']is not None:\n self.write(repr(self.globals['_'])+'\\n')\n self._status=\"main\"\n except Exception as exc:\n self.print_tb(exc)\n self._status=\"main\"\n else:\n try:\n mode(block_src,self.globals,self.locals)\n except Exception as exc:\n self.print_tb(exc)\n self.insert_prompt()\n \n else:\n self.insert_continuation()\n \n self.cursor_to_end()\n if event is not None:\n event.preventDefault()\n \n def keydown(self,event):\n sel=window.getSelection()\n if event.key in(\"ArrowLeft\",\"Backspace\"):\n \n if sel.anchorNode is not self.zone:\n caret_column=sel.anchorOffset\n if caret_column >=5:\n return\n event.preventDefault()\n event.stopPropagation()\n elif event.key ==\"Home\":\n anchor=sel.anchorNode\n sel.setBaseAndExtent(anchor,4,anchor,4)\n event.preventDefault()\n event.stopPropagation()\n elif event.key ==\"ArrowUp\":\n if self.current >0:\n last_child=self.zone.lastChild\n last_child.text=last_child.text[:4]+self.history[self.current -1]\n self.current -=1\n self.cursor_to_end()\n event.preventDefault()\n elif event.key ==\"ArrowDown\":\n if self.current \",\">\")\n frames_sel <=html.OPTION(name)\n frame=frame.f_back\n frames_sel.bind(\"change\",self.change_frame)\n frame_div=html.DIV(\"Frame \"+frames_sel)\n panel_style=window.getComputedStyle(self.dialog.panel)\n frame_div.style.paddingLeft=panel_style.paddingLeft\n frame_div.style.paddingTop=panel_style.paddingTop\n self.dialog.insertBefore(frame_div,self.dialog.panel)\n \n def change_frame(self,ev):\n self.globals,self.locals=self.frames[ev.target.selectedIndex]\n \n", ["browser", "browser.widgets.dialog", "builtins", "re", "sys", "tb"]], "io": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__author__=(\"Guido van Rossum , \"\n\"Mike Verdone , \"\n\"Mark Russell , \"\n\"Antoine Pitrou , \"\n\"Amaury Forgeot d'Arc , \"\n\"Benjamin Peterson \")\n\n__all__=[\"BlockingIOError\",\"open\",\"open_code\",\"IOBase\",\"RawIOBase\",\n\"FileIO\",\"BytesIO\",\"StringIO\",\"BufferedIOBase\",\n\"BufferedReader\",\"BufferedWriter\",\"BufferedRWPair\",\n\"BufferedRandom\",\"TextIOBase\",\"TextIOWrapper\",\n\"UnsupportedOperation\",\"SEEK_SET\",\"SEEK_CUR\",\"SEEK_END\"]\n\n\nimport _io\nimport abc\n\nfrom _io import(DEFAULT_BUFFER_SIZE,BlockingIOError,UnsupportedOperation,\nopen,open_code,FileIO,BytesIO,StringIO,BufferedReader,\nBufferedWriter,BufferedRWPair,BufferedRandom,\nIncrementalNewlineDecoder,text_encoding,TextIOWrapper)\n\n\n\nUnsupportedOperation.__module__=\"io\"\n\n\nSEEK_SET=0\nSEEK_CUR=1\nSEEK_END=2\n\n\n\n\nclass IOBase(_io._IOBase,metaclass=abc.ABCMeta):\n __doc__=_io._IOBase.__doc__\n \nclass RawIOBase(_io._RawIOBase,IOBase):\n __doc__=_io._RawIOBase.__doc__\n \nclass BufferedIOBase(_io._BufferedIOBase,IOBase):\n __doc__=_io._BufferedIOBase.__doc__\n \nclass TextIOBase(_io._TextIOBase,IOBase):\n __doc__=_io._TextIOBase.__doc__\n \nRawIOBase.register(FileIO)\n\nfor klass in(BytesIO,BufferedReader,BufferedWriter,BufferedRandom,\nBufferedRWPair):\n BufferedIOBase.register(klass)\n \nfor klass in(StringIO,TextIOWrapper):\n TextIOBase.register(klass)\ndel klass\n\ntry:\n from _io import _WindowsConsoleIO\nexcept ImportError:\n pass\nelse:\n RawIOBase.register(_WindowsConsoleIO)\n", ["_io", "abc"]], "ipaddress": [".py", "\n\n\n\"\"\"A fast, lightweight IPv4/IPv6 manipulation library in Python.\n\nThis library is used to create/poke/manipulate IPv4 and IPv6 addresses\nand networks.\n\n\"\"\"\n\n__version__='1.0'\n\n\nimport functools\n\nIPV4LENGTH=32\nIPV6LENGTH=128\n\n\nclass AddressValueError(ValueError):\n ''\n \n \nclass NetmaskValueError(ValueError):\n ''\n \n \ndef ip_address(address):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return IPv4Address(address)\n except (AddressValueError,NetmaskValueError):\n pass\n \n try :\n return IPv6Address(address)\n except (AddressValueError,NetmaskValueError):\n pass\n \n raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')\n \n \ndef ip_network(address,strict=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return IPv4Network(address,strict)\n except (AddressValueError,NetmaskValueError):\n pass\n \n try :\n return IPv6Network(address,strict)\n except (AddressValueError,NetmaskValueError):\n pass\n \n raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 network')\n \n \ndef ip_interface(address):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return IPv4Interface(address)\n except (AddressValueError,NetmaskValueError):\n pass\n \n try :\n return IPv6Interface(address)\n except (AddressValueError,NetmaskValueError):\n pass\n \n raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 interface')\n \n \ndef v4_int_to_packed(address):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return address.to_bytes(4)\n except OverflowError:\n raise ValueError(\"Address negative or too large for IPv4\")\n \n \ndef v6_int_to_packed(address):\n ''\n\n\n\n\n\n\n\n \n try :\n return address.to_bytes(16)\n except OverflowError:\n raise ValueError(\"Address negative or too large for IPv6\")\n \n \ndef _split_optional_netmask(address):\n ''\n addr=str(address).split('/')\n if len(addr)>2:\n raise AddressValueError(f\"Only one '/' permitted in {address!r}\")\n return addr\n \n \ndef _find_address_range(addresses):\n ''\n\n\n\n\n\n\n\n \n it=iter(addresses)\n first=last=next(it)\n for ip in it:\n if ip._ip !=last._ip+1:\n yield first,last\n first=ip\n last=ip\n yield first,last\n \n \ndef _count_righthand_zero_bits(number,bits):\n ''\n\n\n\n\n\n\n\n\n \n if number ==0:\n return bits\n return min(bits,(~number&(number -1)).bit_length())\n \n \ndef summarize_address_range(first,last):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if (not (isinstance(first,_BaseAddress)and\n isinstance(last,_BaseAddress))):\n raise TypeError('first and last must be IP addresses, not networks')\n if first.version !=last.version:\n raise TypeError(\"%s and %s are not of the same version\"%(\n first,last))\n if first >last:\n raise ValueError('last IP address must be greater than first')\n \n if first.version ==4:\n ip=IPv4Network\n elif first.version ==6:\n ip=IPv6Network\n else :\n raise ValueError('unknown IP version')\n \n ip_bits=first._max_prefixlen\n first_int=first._ip\n last_int=last._ip\n while first_int <=last_int:\n nbits=min(_count_righthand_zero_bits(first_int,ip_bits),\n (last_int -first_int+1).bit_length()-1)\n net=ip((first_int,ip_bits -nbits))\n yield net\n first_int +=1 <=net.broadcast_address:\n continue\n yield net\n last=net\n \n \ndef collapse_addresses(addresses):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n addrs=[]\n ips=[]\n nets=[]\n \n \n for ip in addresses:\n if isinstance(ip,_BaseAddress):\n if ips and ips[-1]._version !=ip._version:\n raise TypeError(\"%s and %s are not of the same version\"%(\n ip,ips[-1]))\n ips.append(ip)\n elif ip._prefixlen ==ip._max_prefixlen:\n if ips and ips[-1]._version !=ip._version:\n raise TypeError(\"%s and %s are not of the same version\"%(\n ip,ips[-1]))\n try :\n ips.append(ip.ip)\n except AttributeError:\n ips.append(ip.network_address)\n else :\n if nets and nets[-1]._version !=ip._version:\n raise TypeError(\"%s and %s are not of the same version\"%(\n ip,nets[-1]))\n nets.append(ip)\n \n \n ips=sorted(set(ips))\n \n \n if ips:\n for first,last in _find_address_range(ips):\n addrs.extend(summarize_address_range(first,last))\n \n return _collapse_addresses_internal(addrs+nets)\n \n \ndef get_mixed_type_key(obj):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(obj,_BaseNetwork):\n return obj._get_networks_key()\n elif isinstance(obj,_BaseAddress):\n return obj._get_address_key()\n return NotImplemented\n \n \nclass _IPAddressBase:\n\n ''\n \n __slots__=()\n \n @property\n def exploded(self):\n ''\n return self._explode_shorthand_ip_string()\n \n @property\n def compressed(self):\n ''\n return str(self)\n \n @property\n def reverse_pointer(self):\n ''\n\n\n\n\n\n \n return self._reverse_pointer()\n \n @property\n def version(self):\n msg='%200s has no version specified'%(type(self),)\n raise NotImplementedError(msg)\n \n def _check_int_address(self,address):\n if address <0:\n msg=\"%d (< 0) is not permitted as an IPv%d address\"\n raise AddressValueError(msg %(address,self._version))\n if address >self._ALL_ONES:\n msg=\"%d (>= 2**%d) is not permitted as an IPv%d address\"\n raise AddressValueError(msg %(address,self._max_prefixlen,\n self._version))\n \n def _check_packed_address(self,address,expected_len):\n address_len=len(address)\n if address_len !=expected_len:\n msg=\"%r (len %d != %d) is not permitted as an IPv%d address\"\n raise AddressValueError(msg %(address,address_len,\n expected_len,self._version))\n \n @classmethod\n def _ip_int_from_prefix(cls,prefixlen):\n ''\n\n\n\n\n\n\n\n \n return cls._ALL_ONES ^(cls._ALL_ONES >>prefixlen)\n \n @classmethod\n def _prefix_from_ip_int(cls,ip_int):\n ''\n\n\n\n\n\n\n\n\n\n \n trailing_zeroes=_count_righthand_zero_bits(ip_int,\n cls._max_prefixlen)\n prefixlen=cls._max_prefixlen -trailing_zeroes\n leading_ones=ip_int >>trailing_zeroes\n all_ones=(1 <1:\n return address\n return address[0],cls._max_prefixlen\n \n def __reduce__(self):\n return self.__class__,(str(self),)\n \n \n_address_fmt_re=None\n\n@functools.total_ordering\nclass _BaseAddress(_IPAddressBase):\n\n ''\n\n\n\n \n \n __slots__=()\n \n def __int__(self):\n return self._ip\n \n def __eq__(self,other):\n try :\n return (self._ip ==other._ip\n and self._version ==other._version)\n except AttributeError:\n return NotImplemented\n \n def __lt__(self,other):\n if not isinstance(other,_BaseAddress):\n return NotImplemented\n if self._version !=other._version:\n raise TypeError('%s and %s are not of the same version'%(\n self,other))\n if self._ip !=other._ip:\n return self._ip =0:\n if network+n >broadcast:\n raise IndexError('address out of range')\n return self._address_class(network+n)\n else :\n n +=1\n if broadcast+n other.network_address:\n return 1\n \n if self.netmask other.netmask:\n return 1\n return 0\n \n def _get_networks_key(self):\n ''\n\n\n\n\n\n \n return (self._version,self.network_address,self.netmask)\n \n def subnets(self,prefixlen_diff=1,new_prefix=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self._prefixlen ==self._max_prefixlen:\n yield self\n return\n \n if new_prefix is not None :\n if new_prefix 0')\n new_prefixlen=self._prefixlen+prefixlen_diff\n \n if new_prefixlen >self._max_prefixlen:\n raise ValueError(\n 'prefix length diff %d is invalid for netblock %s'%(\n new_prefixlen,self))\n \n start=int(self.network_address)\n end=int(self.broadcast_address)+1\n step=(int(self.hostmask)+1)>>prefixlen_diff\n for new_addr in range(start,end,step):\n current=self.__class__((new_addr,new_prefixlen))\n yield current\n \n def supernet(self,prefixlen_diff=1,new_prefix=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self._prefixlen ==0:\n return self\n \n if new_prefix is not None :\n if new_prefix >self._prefixlen:\n raise ValueError('new prefix must be shorter')\n if prefixlen_diff !=1:\n raise ValueError('cannot set prefixlen_diff and new_prefix')\n prefixlen_diff=self._prefixlen -new_prefix\n \n new_prefixlen=self.prefixlen -prefixlen_diff\n if new_prefixlen <0:\n raise ValueError(\n 'current prefixlen is %d, cannot have a prefixlen_diff of %d'%\n (self.prefixlen,prefixlen_diff))\n return self.__class__((\n int(self.network_address)&(int(self.netmask)<=a.broadcast_address)\n except AttributeError:\n raise TypeError(f\"Unable to test subnet containment \"\n f\"between {a} and {b}\")\n \n def subnet_of(self,other):\n ''\n return self._is_subnet_of(self,other)\n \n def supernet_of(self,other):\n ''\n return self._is_subnet_of(other,self)\n \n @property\n def is_reserved(self):\n ''\n\n\n\n\n\n \n return (self.network_address.is_reserved and\n self.broadcast_address.is_reserved)\n \n @property\n def is_link_local(self):\n ''\n\n\n\n\n \n return (self.network_address.is_link_local and\n self.broadcast_address.is_link_local)\n \n @property\n def is_private(self):\n ''\n\n\n\n\n\n \n return (self.network_address.is_private and\n self.broadcast_address.is_private)\n \n @property\n def is_global(self):\n ''\n\n\n\n\n\n \n return not self.is_private\n \n @property\n def is_unspecified(self):\n ''\n\n\n\n\n\n \n return (self.network_address.is_unspecified and\n self.broadcast_address.is_unspecified)\n \n @property\n def is_loopback(self):\n ''\n\n\n\n\n\n \n return (self.network_address.is_loopback and\n self.broadcast_address.is_loopback)\n \nclass _BaseV4:\n\n ''\n\n\n\n\n \n \n __slots__=()\n _version=4\n \n _ALL_ONES=(2 **IPV4LENGTH)-1\n \n _max_prefixlen=IPV4LENGTH\n \n \n _netmask_cache={}\n \n def _explode_shorthand_ip_string(self):\n return str(self)\n \n @classmethod\n def _make_netmask(cls,arg):\n ''\n\n\n\n\n\n \n if arg not in cls._netmask_cache:\n if isinstance(arg,int):\n prefixlen=arg\n if not (0 <=prefixlen <=cls._max_prefixlen):\n cls._report_invalid_netmask(prefixlen)\n else :\n try :\n \n prefixlen=cls._prefix_from_prefix_string(arg)\n except NetmaskValueError:\n \n \n prefixlen=cls._prefix_from_ip_string(arg)\n netmask=IPv4Address(cls._ip_int_from_prefix(prefixlen))\n cls._netmask_cache[arg]=netmask,prefixlen\n return cls._netmask_cache[arg]\n \n @classmethod\n def _ip_int_from_string(cls,ip_str):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if not ip_str:\n raise AddressValueError('Address cannot be empty')\n \n octets=ip_str.split('.')\n if len(octets)!=4:\n raise AddressValueError(\"Expected 4 octets in %r\"%ip_str)\n \n try :\n return int.from_bytes(map(cls._parse_octet,octets),'big')\n except ValueError as exc:\n raise AddressValueError(\"%s in %r\"%(exc,ip_str))from None\n \n @classmethod\n def _parse_octet(cls,octet_str):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if not octet_str:\n raise ValueError(\"Empty octet not permitted\")\n \n if not (octet_str.isascii()and octet_str.isdigit()):\n msg=\"Only decimal digits permitted in %r\"\n raise ValueError(msg %octet_str)\n \n \n if len(octet_str)>3:\n msg=\"At most 3 characters permitted in %r\"\n raise ValueError(msg %octet_str)\n \n \n if octet_str !='0'and octet_str[0]=='0':\n msg=\"Leading zeros are not permitted in %r\"\n raise ValueError(msg %octet_str)\n \n octet_int=int(octet_str,10)\n if octet_int >255:\n raise ValueError(\"Octet %d (> 255) not permitted\"%octet_int)\n return octet_int\n \n @classmethod\n def _string_from_ip_int(cls,ip_int):\n ''\n\n\n\n\n\n\n\n \n return '.'.join(map(str,ip_int.to_bytes(4,'big')))\n \n def _reverse_pointer(self):\n ''\n\n\n\n \n reverse_octets=str(self).split('.')[::-1]\n return '.'.join(reverse_octets)+'.in-addr.arpa'\n \n @property\n def max_prefixlen(self):\n return self._max_prefixlen\n \n @property\n def version(self):\n return self._version\n \n \nclass IPv4Address(_BaseV4,_BaseAddress):\n\n ''\n \n __slots__=('_ip','__weakref__')\n \n def __init__(self,address):\n \n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if isinstance(address,int):\n self._check_int_address(address)\n self._ip=address\n return\n \n \n if isinstance(address,bytes):\n self._check_packed_address(address,4)\n self._ip=int.from_bytes(address)\n return\n \n \n \n addr_str=str(address)\n if '/'in addr_str:\n raise AddressValueError(f\"Unexpected '/' in {address!r}\")\n self._ip=self._ip_int_from_string(addr_str)\n \n @property\n def packed(self):\n ''\n return v4_int_to_packed(self._ip)\n \n @property\n def is_reserved(self):\n ''\n\n\n\n\n\n \n return self in self._constants._reserved_network\n \n @property\n @functools.lru_cache()\n def is_private(self):\n ''\n\n\n\n\n\n \n return any(self in net for net in self._constants._private_networks)\n \n @property\n @functools.lru_cache()\n def is_global(self):\n return self not in self._constants._public_network and not self.is_private\n \n @property\n def is_multicast(self):\n ''\n\n\n\n\n\n \n return self in self._constants._multicast_network\n \n @property\n def is_unspecified(self):\n ''\n\n\n\n\n\n \n return self ==self._constants._unspecified_address\n \n @property\n def is_loopback(self):\n ''\n\n\n\n\n \n return self in self._constants._loopback_network\n \n @property\n def is_link_local(self):\n ''\n\n\n\n\n \n return self in self._constants._linklocal_network\n \n \nclass IPv4Interface(IPv4Address):\n\n def __init__(self,address):\n addr,mask=self._split_addr_prefix(address)\n \n IPv4Address.__init__(self,addr)\n self.network=IPv4Network((addr,mask),strict=False )\n self.netmask=self.network.netmask\n self._prefixlen=self.network._prefixlen\n \n @functools.cached_property\n def hostmask(self):\n return self.network.hostmask\n \n def __str__(self):\n return '%s/%d'%(self._string_from_ip_int(self._ip),\n self._prefixlen)\n \n def __eq__(self,other):\n address_equal=IPv4Address.__eq__(self,other)\n if address_equal is NotImplemented or not address_equal:\n return address_equal\n try :\n return self.network ==other.network\n except AttributeError:\n \n \n \n return False\n \n def __lt__(self,other):\n address_less=IPv4Address.__lt__(self,other)\n if address_less is NotImplemented:\n return NotImplemented\n try :\n return (self.network >16)&0xFFFF))\n parts.append('%x'%(ipv4_int&0xFFFF))\n \n \n \n \n _max_parts=cls._HEXTET_COUNT+1\n if len(parts)>_max_parts:\n msg=\"At most %d colons permitted in %r\"%(_max_parts -1,ip_str)\n raise AddressValueError(msg)\n \n \n \n skip_index=None\n for i in range(1,len(parts)-1):\n if not parts[i]:\n if skip_index is not None :\n \n msg=\"At most one '::' permitted in %r\"%ip_str\n raise AddressValueError(msg)\n skip_index=i\n \n \n \n if skip_index is not None :\n \n parts_hi=skip_index\n parts_lo=len(parts)-skip_index -1\n if not parts[0]:\n parts_hi -=1\n if parts_hi:\n msg=\"Leading ':' only permitted as part of '::' in %r\"\n raise AddressValueError(msg %ip_str)\n if not parts[-1]:\n parts_lo -=1\n if parts_lo:\n msg=\"Trailing ':' only permitted as part of '::' in %r\"\n raise AddressValueError(msg %ip_str)\n parts_skipped=cls._HEXTET_COUNT -(parts_hi+parts_lo)\n if parts_skipped <1:\n msg=\"Expected at most %d other parts with '::' in %r\"\n raise AddressValueError(msg %(cls._HEXTET_COUNT -1,ip_str))\n else :\n \n \n \n if len(parts)!=cls._HEXTET_COUNT:\n msg=\"Exactly %d parts expected without '::' in %r\"\n raise AddressValueError(msg %(cls._HEXTET_COUNT,ip_str))\n if not parts[0]:\n msg=\"Leading ':' only permitted as part of '::' in %r\"\n raise AddressValueError(msg %ip_str)\n if not parts[-1]:\n msg=\"Trailing ':' only permitted as part of '::' in %r\"\n raise AddressValueError(msg %ip_str)\n parts_hi=len(parts)\n parts_lo=0\n parts_skipped=0\n \n try :\n \n ip_int=0\n for i in range(parts_hi):\n ip_int <<=16\n ip_int |=cls._parse_hextet(parts[i])\n ip_int <<=16 *parts_skipped\n for i in range(-parts_lo,0):\n ip_int <<=16\n ip_int |=cls._parse_hextet(parts[i])\n return ip_int\n except ValueError as exc:\n raise AddressValueError(\"%s in %r\"%(exc,ip_str))from None\n \n @classmethod\n def _parse_hextet(cls,hextet_str):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n if not cls._HEX_DIGITS.issuperset(hextet_str):\n raise ValueError(\"Only hex digits permitted in %r\"%hextet_str)\n \n \n if len(hextet_str)>4:\n msg=\"At most 4 characters permitted in %r\"\n raise ValueError(msg %hextet_str)\n \n return int(hextet_str,16)\n \n @classmethod\n def _compress_hextets(cls,hextets):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n best_doublecolon_start=-1\n best_doublecolon_len=0\n doublecolon_start=-1\n doublecolon_len=0\n for index,hextet in enumerate(hextets):\n if hextet =='0':\n doublecolon_len +=1\n if doublecolon_start ==-1:\n \n doublecolon_start=index\n if doublecolon_len >best_doublecolon_len:\n \n best_doublecolon_len=doublecolon_len\n best_doublecolon_start=doublecolon_start\n else :\n doublecolon_len=0\n doublecolon_start=-1\n \n if best_doublecolon_len >1:\n best_doublecolon_end=(best_doublecolon_start+\n best_doublecolon_len)\n \n if best_doublecolon_end ==len(hextets):\n hextets +=['']\n hextets[best_doublecolon_start:best_doublecolon_end]=['']\n \n if best_doublecolon_start ==0:\n hextets=['']+hextets\n \n return hextets\n \n @classmethod\n def _string_from_ip_int(cls,ip_int=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if ip_int is None :\n ip_int=int(cls._ip)\n \n if ip_int >cls._ALL_ONES:\n raise ValueError('IPv6 address is too large')\n \n hex_str='%032x'%ip_int\n hextets=['%x'%int(hex_str[x:x+4],16)for x in range(0,32,4)]\n \n hextets=cls._compress_hextets(hextets)\n return ':'.join(hextets)\n \n def _explode_shorthand_ip_string(self):\n ''\n\n\n\n\n\n\n\n \n if isinstance(self,IPv6Network):\n ip_str=str(self.network_address)\n elif isinstance(self,IPv6Interface):\n ip_str=str(self.ip)\n else :\n ip_str=str(self)\n \n ip_int=self._ip_int_from_string(ip_str)\n hex_str='%032x'%ip_int\n parts=[hex_str[x:x+4]for x in range(0,32,4)]\n if isinstance(self,(_BaseNetwork,IPv6Interface)):\n return '%s/%d'%(':'.join(parts),self._prefixlen)\n return ':'.join(parts)\n \n def _reverse_pointer(self):\n ''\n\n\n\n \n reverse_chars=self.exploded[::-1].replace(':','')\n return '.'.join(reverse_chars)+'.ip6.arpa'\n \n @staticmethod\n def _split_scope_id(ip_str):\n ''\n\n\n\n\n\n\n\n\n\n \n addr,sep,scope_id=ip_str.partition('%')\n if not sep:\n scope_id=None\n elif not scope_id or '%'in scope_id:\n raise AddressValueError('Invalid IPv6 address: \"%r\"'%ip_str)\n return addr,scope_id\n \n @property\n def max_prefixlen(self):\n return self._max_prefixlen\n \n @property\n def version(self):\n return self._version\n \n \nclass IPv6Address(_BaseV6,_BaseAddress):\n\n ''\n \n __slots__=('_ip','_scope_id','__weakref__')\n \n def __init__(self,address):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if isinstance(address,int):\n self._check_int_address(address)\n self._ip=address\n self._scope_id=None\n return\n \n \n if isinstance(address,bytes):\n self._check_packed_address(address,16)\n self._ip=int.from_bytes(address,'big')\n self._scope_id=None\n return\n \n \n \n addr_str=str(address)\n if '/'in addr_str:\n raise AddressValueError(f\"Unexpected '/' in {address!r}\")\n addr_str,self._scope_id=self._split_scope_id(addr_str)\n \n self._ip=self._ip_int_from_string(addr_str)\n \n def __str__(self):\n ip_str=super().__str__()\n return ip_str+'%'+self._scope_id if self._scope_id else ip_str\n \n def __hash__(self):\n return hash((self._ip,self._scope_id))\n \n def __eq__(self,other):\n address_equal=super().__eq__(other)\n if address_equal is NotImplemented:\n return NotImplemented\n if not address_equal:\n return False\n return self._scope_id ==getattr(other,'_scope_id',None )\n \n @property\n def scope_id(self):\n ''\n\n\n\n\n\n\n \n return self._scope_id\n \n @property\n def packed(self):\n ''\n return v6_int_to_packed(self._ip)\n \n @property\n def is_multicast(self):\n ''\n\n\n\n\n\n \n return self in self._constants._multicast_network\n \n @property\n def is_reserved(self):\n ''\n\n\n\n\n\n \n return any(self in x for x in self._constants._reserved_networks)\n \n @property\n def is_link_local(self):\n ''\n\n\n\n\n \n return self in self._constants._linklocal_network\n \n @property\n def is_site_local(self):\n ''\n\n\n\n\n\n\n\n\n \n return self in self._constants._sitelocal_network\n \n @property\n @functools.lru_cache()\n def is_private(self):\n ''\n\n\n\n\n\n\n \n ipv4_mapped=self.ipv4_mapped\n if ipv4_mapped is not None :\n return ipv4_mapped.is_private\n return any(self in net for net in self._constants._private_networks)\n \n @property\n def is_global(self):\n ''\n\n\n\n\n\n \n return not self.is_private\n \n @property\n def is_unspecified(self):\n ''\n\n\n\n\n\n \n return self._ip ==0\n \n @property\n def is_loopback(self):\n ''\n\n\n\n\n\n \n return self._ip ==1\n \n @property\n def ipv4_mapped(self):\n ''\n\n\n\n\n\n \n if (self._ip >>32)!=0xFFFF:\n return None\n return IPv4Address(self._ip&0xFFFFFFFF)\n \n @property\n def teredo(self):\n ''\n\n\n\n\n\n\n \n if (self._ip >>96)!=0x20010000:\n return None\n return (IPv4Address((self._ip >>64)&0xFFFFFFFF),\n IPv4Address(~self._ip&0xFFFFFFFF))\n \n @property\n def sixtofour(self):\n ''\n\n\n\n\n\n \n if (self._ip >>112)!=0x2002:\n return None\n return IPv4Address((self._ip >>80)&0xFFFFFFFF)\n \n \nclass IPv6Interface(IPv6Address):\n\n def __init__(self,address):\n addr,mask=self._split_addr_prefix(address)\n \n IPv6Address.__init__(self,addr)\n self.network=IPv6Network((addr,mask),strict=False )\n self.netmask=self.network.netmask\n self._prefixlen=self.network._prefixlen\n \n @functools.cached_property\n def hostmask(self):\n return self.network.hostmask\n \n def __str__(self):\n return '%s/%d'%(super().__str__(),\n self._prefixlen)\n \n def __eq__(self,other):\n address_equal=IPv6Address.__eq__(self,other)\n if address_equal is NotImplemented or not address_equal:\n return address_equal\n try :\n return self.network ==other.network\n except AttributeError:\n \n \n \n return False\n \n def __lt__(self,other):\n address_less=IPv6Address.__lt__(self,other)\n if address_less is NotImplemented:\n return address_less\n try :\n return (self.network self.n:\n raise StopIteration\n if not self.zero:\n self.zero=True\n return tuple(self.pool[i]for i in self.indices)\n else :\n try :\n for i in reversed(range(self.r)):\n if self.indices[i]!=i+self.n -self.r:\n break\n self.indices[i]+=1\n for j in range(i+1,self.r):\n self.indices[j]=self.indices[j -1]+1\n return tuple(self.pool[i]for i in self.indices)\n except :\n raise StopIteration\n \nclass combinations_with_replacement:\n def __init__(self,iterable,r):\n self.pool=tuple(iterable)\n self.n=len(self.pool)\n self.r=r\n self.indices=[0]*self.r\n self.zero=False\n \n def __iter__(self):\n return self\n \n def __next__(self):\n if not self.n and self.r:\n raise StopIteration\n if not self.zero:\n self.zero=True\n return tuple(self.pool[i]for i in self.indices)\n else :\n try :\n for i in reversed(range(self.r)):\n if self.indices[i]!=self.n -1:\n break\n self.indices[i:]=[self.indices[i]+1]*(self.r -i)\n return tuple(self.pool[i]for i in self.indices)\n except :\n raise StopIteration\n \n \n \nclass compress:\n def __init__(self,data,selectors):\n self.data=iter(data)\n self.selectors=iter(selectors)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n while True :\n next_item=next(self.data)\n next_selector=next(self.selectors)\n if bool(next_selector):\n return next_item\n \n \n \n \nclass count:\n ''\n\n\n\n \n def __init__(self,start=0,step=1):\n if not isinstance(start,(int,float)):\n raise TypeError('a number is required')\n self.times=start -step\n self.step=step\n \n def __iter__(self):\n return self\n \n def __next__(self):\n self.times +=self.step\n return self.times\n \n def __repr__(self):\n return 'count(%d)'%(self.times+self.step)\n \n \n \nclass cycle:\n def __init__(self,iterable):\n self._cur_iter=iter(iterable)\n self._saved=[]\n self._must_save=True\n \n def __iter__(self):\n return self\n \n def __next__(self):\n try :\n next_elt=next(self._cur_iter)\n if self._must_save:\n self._saved.append(next_elt)\n except StopIteration:\n self._cur_iter=iter(self._saved)\n next_elt=next(self._cur_iter)\n self._must_save=False\n return next_elt\n \n \n \nclass dropwhile:\n def __init__(self,predicate,iterable):\n self._predicate=predicate\n self._iter=iter(iterable)\n self._dropped=False\n \n def __iter__(self):\n return self\n \n def __next__(self):\n value=next(self._iter)\n if self._dropped:\n return value\n while self._predicate(value):\n value=next(self._iter)\n self._dropped=True\n return value\n \n \n \nclass filterfalse:\n def __init__(self,predicate,iterable):\n \n self._iter=iter(iterable)\n if predicate is None :\n self._predicate=bool\n else :\n self._predicate=predicate\n \n def __iter__(self):\n return self\n def __next__(self):\n next_elt=next(self._iter)\n while True :\n if not self._predicate(next_elt):\n return next_elt\n next_elt=next(self._iter)\n \nclass groupby:\n\n\n def __init__(self,iterable,key=None ):\n if key is None :\n key=lambda x:x\n self.keyfunc=key\n self.it=iter(iterable)\n self.tgtkey=self.currkey=self.currvalue=object()\n def __iter__(self):\n return self\n def __next__(self):\n while self.currkey ==self.tgtkey:\n self.currvalue=next(self.it)\n self.currkey=self.keyfunc(self.currvalue)\n self.tgtkey=self.currkey\n return (self.currkey,self._grouper(self.tgtkey))\n def _grouper(self,tgtkey):\n while self.currkey ==tgtkey:\n yield self.currvalue\n self.currvalue=next(self.it)\n self.currkey=self.keyfunc(self.currvalue)\n \n \n \nclass islice:\n def __init__(self,iterable,*args):\n s=slice(*args)\n self.start,self.stop,self.step=s.start or 0,s.stop,s.step\n if not isinstance(self.start,int):\n raise ValueError(\"Start argument must be an integer\")\n if self.stop !=None and not isinstance(self.stop,int):\n raise ValueError(\"Stop argument must be an integer or None\")\n if self.step is None :\n self.step=1\n if self.start <0 or (self.stop !=None and self.stop <0\n )or self.step <=0:\n raise ValueError(\"indices for islice() must be positive\")\n self.it=iter(iterable)\n self.donext=None\n self.cnt=0\n \n def __iter__(self):\n return self\n \n def __next__(self):\n nextindex=self.start\n if self.stop !=None and nextindex >=self.stop:\n raise StopIteration\n while self.cnt <=nextindex:\n nextitem=next(self.it)\n self.cnt +=1\n self.start +=self.step\n return nextitem\n \nclass permutations:\n def __init__(self,iterable,r=None ):\n self.pool=tuple(iterable)\n self.n=len(self.pool)\n self.r=self.n if r is None else r\n self.indices=list(range(self.n))\n self.cycles=list(range(self.n,self.n -self.r,-1))\n self.zero=False\n self.stop=False\n \n def __iter__(self):\n return self\n \n def __next__(self):\n indices=self.indices\n if self.r >self.n:\n raise StopIteration\n if not self.zero:\n self.zero=True\n return tuple(self.pool[i]for i in indices[:self.r])\n \n i=self.r -1\n while i >=0:\n j=self.cycles[i]-1\n if j >0:\n self.cycles[i]=j\n indices[i],indices[-j]=indices[-j],indices[i]\n return tuple(self.pool[i]for i in indices[:self.r])\n self.cycles[i]=len(indices)-i\n n1=len(indices)-1\n assert n1 >=0\n num=indices[i]\n for k in range(i,n1):\n indices[k]=indices[k+1]\n indices[n1]=num\n i -=1\n raise StopIteration\n \n \ndef product(*args,repeat=1):\n\n\n pools=[tuple(pool)for pool in args]*repeat\n result=[[]]\n for pool in pools:\n result=[x+[y]for x in result for y in pool]\n for prod in result:\n yield tuple(prod)\n \n \n \n \n \n \n \n \nclass _product:\n def __init__(self,*args,**kw):\n if len(kw)>1:\n raise TypeError(\"product() takes at most 1 argument (%d given)\"%\n len(kw))\n self.repeat=kw.get('repeat',1)\n if not isinstance(self.repeat,int):\n raise TypeError(\"integer argument expected, got %s\"%\n type(self.repeat))\n self.gears=[x for x in args]*self.repeat\n self.num_gears=len(self.gears)\n \n self.indicies=[(0,len(self.gears[x]))\n for x in range(0,self.num_gears)]\n self.cont=True\n self.zero=False\n \n def roll_gears(self):\n \n \n \n should_carry=True\n for n in range(0,self.num_gears):\n nth_gear=self.num_gears -n -1\n if should_carry:\n count,lim=self.indicies[nth_gear]\n count +=1\n if count ==lim and nth_gear ==0:\n self.cont=False\n if count ==lim:\n should_carry=True\n count=0\n else :\n should_carry=False\n self.indicies[nth_gear]=(count,lim)\n else :\n break\n \n def __iter__(self):\n return self\n \n def __next__(self):\n if self.zero:\n raise StopIteration\n if self.repeat >0:\n if not self.cont:\n raise StopIteration\n l=[]\n for x in range(0,self.num_gears):\n index,limit=self.indicies[x]\n print('itertools 353',self.gears,x,index)\n l.append(self.gears[x][index])\n self.roll_gears()\n return tuple(l)\n elif self.repeat ==0:\n self.zero=True\n return ()\n else :\n raise ValueError(\"repeat argument cannot be negative\")\n \n \n \nclass repeat:\n def __init__(self,obj,times=None ):\n self._obj=obj\n if times is not None :\n range(times)\n if times <0:\n times=0\n self._times=times\n \n def __iter__(self):\n return self\n \n def __next__(self):\n \n if self._times is not None :\n if self._times <=0:\n raise StopIteration()\n self._times -=1\n return self._obj\n \n def __repr__(self):\n if self._times is not None :\n return 'repeat(%r, %r)'%(self._obj,self._times)\n else :\n return 'repeat(%r)'%(self._obj,)\n \n def __len__(self):\n if self._times ==-1 or self._times is None :\n raise TypeError(\"len() of uniszed object\")\n return self._times\n \n \n \nclass starmap(object):\n def __init__(self,function,iterable):\n self._func=function\n self._iter=iter(iterable)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n t=next(self._iter)\n return self._func(*t)\n \n \n \nclass takewhile(object):\n def __init__(self,predicate,iterable):\n self._predicate=predicate\n self._iter=iter(iterable)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n value=next(self._iter)\n if not self._predicate(value):\n raise StopIteration()\n return value\n \n \n \nclass TeeData(object):\n def __init__(self,iterator):\n self.data=[]\n self._iter=iterator\n \n def __getitem__(self,i):\n \n while i >=len(self.data):\n self.data.append(next(self._iter))\n return self.data[i]\n \n \nclass TeeObject(object):\n def __init__(self,iterable=None ,tee_data=None ):\n if tee_data:\n self.tee_data=tee_data\n self.pos=0\n \n elif isinstance(iterable,TeeObject):\n self.tee_data=iterable.tee_data\n self.pos=iterable.pos\n else :\n self.tee_data=TeeData(iter(iterable))\n self.pos=0\n \n def __next__(self):\n data=self.tee_data[self.pos]\n self.pos +=1\n return data\n \n def __iter__(self):\n return self\n \n \ndef tee(iterable,n=2):\n if isinstance(iterable,TeeObject):\n return tuple([iterable]+\n [TeeObject(tee_data=iterable.tee_data)for i in range(n -1)])\n tee_data=TeeData(iter(iterable))\n return tuple([TeeObject(tee_data=tee_data)for i in range(n)])\n \nclass zip_longest:\n def __init__(self,*args,fillvalue=None ):\n self.args=[iter(arg)for arg in args]\n self.fillvalue=fillvalue\n self.units=len(args)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n temp=[]\n nb=0\n for i in range(self.units):\n try :\n temp.append(next(self.args[i]))\n nb +=1\n except StopIteration:\n temp.append(self.fillvalue)\n if nb ==0:\n raise StopIteration\n return tuple(temp)\n", ["operator"]], "keyword": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\"iskeyword\",\"issoftkeyword\",\"kwlist\",\"softkwlist\"]\n\nkwlist=[\n'False',\n'None',\n'True',\n'and',\n'as',\n'assert',\n'async',\n'await',\n'break',\n'class',\n'continue',\n'def',\n'del',\n'elif',\n'else',\n'except',\n'finally',\n'for',\n'from',\n'global',\n'if',\n'import',\n'in',\n'is',\n'lambda',\n'nonlocal',\n'not',\n'or',\n'pass',\n'raise',\n'return',\n'try',\n'while',\n'with',\n'yield'\n]\n\nsoftkwlist=[\n'_',\n'case',\n'match',\n'type'\n]\n\niskeyword=frozenset(kwlist).__contains__\nissoftkeyword=frozenset(softkwlist).__contains__\n", []], "linecache": [".py", "''\n\n\n\n\n\n\nimport functools\nimport sys\nimport os\nimport tokenize\n\n__all__=[\"getline\",\"clearcache\",\"checkcache\",\"lazycache\"]\n\n\n\n\ncache={}\n\n\ndef clearcache():\n ''\n cache.clear()\n \n \ndef getline(filename,lineno,module_globals=None ):\n ''\n \n \n lines=getlines(filename,module_globals)\n if 1 <=lineno <=len(lines):\n return lines[lineno -1]\n return ''\n \n \ndef getlines(filename,module_globals=None ):\n ''\n \n \n if filename in cache:\n entry=cache[filename]\n if len(entry)!=1:\n return cache[filename][2]\n \n try :\n return updatecache(filename,module_globals)\n except MemoryError:\n clearcache()\n return []\n \n \ndef checkcache(filename=None ):\n ''\n \n \n if filename is None :\n filenames=list(cache.keys())\n elif filename in cache:\n filenames=[filename]\n else :\n return\n \n for filename in filenames:\n entry=cache[filename]\n if len(entry)==1:\n \n continue\n size,mtime,lines,fullname=entry\n if mtime is None :\n continue\n try :\n stat=os.stat(fullname)\n except OSError:\n cache.pop(filename,None )\n continue\n if size !=stat.st_size or mtime !=stat.st_mtime:\n cache.pop(filename,None )\n \n \ndef updatecache(filename,module_globals=None ):\n ''\n\n \n \n if filename in cache:\n if len(cache[filename])!=1:\n cache.pop(filename,None )\n if not filename or (filename.startswith('<')and filename.endswith('>')):\n return []\n \n fullname=filename\n try :\n stat=os.stat(fullname)\n except OSError:\n basename=filename\n \n \n \n if lazycache(filename,module_globals):\n try :\n data=cache[filename][0]()\n except (ImportError,OSError):\n pass\n else :\n if data is None :\n \n \n return []\n cache[filename]=(\n len(data),\n None ,\n [line+'\\n'for line in data.splitlines()],\n fullname\n )\n return cache[filename][2]\n \n \n \n if os.path.isabs(filename):\n return []\n \n for dirname in sys.path:\n try :\n fullname=os.path.join(dirname,basename)\n except (TypeError,AttributeError):\n \n continue\n try :\n stat=os.stat(fullname)\n break\n except OSError:\n pass\n else :\n return []\n try :\n with tokenize.open(fullname)as fp:\n lines=fp.readlines()\n except (OSError,UnicodeDecodeError,SyntaxError):\n return []\n if lines and not lines[-1].endswith('\\n'):\n lines[-1]+='\\n'\n size,mtime=stat.st_size,stat.st_mtime\n cache[filename]=size,mtime,lines,fullname\n return lines\n \n \ndef lazycache(filename,module_globals):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if filename in cache:\n if len(cache[filename])==1:\n return True\n else :\n return False\n if not filename or (filename.startswith('<')and filename.endswith('>')):\n return False\n \n if module_globals and '__name__'in module_globals:\n name=module_globals['__name__']\n if (loader :=module_globals.get('__loader__'))is None :\n if spec :=module_globals.get('__spec__'):\n try :\n loader=spec.loader\n except AttributeError:\n pass\n get_source=getattr(loader,'get_source',None )\n \n if name and get_source:\n get_lines=functools.partial(get_source,name)\n cache[filename]=(get_lines,)\n return True\n return False\n", ["functools", "os", "sys", "tokenize"]], "locale": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\nimport sys\nimport encodings\nimport encodings.aliases\nimport re\nimport _collections_abc\nfrom builtins import str as _builtin_str\nimport functools\n\n\n\n\n\n\n\n__all__=[\"getlocale\",\"getdefaultlocale\",\"getpreferredencoding\",\"Error\",\n\"setlocale\",\"resetlocale\",\"localeconv\",\"strcoll\",\"strxfrm\",\n\"str\",\"atof\",\"atoi\",\"format_string\",\"currency\",\n\"normalize\",\"LC_CTYPE\",\"LC_COLLATE\",\"LC_TIME\",\"LC_MONETARY\",\n\"LC_NUMERIC\",\"LC_ALL\",\"CHAR_MAX\",\"getencoding\"]\n\ndef _strcoll(a,b):\n ''\n\n \n return(a >b)-(a .*?)\\))?'\nr'(?P[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]')\n\ndef _format(percent,value,grouping=False,monetary=False,*additional):\n if additional:\n formatted=percent %((value,)+additional)\n else:\n formatted=percent %value\n if percent[-1]in 'eEfFgGdiu':\n formatted=_localize(formatted,grouping,monetary)\n return formatted\n \n \ndef _localize(formatted,grouping=False,monetary=False):\n\n if '.'in formatted:\n seps=0\n parts=formatted.split('.')\n if grouping:\n parts[0],seps=_group(parts[0],monetary=monetary)\n decimal_point=localeconv()[monetary and 'mon_decimal_point'\n or 'decimal_point']\n formatted=decimal_point.join(parts)\n if seps:\n formatted=_strip_padding(formatted,seps)\n else:\n seps=0\n if grouping:\n formatted,seps=_group(formatted,monetary=monetary)\n if seps:\n formatted=_strip_padding(formatted,seps)\n return formatted\n \ndef format_string(f,val,grouping=False,monetary=False):\n ''\n\n\n\n\n \n percents=list(_percent_re.finditer(f))\n new_f=_percent_re.sub('%s',f)\n \n if isinstance(val,_collections_abc.Mapping):\n new_val=[]\n for perc in percents:\n if perc.group()[-1]=='%':\n new_val.append('%')\n else:\n new_val.append(_format(perc.group(),val,grouping,monetary))\n else:\n if not isinstance(val,tuple):\n val=(val,)\n new_val=[]\n i=0\n for perc in percents:\n if perc.group()[-1]=='%':\n new_val.append('%')\n else:\n starcount=perc.group('modifiers').count('*')\n new_val.append(_format(perc.group(),\n val[i],\n grouping,\n monetary,\n *val[i+1:i+1+starcount]))\n i +=(1+starcount)\n val=tuple(new_val)\n \n return new_f %val\n \ndef currency(val,symbol=True,grouping=False,international=False):\n ''\n \n conv=localeconv()\n \n \n digits=conv[international and 'int_frac_digits'or 'frac_digits']\n if digits ==127:\n raise ValueError(\"Currency formatting is not possible using \"\n \"the 'C' locale.\")\n \n s=_localize(f'{abs(val):.{digits}f}',grouping,monetary=True)\n \n s='<'+s+'>'\n \n if symbol:\n smb=conv[international and 'int_curr_symbol'or 'currency_symbol']\n precedes=conv[val <0 and 'n_cs_precedes'or 'p_cs_precedes']\n separated=conv[val <0 and 'n_sep_by_space'or 'p_sep_by_space']\n \n if precedes:\n s=smb+(separated and ' 'or '')+s\n else:\n if international and smb[-1]==' ':\n smb=smb[:-1]\n s=s+(separated and ' 'or '')+smb\n \n sign_pos=conv[val <0 and 'n_sign_posn'or 'p_sign_posn']\n sign=conv[val <0 and 'negative_sign'or 'positive_sign']\n \n if sign_pos ==0:\n s='('+s+')'\n elif sign_pos ==1:\n s=sign+s\n elif sign_pos ==2:\n s=s+sign\n elif sign_pos ==3:\n s=s.replace('<',sign)\n elif sign_pos ==4:\n s=s.replace('>',sign)\n else:\n \n \n s=sign+s\n \n return s.replace('<','').replace('>','')\n \ndef str(val):\n ''\n return _format(\"%.12g\",val)\n \ndef delocalize(string):\n ''\n \n conv=localeconv()\n \n \n ts=conv['thousands_sep']\n if ts:\n string=string.replace(ts,'')\n \n \n dd=conv['decimal_point']\n if dd:\n string=string.replace(dd,'.')\n return string\n \ndef localize(string,grouping=False,monetary=False):\n ''\n return _localize(string,grouping,monetary)\n \ndef atof(string,func=float):\n ''\n return func(delocalize(string))\n \ndef atoi(string):\n ''\n return int(delocalize(string))\n \ndef _test():\n setlocale(LC_ALL,\"\")\n \n s1=format_string(\"%d\",123456789,1)\n print(s1,\"is\",atoi(s1))\n \n s1=str(3.14)\n print(s1,\"is\",atof(s1))\n \n \n \n \n \n \n \n \n_setlocale=setlocale\n\ndef _replace_encoding(code,encoding):\n if '.'in code:\n langname=code[:code.index('.')]\n else:\n langname=code\n \n norm_encoding=encodings.normalize_encoding(encoding)\n \n norm_encoding=encodings.aliases.aliases.get(norm_encoding.lower(),\n norm_encoding)\n \n encoding=norm_encoding\n norm_encoding=norm_encoding.lower()\n if norm_encoding in locale_encoding_alias:\n encoding=locale_encoding_alias[norm_encoding]\n else:\n norm_encoding=norm_encoding.replace('_','')\n norm_encoding=norm_encoding.replace('-','')\n if norm_encoding in locale_encoding_alias:\n encoding=locale_encoding_alias[norm_encoding]\n \n return langname+'.'+encoding\n \ndef _append_modifier(code,modifier):\n if modifier =='euro':\n if '.'not in code:\n return code+'.ISO8859-15'\n _,_,encoding=code.partition('.')\n if encoding in('ISO8859-15','UTF-8'):\n return code\n if encoding =='ISO8859-1':\n return _replace_encoding(code,'ISO8859-15')\n return code+'@'+modifier\n \ndef normalize(localename):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n code=localename.lower()\n if ':'in code:\n \n code=code.replace(':','.')\n if '@'in code:\n code,modifier=code.split('@',1)\n else:\n modifier=''\n if '.'in code:\n langname,encoding=code.split('.')[:2]\n else:\n langname=code\n encoding=''\n \n \n lang_enc=langname\n if encoding:\n norm_encoding=encoding.replace('-','')\n norm_encoding=norm_encoding.replace('_','')\n lang_enc +='.'+norm_encoding\n lookup_name=lang_enc\n if modifier:\n lookup_name +='@'+modifier\n code=locale_alias.get(lookup_name,None)\n if code is not None:\n return code\n \n \n if modifier:\n \n code=locale_alias.get(lang_enc,None)\n if code is not None:\n \n if '@'not in code:\n return _append_modifier(code,modifier)\n if code.split('@',1)[1].lower()==modifier:\n return code\n \n \n if encoding:\n \n lookup_name=langname\n if modifier:\n lookup_name +='@'+modifier\n code=locale_alias.get(lookup_name,None)\n if code is not None:\n \n if '@'not in code:\n return _replace_encoding(code,encoding)\n code,modifier=code.split('@',1)\n return _replace_encoding(code,encoding)+'@'+modifier\n \n if modifier:\n \n code=locale_alias.get(langname,None)\n if code is not None:\n \n if '@'not in code:\n code=_replace_encoding(code,encoding)\n return _append_modifier(code,modifier)\n code,defmod=code.split('@',1)\n if defmod.lower()==modifier:\n return _replace_encoding(code,encoding)+'@'+defmod\n \n return localename\n \ndef _parse_localename(localename):\n\n ''\n\n\n\n\n\n\n\n\n\n\n \n code=normalize(localename)\n if '@'in code:\n \n code,modifier=code.split('@',1)\n if modifier =='euro'and '.'not in code:\n \n \n \n return code,'iso-8859-15'\n \n if '.'in code:\n return tuple(code.split('.')[:2])\n elif code =='C':\n return None,None\n elif code =='UTF-8':\n \n \n return None,'UTF-8'\n raise ValueError('unknown locale: %s'%localename)\n \ndef _build_localename(localetuple):\n\n ''\n\n\n\n\n \n try:\n language,encoding=localetuple\n \n if language is None:\n language='C'\n if encoding is None:\n return language\n else:\n return language+'.'+encoding\n except(TypeError,ValueError):\n raise TypeError('Locale must be None, a string, or an iterable of '\n 'two strings -- language code, encoding.')from None\n \ndef getdefaultlocale(envvars=('LC_ALL','LC_CTYPE','LANG','LANGUAGE')):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n import warnings\n warnings.warn(\n \"Use setlocale(), getencoding() and getlocale() instead\",\n DeprecationWarning,stacklevel=2\n )\n return _getdefaultlocale(envvars)\n \ndef _getdefaultlocale(envvars=('LC_ALL','LC_CTYPE','LANG','LANGUAGE')):\n try:\n \n import _locale\n code,encoding=_locale._getdefaultlocale()\n except(ImportError,AttributeError):\n pass\n else:\n \n if sys.platform ==\"win32\"and code and code[:2]==\"0x\":\n \n code=windows_locale.get(int(code,0))\n \n \n return code,encoding\n \n \n import os\n lookup=os.environ.get\n for variable in envvars:\n localename=lookup(variable,None)\n if localename:\n if variable =='LANGUAGE':\n localename=localename.split(':')[0]\n break\n else:\n localename='C'\n return _parse_localename(localename)\n \n \ndef getlocale(category=LC_CTYPE):\n\n ''\n\n\n\n\n\n\n\n\n\n \n localename=_setlocale(category)\n if category ==LC_ALL and ';'in localename:\n raise TypeError('category LC_ALL is not supported')\n return _parse_localename(localename)\n \ndef setlocale(category,locale=None):\n\n ''\n\n\n\n\n\n\n\n\n \n if locale and not isinstance(locale,_builtin_str):\n \n locale=normalize(_build_localename(locale))\n return _setlocale(category,locale)\n \ndef resetlocale(category=LC_ALL):\n\n ''\n\n\n\n\n \n import warnings\n warnings.warn(\n 'Use locale.setlocale(locale.LC_ALL, \"\") instead',\n DeprecationWarning,stacklevel=2\n )\n \n with warnings.catch_warnings():\n warnings.simplefilter('ignore',category=DeprecationWarning)\n loc=getdefaultlocale()\n \n _setlocale(category,_build_localename(loc))\n \n \ntry:\n from _locale import getencoding\nexcept ImportError:\n def getencoding():\n if hasattr(sys,'getandroidapilevel'):\n \n \n return 'utf-8'\n encoding=_getdefaultlocale()[1]\n if encoding is None:\n \n encoding='utf-8'\n return encoding\n \ntry:\n CODESET\nexcept NameError:\n def getpreferredencoding(do_setlocale=True):\n ''\n if sys.flags.warn_default_encoding:\n import warnings\n warnings.warn(\n \"UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.\",\n EncodingWarning,2)\n if sys.flags.utf8_mode:\n return 'utf-8'\n return getencoding()\nelse:\n\n def getpreferredencoding(do_setlocale=True):\n ''\n \n \n if sys.flags.warn_default_encoding:\n import warnings\n warnings.warn(\n \"UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.\",\n EncodingWarning,2)\n if sys.flags.utf8_mode:\n return 'utf-8'\n \n if not do_setlocale:\n return getencoding()\n \n old_loc=setlocale(LC_CTYPE)\n try:\n try:\n setlocale(LC_CTYPE,\"\")\n except Error:\n pass\n return getencoding()\n finally:\n setlocale(LC_CTYPE,old_loc)\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \nlocale_encoding_alias={\n\n\n'437':'C',\n'c':'C',\n'en':'ISO8859-1',\n'jis':'JIS7',\n'jis7':'JIS7',\n'ajec':'eucJP',\n'koi8c':'KOI8-C',\n'microsoftcp1251':'CP1251',\n'microsoftcp1255':'CP1255',\n'microsoftcp1256':'CP1256',\n'88591':'ISO8859-1',\n'88592':'ISO8859-2',\n'88595':'ISO8859-5',\n'885915':'ISO8859-15',\n\n\n'ascii':'ISO8859-1',\n'latin_1':'ISO8859-1',\n'iso8859_1':'ISO8859-1',\n'iso8859_10':'ISO8859-10',\n'iso8859_11':'ISO8859-11',\n'iso8859_13':'ISO8859-13',\n'iso8859_14':'ISO8859-14',\n'iso8859_15':'ISO8859-15',\n'iso8859_16':'ISO8859-16',\n'iso8859_2':'ISO8859-2',\n'iso8859_3':'ISO8859-3',\n'iso8859_4':'ISO8859-4',\n'iso8859_5':'ISO8859-5',\n'iso8859_6':'ISO8859-6',\n'iso8859_7':'ISO8859-7',\n'iso8859_8':'ISO8859-8',\n'iso8859_9':'ISO8859-9',\n'iso2022_jp':'JIS7',\n'shift_jis':'SJIS',\n'tactis':'TACTIS',\n'euc_jp':'eucJP',\n'euc_kr':'eucKR',\n'utf_8':'UTF-8',\n'koi8_r':'KOI8-R',\n'koi8_t':'KOI8-T',\n'koi8_u':'KOI8-U',\n'kz1048':'RK1048',\n'cp1251':'CP1251',\n'cp1255':'CP1255',\n'cp1256':'CP1256',\n\n\n\n}\n\nfor k,v in sorted(locale_encoding_alias.items()):\n k=k.replace('_','')\n locale_encoding_alias.setdefault(k,v)\ndel k,v\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nlocale_alias={\n'a3':'az_AZ.KOI8-C',\n'a3_az':'az_AZ.KOI8-C',\n'a3_az.koic':'az_AZ.KOI8-C',\n'aa_dj':'aa_DJ.ISO8859-1',\n'aa_er':'aa_ER.UTF-8',\n'aa_et':'aa_ET.UTF-8',\n'af':'af_ZA.ISO8859-1',\n'af_za':'af_ZA.ISO8859-1',\n'agr_pe':'agr_PE.UTF-8',\n'ak_gh':'ak_GH.UTF-8',\n'am':'am_ET.UTF-8',\n'am_et':'am_ET.UTF-8',\n'american':'en_US.ISO8859-1',\n'an_es':'an_ES.ISO8859-15',\n'anp_in':'anp_IN.UTF-8',\n'ar':'ar_AA.ISO8859-6',\n'ar_aa':'ar_AA.ISO8859-6',\n'ar_ae':'ar_AE.ISO8859-6',\n'ar_bh':'ar_BH.ISO8859-6',\n'ar_dz':'ar_DZ.ISO8859-6',\n'ar_eg':'ar_EG.ISO8859-6',\n'ar_in':'ar_IN.UTF-8',\n'ar_iq':'ar_IQ.ISO8859-6',\n'ar_jo':'ar_JO.ISO8859-6',\n'ar_kw':'ar_KW.ISO8859-6',\n'ar_lb':'ar_LB.ISO8859-6',\n'ar_ly':'ar_LY.ISO8859-6',\n'ar_ma':'ar_MA.ISO8859-6',\n'ar_om':'ar_OM.ISO8859-6',\n'ar_qa':'ar_QA.ISO8859-6',\n'ar_sa':'ar_SA.ISO8859-6',\n'ar_sd':'ar_SD.ISO8859-6',\n'ar_ss':'ar_SS.UTF-8',\n'ar_sy':'ar_SY.ISO8859-6',\n'ar_tn':'ar_TN.ISO8859-6',\n'ar_ye':'ar_YE.ISO8859-6',\n'arabic':'ar_AA.ISO8859-6',\n'as':'as_IN.UTF-8',\n'as_in':'as_IN.UTF-8',\n'ast_es':'ast_ES.ISO8859-15',\n'ayc_pe':'ayc_PE.UTF-8',\n'az':'az_AZ.ISO8859-9E',\n'az_az':'az_AZ.ISO8859-9E',\n'az_az.iso88599e':'az_AZ.ISO8859-9E',\n'az_ir':'az_IR.UTF-8',\n'be':'be_BY.CP1251',\n'be@latin':'be_BY.UTF-8@latin',\n'be_bg.utf8':'bg_BG.UTF-8',\n'be_by':'be_BY.CP1251',\n'be_by@latin':'be_BY.UTF-8@latin',\n'bem_zm':'bem_ZM.UTF-8',\n'ber_dz':'ber_DZ.UTF-8',\n'ber_ma':'ber_MA.UTF-8',\n'bg':'bg_BG.CP1251',\n'bg_bg':'bg_BG.CP1251',\n'bhb_in.utf8':'bhb_IN.UTF-8',\n'bho_in':'bho_IN.UTF-8',\n'bho_np':'bho_NP.UTF-8',\n'bi_vu':'bi_VU.UTF-8',\n'bn_bd':'bn_BD.UTF-8',\n'bn_in':'bn_IN.UTF-8',\n'bo_cn':'bo_CN.UTF-8',\n'bo_in':'bo_IN.UTF-8',\n'bokmal':'nb_NO.ISO8859-1',\n'bokm\\xe5l':'nb_NO.ISO8859-1',\n'br':'br_FR.ISO8859-1',\n'br_fr':'br_FR.ISO8859-1',\n'brx_in':'brx_IN.UTF-8',\n'bs':'bs_BA.ISO8859-2',\n'bs_ba':'bs_BA.ISO8859-2',\n'bulgarian':'bg_BG.CP1251',\n'byn_er':'byn_ER.UTF-8',\n'c':'C',\n'c-french':'fr_CA.ISO8859-1',\n'c.ascii':'C',\n'c.en':'C',\n'c.iso88591':'en_US.ISO8859-1',\n'c.utf8':'C.UTF-8',\n'c_c':'C',\n'c_c.c':'C',\n'ca':'ca_ES.ISO8859-1',\n'ca_ad':'ca_AD.ISO8859-1',\n'ca_es':'ca_ES.ISO8859-1',\n'ca_es@valencia':'ca_ES.UTF-8@valencia',\n'ca_fr':'ca_FR.ISO8859-1',\n'ca_it':'ca_IT.ISO8859-1',\n'catalan':'ca_ES.ISO8859-1',\n'ce_ru':'ce_RU.UTF-8',\n'cextend':'en_US.ISO8859-1',\n'chinese-s':'zh_CN.eucCN',\n'chinese-t':'zh_TW.eucTW',\n'chr_us':'chr_US.UTF-8',\n'ckb_iq':'ckb_IQ.UTF-8',\n'cmn_tw':'cmn_TW.UTF-8',\n'crh_ua':'crh_UA.UTF-8',\n'croatian':'hr_HR.ISO8859-2',\n'cs':'cs_CZ.ISO8859-2',\n'cs_cs':'cs_CZ.ISO8859-2',\n'cs_cz':'cs_CZ.ISO8859-2',\n'csb_pl':'csb_PL.UTF-8',\n'cv_ru':'cv_RU.UTF-8',\n'cy':'cy_GB.ISO8859-1',\n'cy_gb':'cy_GB.ISO8859-1',\n'cz':'cs_CZ.ISO8859-2',\n'cz_cz':'cs_CZ.ISO8859-2',\n'czech':'cs_CZ.ISO8859-2',\n'da':'da_DK.ISO8859-1',\n'da_dk':'da_DK.ISO8859-1',\n'danish':'da_DK.ISO8859-1',\n'dansk':'da_DK.ISO8859-1',\n'de':'de_DE.ISO8859-1',\n'de_at':'de_AT.ISO8859-1',\n'de_be':'de_BE.ISO8859-1',\n'de_ch':'de_CH.ISO8859-1',\n'de_de':'de_DE.ISO8859-1',\n'de_it':'de_IT.ISO8859-1',\n'de_li.utf8':'de_LI.UTF-8',\n'de_lu':'de_LU.ISO8859-1',\n'deutsch':'de_DE.ISO8859-1',\n'doi_in':'doi_IN.UTF-8',\n'dutch':'nl_NL.ISO8859-1',\n'dutch.iso88591':'nl_BE.ISO8859-1',\n'dv_mv':'dv_MV.UTF-8',\n'dz_bt':'dz_BT.UTF-8',\n'ee':'ee_EE.ISO8859-4',\n'ee_ee':'ee_EE.ISO8859-4',\n'eesti':'et_EE.ISO8859-1',\n'el':'el_GR.ISO8859-7',\n'el_cy':'el_CY.ISO8859-7',\n'el_gr':'el_GR.ISO8859-7',\n'el_gr@euro':'el_GR.ISO8859-15',\n'en':'en_US.ISO8859-1',\n'en_ag':'en_AG.UTF-8',\n'en_au':'en_AU.ISO8859-1',\n'en_be':'en_BE.ISO8859-1',\n'en_bw':'en_BW.ISO8859-1',\n'en_ca':'en_CA.ISO8859-1',\n'en_dk':'en_DK.ISO8859-1',\n'en_dl.utf8':'en_DL.UTF-8',\n'en_gb':'en_GB.ISO8859-1',\n'en_hk':'en_HK.ISO8859-1',\n'en_ie':'en_IE.ISO8859-1',\n'en_il':'en_IL.UTF-8',\n'en_in':'en_IN.ISO8859-1',\n'en_ng':'en_NG.UTF-8',\n'en_nz':'en_NZ.ISO8859-1',\n'en_ph':'en_PH.ISO8859-1',\n'en_sc.utf8':'en_SC.UTF-8',\n'en_sg':'en_SG.ISO8859-1',\n'en_uk':'en_GB.ISO8859-1',\n'en_us':'en_US.ISO8859-1',\n'en_us@euro@euro':'en_US.ISO8859-15',\n'en_za':'en_ZA.ISO8859-1',\n'en_zm':'en_ZM.UTF-8',\n'en_zw':'en_ZW.ISO8859-1',\n'en_zw.utf8':'en_ZS.UTF-8',\n'eng_gb':'en_GB.ISO8859-1',\n'english':'en_EN.ISO8859-1',\n'english.iso88591':'en_US.ISO8859-1',\n'english_uk':'en_GB.ISO8859-1',\n'english_united-states':'en_US.ISO8859-1',\n'english_united-states.437':'C',\n'english_us':'en_US.ISO8859-1',\n'eo':'eo_XX.ISO8859-3',\n'eo.utf8':'eo.UTF-8',\n'eo_eo':'eo_EO.ISO8859-3',\n'eo_us.utf8':'eo_US.UTF-8',\n'eo_xx':'eo_XX.ISO8859-3',\n'es':'es_ES.ISO8859-1',\n'es_ar':'es_AR.ISO8859-1',\n'es_bo':'es_BO.ISO8859-1',\n'es_cl':'es_CL.ISO8859-1',\n'es_co':'es_CO.ISO8859-1',\n'es_cr':'es_CR.ISO8859-1',\n'es_cu':'es_CU.UTF-8',\n'es_do':'es_DO.ISO8859-1',\n'es_ec':'es_EC.ISO8859-1',\n'es_es':'es_ES.ISO8859-1',\n'es_gt':'es_GT.ISO8859-1',\n'es_hn':'es_HN.ISO8859-1',\n'es_mx':'es_MX.ISO8859-1',\n'es_ni':'es_NI.ISO8859-1',\n'es_pa':'es_PA.ISO8859-1',\n'es_pe':'es_PE.ISO8859-1',\n'es_pr':'es_PR.ISO8859-1',\n'es_py':'es_PY.ISO8859-1',\n'es_sv':'es_SV.ISO8859-1',\n'es_us':'es_US.ISO8859-1',\n'es_uy':'es_UY.ISO8859-1',\n'es_ve':'es_VE.ISO8859-1',\n'estonian':'et_EE.ISO8859-1',\n'et':'et_EE.ISO8859-15',\n'et_ee':'et_EE.ISO8859-15',\n'eu':'eu_ES.ISO8859-1',\n'eu_es':'eu_ES.ISO8859-1',\n'eu_fr':'eu_FR.ISO8859-1',\n'fa':'fa_IR.UTF-8',\n'fa_ir':'fa_IR.UTF-8',\n'fa_ir.isiri3342':'fa_IR.ISIRI-3342',\n'ff_sn':'ff_SN.UTF-8',\n'fi':'fi_FI.ISO8859-15',\n'fi_fi':'fi_FI.ISO8859-15',\n'fil_ph':'fil_PH.UTF-8',\n'finnish':'fi_FI.ISO8859-1',\n'fo':'fo_FO.ISO8859-1',\n'fo_fo':'fo_FO.ISO8859-1',\n'fr':'fr_FR.ISO8859-1',\n'fr_be':'fr_BE.ISO8859-1',\n'fr_ca':'fr_CA.ISO8859-1',\n'fr_ch':'fr_CH.ISO8859-1',\n'fr_fr':'fr_FR.ISO8859-1',\n'fr_lu':'fr_LU.ISO8859-1',\n'fran\\xe7ais':'fr_FR.ISO8859-1',\n'fre_fr':'fr_FR.ISO8859-1',\n'french':'fr_FR.ISO8859-1',\n'french.iso88591':'fr_CH.ISO8859-1',\n'french_france':'fr_FR.ISO8859-1',\n'fur_it':'fur_IT.UTF-8',\n'fy_de':'fy_DE.UTF-8',\n'fy_nl':'fy_NL.UTF-8',\n'ga':'ga_IE.ISO8859-1',\n'ga_ie':'ga_IE.ISO8859-1',\n'galego':'gl_ES.ISO8859-1',\n'galician':'gl_ES.ISO8859-1',\n'gd':'gd_GB.ISO8859-1',\n'gd_gb':'gd_GB.ISO8859-1',\n'ger_de':'de_DE.ISO8859-1',\n'german':'de_DE.ISO8859-1',\n'german.iso88591':'de_CH.ISO8859-1',\n'german_germany':'de_DE.ISO8859-1',\n'gez_er':'gez_ER.UTF-8',\n'gez_et':'gez_ET.UTF-8',\n'gl':'gl_ES.ISO8859-1',\n'gl_es':'gl_ES.ISO8859-1',\n'greek':'el_GR.ISO8859-7',\n'gu_in':'gu_IN.UTF-8',\n'gv':'gv_GB.ISO8859-1',\n'gv_gb':'gv_GB.ISO8859-1',\n'ha_ng':'ha_NG.UTF-8',\n'hak_tw':'hak_TW.UTF-8',\n'he':'he_IL.ISO8859-8',\n'he_il':'he_IL.ISO8859-8',\n'hebrew':'he_IL.ISO8859-8',\n'hi':'hi_IN.ISCII-DEV',\n'hi_in':'hi_IN.ISCII-DEV',\n'hi_in.isciidev':'hi_IN.ISCII-DEV',\n'hif_fj':'hif_FJ.UTF-8',\n'hne':'hne_IN.UTF-8',\n'hne_in':'hne_IN.UTF-8',\n'hr':'hr_HR.ISO8859-2',\n'hr_hr':'hr_HR.ISO8859-2',\n'hrvatski':'hr_HR.ISO8859-2',\n'hsb_de':'hsb_DE.ISO8859-2',\n'ht_ht':'ht_HT.UTF-8',\n'hu':'hu_HU.ISO8859-2',\n'hu_hu':'hu_HU.ISO8859-2',\n'hungarian':'hu_HU.ISO8859-2',\n'hy_am':'hy_AM.UTF-8',\n'hy_am.armscii8':'hy_AM.ARMSCII_8',\n'ia':'ia.UTF-8',\n'ia_fr':'ia_FR.UTF-8',\n'icelandic':'is_IS.ISO8859-1',\n'id':'id_ID.ISO8859-1',\n'id_id':'id_ID.ISO8859-1',\n'ig_ng':'ig_NG.UTF-8',\n'ik_ca':'ik_CA.UTF-8',\n'in':'id_ID.ISO8859-1',\n'in_id':'id_ID.ISO8859-1',\n'is':'is_IS.ISO8859-1',\n'is_is':'is_IS.ISO8859-1',\n'iso-8859-1':'en_US.ISO8859-1',\n'iso-8859-15':'en_US.ISO8859-15',\n'iso8859-1':'en_US.ISO8859-1',\n'iso8859-15':'en_US.ISO8859-15',\n'iso_8859_1':'en_US.ISO8859-1',\n'iso_8859_15':'en_US.ISO8859-15',\n'it':'it_IT.ISO8859-1',\n'it_ch':'it_CH.ISO8859-1',\n'it_it':'it_IT.ISO8859-1',\n'italian':'it_IT.ISO8859-1',\n'iu':'iu_CA.NUNACOM-8',\n'iu_ca':'iu_CA.NUNACOM-8',\n'iu_ca.nunacom8':'iu_CA.NUNACOM-8',\n'iw':'he_IL.ISO8859-8',\n'iw_il':'he_IL.ISO8859-8',\n'iw_il.utf8':'iw_IL.UTF-8',\n'ja':'ja_JP.eucJP',\n'ja_jp':'ja_JP.eucJP',\n'ja_jp.euc':'ja_JP.eucJP',\n'ja_jp.mscode':'ja_JP.SJIS',\n'ja_jp.pck':'ja_JP.SJIS',\n'japan':'ja_JP.eucJP',\n'japanese':'ja_JP.eucJP',\n'japanese-euc':'ja_JP.eucJP',\n'japanese.euc':'ja_JP.eucJP',\n'jp_jp':'ja_JP.eucJP',\n'ka':'ka_GE.GEORGIAN-ACADEMY',\n'ka_ge':'ka_GE.GEORGIAN-ACADEMY',\n'ka_ge.georgianacademy':'ka_GE.GEORGIAN-ACADEMY',\n'ka_ge.georgianps':'ka_GE.GEORGIAN-PS',\n'ka_ge.georgianrs':'ka_GE.GEORGIAN-ACADEMY',\n'kab_dz':'kab_DZ.UTF-8',\n'kk_kz':'kk_KZ.ptcp154',\n'kl':'kl_GL.ISO8859-1',\n'kl_gl':'kl_GL.ISO8859-1',\n'km_kh':'km_KH.UTF-8',\n'kn':'kn_IN.UTF-8',\n'kn_in':'kn_IN.UTF-8',\n'ko':'ko_KR.eucKR',\n'ko_kr':'ko_KR.eucKR',\n'ko_kr.euc':'ko_KR.eucKR',\n'kok_in':'kok_IN.UTF-8',\n'korean':'ko_KR.eucKR',\n'korean.euc':'ko_KR.eucKR',\n'ks':'ks_IN.UTF-8',\n'ks_in':'ks_IN.UTF-8',\n'ks_in@devanagari.utf8':'ks_IN.UTF-8@devanagari',\n'ku_tr':'ku_TR.ISO8859-9',\n'kw':'kw_GB.ISO8859-1',\n'kw_gb':'kw_GB.ISO8859-1',\n'ky':'ky_KG.UTF-8',\n'ky_kg':'ky_KG.UTF-8',\n'lb_lu':'lb_LU.UTF-8',\n'lg_ug':'lg_UG.ISO8859-10',\n'li_be':'li_BE.UTF-8',\n'li_nl':'li_NL.UTF-8',\n'lij_it':'lij_IT.UTF-8',\n'lithuanian':'lt_LT.ISO8859-13',\n'ln_cd':'ln_CD.UTF-8',\n'lo':'lo_LA.MULELAO-1',\n'lo_la':'lo_LA.MULELAO-1',\n'lo_la.cp1133':'lo_LA.IBM-CP1133',\n'lo_la.ibmcp1133':'lo_LA.IBM-CP1133',\n'lo_la.mulelao1':'lo_LA.MULELAO-1',\n'lt':'lt_LT.ISO8859-13',\n'lt_lt':'lt_LT.ISO8859-13',\n'lv':'lv_LV.ISO8859-13',\n'lv_lv':'lv_LV.ISO8859-13',\n'lzh_tw':'lzh_TW.UTF-8',\n'mag_in':'mag_IN.UTF-8',\n'mai':'mai_IN.UTF-8',\n'mai_in':'mai_IN.UTF-8',\n'mai_np':'mai_NP.UTF-8',\n'mfe_mu':'mfe_MU.UTF-8',\n'mg_mg':'mg_MG.ISO8859-15',\n'mhr_ru':'mhr_RU.UTF-8',\n'mi':'mi_NZ.ISO8859-1',\n'mi_nz':'mi_NZ.ISO8859-1',\n'miq_ni':'miq_NI.UTF-8',\n'mjw_in':'mjw_IN.UTF-8',\n'mk':'mk_MK.ISO8859-5',\n'mk_mk':'mk_MK.ISO8859-5',\n'ml':'ml_IN.UTF-8',\n'ml_in':'ml_IN.UTF-8',\n'mn_mn':'mn_MN.UTF-8',\n'mni_in':'mni_IN.UTF-8',\n'mr':'mr_IN.UTF-8',\n'mr_in':'mr_IN.UTF-8',\n'ms':'ms_MY.ISO8859-1',\n'ms_my':'ms_MY.ISO8859-1',\n'mt':'mt_MT.ISO8859-3',\n'mt_mt':'mt_MT.ISO8859-3',\n'my_mm':'my_MM.UTF-8',\n'nan_tw':'nan_TW.UTF-8',\n'nb':'nb_NO.ISO8859-1',\n'nb_no':'nb_NO.ISO8859-1',\n'nds_de':'nds_DE.UTF-8',\n'nds_nl':'nds_NL.UTF-8',\n'ne_np':'ne_NP.UTF-8',\n'nhn_mx':'nhn_MX.UTF-8',\n'niu_nu':'niu_NU.UTF-8',\n'niu_nz':'niu_NZ.UTF-8',\n'nl':'nl_NL.ISO8859-1',\n'nl_aw':'nl_AW.UTF-8',\n'nl_be':'nl_BE.ISO8859-1',\n'nl_nl':'nl_NL.ISO8859-1',\n'nn':'nn_NO.ISO8859-1',\n'nn_no':'nn_NO.ISO8859-1',\n'no':'no_NO.ISO8859-1',\n'no@nynorsk':'ny_NO.ISO8859-1',\n'no_no':'no_NO.ISO8859-1',\n'no_no.iso88591@bokmal':'no_NO.ISO8859-1',\n'no_no.iso88591@nynorsk':'no_NO.ISO8859-1',\n'norwegian':'no_NO.ISO8859-1',\n'nr':'nr_ZA.ISO8859-1',\n'nr_za':'nr_ZA.ISO8859-1',\n'nso':'nso_ZA.ISO8859-15',\n'nso_za':'nso_ZA.ISO8859-15',\n'ny':'ny_NO.ISO8859-1',\n'ny_no':'ny_NO.ISO8859-1',\n'nynorsk':'nn_NO.ISO8859-1',\n'oc':'oc_FR.ISO8859-1',\n'oc_fr':'oc_FR.ISO8859-1',\n'om_et':'om_ET.UTF-8',\n'om_ke':'om_KE.ISO8859-1',\n'or':'or_IN.UTF-8',\n'or_in':'or_IN.UTF-8',\n'os_ru':'os_RU.UTF-8',\n'pa':'pa_IN.UTF-8',\n'pa_in':'pa_IN.UTF-8',\n'pa_pk':'pa_PK.UTF-8',\n'pap_an':'pap_AN.UTF-8',\n'pap_aw':'pap_AW.UTF-8',\n'pap_cw':'pap_CW.UTF-8',\n'pd':'pd_US.ISO8859-1',\n'pd_de':'pd_DE.ISO8859-1',\n'pd_us':'pd_US.ISO8859-1',\n'ph':'ph_PH.ISO8859-1',\n'ph_ph':'ph_PH.ISO8859-1',\n'pl':'pl_PL.ISO8859-2',\n'pl_pl':'pl_PL.ISO8859-2',\n'polish':'pl_PL.ISO8859-2',\n'portuguese':'pt_PT.ISO8859-1',\n'portuguese_brazil':'pt_BR.ISO8859-1',\n'posix':'C',\n'posix-utf2':'C',\n'pp':'pp_AN.ISO8859-1',\n'pp_an':'pp_AN.ISO8859-1',\n'ps_af':'ps_AF.UTF-8',\n'pt':'pt_PT.ISO8859-1',\n'pt_br':'pt_BR.ISO8859-1',\n'pt_pt':'pt_PT.ISO8859-1',\n'quz_pe':'quz_PE.UTF-8',\n'raj_in':'raj_IN.UTF-8',\n'ro':'ro_RO.ISO8859-2',\n'ro_ro':'ro_RO.ISO8859-2',\n'romanian':'ro_RO.ISO8859-2',\n'ru':'ru_RU.UTF-8',\n'ru_ru':'ru_RU.UTF-8',\n'ru_ua':'ru_UA.KOI8-U',\n'rumanian':'ro_RO.ISO8859-2',\n'russian':'ru_RU.KOI8-R',\n'rw':'rw_RW.ISO8859-1',\n'rw_rw':'rw_RW.ISO8859-1',\n'sa_in':'sa_IN.UTF-8',\n'sat_in':'sat_IN.UTF-8',\n'sc_it':'sc_IT.UTF-8',\n'sd':'sd_IN.UTF-8',\n'sd_in':'sd_IN.UTF-8',\n'sd_in@devanagari.utf8':'sd_IN.UTF-8@devanagari',\n'sd_pk':'sd_PK.UTF-8',\n'se_no':'se_NO.UTF-8',\n'serbocroatian':'sr_RS.UTF-8@latin',\n'sgs_lt':'sgs_LT.UTF-8',\n'sh':'sr_RS.UTF-8@latin',\n'sh_ba.iso88592@bosnia':'sr_CS.ISO8859-2',\n'sh_hr':'sh_HR.ISO8859-2',\n'sh_hr.iso88592':'hr_HR.ISO8859-2',\n'sh_sp':'sr_CS.ISO8859-2',\n'sh_yu':'sr_RS.UTF-8@latin',\n'shn_mm':'shn_MM.UTF-8',\n'shs_ca':'shs_CA.UTF-8',\n'si':'si_LK.UTF-8',\n'si_lk':'si_LK.UTF-8',\n'sid_et':'sid_ET.UTF-8',\n'sinhala':'si_LK.UTF-8',\n'sk':'sk_SK.ISO8859-2',\n'sk_sk':'sk_SK.ISO8859-2',\n'sl':'sl_SI.ISO8859-2',\n'sl_cs':'sl_CS.ISO8859-2',\n'sl_si':'sl_SI.ISO8859-2',\n'slovak':'sk_SK.ISO8859-2',\n'slovene':'sl_SI.ISO8859-2',\n'slovenian':'sl_SI.ISO8859-2',\n'sm_ws':'sm_WS.UTF-8',\n'so_dj':'so_DJ.ISO8859-1',\n'so_et':'so_ET.UTF-8',\n'so_ke':'so_KE.ISO8859-1',\n'so_so':'so_SO.ISO8859-1',\n'sp':'sr_CS.ISO8859-5',\n'sp_yu':'sr_CS.ISO8859-5',\n'spanish':'es_ES.ISO8859-1',\n'spanish_spain':'es_ES.ISO8859-1',\n'sq':'sq_AL.ISO8859-2',\n'sq_al':'sq_AL.ISO8859-2',\n'sq_mk':'sq_MK.UTF-8',\n'sr':'sr_RS.UTF-8',\n'sr@cyrillic':'sr_RS.UTF-8',\n'sr@latn':'sr_CS.UTF-8@latin',\n'sr_cs':'sr_CS.UTF-8',\n'sr_cs.iso88592@latn':'sr_CS.ISO8859-2',\n'sr_cs@latn':'sr_CS.UTF-8@latin',\n'sr_me':'sr_ME.UTF-8',\n'sr_rs':'sr_RS.UTF-8',\n'sr_rs@latn':'sr_RS.UTF-8@latin',\n'sr_sp':'sr_CS.ISO8859-2',\n'sr_yu':'sr_RS.UTF-8@latin',\n'sr_yu.cp1251@cyrillic':'sr_CS.CP1251',\n'sr_yu.iso88592':'sr_CS.ISO8859-2',\n'sr_yu.iso88595':'sr_CS.ISO8859-5',\n'sr_yu.iso88595@cyrillic':'sr_CS.ISO8859-5',\n'sr_yu.microsoftcp1251@cyrillic':'sr_CS.CP1251',\n'sr_yu.utf8':'sr_RS.UTF-8',\n'sr_yu.utf8@cyrillic':'sr_RS.UTF-8',\n'sr_yu@cyrillic':'sr_RS.UTF-8',\n'ss':'ss_ZA.ISO8859-1',\n'ss_za':'ss_ZA.ISO8859-1',\n'st':'st_ZA.ISO8859-1',\n'st_za':'st_ZA.ISO8859-1',\n'sv':'sv_SE.ISO8859-1',\n'sv_fi':'sv_FI.ISO8859-1',\n'sv_se':'sv_SE.ISO8859-1',\n'sw_ke':'sw_KE.UTF-8',\n'sw_tz':'sw_TZ.UTF-8',\n'swedish':'sv_SE.ISO8859-1',\n'szl_pl':'szl_PL.UTF-8',\n'ta':'ta_IN.TSCII-0',\n'ta_in':'ta_IN.TSCII-0',\n'ta_in.tscii':'ta_IN.TSCII-0',\n'ta_in.tscii0':'ta_IN.TSCII-0',\n'ta_lk':'ta_LK.UTF-8',\n'tcy_in.utf8':'tcy_IN.UTF-8',\n'te':'te_IN.UTF-8',\n'te_in':'te_IN.UTF-8',\n'tg':'tg_TJ.KOI8-C',\n'tg_tj':'tg_TJ.KOI8-C',\n'th':'th_TH.ISO8859-11',\n'th_th':'th_TH.ISO8859-11',\n'th_th.tactis':'th_TH.TIS620',\n'th_th.tis620':'th_TH.TIS620',\n'thai':'th_TH.ISO8859-11',\n'the_np':'the_NP.UTF-8',\n'ti_er':'ti_ER.UTF-8',\n'ti_et':'ti_ET.UTF-8',\n'tig_er':'tig_ER.UTF-8',\n'tk_tm':'tk_TM.UTF-8',\n'tl':'tl_PH.ISO8859-1',\n'tl_ph':'tl_PH.ISO8859-1',\n'tn':'tn_ZA.ISO8859-15',\n'tn_za':'tn_ZA.ISO8859-15',\n'to_to':'to_TO.UTF-8',\n'tpi_pg':'tpi_PG.UTF-8',\n'tr':'tr_TR.ISO8859-9',\n'tr_cy':'tr_CY.ISO8859-9',\n'tr_tr':'tr_TR.ISO8859-9',\n'ts':'ts_ZA.ISO8859-1',\n'ts_za':'ts_ZA.ISO8859-1',\n'tt':'tt_RU.TATAR-CYR',\n'tt_ru':'tt_RU.TATAR-CYR',\n'tt_ru.tatarcyr':'tt_RU.TATAR-CYR',\n'tt_ru@iqtelif':'tt_RU.UTF-8@iqtelif',\n'turkish':'tr_TR.ISO8859-9',\n'ug_cn':'ug_CN.UTF-8',\n'uk':'uk_UA.KOI8-U',\n'uk_ua':'uk_UA.KOI8-U',\n'univ':'en_US.utf',\n'universal':'en_US.utf',\n'universal.utf8@ucs4':'en_US.UTF-8',\n'unm_us':'unm_US.UTF-8',\n'ur':'ur_PK.CP1256',\n'ur_in':'ur_IN.UTF-8',\n'ur_pk':'ur_PK.CP1256',\n'uz':'uz_UZ.UTF-8',\n'uz_uz':'uz_UZ.UTF-8',\n'uz_uz@cyrillic':'uz_UZ.UTF-8',\n've':'ve_ZA.UTF-8',\n've_za':'ve_ZA.UTF-8',\n'vi':'vi_VN.TCVN',\n'vi_vn':'vi_VN.TCVN',\n'vi_vn.tcvn':'vi_VN.TCVN',\n'vi_vn.tcvn5712':'vi_VN.TCVN',\n'vi_vn.viscii':'vi_VN.VISCII',\n'vi_vn.viscii111':'vi_VN.VISCII',\n'wa':'wa_BE.ISO8859-1',\n'wa_be':'wa_BE.ISO8859-1',\n'wae_ch':'wae_CH.UTF-8',\n'wal_et':'wal_ET.UTF-8',\n'wo_sn':'wo_SN.UTF-8',\n'xh':'xh_ZA.ISO8859-1',\n'xh_za':'xh_ZA.ISO8859-1',\n'yi':'yi_US.CP1255',\n'yi_us':'yi_US.CP1255',\n'yo_ng':'yo_NG.UTF-8',\n'yue_hk':'yue_HK.UTF-8',\n'yuw_pg':'yuw_PG.UTF-8',\n'zh':'zh_CN.eucCN',\n'zh_cn':'zh_CN.gb2312',\n'zh_cn.big5':'zh_TW.big5',\n'zh_cn.euc':'zh_CN.eucCN',\n'zh_hk':'zh_HK.big5hkscs',\n'zh_hk.big5hk':'zh_HK.big5hkscs',\n'zh_sg':'zh_SG.GB2312',\n'zh_sg.gbk':'zh_SG.GBK',\n'zh_tw':'zh_TW.big5',\n'zh_tw.euc':'zh_TW.eucTW',\n'zh_tw.euctw':'zh_TW.eucTW',\n'zu':'zu_ZA.ISO8859-1',\n'zu_za':'zu_ZA.ISO8859-1',\n}\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nwindows_locale={\n0x0436:\"af_ZA\",\n0x041c:\"sq_AL\",\n0x0484:\"gsw_FR\",\n0x045e:\"am_ET\",\n0x0401:\"ar_SA\",\n0x0801:\"ar_IQ\",\n0x0c01:\"ar_EG\",\n0x1001:\"ar_LY\",\n0x1401:\"ar_DZ\",\n0x1801:\"ar_MA\",\n0x1c01:\"ar_TN\",\n0x2001:\"ar_OM\",\n0x2401:\"ar_YE\",\n0x2801:\"ar_SY\",\n0x2c01:\"ar_JO\",\n0x3001:\"ar_LB\",\n0x3401:\"ar_KW\",\n0x3801:\"ar_AE\",\n0x3c01:\"ar_BH\",\n0x4001:\"ar_QA\",\n0x042b:\"hy_AM\",\n0x044d:\"as_IN\",\n0x042c:\"az_AZ\",\n0x082c:\"az_AZ\",\n0x046d:\"ba_RU\",\n0x042d:\"eu_ES\",\n0x0423:\"be_BY\",\n0x0445:\"bn_IN\",\n0x201a:\"bs_BA\",\n0x141a:\"bs_BA\",\n0x047e:\"br_FR\",\n0x0402:\"bg_BG\",\n\n0x0403:\"ca_ES\",\n0x0004:\"zh_CHS\",\n0x0404:\"zh_TW\",\n0x0804:\"zh_CN\",\n0x0c04:\"zh_HK\",\n0x1004:\"zh_SG\",\n0x1404:\"zh_MO\",\n0x7c04:\"zh_CHT\",\n0x0483:\"co_FR\",\n0x041a:\"hr_HR\",\n0x101a:\"hr_BA\",\n0x0405:\"cs_CZ\",\n0x0406:\"da_DK\",\n0x048c:\"gbz_AF\",\n0x0465:\"div_MV\",\n0x0413:\"nl_NL\",\n0x0813:\"nl_BE\",\n0x0409:\"en_US\",\n0x0809:\"en_GB\",\n0x0c09:\"en_AU\",\n0x1009:\"en_CA\",\n0x1409:\"en_NZ\",\n0x1809:\"en_IE\",\n0x1c09:\"en_ZA\",\n0x2009:\"en_JA\",\n0x2409:\"en_CB\",\n0x2809:\"en_BZ\",\n0x2c09:\"en_TT\",\n0x3009:\"en_ZW\",\n0x3409:\"en_PH\",\n0x4009:\"en_IN\",\n0x4409:\"en_MY\",\n0x4809:\"en_IN\",\n0x0425:\"et_EE\",\n0x0438:\"fo_FO\",\n0x0464:\"fil_PH\",\n0x040b:\"fi_FI\",\n0x040c:\"fr_FR\",\n0x080c:\"fr_BE\",\n0x0c0c:\"fr_CA\",\n0x100c:\"fr_CH\",\n0x140c:\"fr_LU\",\n0x180c:\"fr_MC\",\n0x0462:\"fy_NL\",\n0x0456:\"gl_ES\",\n0x0437:\"ka_GE\",\n0x0407:\"de_DE\",\n0x0807:\"de_CH\",\n0x0c07:\"de_AT\",\n0x1007:\"de_LU\",\n0x1407:\"de_LI\",\n0x0408:\"el_GR\",\n0x046f:\"kl_GL\",\n0x0447:\"gu_IN\",\n0x0468:\"ha_NG\",\n0x040d:\"he_IL\",\n0x0439:\"hi_IN\",\n0x040e:\"hu_HU\",\n0x040f:\"is_IS\",\n0x0421:\"id_ID\",\n0x045d:\"iu_CA\",\n0x085d:\"iu_CA\",\n0x083c:\"ga_IE\",\n0x0410:\"it_IT\",\n0x0810:\"it_CH\",\n0x0411:\"ja_JP\",\n0x044b:\"kn_IN\",\n0x043f:\"kk_KZ\",\n0x0453:\"kh_KH\",\n0x0486:\"qut_GT\",\n0x0487:\"rw_RW\",\n0x0457:\"kok_IN\",\n0x0412:\"ko_KR\",\n0x0440:\"ky_KG\",\n0x0454:\"lo_LA\",\n0x0426:\"lv_LV\",\n0x0427:\"lt_LT\",\n0x082e:\"dsb_DE\",\n0x046e:\"lb_LU\",\n0x042f:\"mk_MK\",\n0x043e:\"ms_MY\",\n0x083e:\"ms_BN\",\n0x044c:\"ml_IN\",\n0x043a:\"mt_MT\",\n0x0481:\"mi_NZ\",\n0x047a:\"arn_CL\",\n0x044e:\"mr_IN\",\n0x047c:\"moh_CA\",\n0x0450:\"mn_MN\",\n0x0850:\"mn_CN\",\n0x0461:\"ne_NP\",\n0x0414:\"nb_NO\",\n0x0814:\"nn_NO\",\n0x0482:\"oc_FR\",\n0x0448:\"or_IN\",\n0x0463:\"ps_AF\",\n0x0429:\"fa_IR\",\n0x0415:\"pl_PL\",\n0x0416:\"pt_BR\",\n0x0816:\"pt_PT\",\n0x0446:\"pa_IN\",\n0x046b:\"quz_BO\",\n0x086b:\"quz_EC\",\n0x0c6b:\"quz_PE\",\n0x0418:\"ro_RO\",\n0x0417:\"rm_CH\",\n0x0419:\"ru_RU\",\n0x243b:\"smn_FI\",\n0x103b:\"smj_NO\",\n0x143b:\"smj_SE\",\n0x043b:\"se_NO\",\n0x083b:\"se_SE\",\n0x0c3b:\"se_FI\",\n0x203b:\"sms_FI\",\n0x183b:\"sma_NO\",\n0x1c3b:\"sma_SE\",\n0x044f:\"sa_IN\",\n0x0c1a:\"sr_SP\",\n0x1c1a:\"sr_BA\",\n0x081a:\"sr_SP\",\n0x181a:\"sr_BA\",\n0x045b:\"si_LK\",\n0x046c:\"ns_ZA\",\n0x0432:\"tn_ZA\",\n0x041b:\"sk_SK\",\n0x0424:\"sl_SI\",\n0x040a:\"es_ES\",\n0x080a:\"es_MX\",\n0x0c0a:\"es_ES\",\n0x100a:\"es_GT\",\n0x140a:\"es_CR\",\n0x180a:\"es_PA\",\n0x1c0a:\"es_DO\",\n0x200a:\"es_VE\",\n0x240a:\"es_CO\",\n0x280a:\"es_PE\",\n0x2c0a:\"es_AR\",\n0x300a:\"es_EC\",\n0x340a:\"es_CL\",\n0x380a:\"es_UR\",\n0x3c0a:\"es_PY\",\n0x400a:\"es_BO\",\n0x440a:\"es_SV\",\n0x480a:\"es_HN\",\n0x4c0a:\"es_NI\",\n0x500a:\"es_PR\",\n0x540a:\"es_US\",\n\n0x0441:\"sw_KE\",\n0x041d:\"sv_SE\",\n0x081d:\"sv_FI\",\n0x045a:\"syr_SY\",\n0x0428:\"tg_TJ\",\n0x085f:\"tmz_DZ\",\n0x0449:\"ta_IN\",\n0x0444:\"tt_RU\",\n0x044a:\"te_IN\",\n0x041e:\"th_TH\",\n0x0851:\"bo_BT\",\n0x0451:\"bo_CN\",\n0x041f:\"tr_TR\",\n0x0442:\"tk_TM\",\n0x0480:\"ug_CN\",\n0x0422:\"uk_UA\",\n0x042e:\"wen_DE\",\n0x0420:\"ur_PK\",\n0x0820:\"ur_IN\",\n0x0443:\"uz_UZ\",\n0x0843:\"uz_UZ\",\n0x042a:\"vi_VN\",\n0x0452:\"cy_GB\",\n0x0488:\"wo_SN\",\n0x0434:\"xh_ZA\",\n0x0485:\"sah_RU\",\n0x0478:\"ii_CN\",\n0x046a:\"yo_NG\",\n0x0435:\"zu_ZA\",\n}\n\ndef _print_locale():\n\n ''\n \n categories={}\n def _init_categories(categories=categories):\n for k,v in globals().items():\n if k[:3]=='LC_':\n categories[k]=v\n _init_categories()\n del categories['LC_ALL']\n \n print('Locale defaults as determined by getdefaultlocale():')\n print('-'*72)\n lang,enc=getdefaultlocale()\n print('Language: ',lang or '(undefined)')\n print('Encoding: ',enc or '(undefined)')\n print()\n \n print('Locale settings on startup:')\n print('-'*72)\n for name,category in categories.items():\n print(name,'...')\n lang,enc=getlocale(category)\n print(' Language: ',lang or '(undefined)')\n print(' Encoding: ',enc or '(undefined)')\n print()\n \n print()\n print('Locale settings after calling resetlocale():')\n print('-'*72)\n resetlocale()\n for name,category in categories.items():\n print(name,'...')\n lang,enc=getlocale(category)\n print(' Language: ',lang or '(undefined)')\n print(' Encoding: ',enc or '(undefined)')\n print()\n \n try:\n setlocale(LC_ALL,\"\")\n except:\n print('NOTE:')\n print('setlocale(LC_ALL, \"\") does not support the default locale')\n print('given in the OS environment variables.')\n else:\n print()\n print('Locale settings after calling setlocale(LC_ALL, \"\"):')\n print('-'*72)\n for name,category in categories.items():\n print(name,'...')\n lang,enc=getlocale(category)\n print(' Language: ',lang or '(undefined)')\n print(' Encoding: ',enc or '(undefined)')\n print()\n \n \n \ntry:\n LC_MESSAGES\nexcept NameError:\n pass\nelse:\n __all__.append(\"LC_MESSAGES\")\n \nif __name__ =='__main__':\n print('Locale aliasing:')\n print()\n _print_locale()\n print()\n print('Number formatting:')\n print()\n _test()\n", ["_collections_abc", "_locale", "builtins", "encodings", "encodings.aliases", "functools", "os", "re", "sys", "warnings"]], "mimetypes": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport os\nimport sys\nimport posixpath\nimport urllib.parse\n\ntry:\n from _winapi import _mimetypes_read_windows_registry\nexcept ImportError:\n _mimetypes_read_windows_registry=None\n \ntry:\n import winreg as _winreg\nexcept ImportError:\n _winreg=None\n \n__all__=[\n\"knownfiles\",\"inited\",\"MimeTypes\",\n\"guess_type\",\"guess_all_extensions\",\"guess_extension\",\n\"add_type\",\"init\",\"read_mime_types\",\n\"suffix_map\",\"encodings_map\",\"types_map\",\"common_types\"\n]\n\nknownfiles=[\n\"/etc/mime.types\",\n\"/etc/httpd/mime.types\",\n\"/etc/httpd/conf/mime.types\",\n\"/etc/apache/mime.types\",\n\"/etc/apache2/mime.types\",\n\"/usr/local/etc/httpd/conf/mime.types\",\n\"/usr/local/lib/netscape/mime.types\",\n\"/usr/local/etc/httpd/conf/mime.types\",\n\"/usr/local/etc/mime.types\",\n]\n\ninited=False\n_db=None\n\n\nclass MimeTypes:\n ''\n\n\n\n\n \n \n def __init__(self,filenames=(),strict=True):\n if not inited:\n init()\n self.encodings_map=_encodings_map_default.copy()\n self.suffix_map=_suffix_map_default.copy()\n self.types_map=({},{})\n self.types_map_inv=({},{})\n for(ext,type)in _types_map_default.items():\n self.add_type(type,ext,True)\n for(ext,type)in _common_types_default.items():\n self.add_type(type,ext,False)\n for name in filenames:\n self.read(name,strict)\n \n def add_type(self,type,ext,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n \n self.types_map[strict][ext]=type\n exts=self.types_map_inv[strict].setdefault(type,[])\n if ext not in exts:\n exts.append(ext)\n \n def guess_type(self,url,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n url=os.fspath(url)\n scheme,url=urllib.parse._splittype(url)\n if scheme =='data':\n \n \n \n \n \n \n comma=url.find(',')\n if comma <0:\n \n return None,None\n semi=url.find(';',0,comma)\n if semi >=0:\n type=url[:semi]\n else:\n type=url[:comma]\n if '='in type or '/'not in type:\n type='text/plain'\n return type,None\n base,ext=posixpath.splitext(url)\n while(ext_lower :=ext.lower())in self.suffix_map:\n base,ext=posixpath.splitext(base+self.suffix_map[ext_lower])\n \n if ext in self.encodings_map:\n encoding=self.encodings_map[ext]\n base,ext=posixpath.splitext(base)\n else:\n encoding=None\n ext=ext.lower()\n types_map=self.types_map[True]\n if ext in types_map:\n return types_map[ext],encoding\n elif strict:\n return None,encoding\n types_map=self.types_map[False]\n if ext in types_map:\n return types_map[ext],encoding\n else:\n return None,encoding\n \n def guess_all_extensions(self,type,strict=True):\n ''\n\n\n\n\n\n\n\n\n \n type=type.lower()\n extensions=list(self.types_map_inv[True].get(type,[]))\n if not strict:\n for ext in self.types_map_inv[False].get(type,[]):\n if ext not in extensions:\n extensions.append(ext)\n return extensions\n \n def guess_extension(self,type,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n\n \n extensions=self.guess_all_extensions(type,strict)\n if not extensions:\n return None\n return extensions[0]\n \n def read(self,filename,strict=True):\n ''\n\n\n\n\n\n \n with open(filename,encoding='utf-8')as fp:\n self.readfp(fp,strict)\n \n def readfp(self,fp,strict=True):\n ''\n\n\n\n\n\n \n while line :=fp.readline():\n words=line.split()\n for i in range(len(words)):\n if words[i][0]=='#':\n del words[i:]\n break\n if not words:\n continue\n type,suffixes=words[0],words[1:]\n for suff in suffixes:\n self.add_type(type,'.'+suff,strict)\n \n def read_windows_registry(self,strict=True):\n ''\n\n\n\n\n\n \n \n if not _mimetypes_read_windows_registry and not _winreg:\n return\n \n add_type=self.add_type\n if strict:\n add_type=lambda type,ext:self.add_type(type,ext,True)\n \n \n if _mimetypes_read_windows_registry:\n _mimetypes_read_windows_registry(add_type)\n elif _winreg:\n self._read_windows_registry(add_type)\n \n @classmethod\n def _read_windows_registry(cls,add_type):\n def enum_types(mimedb):\n i=0\n while True:\n try:\n ctype=_winreg.EnumKey(mimedb,i)\n except OSError:\n break\n else:\n if '\\0'not in ctype:\n yield ctype\n i +=1\n \n with _winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,'')as hkcr:\n for subkeyname in enum_types(hkcr):\n try:\n with _winreg.OpenKey(hkcr,subkeyname)as subkey:\n \n if not subkeyname.startswith(\".\"):\n continue\n \n mimetype,datatype=_winreg.QueryValueEx(\n subkey,'Content Type')\n if datatype !=_winreg.REG_SZ:\n continue\n add_type(mimetype,subkeyname)\n except OSError:\n continue\n \ndef guess_type(url,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if _db is None:\n init()\n return _db.guess_type(url,strict)\n \n \ndef guess_all_extensions(type,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if _db is None:\n init()\n return _db.guess_all_extensions(type,strict)\n \ndef guess_extension(type,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n \n if _db is None:\n init()\n return _db.guess_extension(type,strict)\n \ndef add_type(type,ext,strict=True):\n ''\n\n\n\n\n\n\n\n\n\n \n if _db is None:\n init()\n return _db.add_type(type,ext,strict)\n \n \ndef init(files=None):\n global suffix_map,types_map,encodings_map,common_types\n global inited,_db\n inited=True\n \n if files is None or _db is None:\n db=MimeTypes()\n \n db.read_windows_registry()\n \n if files is None:\n files=knownfiles\n else:\n files=knownfiles+list(files)\n else:\n db=_db\n \n for file in files:\n if os.path.isfile(file):\n db.read(file)\n encodings_map=db.encodings_map\n suffix_map=db.suffix_map\n types_map=db.types_map[True]\n common_types=db.types_map[False]\n \n _db=db\n \n \ndef read_mime_types(file):\n try:\n f=open(file,encoding='utf-8')\n except OSError:\n return None\n with f:\n db=MimeTypes()\n db.readfp(f,True)\n return db.types_map[True]\n \n \ndef _default_mime_types():\n global suffix_map,_suffix_map_default\n global encodings_map,_encodings_map_default\n global types_map,_types_map_default\n global common_types,_common_types_default\n \n suffix_map=_suffix_map_default={\n '.svgz':'.svg.gz',\n '.tgz':'.tar.gz',\n '.taz':'.tar.gz',\n '.tz':'.tar.gz',\n '.tbz2':'.tar.bz2',\n '.txz':'.tar.xz',\n }\n \n encodings_map=_encodings_map_default={\n '.gz':'gzip',\n '.Z':'compress',\n '.bz2':'bzip2',\n '.xz':'xz',\n '.br':'br',\n }\n \n \n \n \n \n \n \n \n types_map=_types_map_default={\n '.js':'text/javascript',\n '.mjs':'text/javascript',\n '.json':'application/json',\n '.webmanifest':'application/manifest+json',\n '.doc':'application/msword',\n '.dot':'application/msword',\n '.wiz':'application/msword',\n '.nq':'application/n-quads',\n '.nt':'application/n-triples',\n '.bin':'application/octet-stream',\n '.a':'application/octet-stream',\n '.dll':'application/octet-stream',\n '.exe':'application/octet-stream',\n '.o':'application/octet-stream',\n '.obj':'application/octet-stream',\n '.so':'application/octet-stream',\n '.oda':'application/oda',\n '.pdf':'application/pdf',\n '.p7c':'application/pkcs7-mime',\n '.ps':'application/postscript',\n '.ai':'application/postscript',\n '.eps':'application/postscript',\n '.trig':'application/trig',\n '.m3u':'application/vnd.apple.mpegurl',\n '.m3u8':'application/vnd.apple.mpegurl',\n '.xls':'application/vnd.ms-excel',\n '.xlb':'application/vnd.ms-excel',\n '.ppt':'application/vnd.ms-powerpoint',\n '.pot':'application/vnd.ms-powerpoint',\n '.ppa':'application/vnd.ms-powerpoint',\n '.pps':'application/vnd.ms-powerpoint',\n '.pwz':'application/vnd.ms-powerpoint',\n '.wasm':'application/wasm',\n '.bcpio':'application/x-bcpio',\n '.cpio':'application/x-cpio',\n '.csh':'application/x-csh',\n '.dvi':'application/x-dvi',\n '.gtar':'application/x-gtar',\n '.hdf':'application/x-hdf',\n '.h5':'application/x-hdf5',\n '.latex':'application/x-latex',\n '.mif':'application/x-mif',\n '.cdf':'application/x-netcdf',\n '.nc':'application/x-netcdf',\n '.p12':'application/x-pkcs12',\n '.pfx':'application/x-pkcs12',\n '.ram':'application/x-pn-realaudio',\n '.pyc':'application/x-python-code',\n '.pyo':'application/x-python-code',\n '.sh':'application/x-sh',\n '.shar':'application/x-shar',\n '.swf':'application/x-shockwave-flash',\n '.sv4cpio':'application/x-sv4cpio',\n '.sv4crc':'application/x-sv4crc',\n '.tar':'application/x-tar',\n '.tcl':'application/x-tcl',\n '.tex':'application/x-tex',\n '.texi':'application/x-texinfo',\n '.texinfo':'application/x-texinfo',\n '.roff':'application/x-troff',\n '.t':'application/x-troff',\n '.tr':'application/x-troff',\n '.man':'application/x-troff-man',\n '.me':'application/x-troff-me',\n '.ms':'application/x-troff-ms',\n '.ustar':'application/x-ustar',\n '.src':'application/x-wais-source',\n '.xsl':'application/xml',\n '.rdf':'application/xml',\n '.wsdl':'application/xml',\n '.xpdl':'application/xml',\n '.zip':'application/zip',\n '.3gp':'audio/3gpp',\n '.3gpp':'audio/3gpp',\n '.3g2':'audio/3gpp2',\n '.3gpp2':'audio/3gpp2',\n '.aac':'audio/aac',\n '.adts':'audio/aac',\n '.loas':'audio/aac',\n '.ass':'audio/aac',\n '.au':'audio/basic',\n '.snd':'audio/basic',\n '.mp3':'audio/mpeg',\n '.mp2':'audio/mpeg',\n '.opus':'audio/opus',\n '.aif':'audio/x-aiff',\n '.aifc':'audio/x-aiff',\n '.aiff':'audio/x-aiff',\n '.ra':'audio/x-pn-realaudio',\n '.wav':'audio/x-wav',\n '.avif':'image/avif',\n '.bmp':'image/bmp',\n '.gif':'image/gif',\n '.ief':'image/ief',\n '.jpg':'image/jpeg',\n '.jpe':'image/jpeg',\n '.jpeg':'image/jpeg',\n '.heic':'image/heic',\n '.heif':'image/heif',\n '.png':'image/png',\n '.svg':'image/svg+xml',\n '.tiff':'image/tiff',\n '.tif':'image/tiff',\n '.ico':'image/vnd.microsoft.icon',\n '.ras':'image/x-cmu-raster',\n '.pnm':'image/x-portable-anymap',\n '.pbm':'image/x-portable-bitmap',\n '.pgm':'image/x-portable-graymap',\n '.ppm':'image/x-portable-pixmap',\n '.rgb':'image/x-rgb',\n '.xbm':'image/x-xbitmap',\n '.xpm':'image/x-xpixmap',\n '.xwd':'image/x-xwindowdump',\n '.eml':'message/rfc822',\n '.mht':'message/rfc822',\n '.mhtml':'message/rfc822',\n '.nws':'message/rfc822',\n '.css':'text/css',\n '.csv':'text/csv',\n '.html':'text/html',\n '.htm':'text/html',\n '.n3':'text/n3',\n '.txt':'text/plain',\n '.bat':'text/plain',\n '.c':'text/plain',\n '.h':'text/plain',\n '.ksh':'text/plain',\n '.pl':'text/plain',\n '.srt':'text/plain',\n '.rtx':'text/richtext',\n '.tsv':'text/tab-separated-values',\n '.vtt':'text/vtt',\n '.py':'text/x-python',\n '.etx':'text/x-setext',\n '.sgm':'text/x-sgml',\n '.sgml':'text/x-sgml',\n '.vcf':'text/x-vcard',\n '.xml':'text/xml',\n '.mp4':'video/mp4',\n '.mpeg':'video/mpeg',\n '.m1v':'video/mpeg',\n '.mpa':'video/mpeg',\n '.mpe':'video/mpeg',\n '.mpg':'video/mpeg',\n '.mov':'video/quicktime',\n '.qt':'video/quicktime',\n '.webm':'video/webm',\n '.avi':'video/x-msvideo',\n '.movie':'video/x-sgi-movie',\n }\n \n \n \n \n \n common_types=_common_types_default={\n '.rtf':'application/rtf',\n '.midi':'audio/midi',\n '.mid':'audio/midi',\n '.jpg':'image/jpg',\n '.pict':'image/pict',\n '.pct':'image/pict',\n '.pic':'image/pict',\n '.webp':'image/webp',\n '.xul':'text/xul',\n }\n \n \n_default_mime_types()\n\n\ndef _main():\n import getopt\n \n USAGE=\"\"\"\\\nUsage: mimetypes.py [options] type\n\nOptions:\n --help / -h -- print this message and exit\n --lenient / -l -- additionally search of some common, but non-standard\n types.\n --extension / -e -- guess extension instead of type\n\nMore than one type argument may be given.\n\"\"\"\n \n def usage(code,msg=''):\n print(USAGE)\n if msg:print(msg)\n sys.exit(code)\n \n try:\n opts,args=getopt.getopt(sys.argv[1:],'hle',\n ['help','lenient','extension'])\n except getopt.error as msg:\n usage(1,msg)\n \n strict=1\n extension=0\n for opt,arg in opts:\n if opt in('-h','--help'):\n usage(0)\n elif opt in('-l','--lenient'):\n strict=0\n elif opt in('-e','--extension'):\n extension=1\n for gtype in args:\n if extension:\n guess=guess_extension(gtype,strict)\n if not guess:print(\"I don't know anything about type\",gtype)\n else:print(guess)\n else:\n guess,encoding=guess_type(gtype,strict)\n if not guess:print(\"I don't know anything about type\",gtype)\n else:print('type:',guess,'encoding:',encoding)\n \n \nif __name__ =='__main__':\n _main()\n", ["_winapi", "getopt", "os", "posixpath", "sys", "urllib.parse", "winreg"]], "nntplib": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport re\nimport socket\nimport collections\nimport datetime\nimport sys\nimport warnings\n\ntry :\n import ssl\nexcept ImportError:\n _have_ssl=False\nelse :\n _have_ssl=True\n \nfrom email.header import decode_header as _email_decode_header\nfrom socket import _GLOBAL_DEFAULT_TIMEOUT\n\n__all__=[\"NNTP\",\n\"NNTPError\",\"NNTPReplyError\",\"NNTPTemporaryError\",\n\"NNTPPermanentError\",\"NNTPProtocolError\",\"NNTPDataError\",\n\"decode_header\",\n]\n\nwarnings._deprecated(__name__,remove=(3,13))\n\n\n\n\n\n_MAXLINE=2048\n\n\n\nclass NNTPError(Exception):\n ''\n def __init__(self,*args):\n Exception.__init__(self,*args)\n try :\n self.response=args[0]\n except IndexError:\n self.response='No response given'\n \nclass NNTPReplyError(NNTPError):\n ''\n pass\n \nclass NNTPTemporaryError(NNTPError):\n ''\n pass\n \nclass NNTPPermanentError(NNTPError):\n ''\n pass\n \nclass NNTPProtocolError(NNTPError):\n ''\n pass\n \nclass NNTPDataError(NNTPError):\n ''\n pass\n \n \n \nNNTP_PORT=119\nNNTP_SSL_PORT=563\n\n\n_LONGRESP={\n'100',\n'101',\n'211',\n'215',\n'220',\n'221',\n'222',\n'224',\n'225',\n'230',\n'231',\n'282',\n}\n\n\n_DEFAULT_OVERVIEW_FMT=[\n\"subject\",\"from\",\"date\",\"message-id\",\"references\",\":bytes\",\":lines\"]\n\n\n_OVERVIEW_FMT_ALTERNATIVES={\n'bytes':':bytes',\n'lines':':lines',\n}\n\n\n_CRLF=b'\\r\\n'\n\nGroupInfo=collections.namedtuple('GroupInfo',\n['group','last','first','flag'])\n\nArticleInfo=collections.namedtuple('ArticleInfo',\n['number','message_id','lines'])\n\n\n\ndef decode_header(header_str):\n ''\n \n parts=[]\n for v,enc in _email_decode_header(header_str):\n if isinstance(v,bytes):\n parts.append(v.decode(enc or 'ascii'))\n else :\n parts.append(v)\n return ''.join(parts)\n \ndef _parse_overview_fmt(lines):\n ''\n\n\n \n fmt=[]\n for line in lines:\n if line[0]==':':\n \n name,_,suffix=line[1:].partition(':')\n name=':'+name\n else :\n \n name,_,suffix=line.partition(':')\n name=name.lower()\n name=_OVERVIEW_FMT_ALTERNATIVES.get(name,name)\n \n fmt.append(name)\n defaults=_DEFAULT_OVERVIEW_FMT\n if len(fmt)=len(fmt):\n \n \n \n continue\n field_name=fmt[i]\n is_metadata=field_name.startswith(':')\n if i >=n_defaults and not is_metadata:\n \n \n h=field_name+\": \"\n if token and token[:len(h)].lower()!=h:\n raise NNTPDataError(\"OVER/XOVER response doesn't include \"\n \"names of additional headers\")\n token=token[len(h):]if token else None\n fields[fmt[i]]=token\n overview.append((article_number,fields))\n return overview\n \ndef _parse_datetime(date_str,time_str=None ):\n ''\n\n\n \n if time_str is None :\n time_str=date_str[-6:]\n date_str=date_str[:-6]\n hours=int(time_str[:2])\n minutes=int(time_str[2:4])\n seconds=int(time_str[4:])\n year=int(date_str[:-4])\n month=int(date_str[-4:-2])\n day=int(date_str[-2:])\n \n \n if year <70:\n year +=2000\n elif year <100:\n year +=1900\n return datetime.datetime(year,month,day,hours,minutes,seconds)\n \ndef _unparse_datetime(dt,legacy=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if not isinstance(dt,datetime.datetime):\n time_str=\"000000\"\n else :\n time_str=\"{0.hour:02d}{0.minute:02d}{0.second:02d}\".format(dt)\n y=dt.year\n if legacy:\n y=y %100\n date_str=\"{0:02d}{1.month:02d}{1.day:02d}\".format(y,dt)\n else :\n date_str=\"{0:04d}{1.month:02d}{1.day:02d}\".format(y,dt)\n return date_str,time_str\n \n \nif _have_ssl:\n\n def _encrypt_on(sock,context,hostname):\n ''\n\n\n\n\n \n \n if context is None :\n context=ssl._create_stdlib_context()\n return context.wrap_socket(sock,server_hostname=hostname)\n \n \n \nclass NNTP:\n\n\n\n\n\n\n\n\n\n\n\n\n encoding='utf-8'\n errors='surrogateescape'\n \n def __init__(self,host,port=NNTP_PORT,user=None ,password=None ,\n readermode=None ,usenetrc=False ,\n timeout=_GLOBAL_DEFAULT_TIMEOUT):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self.host=host\n self.port=port\n self.sock=self._create_socket(timeout)\n self.file=None\n try :\n self.file=self.sock.makefile(\"rwb\")\n self._base_init(readermode)\n if user or usenetrc:\n self.login(user,password,usenetrc)\n except :\n if self.file:\n self.file.close()\n self.sock.close()\n raise\n \n def _base_init(self,readermode):\n ''\n\n \n self.debugging=0\n self.welcome=self._getresp()\n \n \n self._caps=None\n self.getcapabilities()\n \n \n \n \n \n \n \n \n self.readermode_afterauth=False\n if readermode and 'READER'not in self._caps:\n self._setreadermode()\n if not self.readermode_afterauth:\n \n self._caps=None\n self.getcapabilities()\n \n \n \n \n self.tls_on=False\n \n \n self.authenticated=False\n \n def __enter__(self):\n return self\n \n def __exit__(self,*args):\n is_connected=lambda :hasattr(self,\"file\")\n if is_connected():\n try :\n self.quit()\n except (OSError,EOFError):\n pass\n finally :\n if is_connected():\n self._close()\n \n def _create_socket(self,timeout):\n if timeout is not None and not timeout:\n raise ValueError('Non-blocking socket (timeout=0) is not supported')\n sys.audit(\"nntplib.connect\",self,self.host,self.port)\n return socket.create_connection((self.host,self.port),timeout)\n \n def getwelcome(self):\n ''\n\n\n \n \n if self.debugging:print('*welcome*',repr(self.welcome))\n return self.welcome\n \n def getcapabilities(self):\n ''\n\n \n if self._caps is None :\n self.nntp_version=1\n self.nntp_implementation=None\n try :\n resp,caps=self.capabilities()\n except (NNTPPermanentError,NNTPTemporaryError):\n \n self._caps={}\n else :\n self._caps=caps\n if 'VERSION'in caps:\n \n \n self.nntp_version=max(map(int,caps['VERSION']))\n if 'IMPLEMENTATION'in caps:\n self.nntp_implementation=' '.join(caps['IMPLEMENTATION'])\n return self._caps\n \n def set_debuglevel(self,level):\n ''\n\n\n \n \n self.debugging=level\n debug=set_debuglevel\n \n def _putline(self,line):\n ''\n \n sys.audit(\"nntplib.putline\",self,line)\n line=line+_CRLF\n if self.debugging >1:print('*put*',repr(line))\n self.file.write(line)\n self.file.flush()\n \n def _putcmd(self,line):\n ''\n \n if self.debugging:print('*cmd*',repr(line))\n line=line.encode(self.encoding,self.errors)\n self._putline(line)\n \n def _getline(self,strip_crlf=True ):\n ''\n\n \n line=self.file.readline(_MAXLINE+1)\n if len(line)>_MAXLINE:\n raise NNTPDataError('line too long')\n if self.debugging >1:\n print('*get*',repr(line))\n if not line:raise EOFError\n if strip_crlf:\n if line[-2:]==_CRLF:\n line=line[:-2]\n elif line[-1:]in _CRLF:\n line=line[:-1]\n return line\n \n def _getresp(self):\n ''\n\n \n resp=self._getline()\n if self.debugging:print('*resp*',repr(resp))\n resp=resp.decode(self.encoding,self.errors)\n c=resp[:1]\n if c =='4':\n raise NNTPTemporaryError(resp)\n if c =='5':\n raise NNTPPermanentError(resp)\n if c not in '123':\n raise NNTPProtocolError(resp)\n return resp\n \n def _getlongresp(self,file=None ):\n ''\n\n\n\n\n\n \n \n openedFile=None\n try :\n \n if isinstance(file,(str,bytes)):\n openedFile=file=open(file,\"wb\")\n \n resp=self._getresp()\n if resp[:3]not in _LONGRESP:\n raise NNTPReplyError(resp)\n \n lines=[]\n if file is not None :\n \n terminators=(b'.'+_CRLF,b'.\\n')\n while 1:\n line=self._getline(False )\n if line in terminators:\n break\n if line.startswith(b'..'):\n line=line[1:]\n file.write(line)\n else :\n terminator=b'.'\n while 1:\n line=self._getline()\n if line ==terminator:\n break\n if line.startswith(b'..'):\n line=line[1:]\n lines.append(line)\n finally :\n \n if openedFile:\n openedFile.close()\n \n return resp,lines\n \n def _shortcmd(self,line):\n ''\n \n self._putcmd(line)\n return self._getresp()\n \n def _longcmd(self,line,file=None ):\n ''\n \n self._putcmd(line)\n return self._getlongresp(file)\n \n def _longcmdstring(self,line,file=None ):\n ''\n\n\n \n self._putcmd(line)\n resp,list=self._getlongresp(file)\n return resp,[line.decode(self.encoding,self.errors)\n for line in list]\n \n def _getoverviewfmt(self):\n ''\n \n try :\n return self._cachedoverviewfmt\n except AttributeError:\n pass\n try :\n resp,lines=self._longcmdstring(\"LIST OVERVIEW.FMT\")\n except NNTPPermanentError:\n \n fmt=_DEFAULT_OVERVIEW_FMT[:]\n else :\n fmt=_parse_overview_fmt(lines)\n self._cachedoverviewfmt=fmt\n return fmt\n \n def _grouplist(self,lines):\n \n return [GroupInfo(*line.split())for line in lines]\n \n def capabilities(self):\n ''\n\n\n\n\n \n caps={}\n resp,lines=self._longcmdstring(\"CAPABILITIES\")\n for line in lines:\n name,*tokens=line.split()\n caps[name]=tokens\n return resp,caps\n \n def newgroups(self,date,*,file=None ):\n ''\n\n\n\n\n \n if not isinstance(date,(datetime.date,datetime.date)):\n raise TypeError(\n \"the date parameter must be a date or datetime object, \"\n \"not '{:40}'\".format(date.__class__.__name__))\n date_str,time_str=_unparse_datetime(date,self.nntp_version <2)\n cmd='NEWGROUPS {0} {1}'.format(date_str,time_str)\n resp,lines=self._longcmdstring(cmd,file)\n return resp,self._grouplist(lines)\n \n def newnews(self,group,date,*,file=None ):\n ''\n\n\n\n\n\n \n if not isinstance(date,(datetime.date,datetime.date)):\n raise TypeError(\n \"the date parameter must be a date or datetime object, \"\n \"not '{:40}'\".format(date.__class__.__name__))\n date_str,time_str=_unparse_datetime(date,self.nntp_version <2)\n cmd='NEWNEWS {0} {1} {2}'.format(group,date_str,time_str)\n return self._longcmdstring(cmd,file)\n \n def list(self,group_pattern=None ,*,file=None ):\n ''\n\n\n\n\n\n \n if group_pattern is not None :\n command='LIST ACTIVE '+group_pattern\n else :\n command='LIST'\n resp,lines=self._longcmdstring(command,file)\n return resp,self._grouplist(lines)\n \n def _getdescriptions(self,group_pattern,return_all):\n line_pat=re.compile('^(?P[^ \\t]+)[ \\t]+(.*)$')\n \n resp,lines=self._longcmdstring('LIST NEWSGROUPS '+group_pattern)\n if not resp.startswith('215'):\n \n \n \n resp,lines=self._longcmdstring('XGTITLE '+group_pattern)\n groups={}\n for raw_line in lines:\n match=line_pat.search(raw_line.strip())\n if match:\n name,desc=match.group(1,2)\n if not return_all:\n return desc\n groups[name]=desc\n if return_all:\n return resp,groups\n else :\n \n return ''\n \n def description(self,group):\n ''\n\n\n\n\n\n\n\n\n \n return self._getdescriptions(group,False )\n \n def descriptions(self,group_pattern):\n ''\n return self._getdescriptions(group_pattern,True )\n \n def group(self,name):\n ''\n\n\n\n\n\n\n\n \n resp=self._shortcmd('GROUP '+name)\n if not resp.startswith('211'):\n raise NNTPReplyError(resp)\n words=resp.split()\n count=first=last=0\n n=len(words)\n if n >1:\n count=words[1]\n if n >2:\n first=words[2]\n if n >3:\n last=words[3]\n if n >4:\n name=words[4].lower()\n return resp,int(count),int(first),int(last),name\n \n def help(self,*,file=None ):\n ''\n\n\n\n\n\n \n return self._longcmdstring('HELP',file)\n \n def _statparse(self,resp):\n ''\n \n if not resp.startswith('22'):\n raise NNTPReplyError(resp)\n words=resp.split()\n art_num=int(words[1])\n message_id=words[2]\n return resp,art_num,message_id\n \n def _statcmd(self,line):\n ''\n resp=self._shortcmd(line)\n return self._statparse(resp)\n \n def stat(self,message_spec=None ):\n ''\n\n\n\n\n\n\n \n if message_spec:\n return self._statcmd('STAT {0}'.format(message_spec))\n else :\n return self._statcmd('STAT')\n \n def next(self):\n ''\n return self._statcmd('NEXT')\n \n def last(self):\n ''\n return self._statcmd('LAST')\n \n def _artcmd(self,line,file=None ):\n ''\n resp,lines=self._longcmd(line,file)\n resp,art_num,message_id=self._statparse(resp)\n return resp,ArticleInfo(art_num,message_id,lines)\n \n def head(self,message_spec=None ,*,file=None ):\n ''\n\n\n\n\n\n \n if message_spec is not None :\n cmd='HEAD {0}'.format(message_spec)\n else :\n cmd='HEAD'\n return self._artcmd(cmd,file)\n \n def body(self,message_spec=None ,*,file=None ):\n ''\n\n\n\n\n\n \n if message_spec is not None :\n cmd='BODY {0}'.format(message_spec)\n else :\n cmd='BODY'\n return self._artcmd(cmd,file)\n \n def article(self,message_spec=None ,*,file=None ):\n ''\n\n\n\n\n\n \n if message_spec is not None :\n cmd='ARTICLE {0}'.format(message_spec)\n else :\n cmd='ARTICLE'\n return self._artcmd(cmd,file)\n \n def slave(self):\n ''\n\n \n return self._shortcmd('SLAVE')\n \n def xhdr(self,hdr,str,*,file=None ):\n ''\n\n\n\n\n\n\n \n pat=re.compile('^([0-9]+) ?(.*)\\n?')\n resp,lines=self._longcmdstring('XHDR {0} {1}'.format(hdr,str),file)\n def remove_number(line):\n m=pat.match(line)\n return m.group(1,2)if m else line\n return resp,[remove_number(line)for line in lines]\n \n def xover(self,start,end,*,file=None ):\n ''\n\n\n\n\n\n\n \n resp,lines=self._longcmdstring('XOVER {0}-{1}'.format(start,end),\n file)\n fmt=self._getoverviewfmt()\n return resp,_parse_overview(lines,fmt)\n \n def over(self,message_spec,*,file=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n cmd='OVER'if 'OVER'in self._caps else 'XOVER'\n if isinstance(message_spec,(tuple,list)):\n start,end=message_spec\n cmd +=' {0}-{1}'.format(start,end or '')\n elif message_spec is not None :\n cmd=cmd+' '+message_spec\n resp,lines=self._longcmdstring(cmd,file)\n fmt=self._getoverviewfmt()\n return resp,_parse_overview(lines,fmt)\n \n def date(self):\n ''\n\n\n\n \n resp=self._shortcmd(\"DATE\")\n if not resp.startswith('111'):\n raise NNTPReplyError(resp)\n elem=resp.split()\n if len(elem)!=2:\n raise NNTPDataError(resp)\n date=elem[1]\n if len(date)!=14:\n raise NNTPDataError(resp)\n return resp,_parse_datetime(date,None )\n \n def _post(self,command,f):\n resp=self._shortcmd(command)\n \n if not resp.startswith('3'):\n raise NNTPReplyError(resp)\n if isinstance(f,(bytes,bytearray)):\n f=f.splitlines()\n \n \n \n \n for line in f:\n if not line.endswith(_CRLF):\n line=line.rstrip(b\"\\r\\n\")+_CRLF\n if line.startswith(b'.'):\n line=b'.'+line\n self.file.write(line)\n self.file.write(b\".\\r\\n\")\n self.file.flush()\n return self._getresp()\n \n def post(self,data):\n ''\n\n\n \n return self._post('POST',data)\n \n def ihave(self,message_id,data):\n ''\n\n\n\n\n \n return self._post('IHAVE {0}'.format(message_id),data)\n \n def _close(self):\n try :\n if self.file:\n self.file.close()\n del self.file\n finally :\n self.sock.close()\n \n def quit(self):\n ''\n \n try :\n resp=self._shortcmd('QUIT')\n finally :\n self._close()\n return resp\n \n def login(self,user=None ,password=None ,usenetrc=True ):\n if self.authenticated:\n raise ValueError(\"Already logged in.\")\n if not user and not usenetrc:\n raise ValueError(\n \"At least one of `user` and `usenetrc` must be specified\")\n \n \n \n try :\n if usenetrc and not user:\n import netrc\n credentials=netrc.netrc()\n auth=credentials.authenticators(self.host)\n if auth:\n user=auth[0]\n password=auth[2]\n except OSError:\n pass\n \n if not user:\n return\n resp=self._shortcmd('authinfo user '+user)\n if resp.startswith('381'):\n if not password:\n raise NNTPReplyError(resp)\n else :\n resp=self._shortcmd('authinfo pass '+password)\n if not resp.startswith('281'):\n raise NNTPPermanentError(resp)\n \n self._caps=None\n self.getcapabilities()\n \n \n if self.readermode_afterauth and 'READER'not in self._caps:\n self._setreadermode()\n \n self._caps=None\n self.getcapabilities()\n \n def _setreadermode(self):\n try :\n self.welcome=self._shortcmd('mode reader')\n except NNTPPermanentError:\n \n pass\n except NNTPTemporaryError as e:\n if e.response.startswith('480'):\n \n self.readermode_afterauth=True\n else :\n raise\n \n if _have_ssl:\n def starttls(self,context=None ):\n ''\n\n \n \n \n if self.tls_on:\n raise ValueError(\"TLS is already enabled.\")\n if self.authenticated:\n raise ValueError(\"TLS cannot be started after authentication.\")\n resp=self._shortcmd('STARTTLS')\n if resp.startswith('382'):\n self.file.close()\n self.sock=_encrypt_on(self.sock,context,self.host)\n self.file=self.sock.makefile(\"rwb\")\n self.tls_on=True\n \n \n self._caps=None\n self.getcapabilities()\n else :\n raise NNTPError(\"TLS failed to start.\")\n \n \nif _have_ssl:\n class NNTP_SSL(NNTP):\n \n def __init__(self,host,port=NNTP_SSL_PORT,\n user=None ,password=None ,ssl_context=None ,\n readermode=None ,usenetrc=False ,\n timeout=_GLOBAL_DEFAULT_TIMEOUT):\n ''\n\n \n self.ssl_context=ssl_context\n super().__init__(host,port,user,password,readermode,\n usenetrc,timeout)\n \n def _create_socket(self,timeout):\n sock=super()._create_socket(timeout)\n try :\n sock=_encrypt_on(sock,self.ssl_context,self.host)\n except :\n sock.close()\n raise\n else :\n return sock\n \n __all__.append(\"NNTP_SSL\")\n \n \n \nif __name__ =='__main__':\n import argparse\n \n parser=argparse.ArgumentParser(description=\"\"\"\\\n nntplib built-in demo - display the latest articles in a newsgroup\"\"\")\n parser.add_argument('-g','--group',default='gmane.comp.python.general',\n help='group to fetch messages from (default: %(default)s)')\n parser.add_argument('-s','--server',default='news.gmane.io',\n help='NNTP server hostname (default: %(default)s)')\n parser.add_argument('-p','--port',default=-1,type=int,\n help='NNTP port number (default: %s / %s)'%(NNTP_PORT,NNTP_SSL_PORT))\n parser.add_argument('-n','--nb-articles',default=10,type=int,\n help='number of articles to fetch (default: %(default)s)')\n parser.add_argument('-S','--ssl',action='store_true',default=False ,\n help='use NNTP over SSL')\n args=parser.parse_args()\n \n port=args.port\n if not args.ssl:\n if port ==-1:\n port=NNTP_PORT\n s=NNTP(host=args.server,port=port)\n else :\n if port ==-1:\n port=NNTP_SSL_PORT\n s=NNTP_SSL(host=args.server,port=port)\n \n caps=s.getcapabilities()\n if 'STARTTLS'in caps:\n s.starttls()\n resp,count,first,last,name=s.group(args.group)\n print('Group',name,'has',count,'articles, range',first,'to',last)\n \n def cut(s,lim):\n if len(s)>lim:\n s=s[:lim -4]+\"...\"\n return s\n \n first=str(int(last)-args.nb_articles+1)\n resp,overviews=s.xover(first,last)\n for artnum,over in overviews:\n author=decode_header(over['from']).split('<',1)[0]\n subject=decode_header(over['subject'])\n lines=int(over[':lines'])\n print(\"{:7} {:20} {:42} ({})\".format(\n artnum,cut(author,20),cut(subject,42),lines)\n )\n \n s.quit()\n", ["argparse", "collections", "datetime", "email.header", "netrc", "re", "socket", "ssl", "sys", "warnings"]], "ntpath": [".py", "\n''\n\n\n\n\n\n\n\n\ncurdir='.'\npardir='..'\nextsep='.'\nsep='\\\\'\npathsep=';'\naltsep='/'\ndefpath='.;C:\\\\bin'\ndevnull='nul'\n\nimport os\nimport sys\nimport stat\nimport genericpath\nfrom genericpath import *\n\n\n__all__=[\"normcase\",\"isabs\",\"join\",\"splitdrive\",\"splitroot\",\"split\",\"splitext\",\n\"basename\",\"dirname\",\"commonprefix\",\"getsize\",\"getmtime\",\n\"getatime\",\"getctime\",\"islink\",\"exists\",\"lexists\",\"isdir\",\"isfile\",\n\"ismount\",\"expanduser\",\"expandvars\",\"normpath\",\"abspath\",\n\"curdir\",\"pardir\",\"sep\",\"pathsep\",\"defpath\",\"altsep\",\n\"extsep\",\"devnull\",\"realpath\",\"supports_unicode_filenames\",\"relpath\",\n\"samefile\",\"sameopenfile\",\"samestat\",\"commonpath\",\"isjunction\"]\n\ndef _get_bothseps(path):\n if isinstance(path,bytes):\n return b'\\\\/'\n else:\n return '\\\\/'\n \n \n \n \n \ntry:\n from _winapi import(\n LCMapStringEx as _LCMapStringEx,\n LOCALE_NAME_INVARIANT as _LOCALE_NAME_INVARIANT,\n LCMAP_LOWERCASE as _LCMAP_LOWERCASE)\n \n def normcase(s):\n ''\n\n\n \n s=os.fspath(s)\n if not s:\n return s\n if isinstance(s,bytes):\n encoding=sys.getfilesystemencoding()\n s=s.decode(encoding,'surrogateescape').replace('/','\\\\')\n s=_LCMapStringEx(_LOCALE_NAME_INVARIANT,\n _LCMAP_LOWERCASE,s)\n return s.encode(encoding,'surrogateescape')\n else:\n return _LCMapStringEx(_LOCALE_NAME_INVARIANT,\n _LCMAP_LOWERCASE,\n s.replace('/','\\\\'))\nexcept ImportError:\n def normcase(s):\n ''\n\n\n \n s=os.fspath(s)\n if isinstance(s,bytes):\n return os.fsencode(os.fsdecode(s).replace('/','\\\\').lower())\n return s.replace('/','\\\\').lower()\n \n \n \n \n \n \n \n \ndef isabs(s):\n ''\n s=os.fspath(s)\n if isinstance(s,bytes):\n sep=b'\\\\'\n altsep=b'/'\n colon_sep=b':\\\\'\n else:\n sep='\\\\'\n altsep='/'\n colon_sep=':\\\\'\n s=s[:3].replace(altsep,sep)\n \n \n if s.startswith(sep)or s.startswith(colon_sep,1):\n return True\n return False\n \n \n \ndef join(path,*paths):\n path=os.fspath(path)\n if isinstance(path,bytes):\n sep=b'\\\\'\n seps=b'\\\\/'\n colon=b':'\n else:\n sep='\\\\'\n seps='\\\\/'\n colon=':'\n try:\n if not paths:\n path[:0]+sep\n result_drive,result_root,result_path=splitroot(path)\n for p in map(os.fspath,paths):\n p_drive,p_root,p_path=splitroot(p)\n if p_root:\n \n if p_drive or not result_drive:\n result_drive=p_drive\n result_root=p_root\n result_path=p_path\n continue\n elif p_drive and p_drive !=result_drive:\n if p_drive.lower()!=result_drive.lower():\n \n result_drive=p_drive\n result_root=p_root\n result_path=p_path\n continue\n \n result_drive=p_drive\n \n if result_path and result_path[-1]not in seps:\n result_path=result_path+sep\n result_path=result_path+p_path\n \n if(result_path and not result_root and\n result_drive and result_drive[-1:]not in colon+seps):\n return result_drive+sep+result_path\n return result_drive+result_root+result_path\n except(TypeError,AttributeError,BytesWarning):\n genericpath._check_arg_types('join',path,*paths)\n raise\n \n \n \n \n \ndef splitdrive(p):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n drive,root,tail=splitroot(p)\n return drive,root+tail\n \n \ndef splitroot(p):\n ''\n\n\n\n\n\n\n\n\n \n p=os.fspath(p)\n if isinstance(p,bytes):\n sep=b'\\\\'\n altsep=b'/'\n colon=b':'\n unc_prefix=b'\\\\\\\\?\\\\UNC\\\\'\n empty=b''\n else:\n sep='\\\\'\n altsep='/'\n colon=':'\n unc_prefix='\\\\\\\\?\\\\UNC\\\\'\n empty=''\n normp=p.replace(altsep,sep)\n if normp[:1]==sep:\n if normp[1:2]==sep:\n \n \n start=8 if normp[:8].upper()==unc_prefix else 2\n index=normp.find(sep,start)\n if index ==-1:\n return p,empty,empty\n index2=normp.find(sep,index+1)\n if index2 ==-1:\n return p,empty,empty\n return p[:index2],p[index2:index2+1],p[index2+1:]\n else:\n \n return empty,p[:1],p[1:]\n elif normp[1:2]==colon:\n if normp[2:3]==sep:\n \n return p[:2],p[2:3],p[3:]\n else:\n \n return p[:2],empty,p[2:]\n else:\n \n return empty,empty,p\n \n \n \n \n \n \n \ndef split(p):\n ''\n\n\n \n p=os.fspath(p)\n seps=_get_bothseps(p)\n d,r,p=splitroot(p)\n \n i=len(p)\n while i and p[i -1]not in seps:\n i -=1\n head,tail=p[:i],p[i:]\n return d+r+head.rstrip(seps),tail\n \n \n \n \n \n \n \ndef splitext(p):\n p=os.fspath(p)\n if isinstance(p,bytes):\n return genericpath._splitext(p,b'\\\\',b'/',b'.')\n else:\n return genericpath._splitext(p,'\\\\','/','.')\nsplitext.__doc__=genericpath._splitext.__doc__\n\n\n\n\ndef basename(p):\n ''\n return split(p)[1]\n \n \n \n \ndef dirname(p):\n ''\n return split(p)[0]\n \n \n \n \nif hasattr(os.stat_result,'st_reparse_tag'):\n def isjunction(path):\n ''\n try:\n st=os.lstat(path)\n except(OSError,ValueError,AttributeError):\n return False\n return bool(st.st_reparse_tag ==stat.IO_REPARSE_TAG_MOUNT_POINT)\nelse:\n def isjunction(path):\n ''\n os.fspath(path)\n return False\n \n \n \n \ndef lexists(path):\n ''\n try:\n st=os.lstat(path)\n except(OSError,ValueError):\n return False\n return True\n \n \n \n \n \n \n \n \n \n \n \ntry:\n from nt import _getvolumepathname\nexcept ImportError:\n _getvolumepathname=None\ndef ismount(path):\n ''\n \n path=os.fspath(path)\n seps=_get_bothseps(path)\n path=abspath(path)\n drive,root,rest=splitroot(path)\n if drive and drive[0]in seps:\n return not rest\n if root and not rest:\n return True\n \n if _getvolumepathname:\n x=path.rstrip(seps)\n y=_getvolumepathname(path).rstrip(seps)\n return x.casefold()==y.casefold()\n else:\n return False\n \n \n \n \n \n \n \n \n \n \n \ndef expanduser(path):\n ''\n\n \n path=os.fspath(path)\n if isinstance(path,bytes):\n tilde=b'~'\n else:\n tilde='~'\n if not path.startswith(tilde):\n return path\n i,n=1,len(path)\n while i 0 and comps[i -1]!=pardir:\n del comps[i -1:i+1]\n i -=1\n elif i ==0 and root:\n del comps[i]\n else:\n i +=1\n else:\n i +=1\n \n if not prefix and not comps:\n comps.append(curdir)\n return prefix+sep.join(comps)\n \nelse:\n def normpath(path):\n ''\n path=os.fspath(path)\n if isinstance(path,bytes):\n return os.fsencode(_path_normpath(os.fsdecode(path)))or b\".\"\n return _path_normpath(path)or \".\"\n \n \ndef _abspath_fallback(path):\n ''\n\n\n\n \n \n path=os.fspath(path)\n if not isabs(path):\n if isinstance(path,bytes):\n cwd=os.getcwdb()\n else:\n cwd=os.getcwd()\n path=join(cwd,path)\n return normpath(path)\n \n \ntry:\n from nt import _getfullpathname\n \nexcept ImportError:\n abspath=_abspath_fallback\n \nelse:\n def abspath(path):\n ''\n try:\n return _getfullpathname(normpath(path))\n except(OSError,ValueError):\n return _abspath_fallback(path)\n \ntry:\n from nt import _getfinalpathname,readlink as _nt_readlink\nexcept ImportError:\n\n realpath=abspath\nelse:\n def _readlink_deep(path):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_winerror=1,2,3,5,21,32,50,67,87,4390,4392,4393\n \n seen=set()\n while normcase(path)not in seen:\n seen.add(normcase(path))\n try:\n old_path=path\n path=_nt_readlink(path)\n \n \n if not isabs(path):\n \n \n \n if not islink(old_path):\n path=old_path\n break\n path=normpath(join(dirname(old_path),path))\n except OSError as ex:\n if ex.winerror in allowed_winerror:\n break\n raise\n except ValueError:\n \n break\n return path\n \n def _getfinalpathname_nonstrict(path):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n allowed_winerror=1,2,3,5,21,32,50,53,65,67,87,123,161,1920,1921\n \n \n \n tail=path[:0]\n while path:\n try:\n path=_getfinalpathname(path)\n return join(path,tail)if tail else path\n except OSError as ex:\n if ex.winerror not in allowed_winerror:\n raise\n try:\n \n \n \n new_path=_readlink_deep(path)\n if new_path !=path:\n return join(new_path,tail)if tail else new_path\n except OSError:\n \n pass\n path,name=split(path)\n \n \n \n if path and not name:\n return path+tail\n tail=join(name,tail)if tail else name\n return tail\n \n def realpath(path,*,strict=False):\n path=normpath(path)\n if isinstance(path,bytes):\n prefix=b'\\\\\\\\?\\\\'\n unc_prefix=b'\\\\\\\\?\\\\UNC\\\\'\n new_unc_prefix=b'\\\\\\\\'\n cwd=os.getcwdb()\n \n if normcase(path)==normcase(os.fsencode(devnull)):\n return b'\\\\\\\\.\\\\NUL'\n else:\n prefix='\\\\\\\\?\\\\'\n unc_prefix='\\\\\\\\?\\\\UNC\\\\'\n new_unc_prefix='\\\\\\\\'\n cwd=os.getcwd()\n \n if normcase(path)==normcase(devnull):\n return '\\\\\\\\.\\\\NUL'\n had_prefix=path.startswith(prefix)\n if not had_prefix and not isabs(path):\n path=join(cwd,path)\n try:\n path=_getfinalpathname(path)\n initial_winerror=0\n except OSError as ex:\n if strict:\n raise\n initial_winerror=ex.winerror\n path=_getfinalpathname_nonstrict(path)\n \n \n \n if not had_prefix and path.startswith(prefix):\n \n \n if path.startswith(unc_prefix):\n spath=new_unc_prefix+path[len(unc_prefix):]\n else:\n spath=path[len(prefix):]\n \n try:\n if _getfinalpathname(spath)==path:\n path=spath\n except OSError as ex:\n \n \n if ex.winerror ==initial_winerror:\n path=spath\n return path\n \n \n \nsupports_unicode_filenames=True\n\ndef relpath(path,start=None):\n ''\n path=os.fspath(path)\n if isinstance(path,bytes):\n sep=b'\\\\'\n curdir=b'.'\n pardir=b'..'\n else:\n sep='\\\\'\n curdir='.'\n pardir='..'\n \n if start is None:\n start=curdir\n \n if not path:\n raise ValueError(\"no path specified\")\n \n start=os.fspath(start)\n try:\n start_abs=abspath(normpath(start))\n path_abs=abspath(normpath(path))\n start_drive,_,start_rest=splitroot(start_abs)\n path_drive,_,path_rest=splitroot(path_abs)\n if normcase(start_drive)!=normcase(path_drive):\n raise ValueError(\"path is on mount %r, start on mount %r\"%(\n path_drive,start_drive))\n \n start_list=[x for x in start_rest.split(sep)if x]\n path_list=[x for x in path_rest.split(sep)if x]\n \n i=0\n for e1,e2 in zip(start_list,path_list):\n if normcase(e1)!=normcase(e2):\n break\n i +=1\n \n rel_list=[pardir]*(len(start_list)-i)+path_list[i:]\n if not rel_list:\n return curdir\n return join(*rel_list)\n except(TypeError,ValueError,AttributeError,BytesWarning,DeprecationWarning):\n genericpath._check_arg_types('relpath',path,start)\n raise\n \n \n \n \n \n \n \n \n \n \n \n \ndef commonpath(paths):\n ''\n \n if not paths:\n raise ValueError('commonpath() arg is an empty sequence')\n \n paths=tuple(map(os.fspath,paths))\n if isinstance(paths[0],bytes):\n sep=b'\\\\'\n altsep=b'/'\n curdir=b'.'\n else:\n sep='\\\\'\n altsep='/'\n curdir='.'\n \n try:\n drivesplits=[splitroot(p.replace(altsep,sep).lower())for p in paths]\n split_paths=[p.split(sep)for d,r,p in drivesplits]\n \n if len({r for d,r,p in drivesplits})!=1:\n raise ValueError(\"Can't mix absolute and relative paths\")\n \n \n \n \n if len({d for d,r,p in drivesplits})!=1:\n raise ValueError(\"Paths don't have the same drive\")\n \n drive,root,path=splitroot(paths[0].replace(altsep,sep))\n common=path.split(sep)\n common=[c for c in common if c and c !=curdir]\n \n split_paths=[[c for c in s if c and c !=curdir]for s in split_paths]\n s1=min(split_paths)\n s2=max(split_paths)\n for i,c in enumerate(s1):\n if c !=s2[i]:\n common=common[:i]\n break\n else:\n common=common[:len(s1)]\n \n return drive+root+sep.join(common)\n except(TypeError,AttributeError):\n genericpath._check_arg_types('commonpath',*paths)\n raise\n \n \ntry:\n\n\n\n from nt import _path_isdir as isdir\n from nt import _path_isfile as isfile\n from nt import _path_islink as islink\n from nt import _path_exists as exists\nexcept ImportError:\n\n pass\n \n \ntry:\n from nt import _path_isdevdrive\nexcept ImportError:\n def isdevdrive(path):\n ''\n \n return False\nelse:\n def isdevdrive(path):\n ''\n try:\n return _path_isdevdrive(abspath(path))\n except OSError:\n return False\n", ["_winapi", "genericpath", "nt", "os", "stat", "string", "sys"]], "numbers": [".py", "\n\n\n\"\"\"Abstract Base Classes (ABCs) for numbers, according to PEP 3141.\n\nTODO: Fill out more detailed documentation on the operators.\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfrom abc import ABCMeta,abstractmethod\n\n__all__=[\"Number\",\"Complex\",\"Real\",\"Rational\",\"Integral\"]\n\nclass Number(metaclass=ABCMeta):\n ''\n\n\n\n \n __slots__=()\n \n \n __hash__=None\n \n \n \n \n \n \n \n \n \n \nclass Complex(Number):\n ''\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def __complex__(self):\n ''\n \n def __bool__(self):\n ''\n return self !=0\n \n @property\n @abstractmethod\n def real(self):\n ''\n\n\n \n raise NotImplementedError\n \n @property\n @abstractmethod\n def imag(self):\n ''\n\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __add__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __radd__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __neg__(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __pos__(self):\n ''\n raise NotImplementedError\n \n def __sub__(self,other):\n ''\n return self+-other\n \n def __rsub__(self,other):\n ''\n return -self+other\n \n @abstractmethod\n def __mul__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rmul__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __truediv__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rtruediv__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __pow__(self,exponent):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rpow__(self,base):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __abs__(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def conjugate(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __eq__(self,other):\n ''\n raise NotImplementedError\n \nComplex.register(complex)\n\n\nclass Real(Complex):\n ''\n\n\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def __float__(self):\n ''\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __trunc__(self):\n ''\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __floor__(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __ceil__(self):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __round__(self,ndigits=None):\n ''\n\n\n\n \n raise NotImplementedError\n \n def __divmod__(self,other):\n ''\n\n\n\n \n return(self //other,self %other)\n \n def __rdivmod__(self,other):\n ''\n\n\n\n \n return(other //self,other %self)\n \n @abstractmethod\n def __floordiv__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rfloordiv__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __mod__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rmod__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __lt__(self,other):\n ''\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __le__(self,other):\n ''\n raise NotImplementedError\n \n \n def __complex__(self):\n ''\n return complex(float(self))\n \n @property\n def real(self):\n ''\n return+self\n \n @property\n def imag(self):\n ''\n return 0\n \n def conjugate(self):\n ''\n return+self\n \nReal.register(float)\n\n\nclass Rational(Real):\n ''\n \n __slots__=()\n \n @property\n @abstractmethod\n def numerator(self):\n raise NotImplementedError\n \n @property\n @abstractmethod\n def denominator(self):\n raise NotImplementedError\n \n \n def __float__(self):\n ''\n\n\n\n\n\n \n return int(self.numerator)/int(self.denominator)\n \n \nclass Integral(Rational):\n ''\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def __int__(self):\n ''\n raise NotImplementedError\n \n def __index__(self):\n ''\n return int(self)\n \n @abstractmethod\n def __pow__(self,exponent,modulus=None):\n ''\n\n\n\n\n\n \n raise NotImplementedError\n \n @abstractmethod\n def __lshift__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rlshift__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rshift__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rrshift__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __and__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rand__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __xor__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __rxor__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __or__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __ror__(self,other):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def __invert__(self):\n ''\n raise NotImplementedError\n \n \n def __float__(self):\n ''\n return float(int(self))\n \n @property\n def numerator(self):\n ''\n return+self\n \n @property\n def denominator(self):\n ''\n return 1\n \nIntegral.register(int)\n", ["abc"]], "opcode": [".py", "\n\"\"\"\nopcode module - potentially shared between dis and other modules which\noperate on bytecodes (e.g. peephole optimizers).\n\"\"\"\n\n__all__=[\"cmp_op\",\"hasarg\",\"hasconst\",\"hasname\",\"hasjrel\",\"hasjabs\",\n\"haslocal\",\"hascompare\",\"hasfree\",\"hasexc\",\"opname\",\"opmap\",\n\"HAVE_ARGUMENT\",\"EXTENDED_ARG\"]\n\n\n\n\n\n\n\n\ntry:\n from _opcode import stack_effect\n __all__.append('stack_effect')\nexcept ImportError:\n pass\n \ncmp_op=('<','<=','==','!=','>','>=')\n\nhasarg=[]\nhasconst=[]\nhasname=[]\nhasjrel=[]\nhasjabs=[]\nhaslocal=[]\nhascompare=[]\nhasfree=[]\nhasexc=[]\n\n\nENABLE_SPECIALIZATION=True\n\ndef is_pseudo(op):\n return op >=MIN_PSEUDO_OPCODE and op <=MAX_PSEUDO_OPCODE\n \noplists=[hasarg,hasconst,hasname,hasjrel,hasjabs,\nhaslocal,hascompare,hasfree,hasexc]\n\nopmap={}\n\n\n\n_pseudo_ops={}\n\ndef def_op(name,op):\n opmap[name]=op\n \ndef name_op(name,op):\n def_op(name,op)\n hasname.append(op)\n \ndef jrel_op(name,op):\n def_op(name,op)\n hasjrel.append(op)\n \ndef jabs_op(name,op):\n def_op(name,op)\n hasjabs.append(op)\n \ndef pseudo_op(name,op,real_ops):\n def_op(name,op)\n _pseudo_ops[name]=real_ops\n \n for oplist in oplists:\n res=[opmap[rop]in oplist for rop in real_ops]\n if any(res):\n assert all(res)\n oplist.append(op)\n \n \n \n \n \ndef_op('CACHE',0)\ndef_op('POP_TOP',1)\ndef_op('PUSH_NULL',2)\ndef_op('INTERPRETER_EXIT',3)\n\ndef_op('END_FOR',4)\ndef_op('END_SEND',5)\n\ndef_op('NOP',9)\n\ndef_op('UNARY_NEGATIVE',11)\ndef_op('UNARY_NOT',12)\n\ndef_op('UNARY_INVERT',15)\n\n\n\ndef_op('RESERVED',17)\n\ndef_op('BINARY_SUBSCR',25)\ndef_op('BINARY_SLICE',26)\ndef_op('STORE_SLICE',27)\n\ndef_op('GET_LEN',30)\ndef_op('MATCH_MAPPING',31)\ndef_op('MATCH_SEQUENCE',32)\ndef_op('MATCH_KEYS',33)\n\ndef_op('PUSH_EXC_INFO',35)\ndef_op('CHECK_EXC_MATCH',36)\ndef_op('CHECK_EG_MATCH',37)\n\ndef_op('WITH_EXCEPT_START',49)\ndef_op('GET_AITER',50)\ndef_op('GET_ANEXT',51)\ndef_op('BEFORE_ASYNC_WITH',52)\ndef_op('BEFORE_WITH',53)\ndef_op('END_ASYNC_FOR',54)\ndef_op('CLEANUP_THROW',55)\n\ndef_op('STORE_SUBSCR',60)\ndef_op('DELETE_SUBSCR',61)\n\ndef_op('GET_ITER',68)\ndef_op('GET_YIELD_FROM_ITER',69)\n\ndef_op('LOAD_BUILD_CLASS',71)\n\ndef_op('LOAD_ASSERTION_ERROR',74)\ndef_op('RETURN_GENERATOR',75)\n\ndef_op('RETURN_VALUE',83)\n\ndef_op('SETUP_ANNOTATIONS',85)\ndef_op('LOAD_LOCALS',87)\n\ndef_op('POP_EXCEPT',89)\n\nHAVE_ARGUMENT=90\n\nname_op('STORE_NAME',90)\nname_op('DELETE_NAME',91)\ndef_op('UNPACK_SEQUENCE',92)\njrel_op('FOR_ITER',93)\ndef_op('UNPACK_EX',94)\nname_op('STORE_ATTR',95)\nname_op('DELETE_ATTR',96)\nname_op('STORE_GLOBAL',97)\nname_op('DELETE_GLOBAL',98)\ndef_op('SWAP',99)\ndef_op('LOAD_CONST',100)\nhasconst.append(100)\nname_op('LOAD_NAME',101)\ndef_op('BUILD_TUPLE',102)\ndef_op('BUILD_LIST',103)\ndef_op('BUILD_SET',104)\ndef_op('BUILD_MAP',105)\nname_op('LOAD_ATTR',106)\ndef_op('COMPARE_OP',107)\nhascompare.append(107)\nname_op('IMPORT_NAME',108)\nname_op('IMPORT_FROM',109)\njrel_op('JUMP_FORWARD',110)\njrel_op('POP_JUMP_IF_FALSE',114)\njrel_op('POP_JUMP_IF_TRUE',115)\nname_op('LOAD_GLOBAL',116)\ndef_op('IS_OP',117)\ndef_op('CONTAINS_OP',118)\ndef_op('RERAISE',119)\ndef_op('COPY',120)\ndef_op('RETURN_CONST',121)\nhasconst.append(121)\ndef_op('BINARY_OP',122)\njrel_op('SEND',123)\ndef_op('LOAD_FAST',124)\nhaslocal.append(124)\ndef_op('STORE_FAST',125)\nhaslocal.append(125)\ndef_op('DELETE_FAST',126)\nhaslocal.append(126)\ndef_op('LOAD_FAST_CHECK',127)\nhaslocal.append(127)\njrel_op('POP_JUMP_IF_NOT_NONE',128)\njrel_op('POP_JUMP_IF_NONE',129)\ndef_op('RAISE_VARARGS',130)\ndef_op('GET_AWAITABLE',131)\ndef_op('MAKE_FUNCTION',132)\ndef_op('BUILD_SLICE',133)\njrel_op('JUMP_BACKWARD_NO_INTERRUPT',134)\ndef_op('MAKE_CELL',135)\nhasfree.append(135)\ndef_op('LOAD_CLOSURE',136)\nhasfree.append(136)\ndef_op('LOAD_DEREF',137)\nhasfree.append(137)\ndef_op('STORE_DEREF',138)\nhasfree.append(138)\ndef_op('DELETE_DEREF',139)\nhasfree.append(139)\njrel_op('JUMP_BACKWARD',140)\nname_op('LOAD_SUPER_ATTR',141)\ndef_op('CALL_FUNCTION_EX',142)\ndef_op('LOAD_FAST_AND_CLEAR',143)\nhaslocal.append(143)\n\ndef_op('EXTENDED_ARG',144)\nEXTENDED_ARG=144\ndef_op('LIST_APPEND',145)\ndef_op('SET_ADD',146)\ndef_op('MAP_ADD',147)\nhasfree.append(148)\ndef_op('COPY_FREE_VARS',149)\ndef_op('YIELD_VALUE',150)\ndef_op('RESUME',151)\ndef_op('MATCH_CLASS',152)\n\ndef_op('FORMAT_VALUE',155)\ndef_op('BUILD_CONST_KEY_MAP',156)\ndef_op('BUILD_STRING',157)\n\ndef_op('LIST_EXTEND',162)\ndef_op('SET_UPDATE',163)\ndef_op('DICT_MERGE',164)\ndef_op('DICT_UPDATE',165)\n\ndef_op('CALL',171)\ndef_op('KW_NAMES',172)\nhasconst.append(172)\ndef_op('CALL_INTRINSIC_1',173)\ndef_op('CALL_INTRINSIC_2',174)\n\nname_op('LOAD_FROM_DICT_OR_GLOBALS',175)\ndef_op('LOAD_FROM_DICT_OR_DEREF',176)\nhasfree.append(176)\n\n\nMIN_INSTRUMENTED_OPCODE=237\n\ndef_op('INSTRUMENTED_LOAD_SUPER_ATTR',237)\ndef_op('INSTRUMENTED_POP_JUMP_IF_NONE',238)\ndef_op('INSTRUMENTED_POP_JUMP_IF_NOT_NONE',239)\ndef_op('INSTRUMENTED_RESUME',240)\ndef_op('INSTRUMENTED_CALL',241)\ndef_op('INSTRUMENTED_RETURN_VALUE',242)\ndef_op('INSTRUMENTED_YIELD_VALUE',243)\ndef_op('INSTRUMENTED_CALL_FUNCTION_EX',244)\ndef_op('INSTRUMENTED_JUMP_FORWARD',245)\ndef_op('INSTRUMENTED_JUMP_BACKWARD',246)\ndef_op('INSTRUMENTED_RETURN_CONST',247)\ndef_op('INSTRUMENTED_FOR_ITER',248)\ndef_op('INSTRUMENTED_POP_JUMP_IF_FALSE',249)\ndef_op('INSTRUMENTED_POP_JUMP_IF_TRUE',250)\ndef_op('INSTRUMENTED_END_FOR',251)\ndef_op('INSTRUMENTED_END_SEND',252)\ndef_op('INSTRUMENTED_INSTRUCTION',253)\ndef_op('INSTRUMENTED_LINE',254)\n\n\nhasarg.extend([op for op in opmap.values()if op >=HAVE_ARGUMENT])\n\nMIN_PSEUDO_OPCODE=256\n\npseudo_op('SETUP_FINALLY',256,['NOP'])\nhasexc.append(256)\npseudo_op('SETUP_CLEANUP',257,['NOP'])\nhasexc.append(257)\npseudo_op('SETUP_WITH',258,['NOP'])\nhasexc.append(258)\npseudo_op('POP_BLOCK',259,['NOP'])\n\npseudo_op('JUMP',260,['JUMP_FORWARD','JUMP_BACKWARD'])\npseudo_op('JUMP_NO_INTERRUPT',261,['JUMP_FORWARD','JUMP_BACKWARD_NO_INTERRUPT'])\n\npseudo_op('LOAD_METHOD',262,['LOAD_ATTR'])\npseudo_op('LOAD_SUPER_METHOD',263,['LOAD_SUPER_ATTR'])\npseudo_op('LOAD_ZERO_SUPER_METHOD',264,['LOAD_SUPER_ATTR'])\npseudo_op('LOAD_ZERO_SUPER_ATTR',265,['LOAD_SUPER_ATTR'])\n\npseudo_op('STORE_FAST_MAYBE_NULL',266,['STORE_FAST'])\n\nMAX_PSEUDO_OPCODE=MIN_PSEUDO_OPCODE+len(_pseudo_ops)-1\n\ndel def_op,name_op,jrel_op,jabs_op,pseudo_op\n\nopname=['<%r>'%(op,)for op in range(MAX_PSEUDO_OPCODE+1)]\nfor op,i in opmap.items():\n opname[i]=op\n \n \n_nb_ops=[\n(\"NB_ADD\",\"+\"),\n(\"NB_AND\",\"&\"),\n(\"NB_FLOOR_DIVIDE\",\"//\"),\n(\"NB_LSHIFT\",\"<<\"),\n(\"NB_MATRIX_MULTIPLY\",\"@\"),\n(\"NB_MULTIPLY\",\"*\"),\n(\"NB_REMAINDER\",\"%\"),\n(\"NB_OR\",\"|\"),\n(\"NB_POWER\",\"**\"),\n(\"NB_RSHIFT\",\">>\"),\n(\"NB_SUBTRACT\",\"-\"),\n(\"NB_TRUE_DIVIDE\",\"/\"),\n(\"NB_XOR\",\"^\"),\n(\"NB_INPLACE_ADD\",\"+=\"),\n(\"NB_INPLACE_AND\",\"&=\"),\n(\"NB_INPLACE_FLOOR_DIVIDE\",\"//=\"),\n(\"NB_INPLACE_LSHIFT\",\"<<=\"),\n(\"NB_INPLACE_MATRIX_MULTIPLY\",\"@=\"),\n(\"NB_INPLACE_MULTIPLY\",\"*=\"),\n(\"NB_INPLACE_REMAINDER\",\"%=\"),\n(\"NB_INPLACE_OR\",\"|=\"),\n(\"NB_INPLACE_POWER\",\"**=\"),\n(\"NB_INPLACE_RSHIFT\",\">>=\"),\n(\"NB_INPLACE_SUBTRACT\",\"-=\"),\n(\"NB_INPLACE_TRUE_DIVIDE\",\"/=\"),\n(\"NB_INPLACE_XOR\",\"^=\"),\n]\n\n_intrinsic_1_descs=[\n\"INTRINSIC_1_INVALID\",\n\"INTRINSIC_PRINT\",\n\"INTRINSIC_IMPORT_STAR\",\n\"INTRINSIC_STOPITERATION_ERROR\",\n\"INTRINSIC_ASYNC_GEN_WRAP\",\n\"INTRINSIC_UNARY_POSITIVE\",\n\"INTRINSIC_LIST_TO_TUPLE\",\n\"INTRINSIC_TYPEVAR\",\n\"INTRINSIC_PARAMSPEC\",\n\"INTRINSIC_TYPEVARTUPLE\",\n\"INTRINSIC_SUBSCRIPT_GENERIC\",\n\"INTRINSIC_TYPEALIAS\",\n]\n\n_intrinsic_2_descs=[\n\"INTRINSIC_2_INVALID\",\n\"INTRINSIC_PREP_RERAISE_STAR\",\n\"INTRINSIC_TYPEVAR_WITH_BOUND\",\n\"INTRINSIC_TYPEVAR_WITH_CONSTRAINTS\",\n\"INTRINSIC_SET_FUNCTION_TYPE_PARAMS\",\n]\n\n_specializations={\n\"BINARY_OP\":[\n\"BINARY_OP_ADD_FLOAT\",\n\"BINARY_OP_ADD_INT\",\n\"BINARY_OP_ADD_UNICODE\",\n\"BINARY_OP_INPLACE_ADD_UNICODE\",\n\"BINARY_OP_MULTIPLY_FLOAT\",\n\"BINARY_OP_MULTIPLY_INT\",\n\"BINARY_OP_SUBTRACT_FLOAT\",\n\"BINARY_OP_SUBTRACT_INT\",\n],\n\"BINARY_SUBSCR\":[\n\"BINARY_SUBSCR_DICT\",\n\"BINARY_SUBSCR_GETITEM\",\n\"BINARY_SUBSCR_LIST_INT\",\n\"BINARY_SUBSCR_TUPLE_INT\",\n],\n\"CALL\":[\n\"CALL_PY_EXACT_ARGS\",\n\"CALL_PY_WITH_DEFAULTS\",\n\"CALL_BOUND_METHOD_EXACT_ARGS\",\n\"CALL_BUILTIN_CLASS\",\n\"CALL_BUILTIN_FAST_WITH_KEYWORDS\",\n\"CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS\",\n\"CALL_NO_KW_BUILTIN_FAST\",\n\"CALL_NO_KW_BUILTIN_O\",\n\"CALL_NO_KW_ISINSTANCE\",\n\"CALL_NO_KW_LEN\",\n\"CALL_NO_KW_LIST_APPEND\",\n\"CALL_NO_KW_METHOD_DESCRIPTOR_FAST\",\n\"CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS\",\n\"CALL_NO_KW_METHOD_DESCRIPTOR_O\",\n\"CALL_NO_KW_STR_1\",\n\"CALL_NO_KW_TUPLE_1\",\n\"CALL_NO_KW_TYPE_1\",\n],\n\"COMPARE_OP\":[\n\"COMPARE_OP_FLOAT\",\n\"COMPARE_OP_INT\",\n\"COMPARE_OP_STR\",\n],\n\"FOR_ITER\":[\n\"FOR_ITER_LIST\",\n\"FOR_ITER_TUPLE\",\n\"FOR_ITER_RANGE\",\n\"FOR_ITER_GEN\",\n],\n\"LOAD_SUPER_ATTR\":[\n\"LOAD_SUPER_ATTR_ATTR\",\n\"LOAD_SUPER_ATTR_METHOD\",\n],\n\"LOAD_ATTR\":[\n\n\"LOAD_ATTR_CLASS\",\n\"LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN\",\n\"LOAD_ATTR_INSTANCE_VALUE\",\n\"LOAD_ATTR_MODULE\",\n\"LOAD_ATTR_PROPERTY\",\n\"LOAD_ATTR_SLOT\",\n\"LOAD_ATTR_WITH_HINT\",\n\n\"LOAD_ATTR_METHOD_LAZY_DICT\",\n\"LOAD_ATTR_METHOD_NO_DICT\",\n\"LOAD_ATTR_METHOD_WITH_VALUES\",\n],\n\"LOAD_CONST\":[\n\"LOAD_CONST__LOAD_FAST\",\n],\n\"LOAD_FAST\":[\n\"LOAD_FAST__LOAD_CONST\",\n\"LOAD_FAST__LOAD_FAST\",\n],\n\"LOAD_GLOBAL\":[\n\"LOAD_GLOBAL_BUILTIN\",\n\"LOAD_GLOBAL_MODULE\",\n],\n\"STORE_ATTR\":[\n\"STORE_ATTR_INSTANCE_VALUE\",\n\"STORE_ATTR_SLOT\",\n\"STORE_ATTR_WITH_HINT\",\n],\n\"STORE_FAST\":[\n\"STORE_FAST__LOAD_FAST\",\n\"STORE_FAST__STORE_FAST\",\n],\n\"STORE_SUBSCR\":[\n\"STORE_SUBSCR_DICT\",\n\"STORE_SUBSCR_LIST_INT\",\n],\n\"UNPACK_SEQUENCE\":[\n\"UNPACK_SEQUENCE_LIST\",\n\"UNPACK_SEQUENCE_TUPLE\",\n\"UNPACK_SEQUENCE_TWO_TUPLE\",\n],\n\"SEND\":[\n\"SEND_GEN\",\n],\n}\n_specialized_instructions=[\nopcode for family in _specializations.values()for opcode in family\n]\n\n_cache_format={\n\"LOAD_GLOBAL\":{\n\"counter\":1,\n\"index\":1,\n\"module_keys_version\":1,\n\"builtin_keys_version\":1,\n},\n\"BINARY_OP\":{\n\"counter\":1,\n},\n\"UNPACK_SEQUENCE\":{\n\"counter\":1,\n},\n\"COMPARE_OP\":{\n\"counter\":1,\n},\n\"BINARY_SUBSCR\":{\n\"counter\":1,\n},\n\"FOR_ITER\":{\n\"counter\":1,\n},\n\"LOAD_SUPER_ATTR\":{\n\"counter\":1,\n},\n\"LOAD_ATTR\":{\n\"counter\":1,\n\"version\":2,\n\"keys_version\":2,\n\"descr\":4,\n},\n\"STORE_ATTR\":{\n\"counter\":1,\n\"version\":2,\n\"index\":1,\n},\n\"CALL\":{\n\"counter\":1,\n\"func_version\":2,\n},\n\"STORE_SUBSCR\":{\n\"counter\":1,\n},\n\"SEND\":{\n\"counter\":1,\n},\n}\n\n_inline_cache_entries=[\nsum(_cache_format.get(opname[opcode],{}).values())for opcode in range(256)\n]\n", ["_opcode"]], "operator": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n__all__=['abs','add','and_','attrgetter','call','concat','contains','countOf',\n'delitem','eq','floordiv','ge','getitem','gt','iadd','iand',\n'iconcat','ifloordiv','ilshift','imatmul','imod','imul',\n'index','indexOf','inv','invert','ior','ipow','irshift',\n'is_','is_not','isub','itemgetter','itruediv','ixor','le',\n'length_hint','lshift','lt','matmul','methodcaller','mod',\n'mul','ne','neg','not_','or_','pos','pow','rshift',\n'setitem','sub','truediv','truth','xor']\n\nfrom builtins import abs as _abs\n\n\n\n\ndef lt(a,b):\n ''\n return a =b\n \ndef gt(a,b):\n ''\n return a >b\n \n \n \ndef not_(a):\n ''\n return not a\n \ndef truth(a):\n ''\n return True if a else False\n \ndef is_(a,b):\n ''\n return a is b\n \ndef is_not(a,b):\n ''\n return a is not b\n \n \n \ndef abs(a):\n ''\n return _abs(a)\n \ndef add(a,b):\n ''\n return a+b\n \ndef and_(a,b):\n ''\n return a&b\n \ndef floordiv(a,b):\n ''\n return a //b\n \ndef index(a):\n ''\n return a.__index__()\n \ndef inv(a):\n ''\n return ~a\ninvert=inv\n\ndef lshift(a,b):\n ''\n return a <>b\n \ndef sub(a,b):\n ''\n return a -b\n \ndef truediv(a,b):\n ''\n return a /b\n \ndef xor(a,b):\n ''\n return a ^b\n \n \n \ndef concat(a,b):\n ''\n if not hasattr(a,'__getitem__'):\n msg=\"'%s' object can't be concatenated\"%type(a).__name__\n raise TypeError(msg)\n return a+b\n \ndef contains(a,b):\n ''\n return b in a\n \ndef countOf(a,b):\n ''\n count=0\n for i in a:\n if i is b or i ==b:\n count +=1\n return count\n \ndef delitem(a,b):\n ''\n del a[b]\n \ndef getitem(a,b):\n ''\n return a[b]\n \ndef indexOf(a,b):\n ''\n for i,j in enumerate(a):\n if j is b or j ==b:\n return i\n else :\n raise ValueError('sequence.index(x): x not in sequence')\n \ndef setitem(a,b,c):\n ''\n a[b]=c\n \ndef length_hint(obj,default=0):\n ''\n\n\n\n\n\n\n \n if not isinstance(default,int):\n msg=(\"'%s' object cannot be interpreted as an integer\"%\n type(default).__name__)\n raise TypeError(msg)\n \n try :\n return len(obj)\n except TypeError:\n pass\n \n try :\n hint=type(obj).__length_hint__\n except AttributeError:\n return default\n \n try :\n val=hint(obj)\n except TypeError:\n return default\n if val is NotImplemented:\n return default\n if not isinstance(val,int):\n msg=('__length_hint__ must be integer, not %s'%\n type(val).__name__)\n raise TypeError(msg)\n if val <0:\n msg='__length_hint__() should return >= 0'\n raise ValueError(msg)\n return val\n \n \n \ndef call(obj,/,*args,**kwargs):\n ''\n return obj(*args,**kwargs)\n \n \n \nclass attrgetter:\n ''\n\n\n\n\n\n \n __slots__=('_attrs','_call')\n \n def __init__(self,attr,*attrs):\n if not attrs:\n if not isinstance(attr,str):\n raise TypeError('attribute name must be a string')\n self._attrs=(attr,)\n names=attr.split('.')\n def func(obj):\n for name in names:\n obj=getattr(obj,name)\n return obj\n self._call=func\n else :\n self._attrs=(attr,)+attrs\n getters=tuple(map(attrgetter,self._attrs))\n def func(obj):\n return tuple(getter(obj)for getter in getters)\n self._call=func\n \n def __call__(self,obj):\n return self._call(obj)\n \n def __repr__(self):\n return '%s.%s(%s)'%(self.__class__.__module__,\n self.__class__.__qualname__,\n ', '.join(map(repr,self._attrs)))\n \n def __reduce__(self):\n return self.__class__,self._attrs\n \nclass itemgetter:\n ''\n\n\n\n \n __slots__=('_items','_call')\n \n def __init__(self,item,*items):\n if not items:\n self._items=(item,)\n def func(obj):\n return obj[item]\n self._call=func\n else :\n self._items=items=(item,)+items\n def func(obj):\n return tuple(obj[i]for i in items)\n self._call=func\n \n def __call__(self,obj):\n return self._call(obj)\n \n def __repr__(self):\n return '%s.%s(%s)'%(self.__class__.__module__,\n self.__class__.__name__,\n ', '.join(map(repr,self._items)))\n \n def __reduce__(self):\n return self.__class__,self._items\n \nclass methodcaller:\n ''\n\n\n\n\n \n __slots__=('_name','_args','_kwargs')\n \n def __init__(self,name,/,*args,**kwargs):\n self._name=name\n if not isinstance(self._name,str):\n raise TypeError('method name must be a string')\n self._args=args\n self._kwargs=kwargs\n \n def __call__(self,obj):\n return getattr(obj,self._name)(*self._args,**self._kwargs)\n \n def __repr__(self):\n args=[repr(self._name)]\n args.extend(map(repr,self._args))\n args.extend('%s=%r'%(k,v)for k,v in self._kwargs.items())\n return '%s.%s(%s)'%(self.__class__.__module__,\n self.__class__.__name__,\n ', '.join(args))\n \n def __reduce__(self):\n if not self._kwargs:\n return self.__class__,(self._name,)+self._args\n else :\n from functools import partial\n return partial(self.__class__,self._name,**self._kwargs),self._args\n \n \n \n \ndef iadd(a,b):\n ''\n a +=b\n return a\n \ndef iand(a,b):\n ''\n a &=b\n return a\n \ndef iconcat(a,b):\n ''\n if not hasattr(a,'__getitem__'):\n msg=\"'%s' object can't be concatenated\"%type(a).__name__\n raise TypeError(msg)\n a +=b\n return a\n \ndef ifloordiv(a,b):\n ''\n a //=b\n return a\n \ndef ilshift(a,b):\n ''\n a <<=b\n return a\n \ndef imod(a,b):\n ''\n a %=b\n return a\n \ndef imul(a,b):\n ''\n a *=b\n return a\n \ndef imatmul(a,b):\n ''\n a @=b\n return a\n \ndef ior(a,b):\n ''\n a |=b\n return a\n \ndef ipow(a,b):\n ''\n a **=b\n return a\n \ndef irshift(a,b):\n ''\n a >>=b\n return a\n \ndef isub(a,b):\n ''\n a -=b\n return a\n \ndef itruediv(a,b):\n ''\n a /=b\n return a\n \ndef ixor(a,b):\n ''\n a ^=b\n return a\n \n \ntry :\n from _operator import *\nexcept ImportError:\n pass\nelse :\n from _operator import __doc__\n \n \n \n__lt__=lt\n__le__=le\n__eq__=eq\n__ne__=ne\n__ge__=ge\n__gt__=gt\n__not__=not_\n__abs__=abs\n__add__=add\n__and__=and_\n__call__=call\n__floordiv__=floordiv\n__index__=index\n__inv__=inv\n__invert__=invert\n__lshift__=lshift\n__mod__=mod\n__mul__=mul\n__matmul__=matmul\n__neg__=neg\n__or__=or_\n__pos__=pos\n__pow__=pow\n__rshift__=rshift\n__sub__=sub\n__truediv__=truediv\n__xor__=xor\n__concat__=concat\n__contains__=contains\n__delitem__=delitem\n__getitem__=getitem\n__setitem__=setitem\n__iadd__=iadd\n__iand__=iand\n__iconcat__=iconcat\n__ifloordiv__=ifloordiv\n__ilshift__=ilshift\n__imod__=imod\n__imul__=imul\n__imatmul__=imatmul\n__ior__=ior\n__ipow__=ipow\n__irshift__=irshift\n__isub__=isub\n__itruediv__=itruediv\n__ixor__=ixor\n", ["_operator", "builtins", "functools"]], "optparse": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__version__=\"1.5.3\"\n\n__all__=['Option',\n'make_option',\n'SUPPRESS_HELP',\n'SUPPRESS_USAGE',\n'Values',\n'OptionContainer',\n'OptionGroup',\n'OptionParser',\n'HelpFormatter',\n'IndentedHelpFormatter',\n'TitledHelpFormatter',\n'OptParseError',\n'OptionError',\n'OptionConflictError',\n'OptionValueError',\n'BadOptionError',\n'check_choice']\n\n__copyright__=\"\"\"\nCopyright (c) 2001-2006 Gregory P. Ward. All rights reserved.\nCopyright (c) 2002-2006 Python Software Foundation. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n * Neither the name of the author nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\nIS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\nTO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\nEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\nPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\"\"\"\n\nimport sys,os\nimport textwrap\n\ndef _repr(self):\n return \"<%s at 0x%x: %s>\"%(self.__class__.__name__,id(self),self)\n \n \n \n \n \n \n \n \ntry :\n from gettext import gettext,ngettext\nexcept ImportError:\n def gettext(message):\n return message\n \n def ngettext(singular,plural,n):\n if n ==1:\n return singular\n return plural\n \n_=gettext\n\n\nclass OptParseError(Exception):\n def __init__(self,msg):\n self.msg=msg\n \n def __str__(self):\n return self.msg\n \n \nclass OptionError(OptParseError):\n ''\n\n\n \n \n def __init__(self,msg,option):\n self.msg=msg\n self.option_id=str(option)\n \n def __str__(self):\n if self.option_id:\n return \"option %s: %s\"%(self.option_id,self.msg)\n else :\n return self.msg\n \nclass OptionConflictError(OptionError):\n ''\n\n \n \nclass OptionValueError(OptParseError):\n ''\n\n\n \n \nclass BadOptionError(OptParseError):\n ''\n\n \n def __init__(self,opt_str):\n self.opt_str=opt_str\n \n def __str__(self):\n return _(\"no such option: %s\")%self.opt_str\n \nclass AmbiguousOptionError(BadOptionError):\n ''\n\n \n def __init__(self,opt_str,possibilities):\n BadOptionError.__init__(self,opt_str)\n self.possibilities=possibilities\n \n def __str__(self):\n return (_(\"ambiguous option: %s (%s?)\")\n %(self.opt_str,\", \".join(self.possibilities)))\n \n \nclass HelpFormatter:\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n NO_DEFAULT_VALUE=\"none\"\n \n def __init__(self,\n indent_increment,\n max_help_position,\n width,\n short_first):\n self.parser=None\n self.indent_increment=indent_increment\n if width is None :\n try :\n width=int(os.environ['COLUMNS'])\n except (KeyError,ValueError):\n width=80\n width -=2\n self.width=width\n self.help_position=self.max_help_position=\\\n min(max_help_position,max(width -20,indent_increment *2))\n self.current_indent=0\n self.level=0\n self.help_width=None\n self.short_first=short_first\n self.default_tag=\"%default\"\n self.option_strings={}\n self._short_opt_fmt=\"%s %s\"\n self._long_opt_fmt=\"%s=%s\"\n \n def set_parser(self,parser):\n self.parser=parser\n \n def set_short_opt_delimiter(self,delim):\n if delim not in (\"\",\" \"):\n raise ValueError(\n \"invalid metavar delimiter for short options: %r\"%delim)\n self._short_opt_fmt=\"%s\"+delim+\"%s\"\n \n def set_long_opt_delimiter(self,delim):\n if delim not in (\"=\",\" \"):\n raise ValueError(\n \"invalid metavar delimiter for long options: %r\"%delim)\n self._long_opt_fmt=\"%s\"+delim+\"%s\"\n \n def indent(self):\n self.current_indent +=self.indent_increment\n self.level +=1\n \n def dedent(self):\n self.current_indent -=self.indent_increment\n assert self.current_indent >=0,\"Indent decreased below 0.\"\n self.level -=1\n \n def format_usage(self,usage):\n raise NotImplementedError(\"subclasses must implement\")\n \n def format_heading(self,heading):\n raise NotImplementedError(\"subclasses must implement\")\n \n def _format_text(self,text):\n ''\n\n\n \n text_width=max(self.width -self.current_indent,11)\n indent=\" \"*self.current_indent\n return textwrap.fill(text,\n text_width,\n initial_indent=indent,\n subsequent_indent=indent)\n \n def format_description(self,description):\n if description:\n return self._format_text(description)+\"\\n\"\n else :\n return \"\"\n \n def format_epilog(self,epilog):\n if epilog:\n return \"\\n\"+self._format_text(epilog)+\"\\n\"\n else :\n return \"\"\n \n \n def expand_default(self,option):\n if self.parser is None or not self.default_tag:\n return option.help\n \n default_value=self.parser.defaults.get(option.dest)\n if default_value is NO_DEFAULT or default_value is None :\n default_value=self.NO_DEFAULT_VALUE\n \n return option.help.replace(self.default_tag,str(default_value))\n \n def format_option(self,option):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n result=[]\n opts=self.option_strings[option]\n opt_width=self.help_position -self.current_indent -2\n if len(opts)>opt_width:\n opts=\"%*s%s\\n\"%(self.current_indent,\"\",opts)\n indent_first=self.help_position\n else :\n opts=\"%*s%-*s \"%(self.current_indent,\"\",opt_width,opts)\n indent_first=0\n result.append(opts)\n if option.help:\n help_text=self.expand_default(option)\n help_lines=textwrap.wrap(help_text,self.help_width)\n result.append(\"%*s%s\\n\"%(indent_first,\"\",help_lines[0]))\n result.extend([\"%*s%s\\n\"%(self.help_position,\"\",line)\n for line in help_lines[1:]])\n elif opts[-1]!=\"\\n\":\n result.append(\"\\n\")\n return \"\".join(result)\n \n def store_option_strings(self,parser):\n self.indent()\n max_len=0\n for opt in parser.option_list:\n strings=self.format_option_strings(opt)\n self.option_strings[opt]=strings\n max_len=max(max_len,len(strings)+self.current_indent)\n self.indent()\n for group in parser.option_groups:\n for opt in group.option_list:\n strings=self.format_option_strings(opt)\n self.option_strings[opt]=strings\n max_len=max(max_len,len(strings)+self.current_indent)\n self.dedent()\n self.dedent()\n self.help_position=min(max_len+2,self.max_help_position)\n self.help_width=max(self.width -self.help_position,11)\n \n def format_option_strings(self,option):\n ''\n if option.takes_value():\n metavar=option.metavar or option.dest.upper()\n short_opts=[self._short_opt_fmt %(sopt,metavar)\n for sopt in option._short_opts]\n long_opts=[self._long_opt_fmt %(lopt,metavar)\n for lopt in option._long_opts]\n else :\n short_opts=option._short_opts\n long_opts=option._long_opts\n \n if self.short_first:\n opts=short_opts+long_opts\n else :\n opts=long_opts+short_opts\n \n return \", \".join(opts)\n \nclass IndentedHelpFormatter(HelpFormatter):\n ''\n \n \n def __init__(self,\n indent_increment=2,\n max_help_position=24,\n width=None ,\n short_first=1):\n HelpFormatter.__init__(\n self,indent_increment,max_help_position,width,short_first)\n \n def format_usage(self,usage):\n return _(\"Usage: %s\\n\")%usage\n \n def format_heading(self,heading):\n return \"%*s%s:\\n\"%(self.current_indent,\"\",heading)\n \n \nclass TitledHelpFormatter(HelpFormatter):\n ''\n \n \n def __init__(self,\n indent_increment=0,\n max_help_position=24,\n width=None ,\n short_first=0):\n HelpFormatter.__init__(\n self,indent_increment,max_help_position,width,short_first)\n \n def format_usage(self,usage):\n return \"%s %s\\n\"%(self.format_heading(_(\"Usage\")),usage)\n \n def format_heading(self,heading):\n return \"%s\\n%s\\n\"%(heading,\"=-\"[self.level]*len(heading))\n \n \ndef _parse_num(val,type):\n if val[:2].lower()==\"0x\":\n radix=16\n elif val[:2].lower()==\"0b\":\n radix=2\n val=val[2:]or \"0\"\n elif val[:1]==\"0\":\n radix=8\n else :\n radix=10\n \n return type(val,radix)\n \ndef _parse_int(val):\n return _parse_num(val,int)\n \n_builtin_cvt={\"int\":(_parse_int,_(\"integer\")),\n\"long\":(_parse_int,_(\"integer\")),\n\"float\":(float,_(\"floating-point\")),\n\"complex\":(complex,_(\"complex\"))}\n\ndef check_builtin(option,opt,value):\n (cvt,what)=_builtin_cvt[option.type]\n try :\n return cvt(value)\n except ValueError:\n raise OptionValueError(\n _(\"option %s: invalid %s value: %r\")%(opt,what,value))\n \ndef check_choice(option,opt,value):\n if value in option.choices:\n return value\n else :\n choices=\", \".join(map(repr,option.choices))\n raise OptionValueError(\n _(\"option %s: invalid choice: %r (choose from %s)\")\n %(opt,value,choices))\n \n \n \nNO_DEFAULT=(\"NO\",\"DEFAULT\")\n\n\nclass Option:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n ATTRS=['action',\n 'type',\n 'dest',\n 'default',\n 'nargs',\n 'const',\n 'choices',\n 'callback',\n 'callback_args',\n 'callback_kwargs',\n 'help',\n 'metavar']\n \n \n \n ACTIONS=(\"store\",\n \"store_const\",\n \"store_true\",\n \"store_false\",\n \"append\",\n \"append_const\",\n \"count\",\n \"callback\",\n \"help\",\n \"version\")\n \n \n \n \n STORE_ACTIONS=(\"store\",\n \"store_const\",\n \"store_true\",\n \"store_false\",\n \"append\",\n \"append_const\",\n \"count\")\n \n \n \n TYPED_ACTIONS=(\"store\",\n \"append\",\n \"callback\")\n \n \n \n ALWAYS_TYPED_ACTIONS=(\"store\",\n \"append\")\n \n \n CONST_ACTIONS=(\"store_const\",\n \"append_const\")\n \n \n \n TYPES=(\"string\",\"int\",\"long\",\"float\",\"complex\",\"choice\")\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n TYPE_CHECKER={\"int\":check_builtin,\n \"long\":check_builtin,\n \"float\":check_builtin,\n \"complex\":check_builtin,\n \"choice\":check_choice,\n }\n \n \n \n \n \n \n \n \n \n \n CHECK_METHODS=None\n \n \n \n \n def __init__(self,*opts,**attrs):\n \n \n self._short_opts=[]\n self._long_opts=[]\n opts=self._check_opt_strings(opts)\n self._set_opt_strings(opts)\n \n \n self._set_attrs(attrs)\n \n \n \n \n \n \n for checker in self.CHECK_METHODS:\n checker(self)\n \n def _check_opt_strings(self,opts):\n \n \n \n opts=[opt for opt in opts if opt]\n if not opts:\n raise TypeError(\"at least one option string must be supplied\")\n return opts\n \n def _set_opt_strings(self,opts):\n for opt in opts:\n if len(opt)<2:\n raise OptionError(\n \"invalid option string %r: \"\n \"must be at least two characters long\"%opt,self)\n elif len(opt)==2:\n if not (opt[0]==\"-\"and opt[1]!=\"-\"):\n raise OptionError(\n \"invalid short option string %r: \"\n \"must be of the form -x, (x any non-dash char)\"%opt,\n self)\n self._short_opts.append(opt)\n else :\n if not (opt[0:2]==\"--\"and opt[2]!=\"-\"):\n raise OptionError(\n \"invalid long option string %r: \"\n \"must start with --, followed by non-dash\"%opt,\n self)\n self._long_opts.append(opt)\n \n def _set_attrs(self,attrs):\n for attr in self.ATTRS:\n if attr in attrs:\n setattr(self,attr,attrs[attr])\n del attrs[attr]\n else :\n if attr =='default':\n setattr(self,attr,NO_DEFAULT)\n else :\n setattr(self,attr,None )\n if attrs:\n attrs=sorted(attrs.keys())\n raise OptionError(\n \"invalid keyword arguments: %s\"%\", \".join(attrs),\n self)\n \n \n \n \n def _check_action(self):\n if self.action is None :\n self.action=\"store\"\n elif self.action not in self.ACTIONS:\n raise OptionError(\"invalid action: %r\"%self.action,self)\n \n def _check_type(self):\n if self.type is None :\n if self.action in self.ALWAYS_TYPED_ACTIONS:\n if self.choices is not None :\n \n self.type=\"choice\"\n else :\n \n self.type=\"string\"\n else :\n \n \n if isinstance(self.type,type):\n self.type=self.type.__name__\n \n if self.type ==\"str\":\n self.type=\"string\"\n \n if self.type not in self.TYPES:\n raise OptionError(\"invalid option type: %r\"%self.type,self)\n if self.action not in self.TYPED_ACTIONS:\n raise OptionError(\n \"must not supply a type for action %r\"%self.action,self)\n \n def _check_choice(self):\n if self.type ==\"choice\":\n if self.choices is None :\n raise OptionError(\n \"must supply a list of choices for type 'choice'\",self)\n elif not isinstance(self.choices,(tuple,list)):\n raise OptionError(\n \"choices must be a list of strings ('%s' supplied)\"\n %str(type(self.choices)).split(\"'\")[1],self)\n elif self.choices is not None :\n raise OptionError(\n \"must not supply choices for type %r\"%self.type,self)\n \n def _check_dest(self):\n \n \n takes_value=(self.action in self.STORE_ACTIONS or\n self.type is not None )\n if self.dest is None and takes_value:\n \n \n \n if self._long_opts:\n \n self.dest=self._long_opts[0][2:].replace('-','_')\n else :\n self.dest=self._short_opts[0][1]\n \n def _check_const(self):\n if self.action not in self.CONST_ACTIONS and self.const is not None :\n raise OptionError(\n \"'const' must not be supplied for action %r\"%self.action,\n self)\n \n def _check_nargs(self):\n if self.action in self.TYPED_ACTIONS:\n if self.nargs is None :\n self.nargs=1\n elif self.nargs is not None :\n raise OptionError(\n \"'nargs' must not be supplied for action %r\"%self.action,\n self)\n \n def _check_callback(self):\n if self.action ==\"callback\":\n if not callable(self.callback):\n raise OptionError(\n \"callback not callable: %r\"%self.callback,self)\n if (self.callback_args is not None and\n not isinstance(self.callback_args,tuple)):\n raise OptionError(\n \"callback_args, if supplied, must be a tuple: not %r\"\n %self.callback_args,self)\n if (self.callback_kwargs is not None and\n not isinstance(self.callback_kwargs,dict)):\n raise OptionError(\n \"callback_kwargs, if supplied, must be a dict: not %r\"\n %self.callback_kwargs,self)\n else :\n if self.callback is not None :\n raise OptionError(\n \"callback supplied (%r) for non-callback option\"\n %self.callback,self)\n if self.callback_args is not None :\n raise OptionError(\n \"callback_args supplied for non-callback option\",self)\n if self.callback_kwargs is not None :\n raise OptionError(\n \"callback_kwargs supplied for non-callback option\",self)\n \n \n CHECK_METHODS=[_check_action,\n _check_type,\n _check_choice,\n _check_dest,\n _check_const,\n _check_nargs,\n _check_callback]\n \n \n \n \n def __str__(self):\n return \"/\".join(self._short_opts+self._long_opts)\n \n __repr__=_repr\n \n def takes_value(self):\n return self.type is not None\n \n def get_opt_string(self):\n if self._long_opts:\n return self._long_opts[0]\n else :\n return self._short_opts[0]\n \n \n \n \n def check_value(self,opt,value):\n checker=self.TYPE_CHECKER.get(self.type)\n if checker is None :\n return value\n else :\n return checker(self,opt,value)\n \n def convert_value(self,opt,value):\n if value is not None :\n if self.nargs ==1:\n return self.check_value(opt,value)\n else :\n return tuple([self.check_value(opt,v)for v in value])\n \n def process(self,opt,value,values,parser):\n \n \n \n value=self.convert_value(opt,value)\n \n \n \n \n return self.take_action(\n self.action,self.dest,opt,value,values,parser)\n \n def take_action(self,action,dest,opt,value,values,parser):\n if action ==\"store\":\n setattr(values,dest,value)\n elif action ==\"store_const\":\n setattr(values,dest,self.const)\n elif action ==\"store_true\":\n setattr(values,dest,True )\n elif action ==\"store_false\":\n setattr(values,dest,False )\n elif action ==\"append\":\n values.ensure_value(dest,[]).append(value)\n elif action ==\"append_const\":\n values.ensure_value(dest,[]).append(self.const)\n elif action ==\"count\":\n setattr(values,dest,values.ensure_value(dest,0)+1)\n elif action ==\"callback\":\n args=self.callback_args or ()\n kwargs=self.callback_kwargs or {}\n self.callback(self,opt,value,parser,*args,**kwargs)\n elif action ==\"help\":\n parser.print_help()\n parser.exit()\n elif action ==\"version\":\n parser.print_version()\n parser.exit()\n else :\n raise ValueError(\"unknown action %r\"%self.action)\n \n return 1\n \n \n \n \nSUPPRESS_HELP=\"SUPPRESS\"+\"HELP\"\nSUPPRESS_USAGE=\"SUPPRESS\"+\"USAGE\"\n\nclass Values:\n\n def __init__(self,defaults=None ):\n if defaults:\n for (attr,val)in defaults.items():\n setattr(self,attr,val)\n \n def __str__(self):\n return str(self.__dict__)\n \n __repr__=_repr\n \n def __eq__(self,other):\n if isinstance(other,Values):\n return self.__dict__ ==other.__dict__\n elif isinstance(other,dict):\n return self.__dict__ ==other\n else :\n return NotImplemented\n \n def _update_careful(self,dict):\n ''\n\n\n\n\n \n for attr in dir(self):\n if attr in dict:\n dval=dict[attr]\n if dval is not None :\n setattr(self,attr,dval)\n \n def _update_loose(self,dict):\n ''\n\n\n\n \n self.__dict__.update(dict)\n \n def _update(self,dict,mode):\n if mode ==\"careful\":\n self._update_careful(dict)\n elif mode ==\"loose\":\n self._update_loose(dict)\n else :\n raise ValueError(\"invalid update mode: %r\"%mode)\n \n def read_module(self,modname,mode=\"careful\"):\n __import__(modname)\n mod=sys.modules[modname]\n self._update(vars(mod),mode)\n \n def read_file(self,filename,mode=\"careful\"):\n vars={}\n exec(open(filename).read(),vars)\n self._update(vars,mode)\n \n def ensure_value(self,attr,value):\n if not hasattr(self,attr)or getattr(self,attr)is None :\n setattr(self,attr,value)\n return getattr(self,attr)\n \n \nclass OptionContainer:\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,option_class,conflict_handler,description):\n \n \n \n \n self._create_option_list()\n \n self.option_class=option_class\n self.set_conflict_handler(conflict_handler)\n self.set_description(description)\n \n def _create_option_mappings(self):\n \n \n \n self._short_opt={}\n self._long_opt={}\n self.defaults={}\n \n \n def _share_option_mappings(self,parser):\n \n \n self._short_opt=parser._short_opt\n self._long_opt=parser._long_opt\n self.defaults=parser.defaults\n \n def set_conflict_handler(self,handler):\n if handler not in (\"error\",\"resolve\"):\n raise ValueError(\"invalid conflict_resolution value %r\"%handler)\n self.conflict_handler=handler\n \n def set_description(self,description):\n self.description=description\n \n def get_description(self):\n return self.description\n \n \n def destroy(self):\n ''\n del self._short_opt\n del self._long_opt\n del self.defaults\n \n \n \n \n def _check_conflict(self,option):\n conflict_opts=[]\n for opt in option._short_opts:\n if opt in self._short_opt:\n conflict_opts.append((opt,self._short_opt[opt]))\n for opt in option._long_opts:\n if opt in self._long_opt:\n conflict_opts.append((opt,self._long_opt[opt]))\n \n if conflict_opts:\n handler=self.conflict_handler\n if handler ==\"error\":\n raise OptionConflictError(\n \"conflicting option string(s): %s\"\n %\", \".join([co[0]for co in conflict_opts]),\n option)\n elif handler ==\"resolve\":\n for (opt,c_option)in conflict_opts:\n if opt.startswith(\"--\"):\n c_option._long_opts.remove(opt)\n del self._long_opt[opt]\n else :\n c_option._short_opts.remove(opt)\n del self._short_opt[opt]\n if not (c_option._short_opts or c_option._long_opts):\n c_option.container.option_list.remove(c_option)\n \n def add_option(self,*args,**kwargs):\n ''\n\n \n if isinstance(args[0],str):\n option=self.option_class(*args,**kwargs)\n elif len(args)==1 and not kwargs:\n option=args[0]\n if not isinstance(option,Option):\n raise TypeError(\"not an Option instance: %r\"%option)\n else :\n raise TypeError(\"invalid arguments\")\n \n self._check_conflict(option)\n \n self.option_list.append(option)\n option.container=self\n for opt in option._short_opts:\n self._short_opt[opt]=option\n for opt in option._long_opts:\n self._long_opt[opt]=option\n \n if option.dest is not None :\n if option.default is not NO_DEFAULT:\n self.defaults[option.dest]=option.default\n elif option.dest not in self.defaults:\n self.defaults[option.dest]=None\n \n return option\n \n def add_options(self,option_list):\n for option in option_list:\n self.add_option(option)\n \n \n \n def get_option(self,opt_str):\n return (self._short_opt.get(opt_str)or\n self._long_opt.get(opt_str))\n \n def has_option(self,opt_str):\n return (opt_str in self._short_opt or\n opt_str in self._long_opt)\n \n def remove_option(self,opt_str):\n option=self._short_opt.get(opt_str)\n if option is None :\n option=self._long_opt.get(opt_str)\n if option is None :\n raise ValueError(\"no such option %r\"%opt_str)\n \n for opt in option._short_opts:\n del self._short_opt[opt]\n for opt in option._long_opts:\n del self._long_opt[opt]\n option.container.option_list.remove(option)\n \n \n \n \n def format_option_help(self,formatter):\n if not self.option_list:\n return \"\"\n result=[]\n for option in self.option_list:\n if not option.help is SUPPRESS_HELP:\n result.append(formatter.format_option(option))\n return \"\".join(result)\n \n def format_description(self,formatter):\n return formatter.format_description(self.get_description())\n \n def format_help(self,formatter):\n result=[]\n if self.description:\n result.append(self.format_description(formatter))\n if self.option_list:\n result.append(self.format_option_help(formatter))\n return \"\\n\".join(result)\n \n \nclass OptionGroup(OptionContainer):\n\n def __init__(self,parser,title,description=None ):\n self.parser=parser\n OptionContainer.__init__(\n self,parser.option_class,parser.conflict_handler,description)\n self.title=title\n \n def _create_option_list(self):\n self.option_list=[]\n self._share_option_mappings(self.parser)\n \n def set_title(self,title):\n self.title=title\n \n def destroy(self):\n ''\n OptionContainer.destroy(self)\n del self.option_list\n \n \n \n def format_help(self,formatter):\n result=formatter.format_heading(self.title)\n formatter.indent()\n result +=OptionContainer.format_help(self,formatter)\n formatter.dedent()\n return result\n \n \nclass OptionParser(OptionContainer):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n standard_option_list=[]\n \n def __init__(self,\n usage=None ,\n option_list=None ,\n option_class=Option,\n version=None ,\n conflict_handler=\"error\",\n description=None ,\n formatter=None ,\n add_help_option=True ,\n prog=None ,\n epilog=None ):\n OptionContainer.__init__(\n self,option_class,conflict_handler,description)\n self.set_usage(usage)\n self.prog=prog\n self.version=version\n self.allow_interspersed_args=True\n self.process_default_values=True\n if formatter is None :\n formatter=IndentedHelpFormatter()\n self.formatter=formatter\n self.formatter.set_parser(self)\n self.epilog=epilog\n \n \n \n \n \n self._populate_option_list(option_list,\n add_help=add_help_option)\n \n self._init_parsing_state()\n \n \n def destroy(self):\n ''\n\n\n\n\n \n OptionContainer.destroy(self)\n for group in self.option_groups:\n group.destroy()\n del self.option_list\n del self.option_groups\n del self.formatter\n \n \n \n \n \n def _create_option_list(self):\n self.option_list=[]\n self.option_groups=[]\n self._create_option_mappings()\n \n def _add_help_option(self):\n self.add_option(\"-h\",\"--help\",\n action=\"help\",\n help=_(\"show this help message and exit\"))\n \n def _add_version_option(self):\n self.add_option(\"--version\",\n action=\"version\",\n help=_(\"show program's version number and exit\"))\n \n def _populate_option_list(self,option_list,add_help=True ):\n if self.standard_option_list:\n self.add_options(self.standard_option_list)\n if option_list:\n self.add_options(option_list)\n if self.version:\n self._add_version_option()\n if add_help:\n self._add_help_option()\n \n def _init_parsing_state(self):\n \n self.rargs=None\n self.largs=None\n self.values=None\n \n \n \n \n def set_usage(self,usage):\n if usage is None :\n self.usage=_(\"%prog [options]\")\n elif usage is SUPPRESS_USAGE:\n self.usage=None\n \n elif usage.lower().startswith(\"usage: \"):\n self.usage=usage[7:]\n else :\n self.usage=usage\n \n def enable_interspersed_args(self):\n ''\n\n\n\n \n self.allow_interspersed_args=True\n \n def disable_interspersed_args(self):\n ''\n\n\n\n \n self.allow_interspersed_args=False\n \n def set_process_default_values(self,process):\n self.process_default_values=process\n \n def set_default(self,dest,value):\n self.defaults[dest]=value\n \n def set_defaults(self,**kwargs):\n self.defaults.update(kwargs)\n \n def _get_all_options(self):\n options=self.option_list[:]\n for group in self.option_groups:\n options.extend(group.option_list)\n return options\n \n def get_default_values(self):\n if not self.process_default_values:\n \n return Values(self.defaults)\n \n defaults=self.defaults.copy()\n for option in self._get_all_options():\n default=defaults.get(option.dest)\n if isinstance(default,str):\n opt_str=option.get_opt_string()\n defaults[option.dest]=option.check_value(opt_str,default)\n \n return Values(defaults)\n \n \n \n \n def add_option_group(self,*args,**kwargs):\n \n if isinstance(args[0],str):\n group=OptionGroup(self,*args,**kwargs)\n elif len(args)==1 and not kwargs:\n group=args[0]\n if not isinstance(group,OptionGroup):\n raise TypeError(\"not an OptionGroup instance: %r\"%group)\n if group.parser is not self:\n raise ValueError(\"invalid OptionGroup (wrong parser)\")\n else :\n raise TypeError(\"invalid arguments\")\n \n self.option_groups.append(group)\n return group\n \n def get_option_group(self,opt_str):\n option=(self._short_opt.get(opt_str)or\n self._long_opt.get(opt_str))\n if option and option.container is not self:\n return option.container\n return None\n \n \n \n \n def _get_args(self,args):\n if args is None :\n return sys.argv[1:]\n else :\n return args[:]\n \n def parse_args(self,args=None ,values=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n rargs=self._get_args(args)\n if values is None :\n values=self.get_default_values()\n \n \n \n \n \n \n \n \n \n \n self.rargs=rargs\n self.largs=largs=[]\n self.values=values\n \n try :\n stop=self._process_args(largs,rargs,values)\n except (BadOptionError,OptionValueError)as err:\n self.error(str(err))\n \n args=largs+rargs\n return self.check_values(values,args)\n \n def check_values(self,values,args):\n ''\n\n\n\n\n\n\n\n\n \n return (values,args)\n \n def _process_args(self,largs,rargs,values):\n ''\n\n\n\n\n\n\n\n \n while rargs:\n arg=rargs[0]\n \n \n \n if arg ==\"--\":\n del rargs[0]\n return\n elif arg[0:2]==\"--\":\n \n self._process_long_opt(rargs,values)\n elif arg[:1]==\"-\"and len(arg)>1:\n \n \n self._process_short_opts(rargs,values)\n elif self.allow_interspersed_args:\n largs.append(arg)\n del rargs[0]\n else :\n return\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def _match_long_opt(self,opt):\n ''\n\n\n\n\n \n return _match_abbrev(opt,self._long_opt)\n \n def _process_long_opt(self,rargs,values):\n arg=rargs.pop(0)\n \n \n \n if \"=\"in arg:\n (opt,next_arg)=arg.split(\"=\",1)\n rargs.insert(0,next_arg)\n had_explicit_value=True\n else :\n opt=arg\n had_explicit_value=False\n \n opt=self._match_long_opt(opt)\n option=self._long_opt[opt]\n if option.takes_value():\n nargs=option.nargs\n if len(rargs)\".format(self.path)\n return \"\"\n \n def add_dll_directory(path):\n ''\n\n\n\n\n\n\n\n \n import nt\n cookie=nt._add_dll_directory(path)\n return _AddedDllDirectory(\n path,\n cookie,\n nt._remove_dll_directory\n )\n \n \ndef scandir(*args,**kw):\n raise NotImplementedError('browsers cannot read a directory content')\n \ndef waitstatus_to_exitcode(status):\n return status >>8\n \n_set=set()\n\nsupports_dir_fd=_set\n\nsupports_effective_ids=_set\n\nsupports_fd=_set\n\nsupports_follow_symlinks=_set\n\n", ["abc", "nt", "os.path", "posix", "posixpath", "sys"]], "pathlib": [".py", "''\n\n\n\n\n\n\nimport fnmatch\nimport functools\nimport io\nimport ntpath\nimport os\nimport posixpath\nimport re\nimport sys\nimport warnings\nfrom _collections_abc import Sequence\nfrom errno import ENOENT,ENOTDIR,EBADF,ELOOP\nfrom stat import S_ISDIR,S_ISLNK,S_ISREG,S_ISSOCK,S_ISBLK,S_ISCHR,S_ISFIFO\nfrom urllib.parse import quote_from_bytes as urlquote_from_bytes\n\n\n__all__=[\n\"PurePath\",\"PurePosixPath\",\"PureWindowsPath\",\n\"Path\",\"PosixPath\",\"WindowsPath\",\n]\n\n\n\n\n\n\n\n_WIN_RESERVED_NAMES=frozenset(\n{'CON','PRN','AUX','NUL','CONIN$','CONOUT$'}|\n{f'COM{c}'for c in '123456789\\xb9\\xb2\\xb3'}|\n{f'LPT{c}'for c in '123456789\\xb9\\xb2\\xb3'}\n)\n\n_WINERROR_NOT_READY=21\n_WINERROR_INVALID_NAME=123\n_WINERROR_CANT_RESOLVE_FILENAME=1921\n\n\n_IGNORED_ERRNOS=(ENOENT,ENOTDIR,EBADF,ELOOP)\n\n_IGNORED_WINERRORS=(\n_WINERROR_NOT_READY,\n_WINERROR_INVALID_NAME,\n_WINERROR_CANT_RESOLVE_FILENAME)\n\ndef _ignore_error(exception):\n return(getattr(exception,'errno',None)in _IGNORED_ERRNOS or\n getattr(exception,'winerror',None)in _IGNORED_WINERRORS)\n \n \n@functools.cache\ndef _is_case_sensitive(flavour):\n return flavour.normcase('Aa')=='Aa'\n \n \n \n \n \n \n \n \n \n \n \n \n \n_FNMATCH_PREFIX,_FNMATCH_SUFFIX=fnmatch.translate('_').split('_')\n_FNMATCH_SLICE=slice(len(_FNMATCH_PREFIX),-len(_FNMATCH_SUFFIX))\n_SWAP_SEP_AND_NEWLINE={\n'/':str.maketrans({'/':'\\n','\\n':'/'}),\n'\\\\':str.maketrans({'\\\\':'\\n','\\n':'\\\\'}),\n}\n\n\n@functools.lru_cache()\ndef _make_selector(pattern_parts,flavour,case_sensitive):\n pat=pattern_parts[0]\n if not pat:\n return _TerminatingSelector()\n if pat =='**':\n child_parts_idx=1\n while child_parts_idx =len(self)or idx <-len(self):\n raise IndexError(idx)\n if idx <0:\n idx +=len(self)\n return self._path._from_parsed_parts(self._drv,self._root,\n self._tail[:-idx -1])\n \n def __repr__(self):\n return \"<{}.parents>\".format(type(self._path).__name__)\n \n \nclass PurePath(object):\n ''\n\n\n\n\n\n\n \n \n __slots__=(\n \n \n '_raw_path',\n \n \n \n \n \n \n \n \n '_drv','_root','_tail_cached',\n \n \n \n \n '_str',\n \n \n \n \n \n '_str_normcase_cached',\n \n \n \n \n \n '_parts_normcase_cached',\n \n \n \n '_lines_cached',\n \n \n \n '_hash',\n )\n _flavour=os.path\n \n def __new__(cls,*args,**kwargs):\n ''\n\n\n\n \n if cls is PurePath:\n cls=PureWindowsPath if os.name =='nt'else PurePosixPath\n return object.__new__(cls)\n \n def __reduce__(self):\n \n \n return(self.__class__,self.parts)\n \n def __init__(self,*args):\n paths=[]\n for arg in args:\n if isinstance(arg,PurePath):\n path=arg._raw_path\n if arg._flavour is ntpath and self._flavour is posixpath:\n \n path=path.replace('\\\\','/')\n else:\n try:\n path=os.fspath(arg)\n except TypeError:\n path=arg\n if not isinstance(path,str):\n raise TypeError(\n \"argument should be a str or an os.PathLike \"\n \"object where __fspath__ returns a str, \"\n f\"not {type(path).__name__ !r}\")\n paths.append(path)\n if len(paths)==0:\n self._raw_path=''\n elif len(paths)==1:\n self._raw_path=paths[0]\n else:\n self._raw_path=self._flavour.join(*paths)\n \n def with_segments(self,*pathsegments):\n ''\n\n\n \n return type(self)(*pathsegments)\n \n @classmethod\n def _parse_path(cls,path):\n if not path:\n return '','',[]\n sep=cls._flavour.sep\n altsep=cls._flavour.altsep\n if altsep:\n path=path.replace(altsep,sep)\n drv,root,rel=cls._flavour.splitroot(path)\n if not root and drv.startswith(sep)and not drv.endswith(sep):\n drv_parts=drv.split(sep)\n if len(drv_parts)==4 and drv_parts[2]not in '?.':\n \n root=sep\n elif len(drv_parts)==6:\n \n root=sep\n parsed=[sys.intern(str(x))for x in rel.split(sep)if x and x !='.']\n return drv,root,parsed\n \n def _load_parts(self):\n drv,root,tail=self._parse_path(self._raw_path)\n self._drv=drv\n self._root=root\n self._tail_cached=tail\n \n def _from_parsed_parts(self,drv,root,tail):\n path_str=self._format_parsed_parts(drv,root,tail)\n path=self.with_segments(path_str)\n path._str=path_str or '.'\n path._drv=drv\n path._root=root\n path._tail_cached=tail\n return path\n \n @classmethod\n def _format_parsed_parts(cls,drv,root,tail):\n if drv or root:\n return drv+root+cls._flavour.sep.join(tail)\n elif tail and cls._flavour.splitdrive(tail[0])[0]:\n tail=['.']+tail\n return cls._flavour.sep.join(tail)\n \n def __str__(self):\n ''\n \n try:\n return self._str\n except AttributeError:\n self._str=self._format_parsed_parts(self.drive,self.root,\n self._tail)or '.'\n return self._str\n \n def __fspath__(self):\n return str(self)\n \n def as_posix(self):\n ''\n \n f=self._flavour\n return str(self).replace(f.sep,'/')\n \n def __bytes__(self):\n ''\n \n return os.fsencode(self)\n \n def __repr__(self):\n return \"{}({!r})\".format(self.__class__.__name__,self.as_posix())\n \n def as_uri(self):\n ''\n if not self.is_absolute():\n raise ValueError(\"relative path can't be expressed as a file URI\")\n \n drive=self.drive\n if len(drive)==2 and drive[1]==':':\n \n prefix='file:///'+drive\n path=self.as_posix()[2:]\n elif drive:\n \n prefix='file:'\n path=self.as_posix()\n else:\n \n prefix='file://'\n path=str(self)\n return prefix+urlquote_from_bytes(os.fsencode(path))\n \n @property\n def _str_normcase(self):\n \n try:\n return self._str_normcase_cached\n except AttributeError:\n if _is_case_sensitive(self._flavour):\n self._str_normcase_cached=str(self)\n else:\n self._str_normcase_cached=str(self).lower()\n return self._str_normcase_cached\n \n @property\n def _parts_normcase(self):\n \n try:\n return self._parts_normcase_cached\n except AttributeError:\n self._parts_normcase_cached=self._str_normcase.split(self._flavour.sep)\n return self._parts_normcase_cached\n \n @property\n def _lines(self):\n \n try:\n return self._lines_cached\n except AttributeError:\n trans=_SWAP_SEP_AND_NEWLINE[self._flavour.sep]\n self._lines_cached=str(self).translate(trans)\n return self._lines_cached\n \n def __eq__(self,other):\n if not isinstance(other,PurePath):\n return NotImplemented\n return self._str_normcase ==other._str_normcase and self._flavour is other._flavour\n \n def __hash__(self):\n try:\n return self._hash\n except AttributeError:\n self._hash=hash(self._str_normcase)\n return self._hash\n \n def __lt__(self,other):\n if not isinstance(other,PurePath)or self._flavour is not other._flavour:\n return NotImplemented\n return self._parts_normcase other._parts_normcase\n \n def __ge__(self,other):\n if not isinstance(other,PurePath)or self._flavour is not other._flavour:\n return NotImplemented\n return self._parts_normcase >=other._parts_normcase\n \n @property\n def drive(self):\n ''\n try:\n return self._drv\n except AttributeError:\n self._load_parts()\n return self._drv\n \n @property\n def root(self):\n ''\n try:\n return self._root\n except AttributeError:\n self._load_parts()\n return self._root\n \n @property\n def _tail(self):\n try:\n return self._tail_cached\n except AttributeError:\n self._load_parts()\n return self._tail_cached\n \n @property\n def anchor(self):\n ''\n anchor=self.drive+self.root\n return anchor\n \n @property\n def name(self):\n ''\n tail=self._tail\n if not tail:\n return ''\n return tail[-1]\n \n @property\n def suffix(self):\n ''\n\n\n\n \n name=self.name\n i=name.rfind('.')\n if 0 >> import pdb\n >>> pdb.run('')\n\nThe debugger's prompt is '(Pdb) '. This will stop in the first\nfunction call in .\n\nAlternatively, if a statement terminated with an unhandled exception,\nyou can use pdb's post-mortem facility to inspect the contents of the\ntraceback:\n\n >>> \n \n >>> import pdb\n >>> pdb.pm()\n\nThe commands recognized by the debugger are listed in the next\nsection. Most can be abbreviated as indicated; e.g., h(elp) means\nthat 'help' can be typed as 'h' or 'help' (but not as 'he' or 'hel',\nnor as 'H' or 'Help' or 'HELP'). Optional arguments are enclosed in\nsquare brackets. Alternatives in the command syntax are separated\nby a vertical bar (|).\n\nA blank line repeats the previous command literally, except for\n'list', where it lists the next 11 lines.\n\nCommands that the debugger doesn't recognize are assumed to be Python\nstatements and are executed in the context of the program being\ndebugged. Python statements can also be prefixed with an exclamation\npoint ('!'). This is a powerful way to inspect the program being\ndebugged; it is even possible to change variables or call functions.\nWhen an exception occurs in such a statement, the exception name is\nprinted but the debugger's state is not changed.\n\nThe debugger supports aliases, which can save typing. And aliases can\nhave parameters (see the alias help entry) which allows one a certain\nlevel of adaptability to the context under examination.\n\nMultiple commands may be entered on a single line, separated by the\npair ';;'. No intelligence is applied to separating the commands; the\ninput is split at the first ';;', even if it is in the middle of a\nquoted string.\n\nIf a file \".pdbrc\" exists in your home directory or in the current\ndirectory, it is read in and executed as if it had been typed at the\ndebugger prompt. This is particularly useful for aliases. If both\nfiles exist, the one in the home directory is read first and aliases\ndefined there can be overridden by the local file. This behavior can be\ndisabled by passing the \"readrc=False\" argument to the Pdb constructor.\n\nAside from aliases, the debugger is not directly programmable; but it\nis implemented as a class from which you can derive your own debugger\nclass, which you can make as fancy as you like.\n\n\nDebugger commands\n=================\n\n\"\"\"\n\n\n\nimport os\nimport io\nimport re\nimport sys\nimport cmd\nimport bdb\nimport dis\nimport code\nimport glob\nimport pprint\nimport signal\nimport inspect\nimport tokenize\nimport functools\nimport traceback\nimport linecache\n\nfrom typing import Union\n\n\nclass Restart(Exception):\n ''\n pass\n \n__all__=[\"run\",\"pm\",\"Pdb\",\"runeval\",\"runctx\",\"runcall\",\"set_trace\",\n\"post_mortem\",\"help\"]\n\ndef find_function(funcname,filename):\n cre=re.compile(r'def\\s+%s\\s*[(]'%re.escape(funcname))\n try:\n fp=tokenize.open(filename)\n except OSError:\n return None\n \n with fp:\n for lineno,line in enumerate(fp,start=1):\n if cre.match(line):\n return funcname,filename,lineno\n return None\n \ndef lasti2lineno(code,lasti):\n linestarts=list(dis.findlinestarts(code))\n linestarts.reverse()\n for i,lineno in linestarts:\n if lasti >=i:\n return lineno\n return 0\n \n \nclass _rstr(str):\n ''\n def __repr__(self):\n return self\n \n \nclass _ScriptTarget(str):\n def __new__(cls,val):\n \n res=super().__new__(cls,os.path.realpath(val))\n \n \n res.orig=val\n \n return res\n \n def check(self):\n if not os.path.exists(self):\n print('Error:',self.orig,'does not exist')\n sys.exit(1)\n \n \n sys.path[0]=os.path.dirname(self)\n \n @property\n def filename(self):\n return self\n \n @property\n def namespace(self):\n return dict(\n __name__='__main__',\n __file__=self,\n __builtins__=__builtins__,\n )\n \n @property\n def code(self):\n with io.open_code(self)as fp:\n return f\"exec(compile({fp.read()!r}, {self !r}, 'exec'))\"\n \n \nclass _ModuleTarget(str):\n def check(self):\n try:\n self._details\n except Exception:\n traceback.print_exc()\n sys.exit(1)\n \n @functools.cached_property\n def _details(self):\n import runpy\n return runpy._get_module_details(self)\n \n @property\n def filename(self):\n return self.code.co_filename\n \n @property\n def code(self):\n name,spec,code=self._details\n return code\n \n @property\n def _spec(self):\n name,spec,code=self._details\n return spec\n \n @property\n def namespace(self):\n return dict(\n __name__='__main__',\n __file__=os.path.normcase(os.path.abspath(self.filename)),\n __package__=self._spec.parent,\n __loader__=self._spec.loader,\n __spec__=self._spec,\n __builtins__=__builtins__,\n )\n \n \n \n \n \n \n \nline_prefix='\\n-> '\n\nclass Pdb(bdb.Bdb,cmd.Cmd):\n\n _previous_sigint_handler=None\n \n def __init__(self,completekey='tab',stdin=None,stdout=None,skip=None,\n nosigint=False,readrc=True):\n bdb.Bdb.__init__(self,skip=skip)\n cmd.Cmd.__init__(self,completekey,stdin,stdout)\n sys.audit(\"pdb.Pdb\")\n if stdout:\n self.use_rawinput=0\n self.prompt='(Pdb) '\n self.aliases={}\n self.displaying={}\n self.mainpyfile=''\n self._wait_for_mainpyfile=False\n self.tb_lineno={}\n \n try:\n import readline\n \n readline.set_completer_delims(' \\t\\n`@#$%^&*()=+[{]}\\\\|;:\\'\",<>?')\n except ImportError:\n pass\n self.allow_kbdint=False\n self.nosigint=nosigint\n \n \n self.rcLines=[]\n if readrc:\n try:\n with open(os.path.expanduser('~/.pdbrc'),encoding='utf-8')as rcFile:\n self.rcLines.extend(rcFile)\n except OSError:\n pass\n try:\n with open(\".pdbrc\",encoding='utf-8')as rcFile:\n self.rcLines.extend(rcFile)\n except OSError:\n pass\n \n self.commands={}\n self.commands_doprompt={}\n \n self.commands_silent={}\n \n self.commands_defining=False\n \n self.commands_bnum=None\n \n \n def sigint_handler(self,signum,frame):\n if self.allow_kbdint:\n raise KeyboardInterrupt\n self.message(\"\\nProgram interrupted. (Use 'cont' to resume).\")\n self.set_step()\n self.set_trace(frame)\n \n def reset(self):\n bdb.Bdb.reset(self)\n self.forget()\n \n def forget(self):\n self.lineno=None\n self.stack=[]\n self.curindex=0\n if hasattr(self,'curframe')and self.curframe:\n self.curframe.f_globals.pop('__pdb_convenience_variables',None)\n self.curframe=None\n self.tb_lineno.clear()\n \n def setup(self,f,tb):\n self.forget()\n self.stack,self.curindex=self.get_stack(f,tb)\n while tb:\n \n \n \n lineno=lasti2lineno(tb.tb_frame.f_code,tb.tb_lasti)\n self.tb_lineno[tb.tb_frame]=lineno\n tb=tb.tb_next\n self.curframe=self.stack[self.curindex][0]\n \n \n \n self.curframe_locals=self.curframe.f_locals\n self.set_convenience_variable(self.curframe,'_frame',self.curframe)\n return self.execRcLines()\n \n \n def execRcLines(self):\n if not self.rcLines:\n return\n \n rcLines=self.rcLines\n rcLines.reverse()\n \n self.rcLines=[]\n while rcLines:\n line=rcLines.pop().strip()\n if line and line[0]!='#':\n if self.onecmd(line):\n \n \n \n self.rcLines +=reversed(rcLines)\n return True\n \n \n \n def user_call(self,frame,argument_list):\n ''\n \n if self._wait_for_mainpyfile:\n return\n if self.stop_here(frame):\n self.message('--Call--')\n self.interaction(frame,None)\n \n def user_line(self,frame):\n ''\n if self._wait_for_mainpyfile:\n if(self.mainpyfile !=self.canonic(frame.f_code.co_filename)\n or frame.f_lineno <=0):\n return\n self._wait_for_mainpyfile=False\n if self.bp_commands(frame):\n self.interaction(frame,None)\n \n def bp_commands(self,frame):\n ''\n\n\n\n \n \n if getattr(self,\"currentbp\",False)and\\\n self.currentbp in self.commands:\n currentbp=self.currentbp\n self.currentbp=0\n lastcmd_back=self.lastcmd\n self.setup(frame,None)\n for line in self.commands[currentbp]:\n self.onecmd(line)\n self.lastcmd=lastcmd_back\n if not self.commands_silent[currentbp]:\n self.print_stack_entry(self.stack[self.curindex])\n if self.commands_doprompt[currentbp]:\n self._cmdloop()\n self.forget()\n return\n return 1\n \n def user_return(self,frame,return_value):\n ''\n if self._wait_for_mainpyfile:\n return\n frame.f_locals['__return__']=return_value\n self.set_convenience_variable(frame,'_retval',return_value)\n self.message('--Return--')\n self.interaction(frame,None)\n \n def user_exception(self,frame,exc_info):\n ''\n \n if self._wait_for_mainpyfile:\n return\n exc_type,exc_value,exc_traceback=exc_info\n frame.f_locals['__exception__']=exc_type,exc_value\n self.set_convenience_variable(frame,'_exception',exc_value)\n \n \n \n \n \n \n prefix='Internal 'if(not exc_traceback\n and exc_type is StopIteration)else ''\n self.message('%s%s'%(prefix,self._format_exc(exc_value)))\n self.interaction(frame,exc_traceback)\n \n \n def _cmdloop(self):\n while True:\n try:\n \n \n self.allow_kbdint=True\n self.cmdloop()\n self.allow_kbdint=False\n break\n except KeyboardInterrupt:\n self.message('--KeyboardInterrupt--')\n \n \n \n def preloop(self):\n displaying=self.displaying.get(self.curframe)\n if displaying:\n for expr,oldvalue in displaying.items():\n newvalue=self._getval_except(expr)\n \n \n \n if newvalue is not oldvalue and newvalue !=oldvalue:\n displaying[expr]=newvalue\n self.message('display %s: %r [old: %r]'%\n (expr,newvalue,oldvalue))\n \n def interaction(self,frame,traceback):\n \n if Pdb._previous_sigint_handler:\n try:\n signal.signal(signal.SIGINT,Pdb._previous_sigint_handler)\n except ValueError:\n pass\n else:\n Pdb._previous_sigint_handler=None\n if self.setup(frame,traceback):\n \n \n self.forget()\n return\n self.print_stack_entry(self.stack[self.curindex])\n self._cmdloop()\n self.forget()\n \n def displayhook(self,obj):\n ''\n\n \n \n if obj is not None:\n self.message(repr(obj))\n \n def default(self,line):\n if line[:1]=='!':line=line[1:].strip()\n locals=self.curframe_locals\n globals=self.curframe.f_globals\n try:\n code=compile(line+'\\n','','single')\n save_stdout=sys.stdout\n save_stdin=sys.stdin\n save_displayhook=sys.displayhook\n try:\n sys.stdin=self.stdin\n sys.stdout=self.stdout\n sys.displayhook=self.displayhook\n exec(code,globals,locals)\n finally:\n sys.stdout=save_stdout\n sys.stdin=save_stdin\n sys.displayhook=save_displayhook\n except:\n self._error_exc()\n \n def precmd(self,line):\n ''\n if not line.strip():\n return line\n args=line.split()\n while args[0]in self.aliases:\n line=self.aliases[args[0]]\n ii=1\n for tmpArg in args[1:]:\n line=line.replace(\"%\"+str(ii),\n tmpArg)\n ii +=1\n line=line.replace(\"%*\",' '.join(args[1:]))\n args=line.split()\n \n \n if args[0]!='alias':\n marker=line.find(';;')\n if marker >=0:\n \n next=line[marker+2:].lstrip()\n self.cmdqueue.append(next)\n line=line[:marker].rstrip()\n \n \n line=re.sub(r'\\$([a-zA-Z_][a-zA-Z0-9_]*)',r'__pdb_convenience_variables[\"\\1\"]',line)\n return line\n \n def onecmd(self,line):\n ''\n\n\n\n\n \n if not self.commands_defining:\n return cmd.Cmd.onecmd(self,line)\n else:\n return self.handle_command_def(line)\n \n def handle_command_def(self,line):\n ''\n cmd,arg,line=self.parseline(line)\n if not cmd:\n return\n if cmd =='silent':\n self.commands_silent[self.commands_bnum]=True\n return\n elif cmd =='end':\n self.cmdqueue=[]\n return 1\n cmdlist=self.commands[self.commands_bnum]\n if arg:\n cmdlist.append(cmd+' '+arg)\n else:\n cmdlist.append(cmd)\n \n try:\n func=getattr(self,'do_'+cmd)\n except AttributeError:\n func=self.default\n \n if func.__name__ in self.commands_resuming:\n self.commands_doprompt[self.commands_bnum]=False\n self.cmdqueue=[]\n return 1\n return\n \n \n \n def message(self,msg):\n print(msg,file=self.stdout)\n \n def error(self,msg):\n print('***',msg,file=self.stdout)\n \n \n \n def set_convenience_variable(self,frame,name,value):\n if '__pdb_convenience_variables'not in frame.f_globals:\n frame.f_globals['__pdb_convenience_variables']={}\n frame.f_globals['__pdb_convenience_variables'][name]=value\n \n \n \n \n def _complete_location(self,text,line,begidx,endidx):\n \n if line.strip().endswith((':',',')):\n \n return[]\n \n try:\n ret=self._complete_expression(text,line,begidx,endidx)\n except Exception:\n ret=[]\n \n globs=glob.glob(glob.escape(text)+'*')\n for fn in globs:\n if os.path.isdir(fn):\n ret.append(fn+'/')\n elif os.path.isfile(fn)and fn.lower().endswith(('.py','.pyw')):\n ret.append(fn+':')\n return ret\n \n def _complete_bpnumber(self,text,line,begidx,endidx):\n \n \n \n return[str(i)for i,bp in enumerate(bdb.Breakpoint.bpbynumber)\n if bp is not None and str(i).startswith(text)]\n \n def _complete_expression(self,text,line,begidx,endidx):\n \n if not self.curframe:\n return[]\n \n \n \n ns={**self.curframe.f_globals,**self.curframe_locals}\n if '.'in text:\n \n \n \n dotted=text.split('.')\n try:\n obj=ns[dotted[0]]\n for part in dotted[1:-1]:\n obj=getattr(obj,part)\n except(KeyError,AttributeError):\n return[]\n prefix='.'.join(dotted[:-1])+'.'\n return[prefix+n for n in dir(obj)if n.startswith(dotted[-1])]\n else:\n \n return[n for n in ns.keys()if n.startswith(text)]\n \n \n \n \n \n def do_commands(self,arg):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not arg:\n bnum=len(bdb.Breakpoint.bpbynumber)-1\n else:\n try:\n bnum=int(arg)\n except:\n self.error(\"Usage: commands [bnum]\\n ...\\n end\")\n return\n try:\n self.get_bpbynumber(bnum)\n except ValueError as err:\n self.error('cannot set commands: %s'%err)\n return\n \n self.commands_bnum=bnum\n \n if bnum in self.commands:\n old_command_defs=(self.commands[bnum],\n self.commands_doprompt[bnum],\n self.commands_silent[bnum])\n else:\n old_command_defs=None\n self.commands[bnum]=[]\n self.commands_doprompt[bnum]=True\n self.commands_silent[bnum]=False\n \n prompt_back=self.prompt\n self.prompt='(com) '\n self.commands_defining=True\n try:\n self.cmdloop()\n except KeyboardInterrupt:\n \n if old_command_defs:\n self.commands[bnum]=old_command_defs[0]\n self.commands_doprompt[bnum]=old_command_defs[1]\n self.commands_silent[bnum]=old_command_defs[2]\n else:\n del self.commands[bnum]\n del self.commands_doprompt[bnum]\n del self.commands_silent[bnum]\n self.error('command definition aborted, old commands restored')\n finally:\n self.commands_defining=False\n self.prompt=prompt_back\n \n complete_commands=_complete_bpnumber\n \n def do_break(self,arg,temporary=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not arg:\n if self.breaks:\n self.message(\"Num Type Disp Enb Where\")\n for bp in bdb.Breakpoint.bpbynumber:\n if bp:\n self.message(bp.bpformat())\n return\n \n \n filename=None\n lineno=None\n cond=None\n comma=arg.find(',')\n if comma >0:\n \n cond=arg[comma+1:].lstrip()\n if err :=self._compile_error_message(cond):\n self.error('Invalid condition %s: %r'%(cond,err))\n return\n arg=arg[:comma].rstrip()\n \n colon=arg.rfind(':')\n funcname=None\n if colon >=0:\n filename=arg[:colon].rstrip()\n f=self.lookupmodule(filename)\n if not f:\n self.error('%r not found from sys.path'%filename)\n return\n else:\n filename=f\n arg=arg[colon+1:].lstrip()\n try:\n lineno=int(arg)\n except ValueError:\n self.error('Bad lineno: %s'%arg)\n return\n else:\n \n try:\n lineno=int(arg)\n except ValueError:\n try:\n func=eval(arg,\n self.curframe.f_globals,\n self.curframe_locals)\n except:\n func=arg\n try:\n if hasattr(func,'__func__'):\n func=func.__func__\n code=func.__code__\n \n \n funcname=code.co_name\n lineno=code.co_firstlineno\n filename=code.co_filename\n except:\n \n (ok,filename,ln)=self.lineinfo(arg)\n if not ok:\n self.error('The specified object %r is not a function '\n 'or was not found along sys.path.'%arg)\n return\n funcname=ok\n lineno=int(ln)\n if not filename:\n filename=self.defaultFile()\n \n line=self.checkline(filename,lineno)\n if line:\n \n err=self.set_break(filename,line,temporary,cond,funcname)\n if err:\n self.error(err)\n else:\n bp=self.get_breaks(filename,line)[-1]\n self.message(\"Breakpoint %d at %s:%d\"%\n (bp.number,bp.file,bp.line))\n \n \n def defaultFile(self):\n ''\n filename=self.curframe.f_code.co_filename\n if filename ==''and self.mainpyfile:\n filename=self.mainpyfile\n return filename\n \n do_b=do_break\n \n complete_break=_complete_location\n complete_b=_complete_location\n \n def do_tbreak(self,arg):\n ''\n\n\n\n \n self.do_break(arg,1)\n \n complete_tbreak=_complete_location\n \n def lineinfo(self,identifier):\n failed=(None,None,None)\n \n idstring=identifier.split(\"'\")\n if len(idstring)==1:\n \n id=idstring[0].strip()\n elif len(idstring)==3:\n \n id=idstring[1].strip()\n else:\n return failed\n if id =='':return failed\n parts=id.split('.')\n \n if parts[0]=='self':\n del parts[0]\n if len(parts)==0:\n return failed\n \n fname=self.defaultFile()\n if len(parts)==1:\n item=parts[0]\n else:\n \n \n f=self.lookupmodule(parts[0])\n if f:\n fname=f\n item=parts[1]\n answer=find_function(item,fname)\n return answer or failed\n \n def checkline(self,filename,lineno):\n ''\n\n\n\n \n \n \n frame=getattr(self,'curframe',None)\n globs=frame.f_globals if frame else None\n line=linecache.getline(filename,lineno,globs)\n if not line:\n self.message('End of file')\n return 0\n line=line.strip()\n \n if(not line or(line[0]=='#')or\n (line[:3]=='\"\"\"')or line[:3]==\"'''\"):\n self.error('Blank or comment')\n return 0\n return lineno\n \n def do_enable(self,arg):\n ''\n\n\n\n \n args=arg.split()\n for i in args:\n try:\n bp=self.get_bpbynumber(i)\n except ValueError as err:\n self.error(err)\n else:\n bp.enable()\n self.message('Enabled %s'%bp)\n \n complete_enable=_complete_bpnumber\n \n def do_disable(self,arg):\n ''\n\n\n\n\n\n\n \n args=arg.split()\n for i in args:\n try:\n bp=self.get_bpbynumber(i)\n except ValueError as err:\n self.error(err)\n else:\n bp.disable()\n self.message('Disabled %s'%bp)\n \n complete_disable=_complete_bpnumber\n \n def do_condition(self,arg):\n ''\n\n\n\n\n\n \n args=arg.split(' ',1)\n try:\n cond=args[1]\n if err :=self._compile_error_message(cond):\n self.error('Invalid condition %s: %r'%(cond,err))\n return\n except IndexError:\n cond=None\n try:\n bp=self.get_bpbynumber(args[0].strip())\n except IndexError:\n self.error('Breakpoint number expected')\n except ValueError as err:\n self.error(err)\n else:\n bp.cond=cond\n if not cond:\n self.message('Breakpoint %d is now unconditional.'%bp.number)\n else:\n self.message('New condition set for breakpoint %d.'%bp.number)\n \n complete_condition=_complete_bpnumber\n \n def do_ignore(self,arg):\n ''\n\n\n\n\n\n\n\n \n args=arg.split()\n try:\n count=int(args[1].strip())\n except:\n count=0\n try:\n bp=self.get_bpbynumber(args[0].strip())\n except IndexError:\n self.error('Breakpoint number expected')\n except ValueError as err:\n self.error(err)\n else:\n bp.ignore=count\n if count >0:\n if count >1:\n countstr='%d crossings'%count\n else:\n countstr='1 crossing'\n self.message('Will ignore next %s of breakpoint %d.'%\n (countstr,bp.number))\n else:\n self.message('Will stop next time breakpoint %d is reached.'\n %bp.number)\n \n complete_ignore=_complete_bpnumber\n \n def do_clear(self,arg):\n ''\n\n\n\n\n\n \n if not arg:\n try:\n reply=input('Clear all breaks? ')\n except EOFError:\n reply='no'\n reply=reply.strip().lower()\n if reply in('y','yes'):\n bplist=[bp for bp in bdb.Breakpoint.bpbynumber if bp]\n self.clear_all_breaks()\n for bp in bplist:\n self.message('Deleted %s'%bp)\n return\n if ':'in arg:\n \n i=arg.rfind(':')\n filename=arg[:i]\n arg=arg[i+1:]\n try:\n lineno=int(arg)\n except ValueError:\n err=\"Invalid line number (%s)\"%arg\n else:\n bplist=self.get_breaks(filename,lineno)[:]\n err=self.clear_break(filename,lineno)\n if err:\n self.error(err)\n else:\n for bp in bplist:\n self.message('Deleted %s'%bp)\n return\n numberlist=arg.split()\n for i in numberlist:\n try:\n bp=self.get_bpbynumber(i)\n except ValueError as err:\n self.error(err)\n else:\n self.clear_bpbynumber(i)\n self.message('Deleted %s'%bp)\n do_cl=do_clear\n \n complete_clear=_complete_location\n complete_cl=_complete_location\n \n def do_where(self,arg):\n ''\n\n\n\n\n \n self.print_stack_trace()\n do_w=do_where\n do_bt=do_where\n \n def _select_frame(self,number):\n assert 0 <=number =2:\n self.error('No help for %r; please do not run Python with -OO '\n 'if you need command help'%arg)\n return\n if command.__doc__ is None:\n self.error('No help for %r; __doc__ string missing'%arg)\n return\n self.message(self._help_message_from_doc(command.__doc__))\n \n do_h=do_help\n \n def help_exec(self):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n self.message((self.help_exec.__doc__ or '').strip())\n \n def help_pdb(self):\n help()\n \n \n \n def lookupmodule(self,filename):\n ''\n\n\n\n \n if os.path.isabs(filename)and os.path.exists(filename):\n return filename\n f=os.path.join(sys.path[0],filename)\n if os.path.exists(f)and self.canonic(f)==self.mainpyfile:\n return f\n root,ext=os.path.splitext(filename)\n if ext =='':\n filename=filename+'.py'\n if os.path.isabs(filename):\n return filename\n for dirname in sys.path:\n while os.path.islink(dirname):\n dirname=os.readlink(dirname)\n fullname=os.path.join(dirname,filename)\n if os.path.exists(fullname):\n return fullname\n return None\n \n def _run(self,target:Union[_ModuleTarget,_ScriptTarget]):\n \n \n \n \n \n self._wait_for_mainpyfile=True\n self._user_requested_quit=False\n \n self.mainpyfile=self.canonic(target.filename)\n \n \n \n \n import __main__\n __main__.__dict__.clear()\n __main__.__dict__.update(target.namespace)\n \n self.run(target.code)\n \n def _format_exc(self,exc:BaseException):\n return traceback.format_exception_only(exc)[-1].strip()\n \n def _compile_error_message(self,expr):\n ''\n try:\n compile(expr,\"\",\"eval\")\n except SyntaxError as exc:\n return _rstr(self._format_exc(exc))\n return \"\"\n \n def _getsourcelines(self,obj):\n \n \n \n \n \n lines,lineno=inspect.getsourcelines(obj)\n lineno=max(1,lineno)\n return lines,lineno\n \n def _help_message_from_doc(self,doc):\n lines=[line.strip()for line in doc.rstrip().splitlines()]\n if not lines:\n return \"No help message found.\"\n if \"\"in lines:\n usage_end=lines.index(\"\")\n else:\n usage_end=1\n formatted=[]\n indent=\" \"*len(self.prompt)\n for i,line in enumerate(lines):\n if i ==0:\n prefix=\"Usage: \"\n elif i 0:\n self.commit_frame(force=True)\n self.current_frame=None\n \n def commit_frame(self,force=False):\n if self.current_frame:\n f=self.current_frame\n if f.tell()>=self._FRAME_SIZE_TARGET or force:\n data=f.getbuffer()\n write=self.file_write\n if len(data)>=self._FRAME_SIZE_MIN:\n \n \n \n \n write(FRAME+pack(\"':\n raise AttributeError(\"Can't get local attribute {!r} on {!r}\"\n .format(name,obj))\n try:\n parent=obj\n obj=getattr(obj,subpath)\n except AttributeError:\n raise AttributeError(\"Can't get attribute {!r} on {!r}\"\n .format(name,obj))from None\n return obj,parent\n \ndef whichmodule(obj,name):\n ''\n module_name=getattr(obj,'__module__',None)\n if module_name is not None:\n return module_name\n \n \n for module_name,module in sys.modules.copy().items():\n if(module_name =='__main__'\n or module_name =='__mp_main__'\n or module is None):\n continue\n try:\n if _getattribute(module,name)[0]is obj:\n return module_name\n except AttributeError:\n pass\n return '__main__'\n \ndef encode_long(x):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if x ==0:\n return b''\n nbytes=(x.bit_length()>>3)+1\n result=x.to_bytes(nbytes,byteorder='little',signed=True)\n if x <0 and nbytes >1:\n if result[-1]==0xff and(result[-2]&0x80)!=0:\n result=result[:-1]\n return result\n \ndef decode_long(data):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return int.from_bytes(data,byteorder='little',signed=True)\n \n \n \n \nclass _Pickler:\n\n def __init__(self,file,protocol=None,*,fix_imports=True,\n buffer_callback=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if protocol is None:\n protocol=DEFAULT_PROTOCOL\n if protocol <0:\n protocol=HIGHEST_PROTOCOL\n elif not 0 <=protocol <=HIGHEST_PROTOCOL:\n raise ValueError(\"pickle protocol must be <= %d\"%HIGHEST_PROTOCOL)\n if buffer_callback is not None and protocol <5:\n raise ValueError(\"buffer_callback needs protocol >= 5\")\n self._buffer_callback=buffer_callback\n try:\n self._file_write=file.write\n except AttributeError:\n raise TypeError(\"file must have a 'write' attribute\")\n self.framer=_Framer(self._file_write)\n self.write=self.framer.write\n self._write_large_bytes=self.framer.write_large_bytes\n self.memo={}\n self.proto=int(protocol)\n self.bin=protocol >=1\n self.fast=0\n self.fix_imports=fix_imports and protocol <3\n \n def clear_memo(self):\n ''\n\n\n\n\n\n \n self.memo.clear()\n \n def dump(self,obj):\n ''\n \n \n if not hasattr(self,\"_file_write\"):\n raise PicklingError(\"Pickler.__init__() was not called by \"\n \"%s.__init__()\"%(self.__class__.__name__,))\n if self.proto >=2:\n self.write(PROTO+pack(\"=4:\n self.framer.start_framing()\n self.save(obj)\n self.write(STOP)\n self.framer.end_framing()\n \n def memoize(self,obj):\n ''\n \n \n \n \n \n \n \n \n \n \n \n \n \n if self.fast:\n return\n assert id(obj)not in self.memo\n idx=len(self.memo)\n self.write(self.put(idx))\n self.memo[id(obj)]=idx,obj\n \n \n def put(self,idx):\n if self.proto >=4:\n return MEMOIZE\n elif self.bin:\n if idx <256:\n return BINPUT+pack(\"=2 and func_name ==\"__newobj_ex__\":\n cls,args,kwargs=args\n if not hasattr(cls,\"__new__\"):\n raise PicklingError(\"args[0] from {} args has no __new__\"\n .format(func_name))\n if obj is not None and cls is not obj.__class__:\n raise PicklingError(\"args[0] from {} args has the wrong class\"\n .format(func_name))\n if self.proto >=4:\n save(cls)\n save(args)\n save(kwargs)\n write(NEWOBJ_EX)\n else:\n func=partial(cls.__new__,cls,*args,**kwargs)\n save(func)\n save(())\n write(REDUCE)\n elif self.proto >=2 and func_name ==\"__newobj__\":\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n cls=args[0]\n if not hasattr(cls,\"__new__\"):\n raise PicklingError(\n \"args[0] from __newobj__ args has no __new__\")\n if obj is not None and cls is not obj.__class__:\n raise PicklingError(\n \"args[0] from __newobj__ args has the wrong class\")\n args=args[1:]\n save(cls)\n save(args)\n write(NEWOBJ)\n else:\n save(func)\n save(args)\n write(REDUCE)\n \n if obj is not None:\n \n \n \n if id(obj)in self.memo:\n write(POP+self.get(self.memo[id(obj)][0]))\n else:\n self.memoize(obj)\n \n \n \n \n \n \n if listitems is not None:\n self._batch_appends(listitems)\n \n if dictitems is not None:\n self._batch_setitems(dictitems)\n \n if state is not None:\n if state_setter is None:\n save(state)\n write(BUILD)\n else:\n \n \n \n \n save(state_setter)\n save(obj)\n save(state)\n write(TUPLE2)\n \n write(REDUCE)\n \n \n \n \n write(POP)\n \n \n \n dispatch={}\n \n def save_none(self,obj):\n self.write(NONE)\n dispatch[type(None)]=save_none\n \n def save_bool(self,obj):\n if self.proto >=2:\n self.write(NEWTRUE if obj else NEWFALSE)\n else:\n self.write(TRUE if obj else FALSE)\n dispatch[bool]=save_bool\n \n def save_long(self,obj):\n if self.bin:\n \n \n \n \n if obj >=0:\n if obj <=0xff:\n self.write(BININT1+pack(\"=2:\n encoded=encode_long(obj)\n n=len(encoded)\n if n <256:\n self.write(LONG1+pack(\"d',obj))\n else:\n self.write(FLOAT+repr(obj).encode(\"ascii\")+b'\\n')\n dispatch[float]=save_float\n \n def save_bytes(self,obj):\n if self.proto <3:\n if not obj:\n self.save_reduce(bytes,(),obj=obj)\n else:\n self.save_reduce(codecs.encode,\n (str(obj,'latin1'),'latin1'),obj=obj)\n return\n n=len(obj)\n if n <=0xff:\n self.write(SHORT_BINBYTES+pack(\"0xffffffff and self.proto >=4:\n self._write_large_bytes(BINBYTES8+pack(\"=self.framer._FRAME_SIZE_TARGET:\n self._write_large_bytes(BINBYTES+pack(\"=self.framer._FRAME_SIZE_TARGET:\n self._write_large_bytes(BYTEARRAY8+pack(\"= 5\")\n with obj.raw()as m:\n if not m.contiguous:\n raise PicklingError(\"PickleBuffer can not be pickled when \"\n \"pointing to a non-contiguous buffer\")\n in_band=True\n if self._buffer_callback is not None:\n in_band=bool(self._buffer_callback(obj))\n if in_band:\n \n \n if m.readonly:\n self.save_bytes(m.tobytes())\n else:\n self.save_bytearray(m.tobytes())\n else:\n \n self.write(NEXT_BUFFER)\n if m.readonly:\n self.write(READONLY_BUFFER)\n \n dispatch[PickleBuffer]=save_picklebuffer\n \n def save_str(self,obj):\n if self.bin:\n encoded=obj.encode('utf-8','surrogatepass')\n n=len(encoded)\n if n <=0xff and self.proto >=4:\n self.write(SHORT_BINUNICODE+pack(\"0xffffffff and self.proto >=4:\n self._write_large_bytes(BINUNICODE8+pack(\"=self.framer._FRAME_SIZE_TARGET:\n self._write_large_bytes(BINUNICODE+pack(\"=2:\n for element in obj:\n save(element)\n \n if id(obj)in memo:\n get=self.get(memo[id(obj)][0])\n self.write(POP *n+get)\n else:\n self.write(_tuplesize2code[n])\n self.memoize(obj)\n return\n \n \n \n write=self.write\n write(MARK)\n for element in obj:\n save(element)\n \n if id(obj)in memo:\n \n \n \n \n \n \n \n get=self.get(memo[id(obj)][0])\n if self.bin:\n write(POP_MARK+get)\n else:\n write(POP *(n+1)+get)\n return\n \n \n write(TUPLE)\n self.memoize(obj)\n \n dispatch[tuple]=save_tuple\n \n def save_list(self,obj):\n if self.bin:\n self.write(EMPTY_LIST)\n else:\n self.write(MARK+LIST)\n \n self.memoize(obj)\n self._batch_appends(obj)\n \n dispatch[list]=save_list\n \n _BATCHSIZE=1000\n \n def _batch_appends(self,items):\n \n save=self.save\n write=self.write\n \n if not self.bin:\n for x in items:\n save(x)\n write(APPEND)\n return\n \n it=iter(items)\n while True:\n tmp=list(islice(it,self._BATCHSIZE))\n n=len(tmp)\n if n >1:\n write(MARK)\n for x in tmp:\n save(x)\n write(APPENDS)\n elif n:\n save(tmp[0])\n write(APPEND)\n \n if n 1:\n write(MARK)\n for k,v in tmp:\n save(k)\n save(v)\n write(SETITEMS)\n elif n:\n k,v=tmp[0]\n save(k)\n save(v)\n write(SETITEM)\n \n if n 0:\n write(MARK)\n for item in batch:\n save(item)\n write(ADDITEMS)\n if n =2:\n code=_extension_registry.get((module_name,name))\n if code:\n assert code >0\n if code <=0xff:\n write(EXT1+pack(\"=4:\n self.save(module_name)\n self.save(name)\n write(STACK_GLOBAL)\n elif parent is not module:\n self.save_reduce(getattr,(parent,lastname))\n elif self.proto >=3:\n write(GLOBAL+bytes(module_name,\"utf-8\")+b'\\n'+\n bytes(name,\"utf-8\")+b'\\n')\n else:\n if self.fix_imports:\n r_name_mapping=_compat_pickle.REVERSE_NAME_MAPPING\n r_import_mapping=_compat_pickle.REVERSE_IMPORT_MAPPING\n if(module_name,name)in r_name_mapping:\n module_name,name=r_name_mapping[(module_name,name)]\n elif module_name in r_import_mapping:\n module_name=r_import_mapping[module_name]\n try:\n write(GLOBAL+bytes(module_name,\"ascii\")+b'\\n'+\n bytes(name,\"ascii\")+b'\\n')\n except UnicodeEncodeError:\n raise PicklingError(\n \"can't pickle global identifier '%s.%s' using \"\n \"pickle protocol %i\"%(module,name,self.proto))from None\n \n self.memoize(obj)\n \n def save_type(self,obj):\n if obj is type(None):\n return self.save_reduce(type,(None,),obj=obj)\n elif obj is type(NotImplemented):\n return self.save_reduce(type,(NotImplemented,),obj=obj)\n elif obj is type(...):\n return self.save_reduce(type,(...,),obj=obj)\n return self.save_global(obj)\n \n dispatch[FunctionType]=save_global\n dispatch[type]=save_type\n \n \n \n \nclass _Unpickler:\n\n def __init__(self,file,*,fix_imports=True,\n encoding=\"ASCII\",errors=\"strict\",buffers=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n self._buffers=iter(buffers)if buffers is not None else None\n self._file_readline=file.readline\n self._file_read=file.read\n self.memo={}\n self.encoding=encoding\n self.errors=errors\n self.proto=0\n self.fix_imports=fix_imports\n \n def load(self):\n ''\n\n\n \n \n \n if not hasattr(self,\"_file_read\"):\n raise UnpicklingError(\"Unpickler.__init__() was not called by \"\n \"%s.__init__()\"%(self.__class__.__name__,))\n self._unframer=_Unframer(self._file_read,self._file_readline)\n self.read=self._unframer.read\n self.readinto=self._unframer.readinto\n self.readline=self._unframer.readline\n self.metastack=[]\n self.stack=[]\n self.append=self.stack.append\n self.proto=0\n read=self.read\n dispatch=self.dispatch\n try:\n while True:\n key=read(1)\n if not key:\n raise EOFError\n assert isinstance(key,bytes_types)\n dispatch[key[0]](self)\n except _Stop as stopinst:\n return stopinst.value\n \n \n def pop_mark(self):\n items=self.stack\n self.stack=self.metastack.pop()\n self.append=self.stack.append\n return items\n \n def persistent_load(self,pid):\n raise UnpicklingError(\"unsupported persistent id encountered\")\n \n dispatch={}\n \n def load_proto(self):\n proto=self.read(1)[0]\n if not 0 <=proto <=HIGHEST_PROTOCOL:\n raise ValueError(\"unsupported pickle protocol: %d\"%proto)\n self.proto=proto\n dispatch[PROTO[0]]=load_proto\n \n def load_frame(self):\n frame_size,=unpack('sys.maxsize:\n raise ValueError(\"frame size > sys.maxsize: %d\"%frame_size)\n self._unframer.load_frame(frame_size)\n dispatch[FRAME[0]]=load_frame\n \n def load_persid(self):\n try:\n pid=self.readline()[:-1].decode(\"ascii\")\n except UnicodeDecodeError:\n raise UnpicklingError(\n \"persistent IDs in protocol 0 must be ASCII strings\")\n self.append(self.persistent_load(pid))\n dispatch[PERSID[0]]=load_persid\n \n def load_binpersid(self):\n pid=self.stack.pop()\n self.append(self.persistent_load(pid))\n dispatch[BINPERSID[0]]=load_binpersid\n \n def load_none(self):\n self.append(None)\n dispatch[NONE[0]]=load_none\n \n def load_false(self):\n self.append(False)\n dispatch[NEWFALSE[0]]=load_false\n \n def load_true(self):\n self.append(True)\n dispatch[NEWTRUE[0]]=load_true\n \n def load_int(self):\n data=self.readline()\n if data ==FALSE[1:]:\n val=False\n elif data ==TRUE[1:]:\n val=True\n else:\n val=int(data,0)\n self.append(val)\n dispatch[INT[0]]=load_int\n \n def load_binint(self):\n self.append(unpack('d',self.read(8))[0])\n dispatch[BINFLOAT[0]]=load_binfloat\n \n def _decode_string(self,value):\n \n \n \n if self.encoding ==\"bytes\":\n return value\n else:\n return value.decode(self.encoding,self.errors)\n \n def load_string(self):\n data=self.readline()[:-1]\n \n if len(data)>=2 and data[0]==data[-1]and data[0]in b'\"\\'':\n data=data[1:-1]\n else:\n raise UnpicklingError(\"the STRING opcode argument must be quoted\")\n self.append(self._decode_string(codecs.escape_decode(data)[0]))\n dispatch[STRING[0]]=load_string\n \n def load_binstring(self):\n \n len,=unpack('maxsize:\n raise UnpicklingError(\"BINBYTES exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n self.append(self.read(len))\n dispatch[BINBYTES[0]]=load_binbytes\n \n def load_unicode(self):\n self.append(str(self.readline()[:-1],'raw-unicode-escape'))\n dispatch[UNICODE[0]]=load_unicode\n \n def load_binunicode(self):\n len,=unpack('maxsize:\n raise UnpicklingError(\"BINUNICODE exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n self.append(str(self.read(len),'utf-8','surrogatepass'))\n dispatch[BINUNICODE[0]]=load_binunicode\n \n def load_binunicode8(self):\n len,=unpack('maxsize:\n raise UnpicklingError(\"BINUNICODE8 exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n self.append(str(self.read(len),'utf-8','surrogatepass'))\n dispatch[BINUNICODE8[0]]=load_binunicode8\n \n def load_binbytes8(self):\n len,=unpack('maxsize:\n raise UnpicklingError(\"BINBYTES8 exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n self.append(self.read(len))\n dispatch[BINBYTES8[0]]=load_binbytes8\n \n def load_bytearray8(self):\n len,=unpack('maxsize:\n raise UnpicklingError(\"BYTEARRAY8 exceeds system's maximum size \"\n \"of %d bytes\"%maxsize)\n b=bytearray(len)\n self.readinto(b)\n self.append(b)\n dispatch[BYTEARRAY8[0]]=load_bytearray8\n \n def load_next_buffer(self):\n if self._buffers is None:\n raise UnpicklingError(\"pickle stream refers to out-of-band data \"\n \"but no *buffers* argument was given\")\n try:\n buf=next(self._buffers)\n except StopIteration:\n raise UnpicklingError(\"not enough out-of-band buffers\")\n self.append(buf)\n dispatch[NEXT_BUFFER[0]]=load_next_buffer\n \n def load_readonly_buffer(self):\n buf=self.stack[-1]\n with memoryview(buf)as m:\n if not m.readonly:\n self.stack[-1]=m.toreadonly()\n dispatch[READONLY_BUFFER[0]]=load_readonly_buffer\n \n def load_short_binstring(self):\n len=self.read(1)[0]\n data=self.read(len)\n self.append(self._decode_string(data))\n dispatch[SHORT_BINSTRING[0]]=load_short_binstring\n \n def load_short_binbytes(self):\n len=self.read(1)[0]\n self.append(self.read(len))\n dispatch[SHORT_BINBYTES[0]]=load_short_binbytes\n \n def load_short_binunicode(self):\n len=self.read(1)[0]\n self.append(str(self.read(len),'utf-8','surrogatepass'))\n dispatch[SHORT_BINUNICODE[0]]=load_short_binunicode\n \n def load_tuple(self):\n items=self.pop_mark()\n self.append(tuple(items))\n dispatch[TUPLE[0]]=load_tuple\n \n def load_empty_tuple(self):\n self.append(())\n dispatch[EMPTY_TUPLE[0]]=load_empty_tuple\n \n def load_tuple1(self):\n self.stack[-1]=(self.stack[-1],)\n dispatch[TUPLE1[0]]=load_tuple1\n \n def load_tuple2(self):\n self.stack[-2:]=[(self.stack[-2],self.stack[-1])]\n dispatch[TUPLE2[0]]=load_tuple2\n \n def load_tuple3(self):\n self.stack[-3:]=[(self.stack[-3],self.stack[-2],self.stack[-1])]\n dispatch[TUPLE3[0]]=load_tuple3\n \n def load_empty_list(self):\n self.append([])\n dispatch[EMPTY_LIST[0]]=load_empty_list\n \n def load_empty_dictionary(self):\n self.append({})\n dispatch[EMPTY_DICT[0]]=load_empty_dictionary\n \n def load_empty_set(self):\n self.append(set())\n dispatch[EMPTY_SET[0]]=load_empty_set\n \n def load_frozenset(self):\n items=self.pop_mark()\n self.append(frozenset(items))\n dispatch[FROZENSET[0]]=load_frozenset\n \n def load_list(self):\n items=self.pop_mark()\n self.append(items)\n dispatch[LIST[0]]=load_list\n \n def load_dict(self):\n items=self.pop_mark()\n d={items[i]:items[i+1]\n for i in range(0,len(items),2)}\n self.append(d)\n dispatch[DICT[0]]=load_dict\n \n \n \n \n \n \n def _instantiate(self,klass,args):\n if(args or not isinstance(klass,type)or\n hasattr(klass,\"__getinitargs__\")):\n try:\n value=klass(*args)\n except TypeError as err:\n raise TypeError(\"in constructor for %s: %s\"%\n (klass.__name__,str(err)),err.__traceback__)\n else:\n value=klass.__new__(klass)\n self.append(value)\n \n def load_inst(self):\n module=self.readline()[:-1].decode(\"ascii\")\n name=self.readline()[:-1].decode(\"ascii\")\n klass=self.find_class(module,name)\n self._instantiate(klass,self.pop_mark())\n dispatch[INST[0]]=load_inst\n \n def load_obj(self):\n \n args=self.pop_mark()\n cls=args.pop(0)\n self._instantiate(cls,args)\n dispatch[OBJ[0]]=load_obj\n \n def load_newobj(self):\n args=self.stack.pop()\n cls=self.stack.pop()\n obj=cls.__new__(cls,*args)\n self.append(obj)\n dispatch[NEWOBJ[0]]=load_newobj\n \n def load_newobj_ex(self):\n kwargs=self.stack.pop()\n args=self.stack.pop()\n cls=self.stack.pop()\n obj=cls.__new__(cls,*args,**kwargs)\n self.append(obj)\n dispatch[NEWOBJ_EX[0]]=load_newobj_ex\n \n def load_global(self):\n module=self.readline()[:-1].decode(\"utf-8\")\n name=self.readline()[:-1].decode(\"utf-8\")\n klass=self.find_class(module,name)\n self.append(klass)\n dispatch[GLOBAL[0]]=load_global\n \n def load_stack_global(self):\n name=self.stack.pop()\n module=self.stack.pop()\n if type(name)is not str or type(module)is not str:\n raise UnpicklingError(\"STACK_GLOBAL requires str\")\n self.append(self.find_class(module,name))\n dispatch[STACK_GLOBAL[0]]=load_stack_global\n \n def load_ext1(self):\n code=self.read(1)[0]\n self.get_extension(code)\n dispatch[EXT1[0]]=load_ext1\n \n def load_ext2(self):\n code,=unpack('=4:\n return _getattribute(sys.modules[module],name)[0]\n else:\n return getattr(sys.modules[module],name)\n \n def load_reduce(self):\n stack=self.stack\n args=stack.pop()\n func=stack[-1]\n stack[-1]=func(*args)\n dispatch[REDUCE[0]]=load_reduce\n \n def load_pop(self):\n if self.stack:\n del self.stack[-1]\n else:\n self.pop_mark()\n dispatch[POP[0]]=load_pop\n \n def load_pop_mark(self):\n self.pop_mark()\n dispatch[POP_MARK[0]]=load_pop_mark\n \n def load_dup(self):\n self.append(self.stack[-1])\n dispatch[DUP[0]]=load_dup\n \n def load_get(self):\n i=int(self.readline()[:-1])\n try:\n self.append(self.memo[i])\n except KeyError:\n msg=f'Memo value not found at index {i}'\n raise UnpicklingError(msg)from None\n dispatch[GET[0]]=load_get\n \n def load_binget(self):\n i=self.read(1)[0]\n try:\n self.append(self.memo[i])\n except KeyError as exc:\n msg=f'Memo value not found at index {i}'\n raise UnpicklingError(msg)from None\n dispatch[BINGET[0]]=load_binget\n \n def load_long_binget(self):\n i,=unpack('maxsize:\n raise ValueError(\"negative LONG_BINPUT argument\")\n self.memo[i]=self.stack[-1]\n dispatch[LONG_BINPUT[0]]=load_long_binput\n \n def load_memoize(self):\n memo=self.memo\n memo[len(memo)]=self.stack[-1]\n dispatch[MEMOIZE[0]]=load_memoize\n \n def load_append(self):\n stack=self.stack\n value=stack.pop()\n list=stack[-1]\n list.append(value)\n dispatch[APPEND[0]]=load_append\n \n def load_appends(self):\n items=self.pop_mark()\n list_obj=self.stack[-1]\n try:\n extend=list_obj.extend\n except AttributeError:\n pass\n else:\n extend(items)\n return\n \n \n \n append=list_obj.append\n for item in items:\n append(item)\n dispatch[APPENDS[0]]=load_appends\n \n def load_setitem(self):\n stack=self.stack\n value=stack.pop()\n key=stack.pop()\n dict=stack[-1]\n dict[key]=value\n dispatch[SETITEM[0]]=load_setitem\n \n def load_setitems(self):\n items=self.pop_mark()\n dict=self.stack[-1]\n for i in range(0,len(items),2):\n dict[items[i]]=items[i+1]\n dispatch[SETITEMS[0]]=load_setitems\n \n def load_additems(self):\n items=self.pop_mark()\n set_obj=self.stack[-1]\n if isinstance(set_obj,set):\n set_obj.update(items)\n else:\n add=set_obj.add\n for item in items:\n add(item)\n dispatch[ADDITEMS[0]]=load_additems\n \n def load_build(self):\n stack=self.stack\n state=stack.pop()\n inst=stack[-1]\n setstate=getattr(inst,\"__setstate__\",None)\n if setstate is not None:\n setstate(state)\n return\n slotstate=None\n if isinstance(state,tuple)and len(state)==2:\n state,slotstate=state\n if state:\n inst_dict=inst.__dict__\n intern=sys.intern\n for k,v in state.items():\n if type(k)is str:\n inst_dict[intern(k)]=v\n else:\n inst_dict[k]=v\n if slotstate:\n for k,v in slotstate.items():\n setattr(inst,k,v)\n dispatch[BUILD[0]]=load_build\n \n def load_mark(self):\n self.metastack.append(self.stack)\n self.stack=[]\n self.append=self.stack.append\n dispatch[MARK[0]]=load_mark\n \n def load_stop(self):\n value=self.stack.pop()\n raise _Stop(value)\n dispatch[STOP[0]]=load_stop\n \n \n \n \ndef _dump(obj,file,protocol=None,*,fix_imports=True,buffer_callback=None):\n _Pickler(file,protocol,fix_imports=fix_imports,\n buffer_callback=buffer_callback).dump(obj)\n \ndef _dumps(obj,protocol=None,*,fix_imports=True,buffer_callback=None):\n f=io.BytesIO()\n _Pickler(f,protocol,fix_imports=fix_imports,\n buffer_callback=buffer_callback).dump(obj)\n res=f.getvalue()\n assert isinstance(res,bytes_types)\n return res\n \ndef _load(file,*,fix_imports=True,encoding=\"ASCII\",errors=\"strict\",\nbuffers=None):\n return _Unpickler(file,fix_imports=fix_imports,buffers=buffers,\n encoding=encoding,errors=errors).load()\n \ndef _loads(s,/,*,fix_imports=True,encoding=\"ASCII\",errors=\"strict\",\nbuffers=None):\n if isinstance(s,str):\n raise TypeError(\"Can't load pickle from unicode string\")\n file=io.BytesIO(s)\n return _Unpickler(file,fix_imports=fix_imports,buffers=buffers,\n encoding=encoding,errors=errors).load()\n \n \ntry:\n from _pickle import(\n PickleError,\n PicklingError,\n UnpicklingError,\n Pickler,\n Unpickler,\n dump,\n dumps,\n load,\n loads\n )\nexcept ImportError:\n Pickler,Unpickler=_Pickler,_Unpickler\n dump,dumps,load,loads=_dump,_dumps,_load,_loads\n \n \ndef _test():\n import doctest\n return doctest.testmod()\n \nif __name__ ==\"__main__\":\n import argparse\n parser=argparse.ArgumentParser(\n description='display contents of the pickle files')\n parser.add_argument(\n 'pickle_file',type=argparse.FileType('br'),\n nargs='*',help='the pickle file')\n parser.add_argument(\n '-t','--test',action='store_true',\n help='run self-test suite')\n parser.add_argument(\n '-v',action='store_true',\n help='run verbosely; only affects self-test run')\n args=parser.parse_args()\n if args.test:\n _test()\n else:\n if not args.pickle_file:\n parser.print_help()\n else:\n import pprint\n for f in args.pickle_file:\n obj=load(f)\n pprint.pprint(obj)\n", ["_compat_pickle", "_pickle", "argparse", "codecs", "copyreg", "doctest", "functools", "io", "itertools", "pprint", "re", "struct", "sys", "types"]], "pkgutil": [".py", "''\n\nfrom collections import namedtuple\nfrom functools import singledispatch as simplegeneric\nimport importlib\nimport importlib.util\nimport importlib.machinery\nimport os\nimport os.path\nimport sys\nfrom types import ModuleType\nimport warnings\n\n__all__=[\n'get_importer','iter_importers','get_loader','find_loader',\n'walk_packages','iter_modules','get_data',\n'read_code','extend_path',\n'ModuleInfo',\n]\n\n\nModuleInfo=namedtuple('ModuleInfo','module_finder name ispkg')\nModuleInfo.__doc__='A namedtuple with minimal info about a module.'\n\n\ndef read_code(stream):\n\n\n import marshal\n \n magic=stream.read(4)\n if magic !=importlib.util.MAGIC_NUMBER:\n return None\n \n stream.read(12)\n return marshal.load(stream)\n \n \ndef walk_packages(path=None,prefix='',onerror=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def seen(p,m={}):\n if p in m:\n return True\n m[p]=True\n \n for info in iter_modules(path,prefix):\n yield info\n \n if info.ispkg:\n try:\n __import__(info.name)\n except ImportError:\n if onerror is not None:\n onerror(info.name)\n except Exception:\n if onerror is not None:\n onerror(info.name)\n else:\n raise\n else:\n path=getattr(sys.modules[info.name],'__path__',None)or[]\n \n \n path=[p for p in path if not seen(p)]\n \n yield from walk_packages(path,info.name+'.',onerror)\n \n \ndef iter_modules(path=None,prefix=''):\n ''\n\n\n\n\n\n\n\n \n if path is None:\n importers=iter_importers()\n elif isinstance(path,str):\n raise ValueError(\"path must be None or list of paths to look for \"\n \"modules in\")\n else:\n importers=map(get_importer,path)\n \n yielded={}\n for i in importers:\n for name,ispkg in iter_importer_modules(i,prefix):\n if name not in yielded:\n yielded[name]=1\n yield ModuleInfo(i,name,ispkg)\n \n \n@simplegeneric\ndef iter_importer_modules(importer,prefix=''):\n if not hasattr(importer,'iter_modules'):\n return[]\n return importer.iter_modules(prefix)\n \n \n \ndef _iter_file_finder_modules(importer,prefix=''):\n if importer.path is None or not os.path.isdir(importer.path):\n return\n \n yielded={}\n import inspect\n try:\n filenames=os.listdir(importer.path)\n except OSError:\n \n filenames=[]\n filenames.sort()\n \n for fn in filenames:\n modname=inspect.getmodulename(fn)\n if modname =='__init__'or modname in yielded:\n continue\n \n path=os.path.join(importer.path,fn)\n ispkg=False\n \n if not modname and os.path.isdir(path)and '.'not in fn:\n modname=fn\n try:\n dircontents=os.listdir(path)\n except OSError:\n \n dircontents=[]\n for fn in dircontents:\n subname=inspect.getmodulename(fn)\n if subname =='__init__':\n ispkg=True\n break\n else:\n continue\n \n if modname and '.'not in modname:\n yielded[modname]=1\n yield prefix+modname,ispkg\n \niter_importer_modules.register(\nimportlib.machinery.FileFinder,_iter_file_finder_modules)\n\n\ntry:\n import zipimport\n from zipimport import zipimporter\n \n def iter_zipimport_modules(importer,prefix=''):\n dirlist=sorted(zipimport._zip_directory_cache[importer.archive])\n _prefix=importer.prefix\n plen=len(_prefix)\n yielded={}\n import inspect\n for fn in dirlist:\n if not fn.startswith(_prefix):\n continue\n \n fn=fn[plen:].split(os.sep)\n \n if len(fn)==2 and fn[1].startswith('__init__.py'):\n if fn[0]not in yielded:\n yielded[fn[0]]=1\n yield prefix+fn[0],True\n \n if len(fn)!=1:\n continue\n \n modname=inspect.getmodulename(fn[0])\n if modname =='__init__':\n continue\n \n if modname and '.'not in modname and modname not in yielded:\n yielded[modname]=1\n yield prefix+modname,False\n \n iter_importer_modules.register(zipimporter,iter_zipimport_modules)\n \nexcept ImportError:\n pass\n \n \ndef get_importer(path_item):\n ''\n\n\n\n\n\n\n \n path_item=os.fsdecode(path_item)\n try:\n importer=sys.path_importer_cache[path_item]\n except KeyError:\n for path_hook in sys.path_hooks:\n try:\n importer=path_hook(path_item)\n sys.path_importer_cache.setdefault(path_item,importer)\n break\n except ImportError:\n pass\n else:\n importer=None\n return importer\n \n \ndef iter_importers(fullname=\"\"):\n ''\n\n\n\n\n\n\n\n\n\n \n if fullname.startswith('.'):\n msg=\"Relative module name {!r} not supported\".format(fullname)\n raise ImportError(msg)\n if '.'in fullname:\n \n pkg_name=fullname.rpartition(\".\")[0]\n pkg=importlib.import_module(pkg_name)\n path=getattr(pkg,'__path__',None)\n if path is None:\n return\n else:\n yield from sys.meta_path\n path=sys.path\n for item in path:\n yield get_importer(item)\n \n \ndef get_loader(module_or_name):\n ''\n\n\n\n\n \n warnings._deprecated(\"pkgutil.get_loader\",\n f\"{warnings._DEPRECATED_MSG}; \"\n \"use importlib.util.find_spec() instead\",\n remove=(3,14))\n if module_or_name in sys.modules:\n module_or_name=sys.modules[module_or_name]\n if module_or_name is None:\n return None\n if isinstance(module_or_name,ModuleType):\n module=module_or_name\n loader=getattr(module,'__loader__',None)\n if loader is not None:\n return loader\n if getattr(module,'__spec__',None)is None:\n return None\n fullname=module.__name__\n else:\n fullname=module_or_name\n return find_loader(fullname)\n \n \ndef find_loader(fullname):\n ''\n\n\n\n\n \n warnings._deprecated(\"pkgutil.find_loader\",\n f\"{warnings._DEPRECATED_MSG}; \"\n \"use importlib.util.find_spec() instead\",\n remove=(3,14))\n if fullname.startswith('.'):\n msg=\"Relative module name {!r} not supported\".format(fullname)\n raise ImportError(msg)\n try:\n spec=importlib.util.find_spec(fullname)\n except(ImportError,AttributeError,TypeError,ValueError)as ex:\n \n \n \n msg=\"Error while finding loader for {!r} ({}: {})\"\n raise ImportError(msg.format(fullname,type(ex),ex))from ex\n return spec.loader if spec is not None else None\n \n \ndef extend_path(path,name):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if not isinstance(path,list):\n \n \n return path\n \n sname_pkg=name+\".pkg\"\n \n path=path[:]\n \n parent_package,_,final_name=name.rpartition('.')\n if parent_package:\n try:\n search_path=sys.modules[parent_package].__path__\n except(KeyError,AttributeError):\n \n \n return path\n else:\n search_path=sys.path\n \n for dir in search_path:\n if not isinstance(dir,str):\n continue\n \n finder=get_importer(dir)\n if finder is not None:\n portions=[]\n if hasattr(finder,'find_spec'):\n spec=finder.find_spec(final_name)\n if spec is not None:\n portions=spec.submodule_search_locations or[]\n \n elif hasattr(finder,'find_loader'):\n _,portions=finder.find_loader(final_name)\n \n for portion in portions:\n \n \n if portion not in path:\n path.append(portion)\n \n \n \n pkgfile=os.path.join(dir,sname_pkg)\n if os.path.isfile(pkgfile):\n try:\n f=open(pkgfile)\n except OSError as msg:\n sys.stderr.write(\"Can't open %s: %s\\n\"%\n (pkgfile,msg))\n else:\n with f:\n for line in f:\n line=line.rstrip('\\n')\n if not line or line.startswith('#'):\n continue\n path.append(line)\n \n return path\n \n \ndef get_data(package,resource):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n spec=importlib.util.find_spec(package)\n if spec is None:\n return None\n loader=spec.loader\n if loader is None or not hasattr(loader,'get_data'):\n return None\n \n mod=(sys.modules.get(package)or\n importlib._bootstrap._load(spec))\n if mod is None or not hasattr(mod,'__file__'):\n return None\n \n \n \n \n parts=resource.split('/')\n parts.insert(0,os.path.dirname(mod.__file__))\n resource_name=os.path.join(*parts)\n return loader.get_data(resource_name)\n \n \n_NAME_PATTERN=None\n\ndef resolve_name(name):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n global _NAME_PATTERN\n if _NAME_PATTERN is None:\n \n import re\n dotted_words=r'(?!\\d)(\\w+)(\\.(?!\\d)(\\w+))*'\n _NAME_PATTERN=re.compile(f'^(?P{dotted_words})'\n f'(?P:(?P{dotted_words})?)?$',\n re.UNICODE)\n \n m=_NAME_PATTERN.match(name)\n if not m:\n raise ValueError(f'invalid format: {name !r}')\n gd=m.groupdict()\n if gd.get('cln'):\n \n mod=importlib.import_module(gd['pkg'])\n parts=gd.get('obj')\n parts=parts.split('.')if parts else[]\n else:\n \n parts=name.split('.')\n modname=parts.pop(0)\n \n mod=importlib.import_module(modname)\n while parts:\n p=parts[0]\n s=f'{modname}.{p}'\n try:\n mod=importlib.import_module(s)\n parts.pop(0)\n modname=s\n except ImportError:\n break\n \n \n \n result=mod\n for p in parts:\n result=getattr(result,p)\n return result\n", ["collections", "functools", "importlib", "importlib.machinery", "importlib.util", "inspect", "marshal", "os", "os.path", "re", "sys", "types", "warnings", "zipimport"]], "platform": [".py", "''\n\n\n\nfrom browser import self as window\n\ndef architecture(*args,**kw):\n return \"\",window.navigator.platform\n \ndef machine(*args,**kw):\n return ''\n \ndef node(*args,**kw):\n return ''\n \ndef platform(*args,**kw):\n return window.navigator.platform\n \ndef processor(*args,**kw):\n return ''\n \ndef python_build():\n return ('.'.join(map(str,__BRYTHON__.implementation[:-1])),\n __BRYTHON__.compiled_date)\n \ndef python_compiler():\n return ''\n \ndef python_branch():\n return ''\n \ndef python_implementation():\n return 'Brython'\n \ndef python_revision():\n return ''\n \ndef python_version():\n return '.'.join(map(str,__BRYTHON__.version_info[:3]))\n \ndef python_version_tuple():\n return __BRYTHON__.version_info[:3]\n \ndef release():\n return ''\n \ndef system():\n return window.navigator.platform\n \ndef system_alias(*args,**kw):\n return window.navigator.platform\n \ndef uname():\n from collections import namedtuple\n klass=namedtuple('uname_result',\n 'system node release version machine processor')\n return klass(window.navigator.platform,'','','','','')\n", ["browser", "collections"]], "posixpath": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\ncurdir='.'\npardir='..'\nextsep='.'\nsep='/'\npathsep=':'\ndefpath='/bin:/usr/bin'\naltsep=None\ndevnull='/dev/null'\n\nimport os\nimport sys\nimport stat\nimport genericpath\nfrom genericpath import *\n\n__all__=[\"normcase\",\"isabs\",\"join\",\"splitdrive\",\"splitroot\",\"split\",\"splitext\",\n\"basename\",\"dirname\",\"commonprefix\",\"getsize\",\"getmtime\",\n\"getatime\",\"getctime\",\"islink\",\"exists\",\"lexists\",\"isdir\",\"isfile\",\n\"ismount\",\"expanduser\",\"expandvars\",\"normpath\",\"abspath\",\n\"samefile\",\"sameopenfile\",\"samestat\",\n\"curdir\",\"pardir\",\"sep\",\"pathsep\",\"defpath\",\"altsep\",\"extsep\",\n\"devnull\",\"realpath\",\"supports_unicode_filenames\",\"relpath\",\n\"commonpath\",\"isjunction\"]\n\n\ndef _get_sep(path):\n if isinstance(path,bytes):\n return b'/'\n else:\n return '/'\n \n \n \n \n \n \ndef normcase(s):\n ''\n return os.fspath(s)\n \n \n \n \n \ndef isabs(s):\n ''\n s=os.fspath(s)\n sep=_get_sep(s)\n return s.startswith(sep)\n \n \n \n \n \n \ndef join(a,*p):\n ''\n\n\n \n a=os.fspath(a)\n sep=_get_sep(a)\n path=a\n try:\n if not p:\n path[:0]+sep\n for b in map(os.fspath,p):\n if b.startswith(sep):\n path=b\n elif not path or path.endswith(sep):\n path +=b\n else:\n path +=sep+b\n except(TypeError,AttributeError,BytesWarning):\n genericpath._check_arg_types('join',a,*p)\n raise\n return path\n \n \n \n \n \n \n \ndef split(p):\n ''\n \n p=os.fspath(p)\n sep=_get_sep(p)\n i=p.rfind(sep)+1\n head,tail=p[:i],p[i:]\n if head and head !=sep *len(head):\n head=head.rstrip(sep)\n return head,tail\n \n \n \n \n \n \n \ndef splitext(p):\n p=os.fspath(p)\n if isinstance(p,bytes):\n sep=b'/'\n extsep=b'.'\n else:\n sep='/'\n extsep='.'\n return genericpath._splitext(p,sep,None,extsep)\nsplitext.__doc__=genericpath._splitext.__doc__\n\n\n\n\ndef splitdrive(p):\n ''\n \n p=os.fspath(p)\n return p[:0],p\n \n \ndef splitroot(p):\n ''\n\n\n\n\n\n\n\n \n p=os.fspath(p)\n if isinstance(p,bytes):\n sep=b'/'\n empty=b''\n else:\n sep='/'\n empty=''\n if p[:1]!=sep:\n \n return empty,empty,p\n elif p[1:2]!=sep or p[2:3]==sep:\n \n return empty,sep,p[1:]\n else:\n \n \n return empty,p[:2],p[2:]\n \n \n \n \ndef basename(p):\n ''\n p=os.fspath(p)\n sep=_get_sep(p)\n i=p.rfind(sep)+1\n return p[i:]\n \n \n \n \ndef dirname(p):\n ''\n p=os.fspath(p)\n sep=_get_sep(p)\n i=p.rfind(sep)+1\n head=p[:i]\n if head and head !=sep *len(head):\n head=head.rstrip(sep)\n return head\n \n \n \n \ndef isjunction(path):\n ''\n \n os.fspath(path)\n return False\n \n \n \n \ndef lexists(path):\n ''\n try:\n os.lstat(path)\n except(OSError,ValueError):\n return False\n return True\n \n \n \n \n \ndef ismount(path):\n ''\n try:\n s1=os.lstat(path)\n except(OSError,ValueError):\n \n return False\n else:\n \n if stat.S_ISLNK(s1.st_mode):\n return False\n \n path=os.fspath(path)\n if isinstance(path,bytes):\n parent=join(path,b'..')\n else:\n parent=join(path,'..')\n parent=realpath(parent)\n try:\n s2=os.lstat(parent)\n except(OSError,ValueError):\n return False\n \n dev1=s1.st_dev\n dev2=s2.st_dev\n if dev1 !=dev2:\n return True\n ino1=s1.st_ino\n ino2=s2.st_ino\n if ino1 ==ino2:\n return True\n return False\n \n \n \n \n \n \n \n \n \n \n \ndef expanduser(path):\n ''\n \n path=os.fspath(path)\n if isinstance(path,bytes):\n tilde=b'~'\n else:\n tilde='~'\n if not path.startswith(tilde):\n return path\n sep=_get_sep(path)\n i=path.find(sep,1)\n if i <0:\n i=len(path)\n if i ==1:\n if 'HOME'not in os.environ:\n try:\n import pwd\n except ImportError:\n \n return path\n try:\n userhome=pwd.getpwuid(os.getuid()).pw_dir\n except KeyError:\n \n \n return path\n else:\n userhome=os.environ['HOME']\n else:\n try:\n import pwd\n except ImportError:\n \n return path\n name=path[1:i]\n if isinstance(name,bytes):\n name=str(name,'ASCII')\n try:\n pwent=pwd.getpwnam(name)\n except KeyError:\n \n \n return path\n userhome=pwent.pw_dir\n \n if userhome is None and sys.platform ==\"vxworks\":\n return path\n if isinstance(path,bytes):\n userhome=os.fsencode(userhome)\n root=b'/'\n else:\n root='/'\n userhome=userhome.rstrip(root)\n return(userhome+path[i:])or root\n \n \n \n \n \n \n_varprog=None\n_varprogb=None\n\ndef expandvars(path):\n ''\n \n path=os.fspath(path)\n global _varprog,_varprogb\n if isinstance(path,bytes):\n if b'$'not in path:\n return path\n if not _varprogb:\n import re\n _varprogb=re.compile(br'\\$(\\w+|\\{[^}]*\\})',re.ASCII)\n search=_varprogb.search\n start=b'{'\n end=b'}'\n environ=getattr(os,'environb',None)\n else:\n if '$'not in path:\n return path\n if not _varprog:\n import re\n _varprog=re.compile(r'\\$(\\w+|\\{[^}]*\\})',re.ASCII)\n search=_varprog.search\n start='{'\n end='}'\n environ=os.environ\n i=0\n while True:\n m=search(path,i)\n if not m:\n break\n i,j=m.span(0)\n name=m.group(1)\n if name.startswith(start)and name.endswith(end):\n name=name[1:-1]\n try:\n if environ is None:\n value=os.fsencode(os.environ[os.fsdecode(name)])\n else:\n value=environ[name]\n except KeyError:\n i=j\n else:\n tail=path[j:]\n path=path[:i]+value\n i=len(path)\n path +=tail\n return path\n \n \n \n \n \n \ntry:\n from posix import _path_normpath\n \nexcept ImportError:\n def normpath(path):\n ''\n path=os.fspath(path)\n if isinstance(path,bytes):\n sep=b'/'\n empty=b''\n dot=b'.'\n dotdot=b'..'\n else:\n sep='/'\n empty=''\n dot='.'\n dotdot='..'\n if path ==empty:\n return dot\n _,initial_slashes,path=splitroot(path)\n comps=path.split(sep)\n new_comps=[]\n for comp in comps:\n if comp in(empty,dot):\n continue\n if(comp !=dotdot or(not initial_slashes and not new_comps)or\n (new_comps and new_comps[-1]==dotdot)):\n new_comps.append(comp)\n elif new_comps:\n new_comps.pop()\n comps=new_comps\n path=initial_slashes+sep.join(comps)\n return path or dot\n \nelse:\n def normpath(path):\n ''\n path=os.fspath(path)\n if isinstance(path,bytes):\n return os.fsencode(_path_normpath(os.fsdecode(path)))or b\".\"\n return _path_normpath(path)or \".\"\n \n \ndef abspath(path):\n ''\n path=os.fspath(path)\n if not isabs(path):\n if isinstance(path,bytes):\n cwd=os.getcwdb()\n else:\n cwd=os.getcwd()\n path=join(cwd,path)\n return normpath(path)\n \n \n \n \n \ndef realpath(filename,*,strict=False):\n ''\n \n filename=os.fspath(filename)\n print('posixpath 435, filename',filename,type(filename))\n path,ok=_joinrealpath(filename[:0],filename,strict,{})\n return abspath(path)\n \n \n \ndef _joinrealpath(path,rest,strict,seen):\n if isinstance(path,bytes):\n sep=b'/'\n curdir=b'.'\n pardir=b'..'\n else:\n sep='/'\n curdir='.'\n pardir='..'\n \n if isabs(rest):\n rest=rest[1:]\n path=sep\n \n while rest:\n name,_,rest=rest.partition(sep)\n if not name or name ==curdir:\n \n continue\n if name ==pardir:\n \n if path:\n path,name=split(path)\n if name ==pardir:\n path=join(path,pardir,pardir)\n else:\n path=pardir\n continue\n newpath=join(path,name)\n try:\n st=os.lstat(newpath)\n except OSError:\n if strict:\n raise\n is_link=False\n else:\n is_link=stat.S_ISLNK(st.st_mode)\n if not is_link:\n path=newpath\n continue\n \n if newpath in seen:\n \n path=seen[newpath]\n if path is not None:\n \n continue\n \n if strict:\n \n os.stat(newpath)\n else:\n \n return join(newpath,rest),False\n seen[newpath]=None\n path,ok=_joinrealpath(path,os.readlink(newpath),strict,seen)\n if not ok:\n return join(path,rest),False\n seen[newpath]=path\n \n return path,True\n \n \nsupports_unicode_filenames=(sys.platform =='darwin')\n\ndef relpath(path,start=None):\n ''\n \n if not path:\n raise ValueError(\"no path specified\")\n \n path=os.fspath(path)\n if isinstance(path,bytes):\n curdir=b'.'\n sep=b'/'\n pardir=b'..'\n else:\n curdir='.'\n sep='/'\n pardir='..'\n \n if start is None:\n start=curdir\n else:\n start=os.fspath(start)\n \n try:\n start_list=[x for x in abspath(start).split(sep)if x]\n path_list=[x for x in abspath(path).split(sep)if x]\n \n i=len(commonprefix([start_list,path_list]))\n \n rel_list=[pardir]*(len(start_list)-i)+path_list[i:]\n if not rel_list:\n return curdir\n return join(*rel_list)\n except(TypeError,AttributeError,BytesWarning,DeprecationWarning):\n genericpath._check_arg_types('relpath',path,start)\n raise\n \n \n \n \n \n \n \ndef commonpath(paths):\n ''\n \n if not paths:\n raise ValueError('commonpath() arg is an empty sequence')\n \n paths=tuple(map(os.fspath,paths))\n if isinstance(paths[0],bytes):\n sep=b'/'\n curdir=b'.'\n else:\n sep='/'\n curdir='.'\n \n try:\n split_paths=[path.split(sep)for path in paths]\n \n try:\n isabs,=set(p[:1]==sep for p in paths)\n except ValueError:\n raise ValueError(\"Can't mix absolute and relative paths\")from None\n \n split_paths=[[c for c in s if c and c !=curdir]for s in split_paths]\n s1=min(split_paths)\n s2=max(split_paths)\n common=s1\n for i,c in enumerate(s1):\n if c !=s2[i]:\n common=s1[:i]\n break\n \n prefix=sep if isabs else sep[:0]\n return prefix+sep.join(common)\n except(TypeError,AttributeError):\n genericpath._check_arg_types('commonpath',*paths)\n raise\n \n", ["genericpath", "os", "posix", "pwd", "re", "stat", "sys"]], "pprint": [".py", "\n\n\n\n\n\n\n\n\n\n\"\"\"Support to pretty-print lists, tuples, & dictionaries recursively.\n\nVery simple, but useful, especially in debugging data structures.\n\nClasses\n-------\n\nPrettyPrinter()\n Handle pretty-printing operations onto a stream using a configured\n set of formatting parameters.\n\nFunctions\n---------\n\npformat()\n Format a Python object into a pretty-printed representation.\n\npprint()\n Pretty-print a Python object to a stream [default is sys.stdout].\n\nsaferepr()\n Generate a 'standard' repr()-like value, but protect against recursive\n data structures.\n\n\"\"\"\n\nimport collections as _collections\nimport dataclasses as _dataclasses\nimport re\nimport sys as _sys\nimport types as _types\nfrom io import StringIO as _StringIO\n\n__all__=[\"pprint\",\"pformat\",\"isreadable\",\"isrecursive\",\"saferepr\",\n\"PrettyPrinter\",\"pp\"]\n\n\ndef pprint(object,stream=None,indent=1,width=80,depth=None,*,\ncompact=False,sort_dicts=True,underscore_numbers=False):\n ''\n printer=PrettyPrinter(\n stream=stream,indent=indent,width=width,depth=depth,\n compact=compact,sort_dicts=sort_dicts,\n underscore_numbers=underscore_numbers)\n printer.pprint(object)\n \ndef pformat(object,indent=1,width=80,depth=None,*,\ncompact=False,sort_dicts=True,underscore_numbers=False):\n ''\n return PrettyPrinter(indent=indent,width=width,depth=depth,\n compact=compact,sort_dicts=sort_dicts,\n underscore_numbers=underscore_numbers).pformat(object)\n \ndef pp(object,*args,sort_dicts=False,**kwargs):\n ''\n pprint(object,*args,sort_dicts=sort_dicts,**kwargs)\n \ndef saferepr(object):\n ''\n return PrettyPrinter()._safe_repr(object,{},None,0)[0]\n \ndef isreadable(object):\n ''\n return PrettyPrinter()._safe_repr(object,{},None,0)[1]\n \ndef isrecursive(object):\n ''\n return PrettyPrinter()._safe_repr(object,{},None,0)[2]\n \nclass _safe_key:\n ''\n\n\n\n\n\n\n \n \n __slots__=['obj']\n \n def __init__(self,obj):\n self.obj=obj\n \n def __lt__(self,other):\n try:\n return self.obj = 0')\n if depth is not None and depth <=0:\n raise ValueError('depth must be > 0')\n if not width:\n raise ValueError('width must be != 0')\n self._depth=depth\n self._indent_per_level=indent\n self._width=width\n if stream is not None:\n self._stream=stream\n else:\n self._stream=_sys.stdout\n self._compact=bool(compact)\n self._sort_dicts=sort_dicts\n self._underscore_numbers=underscore_numbers\n \n def pprint(self,object):\n if self._stream is not None:\n self._format(object,self._stream,0,0,{},0)\n self._stream.write(\"\\n\")\n \n def pformat(self,object):\n sio=_StringIO()\n self._format(object,sio,0,0,{},0)\n return sio.getvalue()\n \n def isrecursive(self,object):\n return self.format(object,{},0,0)[2]\n \n def isreadable(self,object):\n s,readable,recursive=self.format(object,{},0,0)\n return readable and not recursive\n \n def _format(self,object,stream,indent,allowance,context,level):\n objid=id(object)\n if objid in context:\n stream.write(_recursion(object))\n self._recursive=True\n self._readable=False\n return\n rep=self._repr(object,context,level)\n max_width=self._width -indent -allowance\n if len(rep)>max_width:\n p=self._dispatch.get(type(object).__repr__,None)\n if p is not None:\n context[objid]=1\n p(self,object,stream,indent,allowance,context,level+1)\n del context[objid]\n return\n elif(_dataclasses.is_dataclass(object)and\n not isinstance(object,type)and\n object.__dataclass_params__.repr and\n \n hasattr(object.__repr__,\"__wrapped__\")and\n \"__create_fn__\"in object.__repr__.__wrapped__.__qualname__):\n context[objid]=1\n self._pprint_dataclass(object,stream,indent,allowance,context,level+1)\n del context[objid]\n return\n stream.write(rep)\n \n def _pprint_dataclass(self,object,stream,indent,allowance,context,level):\n cls_name=object.__class__.__name__\n indent +=len(cls_name)+1\n items=[(f.name,getattr(object,f.name))for f in _dataclasses.fields(object)if f.repr]\n stream.write(cls_name+'(')\n self._format_namespace_items(items,stream,indent,allowance,context,level)\n stream.write(')')\n \n _dispatch={}\n \n def _pprint_dict(self,object,stream,indent,allowance,context,level):\n write=stream.write\n write('{')\n if self._indent_per_level >1:\n write((self._indent_per_level -1)*' ')\n length=len(object)\n if length:\n if self._sort_dicts:\n items=sorted(object.items(),key=_safe_tuple)\n else:\n items=object.items()\n self._format_dict_items(items,stream,indent,allowance+1,\n context,level)\n write('}')\n \n _dispatch[dict.__repr__]=_pprint_dict\n \n def _pprint_ordered_dict(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n cls=object.__class__\n stream.write(cls.__name__+'(')\n self._format(list(object.items()),stream,\n indent+len(cls.__name__)+1,allowance+1,\n context,level)\n stream.write(')')\n \n _dispatch[_collections.OrderedDict.__repr__]=_pprint_ordered_dict\n \n def _pprint_list(self,object,stream,indent,allowance,context,level):\n stream.write('[')\n self._format_items(object,stream,indent,allowance+1,\n context,level)\n stream.write(']')\n \n _dispatch[list.__repr__]=_pprint_list\n \n def _pprint_tuple(self,object,stream,indent,allowance,context,level):\n stream.write('(')\n endchar=',)'if len(object)==1 else ')'\n self._format_items(object,stream,indent,allowance+len(endchar),\n context,level)\n stream.write(endchar)\n \n _dispatch[tuple.__repr__]=_pprint_tuple\n \n def _pprint_set(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n typ=object.__class__\n if typ is set:\n stream.write('{')\n endchar='}'\n else:\n stream.write(typ.__name__+'({')\n endchar='})'\n indent +=len(typ.__name__)+1\n object=sorted(object,key=_safe_key)\n self._format_items(object,stream,indent,allowance+len(endchar),\n context,level)\n stream.write(endchar)\n \n _dispatch[set.__repr__]=_pprint_set\n _dispatch[frozenset.__repr__]=_pprint_set\n \n def _pprint_str(self,object,stream,indent,allowance,context,level):\n write=stream.write\n if not len(object):\n write(repr(object))\n return\n chunks=[]\n lines=object.splitlines(True)\n if level ==1:\n indent +=1\n allowance +=1\n max_width1=max_width=self._width -indent\n for i,line in enumerate(lines):\n rep=repr(line)\n if i ==len(lines)-1:\n max_width1 -=allowance\n if len(rep)<=max_width1:\n chunks.append(rep)\n else:\n \n parts=re.findall(r'\\S*\\s*',line)\n assert parts\n assert not parts[-1]\n parts.pop()\n max_width2=max_width\n current=''\n for j,part in enumerate(parts):\n candidate=current+part\n if j ==len(parts)-1 and i ==len(lines)-1:\n max_width2 -=allowance\n if len(repr(candidate))>max_width2:\n if current:\n chunks.append(repr(current))\n current=part\n else:\n current=candidate\n if current:\n chunks.append(repr(current))\n if len(chunks)==1:\n write(rep)\n return\n if level ==1:\n write('(')\n for i,rep in enumerate(chunks):\n if i >0:\n write('\\n'+' '*indent)\n write(rep)\n if level ==1:\n write(')')\n \n _dispatch[str.__repr__]=_pprint_str\n \n def _pprint_bytes(self,object,stream,indent,allowance,context,level):\n write=stream.write\n if len(object)<=4:\n write(repr(object))\n return\n parens=level ==1\n if parens:\n indent +=1\n allowance +=1\n write('(')\n delim=''\n for rep in _wrap_bytes_repr(object,self._width -indent,allowance):\n write(delim)\n write(rep)\n if not delim:\n delim='\\n'+' '*indent\n if parens:\n write(')')\n \n _dispatch[bytes.__repr__]=_pprint_bytes\n \n def _pprint_bytearray(self,object,stream,indent,allowance,context,level):\n write=stream.write\n write('bytearray(')\n self._pprint_bytes(bytes(object),stream,indent+10,\n allowance+1,context,level+1)\n write(')')\n \n _dispatch[bytearray.__repr__]=_pprint_bytearray\n \n def _pprint_mappingproxy(self,object,stream,indent,allowance,context,level):\n stream.write('mappingproxy(')\n self._format(object.copy(),stream,indent+13,allowance+1,\n context,level)\n stream.write(')')\n \n _dispatch[_types.MappingProxyType.__repr__]=_pprint_mappingproxy\n \n def _pprint_simplenamespace(self,object,stream,indent,allowance,context,level):\n if type(object)is _types.SimpleNamespace:\n \n \n cls_name='namespace'\n else:\n cls_name=object.__class__.__name__\n indent +=len(cls_name)+1\n items=object.__dict__.items()\n stream.write(cls_name+'(')\n self._format_namespace_items(items,stream,indent,allowance,context,level)\n stream.write(')')\n \n _dispatch[_types.SimpleNamespace.__repr__]=_pprint_simplenamespace\n \n def _format_dict_items(self,items,stream,indent,allowance,context,\n level):\n write=stream.write\n indent +=self._indent_per_level\n delimnl=',\\n'+' '*indent\n last_index=len(items)-1\n for i,(key,ent)in enumerate(items):\n last=i ==last_index\n rep=self._repr(key,context,level)\n write(rep)\n write(': ')\n self._format(ent,stream,indent+len(rep)+2,\n allowance if last else 1,\n context,level)\n if not last:\n write(delimnl)\n \n def _format_namespace_items(self,items,stream,indent,allowance,context,level):\n write=stream.write\n delimnl=',\\n'+' '*indent\n last_index=len(items)-1\n for i,(key,ent)in enumerate(items):\n last=i ==last_index\n write(key)\n write('=')\n if id(ent)in context:\n \n \n write(\"...\")\n else:\n self._format(ent,stream,indent+len(key)+1,\n allowance if last else 1,\n context,level)\n if not last:\n write(delimnl)\n \n def _format_items(self,items,stream,indent,allowance,context,level):\n write=stream.write\n indent +=self._indent_per_level\n if self._indent_per_level >1:\n write((self._indent_per_level -1)*' ')\n delimnl=',\\n'+' '*indent\n delim=''\n width=max_width=self._width -indent+1\n it=iter(items)\n try:\n next_ent=next(it)\n except StopIteration:\n return\n last=False\n while not last:\n ent=next_ent\n try:\n next_ent=next(it)\n except StopIteration:\n last=True\n max_width -=allowance\n width -=allowance\n if self._compact:\n rep=self._repr(ent,context,level)\n w=len(rep)+2\n if width =w:\n width -=w\n write(delim)\n delim=', '\n write(rep)\n continue\n write(delim)\n delim=delimnl\n self._format(ent,stream,indent,\n allowance if last else 1,\n context,level)\n \n def _repr(self,object,context,level):\n repr,readable,recursive=self.format(object,context.copy(),\n self._depth,level)\n if not readable:\n self._readable=False\n if recursive:\n self._recursive=True\n return repr\n \n def format(self,object,context,maxlevels,level):\n ''\n\n\n \n return self._safe_repr(object,context,maxlevels,level)\n \n def _pprint_default_dict(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n rdf=self._repr(object.default_factory,context,level)\n cls=object.__class__\n indent +=len(cls.__name__)+1\n stream.write('%s(%s,\\n%s'%(cls.__name__,rdf,' '*indent))\n self._pprint_dict(object,stream,indent,allowance+1,context,level)\n stream.write(')')\n \n _dispatch[_collections.defaultdict.__repr__]=_pprint_default_dict\n \n def _pprint_counter(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n cls=object.__class__\n stream.write(cls.__name__+'({')\n if self._indent_per_level >1:\n stream.write((self._indent_per_level -1)*' ')\n items=object.most_common()\n self._format_dict_items(items,stream,\n indent+len(cls.__name__)+1,allowance+2,\n context,level)\n stream.write('})')\n \n _dispatch[_collections.Counter.__repr__]=_pprint_counter\n \n def _pprint_chain_map(self,object,stream,indent,allowance,context,level):\n if not len(object.maps):\n stream.write(repr(object))\n return\n cls=object.__class__\n stream.write(cls.__name__+'(')\n indent +=len(cls.__name__)+1\n for i,m in enumerate(object.maps):\n if i ==len(object.maps)-1:\n self._format(m,stream,indent,allowance+1,context,level)\n stream.write(')')\n else:\n self._format(m,stream,indent,1,context,level)\n stream.write(',\\n'+' '*indent)\n \n _dispatch[_collections.ChainMap.__repr__]=_pprint_chain_map\n \n def _pprint_deque(self,object,stream,indent,allowance,context,level):\n if not len(object):\n stream.write(repr(object))\n return\n cls=object.__class__\n stream.write(cls.__name__+'(')\n indent +=len(cls.__name__)+1\n stream.write('[')\n if object.maxlen is None:\n self._format_items(object,stream,indent,allowance+2,\n context,level)\n stream.write('])')\n else:\n self._format_items(object,stream,indent,2,\n context,level)\n rml=self._repr(object.maxlen,context,level)\n stream.write('],\\n%smaxlen=%s)'%(' '*indent,rml))\n \n _dispatch[_collections.deque.__repr__]=_pprint_deque\n \n def _pprint_user_dict(self,object,stream,indent,allowance,context,level):\n self._format(object.data,stream,indent,allowance,context,level -1)\n \n _dispatch[_collections.UserDict.__repr__]=_pprint_user_dict\n \n def _pprint_user_list(self,object,stream,indent,allowance,context,level):\n self._format(object.data,stream,indent,allowance,context,level -1)\n \n _dispatch[_collections.UserList.__repr__]=_pprint_user_list\n \n def _pprint_user_string(self,object,stream,indent,allowance,context,level):\n self._format(object.data,stream,indent,allowance,context,level -1)\n \n _dispatch[_collections.UserString.__repr__]=_pprint_user_string\n \n def _safe_repr(self,object,context,maxlevels,level):\n \n typ=type(object)\n if typ in _builtin_scalars:\n return repr(object),True,False\n \n r=getattr(typ,\"__repr__\",None)\n \n if issubclass(typ,int)and r is int.__repr__:\n if self._underscore_numbers:\n return f\"{object:_d}\",True,False\n else:\n return repr(object),True,False\n \n if issubclass(typ,dict)and r is dict.__repr__:\n if not object:\n return \"{}\",True,False\n objid=id(object)\n if maxlevels and level >=maxlevels:\n return \"{...}\",False,objid in context\n if objid in context:\n return _recursion(object),False,True\n context[objid]=1\n readable=True\n recursive=False\n components=[]\n append=components.append\n level +=1\n if self._sort_dicts:\n items=sorted(object.items(),key=_safe_tuple)\n else:\n items=object.items()\n for k,v in items:\n krepr,kreadable,krecur=self.format(\n k,context,maxlevels,level)\n vrepr,vreadable,vrecur=self.format(\n v,context,maxlevels,level)\n append(\"%s: %s\"%(krepr,vrepr))\n readable=readable and kreadable and vreadable\n if krecur or vrecur:\n recursive=True\n del context[objid]\n return \"{%s}\"%\", \".join(components),readable,recursive\n \n if(issubclass(typ,list)and r is list.__repr__)or\\\n (issubclass(typ,tuple)and r is tuple.__repr__):\n if issubclass(typ,list):\n if not object:\n return \"[]\",True,False\n format=\"[%s]\"\n elif len(object)==1:\n format=\"(%s,)\"\n else:\n if not object:\n return \"()\",True,False\n format=\"(%s)\"\n objid=id(object)\n if maxlevels and level >=maxlevels:\n return format %\"...\",False,objid in context\n if objid in context:\n return _recursion(object),False,True\n context[objid]=1\n readable=True\n recursive=False\n components=[]\n append=components.append\n level +=1\n for o in object:\n orepr,oreadable,orecur=self.format(\n o,context,maxlevels,level)\n append(orepr)\n if not oreadable:\n readable=False\n if orecur:\n recursive=True\n del context[objid]\n return format %\", \".join(components),readable,recursive\n \n rep=repr(object)\n return rep,(rep and not rep.startswith('<')),False\n \n_builtin_scalars=frozenset({str,bytes,bytearray,float,complex,\nbool,type(None)})\n\ndef _recursion(object):\n return(\"\"\n %(type(object).__name__,id(object)))\n \n \ndef _wrap_bytes_repr(object,width,allowance):\n current=b''\n last=len(object)//4 *4\n for i in range(0,len(object),4):\n part=object[i:i+4]\n candidate=current+part\n if i ==last:\n width -=allowance\n if len(repr(candidate))>width:\n if current:\n yield repr(current)\n current=part\n else:\n current=candidate\n if current:\n yield repr(current)\n", ["collections", "dataclasses", "io", "re", "sys", "types"]], "profile": [".py", "#! /usr/bin/env python3\n\n\n\n\n\n\n\n\"\"\"Class for profiling Python code.\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport importlib.machinery\nimport io\nimport sys\nimport time\nimport marshal\n\n__all__=[\"run\",\"runctx\",\"Profile\"]\n\n\n\n\n\n\n\n\n\nclass _Utils:\n ''\n\n\n \n \n def __init__(self,profiler):\n self.profiler=profiler\n \n def run(self,statement,filename,sort):\n prof=self.profiler()\n try:\n prof.run(statement)\n except SystemExit:\n pass\n finally:\n self._show(prof,filename,sort)\n \n def runctx(self,statement,globals,locals,filename,sort):\n prof=self.profiler()\n try:\n prof.runctx(statement,globals,locals)\n except SystemExit:\n pass\n finally:\n self._show(prof,filename,sort)\n \n def _show(self,prof,filename,sort):\n if filename is not None:\n prof.dump_stats(filename)\n else:\n prof.print_stats(sort)\n \n \n \n \n \n \n \ndef run(statement,filename=None,sort=-1):\n ''\n\n\n\n\n\n\n\n\n \n return _Utils(Profile).run(statement,filename,sort)\n \ndef runctx(statement,globals,locals,filename=None,sort=-1):\n ''\n\n\n\n \n return _Utils(Profile).runctx(statement,globals,locals,filename,sort)\n \n \nclass Profile:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n bias=0\n \n def __init__(self,timer=None,bias=None):\n self.timings={}\n self.cur=None\n self.cmd=\"\"\n self.c_func_name=\"\"\n \n if bias is None:\n bias=self.bias\n self.bias=bias\n \n if not timer:\n self.timer=self.get_time=time.process_time\n self.dispatcher=self.trace_dispatch_i\n else:\n self.timer=timer\n t=self.timer()\n try:\n length=len(t)\n except TypeError:\n self.get_time=timer\n self.dispatcher=self.trace_dispatch_i\n else:\n if length ==2:\n self.dispatcher=self.trace_dispatch\n else:\n self.dispatcher=self.trace_dispatch_l\n \n \n \n \n \n def get_time_timer(timer=timer,sum=sum):\n return sum(timer())\n self.get_time=get_time_timer\n self.t=self.get_time()\n self.simulate_call('profiler')\n \n \n \n def trace_dispatch(self,frame,event,arg):\n timer=self.timer\n t=timer()\n t=t[0]+t[1]-self.t -self.bias\n \n if event ==\"c_call\":\n self.c_func_name=arg.__name__\n \n if self.dispatch[event](self,frame,t):\n t=timer()\n self.t=t[0]+t[1]\n else:\n r=timer()\n self.t=r[0]+r[1]-t\n \n \n \n \n def trace_dispatch_i(self,frame,event,arg):\n timer=self.timer\n t=timer()-self.t -self.bias\n \n if event ==\"c_call\":\n self.c_func_name=arg.__name__\n \n if self.dispatch[event](self,frame,t):\n self.t=timer()\n else:\n self.t=timer()-t\n \n \n \n \n def trace_dispatch_mac(self,frame,event,arg):\n timer=self.timer\n t=timer()/60.0 -self.t -self.bias\n \n if event ==\"c_call\":\n self.c_func_name=arg.__name__\n \n if self.dispatch[event](self,frame,t):\n self.t=timer()/60.0\n else:\n self.t=timer()/60.0 -t\n \n \n \n def trace_dispatch_l(self,frame,event,arg):\n get_time=self.get_time\n t=get_time()-self.t -self.bias\n \n if event ==\"c_call\":\n self.c_func_name=arg.__name__\n \n if self.dispatch[event](self,frame,t):\n self.t=get_time()\n else:\n self.t=get_time()-t\n \n \n \n \n \n \n \n \n def trace_dispatch_exception(self,frame,t):\n rpt,rit,ret,rfn,rframe,rcur=self.cur\n if(rframe is not frame)and rcur:\n return self.trace_dispatch_return(rframe,t)\n self.cur=rpt,rit+t,ret,rfn,rframe,rcur\n return 1\n \n \n def trace_dispatch_call(self,frame,t):\n if self.cur and frame.f_back is not self.cur[-2]:\n rpt,rit,ret,rfn,rframe,rcur=self.cur\n if not isinstance(rframe,Profile.fake_frame):\n assert rframe.f_back is frame.f_back,(\"Bad call\",rfn,\n rframe,rframe.f_back,\n frame,frame.f_back)\n self.trace_dispatch_return(rframe,0)\n assert(self.cur is None or\\\n frame.f_back is self.cur[-2]),(\"Bad call\",\n self.cur[-3])\n fcode=frame.f_code\n fn=(fcode.co_filename,fcode.co_firstlineno,fcode.co_name)\n self.cur=(t,0,0,fn,frame,self.cur)\n timings=self.timings\n if fn in timings:\n cc,ns,tt,ct,callers=timings[fn]\n timings[fn]=cc,ns+1,tt,ct,callers\n else:\n timings[fn]=0,0,0,0,{}\n return 1\n \n def trace_dispatch_c_call(self,frame,t):\n fn=(\"\",0,self.c_func_name)\n self.cur=(t,0,0,fn,frame,self.cur)\n timings=self.timings\n if fn in timings:\n cc,ns,tt,ct,callers=timings[fn]\n timings[fn]=cc,ns+1,tt,ct,callers\n else:\n timings[fn]=0,0,0,0,{}\n return 1\n \n def trace_dispatch_return(self,frame,t):\n if frame is not self.cur[-2]:\n assert frame is self.cur[-2].f_back,(\"Bad return\",self.cur[-3])\n self.trace_dispatch_return(self.cur[-2],0)\n \n \n \n \n rpt,rit,ret,rfn,frame,rcur=self.cur\n rit=rit+t\n frame_total=rit+ret\n \n ppt,pit,pet,pfn,pframe,pcur=rcur\n self.cur=ppt,pit+rpt,pet+frame_total,pfn,pframe,pcur\n \n timings=self.timings\n cc,ns,tt,ct,callers=timings[rfn]\n if not ns:\n \n \n \n \n ct=ct+frame_total\n cc=cc+1\n \n if pfn in callers:\n callers[pfn]=callers[pfn]+1\n \n \n \n else:\n callers[pfn]=1\n \n timings[rfn]=cc,ns -1,tt+rit,ct,callers\n \n return 1\n \n \n dispatch={\n \"call\":trace_dispatch_call,\n \"exception\":trace_dispatch_exception,\n \"return\":trace_dispatch_return,\n \"c_call\":trace_dispatch_c_call,\n \"c_exception\":trace_dispatch_return,\n \"c_return\":trace_dispatch_return,\n }\n \n \n \n \n \n \n \n \n def set_cmd(self,cmd):\n if self.cur[-1]:return\n self.cmd=cmd\n self.simulate_call(cmd)\n \n class fake_code:\n def __init__(self,filename,line,name):\n self.co_filename=filename\n self.co_line=line\n self.co_name=name\n self.co_firstlineno=0\n \n def __repr__(self):\n return repr((self.co_filename,self.co_line,self.co_name))\n \n class fake_frame:\n def __init__(self,code,prior):\n self.f_code=code\n self.f_back=prior\n \n def simulate_call(self,name):\n code=self.fake_code('profile',0,name)\n if self.cur:\n pframe=self.cur[-2]\n else:\n pframe=None\n frame=self.fake_frame(code,pframe)\n self.dispatch['call'](self,frame,0)\n \n \n \n \n def simulate_cmd_complete(self):\n get_time=self.get_time\n t=get_time()-self.t\n while self.cur[-1]:\n \n \n self.dispatch['return'](self,self.cur[-2],t)\n t=0\n self.t=get_time()-t\n \n \n def print_stats(self,sort=-1):\n import pstats\n pstats.Stats(self).strip_dirs().sort_stats(sort).\\\n print_stats()\n \n def dump_stats(self,file):\n with open(file,'wb')as f:\n self.create_stats()\n marshal.dump(self.stats,f)\n \n def create_stats(self):\n self.simulate_cmd_complete()\n self.snapshot_stats()\n \n def snapshot_stats(self):\n self.stats={}\n for func,(cc,ns,tt,ct,callers)in self.timings.items():\n callers=callers.copy()\n nc=0\n for callcnt in callers.values():\n nc +=callcnt\n self.stats[func]=cc,nc,tt,ct,callers\n \n \n \n \n \n def run(self,cmd):\n import __main__\n dict=__main__.__dict__\n return self.runctx(cmd,dict,dict)\n \n def runctx(self,cmd,globals,locals):\n self.set_cmd(cmd)\n sys.setprofile(self.dispatcher)\n try:\n exec(cmd,globals,locals)\n finally:\n sys.setprofile(None)\n return self\n \n \n def runcall(self,func,/,*args,**kw):\n self.set_cmd(repr(func))\n sys.setprofile(self.dispatcher)\n try:\n return func(*args,**kw)\n finally:\n sys.setprofile(None)\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def calibrate(self,m,verbose=0):\n if self.__class__ is not Profile:\n raise TypeError(\"Subclasses must override .calibrate().\")\n \n saved_bias=self.bias\n self.bias=0\n try:\n return self._calibrate_inner(m,verbose)\n finally:\n self.bias=saved_bias\n \n def _calibrate_inner(self,m,verbose):\n get_time=self.get_time\n \n \n \n \n \n \n \n def f1(n):\n for i in range(n):\n x=1\n \n def f(m,f1=f1):\n for i in range(m):\n f1(100)\n \n f(m)\n \n \n t0=get_time()\n f(m)\n t1=get_time()\n elapsed_noprofile=t1 -t0\n if verbose:\n print(\"elapsed time without profiling =\",elapsed_noprofile)\n \n \n \n \n p=Profile()\n t0=get_time()\n p.runctx('f(m)',globals(),locals())\n t1=get_time()\n elapsed_profile=t1 -t0\n if verbose:\n print(\"elapsed time with profiling =\",elapsed_profile)\n \n \n total_calls=0.0\n reported_time=0.0\n for(filename,line,funcname),(cc,ns,tt,ct,callers)in\\\n p.timings.items():\n if funcname in(\"f\",\"f1\"):\n total_calls +=cc\n reported_time +=tt\n \n if verbose:\n print(\"'CPU seconds' profiler reported =\",reported_time)\n print(\"total # calls =\",total_calls)\n if total_calls !=m+1:\n raise ValueError(\"internal error: total calls = %d\"%total_calls)\n \n \n \n \n \n mean=(reported_time -elapsed_noprofile)/2.0 /total_calls\n if verbose:\n print(\"mean stopwatch overhead per profile event =\",mean)\n return mean\n \n \n \ndef main():\n import os\n from optparse import OptionParser\n \n usage=\"profile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...\"\n parser=OptionParser(usage=usage)\n parser.allow_interspersed_args=False\n parser.add_option('-o','--outfile',dest=\"outfile\",\n help=\"Save stats to \",default=None)\n parser.add_option('-m',dest=\"module\",action=\"store_true\",\n help=\"Profile a library module.\",default=False)\n parser.add_option('-s','--sort',dest=\"sort\",\n help=\"Sort order when printing to stdout, based on pstats.Stats class\",\n default=-1)\n \n if not sys.argv[1:]:\n parser.print_usage()\n sys.exit(2)\n \n (options,args)=parser.parse_args()\n sys.argv[:]=args\n \n \n \n if options.outfile is not None:\n options.outfile=os.path.abspath(options.outfile)\n \n if len(args)>0:\n if options.module:\n import runpy\n code=\"run_module(modname, run_name='__main__')\"\n globs={\n 'run_module':runpy.run_module,\n 'modname':args[0]\n }\n else:\n progname=args[0]\n sys.path.insert(0,os.path.dirname(progname))\n with io.open_code(progname)as fp:\n code=compile(fp.read(),progname,'exec')\n spec=importlib.machinery.ModuleSpec(name='__main__',loader=None,\n origin=progname)\n globs={\n '__spec__':spec,\n '__file__':spec.origin,\n '__name__':spec.name,\n '__package__':None,\n '__cached__':None,\n }\n try:\n runctx(code,globs,None,options.outfile,options.sort)\n except BrokenPipeError as exc:\n \n sys.stdout=None\n sys.exit(exc.errno)\n else:\n parser.print_usage()\n return parser\n \n \nif __name__ =='__main__':\n main()\n", ["__main__", "importlib.machinery", "io", "marshal", "optparse", "os", "pstats", "runpy", "sys", "time"]], "pwd": [".py", "\ndef getpwuid():\n pass\n", []], "pyclbr": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport ast\nimport sys\nimport importlib.util\n\n__all__=[\"readmodule\",\"readmodule_ex\",\"Class\",\"Function\"]\n\n_modules={}\n\n\nclass _Object:\n ''\n def __init__(self,module,name,file,lineno,end_lineno,parent):\n self.module=module\n self.name=name\n self.file=file\n self.lineno=lineno\n self.end_lineno=end_lineno\n self.parent=parent\n self.children={}\n if parent is not None:\n parent.children[name]=self\n \n \n \nclass Function(_Object):\n ''\n def __init__(self,module,name,file,lineno,\n parent=None,is_async=False,*,end_lineno=None):\n super().__init__(module,name,file,lineno,end_lineno,parent)\n self.is_async=is_async\n if isinstance(parent,Class):\n parent.methods[name]=lineno\n \n \nclass Class(_Object):\n ''\n def __init__(self,module,name,super_,file,lineno,\n parent=None,*,end_lineno=None):\n super().__init__(module,name,file,lineno,end_lineno,parent)\n self.super=super_ or[]\n self.methods={}\n \n \n \n \ndef _nest_function(ob,func_name,lineno,end_lineno,is_async=False):\n ''\n return Function(ob.module,func_name,ob.file,lineno,\n parent=ob,is_async=is_async,end_lineno=end_lineno)\n \ndef _nest_class(ob,class_name,lineno,end_lineno,super=None):\n ''\n return Class(ob.module,class_name,super,ob.file,lineno,\n parent=ob,end_lineno=end_lineno)\n \n \ndef readmodule(module,path=None):\n ''\n\n\n \n \n res={}\n for key,value in _readmodule(module,path or[]).items():\n if isinstance(value,Class):\n res[key]=value\n return res\n \ndef readmodule_ex(module,path=None):\n ''\n\n\n\n\n \n return _readmodule(module,path or[])\n \n \ndef _readmodule(module,path,inpackage=None):\n ''\n\n\n\n\n\n \n \n if inpackage is not None:\n fullmodule=\"%s.%s\"%(inpackage,module)\n else:\n fullmodule=module\n \n \n if fullmodule in _modules:\n return _modules[fullmodule]\n \n \n tree={}\n \n \n if module in sys.builtin_module_names and inpackage is None:\n _modules[module]=tree\n return tree\n \n \n i=module.rfind('.')\n if i >=0:\n package=module[:i]\n submodule=module[i+1:]\n parent=_readmodule(package,path,inpackage)\n if inpackage is not None:\n package=\"%s.%s\"%(inpackage,package)\n if not '__path__'in parent:\n raise ImportError('No package named {}'.format(package))\n return _readmodule(submodule,parent['__path__'],package)\n \n \n f=None\n if inpackage is not None:\n search_path=path\n else:\n search_path=path+sys.path\n spec=importlib.util._find_spec_from_path(fullmodule,search_path)\n if spec is None:\n raise ModuleNotFoundError(f\"no module named {fullmodule !r}\",name=fullmodule)\n _modules[fullmodule]=tree\n \n if spec.submodule_search_locations is not None:\n tree['__path__']=spec.submodule_search_locations\n try:\n source=spec.loader.get_source(fullmodule)\n except(AttributeError,ImportError):\n \n return tree\n else:\n if source is None:\n return tree\n \n fname=spec.loader.get_filename(fullmodule)\n return _create_tree(fullmodule,path,fname,source,tree,inpackage)\n \n \nclass _ModuleBrowser(ast.NodeVisitor):\n def __init__(self,module,path,file,tree,inpackage):\n self.path=path\n self.tree=tree\n self.file=file\n self.module=module\n self.inpackage=inpackage\n self.stack=[]\n \n def visit_ClassDef(self,node):\n bases=[]\n for base in node.bases:\n name=ast.unparse(base)\n if name in self.tree:\n \n bases.append(self.tree[name])\n elif len(names :=name.split(\".\"))>1:\n \n \n *_,module,class_=names\n if module in _modules:\n bases.append(_modules[module].get(class_,name))\n else:\n bases.append(name)\n \n parent=self.stack[-1]if self.stack else None\n class_=Class(self.module,node.name,bases,self.file,node.lineno,\n parent=parent,end_lineno=node.end_lineno)\n if parent is None:\n self.tree[node.name]=class_\n self.stack.append(class_)\n self.generic_visit(node)\n self.stack.pop()\n \n def visit_FunctionDef(self,node,*,is_async=False):\n parent=self.stack[-1]if self.stack else None\n function=Function(self.module,node.name,self.file,node.lineno,\n parent,is_async,end_lineno=node.end_lineno)\n if parent is None:\n self.tree[node.name]=function\n self.stack.append(function)\n self.generic_visit(node)\n self.stack.pop()\n \n def visit_AsyncFunctionDef(self,node):\n self.visit_FunctionDef(node,is_async=True)\n \n def visit_Import(self,node):\n if node.col_offset !=0:\n return\n \n for module in node.names:\n try:\n try:\n _readmodule(module.name,self.path,self.inpackage)\n except ImportError:\n _readmodule(module.name,[])\n except(ImportError,SyntaxError):\n \n \n continue\n \n def visit_ImportFrom(self,node):\n if node.col_offset !=0:\n return\n try:\n module=\".\"*node.level\n if node.module:\n module +=node.module\n module=_readmodule(module,self.path,self.inpackage)\n except(ImportError,SyntaxError):\n return\n \n for name in node.names:\n if name.name in module:\n self.tree[name.asname or name.name]=module[name.name]\n elif name.name ==\"*\":\n for import_name,import_value in module.items():\n if import_name.startswith(\"_\"):\n continue\n self.tree[import_name]=import_value\n \n \ndef _create_tree(fullmodule,path,fname,source,tree,inpackage):\n mbrowser=_ModuleBrowser(fullmodule,path,fname,tree,inpackage)\n mbrowser.visit(ast.parse(source))\n return mbrowser.tree\n \n \ndef _main():\n ''\n import os\n try:\n mod=sys.argv[1]\n except:\n mod=__file__\n if os.path.exists(mod):\n path=[os.path.dirname(mod)]\n mod=os.path.basename(mod)\n if mod.lower().endswith(\".py\"):\n mod=mod[:-3]\n else:\n path=[]\n tree=readmodule_ex(mod,path)\n lineno_key=lambda a:getattr(a,'lineno',0)\n objs=sorted(tree.values(),key=lineno_key,reverse=True)\n indent_level=2\n while objs:\n obj=objs.pop()\n if isinstance(obj,list):\n \n continue\n if not hasattr(obj,'indent'):\n obj.indent=0\n \n if isinstance(obj,_Object):\n new_objs=sorted(obj.children.values(),\n key=lineno_key,reverse=True)\n for ob in new_objs:\n ob.indent=obj.indent+indent_level\n objs.extend(new_objs)\n if isinstance(obj,Class):\n print(\"{}class {} {} {}\"\n .format(' '*obj.indent,obj.name,obj.super,obj.lineno))\n elif isinstance(obj,Function):\n print(\"{}def {} {}\".format(' '*obj.indent,obj.name,obj.lineno))\n \nif __name__ ==\"__main__\":\n _main()\n", ["ast", "importlib.util", "os", "sys"]], "pydoc": [".py", "#!/usr/bin/env python3\n''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['help']\n__author__=\"Ka-Ping Yee \"\n__date__=\"26 February 2001\"\n\n__credits__=\"\"\"Guido van Rossum, for an excellent programming language.\nTommy Burnette, the original creator of manpy.\nPaul Prescod, for all his work on onlinehelp.\nRichard Chamberlain, for the first implementation of textdoc.\n\"\"\"\n\n\n\n\n\n\n\n\nimport __future__\nimport builtins\nimport importlib._bootstrap\nimport importlib._bootstrap_external\nimport importlib.machinery\nimport importlib.util\nimport inspect\nimport io\nimport os\nimport pkgutil\nimport platform\nimport re\nimport sys\nimport sysconfig\nimport time\nimport tokenize\nimport urllib.parse\nimport warnings\nfrom collections import deque\nfrom reprlib import Repr\nfrom traceback import format_exception_only\n\n\n\n\ndef pathdirs():\n ''\n dirs=[]\n normdirs=[]\n for dir in sys.path:\n dir=os.path.abspath(dir or '.')\n normdir=os.path.normcase(dir)\n if normdir not in normdirs and os.path.isdir(dir):\n dirs.append(dir)\n normdirs.append(normdir)\n return dirs\n \ndef _findclass(func):\n cls=sys.modules.get(func.__module__)\n if cls is None:\n return None\n for name in func.__qualname__.split('.')[:-1]:\n cls=getattr(cls,name)\n if not inspect.isclass(cls):\n return None\n return cls\n \ndef _finddoc(obj):\n if inspect.ismethod(obj):\n name=obj.__func__.__name__\n self=obj.__self__\n if(inspect.isclass(self)and\n getattr(getattr(self,name,None),'__func__')is obj.__func__):\n \n cls=self\n else:\n cls=self.__class__\n elif inspect.isfunction(obj):\n name=obj.__name__\n cls=_findclass(obj)\n if cls is None or getattr(cls,name)is not obj:\n return None\n elif inspect.isbuiltin(obj):\n name=obj.__name__\n self=obj.__self__\n if(inspect.isclass(self)and\n self.__qualname__+'.'+name ==obj.__qualname__):\n \n cls=self\n else:\n cls=self.__class__\n \n elif isinstance(obj,property):\n func=obj.fget\n name=func.__name__\n cls=_findclass(func)\n if cls is None or getattr(cls,name)is not obj:\n return None\n elif inspect.ismethoddescriptor(obj)or inspect.isdatadescriptor(obj):\n name=obj.__name__\n cls=obj.__objclass__\n if getattr(cls,name)is not obj:\n return None\n if inspect.ismemberdescriptor(obj):\n slots=getattr(cls,'__slots__',None)\n if isinstance(slots,dict)and name in slots:\n return slots[name]\n else:\n return None\n for base in cls.__mro__:\n try:\n doc=_getowndoc(getattr(base,name))\n except AttributeError:\n continue\n if doc is not None:\n return doc\n return None\n \ndef _getowndoc(obj):\n ''\n \n try:\n doc=object.__getattribute__(obj,'__doc__')\n if doc is None:\n return None\n if obj is not type:\n typedoc=type(obj).__doc__\n if isinstance(typedoc,str)and typedoc ==doc:\n return None\n return doc\n except AttributeError:\n return None\n \ndef _getdoc(object):\n ''\n\n\n\n \n doc=_getowndoc(object)\n if doc is None:\n try:\n doc=_finddoc(object)\n except(AttributeError,TypeError):\n return None\n if not isinstance(doc,str):\n return None\n return inspect.cleandoc(doc)\n \ndef getdoc(object):\n ''\n result=_getdoc(object)or inspect.getcomments(object)\n return result and re.sub('^ *\\n','',result.rstrip())or ''\n \ndef splitdoc(doc):\n ''\n lines=doc.strip().split('\\n')\n if len(lines)==1:\n return lines[0],''\n elif len(lines)>=2 and not lines[1].rstrip():\n return lines[0],'\\n'.join(lines[2:])\n return '','\\n'.join(lines)\n \ndef classname(object,modname):\n ''\n name=object.__name__\n if object.__module__ !=modname:\n name=object.__module__+'.'+name\n return name\n \ndef isdata(object):\n ''\n return not(inspect.ismodule(object)or inspect.isclass(object)or\n inspect.isroutine(object)or inspect.isframe(object)or\n inspect.istraceback(object)or inspect.iscode(object))\n \ndef replace(text,*pairs):\n ''\n while pairs:\n text=pairs[1].join(text.split(pairs[0]))\n pairs=pairs[2:]\n return text\n \ndef cram(text,maxlen):\n ''\n if len(text)>maxlen:\n pre=max(0,(maxlen -3)//2)\n post=max(0,maxlen -3 -pre)\n return text[:pre]+'...'+text[len(text)-post:]\n return text\n \n_re_stripid=re.compile(r' at 0x[0-9a-f]{6,16}(>+)$',re.IGNORECASE)\ndef stripid(text):\n ''\n \n return _re_stripid.sub(r'\\1',text)\n \ndef _is_bound_method(fn):\n ''\n\n\n \n if inspect.ismethod(fn):\n return True\n if inspect.isbuiltin(fn):\n self=getattr(fn,'__self__',None)\n return not(inspect.ismodule(self)or(self is None))\n return False\n \n \ndef allmethods(cl):\n methods={}\n for key,value in inspect.getmembers(cl,inspect.isroutine):\n methods[key]=1\n for base in cl.__bases__:\n methods.update(allmethods(base))\n for key in methods.keys():\n methods[key]=getattr(cl,key)\n return methods\n \ndef _split_list(s,predicate):\n ''\n\n\n\n\n \n \n yes=[]\n no=[]\n for x in s:\n if predicate(x):\n yes.append(x)\n else:\n no.append(x)\n return yes,no\n \n_future_feature_names=set(__future__.all_feature_names)\n\ndef visiblename(name,all=None,obj=None):\n ''\n \n \n if name in{'__author__','__builtins__','__cached__','__credits__',\n '__date__','__doc__','__file__','__spec__',\n '__loader__','__module__','__name__','__package__',\n '__path__','__qualname__','__slots__','__version__'}:\n return 0\n \n if name.startswith('__')and name.endswith('__'):return 1\n \n if name.startswith('_')and hasattr(obj,'_fields'):\n return True\n \n if obj is not __future__ and name in _future_feature_names:\n if isinstance(getattr(obj,name,None),__future__._Feature):\n return False\n if all is not None:\n \n return name in all\n else:\n return not name.startswith('_')\n \ndef classify_class_attrs(object):\n ''\n results=[]\n for(name,kind,cls,value)in inspect.classify_class_attrs(object):\n if inspect.isdatadescriptor(value):\n kind='data descriptor'\n if isinstance(value,property)and value.fset is None:\n kind='readonly property'\n results.append((name,kind,cls,value))\n return results\n \ndef sort_attributes(attrs,object):\n ''\n \n \n fields=getattr(object,'_fields',[])\n try:\n field_order={name:i -len(fields)for(i,name)in enumerate(fields)}\n except TypeError:\n field_order={}\n keyfunc=lambda attr:(field_order.get(attr[0],0),attr[0])\n attrs.sort(key=keyfunc)\n \n \n \ndef ispackage(path):\n ''\n if os.path.isdir(path):\n for ext in('.py','.pyc'):\n if os.path.isfile(os.path.join(path,'__init__'+ext)):\n return True\n return False\n \ndef source_synopsis(file):\n line=file.readline()\n while line[:1]=='#'or not line.strip():\n line=file.readline()\n if not line:break\n line=line.strip()\n if line[:4]=='r\"\"\"':line=line[1:]\n if line[:3]=='\"\"\"':\n line=line[3:]\n if line[-1:]=='\\\\':line=line[:-1]\n while not line.strip():\n line=file.readline()\n if not line:break\n result=line.split('\"\"\"')[0].strip()\n else:result=None\n return result\n \ndef synopsis(filename,cache={}):\n ''\n mtime=os.stat(filename).st_mtime\n lastupdate,result=cache.get(filename,(None,None))\n if lastupdate is None or lastupdate ','>')\n \n def repr(self,object):\n return Repr.repr(self,object)\n \n def repr1(self,x,level):\n if hasattr(type(x),'__name__'):\n methodname='repr_'+'_'.join(type(x).__name__.split())\n if hasattr(self,methodname):\n return getattr(self,methodname)(x,level)\n return self.escape(cram(stripid(repr(x)),self.maxother))\n \n def repr_string(self,x,level):\n test=cram(x,self.maxstring)\n testrepr=repr(test)\n if '\\\\'in test and '\\\\'not in replace(testrepr,r'\\\\',''):\n \n \n return 'r'+testrepr[0]+self.escape(test)+testrepr[0]\n return re.sub(r'((\\\\[\\\\abfnrtv\\'\"]|\\\\[0-9]..|\\\\x..|\\\\u....)+)',\n r'\\1',\n self.escape(testrepr))\n \n repr_str=repr_string\n \n def repr_instance(self,x,level):\n try:\n return self.escape(cram(stripid(repr(x)),self.maxstring))\n except:\n return self.escape('<%s instance>'%x.__class__.__name__)\n \n repr_unicode=repr_string\n \nclass HTMLDoc(Doc):\n ''\n \n \n \n _repr_instance=HTMLRepr()\n repr=_repr_instance.repr\n escape=_repr_instance.escape\n \n def page(self,title,contents):\n ''\n return '''\\\n\n\n\n\nPython: %s\n\n%s\n'''%(title,contents)\n \n def heading(self,title,extras=''):\n ''\n return '''\n\n\n\n
 
%s
%s
\n '''%(title,extras or ' ')\n \n def section(self,title,cls,contents,width=6,\n prelude='',marginalia=None,gap=' '):\n ''\n if marginalia is None:\n marginalia=''+' '*width+''\n result='''

\n\n\n\n '''%(cls,title)\n if prelude:\n result=result+'''\n\n\n'''%(cls,marginalia,cls,prelude,gap)\n else:\n result=result+'''\n'''%(cls,marginalia,gap)\n \n return result+'\\n
 
%s
%s%s
%s
%s%s%s
'%contents\n \n def bigsection(self,title,*args):\n ''\n title='%s'%title\n return self.section(title,*args)\n \n def preformat(self,text):\n ''\n text=self.escape(text.expandtabs())\n return replace(text,'\\n\\n','\\n \\n','\\n\\n','\\n \\n',\n ' ',' ','\\n','
\\n')\n \n def multicolumn(self,list,format):\n ''\n result=''\n rows=(len(list)+3)//4\n for col in range(4):\n result=result+''\n for i in range(rows *col,rows *col+rows):\n if i \\n'\n result=result+''\n return '%s
'%result\n \n def grey(self,text):return '%s'%text\n \n def namelink(self,name,*dicts):\n ''\n for dict in dicts:\n if name in dict:\n return '
%s'%(dict[name],name)\n return name\n \n def classlink(self,object,modname):\n ''\n name,module=object.__name__,sys.modules.get(object.__module__)\n if hasattr(module,name)and getattr(module,name)is object:\n return '%s'%(\n module.__name__,name,classname(object,modname))\n return classname(object,modname)\n \n def modulelink(self,object):\n ''\n return '%s'%(object.__name__,object.__name__)\n \n def modpkglink(self,modpkginfo):\n ''\n name,path,ispackage,shadowed=modpkginfo\n if shadowed:\n return self.grey(name)\n if path:\n url='%s.%s.html'%(path,name)\n else:\n url='%s.html'%name\n if ispackage:\n text='%s (package)'%name\n else:\n text=name\n return '%s'%(url,text)\n \n def filelink(self,url,path):\n ''\n return '%s'%(url,path)\n \n def markup(self,text,escape=None,funcs={},classes={},methods={}):\n ''\n \n escape=escape or self.escape\n results=[]\n here=0\n pattern=re.compile(r'\\b((http|https|ftp)://\\S+[\\w/]|'\n r'RFC[- ]?(\\d+)|'\n r'PEP[- ]?(\\d+)|'\n r'(self\\.)?(\\w+))')\n while match :=pattern.search(text,here):\n start,end=match.span()\n results.append(escape(text[here:start]))\n \n all,scheme,rfc,pep,selfdot,name=match.groups()\n if scheme:\n url=escape(all).replace('\"','"')\n results.append('%s'%(url,url))\n elif rfc:\n url='https://www.rfc-editor.org/rfc/rfc%d.txt'%int(rfc)\n results.append('%s'%(url,escape(all)))\n elif pep:\n url='https://peps.python.org/pep-%04d/'%int(pep)\n results.append('%s'%(url,escape(all)))\n elif selfdot:\n \n \n if text[end:end+1]=='(':\n results.append('self.'+self.namelink(name,methods))\n else:\n results.append('self.%s'%name)\n elif text[end:end+1]=='(':\n results.append(self.namelink(name,methods,funcs,classes))\n else:\n results.append(self.namelink(name,classes))\n here=end\n results.append(escape(text[here:]))\n return ''.join(results)\n \n \n \n def formattree(self,tree,modname,parent=None):\n ''\n result=''\n for entry in tree:\n if isinstance(entry,tuple):\n c,bases=entry\n result=result+'

'\n result=result+self.classlink(c,modname)\n if bases and bases !=(parent,):\n parents=[]\n for base in bases:\n parents.append(self.classlink(base,modname))\n result=result+'('+', '.join(parents)+')'\n result=result+'\\n
'\n elif isinstance(entry,list):\n result=result+'
\\n%s
\\n'%self.formattree(\n entry,modname,c)\n return '
\\n%s
\\n'%result\n \n def docmodule(self,object,name=None,mod=None,*ignored):\n ''\n name=object.__name__\n try:\n all=object.__all__\n except AttributeError:\n all=None\n parts=name.split('.')\n links=[]\n for i in range(len(parts)-1):\n links.append(\n '%s'%\n ('.'.join(parts[:i+1]),parts[i]))\n linkedname='.'.join(links+parts[-1:])\n head='%s'%linkedname\n try:\n path=inspect.getabsfile(object)\n url=urllib.parse.quote(path)\n filelink=self.filelink(url,path)\n except TypeError:\n filelink='(built-in)'\n info=[]\n if hasattr(object,'__version__'):\n version=str(object.__version__)\n if version[:11]=='$'+'Revision: 'and version[-1:]=='$':\n version=version[11:-1].strip()\n info.append('version %s'%self.escape(version))\n if hasattr(object,'__date__'):\n info.append(self.escape(str(object.__date__)))\n if info:\n head=head+' (%s)'%', '.join(info)\n docloc=self.getdocloc(object)\n if docloc is not None:\n docloc='
Module Reference'%locals()\n else:\n docloc=''\n result=self.heading(head,'index
'+filelink+docloc)\n \n modules=inspect.getmembers(object,inspect.ismodule)\n \n classes,cdict=[],{}\n for key,value in inspect.getmembers(object,inspect.isclass):\n \n if(all is not None or\n (inspect.getmodule(value)or object)is object):\n if visiblename(key,all,object):\n classes.append((key,value))\n cdict[key]=cdict[value]='#'+key\n for key,value in classes:\n for base in value.__bases__:\n key,modname=base.__name__,base.__module__\n module=sys.modules.get(modname)\n if modname !=name and module and hasattr(module,key):\n if getattr(module,key)is base:\n if not key in cdict:\n cdict[key]=cdict[base]=modname+'.html#'+key\n funcs,fdict=[],{}\n for key,value in inspect.getmembers(object,inspect.isroutine):\n \n if(all is not None or\n inspect.isbuiltin(value)or inspect.getmodule(value)is object):\n if visiblename(key,all,object):\n funcs.append((key,value))\n fdict[key]='#-'+key\n if inspect.isfunction(value):fdict[value]=fdict[key]\n data=[]\n for key,value in inspect.getmembers(object,isdata):\n if visiblename(key,all,object):\n data.append((key,value))\n \n doc=self.markup(getdoc(object),self.preformat,fdict,cdict)\n doc=doc and '%s'%doc\n result=result+'

%s

\\n'%doc\n \n if hasattr(object,'__path__'):\n modpkgs=[]\n for importer,modname,ispkg in pkgutil.iter_modules(object.__path__):\n modpkgs.append((modname,name,ispkg,0))\n modpkgs.sort()\n contents=self.multicolumn(modpkgs,self.modpkglink)\n result=result+self.bigsection(\n 'Package Contents','pkg-content',contents)\n elif modules:\n contents=self.multicolumn(\n modules,lambda t:self.modulelink(t[1]))\n result=result+self.bigsection(\n 'Modules','pkg-content',contents)\n \n if classes:\n classlist=[value for(key,value)in classes]\n contents=[\n self.formattree(inspect.getclasstree(classlist,1),name)]\n for key,value in classes:\n contents.append(self.document(value,key,name,fdict,cdict))\n result=result+self.bigsection(\n 'Classes','index',' '.join(contents))\n if funcs:\n contents=[]\n for key,value in funcs:\n contents.append(self.document(value,key,name,fdict,cdict))\n result=result+self.bigsection(\n 'Functions','functions',' '.join(contents))\n if data:\n contents=[]\n for key,value in data:\n contents.append(self.document(value,key))\n result=result+self.bigsection(\n 'Data','data','
\\n'.join(contents))\n if hasattr(object,'__author__'):\n contents=self.markup(str(object.__author__),self.preformat)\n result=result+self.bigsection('Author','author',contents)\n if hasattr(object,'__credits__'):\n contents=self.markup(str(object.__credits__),self.preformat)\n result=result+self.bigsection('Credits','credits',contents)\n \n return result\n \n def docclass(self,object,name=None,mod=None,funcs={},classes={},\n *ignored):\n ''\n realname=object.__name__\n name=name or realname\n bases=object.__bases__\n \n contents=[]\n push=contents.append\n \n \n class HorizontalRule:\n def __init__(self):\n self.needone=0\n def maybe(self):\n if self.needone:\n push('
\\n')\n self.needone=1\n hr=HorizontalRule()\n \n \n mro=deque(inspect.getmro(object))\n if len(mro)>2:\n hr.maybe()\n push('
Method resolution order:
\\n')\n for base in mro:\n push('
%s
\\n'%self.classlink(base,\n object.__module__))\n push('
\\n')\n \n def spill(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n try:\n value=getattr(object,name)\n except Exception:\n \n \n push(self.docdata(value,name,mod))\n else:\n push(self.document(value,name,mod,\n funcs,classes,mdict,object))\n push('\\n')\n return attrs\n \n def spilldescriptors(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n push(self.docdata(value,name,mod))\n return attrs\n \n def spilldata(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n base=self.docother(getattr(object,name),name,mod)\n doc=getdoc(value)\n if not doc:\n push('
%s
\\n'%base)\n else:\n doc=self.markup(getdoc(value),self.preformat,\n funcs,classes,mdict)\n doc='
%s'%doc\n push('
%s%s
\\n'%(base,doc))\n push('\\n')\n return attrs\n \n attrs=[(name,kind,cls,value)\n for name,kind,cls,value in classify_class_attrs(object)\n if visiblename(name,obj=object)]\n \n mdict={}\n for key,kind,homecls,value in attrs:\n mdict[key]=anchor='#'+name+'-'+key\n try:\n value=getattr(object,name)\n except Exception:\n \n \n pass\n try:\n \n \n mdict[value]=anchor\n except TypeError:\n pass\n \n while attrs:\n if mro:\n thisclass=mro.popleft()\n else:\n thisclass=attrs[0][2]\n attrs,inherited=_split_list(attrs,lambda t:t[2]is thisclass)\n \n if object is not builtins.object and thisclass is builtins.object:\n attrs=inherited\n continue\n elif thisclass is object:\n tag='defined here'\n else:\n tag='inherited from %s'%self.classlink(thisclass,\n object.__module__)\n tag +=':
\\n'\n \n sort_attributes(attrs,object)\n \n \n attrs=spill('Methods %s'%tag,attrs,\n lambda t:t[1]=='method')\n attrs=spill('Class methods %s'%tag,attrs,\n lambda t:t[1]=='class method')\n attrs=spill('Static methods %s'%tag,attrs,\n lambda t:t[1]=='static method')\n attrs=spilldescriptors(\"Readonly properties %s\"%tag,attrs,\n lambda t:t[1]=='readonly property')\n attrs=spilldescriptors('Data descriptors %s'%tag,attrs,\n lambda t:t[1]=='data descriptor')\n attrs=spilldata('Data and other attributes %s'%tag,attrs,\n lambda t:t[1]=='data')\n assert attrs ==[]\n attrs=inherited\n \n contents=''.join(contents)\n \n if name ==realname:\n title='class %s'%(\n name,realname)\n else:\n title='%s = class %s'%(\n name,name,realname)\n if bases:\n parents=[]\n for base in bases:\n parents.append(self.classlink(base,object.__module__))\n title=title+'(%s)'%', '.join(parents)\n \n decl=''\n try:\n signature=inspect.signature(object)\n except(ValueError,TypeError):\n signature=None\n if signature:\n argspec=str(signature)\n if argspec and argspec !='()':\n decl=name+self.escape(argspec)+'\\n\\n'\n \n doc=getdoc(object)\n if decl:\n doc=decl+(doc or '')\n doc=self.markup(doc,self.preformat,funcs,classes,mdict)\n doc=doc and '%s
 
'%doc\n \n return self.section(title,'title',contents,3,doc)\n \n def formatvalue(self,object):\n ''\n return self.grey('='+self.repr(object))\n \n def docroutine(self,object,name=None,mod=None,\n funcs={},classes={},methods={},cl=None):\n ''\n realname=object.__name__\n name=name or realname\n anchor=(cl and cl.__name__ or '')+'-'+name\n note=''\n skipdocs=0\n if _is_bound_method(object):\n imclass=object.__self__.__class__\n if cl:\n if imclass is not cl:\n note=' from '+self.classlink(imclass,mod)\n else:\n if object.__self__ is not None:\n note=' method of %s instance'%self.classlink(\n object.__self__.__class__,mod)\n else:\n note=' unbound %s method'%self.classlink(imclass,mod)\n \n if(inspect.iscoroutinefunction(object)or\n inspect.isasyncgenfunction(object)):\n asyncqualifier='async '\n else:\n asyncqualifier=''\n \n if name ==realname:\n title='%s'%(anchor,realname)\n else:\n if cl and inspect.getattr_static(cl,realname,[])is object:\n reallink='%s'%(\n cl.__name__+'-'+realname,realname)\n skipdocs=1\n else:\n reallink=realname\n title='%s = %s'%(\n anchor,name,reallink)\n argspec=None\n if inspect.isroutine(object):\n try:\n signature=inspect.signature(object)\n except(ValueError,TypeError):\n signature=None\n if signature:\n argspec=str(signature)\n if realname =='':\n title='%s lambda '%name\n \n \n \n argspec=argspec[1:-1]\n if not argspec:\n argspec='(...)'\n \n decl=asyncqualifier+title+self.escape(argspec)+(note and\n self.grey('%s'%note))\n \n if skipdocs:\n return '
%s
\\n'%decl\n else:\n doc=self.markup(\n getdoc(object),self.preformat,funcs,classes,methods)\n doc=doc and '
%s
'%doc\n return '
%s
%s
\\n'%(decl,doc)\n \n def docdata(self,object,name=None,mod=None,cl=None):\n ''\n results=[]\n push=results.append\n \n if name:\n push('
%s
\\n'%name)\n doc=self.markup(getdoc(object),self.preformat)\n if doc:\n push('
%s
\\n'%doc)\n push('
\\n')\n \n return ''.join(results)\n \n docproperty=docdata\n \n def docother(self,object,name=None,mod=None,*ignored):\n ''\n lhs=name and '%s = '%name or ''\n return lhs+self.repr(object)\n \n def index(self,dir,shadowed=None):\n ''\n modpkgs=[]\n if shadowed is None:shadowed={}\n for importer,name,ispkg in pkgutil.iter_modules([dir]):\n if any((0xD800 <=ord(ch)<=0xDFFF)for ch in name):\n \n continue\n modpkgs.append((name,'',ispkg,name in shadowed))\n shadowed[name]=1\n \n modpkgs.sort()\n contents=self.multicolumn(modpkgs,self.modpkglink)\n return self.bigsection(dir,'index',contents)\n \n \n \nclass TextRepr(Repr):\n ''\n def __init__(self):\n Repr.__init__(self)\n self.maxlist=self.maxtuple=20\n self.maxdict=10\n self.maxstring=self.maxother=100\n \n def repr1(self,x,level):\n if hasattr(type(x),'__name__'):\n methodname='repr_'+'_'.join(type(x).__name__.split())\n if hasattr(self,methodname):\n return getattr(self,methodname)(x,level)\n return cram(stripid(repr(x)),self.maxother)\n \n def repr_string(self,x,level):\n test=cram(x,self.maxstring)\n testrepr=repr(test)\n if '\\\\'in test and '\\\\'not in replace(testrepr,r'\\\\',''):\n \n \n return 'r'+testrepr[0]+test+testrepr[0]\n return testrepr\n \n repr_str=repr_string\n \n def repr_instance(self,x,level):\n try:\n return cram(stripid(repr(x)),self.maxstring)\n except:\n return '<%s instance>'%x.__class__.__name__\n \nclass TextDoc(Doc):\n ''\n \n \n \n _repr_instance=TextRepr()\n repr=_repr_instance.repr\n \n def bold(self,text):\n ''\n return ''.join(ch+'\\b'+ch for ch in text)\n \n def indent(self,text,prefix=' '):\n ''\n if not text:return ''\n lines=[(prefix+line).rstrip()for line in text.split('\\n')]\n return '\\n'.join(lines)\n \n def section(self,title,contents):\n ''\n clean_contents=self.indent(contents).rstrip()\n return self.bold(title)+'\\n'+clean_contents+'\\n\\n'\n \n \n \n def formattree(self,tree,modname,parent=None,prefix=''):\n ''\n result=''\n for entry in tree:\n if isinstance(entry,tuple):\n c,bases=entry\n result=result+prefix+classname(c,modname)\n if bases and bases !=(parent,):\n parents=(classname(c,modname)for c in bases)\n result=result+'(%s)'%', '.join(parents)\n result=result+'\\n'\n elif isinstance(entry,list):\n result=result+self.formattree(\n entry,modname,c,prefix+' ')\n return result\n \n def docmodule(self,object,name=None,mod=None):\n ''\n name=object.__name__\n synop,desc=splitdoc(getdoc(object))\n result=self.section('NAME',name+(synop and ' - '+synop))\n all=getattr(object,'__all__',None)\n docloc=self.getdocloc(object)\n if docloc is not None:\n result=result+self.section('MODULE REFERENCE',docloc+\"\"\"\n\nThe following documentation is automatically generated from the Python\nsource files. It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations. When in doubt, consult the module reference at the\nlocation listed above.\n\"\"\")\n \n if desc:\n result=result+self.section('DESCRIPTION',desc)\n \n classes=[]\n for key,value in inspect.getmembers(object,inspect.isclass):\n \n if(all is not None\n or(inspect.getmodule(value)or object)is object):\n if visiblename(key,all,object):\n classes.append((key,value))\n funcs=[]\n for key,value in inspect.getmembers(object,inspect.isroutine):\n \n if(all is not None or\n inspect.isbuiltin(value)or inspect.getmodule(value)is object):\n if visiblename(key,all,object):\n funcs.append((key,value))\n data=[]\n for key,value in inspect.getmembers(object,isdata):\n if visiblename(key,all,object):\n data.append((key,value))\n \n modpkgs=[]\n modpkgs_names=set()\n if hasattr(object,'__path__'):\n for importer,modname,ispkg in pkgutil.iter_modules(object.__path__):\n modpkgs_names.add(modname)\n if ispkg:\n modpkgs.append(modname+' (package)')\n else:\n modpkgs.append(modname)\n \n modpkgs.sort()\n result=result+self.section(\n 'PACKAGE CONTENTS','\\n'.join(modpkgs))\n \n \n submodules=[]\n for key,value in inspect.getmembers(object,inspect.ismodule):\n if value.__name__.startswith(name+'.')and key not in modpkgs_names:\n submodules.append(key)\n if submodules:\n submodules.sort()\n result=result+self.section(\n 'SUBMODULES','\\n'.join(submodules))\n \n if classes:\n classlist=[value for key,value in classes]\n contents=[self.formattree(\n inspect.getclasstree(classlist,1),name)]\n for key,value in classes:\n contents.append(self.document(value,key,name))\n result=result+self.section('CLASSES','\\n'.join(contents))\n \n if funcs:\n contents=[]\n for key,value in funcs:\n contents.append(self.document(value,key,name))\n result=result+self.section('FUNCTIONS','\\n'.join(contents))\n \n if data:\n contents=[]\n for key,value in data:\n contents.append(self.docother(value,key,name,maxlen=70))\n result=result+self.section('DATA','\\n'.join(contents))\n \n if hasattr(object,'__version__'):\n version=str(object.__version__)\n if version[:11]=='$'+'Revision: 'and version[-1:]=='$':\n version=version[11:-1].strip()\n result=result+self.section('VERSION',version)\n if hasattr(object,'__date__'):\n result=result+self.section('DATE',str(object.__date__))\n if hasattr(object,'__author__'):\n result=result+self.section('AUTHOR',str(object.__author__))\n if hasattr(object,'__credits__'):\n result=result+self.section('CREDITS',str(object.__credits__))\n try:\n file=inspect.getabsfile(object)\n except TypeError:\n file='(built-in)'\n result=result+self.section('FILE',file)\n return result\n \n def docclass(self,object,name=None,mod=None,*ignored):\n ''\n realname=object.__name__\n name=name or realname\n bases=object.__bases__\n \n def makename(c,m=object.__module__):\n return classname(c,m)\n \n if name ==realname:\n title='class '+self.bold(realname)\n else:\n title=self.bold(name)+' = class '+realname\n if bases:\n parents=map(makename,bases)\n title=title+'(%s)'%', '.join(parents)\n \n contents=[]\n push=contents.append\n \n try:\n signature=inspect.signature(object)\n except(ValueError,TypeError):\n signature=None\n if signature:\n argspec=str(signature)\n if argspec and argspec !='()':\n push(name+argspec+'\\n')\n \n doc=getdoc(object)\n if doc:\n push(doc+'\\n')\n \n \n mro=deque(inspect.getmro(object))\n if len(mro)>2:\n push(\"Method resolution order:\")\n for base in mro:\n push(' '+makename(base))\n push('')\n \n \n subclasses=sorted(\n (str(cls.__name__)for cls in type.__subclasses__(object)\n if not cls.__name__.startswith(\"_\")and cls.__module__ ==\"builtins\"),\n key=str.lower\n )\n no_of_subclasses=len(subclasses)\n MAX_SUBCLASSES_TO_DISPLAY=4\n if subclasses:\n push(\"Built-in subclasses:\")\n for subclassname in subclasses[:MAX_SUBCLASSES_TO_DISPLAY]:\n push(' '+subclassname)\n if no_of_subclasses >MAX_SUBCLASSES_TO_DISPLAY:\n push(' ... and '+\n str(no_of_subclasses -MAX_SUBCLASSES_TO_DISPLAY)+\n ' other subclasses')\n push('')\n \n \n class HorizontalRule:\n def __init__(self):\n self.needone=0\n def maybe(self):\n if self.needone:\n push('-'*70)\n self.needone=1\n hr=HorizontalRule()\n \n def spill(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n try:\n value=getattr(object,name)\n except Exception:\n \n \n push(self.docdata(value,name,mod))\n else:\n push(self.document(value,\n name,mod,object))\n return attrs\n \n def spilldescriptors(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n push(self.docdata(value,name,mod))\n return attrs\n \n def spilldata(msg,attrs,predicate):\n ok,attrs=_split_list(attrs,predicate)\n if ok:\n hr.maybe()\n push(msg)\n for name,kind,homecls,value in ok:\n doc=getdoc(value)\n try:\n obj=getattr(object,name)\n except AttributeError:\n obj=homecls.__dict__[name]\n push(self.docother(obj,name,mod,maxlen=70,doc=doc)+\n '\\n')\n return attrs\n \n attrs=[(name,kind,cls,value)\n for name,kind,cls,value in classify_class_attrs(object)\n if visiblename(name,obj=object)]\n \n while attrs:\n if mro:\n thisclass=mro.popleft()\n else:\n thisclass=attrs[0][2]\n attrs,inherited=_split_list(attrs,lambda t:t[2]is thisclass)\n \n if object is not builtins.object and thisclass is builtins.object:\n attrs=inherited\n continue\n elif thisclass is object:\n tag=\"defined here\"\n else:\n tag=\"inherited from %s\"%classname(thisclass,\n object.__module__)\n \n sort_attributes(attrs,object)\n \n \n attrs=spill(\"Methods %s:\\n\"%tag,attrs,\n lambda t:t[1]=='method')\n attrs=spill(\"Class methods %s:\\n\"%tag,attrs,\n lambda t:t[1]=='class method')\n attrs=spill(\"Static methods %s:\\n\"%tag,attrs,\n lambda t:t[1]=='static method')\n attrs=spilldescriptors(\"Readonly properties %s:\\n\"%tag,attrs,\n lambda t:t[1]=='readonly property')\n attrs=spilldescriptors(\"Data descriptors %s:\\n\"%tag,attrs,\n lambda t:t[1]=='data descriptor')\n attrs=spilldata(\"Data and other attributes %s:\\n\"%tag,attrs,\n lambda t:t[1]=='data')\n \n assert attrs ==[]\n attrs=inherited\n \n contents='\\n'.join(contents)\n if not contents:\n return title+'\\n'\n return title+'\\n'+self.indent(contents.rstrip(),' | ')+'\\n'\n \n def formatvalue(self,object):\n ''\n return '='+self.repr(object)\n \n def docroutine(self,object,name=None,mod=None,cl=None):\n ''\n realname=object.__name__\n name=name or realname\n note=''\n skipdocs=0\n if _is_bound_method(object):\n imclass=object.__self__.__class__\n if cl:\n if imclass is not cl:\n note=' from '+classname(imclass,mod)\n else:\n if object.__self__ is not None:\n note=' method of %s instance'%classname(\n object.__self__.__class__,mod)\n else:\n note=' unbound %s method'%classname(imclass,mod)\n \n if(inspect.iscoroutinefunction(object)or\n inspect.isasyncgenfunction(object)):\n asyncqualifier='async '\n else:\n asyncqualifier=''\n \n if name ==realname:\n title=self.bold(realname)\n else:\n if cl and inspect.getattr_static(cl,realname,[])is object:\n skipdocs=1\n title=self.bold(name)+' = '+realname\n argspec=None\n \n if inspect.isroutine(object):\n try:\n signature=inspect.signature(object)\n except(ValueError,TypeError):\n signature=None\n if signature:\n argspec=str(signature)\n if realname =='':\n title=self.bold(name)+' lambda '\n \n \n \n argspec=argspec[1:-1]\n if not argspec:\n argspec='(...)'\n decl=asyncqualifier+title+argspec+note\n \n if skipdocs:\n return decl+'\\n'\n else:\n doc=getdoc(object)or ''\n return decl+'\\n'+(doc and self.indent(doc).rstrip()+'\\n')\n \n def docdata(self,object,name=None,mod=None,cl=None):\n ''\n results=[]\n push=results.append\n \n if name:\n push(self.bold(name))\n push('\\n')\n doc=getdoc(object)or ''\n if doc:\n push(self.indent(doc))\n push('\\n')\n return ''.join(results)\n \n docproperty=docdata\n \n def docother(self,object,name=None,mod=None,parent=None,maxlen=None,doc=None):\n ''\n repr=self.repr(object)\n if maxlen:\n line=(name and name+' = 'or '')+repr\n chop=maxlen -len(line)\n if chop <0:repr=repr[:chop]+'...'\n line=(name and self.bold(name)+' = 'or '')+repr\n if not doc:\n doc=getdoc(object)\n if doc:\n line +='\\n'+self.indent(str(doc))+'\\n'\n return line\n \nclass _PlainTextDoc(TextDoc):\n ''\n def bold(self,text):\n return text\n \n \n \ndef pager(text):\n ''\n global pager\n pager=getpager()\n pager(text)\n \ndef getpager():\n ''\n if not hasattr(sys.stdin,\"isatty\"):\n return plainpager\n if not hasattr(sys.stdout,\"isatty\"):\n return plainpager\n if not sys.stdin.isatty()or not sys.stdout.isatty():\n return plainpager\n if sys.platform ==\"emscripten\":\n return plainpager\n use_pager=os.environ.get('MANPAGER')or os.environ.get('PAGER')\n if use_pager:\n if sys.platform =='win32':\n return lambda text:tempfilepager(plain(text),use_pager)\n elif os.environ.get('TERM')in('dumb','emacs'):\n return lambda text:pipepager(plain(text),use_pager)\n else:\n return lambda text:pipepager(text,use_pager)\n if os.environ.get('TERM')in('dumb','emacs'):\n return plainpager\n if sys.platform =='win32':\n return lambda text:tempfilepager(plain(text),'more <')\n if hasattr(os,'system')and os.system('(less) 2>/dev/null')==0:\n return lambda text:pipepager(text,'less')\n \n import tempfile\n (fd,filename)=tempfile.mkstemp()\n os.close(fd)\n try:\n if hasattr(os,'system')and os.system('more \"%s\"'%filename)==0:\n return lambda text:pipepager(text,'more')\n else:\n return ttypager\n finally:\n os.unlink(filename)\n \ndef plain(text):\n ''\n return re.sub('.\\b','',text)\n \ndef pipepager(text,cmd):\n ''\n import subprocess\n proc=subprocess.Popen(cmd,shell=True,stdin=subprocess.PIPE,\n errors='backslashreplace')\n try:\n with proc.stdin as pipe:\n try:\n pipe.write(text)\n except KeyboardInterrupt:\n \n \n pass\n except OSError:\n pass\n while True:\n try:\n proc.wait()\n break\n except KeyboardInterrupt:\n \n \n pass\n \ndef tempfilepager(text,cmd):\n ''\n import tempfile\n with tempfile.TemporaryDirectory()as tempdir:\n filename=os.path.join(tempdir,'pydoc.out')\n with open(filename,'w',errors='backslashreplace',\n encoding=os.device_encoding(0)if\n sys.platform =='win32'else None\n )as file:\n file.write(text)\n os.system(cmd+' \"'+filename+'\"')\n \ndef _escape_stdout(text):\n\n encoding=getattr(sys.stdout,'encoding',None)or 'utf-8'\n return text.encode(encoding,'backslashreplace').decode(encoding)\n \ndef ttypager(text):\n ''\n lines=plain(_escape_stdout(text)).split('\\n')\n try:\n import tty\n fd=sys.stdin.fileno()\n old=tty.tcgetattr(fd)\n tty.setcbreak(fd)\n getchar=lambda:sys.stdin.read(1)\n except(ImportError,AttributeError,io.UnsupportedOperation):\n tty=None\n getchar=lambda:sys.stdin.readline()[:-1][:1]\n \n try:\n try:\n h=int(os.environ.get('LINES',0))\n except ValueError:\n h=0\n if h <=1:\n h=25\n r=inc=h -1\n sys.stdout.write('\\n'.join(lines[:inc])+'\\n')\n while lines[r:]:\n sys.stdout.write('-- more --')\n sys.stdout.flush()\n c=getchar()\n \n if c in('q','Q'):\n sys.stdout.write('\\r \\r')\n break\n elif c in('\\r','\\n'):\n sys.stdout.write('\\r \\r'+lines[r]+'\\n')\n r=r+1\n continue\n if c in('b','B','\\x1b'):\n r=r -inc -inc\n if r <0:r=0\n sys.stdout.write('\\n'+'\\n'.join(lines[r:r+inc])+'\\n')\n r=r+inc\n \n finally:\n if tty:\n tty.tcsetattr(fd,tty.TCSAFLUSH,old)\n \ndef plainpager(text):\n ''\n sys.stdout.write(plain(_escape_stdout(text)))\n \ndef describe(thing):\n ''\n if inspect.ismodule(thing):\n if thing.__name__ in sys.builtin_module_names:\n return 'built-in module '+thing.__name__\n if hasattr(thing,'__path__'):\n return 'package '+thing.__name__\n else:\n return 'module '+thing.__name__\n if inspect.isbuiltin(thing):\n return 'built-in function '+thing.__name__\n if inspect.isgetsetdescriptor(thing):\n return 'getset descriptor %s.%s.%s'%(\n thing.__objclass__.__module__,thing.__objclass__.__name__,\n thing.__name__)\n if inspect.ismemberdescriptor(thing):\n return 'member descriptor %s.%s.%s'%(\n thing.__objclass__.__module__,thing.__objclass__.__name__,\n thing.__name__)\n if inspect.isclass(thing):\n return 'class '+thing.__name__\n if inspect.isfunction(thing):\n return 'function '+thing.__name__\n if inspect.ismethod(thing):\n return 'method '+thing.__name__\n return type(thing).__name__\n \ndef locate(path,forceload=0):\n ''\n parts=[part for part in path.split('.')if part]\n module,n=None,0\n while n >','&',\n '|','^','~','<','>','<=','>=','==','!=','<>'),\n 'COMPARISON':('<','>','<=','>=','==','!=','<>'),\n 'UNARY':('-','~'),\n 'AUGMENTEDASSIGNMENT':('+=','-=','*=','/=','%=','&=','|=',\n '^=','<<=','>>=','**=','//='),\n 'BITWISE':('<<','>>','&','|','^','~'),\n 'COMPLEX':('j','J')\n }\n symbols={\n '%':'OPERATORS FORMATTING',\n '**':'POWER',\n ',':'TUPLES LISTS FUNCTIONS',\n '.':'ATTRIBUTES FLOAT MODULES OBJECTS',\n '...':'ELLIPSIS',\n ':':'SLICINGS DICTIONARYLITERALS',\n '@':'def class',\n '\\\\':'STRINGS',\n '_':'PRIVATENAMES',\n '__':'PRIVATENAMES SPECIALMETHODS',\n '`':'BACKQUOTES',\n '(':'TUPLES FUNCTIONS CALLS',\n ')':'TUPLES FUNCTIONS CALLS',\n '[':'LISTS SUBSCRIPTS SLICINGS',\n ']':'LISTS SUBSCRIPTS SLICINGS'\n }\n for topic,symbols_ in _symbols_inverse.items():\n for symbol in symbols_:\n topics=symbols.get(symbol,topic)\n if topic not in topics:\n topics=topics+' '+topic\n symbols[symbol]=topics\n del topic,symbols_,symbol,topics\n \n topics={\n 'TYPES':('types','STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS '\n 'FUNCTIONS CLASSES MODULES FILES inspect'),\n 'STRINGS':('strings','str UNICODE SEQUENCES STRINGMETHODS '\n 'FORMATTING TYPES'),\n 'STRINGMETHODS':('string-methods','STRINGS FORMATTING'),\n 'FORMATTING':('formatstrings','OPERATORS'),\n 'UNICODE':('strings','encodings unicode SEQUENCES STRINGMETHODS '\n 'FORMATTING TYPES'),\n 'NUMBERS':('numbers','INTEGER FLOAT COMPLEX TYPES'),\n 'INTEGER':('integers','int range'),\n 'FLOAT':('floating','float math'),\n 'COMPLEX':('imaginary','complex cmath'),\n 'SEQUENCES':('typesseq','STRINGMETHODS FORMATTING range LISTS'),\n 'MAPPINGS':'DICTIONARIES',\n 'FUNCTIONS':('typesfunctions','def TYPES'),\n 'METHODS':('typesmethods','class def CLASSES TYPES'),\n 'CODEOBJECTS':('bltin-code-objects','compile FUNCTIONS TYPES'),\n 'TYPEOBJECTS':('bltin-type-objects','types TYPES'),\n 'FRAMEOBJECTS':'TYPES',\n 'TRACEBACKS':'TYPES',\n 'NONE':('bltin-null-object',''),\n 'ELLIPSIS':('bltin-ellipsis-object','SLICINGS'),\n 'SPECIALATTRIBUTES':('specialattrs',''),\n 'CLASSES':('types','class SPECIALMETHODS PRIVATENAMES'),\n 'MODULES':('typesmodules','import'),\n 'PACKAGES':'import',\n 'EXPRESSIONS':('operator-summary','lambda or and not in is BOOLEAN '\n 'COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER '\n 'UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES '\n 'LISTS DICTIONARIES'),\n 'OPERATORS':'EXPRESSIONS',\n 'PRECEDENCE':'EXPRESSIONS',\n 'OBJECTS':('objects','TYPES'),\n 'SPECIALMETHODS':('specialnames','BASICMETHODS ATTRIBUTEMETHODS '\n 'CALLABLEMETHODS SEQUENCEMETHODS MAPPINGMETHODS '\n 'NUMBERMETHODS CLASSES'),\n 'BASICMETHODS':('customization','hash repr str SPECIALMETHODS'),\n 'ATTRIBUTEMETHODS':('attribute-access','ATTRIBUTES SPECIALMETHODS'),\n 'CALLABLEMETHODS':('callable-types','CALLS SPECIALMETHODS'),\n 'SEQUENCEMETHODS':('sequence-types','SEQUENCES SEQUENCEMETHODS '\n 'SPECIALMETHODS'),\n 'MAPPINGMETHODS':('sequence-types','MAPPINGS SPECIALMETHODS'),\n 'NUMBERMETHODS':('numeric-types','NUMBERS AUGMENTEDASSIGNMENT '\n 'SPECIALMETHODS'),\n 'EXECUTION':('execmodel','NAMESPACES DYNAMICFEATURES EXCEPTIONS'),\n 'NAMESPACES':('naming','global nonlocal ASSIGNMENT DELETION DYNAMICFEATURES'),\n 'DYNAMICFEATURES':('dynamic-features',''),\n 'SCOPING':'NAMESPACES',\n 'FRAMES':'NAMESPACES',\n 'EXCEPTIONS':('exceptions','try except finally raise'),\n 'CONVERSIONS':('conversions',''),\n 'IDENTIFIERS':('identifiers','keywords SPECIALIDENTIFIERS'),\n 'SPECIALIDENTIFIERS':('id-classes',''),\n 'PRIVATENAMES':('atom-identifiers',''),\n 'LITERALS':('atom-literals','STRINGS NUMBERS TUPLELITERALS '\n 'LISTLITERALS DICTIONARYLITERALS'),\n 'TUPLES':'SEQUENCES',\n 'TUPLELITERALS':('exprlists','TUPLES LITERALS'),\n 'LISTS':('typesseq-mutable','LISTLITERALS'),\n 'LISTLITERALS':('lists','LISTS LITERALS'),\n 'DICTIONARIES':('typesmapping','DICTIONARYLITERALS'),\n 'DICTIONARYLITERALS':('dict','DICTIONARIES LITERALS'),\n 'ATTRIBUTES':('attribute-references','getattr hasattr setattr ATTRIBUTEMETHODS'),\n 'SUBSCRIPTS':('subscriptions','SEQUENCEMETHODS'),\n 'SLICINGS':('slicings','SEQUENCEMETHODS'),\n 'CALLS':('calls','EXPRESSIONS'),\n 'POWER':('power','EXPRESSIONS'),\n 'UNARY':('unary','EXPRESSIONS'),\n 'BINARY':('binary','EXPRESSIONS'),\n 'SHIFTING':('shifting','EXPRESSIONS'),\n 'BITWISE':('bitwise','EXPRESSIONS'),\n 'COMPARISON':('comparisons','EXPRESSIONS BASICMETHODS'),\n 'BOOLEAN':('booleans','EXPRESSIONS TRUTHVALUE'),\n 'ASSERTION':'assert',\n 'ASSIGNMENT':('assignment','AUGMENTEDASSIGNMENT'),\n 'AUGMENTEDASSIGNMENT':('augassign','NUMBERMETHODS'),\n 'DELETION':'del',\n 'RETURNING':'return',\n 'IMPORTING':'import',\n 'CONDITIONAL':'if',\n 'LOOPING':('compound','for while break continue'),\n 'TRUTHVALUE':('truth','if while and or not BASICMETHODS'),\n 'DEBUGGING':('debugger','pdb'),\n 'CONTEXTMANAGERS':('context-managers','with'),\n }\n \n def __init__(self,input=None,output=None):\n self._input=input\n self._output=output\n \n @property\n def input(self):\n return self._input or sys.stdin\n \n @property\n def output(self):\n return self._output or sys.stdout\n \n def __repr__(self):\n if inspect.stack()[1][3]=='?':\n self()\n return ''\n return '<%s.%s instance>'%(self.__class__.__module__,\n self.__class__.__qualname__)\n \n _GoInteractive=object()\n def __call__(self,request=_GoInteractive):\n if request is not self._GoInteractive:\n try:\n self.help(request)\n except ImportError as err:\n self.output.write(f'{err}\\n')\n else:\n self.intro()\n self.interact()\n self.output.write('''\nYou are now leaving help and returning to the Python interpreter.\nIf you want to ask for help on a particular object directly from the\ninterpreter, you can type \"help(object)\". Executing \"help('string')\"\nhas the same effect as typing a particular string at the help> prompt.\n''')\n \n def interact(self):\n self.output.write('\\n')\n while True:\n try:\n request=self.getline('help> ')\n if not request:break\n except(KeyboardInterrupt,EOFError):\n break\n request=request.strip()\n \n \n \n if(len(request)>2 and request[0]==request[-1]in(\"'\",'\"')\n and request[0]not in request[1:-1]):\n request=request[1:-1]\n if request.lower()in('q','quit'):break\n if request =='help':\n self.intro()\n else:\n self.help(request)\n \n def getline(self,prompt):\n ''\n if self.input is sys.stdin:\n return input(prompt)\n else:\n self.output.write(prompt)\n self.output.flush()\n return self.input.readline()\n \n def help(self,request):\n if isinstance(request,str):\n request=request.strip()\n if request =='keywords':self.listkeywords()\n elif request =='symbols':self.listsymbols()\n elif request =='topics':self.listtopics()\n elif request =='modules':self.listmodules()\n elif request[:8]=='modules ':\n self.listmodules(request.split()[1])\n elif request in self.symbols:self.showsymbol(request)\n elif request in['True','False','None']:\n \n doc(eval(request),'Help on %s:')\n elif request in self.keywords:self.showtopic(request)\n elif request in self.topics:self.showtopic(request)\n elif request:doc(request,'Help on %s:',output=self._output)\n else:doc(str,'Help on %s:',output=self._output)\n elif isinstance(request,Helper):self()\n else:doc(request,'Help on %s:',output=self._output)\n self.output.write('\\n')\n \n def intro(self):\n self.output.write('''\nWelcome to Python {0}'s help utility!\n\nIf this is your first time using Python, you should definitely check out\nthe tutorial on the internet at https://docs.python.org/{0}/tutorial/.\n\nEnter the name of any module, keyword, or topic to get help on writing\nPython programs and using Python modules. To quit this help utility and\nreturn to the interpreter, just type \"quit\".\n\nTo get a list of available modules, keywords, symbols, or topics, type\n\"modules\", \"keywords\", \"symbols\", or \"topics\". Each module also comes\nwith a one-line summary of what it does; to list the modules whose name\nor summary contain a given string such as \"spam\", type \"modules spam\".\n'''.format('%d.%d'%sys.version_info[:2]))\n \n def list(self,items,columns=4,width=80):\n items=list(sorted(items))\n colw=width //columns\n rows=(len(items)+columns -1)//columns\n for row in range(rows):\n for col in range(columns):\n i=col *rows+row\n if i =0:\n callback(None,modname,desc)\n \n for importer,modname,ispkg in pkgutil.walk_packages(onerror=onerror):\n if self.quit:\n break\n \n if key is None:\n callback(None,modname,'')\n else:\n try:\n spec=importer.find_spec(modname)\n except SyntaxError:\n \n continue\n loader=spec.loader\n if hasattr(loader,'get_source'):\n try:\n source=loader.get_source(modname)\n except Exception:\n if onerror:\n onerror(modname)\n continue\n desc=source_synopsis(io.StringIO(source))or ''\n if hasattr(loader,'get_filename'):\n path=loader.get_filename(modname)\n else:\n path=None\n else:\n try:\n module=importlib._bootstrap._load(spec)\n except ImportError:\n if onerror:\n onerror(modname)\n continue\n desc=module.__doc__.splitlines()[0]if module.__doc__ else ''\n path=getattr(module,'__file__',None)\n name=modname+' - '+desc\n if name.lower().find(key)>=0:\n callback(path,modname,desc)\n \n if completer:\n completer()\n \ndef apropos(key):\n ''\n def callback(path,modname,desc):\n if modname[-9:]=='.__init__':\n modname=modname[:-9]+' (package)'\n print(modname,desc and '- '+desc)\n def onerror(modname):\n pass\n with warnings.catch_warnings():\n warnings.filterwarnings('ignore')\n ModuleScanner().run(callback,key,onerror=onerror)\n \n \n \ndef _start_server(urlhandler,hostname,port):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n import http.server\n import email.message\n import select\n import threading\n \n class DocHandler(http.server.BaseHTTPRequestHandler):\n \n def do_GET(self):\n ''\n\n\n\n \n if self.path.endswith('.css'):\n content_type='text/css'\n else:\n content_type='text/html'\n self.send_response(200)\n self.send_header('Content-Type','%s; charset=UTF-8'%content_type)\n self.end_headers()\n self.wfile.write(self.urlhandler(\n self.path,content_type).encode('utf-8'))\n \n def log_message(self,*args):\n \n pass\n \n class DocServer(http.server.HTTPServer):\n \n def __init__(self,host,port,callback):\n self.host=host\n self.address=(self.host,port)\n self.callback=callback\n self.base.__init__(self,self.address,self.handler)\n self.quit=False\n \n def serve_until_quit(self):\n while not self.quit:\n rd,wr,ex=select.select([self.socket.fileno()],[],[],1)\n if rd:\n self.handle_request()\n self.server_close()\n \n def server_activate(self):\n self.base.server_activate(self)\n if self.callback:\n self.callback(self)\n \n class ServerThread(threading.Thread):\n \n def __init__(self,urlhandler,host,port):\n self.urlhandler=urlhandler\n self.host=host\n self.port=int(port)\n threading.Thread.__init__(self)\n self.serving=False\n self.error=None\n \n def run(self):\n ''\n try:\n DocServer.base=http.server.HTTPServer\n DocServer.handler=DocHandler\n DocHandler.MessageClass=email.message.Message\n DocHandler.urlhandler=staticmethod(self.urlhandler)\n docsvr=DocServer(self.host,self.port,self.ready)\n self.docserver=docsvr\n docsvr.serve_until_quit()\n except Exception as err:\n self.error=err\n \n def ready(self,server):\n self.serving=True\n self.host=server.host\n self.port=server.server_port\n self.url='http://%s:%d/'%(self.host,self.port)\n \n def stop(self):\n ''\n self.docserver.quit=True\n self.join()\n \n \n self.docserver=None\n self.serving=False\n self.url=None\n \n thread=ServerThread(urlhandler,hostname,port)\n thread.start()\n \n \n while not thread.error and not thread.serving:\n time.sleep(.01)\n return thread\n \n \ndef _url_handler(url,content_type=\"text/html\"):\n ''\n\n\n\n\n\n\n \n class _HTMLDoc(HTMLDoc):\n \n def page(self,title,contents):\n ''\n css_path=\"pydoc_data/_pydoc.css\"\n css_link=(\n ''%\n css_path)\n return '''\\\n\n\n\n\nPydoc: %s\n%s%s
%s
\n'''%(title,css_link,html_navbar(),contents)\n \n \n html=_HTMLDoc()\n \n def html_navbar():\n version=html.escape(\"%s [%s, %s]\"%(platform.python_version(),\n platform.python_build()[0],\n platform.python_compiler()))\n return \"\"\"\n
\n Python %s
%s\n
\n
\n \n
\n
\n \n \n
 \n
\n \n \n
\n
\n
\n \"\"\"%(version,html.escape(platform.platform(terse=True)))\n \n def html_index():\n ''\n \n def bltinlink(name):\n return '%s'%(name,name)\n \n heading=html.heading(\n 'Index of Modules'\n )\n names=[name for name in sys.builtin_module_names\n if name !='__main__']\n contents=html.multicolumn(names,bltinlink)\n contents=[heading,'

'+html.bigsection(\n 'Built-in Modules','index',contents)]\n \n seen={}\n for dir in sys.path:\n contents.append(html.index(dir,seen))\n \n contents.append(\n '

pydoc by Ka-Ping Yee'\n '<ping@lfw.org>

')\n return 'Index of Modules',''.join(contents)\n \n def html_search(key):\n ''\n \n search_result=[]\n \n def callback(path,modname,desc):\n if modname[-9:]=='.__init__':\n modname=modname[:-9]+' (package)'\n search_result.append((modname,desc and '- '+desc))\n \n with warnings.catch_warnings():\n warnings.filterwarnings('ignore')\n def onerror(modname):\n pass\n ModuleScanner().run(callback,key,onerror=onerror)\n \n \n def bltinlink(name):\n return '%s'%(name,name)\n \n results=[]\n heading=html.heading(\n 'Search Results',\n )\n for name,desc in search_result:\n results.append(bltinlink(name)+desc)\n contents=heading+html.bigsection(\n 'key = %s'%key,'index','
'.join(results))\n return 'Search Results',contents\n \n def html_topics():\n ''\n \n def bltinlink(name):\n return '%s'%(name,name)\n \n heading=html.heading(\n 'INDEX',\n )\n names=sorted(Helper.topics.keys())\n \n contents=html.multicolumn(names,bltinlink)\n contents=heading+html.bigsection(\n 'Topics','index',contents)\n return 'Topics',contents\n \n def html_keywords():\n ''\n heading=html.heading(\n 'INDEX',\n )\n names=sorted(Helper.keywords.keys())\n \n def bltinlink(name):\n return '%s'%(name,name)\n \n contents=html.multicolumn(names,bltinlink)\n contents=heading+html.bigsection(\n 'Keywords','index',contents)\n return 'Keywords',contents\n \n def html_topicpage(topic):\n ''\n buf=io.StringIO()\n htmlhelp=Helper(buf,buf)\n contents,xrefs=htmlhelp._gettopic(topic)\n if topic in htmlhelp.keywords:\n title='KEYWORD'\n else:\n title='TOPIC'\n heading=html.heading(\n '%s'%title,\n )\n contents='
%s
'%html.markup(contents)\n contents=html.bigsection(topic,'index',contents)\n if xrefs:\n xrefs=sorted(xrefs.split())\n \n def bltinlink(name):\n return '%s'%(name,name)\n \n xrefs=html.multicolumn(xrefs,bltinlink)\n xrefs=html.section('Related help topics: ','index',xrefs)\n return('%s %s'%(title,topic),\n ''.join((heading,contents,xrefs)))\n \n def html_getobj(url):\n obj=locate(url,forceload=1)\n if obj is None and url !='None':\n raise ValueError('could not find object')\n title=describe(obj)\n content=html.document(obj,url)\n return title,content\n \n def html_error(url,exc):\n heading=html.heading(\n 'Error',\n )\n contents='
'.join(html.escape(line)for line in\n format_exception_only(type(exc),exc))\n contents=heading+html.bigsection(url,'error',contents)\n return \"Error - %s\"%url,contents\n \n def get_html_page(url):\n ''\n complete_url=url\n if url.endswith('.html'):\n url=url[:-5]\n try:\n if url in(\"\",\"index\"):\n title,content=html_index()\n elif url ==\"topics\":\n title,content=html_topics()\n elif url ==\"keywords\":\n title,content=html_keywords()\n elif '='in url:\n op,_,url=url.partition('=')\n if op ==\"search?key\":\n title,content=html_search(url)\n elif op ==\"topic?key\":\n \n try:\n title,content=html_topicpage(url)\n except ValueError:\n title,content=html_getobj(url)\n elif op ==\"get?key\":\n \n if url in(\"\",\"index\"):\n title,content=html_index()\n else:\n try:\n title,content=html_getobj(url)\n except ValueError:\n title,content=html_topicpage(url)\n else:\n raise ValueError('bad pydoc url')\n else:\n title,content=html_getobj(url)\n except Exception as exc:\n \n title,content=html_error(complete_url,exc)\n return html.page(title,content)\n \n if url.startswith('/'):\n url=url[1:]\n if content_type =='text/css':\n path_here=os.path.dirname(os.path.realpath(__file__))\n css_path=os.path.join(path_here,url)\n with open(css_path)as fp:\n return ''.join(fp.readlines())\n elif content_type =='text/html':\n return get_html_page(url)\n \n raise TypeError('unknown content type %r for url %s'%(content_type,url))\n \n \ndef browse(port=0,*,open_browser=True,hostname='localhost'):\n ''\n\n\n\n \n import webbrowser\n serverthread=_start_server(_url_handler,hostname,port)\n if serverthread.error:\n print(serverthread.error)\n return\n if serverthread.serving:\n server_help_msg='Server commands: [b]rowser, [q]uit'\n if open_browser:\n webbrowser.open(serverthread.url)\n try:\n print('Server ready at',serverthread.url)\n print(server_help_msg)\n while serverthread.serving:\n cmd=input('server> ')\n cmd=cmd.lower()\n if cmd =='q':\n break\n elif cmd =='b':\n webbrowser.open(serverthread.url)\n else:\n print(server_help_msg)\n except(KeyboardInterrupt,EOFError):\n print()\n finally:\n if serverthread.serving:\n serverthread.stop()\n print('Server stopped')\n \n \n \n \ndef ispath(x):\n return isinstance(x,str)and x.find(os.sep)>=0\n \ndef _get_revised_path(given_path,argv0):\n ''\n\n\n\n\n \n \n \n \n \n \n \n if ''in given_path or os.curdir in given_path or os.getcwd()in given_path:\n return None\n \n \n \n stdlib_dir=os.path.dirname(__file__)\n script_dir=os.path.dirname(argv0)\n revised_path=given_path.copy()\n if script_dir in given_path and not os.path.samefile(script_dir,stdlib_dir):\n revised_path.remove(script_dir)\n revised_path.insert(0,os.getcwd())\n return revised_path\n \n \n \ndef _adjust_cli_sys_path():\n ''\n\n\n \n revised_path=_get_revised_path(sys.path,sys.argv[0])\n if revised_path is not None:\n sys.path[:]=revised_path\n \n \ndef cli():\n ''\n import getopt\n class BadUsage(Exception):pass\n \n _adjust_cli_sys_path()\n \n try:\n opts,args=getopt.getopt(sys.argv[1:],'bk:n:p:w')\n writing=False\n start_server=False\n open_browser=False\n port=0\n hostname='localhost'\n for opt,val in opts:\n if opt =='-b':\n start_server=True\n open_browser=True\n if opt =='-k':\n apropos(val)\n return\n if opt =='-p':\n start_server=True\n port=val\n if opt =='-w':\n writing=True\n if opt =='-n':\n start_server=True\n hostname=val\n \n if start_server:\n browse(port,hostname=hostname,open_browser=open_browser)\n return\n \n if not args:raise BadUsage\n for arg in args:\n if ispath(arg)and not os.path.exists(arg):\n print('file %r does not exist'%arg)\n sys.exit(1)\n try:\n if ispath(arg)and os.path.isfile(arg):\n arg=importfile(arg)\n if writing:\n if ispath(arg)and os.path.isdir(arg):\n writedocs(arg)\n else:\n writedoc(arg)\n else:\n help.help(arg)\n except(ImportError,ErrorDuringImport)as value:\n print(value)\n sys.exit(1)\n \n except(getopt.error,BadUsage):\n cmd=os.path.splitext(os.path.basename(sys.argv[0]))[0]\n print(\"\"\"pydoc - the Python documentation tool\n\n{cmd} ...\n Show text documentation on something. may be the name of a\n Python keyword, topic, function, module, or package, or a dotted\n reference to a class or function within a module or module in a\n package. If contains a '{sep}', it is used as the path to a\n Python source file to document. If name is 'keywords', 'topics',\n or 'modules', a listing of these things is displayed.\n\n{cmd} -k \n Search for a keyword in the synopsis lines of all available modules.\n\n{cmd} -n \n Start an HTTP server with the given hostname (default: localhost).\n\n{cmd} -p \n Start an HTTP server on the given port on the local machine. Port\n number 0 can be used to get an arbitrary unused port.\n\n{cmd} -b\n Start an HTTP server on an arbitrary unused port and open a web browser\n to interactively browse documentation. This option can be used in\n combination with -n and/or -p.\n\n{cmd} -w ...\n Write out the HTML documentation for a module to a file in the current\n directory. If contains a '{sep}', it is treated as a filename; if\n it names a directory, documentation is written for all the contents.\n\"\"\".format(cmd=cmd,sep=os.sep))\n \nif __name__ =='__main__':\n cli()\n", ["__future__", "builtins", "collections", "email.message", "getopt", "http.server", "importlib._bootstrap", "importlib._bootstrap_external", "importlib.machinery", "importlib.util", "inspect", "io", "os", "pkgutil", "platform", "pydoc_data.topics", "re", "reprlib", "select", "subprocess", "sys", "sysconfig", "tempfile", "textwrap", "threading", "time", "tokenize", "traceback", "tty", "urllib.parse", "warnings", "webbrowser"]], "py_compile": [".py", "''\n\n\n\n\nimport enum\nimport importlib._bootstrap_external\nimport importlib.machinery\nimport importlib.util\nimport os\nimport os.path\nimport sys\nimport traceback\n\n__all__=[\"compile\",\"main\",\"PyCompileError\",\"PycInvalidationMode\"]\n\n\nclass PyCompileError(Exception):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,exc_type,exc_value,file,msg=''):\n exc_type_name=exc_type.__name__\n if exc_type is SyntaxError:\n tbtext=''.join(traceback.format_exception_only(\n exc_type,exc_value))\n errmsg=tbtext.replace('File \"\"','File \"%s\"'%file)\n else :\n errmsg=\"Sorry: %s: %s\"%(exc_type_name,exc_value)\n \n Exception.__init__(self,msg or errmsg,exc_type_name,exc_value,file)\n \n self.exc_type_name=exc_type_name\n self.exc_value=exc_value\n self.file=file\n self.msg=msg or errmsg\n \n def __str__(self):\n return self.msg\n \n \nclass PycInvalidationMode(enum.Enum):\n TIMESTAMP=1\n CHECKED_HASH=2\n UNCHECKED_HASH=3\n \n \ndef _get_default_invalidation_mode():\n if os.environ.get('SOURCE_DATE_EPOCH'):\n return PycInvalidationMode.CHECKED_HASH\n else :\n return PycInvalidationMode.TIMESTAMP\n \n \ndef compile(file,cfile=None ,dfile=None ,doraise=False ,optimize=-1,\ninvalidation_mode=None ,quiet=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if invalidation_mode is None :\n invalidation_mode=_get_default_invalidation_mode()\n if cfile is None :\n if optimize >=0:\n optimization=optimize if optimize >=1 else ''\n cfile=importlib.util.cache_from_source(file,\n optimization=optimization)\n else :\n cfile=importlib.util.cache_from_source(file)\n if os.path.islink(cfile):\n msg=('{} is a symlink and will be changed into a regular file if '\n 'import writes a byte-compiled file to it')\n raise FileExistsError(msg.format(cfile))\n elif os.path.exists(cfile)and not os.path.isfile(cfile):\n msg=('{} is a non-regular file and will be changed into a regular '\n 'one if import writes a byte-compiled file to it')\n raise FileExistsError(msg.format(cfile))\n loader=importlib.machinery.SourceFileLoader('',file)\n source_bytes=loader.get_data(file)\n try :\n code=loader.source_to_code(source_bytes,dfile or file,\n _optimize=optimize)\n except Exception as err:\n py_exc=PyCompileError(err.__class__,err,dfile or file)\n if quiet <2:\n if doraise:\n raise py_exc\n else :\n sys.stderr.write(py_exc.msg+'\\n')\n return\n try :\n dirname=os.path.dirname(cfile)\n if dirname:\n os.makedirs(dirname)\n except FileExistsError:\n pass\n if invalidation_mode ==PycInvalidationMode.TIMESTAMP:\n source_stats=loader.path_stats(file)\n bytecode=importlib._bootstrap_external._code_to_timestamp_pyc(\n code,source_stats['mtime'],source_stats['size'])\n else :\n source_hash=importlib.util.source_hash(source_bytes)\n bytecode=importlib._bootstrap_external._code_to_hash_pyc(\n code,\n source_hash,\n (invalidation_mode ==PycInvalidationMode.CHECKED_HASH),\n )\n mode=importlib._bootstrap_external._calc_mode(file)\n importlib._bootstrap_external._write_atomic(cfile,bytecode,mode)\n return cfile\n \n \ndef main():\n import argparse\n \n description='A simple command-line interface for py_compile module.'\n parser=argparse.ArgumentParser(description=description)\n parser.add_argument(\n '-q','--quiet',\n action='store_true',\n help='Suppress error output',\n )\n parser.add_argument(\n 'filenames',\n nargs='+',\n help='Files to compile',\n )\n args=parser.parse_args()\n if args.filenames ==['-']:\n filenames=[filename.rstrip('\\n')for filename in sys.stdin.readlines()]\n else :\n filenames=args.filenames\n for filename in filenames:\n try :\n compile(filename,doraise=True )\n except PyCompileError as error:\n if args.quiet:\n parser.exit(1)\n else :\n parser.exit(1,error.msg)\n except OSError as error:\n if args.quiet:\n parser.exit(1)\n else :\n parser.exit(1,str(error))\n \n \nif __name__ ==\"__main__\":\n main()\n", ["argparse", "enum", "importlib._bootstrap_external", "importlib.machinery", "importlib.util", "os", "os.path", "sys", "traceback"]], "queue": [".py", "''\n\nimport threading\nimport types\nfrom collections import deque\nfrom heapq import heappush,heappop\nfrom time import monotonic as time\ntry :\n from _queue import SimpleQueue\nexcept ImportError:\n SimpleQueue=None\n \n__all__=['Empty','Full','Queue','PriorityQueue','LifoQueue','SimpleQueue']\n\n\ntry :\n from _queue import Empty\nexcept ImportError:\n class Empty(Exception):\n ''\n pass\n \nclass Full(Exception):\n ''\n pass\n \n \nclass Queue:\n ''\n\n\n \n \n def __init__(self,maxsize=0):\n self.maxsize=maxsize\n self._init(maxsize)\n \n \n \n \n \n self.mutex=threading.Lock()\n \n \n \n self.not_empty=threading.Condition(self.mutex)\n \n \n \n self.not_full=threading.Condition(self.mutex)\n \n \n \n self.all_tasks_done=threading.Condition(self.mutex)\n self.unfinished_tasks=0\n \n def task_done(self):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n with self.all_tasks_done:\n unfinished=self.unfinished_tasks -1\n if unfinished <=0:\n if unfinished <0:\n raise ValueError('task_done() called too many times')\n self.all_tasks_done.notify_all()\n self.unfinished_tasks=unfinished\n \n def join(self):\n ''\n\n\n\n\n\n\n \n with self.all_tasks_done:\n while self.unfinished_tasks:\n self.all_tasks_done.wait()\n \n def qsize(self):\n ''\n with self.mutex:\n return self._qsize()\n \n def empty(self):\n ''\n\n\n\n\n\n\n\n\n \n with self.mutex:\n return not self._qsize()\n \n def full(self):\n ''\n\n\n\n\n\n \n with self.mutex:\n return 0 0:\n if not block:\n if self._qsize()>=self.maxsize:\n raise Full\n elif timeout is None :\n while self._qsize()>=self.maxsize:\n self.not_full.wait()\n elif timeout <0:\n raise ValueError(\"'timeout' must be a non-negative number\")\n else :\n endtime=time()+timeout\n while self._qsize()>=self.maxsize:\n remaining=endtime -time()\n if remaining <=0.0:\n raise Full\n self.not_full.wait(remaining)\n self._put(item)\n self.unfinished_tasks +=1\n self.not_empty.notify()\n \n def get(self,block=True ,timeout=None ):\n ''\n\n\n\n\n\n\n\n\n \n with self.not_empty:\n if not block:\n if not self._qsize():\n raise Empty\n elif timeout is None :\n while not self._qsize():\n self.not_empty.wait()\n elif timeout <0:\n raise ValueError(\"'timeout' must be a non-negative number\")\n else :\n endtime=time()+timeout\n while not self._qsize():\n remaining=endtime -time()\n if remaining <=0.0:\n raise Empty\n self.not_empty.wait(remaining)\n item=self._get()\n self.not_full.notify()\n return item\n \n def put_nowait(self,item):\n ''\n\n\n\n \n return self.put(item,block=False )\n \n def get_nowait(self):\n ''\n\n\n\n \n return self.get(block=False )\n \n \n \n \n \n \n def _init(self,maxsize):\n self.queue=deque()\n \n def _qsize(self):\n return len(self.queue)\n \n \n def _put(self,item):\n self.queue.append(item)\n \n \n def _get(self):\n return self.queue.popleft()\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \nclass PriorityQueue(Queue):\n ''\n\n\n \n \n def _init(self,maxsize):\n self.queue=[]\n \n def _qsize(self):\n return len(self.queue)\n \n def _put(self,item):\n heappush(self.queue,item)\n \n def _get(self):\n return heappop(self.queue)\n \n \nclass LifoQueue(Queue):\n ''\n \n def _init(self,maxsize):\n self.queue=[]\n \n def _qsize(self):\n return len(self.queue)\n \n def _put(self,item):\n self.queue.append(item)\n \n def _get(self):\n return self.queue.pop()\n \n \nclass _PySimpleQueue:\n ''\n\n\n \n \n \n \n \n \n def __init__(self):\n self._queue=deque()\n self._count=threading.Semaphore(0)\n \n def put(self,item,block=True ,timeout=None ):\n ''\n\n\n\n \n self._queue.append(item)\n self._count.release()\n \n def get(self,block=True ,timeout=None ):\n ''\n\n\n\n\n\n\n\n\n \n if timeout is not None and timeout <0:\n raise ValueError(\"'timeout' must be a non-negative number\")\n if not self._count.acquire(block,timeout):\n raise Empty\n return self._queue.popleft()\n \n def put_nowait(self,item):\n ''\n\n\n\n \n return self.put(item,block=False )\n \n def get_nowait(self):\n ''\n\n\n\n \n return self.get(block=False )\n \n def empty(self):\n ''\n return len(self._queue)==0\n \n def qsize(self):\n ''\n return len(self._queue)\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \nif SimpleQueue is None :\n SimpleQueue=_PySimpleQueue\n", ["_queue", "collections", "heapq", "threading", "time", "types"]], "quopri": [".py", "#! /usr/bin/env python3\n\n\"\"\"Conversions to/from quoted-printable transport encoding as per RFC 1521.\"\"\"\n\n\n\n__all__=[\"encode\",\"decode\",\"encodestring\",\"decodestring\"]\n\nESCAPE=b'='\nMAXLINESIZE=76\nHEX=b'0123456789ABCDEF'\nEMPTYSTRING=b''\n\ntry:\n from binascii import a2b_qp,b2a_qp\nexcept ImportError:\n a2b_qp=None\n b2a_qp=None\n \n \ndef needsquoting(c,quotetabs,header):\n ''\n\n\n\n\n \n assert isinstance(c,bytes)\n if c in b' \\t':\n return quotetabs\n \n if c ==b'_':\n return header\n return c ==ESCAPE or not(b' '<=c <=b'~')\n \ndef quote(c):\n ''\n assert isinstance(c,bytes)and len(c)==1\n c=ord(c)\n return ESCAPE+bytes((HEX[c //16],HEX[c %16]))\n \n \n \ndef encode(input,output,quotetabs,header=False):\n ''\n\n\n\n\n\n \n \n if b2a_qp is not None:\n data=input.read()\n odata=b2a_qp(data,quotetabs=quotetabs,header=header)\n output.write(odata)\n return\n \n def write(s,output=output,lineEnd=b'\\n'):\n \n \n if s and s[-1:]in b' \\t':\n output.write(s[:-1]+quote(s[-1:])+lineEnd)\n elif s ==b'.':\n output.write(quote(s)+lineEnd)\n else:\n output.write(s+lineEnd)\n \n prevline=None\n while line :=input.readline():\n outline=[]\n \n stripped=b''\n if line[-1:]==b'\\n':\n line=line[:-1]\n stripped=b'\\n'\n \n for c in line:\n c=bytes((c,))\n if needsquoting(c,quotetabs,header):\n c=quote(c)\n if header and c ==b' ':\n outline.append(b'_')\n else:\n outline.append(c)\n \n if prevline is not None:\n write(prevline)\n \n \n thisline=EMPTYSTRING.join(outline)\n while len(thisline)>MAXLINESIZE:\n \n \n write(thisline[:MAXLINESIZE -1],lineEnd=b'=\\n')\n thisline=thisline[MAXLINESIZE -1:]\n \n prevline=thisline\n \n if prevline is not None:\n write(prevline,lineEnd=stripped)\n \ndef encodestring(s,quotetabs=False,header=False):\n if b2a_qp is not None:\n return b2a_qp(s,quotetabs=quotetabs,header=header)\n from io import BytesIO\n infp=BytesIO(s)\n outfp=BytesIO()\n encode(infp,outfp,quotetabs,header)\n return outfp.getvalue()\n \n \n \ndef decode(input,output,header=False):\n ''\n\n \n \n if a2b_qp is not None:\n data=input.read()\n odata=a2b_qp(data,header=header)\n output.write(odata)\n return\n \n new=b''\n while line :=input.readline():\n i,n=0,len(line)\n if n >0 and line[n -1:n]==b'\\n':\n partial=0 ;n=n -1\n \n while n >0 and line[n -1:n]in b\" \\t\\r\":\n n=n -1\n else:\n partial=1\n while i =n:\n r=getrandbits(k)\n return r\n \n def _randbelow_without_getrandbits(self,n,maxsize=1 <=maxsize:\n _warn(\"Underlying random() generator does not supply \\n\"\n \"enough bits to choose from a population range this large.\\n\"\n \"To remove the range limitation, add a getrandbits() method.\")\n return _floor(random()*n)\n rem=maxsize %n\n limit=(maxsize -rem)/maxsize\n r=random()\n while r >=limit:\n r=random()\n return _floor(r *maxsize)%n\n \n _randbelow=_randbelow_with_getrandbits\n \n \n \n \n \n \n \n \n \n \n \n \n def randbytes(self,n):\n ''\n return self.getrandbits(n *8).to_bytes(n,'little')\n \n \n \n \n def randrange(self,start,stop=None,step=_ONE):\n ''\n\n\n\n\n \n \n \n \n istart=_index(start)\n if stop is None:\n \n \n if step is not _ONE:\n raise TypeError(\"Missing a non-None stop argument\")\n if istart >0:\n return self._randbelow(istart)\n raise ValueError(\"empty range for randrange()\")\n \n \n istop=_index(stop)\n width=istop -istart\n istep=_index(step)\n \n if istep ==1:\n if width >0:\n return istart+self._randbelow(width)\n raise ValueError(f\"empty range in randrange({start}, {stop})\")\n \n \n if istep >0:\n n=(width+istep -1)//istep\n elif istep <0:\n n=(width+istep+1)//istep\n else:\n raise ValueError(\"zero step for randrange()\")\n if n <=0:\n raise ValueError(f\"empty range in randrange({start}, {stop}, {step})\")\n return istart+istep *self._randbelow(n)\n \n def randint(self,a,b):\n ''\n \n \n return self.randrange(a,b+1)\n \n \n \n \n def choice(self,seq):\n ''\n \n \n \n if not len(seq):\n raise IndexError('Cannot choose from an empty sequence')\n return seq[self._randbelow(len(seq))]\n \n def shuffle(self,x):\n ''\n \n randbelow=self._randbelow\n for i in reversed(range(1,len(x))):\n \n j=randbelow(i+1)\n x[i],x[j]=x[j],x[i]\n \n def sample(self,population,k,*,counts=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if not isinstance(population,_Sequence):\n raise TypeError(\"Population must be a sequence. \"\n \"For dicts or sets, use sorted(d).\")\n n=len(population)\n if counts is not None:\n cum_counts=list(_accumulate(counts))\n if len(cum_counts)!=n:\n raise ValueError('The number of counts does not match the population')\n total=cum_counts.pop()\n if not isinstance(total,int):\n raise TypeError('Counts must be integers')\n if total <=0:\n raise ValueError('Total of counts must be greater than zero')\n selections=self.sample(range(total),k=k)\n bisect=_bisect\n return[population[bisect(cum_counts,s)]for s in selections]\n randbelow=self._randbelow\n if not 0 <=k <=n:\n raise ValueError(\"Sample larger than population or is negative\")\n result=[None]*k\n setsize=21\n if k >5:\n setsize +=4 **_ceil(_log(k *3,4))\n if n <=setsize:\n \n \n pool=list(population)\n for i in range(k):\n j=randbelow(n -i)\n result[i]=pool[j]\n pool[j]=pool[n -i -1]\n else:\n selected=set()\n selected_add=selected.add\n for i in range(k):\n j=randbelow(n)\n while j in selected:\n j=randbelow(n)\n selected_add(j)\n result[i]=population[j]\n return result\n \n def choices(self,population,weights=None,*,cum_weights=None,k=1):\n ''\n\n\n\n\n \n random=self.random\n n=len(population)\n if cum_weights is None:\n if weights is None:\n floor=_floor\n n +=0.0\n return[population[floor(random()*n)]for i in _repeat(None,k)]\n try:\n cum_weights=list(_accumulate(weights))\n except TypeError:\n if not isinstance(weights,int):\n raise\n k=weights\n raise TypeError(\n f'The number of choices must be a keyword argument: {k=}'\n )from None\n elif weights is not None:\n raise TypeError('Cannot specify both weights and cumulative weights')\n if len(cum_weights)!=n:\n raise ValueError('The number of weights does not match the population')\n total=cum_weights[-1]+0.0\n if total <=0.0:\n raise ValueError('Total of weights must be greater than zero')\n if not _isfinite(total):\n raise ValueError('Total of weights must be finite')\n bisect=_bisect\n hi=n -1\n return[population[bisect(cum_weights,random()*total,0,hi)]\n for i in _repeat(None,k)]\n \n \n \n \n def uniform(self,a,b):\n ''\n return a+(b -a)*self.random()\n \n def triangular(self,low=0.0,high=1.0,mode=None):\n ''\n\n\n\n\n\n\n \n u=self.random()\n try:\n c=0.5 if mode is None else(mode -low)/(high -low)\n except ZeroDivisionError:\n return low\n if u >c:\n u=1.0 -u\n c=1.0 -c\n low,high=high,low\n return low+(high -low)*_sqrt(u *c)\n \n def normalvariate(self,mu=0.0,sigma=1.0):\n ''\n\n\n\n \n \n \n \n \n \n random=self.random\n while True:\n u1=random()\n u2=1.0 -random()\n z=NV_MAGICCONST *(u1 -0.5)/u2\n zz=z *z /4.0\n if zz <=-_log(u2):\n break\n return mu+z *sigma\n \n def gauss(self,mu=0.0,sigma=1.0):\n ''\n\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n random=self.random\n z=self.gauss_next\n self.gauss_next=None\n if z is None:\n x2pi=random()*TWOPI\n g2rad=_sqrt(-2.0 *_log(1.0 -random()))\n z=_cos(x2pi)*g2rad\n self.gauss_next=_sin(x2pi)*g2rad\n \n return mu+z *sigma\n \n def lognormvariate(self,mu,sigma):\n ''\n\n\n\n\n\n \n return _exp(self.normalvariate(mu,sigma))\n \n def expovariate(self,lambd=1.0):\n ''\n\n\n\n\n\n\n\n \n \n \n \n \n \n return -_log(1.0 -self.random())/lambd\n \n def vonmisesvariate(self,mu,kappa):\n ''\n\n\n\n\n\n\n \n \n \n \n \n \n \n \n random=self.random\n if kappa <=1e-6:\n return TWOPI *random()\n \n s=0.5 /kappa\n r=s+_sqrt(1.0+s *s)\n \n while True:\n u1=random()\n z=_cos(_pi *u1)\n \n d=z /(r+z)\n u2=random()\n if u2 <1.0 -d *d or u2 <=(1.0 -d)*_exp(d):\n break\n \n q=1.0 /r\n f=(q+z)/(1.0+q *z)\n u3=random()\n if u3 >0.5:\n theta=(mu+_acos(f))%TWOPI\n else:\n theta=(mu -_acos(f))%TWOPI\n \n return theta\n \n def gammavariate(self,alpha,beta):\n ''\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n if alpha <=0.0 or beta <=0.0:\n raise ValueError('gammavariate: alpha and beta must be > 0.0')\n \n random=self.random\n if alpha >1.0:\n \n \n \n \n \n ainv=_sqrt(2.0 *alpha -1.0)\n bbb=alpha -LOG4\n ccc=alpha+ainv\n \n while True:\n u1=random()\n if not 1e-7 =0.0 or r >=_log(z):\n return x *beta\n \n elif alpha ==1.0:\n \n return -_log(1.0 -random())*beta\n \n else:\n \n \n while True:\n u=random()\n b=(_e+alpha)/_e\n p=b *u\n if p <=1.0:\n x=p **(1.0 /alpha)\n else:\n x=-_log((b -p)/alpha)\n u1=random()\n if p >1.0:\n if u1 <=x **(alpha -1.0):\n break\n elif u1 <=_exp(-x):\n break\n return x *beta\n \n def betavariate(self,alpha,beta):\n ''\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n y=self.gammavariate(alpha,1.0)\n if y:\n return y /(y+self.gammavariate(beta,1.0))\n return 0.0\n \n def paretovariate(self,alpha):\n ''\n \n \n u=1.0 -self.random()\n return u **(-1.0 /alpha)\n \n def weibullvariate(self,alpha,beta):\n ''\n\n\n\n \n \n \n u=1.0 -self.random()\n return alpha *(-_log(u))**(1.0 /beta)\n \n \n \n \n def binomialvariate(self,n=1,p=0.5):\n ''\n\n\n\n\n\n\n\n\n \n \n if n <0:\n raise ValueError(\"n must be non-negative\")\n if p <=0.0 or p >=1.0:\n if p ==0.0:\n return 0\n if p ==1.0:\n return n\n raise ValueError(\"p must be in the range 0.0 <= p <= 1.0\")\n \n random=self.random\n \n \n if n ==1:\n return _index(random()0.5:\n return n -self.binomialvariate(n,1.0 -p)\n \n if n *p <10.0:\n \n \n x=y=0\n c=_log2(1.0 -p)\n if not c:\n return x\n while True:\n y +=_floor(_log2(random())/c)+1\n if y >n:\n return x\n x +=1\n \n \n \n assert n *p >=10.0 and p <=0.5\n setup_complete=False\n \n spq=_sqrt(n *p *(1.0 -p))\n b=1.15+2.53 *spq\n a=-0.0873+0.0248 *b+0.01 *p\n c=n *p+0.5\n vr=0.92 -4.2 /b\n \n while True:\n \n u=random()\n u -=0.5\n us=0.5 -_fabs(u)\n k=_floor((2.0 *a /us+b)*u+c)\n if k <0 or k >n:\n continue\n \n \n \n v=random()\n if us >=0.07 and v <=vr:\n return k\n \n \n \n \n if not setup_complete:\n alpha=(2.83+5.1 /b)*spq\n lpq=_log(p /(1.0 -p))\n m=_floor((n+1)*p)\n h=_lgamma(m+1)+_lgamma(n -m+1)\n setup_complete=True\n v *=alpha /(a /(us *us)+b)\n if _log(v)<=h -_lgamma(k+1)-_lgamma(n -k+1)+(k -m)*lpq:\n return k\n \n \n \n \n \n \nclass SystemRandom(Random):\n ''\n\n\n\n\n\n \n \n def random(self):\n ''\n return(int.from_bytes(_urandom(7))>>3)*RECIP_BPF\n \n def getrandbits(self,k):\n ''\n if k <0:\n raise ValueError('number of bits must be non-negative')\n numbytes=(k+7)//8\n x=int.from_bytes(_urandom(numbytes))\n return x >>(numbytes *8 -k)\n \n def randbytes(self,n):\n ''\n \n \n return _urandom(n)\n \n def seed(self,*args,**kwds):\n ''\n return None\n \n def _notimplemented(self,*args,**kwds):\n ''\n raise NotImplementedError('System entropy source does not have state.')\n getstate=setstate=_notimplemented\n \n \n \n \n \n \n \n \n \n_inst=Random()\nseed=_inst.seed\nrandom=_inst.random\nuniform=_inst.uniform\ntriangular=_inst.triangular\nrandint=_inst.randint\nchoice=_inst.choice\nrandrange=_inst.randrange\nsample=_inst.sample\nshuffle=_inst.shuffle\nchoices=_inst.choices\nnormalvariate=_inst.normalvariate\nlognormvariate=_inst.lognormvariate\nexpovariate=_inst.expovariate\nvonmisesvariate=_inst.vonmisesvariate\ngammavariate=_inst.gammavariate\ngauss=_inst.gauss\nbetavariate=_inst.betavariate\nbinomialvariate=_inst.binomialvariate\nparetovariate=_inst.paretovariate\nweibullvariate=_inst.weibullvariate\ngetstate=_inst.getstate\nsetstate=_inst.setstate\ngetrandbits=_inst.getrandbits\nrandbytes=_inst.randbytes\n\n\n\n\n\ndef _test_generator(n,func,args):\n from statistics import stdev,fmean as mean\n from time import perf_counter\n \n t0=perf_counter()\n data=[func(*args)for i in _repeat(None,n)]\n t1=perf_counter()\n \n xbar=mean(data)\n sigma=stdev(data,xbar)\n low=min(data)\n high=max(data)\n \n print(f'{t1 -t0:.3f} sec, {n} times {func.__name__}{args !r}')\n print('avg %g, stddev %g, min %g, max %g\\n'%(xbar,sigma,low,high))\n \n \ndef _test(N=10_000):\n _test_generator(N,random,())\n _test_generator(N,normalvariate,(0.0,1.0))\n _test_generator(N,lognormvariate,(0.0,1.0))\n _test_generator(N,vonmisesvariate,(0.0,1.0))\n _test_generator(N,binomialvariate,(15,0.60))\n _test_generator(N,binomialvariate,(100,0.75))\n _test_generator(N,gammavariate,(0.01,1.0))\n _test_generator(N,gammavariate,(0.1,1.0))\n _test_generator(N,gammavariate,(0.1,2.0))\n _test_generator(N,gammavariate,(0.5,1.0))\n _test_generator(N,gammavariate,(0.9,1.0))\n _test_generator(N,gammavariate,(1.0,1.0))\n _test_generator(N,gammavariate,(2.0,1.0))\n _test_generator(N,gammavariate,(20.0,1.0))\n _test_generator(N,gammavariate,(200.0,1.0))\n _test_generator(N,gauss,(0.0,1.0))\n _test_generator(N,betavariate,(3.0,3.0))\n _test_generator(N,triangular,(0.0,1.0,1.0 /3.0))\n \n \n \n \n \nif hasattr(_os,\"fork\"):\n _os.register_at_fork(after_in_child=_inst.seed)\n \n \nif __name__ =='__main__':\n _test()\n", ["_collections_abc", "_random", "_sha512", "bisect", "hashlib", "itertools", "math", "operator", "os", "statistics", "time", "warnings"]], "re": [".py", "from python_re import *\n\nimport python_re\n_compile=python_re._compile\n_reconstructor=python_re._reconstructor\n\npython_re._reconstructor.__module__='re'\n", ["python_re"]], "re1": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nr\"\"\"Support for regular expressions (RE).\n\nThis module provides regular expression matching operations similar to\nthose found in Perl. It supports both 8-bit and Unicode strings; both\nthe pattern and the strings being processed can contain null bytes and\ncharacters outside the US ASCII range.\n\nRegular expressions can contain both special and ordinary characters.\nMost ordinary characters, like \"A\", \"a\", or \"0\", are the simplest\nregular expressions; they simply match themselves. You can\nconcatenate ordinary characters, so last matches the string 'last'.\n\nThe special characters are:\n \".\" Matches any character except a newline.\n \"^\" Matches the start of the string.\n \"$\" Matches the end of the string or just before the newline at\n the end of the string.\n \"*\" Matches 0 or more (greedy) repetitions of the preceding RE.\n Greedy means that it will match as many repetitions as possible.\n \"+\" Matches 1 or more (greedy) repetitions of the preceding RE.\n \"?\" Matches 0 or 1 (greedy) of the preceding RE.\n *?,+?,?? Non-greedy versions of the previous three special characters.\n {m,n} Matches from m to n repetitions of the preceding RE.\n {m,n}? Non-greedy version of the above.\n \"\\\\\" Either escapes special characters or signals a special sequence.\n [] Indicates a set of characters.\n A \"^\" as the first character indicates a complementing set.\n \"|\" A|B, creates an RE that will match either A or B.\n (...) Matches the RE inside the parentheses.\n The contents can be retrieved or matched later in the string.\n (?aiLmsux) The letters set the corresponding flags defined below.\n (?:...) Non-grouping version of regular parentheses.\n (?P...) The substring matched by the group is accessible by name.\n (?P=name) Matches the text matched earlier by the group named name.\n (?#...) A comment; ignored.\n (?=...) Matches if ... matches next, but doesn't consume the string.\n (?!...) Matches if ... doesn't match next.\n (?<=...) Matches if preceded by ... (must be fixed length).\n (?1:\n res=f'~({res})'\n else :\n res=f'~{res}'\n return res\n __str__=object.__str__\nglobals().update(RegexFlag.__members__)\n\n\nerror=sre_compile.error\n\n\n\n\ndef match(pattern,string,flags=0):\n ''\n \n return _compile(pattern,flags).match(string)\n \ndef fullmatch(pattern,string,flags=0):\n ''\n \n return _compile(pattern,flags).fullmatch(string)\n \ndef search(pattern,string,flags=0):\n ''\n \n return _compile(pattern,flags).search(string)\n \ndef sub(pattern,repl,string,count=0,flags=0):\n ''\n\n\n\n\n \n return _compile(pattern,flags).sub(repl,string,count)\n \ndef subn(pattern,repl,string,count=0,flags=0):\n ''\n\n\n\n\n\n\n \n return _compile(pattern,flags).subn(repl,string,count)\n \ndef split(pattern,string,maxsplit=0,flags=0):\n ''\n\n\n\n\n\n \n return _compile(pattern,flags).split(string,maxsplit)\n \ndef findall(pattern,string,flags=0):\n ''\n\n\n\n\n\n \n return _compile(pattern,flags).findall(string)\n \ndef finditer(pattern,string,flags=0):\n ''\n\n\n \n return _compile(pattern,flags).finditer(string)\n \ndef compile(pattern,flags=0):\n ''\n return _compile(pattern,flags)\n \ndef purge():\n ''\n _cache.clear()\n _compile_repl.cache_clear()\n \ndef template(pattern,flags=0):\n ''\n return _compile(pattern,flags |T)\n \n \n \n \n \n \n_special_chars_map={i:'\\\\'+chr(i)for i in b'()[]{}?*+-|^$\\\\.&~# \\t\\n\\r\\v\\f'}\n\ndef escape(pattern):\n ''\n\n \n if isinstance(pattern,str):\n return pattern.translate(_special_chars_map)\n else :\n pattern=str(pattern,'latin1')\n return pattern.translate(_special_chars_map).encode('latin1')\n \nPattern=type(sre_compile.compile('',0))\nMatch=type(sre_compile.compile('',0).match(''))\n\n\n\n\n_cache={}\n\n_MAXCACHE=512\ndef _compile(pattern,flags):\n\n if isinstance(flags,RegexFlag):\n flags=flags.value\n try :\n return _cache[type(pattern),pattern,flags]\n except KeyError:\n pass\n if isinstance(pattern,Pattern):\n if flags:\n raise ValueError(\n \"cannot process flags argument with a compiled pattern\")\n return pattern\n if not sre_compile.isstring(pattern):\n raise TypeError(\"first argument must be string or compiled pattern\")\n p=sre_compile.compile(pattern,flags)\n if not (flags&DEBUG):\n if len(_cache)>=_MAXCACHE:\n \n try :\n del _cache[next(iter(_cache))]\n except (StopIteration,RuntimeError,KeyError):\n pass\n _cache[type(pattern),pattern,flags]=p\n return p\n \n@functools.lru_cache(_MAXCACHE)\ndef _compile_repl(repl,pattern):\n\n return sre_parse.parse_template(repl,pattern)\n \ndef _expand(pattern,match,template):\n\n template=sre_parse.parse_template(template,pattern)\n return sre_parse.expand_template(template,match)\n \ndef _subx(pattern,template):\n\n template=_compile_repl(template,pattern)\n if not template[0]and len(template[1])==1:\n \n return template[1][0]\n def filter(match,template=template):\n return sre_parse.expand_template(template,match)\n return filter\n \n \n \nimport copyreg\n\ndef _pickle(p):\n return _compile,(p.pattern,p.flags)\n \ncopyreg.pickle(Pattern,_pickle,_compile)\n\n\n\n\nclass Scanner:\n def __init__(self,lexicon,flags=0):\n from sre_constants import BRANCH,SUBPATTERN\n if isinstance(flags,RegexFlag):\n flags=flags.value\n self.lexicon=lexicon\n \n p=[]\n s=sre_parse.State()\n s.flags=flags\n for phrase,action in lexicon:\n gid=s.opengroup()\n p.append(sre_parse.SubPattern(s,[\n (SUBPATTERN,(gid,0,0,sre_parse.parse(phrase,flags))),\n ]))\n s.closegroup(gid,p[-1])\n p=sre_parse.SubPattern(s,[(BRANCH,(None ,p))])\n self.scanner=sre_compile.compile(p)\n def scan(self,string):\n result=[]\n append=result.append\n match=self.scanner.scanner(string).match\n i=0\n while True :\n m=match()\n if not m:\n break\n j=m.end()\n if i ==j:\n break\n action=self.lexicon[m.lastindex -1][1]\n if callable(action):\n self.match=m\n action=action(self,m.group())\n if action is not None :\n append(action)\n i=j\n return result,string[i:]\n", ["_locale", "copyreg", "enum", "functools", "sre_compile", "sre_constants", "sre_parse"]], "reprlib": [".py", "''\n\n__all__=[\"Repr\",\"repr\",\"recursive_repr\"]\n\nimport builtins\nfrom itertools import islice\nfrom _thread import get_ident\n\ndef recursive_repr(fillvalue='...'):\n ''\n \n def decorating_function(user_function):\n repr_running=set()\n \n def wrapper(self):\n key=id(self),get_ident()\n if key in repr_running:\n return fillvalue\n repr_running.add(key)\n try:\n result=user_function(self)\n finally:\n repr_running.discard(key)\n return result\n \n \n wrapper.__module__=getattr(user_function,'__module__')\n wrapper.__doc__=getattr(user_function,'__doc__')\n wrapper.__name__=getattr(user_function,'__name__')\n wrapper.__qualname__=getattr(user_function,'__qualname__')\n wrapper.__annotations__=getattr(user_function,'__annotations__',{})\n return wrapper\n \n return decorating_function\n \nclass Repr:\n\n def __init__(\n self,*,maxlevel=6,maxtuple=6,maxlist=6,maxarray=5,maxdict=4,\n maxset=6,maxfrozenset=6,maxdeque=6,maxstring=30,maxlong=40,\n maxother=30,fillvalue='...',indent=None,\n ):\n self.maxlevel=maxlevel\n self.maxtuple=maxtuple\n self.maxlist=maxlist\n self.maxarray=maxarray\n self.maxdict=maxdict\n self.maxset=maxset\n self.maxfrozenset=maxfrozenset\n self.maxdeque=maxdeque\n self.maxstring=maxstring\n self.maxlong=maxlong\n self.maxother=maxother\n self.fillvalue=fillvalue\n self.indent=indent\n \n def repr(self,x):\n return self.repr1(x,self.maxlevel)\n \n def repr1(self,x,level):\n typename=type(x).__name__\n if ' 'in typename:\n parts=typename.split()\n typename='_'.join(parts)\n if hasattr(self,'repr_'+typename):\n return getattr(self,'repr_'+typename)(x,level)\n else:\n return self.repr_instance(x,level)\n \n def _join(self,pieces,level):\n if self.indent is None:\n return ', '.join(pieces)\n if not pieces:\n return ''\n indent=self.indent\n if isinstance(indent,int):\n if indent <0:\n raise ValueError(\n f'Repr.indent cannot be negative int (was {indent !r})'\n )\n indent *=' '\n try:\n sep=',\\n'+(self.maxlevel -level+1)*indent\n except TypeError as error:\n raise TypeError(\n f'Repr.indent must be a str, int or None, not {type(indent)}'\n )from error\n return sep.join(('',*pieces,''))[1:-len(indent)or None]\n \n def _repr_iterable(self,x,level,left,right,maxiter,trail=''):\n n=len(x)\n if level <=0 and n:\n s=self.fillvalue\n else:\n newlevel=level -1\n repr1=self.repr1\n pieces=[repr1(elem,newlevel)for elem in islice(x,maxiter)]\n if n >maxiter:\n pieces.append(self.fillvalue)\n s=self._join(pieces,level)\n if n ==1 and trail and self.indent is None:\n right=trail+right\n return '%s%s%s'%(left,s,right)\n \n def repr_tuple(self,x,level):\n return self._repr_iterable(x,level,'(',')',self.maxtuple,',')\n \n def repr_list(self,x,level):\n return self._repr_iterable(x,level,'[',']',self.maxlist)\n \n def repr_array(self,x,level):\n if not x:\n return \"array('%s')\"%x.typecode\n header=\"array('%s', [\"%x.typecode\n return self._repr_iterable(x,level,header,'])',self.maxarray)\n \n def repr_set(self,x,level):\n if not x:\n return 'set()'\n x=_possibly_sorted(x)\n return self._repr_iterable(x,level,'{','}',self.maxset)\n \n def repr_frozenset(self,x,level):\n if not x:\n return 'frozenset()'\n x=_possibly_sorted(x)\n return self._repr_iterable(x,level,'frozenset({','})',\n self.maxfrozenset)\n \n def repr_deque(self,x,level):\n return self._repr_iterable(x,level,'deque([','])',self.maxdeque)\n \n def repr_dict(self,x,level):\n n=len(x)\n if n ==0:\n return '{}'\n if level <=0:\n return '{'+self.fillvalue+'}'\n newlevel=level -1\n repr1=self.repr1\n pieces=[]\n for key in islice(_possibly_sorted(x),self.maxdict):\n keyrepr=repr1(key,newlevel)\n valrepr=repr1(x[key],newlevel)\n pieces.append('%s: %s'%(keyrepr,valrepr))\n if n >self.maxdict:\n pieces.append(self.fillvalue)\n s=self._join(pieces,level)\n return '{%s}'%(s,)\n \n def repr_str(self,x,level):\n s=builtins.repr(x[:self.maxstring])\n if len(s)>self.maxstring:\n i=max(0,(self.maxstring -3)//2)\n j=max(0,self.maxstring -3 -i)\n s=builtins.repr(x[:i]+x[len(x)-j:])\n s=s[:i]+self.fillvalue+s[len(s)-j:]\n return s\n \n def repr_int(self,x,level):\n s=builtins.repr(x)\n if len(s)>self.maxlong:\n i=max(0,(self.maxlong -3)//2)\n j=max(0,self.maxlong -3 -i)\n s=s[:i]+self.fillvalue+s[len(s)-j:]\n return s\n \n def repr_instance(self,x,level):\n try:\n s=builtins.repr(x)\n \n \n except Exception:\n return '<%s instance at %#x>'%(x.__class__.__name__,id(x))\n if len(s)>self.maxother:\n i=max(0,(self.maxother -3)//2)\n j=max(0,self.maxother -3 -i)\n s=s[:i]+self.fillvalue+s[len(s)-j:]\n return s\n \n \ndef _possibly_sorted(x):\n\n\n\n try:\n return sorted(x)\n except Exception:\n return list(x)\n \naRepr=Repr()\nrepr=aRepr.repr\n", ["_thread", "builtins", "itertools"]], "secrets": [".py", "''\n\n\n\n\n\n\n\n__all__=['choice','randbelow','randbits','SystemRandom',\n'token_bytes','token_hex','token_urlsafe',\n'compare_digest',\n]\n\n\nimport base64\n\nfrom hmac import compare_digest\nfrom random import SystemRandom\n\n_sysrand=SystemRandom()\n\nrandbits=_sysrand.getrandbits\nchoice=_sysrand.choice\n\ndef randbelow(exclusive_upper_bound):\n ''\n if exclusive_upper_bound <=0:\n raise ValueError(\"Upper bound must be positive.\")\n return _sysrand._randbelow(exclusive_upper_bound)\n \nDEFAULT_ENTROPY=32\n\ndef token_bytes(nbytes=None):\n ''\n\n\n\n\n\n\n\n \n if nbytes is None:\n nbytes=DEFAULT_ENTROPY\n return _sysrand.randbytes(nbytes)\n \ndef token_hex(nbytes=None):\n ''\n\n\n\n\n\n\n\n\n \n return token_bytes(nbytes).hex()\n \ndef token_urlsafe(nbytes=None):\n ''\n\n\n\n\n\n\n\n \n tok=token_bytes(nbytes)\n return base64.urlsafe_b64encode(tok).rstrip(b'=').decode('ascii')\n", ["base64", "hmac", "random"]], "select": [".py", "''\n\n\n\n\nimport errno\nimport os\n\nclass error(Exception):\n pass\n \nALL=None\n\n_exception_map={}\n\ndef _map_exception(exc,circumstance=ALL):\n try :\n mapped_exception=_exception_map[(exc.__class__,circumstance)]\n mapped_exception.java_exception=exc\n return mapped_exception\n except KeyError:\n return error(-1,'Unmapped java exception: <%s:%s>'%(exc.toString(),circumstance))\n \nPOLLIN=1\nPOLLOUT=2\n\n\n\n\n\nPOLLPRI=4\nPOLLERR=8\nPOLLHUP=16\nPOLLNVAL=32\n\ndef _getselectable(selectable_object):\n try :\n channel=selectable_object.getchannel()\n except :\n try :\n channel=selectable_object.fileno().getChannel()\n except :\n raise TypeError(\"Object '%s' is not watchable\"%selectable_object,\n errno.ENOTSOCK)\n \n return channel\n \n \nclass Selector:\n\n def close(self):\n pass\n \n def keys(self):\n return []\n \n def select(self,timeout=None ):\n return []\n \n def selectedKeys(self):\n class SelectedKeys:\n def iterator(self):\n return []\n return SelectedKeys()\n \n def selectNow(self,timeout=None ):\n return []\n \nclass poll:\n\n def __init__(self):\n self.selector=Selector()\n self.chanmap={}\n self.unconnected_sockets=[]\n \n def _register_channel(self,socket_object,channel,mask):\n jmask=0\n if mask&POLLIN:\n \n if channel.validOps()&OP_ACCEPT:\n jmask=OP_ACCEPT\n else :\n jmask=OP_READ\n if mask&POLLOUT:\n if channel.validOps()&OP_WRITE:\n jmask |=OP_WRITE\n if channel.validOps()&OP_CONNECT:\n jmask |=OP_CONNECT\n selectionkey=channel.register(self.selector,jmask)\n self.chanmap[channel]=(socket_object,selectionkey)\n \n def _check_unconnected_sockets(self):\n temp_list=[]\n for socket_object,mask in self.unconnected_sockets:\n channel=_getselectable(socket_object)\n if channel is not None :\n self._register_channel(socket_object,channel,mask)\n else :\n temp_list.append((socket_object,mask))\n self.unconnected_sockets=temp_list\n \n def register(self,socket_object,mask=POLLIN |POLLOUT |POLLPRI):\n try :\n channel=_getselectable(socket_object)\n if channel is None :\n \n \n self.unconnected_sockets.append((socket_object,mask))\n return\n self._register_channel(socket_object,channel,mask)\n except BaseException as exc:\n raise _map_exception(exc)\n \n def unregister(self,socket_object):\n try :\n channel=_getselectable(socket_object)\n self.chanmap[channel][1].cancel()\n del self.chanmap[channel]\n except BaseException as exc:\n raise _map_exception(exc)\n \n def _dopoll(self,timeout):\n if timeout is None or timeout <0:\n self.selector.select()\n else :\n try :\n timeout=int(timeout)\n if not timeout:\n self.selector.selectNow()\n else :\n \n self.selector.select(timeout)\n except ValueError as vx:\n raise error(\"poll timeout must be a number of milliseconds or None\",errno.EINVAL)\n \n return self.selector.selectedKeys()\n \n def poll(self,timeout=None ):\n return []\n \n def _deregister_all(self):\n try :\n for k in self.selector.keys():\n k.cancel()\n \n self.selector.selectNow()\n except BaseException as exc:\n raise _map_exception(exc)\n \n def close(self):\n try :\n self._deregister_all()\n self.selector.close()\n except BaseException as exc:\n raise _map_exception(exc)\n \ndef _calcselecttimeoutvalue(value):\n if value is None :\n return None\n try :\n floatvalue=float(value)\n except Exception as x:\n raise TypeError(\"Select timeout value must be a number or None\")\n if value <0:\n raise error(\"Select timeout value cannot be negative\",errno.EINVAL)\n if floatvalue <0.000001:\n return 0\n return int(floatvalue *1000)\n \n \n \n \nclass poll_object_cache:\n\n def __init__(self):\n self.is_windows=os.name =='nt'\n if self.is_windows:\n self.poll_object_queue=Queue.Queue()\n import atexit\n atexit.register(self.finalize)\n \n def get_poll_object(self):\n if not self.is_windows:\n return poll()\n try :\n return self.poll_object_queue.get(False )\n except Queue.Empty:\n return poll()\n \n def release_poll_object(self,pobj):\n if self.is_windows:\n pobj._deregister_all()\n self.poll_object_queue.put(pobj)\n else :\n pobj.close()\n \n def finalize(self):\n if self.is_windows:\n while True :\n try :\n p=self.poll_object_queue.get(False )\n p.close()\n except Queue.Empty:\n return\n \n_poll_object_cache=poll_object_cache()\n\ndef native_select(read_fd_list,write_fd_list,outofband_fd_list,timeout=None ):\n timeout=_calcselecttimeoutvalue(timeout)\n \n pobj=_poll_object_cache.get_poll_object()\n try :\n registered_for_read={}\n \n for fd in read_fd_list:\n pobj.register(fd,POLLIN)\n registered_for_read[fd]=1\n \n for fd in write_fd_list:\n if fd in registered_for_read:\n \n pobj.register(fd,POLLIN |POLLOUT)\n else :\n pobj.register(fd,POLLOUT)\n results=pobj.poll(timeout)\n \n read_ready_list,write_ready_list,oob_ready_list=[],[],[]\n for fd,mask in results:\n if mask&POLLIN:\n read_ready_list.append(fd)\n if mask&POLLOUT:\n write_ready_list.append(fd)\n return read_ready_list,write_ready_list,oob_ready_list\n finally :\n _poll_object_cache.release_poll_object(pobj)\n \nselect=native_select\n\ndef cpython_compatible_select(read_fd_list,write_fd_list,outofband_fd_list,timeout=None ):\n\n\n modified_channels=[]\n try :\n for socket_list in [read_fd_list,write_fd_list,outofband_fd_list]:\n for s in socket_list:\n channel=_getselectable(s)\n if channel.isBlocking():\n modified_channels.append(channel)\n channel.configureBlocking(0)\n return native_select(read_fd_list,write_fd_list,outofband_fd_list,timeout)\n finally :\n for channel in modified_channels:\n channel.configureBlocking(1)\n", ["atexit", "errno", "os"]], "selectors": [".py", "''\n\n\n\n\n\n\nfrom abc import ABCMeta,abstractmethod\nfrom collections import namedtuple\nfrom collections.abc import Mapping\nimport math\nimport select\nimport sys\n\n\n\nEVENT_READ=(1 <<0)\nEVENT_WRITE=(1 <<1)\n\n\ndef _fileobj_to_fd(fileobj):\n ''\n\n\n\n\n\n\n\n\n\n \n if isinstance(fileobj,int):\n fd=fileobj\n else :\n try :\n fd=int(fileobj.fileno())\n except (AttributeError,TypeError,ValueError):\n raise ValueError(\"Invalid file object: \"\n \"{!r}\".format(fileobj))from None\n if fd <0:\n raise ValueError(\"Invalid file descriptor: {}\".format(fd))\n return fd\n \n \nSelectorKey=namedtuple('SelectorKey',['fileobj','fd','events','data'])\n\nSelectorKey.__doc__=\"\"\"SelectorKey(fileobj, fd, events, data)\n\n Object used to associate a file object to its backing\n file descriptor, selected event mask, and attached data.\n\"\"\"\nSelectorKey.fileobj.__doc__='File object registered.'\nSelectorKey.fd.__doc__='Underlying file descriptor.'\nSelectorKey.events.__doc__='Events that must be waited for on this file object.'\nSelectorKey.data.__doc__=('''Optional opaque data associated to this file object.\nFor example, this could be used to store a per-client session ID.''')\n\n\nclass _SelectorMapping(Mapping):\n ''\n \n def __init__(self,selector):\n self._selector=selector\n \n def __len__(self):\n return len(self._selector._fd_to_key)\n \n def __getitem__(self,fileobj):\n try :\n fd=self._selector._fileobj_lookup(fileobj)\n return self._selector._fd_to_key[fd]\n except KeyError:\n raise KeyError(\"{!r} is not registered\".format(fileobj))from None\n \n def __iter__(self):\n return iter(self._selector._fd_to_key)\n \n \nclass BaseSelector(metaclass=ABCMeta):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n @abstractmethod\n def register(self,fileobj,events,data=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n @abstractmethod\n def unregister(self,fileobj):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n def modify(self,fileobj,events,data=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n self.unregister(fileobj)\n return self.register(fileobj,events,data)\n \n @abstractmethod\n def select(self,timeout=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise NotImplementedError\n \n def close(self):\n ''\n\n\n \n pass\n \n def get_key(self,fileobj):\n ''\n\n\n\n \n mapping=self.get_map()\n if mapping is None :\n raise RuntimeError('Selector is closed')\n try :\n return mapping[fileobj]\n except KeyError:\n raise KeyError(\"{!r} is not registered\".format(fileobj))from None\n \n @abstractmethod\n def get_map(self):\n ''\n raise NotImplementedError\n \n def __enter__(self):\n return self\n \n def __exit__(self,*args):\n self.close()\n \n \nclass _BaseSelectorImpl(BaseSelector):\n ''\n \n def __init__(self):\n \n self._fd_to_key={}\n \n self._map=_SelectorMapping(self)\n \n def _fileobj_lookup(self,fileobj):\n ''\n\n\n\n\n\n\n \n try :\n return _fileobj_to_fd(fileobj)\n except ValueError:\n \n for key in self._fd_to_key.values():\n if key.fileobj is fileobj:\n return key.fd\n \n raise\n \n def register(self,fileobj,events,data=None ):\n if (not events)or (events&~(EVENT_READ |EVENT_WRITE)):\n raise ValueError(\"Invalid events: {!r}\".format(events))\n \n key=SelectorKey(fileobj,self._fileobj_lookup(fileobj),events,data)\n \n if key.fd in self._fd_to_key:\n raise KeyError(\"{!r} (FD {}) is already registered\"\n .format(fileobj,key.fd))\n \n self._fd_to_key[key.fd]=key\n return key\n \n def unregister(self,fileobj):\n try :\n key=self._fd_to_key.pop(self._fileobj_lookup(fileobj))\n except KeyError:\n raise KeyError(\"{!r} is not registered\".format(fileobj))from None\n return key\n \n def modify(self,fileobj,events,data=None ):\n try :\n key=self._fd_to_key[self._fileobj_lookup(fileobj)]\n except KeyError:\n raise KeyError(\"{!r} is not registered\".format(fileobj))from None\n if events !=key.events:\n self.unregister(fileobj)\n key=self.register(fileobj,events,data)\n elif data !=key.data:\n \n key=key._replace(data=data)\n self._fd_to_key[key.fd]=key\n return key\n \n def close(self):\n self._fd_to_key.clear()\n self._map=None\n \n def get_map(self):\n return self._map\n \n def _key_from_fd(self,fd):\n ''\n\n\n\n\n\n\n \n try :\n return self._fd_to_key[fd]\n except KeyError:\n return None\n \n \nclass SelectSelector(_BaseSelectorImpl):\n ''\n \n def __init__(self):\n super().__init__()\n self._readers=set()\n self._writers=set()\n \n def register(self,fileobj,events,data=None ):\n key=super().register(fileobj,events,data)\n if events&EVENT_READ:\n self._readers.add(key.fd)\n if events&EVENT_WRITE:\n self._writers.add(key.fd)\n return key\n \n def unregister(self,fileobj):\n key=super().unregister(fileobj)\n self._readers.discard(key.fd)\n self._writers.discard(key.fd)\n return key\n \n if sys.platform =='win32':\n def _select(self,r,w,_,timeout=None ):\n r,w,x=select.select(r,w,w,timeout)\n return r,w+x,[]\n else :\n _select=select.select\n \n def select(self,timeout=None ):\n timeout=None if timeout is None else max(timeout,0)\n ready=[]\n try :\n r,w,_=self._select(self._readers,self._writers,[],timeout)\n except InterruptedError:\n return ready\n r=set(r)\n w=set(w)\n for fd in r |w:\n events=0\n if fd in r:\n events |=EVENT_READ\n if fd in w:\n events |=EVENT_WRITE\n \n key=self._key_from_fd(fd)\n if key:\n ready.append((key,events&key.events))\n return ready\n \n \nclass _PollLikeSelector(_BaseSelectorImpl):\n ''\n _selector_cls=None\n _EVENT_READ=None\n _EVENT_WRITE=None\n \n def __init__(self):\n super().__init__()\n self._selector=self._selector_cls()\n \n def register(self,fileobj,events,data=None ):\n key=super().register(fileobj,events,data)\n poller_events=0\n if events&EVENT_READ:\n poller_events |=self._EVENT_READ\n if events&EVENT_WRITE:\n poller_events |=self._EVENT_WRITE\n try :\n self._selector.register(key.fd,poller_events)\n except :\n super().unregister(fileobj)\n raise\n return key\n \n def unregister(self,fileobj):\n key=super().unregister(fileobj)\n try :\n self._selector.unregister(key.fd)\n except OSError:\n \n \n pass\n return key\n \n def modify(self,fileobj,events,data=None ):\n try :\n key=self._fd_to_key[self._fileobj_lookup(fileobj)]\n except KeyError:\n raise KeyError(f\"{fileobj!r} is not registered\")from None\n \n changed=False\n if events !=key.events:\n selector_events=0\n if events&EVENT_READ:\n selector_events |=self._EVENT_READ\n if events&EVENT_WRITE:\n selector_events |=self._EVENT_WRITE\n try :\n self._selector.modify(key.fd,selector_events)\n except :\n super().unregister(fileobj)\n raise\n changed=True\n if data !=key.data:\n changed=True\n \n if changed:\n key=key._replace(events=events,data=data)\n self._fd_to_key[key.fd]=key\n return key\n \n def select(self,timeout=None ):\n \n \n if timeout is None :\n timeout=None\n elif timeout <=0:\n timeout=0\n else :\n \n \n timeout=math.ceil(timeout *1e3)\n ready=[]\n try :\n fd_event_list=self._selector.poll(timeout)\n except InterruptedError:\n return ready\n for fd,event in fd_event_list:\n events=0\n if event&~self._EVENT_READ:\n events |=EVENT_WRITE\n if event&~self._EVENT_WRITE:\n events |=EVENT_READ\n \n key=self._key_from_fd(fd)\n if key:\n ready.append((key,events&key.events))\n return ready\n \n \nif hasattr(select,'poll'):\n\n class PollSelector(_PollLikeSelector):\n ''\n _selector_cls=select.poll\n _EVENT_READ=select.POLLIN\n _EVENT_WRITE=select.POLLOUT\n \n \nif hasattr(select,'epoll'):\n\n class EpollSelector(_PollLikeSelector):\n ''\n _selector_cls=select.epoll\n _EVENT_READ=select.EPOLLIN\n _EVENT_WRITE=select.EPOLLOUT\n \n def fileno(self):\n return self._selector.fileno()\n \n def select(self,timeout=None ):\n if timeout is None :\n timeout=-1\n elif timeout <=0:\n timeout=0\n else :\n \n \n timeout=math.ceil(timeout *1e3)*1e-3\n \n \n \n \n max_ev=max(len(self._fd_to_key),1)\n \n ready=[]\n try :\n fd_event_list=self._selector.poll(timeout,max_ev)\n except InterruptedError:\n return ready\n for fd,event in fd_event_list:\n events=0\n if event&~select.EPOLLIN:\n events |=EVENT_WRITE\n if event&~select.EPOLLOUT:\n events |=EVENT_READ\n \n key=self._key_from_fd(fd)\n if key:\n ready.append((key,events&key.events))\n return ready\n \n def close(self):\n self._selector.close()\n super().close()\n \n \nif hasattr(select,'devpoll'):\n\n class DevpollSelector(_PollLikeSelector):\n ''\n _selector_cls=select.devpoll\n _EVENT_READ=select.POLLIN\n _EVENT_WRITE=select.POLLOUT\n \n def fileno(self):\n return self._selector.fileno()\n \n def close(self):\n self._selector.close()\n super().close()\n \n \nif hasattr(select,'kqueue'):\n\n class KqueueSelector(_BaseSelectorImpl):\n ''\n \n def __init__(self):\n super().__init__()\n self._selector=select.kqueue()\n \n def fileno(self):\n return self._selector.fileno()\n \n def register(self,fileobj,events,data=None ):\n key=super().register(fileobj,events,data)\n try :\n if events&EVENT_READ:\n kev=select.kevent(key.fd,select.KQ_FILTER_READ,\n select.KQ_EV_ADD)\n self._selector.control([kev],0,0)\n if events&EVENT_WRITE:\n kev=select.kevent(key.fd,select.KQ_FILTER_WRITE,\n select.KQ_EV_ADD)\n self._selector.control([kev],0,0)\n except :\n super().unregister(fileobj)\n raise\n return key\n \n def unregister(self,fileobj):\n key=super().unregister(fileobj)\n if key.events&EVENT_READ:\n kev=select.kevent(key.fd,select.KQ_FILTER_READ,\n select.KQ_EV_DELETE)\n try :\n self._selector.control([kev],0,0)\n except OSError:\n \n \n pass\n if key.events&EVENT_WRITE:\n kev=select.kevent(key.fd,select.KQ_FILTER_WRITE,\n select.KQ_EV_DELETE)\n try :\n self._selector.control([kev],0,0)\n except OSError:\n \n pass\n return key\n \n def select(self,timeout=None ):\n timeout=None if timeout is None else max(timeout,0)\n \n \n \n max_ev=max(len(self._fd_to_key),1)\n ready=[]\n try :\n kev_list=self._selector.control(None ,max_ev,timeout)\n except InterruptedError:\n return ready\n for kev in kev_list:\n fd=kev.ident\n flag=kev.filter\n events=0\n if flag ==select.KQ_FILTER_READ:\n events |=EVENT_READ\n if flag ==select.KQ_FILTER_WRITE:\n events |=EVENT_WRITE\n \n key=self._key_from_fd(fd)\n if key:\n ready.append((key,events&key.events))\n return ready\n \n def close(self):\n self._selector.close()\n super().close()\n \n \ndef _can_use(method):\n ''\n \n \n selector=getattr(select,method,None )\n if selector is None :\n \n return False\n \n \n try :\n selector_obj=selector()\n if method =='poll':\n \n selector_obj.poll(0)\n else :\n \n selector_obj.close()\n return True\n except OSError:\n return False\n \n \n \n \n \nif _can_use('kqueue'):\n DefaultSelector=KqueueSelector\nelif _can_use('epoll'):\n DefaultSelector=EpollSelector\nelif _can_use('devpoll'):\n DefaultSelector=DevpollSelector\nelif _can_use('poll'):\n DefaultSelector=PollSelector\nelse :\n DefaultSelector=SelectSelector\n", ["abc", "collections", "collections.abc", "math", "select", "sys"]], "shlex": [".py", "''\n\n\n\n\n\n\n\n\nimport os\nimport re\nimport sys\nfrom collections import deque\n\nfrom io import StringIO\n\n__all__=[\"shlex\",\"split\",\"quote\",\"join\"]\n\nclass shlex:\n ''\n def __init__(self,instream=None,infile=None,posix=False,\n punctuation_chars=False):\n if isinstance(instream,str):\n instream=StringIO(instream)\n if instream is not None:\n self.instream=instream\n self.infile=infile\n else:\n self.instream=sys.stdin\n self.infile=None\n self.posix=posix\n if posix:\n self.eof=None\n else:\n self.eof=''\n self.commenters='#'\n self.wordchars=('abcdfeghijklmnopqrstuvwxyz'\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_')\n if self.posix:\n self.wordchars +=('\u00df\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff'\n '\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d8\u00d9\u00da\u00db\u00dc\u00dd\u00de')\n self.whitespace=' \\t\\r\\n'\n self.whitespace_split=False\n self.quotes='\\'\"'\n self.escape='\\\\'\n self.escapedquotes='\"'\n self.state=' '\n self.pushback=deque()\n self.lineno=1\n self.debug=0\n self.token=''\n self.filestack=deque()\n self.source=None\n if not punctuation_chars:\n punctuation_chars=''\n elif punctuation_chars is True:\n punctuation_chars='();<>|&'\n self._punctuation_chars=punctuation_chars\n if punctuation_chars:\n \n self._pushback_chars=deque()\n \n self.wordchars +='~-./*?='\n \n t=self.wordchars.maketrans(dict.fromkeys(punctuation_chars))\n self.wordchars=self.wordchars.translate(t)\n \n @property\n def punctuation_chars(self):\n return self._punctuation_chars\n \n def push_token(self,tok):\n ''\n if self.debug >=1:\n print(\"shlex: pushing token \"+repr(tok))\n self.pushback.appendleft(tok)\n \n def push_source(self,newstream,newfile=None):\n ''\n if isinstance(newstream,str):\n newstream=StringIO(newstream)\n self.filestack.appendleft((self.infile,self.instream,self.lineno))\n self.infile=newfile\n self.instream=newstream\n self.lineno=1\n if self.debug:\n if newfile is not None:\n print('shlex: pushing to file %s'%(self.infile,))\n else:\n print('shlex: pushing to stream %s'%(self.instream,))\n \n def pop_source(self):\n ''\n self.instream.close()\n (self.infile,self.instream,self.lineno)=self.filestack.popleft()\n if self.debug:\n print('shlex: popping to %s, line %d'\\\n %(self.instream,self.lineno))\n self.state=' '\n \n def get_token(self):\n ''\n if self.pushback:\n tok=self.pushback.popleft()\n if self.debug >=1:\n print(\"shlex: popping token \"+repr(tok))\n return tok\n \n raw=self.read_token()\n \n if self.source is not None:\n while raw ==self.source:\n spec=self.sourcehook(self.read_token())\n if spec:\n (newfile,newstream)=spec\n self.push_source(newstream,newfile)\n raw=self.get_token()\n \n while raw ==self.eof:\n if not self.filestack:\n return self.eof\n else:\n self.pop_source()\n raw=self.get_token()\n \n if self.debug >=1:\n if raw !=self.eof:\n print(\"shlex: token=\"+repr(raw))\n else:\n print(\"shlex: token=EOF\")\n return raw\n \n def read_token(self):\n quoted=False\n escapedstate=' '\n while True:\n if self.punctuation_chars and self._pushback_chars:\n nextchar=self._pushback_chars.pop()\n else:\n nextchar=self.instream.read(1)\n if nextchar =='\\n':\n self.lineno +=1\n if self.debug >=3:\n print(\"shlex: in state %r I see character: %r\"%(self.state,\n nextchar))\n if self.state is None:\n self.token=''\n break\n elif self.state ==' ':\n if not nextchar:\n self.state=None\n break\n elif nextchar in self.whitespace:\n if self.debug >=2:\n print(\"shlex: I see whitespace in whitespace state\")\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n elif nextchar in self.commenters:\n self.instream.readline()\n self.lineno +=1\n elif self.posix and nextchar in self.escape:\n escapedstate='a'\n self.state=nextchar\n elif nextchar in self.wordchars:\n self.token=nextchar\n self.state='a'\n elif nextchar in self.punctuation_chars:\n self.token=nextchar\n self.state='c'\n elif nextchar in self.quotes:\n if not self.posix:\n self.token=nextchar\n self.state=nextchar\n elif self.whitespace_split:\n self.token=nextchar\n self.state='a'\n else:\n self.token=nextchar\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n elif self.state in self.quotes:\n quoted=True\n if not nextchar:\n if self.debug >=2:\n print(\"shlex: I see EOF in quotes state\")\n \n raise ValueError(\"No closing quotation\")\n if nextchar ==self.state:\n if not self.posix:\n self.token +=nextchar\n self.state=' '\n break\n else:\n self.state='a'\n elif(self.posix and nextchar in self.escape and self.state\n in self.escapedquotes):\n escapedstate=self.state\n self.state=nextchar\n else:\n self.token +=nextchar\n elif self.state in self.escape:\n if not nextchar:\n if self.debug >=2:\n print(\"shlex: I see EOF in escape state\")\n \n raise ValueError(\"No escaped character\")\n \n \n if(escapedstate in self.quotes and\n nextchar !=self.state and nextchar !=escapedstate):\n self.token +=self.state\n self.token +=nextchar\n self.state=escapedstate\n elif self.state in('a','c'):\n if not nextchar:\n self.state=None\n break\n elif nextchar in self.whitespace:\n if self.debug >=2:\n print(\"shlex: I see whitespace in word state\")\n self.state=' '\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n elif nextchar in self.commenters:\n self.instream.readline()\n self.lineno +=1\n if self.posix:\n self.state=' '\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n elif self.state =='c':\n if nextchar in self.punctuation_chars:\n self.token +=nextchar\n else:\n if nextchar not in self.whitespace:\n self._pushback_chars.append(nextchar)\n self.state=' '\n break\n elif self.posix and nextchar in self.quotes:\n self.state=nextchar\n elif self.posix and nextchar in self.escape:\n escapedstate='a'\n self.state=nextchar\n elif(nextchar in self.wordchars or nextchar in self.quotes\n or(self.whitespace_split and\n nextchar not in self.punctuation_chars)):\n self.token +=nextchar\n else:\n if self.punctuation_chars:\n self._pushback_chars.append(nextchar)\n else:\n self.pushback.appendleft(nextchar)\n if self.debug >=2:\n print(\"shlex: I see punctuation in word state\")\n self.state=' '\n if self.token or(self.posix and quoted):\n break\n else:\n continue\n result=self.token\n self.token=''\n if self.posix and not quoted and result =='':\n result=None\n if self.debug >1:\n if result:\n print(\"shlex: raw token=\"+repr(result))\n else:\n print(\"shlex: raw token=EOF\")\n return result\n \n def sourcehook(self,newfile):\n ''\n if newfile[0]=='\"':\n newfile=newfile[1:-1]\n \n if isinstance(self.infile,str)and not os.path.isabs(newfile):\n newfile=os.path.join(os.path.dirname(self.infile),newfile)\n return(newfile,open(newfile,\"r\"))\n \n def error_leader(self,infile=None,lineno=None):\n ''\n if infile is None:\n infile=self.infile\n if lineno is None:\n lineno=self.lineno\n return \"\\\"%s\\\", line %d: \"%(infile,lineno)\n \n def __iter__(self):\n return self\n \n def __next__(self):\n token=self.get_token()\n if token ==self.eof:\n raise StopIteration\n return token\n \ndef split(s,comments=False,posix=True):\n ''\n if s is None:\n raise ValueError(\"s argument must not be None\")\n lex=shlex(s,posix=posix)\n lex.whitespace_split=True\n if not comments:\n lex.commenters=''\n return list(lex)\n \n \ndef join(split_command):\n ''\n return ' '.join(quote(arg)for arg in split_command)\n \n \n_find_unsafe=re.compile(r'[^\\w@%+=:,./-]',re.ASCII).search\n\ndef quote(s):\n ''\n if not s:\n return \"''\"\n if _find_unsafe(s)is None:\n return s\n \n \n \n return \"'\"+s.replace(\"'\",\"'\\\"'\\\"'\")+\"'\"\n \n \ndef _print_tokens(lexer):\n while tt :=lexer.get_token():\n print(\"Token: \"+repr(tt))\n \nif __name__ =='__main__':\n if len(sys.argv)==1:\n _print_tokens(shlex())\n else:\n fn=sys.argv[1]\n with open(fn)as f:\n _print_tokens(shlex(f,fn))\n", ["collections", "io", "os", "re", "sys"]], "shutil": [".py", "''\n\n\n\n\n\nimport os\nimport sys\nimport stat\nimport fnmatch\nimport collections\nimport errno\n\ntry :\n import zlib\n del zlib\n _ZLIB_SUPPORTED=True\nexcept ImportError:\n _ZLIB_SUPPORTED=False\n \ntry :\n import bz2\n del bz2\n _BZ2_SUPPORTED=True\nexcept ImportError:\n _BZ2_SUPPORTED=False\n \ntry :\n import lzma\n del lzma\n _LZMA_SUPPORTED=True\nexcept ImportError:\n _LZMA_SUPPORTED=False\n \n_WINDOWS=os.name =='nt'\nposix=nt=None\nif os.name =='posix':\n import posix\nelif _WINDOWS:\n import nt\n \nCOPY_BUFSIZE=1024 *1024 if _WINDOWS else 64 *1024\n_USE_CP_SENDFILE=hasattr(os,\"sendfile\")and sys.platform.startswith(\"linux\")\n_HAS_FCOPYFILE=posix and hasattr(posix,\"_fcopyfile\")\n\n\n_WIN_DEFAULT_PATHEXT=\".COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC\"\n\n__all__=[\"copyfileobj\",\"copyfile\",\"copymode\",\"copystat\",\"copy\",\"copy2\",\n\"copytree\",\"move\",\"rmtree\",\"Error\",\"SpecialFileError\",\n\"ExecError\",\"make_archive\",\"get_archive_formats\",\n\"register_archive_format\",\"unregister_archive_format\",\n\"get_unpack_formats\",\"register_unpack_format\",\n\"unregister_unpack_format\",\"unpack_archive\",\n\"ignore_patterns\",\"chown\",\"which\",\"get_terminal_size\",\n\"SameFileError\"]\n\n\nclass Error(OSError):\n pass\n \nclass SameFileError(Error):\n ''\n \nclass SpecialFileError(OSError):\n ''\n \n \nclass ExecError(OSError):\n ''\n \nclass ReadError(OSError):\n ''\n \nclass RegistryError(Exception):\n ''\n \n \nclass _GiveupOnFastCopy(Exception):\n ''\n\n \n \ndef _fastcopy_fcopyfile(fsrc,fdst,flags):\n ''\n\n \n try :\n infd=fsrc.fileno()\n outfd=fdst.fileno()\n except Exception as err:\n raise _GiveupOnFastCopy(err)\n \n try :\n posix._fcopyfile(infd,outfd,flags)\n except OSError as err:\n err.filename=fsrc.name\n err.filename2=fdst.name\n if err.errno in {errno.EINVAL,errno.ENOTSUP}:\n raise _GiveupOnFastCopy(err)\n else :\n raise err from None\n \ndef _fastcopy_sendfile(fsrc,fdst):\n ''\n\n\n \n \n \n \n \n \n \n \n \n \n global _USE_CP_SENDFILE\n try :\n infd=fsrc.fileno()\n outfd=fdst.fileno()\n except Exception as err:\n raise _GiveupOnFastCopy(err)\n \n \n \n \n \n \n try :\n blocksize=max(os.fstat(infd).st_size,2 **23)\n except OSError:\n blocksize=2 **27\n \n \n if sys.maxsize <2 **32:\n blocksize=min(blocksize,2 **30)\n \n offset=0\n while True :\n try :\n sent=os.sendfile(outfd,infd,offset,blocksize)\n except OSError as err:\n \n err.filename=fsrc.name\n err.filename2=fdst.name\n \n if err.errno ==errno.ENOTSOCK:\n \n \n \n _USE_CP_SENDFILE=False\n raise _GiveupOnFastCopy(err)\n \n if err.errno ==errno.ENOSPC:\n raise err from None\n \n \n if offset ==0 and os.lseek(outfd,0,os.SEEK_CUR)==0:\n raise _GiveupOnFastCopy(err)\n \n raise err\n else :\n if sent ==0:\n break\n offset +=sent\n \ndef _copyfileobj_readinto(fsrc,fdst,length=COPY_BUFSIZE):\n ''\n\n\n \n \n fsrc_readinto=fsrc.readinto\n fdst_write=fdst.write\n with memoryview(bytearray(length))as mv:\n while True :\n n=fsrc_readinto(mv)\n if not n:\n break\n elif n 0:\n _copyfileobj_readinto(fsrc,fdst,min(file_size,COPY_BUFSIZE))\n return dst\n \n copyfileobj(fsrc,fdst)\n \n \n except IsADirectoryError as e:\n if os.path.exists(dst):\n raise\n else :\n raise FileNotFoundError(f'Directory does not exist: {dst}')from e\n \n return dst\n \ndef copymode(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n \n sys.audit(\"shutil.copymode\",src,dst)\n \n if not follow_symlinks and _islink(src)and os.path.islink(dst):\n if hasattr(os,'lchmod'):\n stat_func,chmod_func=os.lstat,os.lchmod\n else :\n return\n else :\n stat_func,chmod_func=_stat,os.chmod\n \n st=stat_func(src)\n chmod_func(dst,stat.S_IMODE(st.st_mode))\n \nif hasattr(os,'listxattr'):\n def _copyxattr(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n \n \n try :\n names=os.listxattr(src,follow_symlinks=follow_symlinks)\n except OSError as e:\n if e.errno not in (errno.ENOTSUP,errno.ENODATA,errno.EINVAL):\n raise\n return\n for name in names:\n try :\n value=os.getxattr(src,name,follow_symlinks=follow_symlinks)\n os.setxattr(dst,name,value,follow_symlinks=follow_symlinks)\n except OSError as e:\n if e.errno not in (errno.EPERM,errno.ENOTSUP,errno.ENODATA,\n errno.EINVAL):\n raise\nelse :\n def _copyxattr(*args,**kwargs):\n pass\n \ndef copystat(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.copystat\",src,dst)\n \n def _nop(*args,ns=None ,follow_symlinks=None ):\n pass\n \n \n follow=follow_symlinks or not (_islink(src)and os.path.islink(dst))\n if follow:\n \n def lookup(name):\n return getattr(os,name,_nop)\n else :\n \n \n def lookup(name):\n fn=getattr(os,name,_nop)\n if fn in os.supports_follow_symlinks:\n return fn\n return _nop\n \n if isinstance(src,os.DirEntry):\n st=src.stat(follow_symlinks=follow)\n else :\n st=lookup(\"stat\")(src,follow_symlinks=follow)\n mode=stat.S_IMODE(st.st_mode)\n lookup(\"utime\")(dst,ns=(st.st_atime_ns,st.st_mtime_ns),\n follow_symlinks=follow)\n \n \n _copyxattr(src,dst,follow_symlinks=follow)\n try :\n lookup(\"chmod\")(dst,mode,follow_symlinks=follow)\n except NotImplementedError:\n \n \n \n \n \n \n \n \n \n \n pass\n if hasattr(st,'st_flags'):\n try :\n lookup(\"chflags\")(dst,st.st_flags,follow_symlinks=follow)\n except OSError as why:\n for err in 'EOPNOTSUPP','ENOTSUP':\n if hasattr(errno,err)and why.errno ==getattr(errno,err):\n break\n else :\n raise\n \ndef copy(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n\n\n\n\n \n if os.path.isdir(dst):\n dst=os.path.join(dst,os.path.basename(src))\n copyfile(src,dst,follow_symlinks=follow_symlinks)\n copymode(src,dst,follow_symlinks=follow_symlinks)\n return dst\n \ndef copy2(src,dst,*,follow_symlinks=True ):\n ''\n\n\n\n\n\n\n\n\n \n if os.path.isdir(dst):\n dst=os.path.join(dst,os.path.basename(src))\n copyfile(src,dst,follow_symlinks=follow_symlinks)\n copystat(src,dst,follow_symlinks=follow_symlinks)\n return dst\n \ndef ignore_patterns(*patterns):\n ''\n\n\n \n def _ignore_patterns(path,names):\n ignored_names=[]\n for pattern in patterns:\n ignored_names.extend(fnmatch.filter(names,pattern))\n return set(ignored_names)\n return _ignore_patterns\n \ndef _copytree(entries,src,dst,symlinks,ignore,copy_function,\nignore_dangling_symlinks,dirs_exist_ok=False ):\n if ignore is not None :\n ignored_names=ignore(os.fspath(src),[x.name for x in entries])\n else :\n ignored_names=set()\n \n os.makedirs(dst,exist_ok=dirs_exist_ok)\n errors=[]\n use_srcentry=copy_function is copy2 or copy_function is copy\n \n for srcentry in entries:\n if srcentry.name in ignored_names:\n continue\n srcname=os.path.join(src,srcentry.name)\n dstname=os.path.join(dst,srcentry.name)\n srcobj=srcentry if use_srcentry else srcname\n try :\n is_symlink=srcentry.is_symlink()\n if is_symlink and os.name =='nt':\n \n \n lstat=srcentry.stat(follow_symlinks=False )\n if lstat.st_reparse_tag ==stat.IO_REPARSE_TAG_MOUNT_POINT:\n is_symlink=False\n if is_symlink:\n linkto=os.readlink(srcname)\n if symlinks:\n \n \n \n os.symlink(linkto,dstname)\n copystat(srcobj,dstname,follow_symlinks=not symlinks)\n else :\n \n if not os.path.exists(linkto)and ignore_dangling_symlinks:\n continue\n \n if srcentry.is_dir():\n copytree(srcobj,dstname,symlinks,ignore,\n copy_function,dirs_exist_ok=dirs_exist_ok)\n else :\n copy_function(srcobj,dstname)\n elif srcentry.is_dir():\n copytree(srcobj,dstname,symlinks,ignore,copy_function,\n dirs_exist_ok=dirs_exist_ok)\n else :\n \n copy_function(srcobj,dstname)\n \n \n except Error as err:\n errors.extend(err.args[0])\n except OSError as why:\n errors.append((srcname,dstname,str(why)))\n try :\n copystat(src,dst)\n except OSError as why:\n \n if getattr(why,'winerror',None )is None :\n errors.append((src,dst,str(why)))\n if errors:\n raise Error(errors)\n return dst\n \ndef copytree(src,dst,symlinks=False ,ignore=None ,copy_function=copy2,\nignore_dangling_symlinks=False ,dirs_exist_ok=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.copytree\",src,dst)\n with os.scandir(src)as itr:\n entries=list(itr)\n return _copytree(entries=entries,src=src,dst=dst,symlinks=symlinks,\n ignore=ignore,copy_function=copy_function,\n ignore_dangling_symlinks=ignore_dangling_symlinks,\n dirs_exist_ok=dirs_exist_ok)\n \nif hasattr(os.stat_result,'st_file_attributes'):\n\n\n\n def _rmtree_isdir(entry):\n try :\n st=entry.stat(follow_symlinks=False )\n return (stat.S_ISDIR(st.st_mode)and not\n (st.st_file_attributes&stat.FILE_ATTRIBUTE_REPARSE_POINT\n and st.st_reparse_tag ==stat.IO_REPARSE_TAG_MOUNT_POINT))\n except OSError:\n return False\n \n def _rmtree_islink(path):\n try :\n st=os.lstat(path)\n return (stat.S_ISLNK(st.st_mode)or\n (st.st_file_attributes&stat.FILE_ATTRIBUTE_REPARSE_POINT\n and st.st_reparse_tag ==stat.IO_REPARSE_TAG_MOUNT_POINT))\n except OSError:\n return False\nelse :\n def _rmtree_isdir(entry):\n try :\n return entry.is_dir(follow_symlinks=False )\n except OSError:\n return False\n \n def _rmtree_islink(path):\n return os.path.islink(path)\n \n \ndef _rmtree_unsafe(path,onerror):\n try :\n with os.scandir(path)as scandir_it:\n entries=list(scandir_it)\n except OSError:\n onerror(os.scandir,path,sys.exc_info())\n entries=[]\n for entry in entries:\n fullname=entry.path\n if _rmtree_isdir(entry):\n try :\n if entry.is_symlink():\n \n \n \n raise OSError(\"Cannot call rmtree on a symbolic link\")\n except OSError:\n onerror(os.path.islink,fullname,sys.exc_info())\n continue\n _rmtree_unsafe(fullname,onerror)\n else :\n try :\n os.unlink(fullname)\n except OSError:\n onerror(os.unlink,fullname,sys.exc_info())\n try :\n os.rmdir(path)\n except OSError:\n onerror(os.rmdir,path,sys.exc_info())\n \n \ndef _rmtree_safe_fd(topfd,path,onerror):\n try :\n with os.scandir(topfd)as scandir_it:\n entries=list(scandir_it)\n except OSError as err:\n err.filename=path\n onerror(os.scandir,path,sys.exc_info())\n return\n for entry in entries:\n fullname=os.path.join(path,entry.name)\n try :\n is_dir=entry.is_dir(follow_symlinks=False )\n except OSError:\n is_dir=False\n else :\n if is_dir:\n try :\n orig_st=entry.stat(follow_symlinks=False )\n is_dir=stat.S_ISDIR(orig_st.st_mode)\n except OSError:\n onerror(os.lstat,fullname,sys.exc_info())\n continue\n if is_dir:\n try :\n dirfd=os.open(entry.name,os.O_RDONLY,dir_fd=topfd)\n except OSError:\n onerror(os.open,fullname,sys.exc_info())\n else :\n try :\n if os.path.samestat(orig_st,os.fstat(dirfd)):\n _rmtree_safe_fd(dirfd,fullname,onerror)\n try :\n os.rmdir(entry.name,dir_fd=topfd)\n except OSError:\n onerror(os.rmdir,fullname,sys.exc_info())\n else :\n try :\n \n \n \n raise OSError(\"Cannot call rmtree on a symbolic \"\n \"link\")\n except OSError:\n onerror(os.path.islink,fullname,sys.exc_info())\n finally :\n os.close(dirfd)\n else :\n try :\n os.unlink(entry.name,dir_fd=topfd)\n except OSError:\n onerror(os.unlink,fullname,sys.exc_info())\n \n_use_fd_functions=({os.open,os.stat,os.unlink,os.rmdir}<=\nos.supports_dir_fd and\nos.scandir in os.supports_fd and\nos.stat in os.supports_follow_symlinks)\n\ndef rmtree(path,ignore_errors=False ,onerror=None ):\n ''\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.rmtree\",path)\n if ignore_errors:\n def onerror(*args):\n pass\n elif onerror is None :\n def onerror(*args):\n raise\n if _use_fd_functions:\n \n if isinstance(path,bytes):\n path=os.fsdecode(path)\n \n \n try :\n orig_st=os.lstat(path)\n except Exception:\n onerror(os.lstat,path,sys.exc_info())\n return\n try :\n fd=os.open(path,os.O_RDONLY)\n except Exception:\n onerror(os.open,path,sys.exc_info())\n return\n try :\n if os.path.samestat(orig_st,os.fstat(fd)):\n _rmtree_safe_fd(fd,path,onerror)\n try :\n os.rmdir(path)\n except OSError:\n onerror(os.rmdir,path,sys.exc_info())\n else :\n try :\n \n raise OSError(\"Cannot call rmtree on a symbolic link\")\n except OSError:\n onerror(os.path.islink,path,sys.exc_info())\n finally :\n os.close(fd)\n else :\n try :\n if _rmtree_islink(path):\n \n raise OSError(\"Cannot call rmtree on a symbolic link\")\n except OSError:\n onerror(os.path.islink,path,sys.exc_info())\n \n return\n return _rmtree_unsafe(path,onerror)\n \n \n \nrmtree.avoids_symlink_attacks=_use_fd_functions\n\ndef _basename(path):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n path=os.fspath(path)\n sep=os.path.sep+(os.path.altsep or '')\n return os.path.basename(path.rstrip(sep))\n \ndef move(src,dst,copy_function=copy2):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.move\",src,dst)\n real_dst=dst\n if os.path.isdir(dst):\n if _samefile(src,dst):\n \n \n os.rename(src,dst)\n return\n \n \n \n real_dst=os.path.join(dst,_basename(src))\n \n if os.path.exists(real_dst):\n raise Error(\"Destination path '%s' already exists\"%real_dst)\n try :\n os.rename(src,real_dst)\n except OSError:\n if os.path.islink(src):\n linkto=os.readlink(src)\n os.symlink(linkto,real_dst)\n os.unlink(src)\n elif os.path.isdir(src):\n if _destinsrc(src,dst):\n raise Error(\"Cannot move a directory '%s' into itself\"\n \" '%s'.\"%(src,dst))\n if (_is_immutable(src)\n or (not os.access(src,os.W_OK)and os.listdir(src)\n and sys.platform =='darwin')):\n raise PermissionError(\"Cannot move the non-empty directory \"\n \"'%s': Lacking write permission to '%s'.\"\n %(src,src))\n copytree(src,real_dst,copy_function=copy_function,\n symlinks=True )\n rmtree(src)\n else :\n copy_function(src,real_dst)\n os.unlink(src)\n return real_dst\n \ndef _destinsrc(src,dst):\n src=os.path.abspath(src)\n dst=os.path.abspath(dst)\n if not src.endswith(os.path.sep):\n src +=os.path.sep\n if not dst.endswith(os.path.sep):\n dst +=os.path.sep\n return dst.startswith(src)\n \ndef _is_immutable(src):\n st=_stat(src)\n immutable_states=[stat.UF_IMMUTABLE,stat.SF_IMMUTABLE]\n return hasattr(st,'st_flags')and st.st_flags in immutable_states\n \ndef _get_gid(name):\n ''\n if name is None :\n return None\n \n try :\n from grp import getgrnam\n except ImportError:\n return None\n \n try :\n result=getgrnam(name)\n except KeyError:\n result=None\n if result is not None :\n return result[2]\n return None\n \ndef _get_uid(name):\n ''\n if name is None :\n return None\n \n try :\n from pwd import getpwnam\n except ImportError:\n return None\n \n try :\n result=getpwnam(name)\n except KeyError:\n result=None\n if result is not None :\n return result[2]\n return None\n \ndef _make_tarball(base_name,base_dir,compress=\"gzip\",verbose=0,dry_run=0,\nowner=None ,group=None ,logger=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n if compress is None :\n tar_compression=''\n elif _ZLIB_SUPPORTED and compress =='gzip':\n tar_compression='gz'\n elif _BZ2_SUPPORTED and compress =='bzip2':\n tar_compression='bz2'\n elif _LZMA_SUPPORTED and compress =='xz':\n tar_compression='xz'\n else :\n raise ValueError(\"bad value for 'compress', or compression format not \"\n \"supported : {0}\".format(compress))\n \n import tarfile\n \n compress_ext='.'+tar_compression if compress else ''\n archive_name=base_name+'.tar'+compress_ext\n archive_dir=os.path.dirname(archive_name)\n \n if archive_dir and not os.path.exists(archive_dir):\n if logger is not None :\n logger.info(\"creating %s\",archive_dir)\n if not dry_run:\n os.makedirs(archive_dir)\n \n \n if logger is not None :\n logger.info('Creating tar archive')\n \n uid=_get_uid(owner)\n gid=_get_gid(group)\n \n def _set_uid_gid(tarinfo):\n if gid is not None :\n tarinfo.gid=gid\n tarinfo.gname=group\n if uid is not None :\n tarinfo.uid=uid\n tarinfo.uname=owner\n return tarinfo\n \n if not dry_run:\n tar=tarfile.open(archive_name,'w|%s'%tar_compression)\n try :\n tar.add(base_dir,filter=_set_uid_gid)\n finally :\n tar.close()\n \n return archive_name\n \ndef _make_zipfile(base_name,base_dir,verbose=0,dry_run=0,logger=None ):\n ''\n\n\n\n \n import zipfile\n \n zip_filename=base_name+\".zip\"\n archive_dir=os.path.dirname(base_name)\n \n if archive_dir and not os.path.exists(archive_dir):\n if logger is not None :\n logger.info(\"creating %s\",archive_dir)\n if not dry_run:\n os.makedirs(archive_dir)\n \n if logger is not None :\n logger.info(\"creating '%s' and adding '%s' to it\",\n zip_filename,base_dir)\n \n if not dry_run:\n with zipfile.ZipFile(zip_filename,\"w\",\n compression=zipfile.ZIP_DEFLATED)as zf:\n path=os.path.normpath(base_dir)\n if path !=os.curdir:\n zf.write(path,path)\n if logger is not None :\n logger.info(\"adding '%s'\",path)\n for dirpath,dirnames,filenames in os.walk(base_dir):\n for name in sorted(dirnames):\n path=os.path.normpath(os.path.join(dirpath,name))\n zf.write(path,path)\n if logger is not None :\n logger.info(\"adding '%s'\",path)\n for name in filenames:\n path=os.path.normpath(os.path.join(dirpath,name))\n if os.path.isfile(path):\n zf.write(path,path)\n if logger is not None :\n logger.info(\"adding '%s'\",path)\n \n return zip_filename\n \n_ARCHIVE_FORMATS={\n'tar':(_make_tarball,[('compress',None )],\"uncompressed tar file\"),\n}\n\nif _ZLIB_SUPPORTED:\n _ARCHIVE_FORMATS['gztar']=(_make_tarball,[('compress','gzip')],\n \"gzip'ed tar-file\")\n _ARCHIVE_FORMATS['zip']=(_make_zipfile,[],\"ZIP file\")\n \nif _BZ2_SUPPORTED:\n _ARCHIVE_FORMATS['bztar']=(_make_tarball,[('compress','bzip2')],\n \"bzip2'ed tar-file\")\n \nif _LZMA_SUPPORTED:\n _ARCHIVE_FORMATS['xztar']=(_make_tarball,[('compress','xz')],\n \"xz'ed tar-file\")\n \ndef get_archive_formats():\n ''\n\n\n \n formats=[(name,registry[2])for name,registry in\n _ARCHIVE_FORMATS.items()]\n formats.sort()\n return formats\n \ndef register_archive_format(name,function,extra_args=None ,description=''):\n ''\n\n\n\n\n\n\n \n if extra_args is None :\n extra_args=[]\n if not callable(function):\n raise TypeError('The %s object is not callable'%function)\n if not isinstance(extra_args,(tuple,list)):\n raise TypeError('extra_args needs to be a sequence')\n for element in extra_args:\n if not isinstance(element,(tuple,list))or len(element)!=2:\n raise TypeError('extra_args elements are : (arg_name, value)')\n \n _ARCHIVE_FORMATS[name]=(function,extra_args,description)\n \ndef unregister_archive_format(name):\n del _ARCHIVE_FORMATS[name]\n \ndef make_archive(base_name,format,root_dir=None ,base_dir=None ,verbose=0,\ndry_run=0,owner=None ,group=None ,logger=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.make_archive\",base_name,format,root_dir,base_dir)\n save_cwd=os.getcwd()\n if root_dir is not None :\n if logger is not None :\n logger.debug(\"changing into '%s'\",root_dir)\n base_name=os.path.abspath(base_name)\n if not dry_run:\n os.chdir(root_dir)\n \n if base_dir is None :\n base_dir=os.curdir\n \n kwargs={'dry_run':dry_run,'logger':logger}\n \n try :\n format_info=_ARCHIVE_FORMATS[format]\n except KeyError:\n raise ValueError(\"unknown archive format '%s'\"%format)from None\n \n func=format_info[0]\n for arg,val in format_info[1]:\n kwargs[arg]=val\n \n if format !='zip':\n kwargs['owner']=owner\n kwargs['group']=group\n \n try :\n filename=func(base_name,base_dir,**kwargs)\n finally :\n if root_dir is not None :\n if logger is not None :\n logger.debug(\"changing back to '%s'\",save_cwd)\n os.chdir(save_cwd)\n \n return filename\n \n \ndef get_unpack_formats():\n ''\n\n\n\n \n formats=[(name,info[0],info[3])for name,info in\n _UNPACK_FORMATS.items()]\n formats.sort()\n return formats\n \ndef _check_unpack_options(extensions,function,extra_args):\n ''\n \n existing_extensions={}\n for name,info in _UNPACK_FORMATS.items():\n for ext in info[0]:\n existing_extensions[ext]=name\n \n for extension in extensions:\n if extension in existing_extensions:\n msg='%s is already registered for \"%s\"'\n raise RegistryError(msg %(extension,\n existing_extensions[extension]))\n \n if not callable(function):\n raise TypeError('The registered function must be a callable')\n \n \ndef register_unpack_format(name,extensions,function,extra_args=None ,\ndescription=''):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if extra_args is None :\n extra_args=[]\n _check_unpack_options(extensions,function,extra_args)\n _UNPACK_FORMATS[name]=extensions,function,extra_args,description\n \ndef unregister_unpack_format(name):\n ''\n del _UNPACK_FORMATS[name]\n \ndef _ensure_directory(path):\n ''\n dirname=os.path.dirname(path)\n if not os.path.isdir(dirname):\n os.makedirs(dirname)\n \ndef _unpack_zipfile(filename,extract_dir):\n ''\n \n import zipfile\n \n if not zipfile.is_zipfile(filename):\n raise ReadError(\"%s is not a zip file\"%filename)\n \n zip=zipfile.ZipFile(filename)\n try :\n for info in zip.infolist():\n name=info.filename\n \n \n if name.startswith('/')or '..'in name:\n continue\n \n targetpath=os.path.join(extract_dir,*name.split('/'))\n if not targetpath:\n continue\n \n _ensure_directory(targetpath)\n if not name.endswith('/'):\n \n with zip.open(name,'r')as source,\\\n open(targetpath,'wb')as target:\n copyfileobj(source,target)\n finally :\n zip.close()\n \ndef _unpack_tarfile(filename,extract_dir):\n ''\n \n import tarfile\n try :\n tarobj=tarfile.open(filename)\n except tarfile.TarError:\n raise ReadError(\n \"%s is not a compressed or uncompressed tar file\"%filename)\n try :\n tarobj.extractall(extract_dir)\n finally :\n tarobj.close()\n \n_UNPACK_FORMATS={\n'tar':(['.tar'],_unpack_tarfile,[],\"uncompressed tar file\"),\n'zip':(['.zip'],_unpack_zipfile,[],\"ZIP file\"),\n}\n\nif _ZLIB_SUPPORTED:\n _UNPACK_FORMATS['gztar']=(['.tar.gz','.tgz'],_unpack_tarfile,[],\n \"gzip'ed tar-file\")\n \nif _BZ2_SUPPORTED:\n _UNPACK_FORMATS['bztar']=(['.tar.bz2','.tbz2'],_unpack_tarfile,[],\n \"bzip2'ed tar-file\")\n \nif _LZMA_SUPPORTED:\n _UNPACK_FORMATS['xztar']=(['.tar.xz','.txz'],_unpack_tarfile,[],\n \"xz'ed tar-file\")\n \ndef _find_unpack_format(filename):\n for name,info in _UNPACK_FORMATS.items():\n for extension in info[0]:\n if filename.endswith(extension):\n return name\n return None\n \ndef unpack_archive(filename,extract_dir=None ,format=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n sys.audit(\"shutil.unpack_archive\",filename,extract_dir,format)\n \n if extract_dir is None :\n extract_dir=os.getcwd()\n \n extract_dir=os.fspath(extract_dir)\n filename=os.fspath(filename)\n \n if format is not None :\n try :\n format_info=_UNPACK_FORMATS[format]\n except KeyError:\n raise ValueError(\"Unknown unpack format '{0}'\".format(format))from None\n \n func=format_info[1]\n func(filename,extract_dir,**dict(format_info[2]))\n else :\n \n format=_find_unpack_format(filename)\n if format is None :\n raise ReadError(\"Unknown archive format '{0}'\".format(filename))\n \n func=_UNPACK_FORMATS[format][1]\n kwargs=dict(_UNPACK_FORMATS[format][2])\n func(filename,extract_dir,**kwargs)\n \n \nif hasattr(os,'statvfs'):\n\n __all__.append('disk_usage')\n _ntuple_diskusage=collections.namedtuple('usage','total used free')\n _ntuple_diskusage.total.__doc__='Total space in bytes'\n _ntuple_diskusage.used.__doc__='Used space in bytes'\n _ntuple_diskusage.free.__doc__='Free space in bytes'\n \n def disk_usage(path):\n ''\n\n\n\n \n st=os.statvfs(path)\n free=st.f_bavail *st.f_frsize\n total=st.f_blocks *st.f_frsize\n used=(st.f_blocks -st.f_bfree)*st.f_frsize\n return _ntuple_diskusage(total,used,free)\n \nelif _WINDOWS:\n\n __all__.append('disk_usage')\n _ntuple_diskusage=collections.namedtuple('usage','total used free')\n \n def disk_usage(path):\n ''\n\n\n\n \n total,free=nt._getdiskusage(path)\n used=total -free\n return _ntuple_diskusage(total,used,free)\n \n \ndef chown(path,user=None ,group=None ):\n ''\n\n\n\n \n sys.audit('shutil.chown',path,user,group)\n \n if user is None and group is None :\n raise ValueError(\"user and/or group must be set\")\n \n _user=user\n _group=group\n \n \n if user is None :\n _user=-1\n \n elif isinstance(user,str):\n _user=_get_uid(user)\n if _user is None :\n raise LookupError(\"no such user: {!r}\".format(user))\n \n if group is None :\n _group=-1\n elif not isinstance(group,int):\n _group=_get_gid(group)\n if _group is None :\n raise LookupError(\"no such group: {!r}\".format(group))\n \n os.chown(path,_user,_group)\n \ndef get_terminal_size(fallback=(80,24)):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n try :\n columns=int(os.environ['COLUMNS'])\n except (KeyError,ValueError):\n columns=0\n \n try :\n lines=int(os.environ['LINES'])\n except (KeyError,ValueError):\n lines=0\n \n \n if columns <=0 or lines <=0:\n try :\n size=os.get_terminal_size(sys.__stdout__.fileno())\n except (AttributeError,ValueError,OSError):\n \n \n size=os.terminal_size(fallback)\n if columns <=0:\n columns=size.columns\n if lines <=0:\n lines=size.lines\n \n return os.terminal_size((columns,lines))\n \n \n \n \n \ndef _access_check(fn,mode):\n return (os.path.exists(fn)and os.access(fn,mode)\n and not os.path.isdir(fn))\n \n \ndef which(cmd,mode=os.F_OK |os.X_OK,path=None ):\n ''\n\n\n\n\n\n\n\n \n \n \n \n if os.path.dirname(cmd):\n if _access_check(cmd,mode):\n return cmd\n return None\n \n use_bytes=isinstance(cmd,bytes)\n \n if path is None :\n path=os.environ.get(\"PATH\",None )\n if path is None :\n try :\n path=os.confstr(\"CS_PATH\")\n except (AttributeError,ValueError):\n \n path=os.defpath\n \n \n \n \n if not path:\n return None\n \n if use_bytes:\n path=os.fsencode(path)\n path=path.split(os.fsencode(os.pathsep))\n else :\n path=os.fsdecode(path)\n path=path.split(os.pathsep)\n \n if sys.platform ==\"win32\":\n \n curdir=os.curdir\n if use_bytes:\n curdir=os.fsencode(curdir)\n if curdir not in path:\n path.insert(0,curdir)\n \n \n pathext_source=os.getenv(\"PATHEXT\")or _WIN_DEFAULT_PATHEXT\n pathext=[ext for ext in pathext_source.split(os.pathsep)if ext]\n \n if use_bytes:\n pathext=[os.fsencode(ext)for ext in pathext]\n \n \n \n \n if any(cmd.lower().endswith(ext.lower())for ext in pathext):\n files=[cmd]\n else :\n files=[cmd+ext for ext in pathext]\n else :\n \n \n files=[cmd]\n \n seen=set()\n for dir in path:\n normdir=os.path.normcase(dir)\n if not normdir in seen:\n seen.add(normdir)\n for thefile in files:\n name=os.path.join(dir,thefile)\n if _access_check(name,mode):\n return name\n return None\n", ["bz2", "collections", "errno", "fnmatch", "grp", "lzma", "nt", "os", "posix", "pwd", "stat", "sys", "tarfile", "zipfile", "zlib"]], "signal": [".py", "import _signal\nfrom _signal import *\nfrom enum import IntEnum as _IntEnum\n\n_globals=globals()\n\n_IntEnum._convert_(\n'Signals',__name__,\nlambda name:\nname.isupper()\nand (name.startswith('SIG')and not name.startswith('SIG_'))\nor name.startswith('CTRL_'))\n\n_IntEnum._convert_(\n'Handlers',__name__,\nlambda name:name in ('SIG_DFL','SIG_IGN'))\n\nif 'pthread_sigmask'in _globals:\n _IntEnum._convert_(\n 'Sigmasks',__name__,\n lambda name:name in ('SIG_BLOCK','SIG_UNBLOCK','SIG_SETMASK'))\n \n \ndef _int_to_enum(value,enum_klass):\n ''\n\n \n try :\n return enum_klass(value)\n except ValueError:\n return value\n \n \ndef _enum_to_int(value):\n ''\n\n \n try :\n return int(value)\n except (ValueError,TypeError):\n return value\n \n \n \n \n \n \ndef _wraps(wrapped):\n def decorator(wrapper):\n wrapper.__doc__=wrapped.__doc__\n return wrapper\n return decorator\n \n@_wraps(_signal.signal)\ndef signal(signalnum,handler):\n handler=_signal.signal(_enum_to_int(signalnum),_enum_to_int(handler))\n return _int_to_enum(handler,Handlers)\n \n \n@_wraps(_signal.getsignal)\ndef getsignal(signalnum):\n handler=_signal.getsignal(signalnum)\n return _int_to_enum(handler,Handlers)\n \n \nif 'pthread_sigmask'in _globals:\n @_wraps(_signal.pthread_sigmask)\n def pthread_sigmask(how,mask):\n sigs_set=_signal.pthread_sigmask(how,mask)\n return set(_int_to_enum(x,Signals)for x in sigs_set)\n \n \nif 'sigpending'in _globals:\n @_wraps(_signal.sigpending)\n def sigpending():\n return {_int_to_enum(x,Signals)for x in _signal.sigpending()}\n \n \nif 'sigwait'in _globals:\n @_wraps(_signal.sigwait)\n def sigwait(sigset):\n retsig=_signal.sigwait(sigset)\n return _int_to_enum(retsig,Signals)\n \n \nif 'valid_signals'in _globals:\n @_wraps(_signal.valid_signals)\n def valid_signals():\n return {_int_to_enum(x,Signals)for x in _signal.valid_signals()}\n \n \ndel _globals,_wraps\n", ["_signal", "enum"]], "site": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport sys\nimport os\nimport builtins\nimport _sitebuiltins\nimport io\n\n\nPREFIXES=[sys.prefix,sys.exec_prefix]\n\n\nENABLE_USER_SITE=None\n\n\n\n\nUSER_SITE=None\nUSER_BASE=None\n\n\ndef _trace(message):\n if sys.flags.verbose:\n print(message,file=sys.stderr)\n \n \ndef makepath(*paths):\n dir=os.path.join(*paths)\n try:\n dir=os.path.abspath(dir)\n except OSError:\n pass\n return dir,os.path.normcase(dir)\n \n \ndef abs_paths():\n ''\n for m in set(sys.modules.values()):\n loader_module=None\n try:\n loader_module=m.__loader__.__module__\n except AttributeError:\n try:\n loader_module=m.__spec__.loader.__module__\n except AttributeError:\n pass\n if loader_module not in{'_frozen_importlib','_frozen_importlib_external'}:\n continue\n try:\n m.__file__=os.path.abspath(m.__file__)\n except(AttributeError,OSError,TypeError):\n pass\n try:\n m.__cached__=os.path.abspath(m.__cached__)\n except(AttributeError,OSError,TypeError):\n pass\n \n \ndef removeduppaths():\n ''\n \n \n \n L=[]\n known_paths=set()\n for dir in sys.path:\n \n \n \n dir,dircase=makepath(dir)\n if dircase not in known_paths:\n L.append(dir)\n known_paths.add(dircase)\n sys.path[:]=L\n return known_paths\n \n \ndef _init_pathinfo():\n ''\n d=set()\n for item in sys.path:\n try:\n if os.path.exists(item):\n _,itemcase=makepath(item)\n d.add(itemcase)\n except TypeError:\n continue\n return d\n \n \ndef addpackage(sitedir,name,known_paths):\n ''\n\n\n \n if known_paths is None:\n known_paths=_init_pathinfo()\n reset=True\n else:\n reset=False\n fullname=os.path.join(sitedir,name)\n _trace(f\"Processing .pth file: {fullname !r}\")\n try:\n \n \n f=io.TextIOWrapper(io.open_code(fullname),encoding=\"locale\")\n except OSError:\n return\n with f:\n for n,line in enumerate(f):\n if line.startswith(\"#\"):\n continue\n if line.strip()==\"\":\n continue\n try:\n if line.startswith((\"import \",\"import\\t\")):\n exec(line)\n continue\n line=line.rstrip()\n dir,dircase=makepath(sitedir,line)\n if not dircase in known_paths and os.path.exists(dir):\n sys.path.append(dir)\n known_paths.add(dircase)\n except Exception as exc:\n print(\"Error processing line {:d} of {}:\\n\".format(n+1,fullname),\n file=sys.stderr)\n import traceback\n for record in traceback.format_exception(exc):\n for line in record.splitlines():\n print(' '+line,file=sys.stderr)\n print(\"\\nRemainder of file ignored\",file=sys.stderr)\n break\n if reset:\n known_paths=None\n return known_paths\n \n \ndef addsitedir(sitedir,known_paths=None):\n ''\n \n _trace(f\"Adding directory: {sitedir !r}\")\n if known_paths is None:\n known_paths=_init_pathinfo()\n reset=True\n else:\n reset=False\n sitedir,sitedircase=makepath(sitedir)\n if not sitedircase in known_paths:\n sys.path.append(sitedir)\n known_paths.add(sitedircase)\n try:\n names=os.listdir(sitedir)\n except OSError:\n return\n names=[name for name in names if name.endswith(\".pth\")]\n for name in sorted(names):\n addpackage(sitedir,name,known_paths)\n if reset:\n known_paths=None\n return known_paths\n \n \ndef check_enableusersite():\n ''\n\n\n\n\n\n\n\n \n if sys.flags.no_user_site:\n return False\n \n if hasattr(os,\"getuid\")and hasattr(os,\"geteuid\"):\n \n if os.geteuid()!=os.getuid():\n return None\n if hasattr(os,\"getgid\")and hasattr(os,\"getegid\"):\n \n if os.getegid()!=os.getgid():\n return None\n \n return True\n \n \n \n \n \n \n \n \n \ndef _getuserbase():\n env_base=os.environ.get(\"PYTHONUSERBASE\",None)\n if env_base:\n return env_base\n \n \n if sys.platform in{\"emscripten\",\"vxworks\",\"wasi\"}:\n return None\n \n def joinuser(*args):\n return os.path.expanduser(os.path.join(*args))\n \n if os.name ==\"nt\":\n base=os.environ.get(\"APPDATA\")or \"~\"\n return joinuser(base,\"Python\")\n \n if sys.platform ==\"darwin\"and sys._framework:\n return joinuser(\"~\",\"Library\",sys._framework,\n \"%d.%d\"%sys.version_info[:2])\n \n return joinuser(\"~\",\".local\")\n \n \n \ndef _get_path(userbase):\n version=sys.version_info\n \n if os.name =='nt':\n ver_nodot=sys.winver.replace('.','')\n return f'{userbase}\\\\Python{ver_nodot}\\\\site-packages'\n \n if sys.platform =='darwin'and sys._framework:\n return f'{userbase}/lib/python/site-packages'\n \n return f'{userbase}/lib/python{version[0]}.{version[1]}/site-packages'\n \n \ndef getuserbase():\n ''\n\n\n\n\n \n global USER_BASE\n if USER_BASE is None:\n USER_BASE=_getuserbase()\n return USER_BASE\n \n \ndef getusersitepackages():\n ''\n\n\n\n \n global USER_SITE,ENABLE_USER_SITE\n userbase=getuserbase()\n \n if USER_SITE is None:\n if userbase is None:\n ENABLE_USER_SITE=False\n else:\n USER_SITE=_get_path(userbase)\n \n return USER_SITE\n \ndef addusersitepackages(known_paths):\n ''\n\n\n\n \n \n \n _trace(\"Processing user site-packages\")\n user_site=getusersitepackages()\n \n if ENABLE_USER_SITE and os.path.isdir(user_site):\n addsitedir(user_site,known_paths)\n return known_paths\n \ndef getsitepackages(prefixes=None):\n ''\n\n\n\n\n \n sitepackages=[]\n seen=set()\n \n if prefixes is None:\n prefixes=PREFIXES\n \n for prefix in prefixes:\n if not prefix or prefix in seen:\n continue\n seen.add(prefix)\n \n if os.sep =='/':\n libdirs=[sys.platlibdir]\n if sys.platlibdir !=\"lib\":\n libdirs.append(\"lib\")\n \n for libdir in libdirs:\n path=os.path.join(prefix,libdir,\n \"python%d.%d\"%sys.version_info[:2],\n \"site-packages\")\n sitepackages.append(path)\n else:\n sitepackages.append(prefix)\n sitepackages.append(os.path.join(prefix,\"Lib\",\"site-packages\"))\n return sitepackages\n \ndef addsitepackages(known_paths,prefixes=None):\n ''\n _trace(\"Processing global site-packages\")\n for sitedir in getsitepackages(prefixes):\n if os.path.isdir(sitedir):\n addsitedir(sitedir,known_paths)\n \n return known_paths\n \ndef setquit():\n ''\n\n\n\n\n \n if os.sep =='\\\\':\n eof='Ctrl-Z plus Return'\n else:\n eof='Ctrl-D (i.e. EOF)'\n \n builtins.quit=_sitebuiltins.Quitter('quit',eof)\n builtins.exit=_sitebuiltins.Quitter('exit',eof)\n \n \ndef setcopyright():\n ''\n builtins.copyright=_sitebuiltins._Printer(\"copyright\",sys.copyright)\n builtins.credits=_sitebuiltins._Printer(\"credits\",\"\"\"\\\n Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands\n for supporting Python development. See www.python.org for more information.\"\"\")\n files,dirs=[],[]\n \n \n here=getattr(sys,'_stdlib_dir',None)\n if not here and hasattr(os,'__file__'):\n here=os.path.dirname(os.__file__)\n if here:\n files.extend([\"LICENSE.txt\",\"LICENSE\"])\n dirs.extend([os.path.join(here,os.pardir),here,os.curdir])\n builtins.license=_sitebuiltins._Printer(\n \"license\",\n \"See https://www.python.org/psf/license/\",\n files,dirs)\n \n \ndef sethelper():\n builtins.help=_sitebuiltins._Helper()\n \ndef enablerlcompleter():\n ''\n\n\n\n\n\n\n \n def register_readline():\n import atexit\n try:\n import readline\n import rlcompleter\n except ImportError:\n return\n \n \n \n readline_doc=getattr(readline,'__doc__','')\n if readline_doc is not None and 'libedit'in readline_doc:\n readline.parse_and_bind('bind ^I rl_complete')\n else:\n readline.parse_and_bind('tab: complete')\n \n try:\n readline.read_init_file()\n except OSError:\n \n \n \n \n pass\n \n if readline.get_current_history_length()==0:\n \n \n \n \n \n history=os.path.join(os.path.expanduser('~'),\n '.python_history')\n try:\n readline.read_history_file(history)\n except OSError:\n pass\n \n def write_history():\n try:\n readline.write_history_file(history)\n except OSError:\n \n \n pass\n \n atexit.register(write_history)\n \n sys.__interactivehook__=register_readline\n \ndef venv(known_paths):\n global PREFIXES,ENABLE_USER_SITE\n \n env=os.environ\n if sys.platform =='darwin'and '__PYVENV_LAUNCHER__'in env:\n executable=sys._base_executable=os.environ['__PYVENV_LAUNCHER__']\n else:\n executable=sys.executable\n exe_dir=os.path.dirname(os.path.abspath(executable))\n site_prefix=os.path.dirname(exe_dir)\n sys._home=None\n conf_basename='pyvenv.cfg'\n candidate_conf=next(\n (\n conffile for conffile in(\n os.path.join(exe_dir,conf_basename),\n os.path.join(site_prefix,conf_basename)\n )\n if os.path.isfile(conffile)\n ),\n None\n )\n \n if candidate_conf:\n virtual_conf=candidate_conf\n system_site=\"true\"\n \n \n with open(virtual_conf,encoding='utf-8')as f:\n for line in f:\n if '='in line:\n key,_,value=line.partition('=')\n key=key.strip().lower()\n value=value.strip()\n if key =='include-system-site-packages':\n system_site=value.lower()\n elif key =='home':\n sys._home=value\n \n sys.prefix=sys.exec_prefix=site_prefix\n \n \n addsitepackages(known_paths,[sys.prefix])\n \n \n \n if system_site ==\"true\":\n PREFIXES.insert(0,sys.prefix)\n else:\n PREFIXES=[sys.prefix]\n ENABLE_USER_SITE=False\n \n return known_paths\n \n \ndef execsitecustomize():\n ''\n try:\n try:\n import sitecustomize\n except ImportError as exc:\n if exc.name =='sitecustomize':\n pass\n else:\n raise\n except Exception as err:\n if sys.flags.verbose:\n sys.excepthook(*sys.exc_info())\n else:\n sys.stderr.write(\n \"Error in sitecustomize; set PYTHONVERBOSE for traceback:\\n\"\n \"%s: %s\\n\"%\n (err.__class__.__name__,err))\n \n \ndef execusercustomize():\n ''\n try:\n try:\n import usercustomize\n except ImportError as exc:\n if exc.name =='usercustomize':\n pass\n else:\n raise\n except Exception as err:\n if sys.flags.verbose:\n sys.excepthook(*sys.exc_info())\n else:\n sys.stderr.write(\n \"Error in usercustomize; set PYTHONVERBOSE for traceback:\\n\"\n \"%s: %s\\n\"%\n (err.__class__.__name__,err))\n \n \ndef main():\n ''\n\n\n\n \n global ENABLE_USER_SITE\n \n orig_path=sys.path[:]\n known_paths=removeduppaths()\n if orig_path !=sys.path:\n \n \n abs_paths()\n \n known_paths=venv(known_paths)\n if ENABLE_USER_SITE is None:\n ENABLE_USER_SITE=check_enableusersite()\n known_paths=addusersitepackages(known_paths)\n known_paths=addsitepackages(known_paths)\n setquit()\n setcopyright()\n sethelper()\n if not sys.flags.isolated:\n enablerlcompleter()\n execsitecustomize()\n if ENABLE_USER_SITE:\n execusercustomize()\n \n \n \nif not sys.flags.no_site:\n main()\n \ndef _script():\n help=\"\"\"\\\n %s [--user-base] [--user-site]\n\n Without arguments print some useful information\n With arguments print the value of USER_BASE and/or USER_SITE separated\n by '%s'.\n\n Exit codes with --user-base or --user-site:\n 0 - user site directory is enabled\n 1 - user site directory is disabled by user\n 2 - user site directory is disabled by super user\n or for security reasons\n >2 - unknown error\n \"\"\"\n args=sys.argv[1:]\n if not args:\n user_base=getuserbase()\n user_site=getusersitepackages()\n print(\"sys.path = [\")\n for dir in sys.path:\n print(\" %r,\"%(dir,))\n print(\"]\")\n def exists(path):\n if path is not None and os.path.isdir(path):\n return \"exists\"\n else:\n return \"doesn't exist\"\n print(f\"USER_BASE: {user_base !r} ({exists(user_base)})\")\n print(f\"USER_SITE: {user_site !r} ({exists(user_site)})\")\n print(f\"ENABLE_USER_SITE: {ENABLE_USER_SITE !r}\")\n sys.exit(0)\n \n buffer=[]\n if '--user-base'in args:\n buffer.append(USER_BASE)\n if '--user-site'in args:\n buffer.append(USER_SITE)\n \n if buffer:\n print(os.pathsep.join(buffer))\n if ENABLE_USER_SITE:\n sys.exit(0)\n elif ENABLE_USER_SITE is False:\n sys.exit(1)\n elif ENABLE_USER_SITE is None:\n sys.exit(2)\n else:\n sys.exit(3)\n else:\n import textwrap\n print(textwrap.dedent(help %(sys.argv[0],os.pathsep)))\n sys.exit(10)\n \nif __name__ =='__main__':\n _script()\n", ["_sitebuiltins", "atexit", "builtins", "io", "os", "readline", "rlcompleter", "sitecustomize", "sys", "textwrap", "traceback", "usercustomize"]], "socket": [".py", "\n\n\n\"\"\"\\\nThis module provides socket operations and some related functions.\nOn Unix, it supports IP (Internet Protocol) and Unix domain sockets.\nOn other systems, it only supports IP. Functions specific for a\nsocket are available as methods of the socket object.\n\nFunctions:\n\nsocket() -- create a new socket object\nsocketpair() -- create a pair of new socket objects [*]\nfromfd() -- create a socket object from an open file descriptor [*]\nsend_fds() -- Send file descriptor to the socket.\nrecv_fds() -- Receive file descriptors from the socket.\nfromshare() -- create a socket object from data received from socket.share() [*]\ngethostname() -- return the current hostname\ngethostbyname() -- map a hostname to its IP number\ngethostbyaddr() -- map an IP number or hostname to DNS info\ngetservbyname() -- map a service name and a protocol name to a port number\ngetprotobyname() -- map a protocol name (e.g. 'tcp') to a number\nntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order\nhtons(), htonl() -- convert 16, 32 bit int from host to network byte order\ninet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format\ninet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)\nsocket.getdefaulttimeout() -- get the default timeout value\nsocket.setdefaulttimeout() -- set the default timeout value\ncreate_connection() -- connects to an address, with an optional timeout and\n optional source address.\n\n [*] not available on all platforms!\n\nSpecial objects:\n\nSocketType -- type object for socket objects\nerror -- exception raised for I/O errors\nhas_ipv6 -- boolean value indicating if IPv6 is supported\n\nIntEnum constants:\n\nAF_INET, AF_UNIX -- socket domains (first argument to socket() call)\nSOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)\n\nInteger constants:\n\nMany other constants may be defined; these may be used in calls to\nthe setsockopt() and getsockopt() methods.\n\"\"\"\n\nimport _socket\nfrom _socket import *\n\nimport os,sys,io,selectors\nfrom enum import IntEnum,IntFlag\n\ntry :\n import errno\nexcept ImportError:\n errno=None\nEBADF=getattr(errno,'EBADF',9)\nEAGAIN=getattr(errno,'EAGAIN',11)\nEWOULDBLOCK=getattr(errno,'EWOULDBLOCK',11)\n\n__all__=[\"fromfd\",\"getfqdn\",\"create_connection\",\"create_server\",\n\"has_dualstack_ipv6\",\"AddressFamily\",\"SocketKind\"]\n__all__.extend(os._get_exports_list(_socket))\n\n\n\n\n\n\n\nIntEnum._convert_(\n'AddressFamily',\n__name__,\nlambda C:C.isupper()and C.startswith('AF_'))\n\nIntEnum._convert_(\n'SocketKind',\n__name__,\nlambda C:C.isupper()and C.startswith('SOCK_'))\n\nIntFlag._convert_(\n'MsgFlag',\n__name__,\nlambda C:C.isupper()and C.startswith('MSG_'))\n\nIntFlag._convert_(\n'AddressInfo',\n__name__,\nlambda C:C.isupper()and C.startswith('AI_'))\n\n_LOCALHOST='127.0.0.1'\n_LOCALHOST_V6='::1'\n\n\ndef _intenum_converter(value,enum_klass):\n ''\n\n\n \n try :\n return enum_klass(value)\n except ValueError:\n return value\n \n \n \nif sys.platform.lower().startswith(\"win\"):\n errorTab={}\n errorTab[6]=\"Specified event object handle is invalid.\"\n errorTab[8]=\"Insufficient memory available.\"\n errorTab[87]=\"One or more parameters are invalid.\"\n errorTab[995]=\"Overlapped operation aborted.\"\n errorTab[996]=\"Overlapped I/O event object not in signaled state.\"\n errorTab[997]=\"Overlapped operation will complete later.\"\n errorTab[10004]=\"The operation was interrupted.\"\n errorTab[10009]=\"A bad file handle was passed.\"\n errorTab[10013]=\"Permission denied.\"\n errorTab[10014]=\"A fault occurred on the network??\"\n errorTab[10022]=\"An invalid operation was attempted.\"\n errorTab[10024]=\"Too many open files.\"\n errorTab[10035]=\"The socket operation would block.\"\n errorTab[10036]=\"A blocking operation is already in progress.\"\n errorTab[10037]=\"Operation already in progress.\"\n errorTab[10038]=\"Socket operation on nonsocket.\"\n errorTab[10039]=\"Destination address required.\"\n errorTab[10040]=\"Message too long.\"\n errorTab[10041]=\"Protocol wrong type for socket.\"\n errorTab[10042]=\"Bad protocol option.\"\n errorTab[10043]=\"Protocol not supported.\"\n errorTab[10044]=\"Socket type not supported.\"\n errorTab[10045]=\"Operation not supported.\"\n errorTab[10046]=\"Protocol family not supported.\"\n errorTab[10047]=\"Address family not supported by protocol family.\"\n errorTab[10048]=\"The network address is in use.\"\n errorTab[10049]=\"Cannot assign requested address.\"\n errorTab[10050]=\"Network is down.\"\n errorTab[10051]=\"Network is unreachable.\"\n errorTab[10052]=\"Network dropped connection on reset.\"\n errorTab[10053]=\"Software caused connection abort.\"\n errorTab[10054]=\"The connection has been reset.\"\n errorTab[10055]=\"No buffer space available.\"\n errorTab[10056]=\"Socket is already connected.\"\n errorTab[10057]=\"Socket is not connected.\"\n errorTab[10058]=\"The network has been shut down.\"\n errorTab[10059]=\"Too many references.\"\n errorTab[10060]=\"The operation timed out.\"\n errorTab[10061]=\"Connection refused.\"\n errorTab[10062]=\"Cannot translate name.\"\n errorTab[10063]=\"The name is too long.\"\n errorTab[10064]=\"The host is down.\"\n errorTab[10065]=\"The host is unreachable.\"\n errorTab[10066]=\"Directory not empty.\"\n errorTab[10067]=\"Too many processes.\"\n errorTab[10068]=\"User quota exceeded.\"\n errorTab[10069]=\"Disk quota exceeded.\"\n errorTab[10070]=\"Stale file handle reference.\"\n errorTab[10071]=\"Item is remote.\"\n errorTab[10091]=\"Network subsystem is unavailable.\"\n errorTab[10092]=\"Winsock.dll version out of range.\"\n errorTab[10093]=\"Successful WSAStartup not yet performed.\"\n errorTab[10101]=\"Graceful shutdown in progress.\"\n errorTab[10102]=\"No more results from WSALookupServiceNext.\"\n errorTab[10103]=\"Call has been canceled.\"\n errorTab[10104]=\"Procedure call table is invalid.\"\n errorTab[10105]=\"Service provider is invalid.\"\n errorTab[10106]=\"Service provider failed to initialize.\"\n errorTab[10107]=\"System call failure.\"\n errorTab[10108]=\"Service not found.\"\n errorTab[10109]=\"Class type not found.\"\n errorTab[10110]=\"No more results from WSALookupServiceNext.\"\n errorTab[10111]=\"Call was canceled.\"\n errorTab[10112]=\"Database query was refused.\"\n errorTab[11001]=\"Host not found.\"\n errorTab[11002]=\"Nonauthoritative host not found.\"\n errorTab[11003]=\"This is a nonrecoverable error.\"\n errorTab[11004]=\"Valid name, no data record requested type.\"\n errorTab[11005]=\"QoS receivers.\"\n errorTab[11006]=\"QoS senders.\"\n errorTab[11007]=\"No QoS senders.\"\n errorTab[11008]=\"QoS no receivers.\"\n errorTab[11009]=\"QoS request confirmed.\"\n errorTab[11010]=\"QoS admission error.\"\n errorTab[11011]=\"QoS policy failure.\"\n errorTab[11012]=\"QoS bad style.\"\n errorTab[11013]=\"QoS bad object.\"\n errorTab[11014]=\"QoS traffic control error.\"\n errorTab[11015]=\"QoS generic error.\"\n errorTab[11016]=\"QoS service type error.\"\n errorTab[11017]=\"QoS flowspec error.\"\n errorTab[11018]=\"Invalid QoS provider buffer.\"\n errorTab[11019]=\"Invalid QoS filter style.\"\n errorTab[11020]=\"Invalid QoS filter style.\"\n errorTab[11021]=\"Incorrect QoS filter count.\"\n errorTab[11022]=\"Invalid QoS object length.\"\n errorTab[11023]=\"Incorrect QoS flow count.\"\n errorTab[11024]=\"Unrecognized QoS object.\"\n errorTab[11025]=\"Invalid QoS policy object.\"\n errorTab[11026]=\"Invalid QoS flow descriptor.\"\n errorTab[11027]=\"Invalid QoS provider-specific flowspec.\"\n errorTab[11028]=\"Invalid QoS provider-specific filterspec.\"\n errorTab[11029]=\"Invalid QoS shape discard mode object.\"\n errorTab[11030]=\"Invalid QoS shaping rate object.\"\n errorTab[11031]=\"Reserved policy QoS element type.\"\n __all__.append(\"errorTab\")\n \n \nclass _GiveupOnSendfile(Exception):pass\n\n\nclass socket(_socket.socket):\n\n ''\n \n __slots__=[\"__weakref__\",\"_io_refs\",\"_closed\"]\n \n def __init__(self,family=-1,type=-1,proto=-1,fileno=None ):\n \n \n \n \n if fileno is None :\n if family ==-1:\n family=AF_INET\n if type ==-1:\n type=SOCK_STREAM\n if proto ==-1:\n proto=0\n _socket.socket.__init__(self,family,type,proto,fileno)\n self._io_refs=0\n self._closed=False\n \n def __enter__(self):\n return self\n \n def __exit__(self,*args):\n if not self._closed:\n self.close()\n \n def __repr__(self):\n ''\n\n \n closed=getattr(self,'_closed',False )\n s=\"<%s.%s%s fd=%i, family=%s, type=%s, proto=%i\"\\\n %(self.__class__.__module__,\n self.__class__.__qualname__,\n \" [closed]\"if closed else \"\",\n self.fileno(),\n self.family,\n self.type,\n self.proto)\n if not closed:\n try :\n laddr=self.getsockname()\n if laddr:\n s +=\", laddr=%s\"%str(laddr)\n except error:\n pass\n try :\n raddr=self.getpeername()\n if raddr:\n s +=\", raddr=%s\"%str(raddr)\n except error:\n pass\n s +='>'\n return s\n \n def __getstate__(self):\n raise TypeError(f\"cannot pickle {self.__class__.__name__!r} object\")\n \n def dup(self):\n ''\n\n\n\n \n fd=dup(self.fileno())\n sock=self.__class__(self.family,self.type,self.proto,fileno=fd)\n sock.settimeout(self.gettimeout())\n return sock\n \n def accept(self):\n ''\n\n\n\n\n \n fd,addr=self._accept()\n sock=socket(self.family,self.type,self.proto,fileno=fd)\n \n \n \n if getdefaulttimeout()is None and self.gettimeout():\n sock.setblocking(True )\n return sock,addr\n \n def makefile(self,mode=\"r\",buffering=None ,*,\n encoding=None ,errors=None ,newline=None ):\n ''\n\n\n\n \n \n if not set(mode)<={\"r\",\"w\",\"b\"}:\n raise ValueError(\"invalid mode %r (only r, w, b allowed)\"%(mode,))\n writing=\"w\"in mode\n reading=\"r\"in mode or not writing\n assert reading or writing\n binary=\"b\"in mode\n rawmode=\"\"\n if reading:\n rawmode +=\"r\"\n if writing:\n rawmode +=\"w\"\n raw=SocketIO(self,rawmode)\n self._io_refs +=1\n if buffering is None :\n buffering=-1\n if buffering <0:\n buffering=io.DEFAULT_BUFFER_SIZE\n if buffering ==0:\n if not binary:\n raise ValueError(\"unbuffered streams must be binary\")\n return raw\n if reading and writing:\n buffer=io.BufferedRWPair(raw,raw,buffering)\n elif reading:\n buffer=io.BufferedReader(raw,buffering)\n else :\n assert writing\n buffer=io.BufferedWriter(raw,buffering)\n if binary:\n return buffer\n encoding=io.text_encoding(encoding)\n text=io.TextIOWrapper(buffer,encoding,errors,newline)\n text.mode=mode\n return text\n \n if hasattr(os,'sendfile'):\n \n def _sendfile_use_sendfile(self,file,offset=0,count=None ):\n self._check_sendfile_params(file,offset,count)\n sockno=self.fileno()\n try :\n fileno=file.fileno()\n except (AttributeError,io.UnsupportedOperation)as err:\n raise _GiveupOnSendfile(err)\n try :\n fsize=os.fstat(fileno).st_size\n except OSError as err:\n raise _GiveupOnSendfile(err)\n if not fsize:\n return 0\n \n blocksize=min(count or fsize,2 **30)\n timeout=self.gettimeout()\n if timeout ==0:\n raise ValueError(\"non-blocking sockets are not supported\")\n \n \n \n if hasattr(selectors,'PollSelector'):\n selector=selectors.PollSelector()\n else :\n selector=selectors.SelectSelector()\n selector.register(sockno,selectors.EVENT_WRITE)\n \n total_sent=0\n \n selector_select=selector.select\n os_sendfile=os.sendfile\n try :\n while True :\n if timeout and not selector_select(timeout):\n raise TimeoutError('timed out')\n if count:\n blocksize=count -total_sent\n if blocksize <=0:\n break\n try :\n sent=os_sendfile(sockno,fileno,offset,blocksize)\n except BlockingIOError:\n if not timeout:\n \n \n selector_select()\n continue\n except OSError as err:\n if total_sent ==0:\n \n \n \n \n raise _GiveupOnSendfile(err)\n raise err from None\n else :\n if sent ==0:\n break\n offset +=sent\n total_sent +=sent\n return total_sent\n finally :\n if total_sent >0 and hasattr(file,'seek'):\n file.seek(offset)\n else :\n def _sendfile_use_sendfile(self,file,offset=0,count=None ):\n raise _GiveupOnSendfile(\n \"os.sendfile() not available on this platform\")\n \n def _sendfile_use_send(self,file,offset=0,count=None ):\n self._check_sendfile_params(file,offset,count)\n if self.gettimeout()==0:\n raise ValueError(\"non-blocking sockets are not supported\")\n if offset:\n file.seek(offset)\n blocksize=min(count,8192)if count else 8192\n total_sent=0\n \n file_read=file.read\n sock_send=self.send\n try :\n while True :\n if count:\n blocksize=min(count -total_sent,blocksize)\n if blocksize <=0:\n break\n data=memoryview(file_read(blocksize))\n if not data:\n break\n while True :\n try :\n sent=sock_send(data)\n except BlockingIOError:\n continue\n else :\n total_sent +=sent\n if sent 0 and hasattr(file,'seek'):\n file.seek(offset+total_sent)\n \n def _check_sendfile_params(self,file,offset,count):\n if 'b'not in getattr(file,'mode','b'):\n raise ValueError(\"file should be opened in binary mode\")\n if not self.type&SOCK_STREAM:\n raise ValueError(\"only SOCK_STREAM type sockets are supported\")\n if count is not None :\n if not isinstance(count,int):\n raise TypeError(\n \"count must be a positive integer (got {!r})\".format(count))\n if count <=0:\n raise ValueError(\n \"count must be a positive integer (got {!r})\".format(count))\n \n def sendfile(self,file,offset=0,count=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n return self._sendfile_use_sendfile(file,offset,count)\n except _GiveupOnSendfile:\n return self._sendfile_use_send(file,offset,count)\n \n def _decref_socketios(self):\n if self._io_refs >0:\n self._io_refs -=1\n if self._closed:\n self.close()\n \n def _real_close(self,_ss=_socket.socket):\n \n _ss.close(self)\n \n def close(self):\n \n self._closed=True\n if self._io_refs <=0:\n self._real_close()\n \n def detach(self):\n ''\n\n\n\n\n \n self._closed=True\n return super().detach()\n \n @property\n def family(self):\n ''\n \n return _intenum_converter(super().family,AddressFamily)\n \n @property\n def type(self):\n ''\n \n return _intenum_converter(super().type,SocketKind)\n \n if os.name =='nt':\n def get_inheritable(self):\n return os.get_handle_inheritable(self.fileno())\n def set_inheritable(self,inheritable):\n os.set_handle_inheritable(self.fileno(),inheritable)\n else :\n def get_inheritable(self):\n return os.get_inheritable(self.fileno())\n def set_inheritable(self,inheritable):\n os.set_inheritable(self.fileno(),inheritable)\n get_inheritable.__doc__=\"Get the inheritable flag of the socket\"\n set_inheritable.__doc__=\"Set the inheritable flag of the socket\"\n \ndef fromfd(fd,family,type,proto=0):\n ''\n\n\n\n \n nfd=dup(fd)\n return socket(family,type,proto,nfd)\n \nif hasattr(_socket.socket,\"sendmsg\"):\n import array\n \n def send_fds(sock,buffers,fds,flags=0,address=None ):\n ''\n\n\n \n return sock.sendmsg(buffers,[(_socket.SOL_SOCKET,\n _socket.SCM_RIGHTS,array.array(\"i\",fds))])\n __all__.append(\"send_fds\")\n \nif hasattr(_socket.socket,\"recvmsg\"):\n import array\n \n def recv_fds(sock,bufsize,maxfds,flags=0):\n ''\n\n\n\n\n \n \n fds=array.array(\"i\")\n msg,ancdata,flags,addr=sock.recvmsg(bufsize,\n _socket.CMSG_LEN(maxfds *fds.itemsize))\n for cmsg_level,cmsg_type,cmsg_data in ancdata:\n if (cmsg_level ==_socket.SOL_SOCKET and cmsg_type ==_socket.SCM_RIGHTS):\n fds.frombytes(cmsg_data[:\n len(cmsg_data)-(len(cmsg_data)%fds.itemsize)])\n \n return msg,list(fds),flags,addr\n __all__.append(\"recv_fds\")\n \nif hasattr(_socket.socket,\"share\"):\n def fromshare(info):\n ''\n\n\n\n \n return socket(0,0,0,info)\n __all__.append(\"fromshare\")\n \nif hasattr(_socket,\"socketpair\"):\n\n def socketpair(family=None ,type=SOCK_STREAM,proto=0):\n ''\n\n\n\n\n\n \n if family is None :\n try :\n family=AF_UNIX\n except NameError:\n family=AF_INET\n a,b=_socket.socketpair(family,type,proto)\n a=socket(family,type,proto,a.detach())\n b=socket(family,type,proto,b.detach())\n return a,b\n \nelse :\n\n\n def socketpair(family=AF_INET,type=SOCK_STREAM,proto=0):\n if family ==AF_INET:\n host=_LOCALHOST\n elif family ==AF_INET6:\n host=_LOCALHOST_V6\n else :\n raise ValueError(\"Only AF_INET and AF_INET6 socket address families \"\n \"are supported\")\n if type !=SOCK_STREAM:\n raise ValueError(\"Only SOCK_STREAM socket type is supported\")\n if proto !=0:\n raise ValueError(\"Only protocol zero is supported\")\n \n \n \n lsock=socket(family,type,proto)\n try :\n lsock.bind((host,0))\n lsock.listen()\n \n addr,port=lsock.getsockname()[:2]\n csock=socket(family,type,proto)\n try :\n csock.setblocking(False )\n try :\n csock.connect((addr,port))\n except (BlockingIOError,InterruptedError):\n pass\n csock.setblocking(True )\n ssock,_=lsock.accept()\n except :\n csock.close()\n raise\n finally :\n lsock.close()\n return (ssock,csock)\n __all__.append(\"socketpair\")\n \nsocketpair.__doc__=\"\"\"socketpair([family[, type[, proto]]]) -> (socket object, socket object)\nCreate a pair of socket objects from the sockets returned by the platform\nsocketpair() function.\nThe arguments are the same as for socket() except the default family is AF_UNIX\nif defined on the platform; otherwise, the default is AF_INET.\n\"\"\"\n\n_blocking_errnos={EAGAIN,EWOULDBLOCK}\n\nclass SocketIO(io.RawIOBase):\n\n ''\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n def __init__(self,sock,mode):\n if mode not in (\"r\",\"w\",\"rw\",\"rb\",\"wb\",\"rwb\"):\n raise ValueError(\"invalid mode: %r\"%mode)\n io.RawIOBase.__init__(self)\n self._sock=sock\n if \"b\"not in mode:\n mode +=\"b\"\n self._mode=mode\n self._reading=\"r\"in mode\n self._writing=\"w\"in mode\n self._timeout_occurred=False\n \n def readinto(self,b):\n ''\n\n\n\n\n\n \n self._checkClosed()\n self._checkReadable()\n if self._timeout_occurred:\n raise OSError(\"cannot read from timed out object\")\n while True :\n try :\n return self._sock.recv_into(b)\n except timeout:\n self._timeout_occurred=True\n raise\n except error as e:\n if e.errno in _blocking_errnos:\n return None\n raise\n \n def write(self,b):\n ''\n\n\n\n \n self._checkClosed()\n self._checkWritable()\n try :\n return self._sock.send(b)\n except error as e:\n \n if e.errno in _blocking_errnos:\n return None\n raise\n \n def readable(self):\n ''\n \n if self.closed:\n raise ValueError(\"I/O operation on closed socket.\")\n return self._reading\n \n def writable(self):\n ''\n \n if self.closed:\n raise ValueError(\"I/O operation on closed socket.\")\n return self._writing\n \n def seekable(self):\n ''\n \n if self.closed:\n raise ValueError(\"I/O operation on closed socket.\")\n return super().seekable()\n \n def fileno(self):\n ''\n \n self._checkClosed()\n return self._sock.fileno()\n \n @property\n def name(self):\n if not self.closed:\n return self.fileno()\n else :\n return -1\n \n @property\n def mode(self):\n return self._mode\n \n def close(self):\n ''\n\n \n if self.closed:\n return\n io.RawIOBase.close(self)\n self._sock._decref_socketios()\n self._sock=None\n \n \ndef getfqdn(name=''):\n ''\n\n\n\n\n\n\n\n \n name=name.strip()\n if not name or name =='0.0.0.0':\n name=gethostname()\n try :\n hostname,aliases,ipaddrs=gethostbyaddr(name)\n except error:\n pass\n else :\n aliases.insert(0,hostname)\n for name in aliases:\n if '.'in name:\n break\n else :\n name=hostname\n return name\n \n \n_GLOBAL_DEFAULT_TIMEOUT=object()\n\ndef create_connection(address,timeout=_GLOBAL_DEFAULT_TIMEOUT,\nsource_address=None ,*,all_errors=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n host,port=address\n exceptions=[]\n for res in getaddrinfo(host,port,0,SOCK_STREAM):\n af,socktype,proto,canonname,sa=res\n sock=None\n try :\n sock=socket(af,socktype,proto)\n if timeout is not _GLOBAL_DEFAULT_TIMEOUT:\n sock.settimeout(timeout)\n if source_address:\n sock.bind(source_address)\n sock.connect(sa)\n \n exceptions.clear()\n return sock\n \n except error as exc:\n if not all_errors:\n exceptions.clear()\n exceptions.append(exc)\n if sock is not None :\n sock.close()\n \n if len(exceptions):\n try :\n if not all_errors:\n raise exceptions[0]\n raise ExceptionGroup(\"create_connection failed\",exceptions)\n finally :\n \n exceptions.clear()\n else :\n raise error(\"getaddrinfo returns an empty list\")\n \n \ndef has_dualstack_ipv6():\n ''\n\n \n if not has_ipv6\\\n or not hasattr(_socket,'IPPROTO_IPV6')\\\n or not hasattr(_socket,'IPV6_V6ONLY'):\n return False\n try :\n with socket(AF_INET6,SOCK_STREAM)as sock:\n sock.setsockopt(IPPROTO_IPV6,IPV6_V6ONLY,0)\n return True\n except error:\n return False\n \n \ndef create_server(address,*,family=AF_INET,backlog=None ,reuse_port=False ,\ndualstack_ipv6=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if reuse_port and not hasattr(_socket,\"SO_REUSEPORT\"):\n raise ValueError(\"SO_REUSEPORT not supported on this platform\")\n if dualstack_ipv6:\n if not has_dualstack_ipv6():\n raise ValueError(\"dualstack_ipv6 not supported on this platform\")\n if family !=AF_INET6:\n raise ValueError(\"dualstack_ipv6 requires AF_INET6 family\")\n sock=socket(family,SOCK_STREAM)\n try :\n \n \n \n \n \n \n \n \n \n if os.name not in ('nt','cygwin')and\\\n hasattr(_socket,'SO_REUSEADDR'):\n try :\n sock.setsockopt(SOL_SOCKET,SO_REUSEADDR,1)\n except error:\n \n \n pass\n if reuse_port:\n sock.setsockopt(SOL_SOCKET,SO_REUSEPORT,1)\n if has_ipv6 and family ==AF_INET6:\n if dualstack_ipv6:\n sock.setsockopt(IPPROTO_IPV6,IPV6_V6ONLY,0)\n elif hasattr(_socket,\"IPV6_V6ONLY\")and\\\n hasattr(_socket,\"IPPROTO_IPV6\"):\n sock.setsockopt(IPPROTO_IPV6,IPV6_V6ONLY,1)\n try :\n sock.bind(address)\n except error as err:\n msg='%s (while attempting to bind on address %r)'%\\\n (err.strerror,address)\n raise error(err.errno,msg)from None\n if backlog is None :\n sock.listen()\n else :\n sock.listen(backlog)\n return sock\n except error:\n sock.close()\n raise\n \n \ndef getaddrinfo(host,port,family=0,type=0,proto=0,flags=0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n addrlist=[]\n for res in _socket.getaddrinfo(host,port,family,type,proto,flags):\n af,socktype,proto,canonname,sa=res\n addrlist.append((_intenum_converter(af,AddressFamily),\n _intenum_converter(socktype,SocketKind),\n proto,canonname,sa))\n return addrlist\n", ["_socket", "array", "enum", "errno", "io", "os", "selectors", "sys"]], "sre_compile": [".py", "import warnings\nwarnings.warn(f\"module {__name__!r} is deprecated\",\nDeprecationWarning,\nstacklevel=2)\n\nfrom re import _compiler as _\nglobals().update({k:v for k,v in vars(_).items()if k[:2]!='__'})\n", ["re", "warnings"]], "sre_constants": [".py", "import warnings\nwarnings.warn(f\"module {__name__!r} is deprecated\",\nDeprecationWarning,\nstacklevel=2)\n\nfrom re import _constants as _\nglobals().update({k:v for k,v in vars(_).items()if k[:2]!='__'})\n", ["re", "warnings"]], "sre_parse": [".py", "import warnings\nwarnings.warn(f\"module {__name__!r} is deprecated\",\nDeprecationWarning,\nstacklevel=2)\n\nfrom re import _parser as _\nglobals().update({k:v for k,v in vars(_).items()if k[:2]!='__'})\n", ["re", "warnings"]], "stat": [".py", "''\n\n\n\n\n\n\nST_MODE=0\nST_INO=1\nST_DEV=2\nST_NLINK=3\nST_UID=4\nST_GID=5\nST_SIZE=6\nST_ATIME=7\nST_MTIME=8\nST_CTIME=9\n\n\n\ndef S_IMODE(mode):\n ''\n\n \n return mode&0o7777\n \ndef S_IFMT(mode):\n ''\n\n \n return mode&0o170000\n \n \n \n \nS_IFDIR=0o040000\nS_IFCHR=0o020000\nS_IFBLK=0o060000\nS_IFREG=0o100000\nS_IFIFO=0o010000\nS_IFLNK=0o120000\nS_IFSOCK=0o140000\n\nS_IFDOOR=0\nS_IFPORT=0\nS_IFWHT=0\n\n\n\ndef S_ISDIR(mode):\n ''\n return S_IFMT(mode)==S_IFDIR\n \ndef S_ISCHR(mode):\n ''\n return S_IFMT(mode)==S_IFCHR\n \ndef S_ISBLK(mode):\n ''\n return S_IFMT(mode)==S_IFBLK\n \ndef S_ISREG(mode):\n ''\n return S_IFMT(mode)==S_IFREG\n \ndef S_ISFIFO(mode):\n ''\n return S_IFMT(mode)==S_IFIFO\n \ndef S_ISLNK(mode):\n ''\n return S_IFMT(mode)==S_IFLNK\n \ndef S_ISSOCK(mode):\n ''\n return S_IFMT(mode)==S_IFSOCK\n \ndef S_ISDOOR(mode):\n ''\n return False\n \ndef S_ISPORT(mode):\n ''\n return False\n \ndef S_ISWHT(mode):\n ''\n return False\n \n \n \nS_ISUID=0o4000\nS_ISGID=0o2000\nS_ENFMT=S_ISGID\nS_ISVTX=0o1000\nS_IREAD=0o0400\nS_IWRITE=0o0200\nS_IEXEC=0o0100\nS_IRWXU=0o0700\nS_IRUSR=0o0400\nS_IWUSR=0o0200\nS_IXUSR=0o0100\nS_IRWXG=0o0070\nS_IRGRP=0o0040\nS_IWGRP=0o0020\nS_IXGRP=0o0010\nS_IRWXO=0o0007\nS_IROTH=0o0004\nS_IWOTH=0o0002\nS_IXOTH=0o0001\n\n\n\nUF_NODUMP=0x00000001\nUF_IMMUTABLE=0x00000002\nUF_APPEND=0x00000004\nUF_OPAQUE=0x00000008\nUF_NOUNLINK=0x00000010\nUF_COMPRESSED=0x00000020\nUF_HIDDEN=0x00008000\nSF_ARCHIVED=0x00010000\nSF_IMMUTABLE=0x00020000\nSF_APPEND=0x00040000\nSF_NOUNLINK=0x00100000\nSF_SNAPSHOT=0x00200000\n\n\n_filemode_table=(\n((S_IFLNK,\"l\"),\n(S_IFSOCK,\"s\"),\n(S_IFREG,\"-\"),\n(S_IFBLK,\"b\"),\n(S_IFDIR,\"d\"),\n(S_IFCHR,\"c\"),\n(S_IFIFO,\"p\")),\n\n((S_IRUSR,\"r\"),),\n((S_IWUSR,\"w\"),),\n((S_IXUSR |S_ISUID,\"s\"),\n(S_ISUID,\"S\"),\n(S_IXUSR,\"x\")),\n\n((S_IRGRP,\"r\"),),\n((S_IWGRP,\"w\"),),\n((S_IXGRP |S_ISGID,\"s\"),\n(S_ISGID,\"S\"),\n(S_IXGRP,\"x\")),\n\n((S_IROTH,\"r\"),),\n((S_IWOTH,\"w\"),),\n((S_IXOTH |S_ISVTX,\"t\"),\n(S_ISVTX,\"T\"),\n(S_IXOTH,\"x\"))\n)\n\ndef filemode(mode):\n ''\n perm=[]\n for table in _filemode_table:\n for bit,char in table:\n if mode&bit ==bit:\n perm.append(char)\n break\n else :\n perm.append(\"-\")\n return \"\".join(perm)\n \n \n \n \n \nFILE_ATTRIBUTE_ARCHIVE=32\nFILE_ATTRIBUTE_COMPRESSED=2048\nFILE_ATTRIBUTE_DEVICE=64\nFILE_ATTRIBUTE_DIRECTORY=16\nFILE_ATTRIBUTE_ENCRYPTED=16384\nFILE_ATTRIBUTE_HIDDEN=2\nFILE_ATTRIBUTE_INTEGRITY_STREAM=32768\nFILE_ATTRIBUTE_NORMAL=128\nFILE_ATTRIBUTE_NOT_CONTENT_INDEXED=8192\nFILE_ATTRIBUTE_NO_SCRUB_DATA=131072\nFILE_ATTRIBUTE_OFFLINE=4096\nFILE_ATTRIBUTE_READONLY=1\nFILE_ATTRIBUTE_REPARSE_POINT=1024\nFILE_ATTRIBUTE_SPARSE_FILE=512\nFILE_ATTRIBUTE_SYSTEM=4\nFILE_ATTRIBUTE_TEMPORARY=256\nFILE_ATTRIBUTE_VIRTUAL=65536\n\n\n\ntry :\n from _stat import *\nexcept ImportError:\n pass\n", ["_stat"]], "statistics": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\n'NormalDist',\n'StatisticsError',\n'correlation',\n'covariance',\n'fmean',\n'geometric_mean',\n'harmonic_mean',\n'linear_regression',\n'mean',\n'median',\n'median_grouped',\n'median_high',\n'median_low',\n'mode',\n'multimode',\n'pstdev',\n'pvariance',\n'quantiles',\n'stdev',\n'variance',\n]\n\nimport math\nimport numbers\nimport random\nimport sys\n\nfrom fractions import Fraction\nfrom decimal import Decimal\nfrom itertools import count,groupby,repeat\nfrom bisect import bisect_left,bisect_right\nfrom math import hypot,sqrt,fabs,exp,erf,tau,log,fsum,sumprod\nfrom functools import reduce\nfrom operator import itemgetter\nfrom collections import Counter,namedtuple,defaultdict\n\n_SQRT2=sqrt(2.0)\n\n\n\nclass StatisticsError(ValueError):\n pass\n \n \n \n \ndef _sum(data):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n count=0\n types=set()\n types_add=types.add\n partials={}\n partials_get=partials.get\n for typ,values in groupby(data,type):\n types_add(typ)\n for n,d in map(_exact_ratio,values):\n count +=1\n partials[d]=partials_get(d,0)+n\n if None in partials:\n \n \n total=partials[None]\n assert not _isfinite(total)\n else:\n \n total=sum(Fraction(n,d)for d,n in partials.items())\n T=reduce(_coerce,types,int)\n return(T,total,count)\n \n \ndef _ss(data,c=None):\n ''\n\n\n\n\n\n\n \n if c is not None:\n T,ssd,count=_sum((d :=x -c)*d for x in data)\n return(T,ssd,c,count)\n count=0\n types=set()\n types_add=types.add\n sx_partials=defaultdict(int)\n sxx_partials=defaultdict(int)\n for typ,values in groupby(data,type):\n types_add(typ)\n for n,d in map(_exact_ratio,values):\n count +=1\n sx_partials[d]+=n\n sxx_partials[d]+=n *n\n if not count:\n ssd=c=Fraction(0)\n elif None in sx_partials:\n \n \n ssd=c=sx_partials[None]\n assert not _isfinite(ssd)\n else:\n sx=sum(Fraction(n,d)for d,n in sx_partials.items())\n sxx=sum(Fraction(n,d *d)for d,n in sxx_partials.items())\n \n \n ssd=(count *sxx -sx *sx)/count\n c=sx /count\n T=reduce(_coerce,types,int)\n return(T,ssd,c,count)\n \n \ndef _isfinite(x):\n try:\n return x.is_finite()\n except AttributeError:\n return math.isfinite(x)\n \n \ndef _coerce(T,S):\n ''\n\n\n\n \n \n assert T is not bool,\"initial type T is bool\"\n \n \n \n if T is S:return T\n \n if S is int or S is bool:return T\n if T is int:return S\n \n if issubclass(S,T):return S\n if issubclass(T,S):return T\n \n if issubclass(T,int):return S\n if issubclass(S,int):return T\n \n if issubclass(T,Fraction)and issubclass(S,float):\n return S\n if issubclass(T,float)and issubclass(S,Fraction):\n return T\n \n msg=\"don't know how to coerce %s and %s\"\n raise TypeError(msg %(T.__name__,S.__name__))\n \n \ndef _exact_ratio(x):\n ''\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n try:\n return x.as_integer_ratio()\n except AttributeError:\n pass\n except(OverflowError,ValueError):\n \n assert not _isfinite(x)\n return(x,None)\n try:\n \n return(x.numerator,x.denominator)\n except AttributeError:\n msg=f\"can't convert type '{type(x).__name__}' to numerator/denominator\"\n raise TypeError(msg)\n \n \ndef _convert(value,T):\n ''\n if type(value)is T:\n \n \n return value\n if issubclass(T,int)and value.denominator !=1:\n T=float\n try:\n \n return T(value)\n except TypeError:\n if issubclass(T,Decimal):\n return T(value.numerator)/T(value.denominator)\n else:\n raise\n \n \ndef _fail_neg(values,errmsg='negative value'):\n ''\n for x in values:\n if x <0:\n raise StatisticsError(errmsg)\n yield x\n \n \ndef _rank(data,/,*,key=None,reverse=False,ties='average',start=1)->list[float]:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n if ties !='average':\n raise ValueError(f'Unknown tie resolution method: {ties !r}')\n if key is not None:\n data=map(key,data)\n val_pos=sorted(zip(data,count()),reverse=reverse)\n i=start -1\n result=[0]*len(val_pos)\n for _,g in groupby(val_pos,key=itemgetter(0)):\n group=list(g)\n size=len(group)\n rank=i+(size+1)/2\n for value,orig_pos in group:\n result[orig_pos]=rank\n i +=size\n return result\n \n \ndef _integer_sqrt_of_frac_rto(n:int,m:int)->int:\n ''\n \n a=math.isqrt(n //m)\n return a |(a *a *m !=n)\n \n \n \n \n_sqrt_bit_width:int=2 *sys.float_info.mant_dig+3\n\n\ndef _float_sqrt_of_frac(n:int,m:int)->float:\n ''\n \n q=(n.bit_length()-m.bit_length()-_sqrt_bit_width)//2\n if q >=0:\n numerator=_integer_sqrt_of_frac_rto(n,m <<2 *q)<Decimal:\n ''\n \n \n \n if n <=0:\n if not n:\n return Decimal('0.0')\n n,m=-n,-m\n \n root=(Decimal(n)/Decimal(m)).sqrt()\n nr,dr=root.as_integer_ratio()\n \n plus=root.next_plus()\n np,dp=plus.as_integer_ratio()\n \n if 4 *n *(dr *dp)**2 >m *(dr *np+dp *nr)**2:\n return plus\n \n minus=root.next_minus()\n nm,dm=minus.as_integer_ratio()\n \n if 4 *n *(dr *dm)**2 ld -1 else j\n delta=i *m -j *n\n interpolated=(data[j -1]*(n -delta)+data[j]*delta)/n\n result.append(interpolated)\n return result\n raise ValueError(f'Unknown method: {method !r}')\n \n \n \n \n \n \n \n \ndef variance(data,xbar=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n T,ss,c,n=_ss(data,xbar)\n if n <2:\n raise StatisticsError('variance requires at least two data points')\n return _convert(ss /(n -1),T)\n \n \ndef pvariance(data,mu=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n T,ss,c,n=_ss(data,mu)\n if n <1:\n raise StatisticsError('pvariance requires at least one data point')\n return _convert(ss /n,T)\n \n \ndef stdev(data,xbar=None):\n ''\n\n\n\n\n\n\n \n T,ss,c,n=_ss(data,xbar)\n if n <2:\n raise StatisticsError('stdev requires at least two data points')\n mss=ss /(n -1)\n if issubclass(T,Decimal):\n return _decimal_sqrt_of_frac(mss.numerator,mss.denominator)\n return _float_sqrt_of_frac(mss.numerator,mss.denominator)\n \n \ndef pstdev(data,mu=None):\n ''\n\n\n\n\n\n\n \n T,ss,c,n=_ss(data,mu)\n if n <1:\n raise StatisticsError('pstdev requires at least one data point')\n mss=ss /n\n if issubclass(T,Decimal):\n return _decimal_sqrt_of_frac(mss.numerator,mss.denominator)\n return _float_sqrt_of_frac(mss.numerator,mss.denominator)\n \n \ndef _mean_stdev(data):\n ''\n T,ss,xbar,n=_ss(data)\n if n <2:\n raise StatisticsError('stdev requires at least two data points')\n mss=ss /(n -1)\n try:\n return float(xbar),_float_sqrt_of_frac(mss.numerator,mss.denominator)\n except AttributeError:\n \n return float(xbar),float(xbar)/float(ss)\n \n \n \n \n \n \n \n \n \ndef covariance(x,y,/):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n n=len(x)\n if len(y)!=n:\n raise StatisticsError('covariance requires that both inputs have same number of data points')\n if n <2:\n raise StatisticsError('covariance requires at least two data points')\n xbar=fsum(x)/n\n ybar=fsum(y)/n\n sxy=sumprod((xi -xbar for xi in x),(yi -ybar for yi in y))\n return sxy /(n -1)\n \n \ndef correlation(x,y,/,*,method='linear'):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n n=len(x)\n if len(y)!=n:\n raise StatisticsError('correlation requires that both inputs have same number of data points')\n if n <2:\n raise StatisticsError('correlation requires at least two data points')\n if method not in{'linear','ranked'}:\n raise ValueError(f'Unknown method: {method !r}')\n if method =='ranked':\n start=(n -1)/-2\n x=_rank(x,start=start)\n y=_rank(y,start=start)\n else:\n xbar=fsum(x)/n\n ybar=fsum(y)/n\n x=[xi -xbar for xi in x]\n y=[yi -ybar for yi in y]\n sxy=sumprod(x,y)\n sxx=sumprod(x,x)\n syy=sumprod(y,y)\n try:\n return sxy /sqrt(sxx *syy)\n except ZeroDivisionError:\n raise StatisticsError('at least one of the inputs is constant')\n \n \nLinearRegression=namedtuple('LinearRegression',('slope','intercept'))\n\n\ndef linear_regression(x,y,/,*,proportional=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n n=len(x)\n if len(y)!=n:\n raise StatisticsError('linear regression requires that both inputs have same number of data points')\n if n <2:\n raise StatisticsError('linear regression requires at least two data points')\n if not proportional:\n xbar=fsum(x)/n\n ybar=fsum(y)/n\n x=[xi -xbar for xi in x]\n y=(yi -ybar for yi in y)\n sxy=sumprod(x,y)+0.0\n sxx=sumprod(x,x)\n try:\n slope=sxy /sxx\n except ZeroDivisionError:\n raise StatisticsError('x is constant')\n intercept=0.0 if proportional else ybar -slope *xbar\n return LinearRegression(slope=slope,intercept=intercept)\n \n \n \n \n \ndef _normal_dist_inv_cdf(p,mu,sigma):\n\n\n\n\n\n q=p -0.5\n if fabs(q)<=0.425:\n r=0.180625 -q *q\n \n num=(((((((2.50908_09287_30122_6727e+3 *r+\n 3.34305_75583_58812_8105e+4)*r+\n 6.72657_70927_00870_0853e+4)*r+\n 4.59219_53931_54987_1457e+4)*r+\n 1.37316_93765_50946_1125e+4)*r+\n 1.97159_09503_06551_4427e+3)*r+\n 1.33141_66789_17843_7745e+2)*r+\n 3.38713_28727_96366_6080e+0)*q\n den=(((((((5.22649_52788_52854_5610e+3 *r+\n 2.87290_85735_72194_2674e+4)*r+\n 3.93078_95800_09271_0610e+4)*r+\n 2.12137_94301_58659_5867e+4)*r+\n 5.39419_60214_24751_1077e+3)*r+\n 6.87187_00749_20579_0830e+2)*r+\n 4.23133_30701_60091_1252e+1)*r+\n 1.0)\n x=num /den\n return mu+(x *sigma)\n r=p if q <=0.0 else 1.0 -p\n r=sqrt(-log(r))\n if r <=5.0:\n r=r -1.6\n \n num=(((((((7.74545_01427_83414_07640e-4 *r+\n 2.27238_44989_26918_45833e-2)*r+\n 2.41780_72517_74506_11770e-1)*r+\n 1.27045_82524_52368_38258e+0)*r+\n 3.64784_83247_63204_60504e+0)*r+\n 5.76949_72214_60691_40550e+0)*r+\n 4.63033_78461_56545_29590e+0)*r+\n 1.42343_71107_49683_57734e+0)\n den=(((((((1.05075_00716_44416_84324e-9 *r+\n 5.47593_80849_95344_94600e-4)*r+\n 1.51986_66563_61645_71966e-2)*r+\n 1.48103_97642_74800_74590e-1)*r+\n 6.89767_33498_51000_04550e-1)*r+\n 1.67638_48301_83803_84940e+0)*r+\n 2.05319_16266_37758_82187e+0)*r+\n 1.0)\n else:\n r=r -5.0\n \n num=(((((((2.01033_43992_92288_13265e-7 *r+\n 2.71155_55687_43487_57815e-5)*r+\n 1.24266_09473_88078_43860e-3)*r+\n 2.65321_89526_57612_30930e-2)*r+\n 2.96560_57182_85048_91230e-1)*r+\n 1.78482_65399_17291_33580e+0)*r+\n 5.46378_49111_64114_36990e+0)*r+\n 6.65790_46435_01103_77720e+0)\n den=(((((((2.04426_31033_89939_78564e-15 *r+\n 1.42151_17583_16445_88870e-7)*r+\n 1.84631_83175_10054_68180e-5)*r+\n 7.86869_13114_56132_59100e-4)*r+\n 1.48753_61290_85061_48525e-2)*r+\n 1.36929_88092_27358_05310e-1)*r+\n 5.99832_20655_58879_37690e-1)*r+\n 1.0)\n x=num /den\n if q <0.0:\n x=-x\n return mu+(x *sigma)\n \n \n \ntry:\n from _statistics import _normal_dist_inv_cdf\nexcept ImportError:\n pass\n \n \nclass NormalDist:\n ''\n \n \n \n __slots__={\n '_mu':'Arithmetic mean of a normal distribution',\n '_sigma':'Standard deviation of a normal distribution',\n }\n \n def __init__(self,mu=0.0,sigma=1.0):\n ''\n if sigma <0.0:\n raise StatisticsError('sigma must be non-negative')\n self._mu=float(mu)\n self._sigma=float(sigma)\n \n @classmethod\n def from_samples(cls,data):\n ''\n return cls(*_mean_stdev(data))\n \n def samples(self,n,*,seed=None):\n ''\n gauss=random.gauss if seed is None else random.Random(seed).gauss\n mu,sigma=self._mu,self._sigma\n return[gauss(mu,sigma)for _ in repeat(None,n)]\n \n def pdf(self,x):\n ''\n variance=self._sigma *self._sigma\n if not variance:\n raise StatisticsError('pdf() not defined when sigma is zero')\n diff=x -self._mu\n return exp(diff *diff /(-2.0 *variance))/sqrt(tau *variance)\n \n def cdf(self,x):\n ''\n if not self._sigma:\n raise StatisticsError('cdf() not defined when sigma is zero')\n return 0.5 *(1.0+erf((x -self._mu)/(self._sigma *_SQRT2)))\n \n def inv_cdf(self,p):\n ''\n\n\n\n\n\n\n\n \n if p <=0.0 or p >=1.0:\n raise StatisticsError('p must be in the range 0.0 < p < 1.0')\n return _normal_dist_inv_cdf(p,self._mu,self._sigma)\n \n def quantiles(self,n=4):\n ''\n\n\n\n\n\n\n \n return[self.inv_cdf(i /n)for i in range(1,n)]\n \n def overlap(self,other):\n ''\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n if not isinstance(other,NormalDist):\n raise TypeError('Expected another NormalDist instance')\n X,Y=self,other\n if(Y._sigma,Y._mu)<(X._sigma,X._mu):\n X,Y=Y,X\n X_var,Y_var=X.variance,Y.variance\n if not X_var or not Y_var:\n raise StatisticsError('overlap() not defined when sigma is zero')\n dv=Y_var -X_var\n dm=fabs(Y._mu -X._mu)\n if not dv:\n return 1.0 -erf(dm /(2.0 *X._sigma *_SQRT2))\n a=X._mu *Y_var -Y._mu *X_var\n b=X._sigma *Y._sigma *sqrt(dm *dm+dv *log(Y_var /X_var))\n x1=(a+b)/dv\n x2=(a -b)/dv\n return 1.0 -(fabs(Y.cdf(x1)-X.cdf(x1))+fabs(Y.cdf(x2)-X.cdf(x2)))\n \n def zscore(self,x):\n ''\n\n\n\n \n \n if not self._sigma:\n raise StatisticsError('zscore() not defined when sigma is zero')\n return(x -self._mu)/self._sigma\n \n @property\n def mean(self):\n ''\n return self._mu\n \n @property\n def median(self):\n ''\n return self._mu\n \n @property\n def mode(self):\n ''\n\n\n\n \n return self._mu\n \n @property\n def stdev(self):\n ''\n return self._sigma\n \n @property\n def variance(self):\n ''\n return self._sigma *self._sigma\n \n def __add__(x1,x2):\n ''\n\n\n\n\n\n\n\n \n if isinstance(x2,NormalDist):\n return NormalDist(x1._mu+x2._mu,hypot(x1._sigma,x2._sigma))\n return NormalDist(x1._mu+x2,x1._sigma)\n \n def __sub__(x1,x2):\n ''\n\n\n\n\n\n\n\n \n if isinstance(x2,NormalDist):\n return NormalDist(x1._mu -x2._mu,hypot(x1._sigma,x2._sigma))\n return NormalDist(x1._mu -x2,x1._sigma)\n \n def __mul__(x1,x2):\n ''\n\n\n\n \n return NormalDist(x1._mu *x2,x1._sigma *fabs(x2))\n \n def __truediv__(x1,x2):\n ''\n\n\n\n \n return NormalDist(x1._mu /x2,x1._sigma /fabs(x2))\n \n def __pos__(x1):\n ''\n return NormalDist(x1._mu,x1._sigma)\n \n def __neg__(x1):\n ''\n return NormalDist(-x1._mu,x1._sigma)\n \n __radd__=__add__\n \n def __rsub__(x1,x2):\n ''\n return -(x1 -x2)\n \n __rmul__=__mul__\n \n def __eq__(x1,x2):\n ''\n if not isinstance(x2,NormalDist):\n return NotImplemented\n return x1._mu ==x2._mu and x1._sigma ==x2._sigma\n \n def __hash__(self):\n ''\n return hash((self._mu,self._sigma))\n \n def __repr__(self):\n return f'{type(self).__name__}(mu={self._mu !r}, sigma={self._sigma !r})'\n \n def __getstate__(self):\n return self._mu,self._sigma\n \n def __setstate__(self,state):\n self._mu,self._sigma=state\n", ["_statistics", "bisect", "collections", "decimal", "fractions", "functools", "itertools", "math", "numbers", "operator", "random", "sys"]], "string": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\"ascii_letters\",\"ascii_lowercase\",\"ascii_uppercase\",\"capwords\",\n\"digits\",\"hexdigits\",\"octdigits\",\"printable\",\"punctuation\",\n\"whitespace\",\"Formatter\",\"Template\"]\n\nimport _string\n\n\nwhitespace=' \\t\\n\\r\\v\\f'\nascii_lowercase='abcdefghijklmnopqrstuvwxyz'\nascii_uppercase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\nascii_letters=ascii_lowercase+ascii_uppercase\ndigits='0123456789'\nhexdigits=digits+'abcdef'+'ABCDEF'\noctdigits='01234567'\npunctuation=r\"\"\"!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\"\"\"\nprintable=digits+ascii_letters+punctuation+whitespace\n\n\n\n\ndef capwords(s,sep=None):\n ''\n\n\n\n\n\n\n\n\n \n return(sep or ' ').join(map(str.capitalize,s.split(sep)))\n \n \n \nimport re as _re\nfrom collections import ChainMap as _ChainMap\n\n_sentinel_dict={}\n\nclass Template:\n ''\n \n delimiter='$'\n \n \n \n \n idpattern=r'(?a:[_a-z][_a-z0-9]*)'\n braceidpattern=None\n flags=_re.IGNORECASE\n \n def __init_subclass__(cls):\n super().__init_subclass__()\n if 'pattern'in cls.__dict__:\n pattern=cls.pattern\n else:\n delim=_re.escape(cls.delimiter)\n id=cls.idpattern\n bid=cls.braceidpattern or cls.idpattern\n pattern=fr\"\"\"\n {delim}(?:\n (?P{delim}) | # Escape sequence of two delimiters\n (?P{id}) | # delimiter and a Python identifier\n {{(?P{bid})}} | # delimiter and a braced identifier\n (?P) # Other ill-formed delimiter exprs\n )\n \"\"\"\n cls.pattern=_re.compile(pattern,cls.flags |_re.VERBOSE)\n \n def __init__(self,template):\n self.template=template\n \n \n \n def _invalid(self,mo):\n i=mo.start('invalid')\n lines=self.template[:i].splitlines(keepends=True)\n if not lines:\n colno=1\n lineno=1\n else:\n colno=i -len(''.join(lines[:-1]))\n lineno=len(lines)\n raise ValueError('Invalid placeholder in string: line %d, col %d'%\n (lineno,colno))\n \n def substitute(self,mapping=_sentinel_dict,/,**kws):\n if mapping is _sentinel_dict:\n mapping=kws\n elif kws:\n mapping=_ChainMap(kws,mapping)\n \n def convert(mo):\n \n named=mo.group('named')or mo.group('braced')\n if named is not None:\n return str(mapping[named])\n if mo.group('escaped')is not None:\n return self.delimiter\n if mo.group('invalid')is not None:\n self._invalid(mo)\n raise ValueError('Unrecognized named group in pattern',\n self.pattern)\n return self.pattern.sub(convert,self.template)\n \n def safe_substitute(self,mapping=_sentinel_dict,/,**kws):\n if mapping is _sentinel_dict:\n mapping=kws\n elif kws:\n mapping=_ChainMap(kws,mapping)\n \n def convert(mo):\n named=mo.group('named')or mo.group('braced')\n if named is not None:\n try:\n return str(mapping[named])\n except KeyError:\n return mo.group()\n if mo.group('escaped')is not None:\n return self.delimiter\n if mo.group('invalid')is not None:\n return mo.group()\n raise ValueError('Unrecognized named group in pattern',\n self.pattern)\n return self.pattern.sub(convert,self.template)\n \n def is_valid(self):\n for mo in self.pattern.finditer(self.template):\n if mo.group('invalid')is not None:\n return False\n if(mo.group('named')is None\n and mo.group('braced')is None\n and mo.group('escaped')is None):\n \n \n raise ValueError('Unrecognized named group in pattern',\n self.pattern)\n return True\n \n def get_identifiers(self):\n ids=[]\n for mo in self.pattern.finditer(self.template):\n named=mo.group('named')or mo.group('braced')\n if named is not None and named not in ids:\n \n ids.append(named)\n elif(named is None\n and mo.group('invalid')is None\n and mo.group('escaped')is None):\n \n \n raise ValueError('Unrecognized named group in pattern',\n self.pattern)\n return ids\n \n \n \nTemplate.__init_subclass__()\n\n\n\n\n\n\n\n\n\n\n\n\nclass Formatter:\n def format(self,format_string,/,*args,**kwargs):\n return self.vformat(format_string,args,kwargs)\n \n def vformat(self,format_string,args,kwargs):\n used_args=set()\n result,_=self._vformat(format_string,args,kwargs,used_args,2)\n self.check_unused_args(used_args,args,kwargs)\n return result\n \n def _vformat(self,format_string,args,kwargs,used_args,recursion_depth,\n auto_arg_index=0):\n if recursion_depth <0:\n raise ValueError('Max string recursion exceeded')\n result=[]\n for literal_text,field_name,format_spec,conversion in\\\n self.parse(format_string):\n \n \n if literal_text:\n result.append(literal_text)\n \n \n if field_name is not None:\n \n \n \n \n if field_name =='':\n if auto_arg_index is False:\n raise ValueError('cannot switch from manual field '\n 'specification to automatic field '\n 'numbering')\n field_name=str(auto_arg_index)\n auto_arg_index +=1\n elif field_name.isdigit():\n if auto_arg_index:\n raise ValueError('cannot switch from manual field '\n 'specification to automatic field '\n 'numbering')\n \n \n auto_arg_index=False\n \n \n \n obj,arg_used=self.get_field(field_name,args,kwargs)\n used_args.add(arg_used)\n \n \n obj=self.convert_field(obj,conversion)\n \n \n format_spec,auto_arg_index=self._vformat(\n format_spec,args,kwargs,\n used_args,recursion_depth -1,\n auto_arg_index=auto_arg_index)\n \n \n result.append(self.format_field(obj,format_spec))\n \n return ''.join(result),auto_arg_index\n \n \n def get_value(self,key,args,kwargs):\n if isinstance(key,int):\n return args[key]\n else:\n return kwargs[key]\n \n \n def check_unused_args(self,used_args,args,kwargs):\n pass\n \n \n def format_field(self,value,format_spec):\n return format(value,format_spec)\n \n \n def convert_field(self,value,conversion):\n \n if conversion is None:\n return value\n elif conversion =='s':\n return str(value)\n elif conversion =='r':\n return repr(value)\n elif conversion =='a':\n return ascii(value)\n raise ValueError(\"Unknown conversion specifier {0!s}\".format(conversion))\n \n \n \n \n \n \n \n \n \n def parse(self,format_string):\n return _string.formatter_parser(format_string)\n \n \n \n \n \n \n \n def get_field(self,field_name,args,kwargs):\n first,rest=_string.formatter_field_name_split(field_name)\n \n obj=self.get_value(first,args,kwargs)\n \n \n \n for is_attr,i in rest:\n if is_attr:\n obj=getattr(obj,i)\n else:\n obj=obj[i]\n \n return obj,first\n", ["_string", "collections", "re"]], "stringprep": [".py", "\n''\n\n\n\n\n\nfrom unicodedata import ucd_3_2_0 as unicodedata\n\nassert unicodedata.unidata_version =='3.2.0'\n\ndef in_table_a1(code):\n if unicodedata.category(code)!='Cn':return False\n c=ord(code)\n if 0xFDD0 <=c <0xFDF0:return False\n return (c&0xFFFF)not in (0xFFFE,0xFFFF)\n \n \nb1_set=set([173,847,6150,6155,6156,6157,8203,8204,8205,8288,65279]+list(range(65024,65040)))\ndef in_table_b1(code):\n return ord(code)in b1_set\n \n \nb3_exceptions={\n0xb5:'\\u03bc',0xdf:'ss',0x130:'i\\u0307',0x149:'\\u02bcn',\n0x17f:'s',0x1f0:'j\\u030c',0x345:'\\u03b9',0x37a:' \\u03b9',\n0x390:'\\u03b9\\u0308\\u0301',0x3b0:'\\u03c5\\u0308\\u0301',0x3c2:'\\u03c3',0x3d0:'\\u03b2',\n0x3d1:'\\u03b8',0x3d2:'\\u03c5',0x3d3:'\\u03cd',0x3d4:'\\u03cb',\n0x3d5:'\\u03c6',0x3d6:'\\u03c0',0x3f0:'\\u03ba',0x3f1:'\\u03c1',\n0x3f2:'\\u03c3',0x3f5:'\\u03b5',0x587:'\\u0565\\u0582',0x1e96:'h\\u0331',\n0x1e97:'t\\u0308',0x1e98:'w\\u030a',0x1e99:'y\\u030a',0x1e9a:'a\\u02be',\n0x1e9b:'\\u1e61',0x1f50:'\\u03c5\\u0313',0x1f52:'\\u03c5\\u0313\\u0300',0x1f54:'\\u03c5\\u0313\\u0301',\n0x1f56:'\\u03c5\\u0313\\u0342',0x1f80:'\\u1f00\\u03b9',0x1f81:'\\u1f01\\u03b9',0x1f82:'\\u1f02\\u03b9',\n0x1f83:'\\u1f03\\u03b9',0x1f84:'\\u1f04\\u03b9',0x1f85:'\\u1f05\\u03b9',0x1f86:'\\u1f06\\u03b9',\n0x1f87:'\\u1f07\\u03b9',0x1f88:'\\u1f00\\u03b9',0x1f89:'\\u1f01\\u03b9',0x1f8a:'\\u1f02\\u03b9',\n0x1f8b:'\\u1f03\\u03b9',0x1f8c:'\\u1f04\\u03b9',0x1f8d:'\\u1f05\\u03b9',0x1f8e:'\\u1f06\\u03b9',\n0x1f8f:'\\u1f07\\u03b9',0x1f90:'\\u1f20\\u03b9',0x1f91:'\\u1f21\\u03b9',0x1f92:'\\u1f22\\u03b9',\n0x1f93:'\\u1f23\\u03b9',0x1f94:'\\u1f24\\u03b9',0x1f95:'\\u1f25\\u03b9',0x1f96:'\\u1f26\\u03b9',\n0x1f97:'\\u1f27\\u03b9',0x1f98:'\\u1f20\\u03b9',0x1f99:'\\u1f21\\u03b9',0x1f9a:'\\u1f22\\u03b9',\n0x1f9b:'\\u1f23\\u03b9',0x1f9c:'\\u1f24\\u03b9',0x1f9d:'\\u1f25\\u03b9',0x1f9e:'\\u1f26\\u03b9',\n0x1f9f:'\\u1f27\\u03b9',0x1fa0:'\\u1f60\\u03b9',0x1fa1:'\\u1f61\\u03b9',0x1fa2:'\\u1f62\\u03b9',\n0x1fa3:'\\u1f63\\u03b9',0x1fa4:'\\u1f64\\u03b9',0x1fa5:'\\u1f65\\u03b9',0x1fa6:'\\u1f66\\u03b9',\n0x1fa7:'\\u1f67\\u03b9',0x1fa8:'\\u1f60\\u03b9',0x1fa9:'\\u1f61\\u03b9',0x1faa:'\\u1f62\\u03b9',\n0x1fab:'\\u1f63\\u03b9',0x1fac:'\\u1f64\\u03b9',0x1fad:'\\u1f65\\u03b9',0x1fae:'\\u1f66\\u03b9',\n0x1faf:'\\u1f67\\u03b9',0x1fb2:'\\u1f70\\u03b9',0x1fb3:'\\u03b1\\u03b9',0x1fb4:'\\u03ac\\u03b9',\n0x1fb6:'\\u03b1\\u0342',0x1fb7:'\\u03b1\\u0342\\u03b9',0x1fbc:'\\u03b1\\u03b9',0x1fbe:'\\u03b9',\n0x1fc2:'\\u1f74\\u03b9',0x1fc3:'\\u03b7\\u03b9',0x1fc4:'\\u03ae\\u03b9',0x1fc6:'\\u03b7\\u0342',\n0x1fc7:'\\u03b7\\u0342\\u03b9',0x1fcc:'\\u03b7\\u03b9',0x1fd2:'\\u03b9\\u0308\\u0300',0x1fd3:'\\u03b9\\u0308\\u0301',\n0x1fd6:'\\u03b9\\u0342',0x1fd7:'\\u03b9\\u0308\\u0342',0x1fe2:'\\u03c5\\u0308\\u0300',0x1fe3:'\\u03c5\\u0308\\u0301',\n0x1fe4:'\\u03c1\\u0313',0x1fe6:'\\u03c5\\u0342',0x1fe7:'\\u03c5\\u0308\\u0342',0x1ff2:'\\u1f7c\\u03b9',\n0x1ff3:'\\u03c9\\u03b9',0x1ff4:'\\u03ce\\u03b9',0x1ff6:'\\u03c9\\u0342',0x1ff7:'\\u03c9\\u0342\\u03b9',\n0x1ffc:'\\u03c9\\u03b9',0x20a8:'rs',0x2102:'c',0x2103:'\\xb0c',\n0x2107:'\\u025b',0x2109:'\\xb0f',0x210b:'h',0x210c:'h',\n0x210d:'h',0x2110:'i',0x2111:'i',0x2112:'l',\n0x2115:'n',0x2116:'no',0x2119:'p',0x211a:'q',\n0x211b:'r',0x211c:'r',0x211d:'r',0x2120:'sm',\n0x2121:'tel',0x2122:'tm',0x2124:'z',0x2128:'z',\n0x212c:'b',0x212d:'c',0x2130:'e',0x2131:'f',\n0x2133:'m',0x213e:'\\u03b3',0x213f:'\\u03c0',0x2145:'d',\n0x3371:'hpa',0x3373:'au',0x3375:'ov',0x3380:'pa',\n0x3381:'na',0x3382:'\\u03bca',0x3383:'ma',0x3384:'ka',\n0x3385:'kb',0x3386:'mb',0x3387:'gb',0x338a:'pf',\n0x338b:'nf',0x338c:'\\u03bcf',0x3390:'hz',0x3391:'khz',\n0x3392:'mhz',0x3393:'ghz',0x3394:'thz',0x33a9:'pa',\n0x33aa:'kpa',0x33ab:'mpa',0x33ac:'gpa',0x33b4:'pv',\n0x33b5:'nv',0x33b6:'\\u03bcv',0x33b7:'mv',0x33b8:'kv',\n0x33b9:'mv',0x33ba:'pw',0x33bb:'nw',0x33bc:'\\u03bcw',\n0x33bd:'mw',0x33be:'kw',0x33bf:'mw',0x33c0:'k\\u03c9',\n0x33c1:'m\\u03c9',0x33c3:'bq',0x33c6:'c\\u2215kg',0x33c7:'co.',\n0x33c8:'db',0x33c9:'gy',0x33cb:'hp',0x33cd:'kk',\n0x33ce:'km',0x33d7:'ph',0x33d9:'ppm',0x33da:'pr',\n0x33dc:'sv',0x33dd:'wb',0xfb00:'ff',0xfb01:'fi',\n0xfb02:'fl',0xfb03:'ffi',0xfb04:'ffl',0xfb05:'st',\n0xfb06:'st',0xfb13:'\\u0574\\u0576',0xfb14:'\\u0574\\u0565',0xfb15:'\\u0574\\u056b',\n0xfb16:'\\u057e\\u0576',0xfb17:'\\u0574\\u056d',0x1d400:'a',0x1d401:'b',\n0x1d402:'c',0x1d403:'d',0x1d404:'e',0x1d405:'f',\n0x1d406:'g',0x1d407:'h',0x1d408:'i',0x1d409:'j',\n0x1d40a:'k',0x1d40b:'l',0x1d40c:'m',0x1d40d:'n',\n0x1d40e:'o',0x1d40f:'p',0x1d410:'q',0x1d411:'r',\n0x1d412:'s',0x1d413:'t',0x1d414:'u',0x1d415:'v',\n0x1d416:'w',0x1d417:'x',0x1d418:'y',0x1d419:'z',\n0x1d434:'a',0x1d435:'b',0x1d436:'c',0x1d437:'d',\n0x1d438:'e',0x1d439:'f',0x1d43a:'g',0x1d43b:'h',\n0x1d43c:'i',0x1d43d:'j',0x1d43e:'k',0x1d43f:'l',\n0x1d440:'m',0x1d441:'n',0x1d442:'o',0x1d443:'p',\n0x1d444:'q',0x1d445:'r',0x1d446:'s',0x1d447:'t',\n0x1d448:'u',0x1d449:'v',0x1d44a:'w',0x1d44b:'x',\n0x1d44c:'y',0x1d44d:'z',0x1d468:'a',0x1d469:'b',\n0x1d46a:'c',0x1d46b:'d',0x1d46c:'e',0x1d46d:'f',\n0x1d46e:'g',0x1d46f:'h',0x1d470:'i',0x1d471:'j',\n0x1d472:'k',0x1d473:'l',0x1d474:'m',0x1d475:'n',\n0x1d476:'o',0x1d477:'p',0x1d478:'q',0x1d479:'r',\n0x1d47a:'s',0x1d47b:'t',0x1d47c:'u',0x1d47d:'v',\n0x1d47e:'w',0x1d47f:'x',0x1d480:'y',0x1d481:'z',\n0x1d49c:'a',0x1d49e:'c',0x1d49f:'d',0x1d4a2:'g',\n0x1d4a5:'j',0x1d4a6:'k',0x1d4a9:'n',0x1d4aa:'o',\n0x1d4ab:'p',0x1d4ac:'q',0x1d4ae:'s',0x1d4af:'t',\n0x1d4b0:'u',0x1d4b1:'v',0x1d4b2:'w',0x1d4b3:'x',\n0x1d4b4:'y',0x1d4b5:'z',0x1d4d0:'a',0x1d4d1:'b',\n0x1d4d2:'c',0x1d4d3:'d',0x1d4d4:'e',0x1d4d5:'f',\n0x1d4d6:'g',0x1d4d7:'h',0x1d4d8:'i',0x1d4d9:'j',\n0x1d4da:'k',0x1d4db:'l',0x1d4dc:'m',0x1d4dd:'n',\n0x1d4de:'o',0x1d4df:'p',0x1d4e0:'q',0x1d4e1:'r',\n0x1d4e2:'s',0x1d4e3:'t',0x1d4e4:'u',0x1d4e5:'v',\n0x1d4e6:'w',0x1d4e7:'x',0x1d4e8:'y',0x1d4e9:'z',\n0x1d504:'a',0x1d505:'b',0x1d507:'d',0x1d508:'e',\n0x1d509:'f',0x1d50a:'g',0x1d50d:'j',0x1d50e:'k',\n0x1d50f:'l',0x1d510:'m',0x1d511:'n',0x1d512:'o',\n0x1d513:'p',0x1d514:'q',0x1d516:'s',0x1d517:'t',\n0x1d518:'u',0x1d519:'v',0x1d51a:'w',0x1d51b:'x',\n0x1d51c:'y',0x1d538:'a',0x1d539:'b',0x1d53b:'d',\n0x1d53c:'e',0x1d53d:'f',0x1d53e:'g',0x1d540:'i',\n0x1d541:'j',0x1d542:'k',0x1d543:'l',0x1d544:'m',\n0x1d546:'o',0x1d54a:'s',0x1d54b:'t',0x1d54c:'u',\n0x1d54d:'v',0x1d54e:'w',0x1d54f:'x',0x1d550:'y',\n0x1d56c:'a',0x1d56d:'b',0x1d56e:'c',0x1d56f:'d',\n0x1d570:'e',0x1d571:'f',0x1d572:'g',0x1d573:'h',\n0x1d574:'i',0x1d575:'j',0x1d576:'k',0x1d577:'l',\n0x1d578:'m',0x1d579:'n',0x1d57a:'o',0x1d57b:'p',\n0x1d57c:'q',0x1d57d:'r',0x1d57e:'s',0x1d57f:'t',\n0x1d580:'u',0x1d581:'v',0x1d582:'w',0x1d583:'x',\n0x1d584:'y',0x1d585:'z',0x1d5a0:'a',0x1d5a1:'b',\n0x1d5a2:'c',0x1d5a3:'d',0x1d5a4:'e',0x1d5a5:'f',\n0x1d5a6:'g',0x1d5a7:'h',0x1d5a8:'i',0x1d5a9:'j',\n0x1d5aa:'k',0x1d5ab:'l',0x1d5ac:'m',0x1d5ad:'n',\n0x1d5ae:'o',0x1d5af:'p',0x1d5b0:'q',0x1d5b1:'r',\n0x1d5b2:'s',0x1d5b3:'t',0x1d5b4:'u',0x1d5b5:'v',\n0x1d5b6:'w',0x1d5b7:'x',0x1d5b8:'y',0x1d5b9:'z',\n0x1d5d4:'a',0x1d5d5:'b',0x1d5d6:'c',0x1d5d7:'d',\n0x1d5d8:'e',0x1d5d9:'f',0x1d5da:'g',0x1d5db:'h',\n0x1d5dc:'i',0x1d5dd:'j',0x1d5de:'k',0x1d5df:'l',\n0x1d5e0:'m',0x1d5e1:'n',0x1d5e2:'o',0x1d5e3:'p',\n0x1d5e4:'q',0x1d5e5:'r',0x1d5e6:'s',0x1d5e7:'t',\n0x1d5e8:'u',0x1d5e9:'v',0x1d5ea:'w',0x1d5eb:'x',\n0x1d5ec:'y',0x1d5ed:'z',0x1d608:'a',0x1d609:'b',\n0x1d60a:'c',0x1d60b:'d',0x1d60c:'e',0x1d60d:'f',\n0x1d60e:'g',0x1d60f:'h',0x1d610:'i',0x1d611:'j',\n0x1d612:'k',0x1d613:'l',0x1d614:'m',0x1d615:'n',\n0x1d616:'o',0x1d617:'p',0x1d618:'q',0x1d619:'r',\n0x1d61a:'s',0x1d61b:'t',0x1d61c:'u',0x1d61d:'v',\n0x1d61e:'w',0x1d61f:'x',0x1d620:'y',0x1d621:'z',\n0x1d63c:'a',0x1d63d:'b',0x1d63e:'c',0x1d63f:'d',\n0x1d640:'e',0x1d641:'f',0x1d642:'g',0x1d643:'h',\n0x1d644:'i',0x1d645:'j',0x1d646:'k',0x1d647:'l',\n0x1d648:'m',0x1d649:'n',0x1d64a:'o',0x1d64b:'p',\n0x1d64c:'q',0x1d64d:'r',0x1d64e:'s',0x1d64f:'t',\n0x1d650:'u',0x1d651:'v',0x1d652:'w',0x1d653:'x',\n0x1d654:'y',0x1d655:'z',0x1d670:'a',0x1d671:'b',\n0x1d672:'c',0x1d673:'d',0x1d674:'e',0x1d675:'f',\n0x1d676:'g',0x1d677:'h',0x1d678:'i',0x1d679:'j',\n0x1d67a:'k',0x1d67b:'l',0x1d67c:'m',0x1d67d:'n',\n0x1d67e:'o',0x1d67f:'p',0x1d680:'q',0x1d681:'r',\n0x1d682:'s',0x1d683:'t',0x1d684:'u',0x1d685:'v',\n0x1d686:'w',0x1d687:'x',0x1d688:'y',0x1d689:'z',\n0x1d6a8:'\\u03b1',0x1d6a9:'\\u03b2',0x1d6aa:'\\u03b3',0x1d6ab:'\\u03b4',\n0x1d6ac:'\\u03b5',0x1d6ad:'\\u03b6',0x1d6ae:'\\u03b7',0x1d6af:'\\u03b8',\n0x1d6b0:'\\u03b9',0x1d6b1:'\\u03ba',0x1d6b2:'\\u03bb',0x1d6b3:'\\u03bc',\n0x1d6b4:'\\u03bd',0x1d6b5:'\\u03be',0x1d6b6:'\\u03bf',0x1d6b7:'\\u03c0',\n0x1d6b8:'\\u03c1',0x1d6b9:'\\u03b8',0x1d6ba:'\\u03c3',0x1d6bb:'\\u03c4',\n0x1d6bc:'\\u03c5',0x1d6bd:'\\u03c6',0x1d6be:'\\u03c7',0x1d6bf:'\\u03c8',\n0x1d6c0:'\\u03c9',0x1d6d3:'\\u03c3',0x1d6e2:'\\u03b1',0x1d6e3:'\\u03b2',\n0x1d6e4:'\\u03b3',0x1d6e5:'\\u03b4',0x1d6e6:'\\u03b5',0x1d6e7:'\\u03b6',\n0x1d6e8:'\\u03b7',0x1d6e9:'\\u03b8',0x1d6ea:'\\u03b9',0x1d6eb:'\\u03ba',\n0x1d6ec:'\\u03bb',0x1d6ed:'\\u03bc',0x1d6ee:'\\u03bd',0x1d6ef:'\\u03be',\n0x1d6f0:'\\u03bf',0x1d6f1:'\\u03c0',0x1d6f2:'\\u03c1',0x1d6f3:'\\u03b8',\n0x1d6f4:'\\u03c3',0x1d6f5:'\\u03c4',0x1d6f6:'\\u03c5',0x1d6f7:'\\u03c6',\n0x1d6f8:'\\u03c7',0x1d6f9:'\\u03c8',0x1d6fa:'\\u03c9',0x1d70d:'\\u03c3',\n0x1d71c:'\\u03b1',0x1d71d:'\\u03b2',0x1d71e:'\\u03b3',0x1d71f:'\\u03b4',\n0x1d720:'\\u03b5',0x1d721:'\\u03b6',0x1d722:'\\u03b7',0x1d723:'\\u03b8',\n0x1d724:'\\u03b9',0x1d725:'\\u03ba',0x1d726:'\\u03bb',0x1d727:'\\u03bc',\n0x1d728:'\\u03bd',0x1d729:'\\u03be',0x1d72a:'\\u03bf',0x1d72b:'\\u03c0',\n0x1d72c:'\\u03c1',0x1d72d:'\\u03b8',0x1d72e:'\\u03c3',0x1d72f:'\\u03c4',\n0x1d730:'\\u03c5',0x1d731:'\\u03c6',0x1d732:'\\u03c7',0x1d733:'\\u03c8',\n0x1d734:'\\u03c9',0x1d747:'\\u03c3',0x1d756:'\\u03b1',0x1d757:'\\u03b2',\n0x1d758:'\\u03b3',0x1d759:'\\u03b4',0x1d75a:'\\u03b5',0x1d75b:'\\u03b6',\n0x1d75c:'\\u03b7',0x1d75d:'\\u03b8',0x1d75e:'\\u03b9',0x1d75f:'\\u03ba',\n0x1d760:'\\u03bb',0x1d761:'\\u03bc',0x1d762:'\\u03bd',0x1d763:'\\u03be',\n0x1d764:'\\u03bf',0x1d765:'\\u03c0',0x1d766:'\\u03c1',0x1d767:'\\u03b8',\n0x1d768:'\\u03c3',0x1d769:'\\u03c4',0x1d76a:'\\u03c5',0x1d76b:'\\u03c6',\n0x1d76c:'\\u03c7',0x1d76d:'\\u03c8',0x1d76e:'\\u03c9',0x1d781:'\\u03c3',\n0x1d790:'\\u03b1',0x1d791:'\\u03b2',0x1d792:'\\u03b3',0x1d793:'\\u03b4',\n0x1d794:'\\u03b5',0x1d795:'\\u03b6',0x1d796:'\\u03b7',0x1d797:'\\u03b8',\n0x1d798:'\\u03b9',0x1d799:'\\u03ba',0x1d79a:'\\u03bb',0x1d79b:'\\u03bc',\n0x1d79c:'\\u03bd',0x1d79d:'\\u03be',0x1d79e:'\\u03bf',0x1d79f:'\\u03c0',\n0x1d7a0:'\\u03c1',0x1d7a1:'\\u03b8',0x1d7a2:'\\u03c3',0x1d7a3:'\\u03c4',\n0x1d7a4:'\\u03c5',0x1d7a5:'\\u03c6',0x1d7a6:'\\u03c7',0x1d7a7:'\\u03c8',\n0x1d7a8:'\\u03c9',0x1d7bb:'\\u03c3',}\n\ndef map_table_b3(code):\n r=b3_exceptions.get(ord(code))\n if r is not None :return r\n return code.lower()\n \n \ndef map_table_b2(a):\n al=map_table_b3(a)\n b=unicodedata.normalize(\"NFKC\",al)\n bl=\"\".join([map_table_b3(ch)for ch in b])\n c=unicodedata.normalize(\"NFKC\",bl)\n if b !=c:\n return c\n else :\n return al\n \n \ndef in_table_c11(code):\n return code ==\" \"\n \n \ndef in_table_c12(code):\n return unicodedata.category(code)==\"Zs\"and code !=\" \"\n \ndef in_table_c11_c12(code):\n return unicodedata.category(code)==\"Zs\"\n \n \ndef in_table_c21(code):\n return ord(code)<128 and unicodedata.category(code)==\"Cc\"\n \nc22_specials=set([1757,1807,6158,8204,8205,8232,8233,65279]+list(range(8288,8292))+list(range(8298,8304))+list(range(65529,65533))+list(range(119155,119163)))\ndef in_table_c22(code):\n c=ord(code)\n if c <128:return False\n if unicodedata.category(code)==\"Cc\":return True\n return c in c22_specials\n \ndef in_table_c21_c22(code):\n return unicodedata.category(code)==\"Cc\"or\\\n ord(code)in c22_specials\n \n \ndef in_table_c3(code):\n return unicodedata.category(code)==\"Co\"\n \n \ndef in_table_c4(code):\n c=ord(code)\n if c <0xFDD0:return False\n if c <0xFDF0:return True\n return (ord(code)&0xFFFF)in (0xFFFE,0xFFFF)\n \n \ndef in_table_c5(code):\n return unicodedata.category(code)==\"Cs\"\n \n \nc6_set=set(range(65529,65534))\ndef in_table_c6(code):\n return ord(code)in c6_set\n \n \nc7_set=set(range(12272,12284))\ndef in_table_c7(code):\n return ord(code)in c7_set\n \n \nc8_set=set([832,833,8206,8207]+list(range(8234,8239))+list(range(8298,8304)))\ndef in_table_c8(code):\n return ord(code)in c8_set\n \n \nc9_set=set([917505]+list(range(917536,917632)))\ndef in_table_c9(code):\n return ord(code)in c9_set\n \n \ndef in_table_d1(code):\n return unicodedata.bidirectional(code)in (\"R\",\"AL\")\n \n \ndef in_table_d2(code):\n return unicodedata.bidirectional(code)==\"L\"\n", ["unicodedata"]], "struct": [".py", "__all__=[\n\n'calcsize','pack','pack_into','unpack','unpack_from',\n'iter_unpack',\n\n\n'Struct',\n\n\n'error'\n]\n\nfrom _struct import *\nfrom _struct import _clearcache\nfrom _struct import __doc__\n", ["_struct"]], "subprocess": [".py", "\n\n\n\n\n\n\n\nr\"\"\"Subprocesses with accessible I/O streams\n\nThis module allows you to spawn processes, connect to their\ninput/output/error pipes, and obtain their return codes.\n\nFor a complete description of this module see the Python documentation.\n\nMain API\n========\nrun(...): Runs a command, waits for it to complete, then returns a\n CompletedProcess instance.\nPopen(...): A class for flexibly executing a command in a new process\n\nConstants\n---------\nDEVNULL: Special value that indicates that os.devnull should be used\nPIPE: Special value that indicates a pipe should be created\nSTDOUT: Special value that indicates that stderr should go to stdout\n\n\nOlder API\n=========\ncall(...): Runs a command, waits for it to complete, then returns\n the return code.\ncheck_call(...): Same as call() but raises CalledProcessError()\n if return code is not 0\ncheck_output(...): Same as check_call() but returns the contents of\n stdout instead of a return code\ngetoutput(...): Runs a command in the shell, waits for it to complete,\n then returns the output\ngetstatusoutput(...): Runs a command in the shell, waits for it to complete,\n then returns a (exitcode, output) tuple\n\"\"\"\n\nimport builtins\nimport errno\nimport io\nimport locale\nimport os\nimport time\nimport signal\nimport sys\nimport threading\nimport warnings\nimport contextlib\nfrom time import monotonic as _time\nimport types\n\ntry :\n import fcntl\nexcept ImportError:\n fcntl=None\n \n \n__all__=[\"Popen\",\"PIPE\",\"STDOUT\",\"call\",\"check_call\",\"getstatusoutput\",\n\"getoutput\",\"check_output\",\"run\",\"CalledProcessError\",\"DEVNULL\",\n\"SubprocessError\",\"TimeoutExpired\",\"CompletedProcess\"]\n\n\n\n\ntry :\n import msvcrt\nexcept ModuleNotFoundError:\n _mswindows=False\nelse :\n _mswindows=True\n \n \n_can_fork_exec=sys.platform not in {\"emscripten\",\"wasi\"}\n\nif _mswindows:\n import _winapi\n from _winapi import (CREATE_NEW_CONSOLE,CREATE_NEW_PROCESS_GROUP,\n STD_INPUT_HANDLE,STD_OUTPUT_HANDLE,\n STD_ERROR_HANDLE,SW_HIDE,\n STARTF_USESTDHANDLES,STARTF_USESHOWWINDOW,\n ABOVE_NORMAL_PRIORITY_CLASS,BELOW_NORMAL_PRIORITY_CLASS,\n HIGH_PRIORITY_CLASS,IDLE_PRIORITY_CLASS,\n NORMAL_PRIORITY_CLASS,REALTIME_PRIORITY_CLASS,\n CREATE_NO_WINDOW,DETACHED_PROCESS,\n CREATE_DEFAULT_ERROR_MODE,CREATE_BREAKAWAY_FROM_JOB)\n \n __all__.extend([\"CREATE_NEW_CONSOLE\",\"CREATE_NEW_PROCESS_GROUP\",\n \"STD_INPUT_HANDLE\",\"STD_OUTPUT_HANDLE\",\n \"STD_ERROR_HANDLE\",\"SW_HIDE\",\n \"STARTF_USESTDHANDLES\",\"STARTF_USESHOWWINDOW\",\n \"STARTUPINFO\",\n \"ABOVE_NORMAL_PRIORITY_CLASS\",\"BELOW_NORMAL_PRIORITY_CLASS\",\n \"HIGH_PRIORITY_CLASS\",\"IDLE_PRIORITY_CLASS\",\n \"NORMAL_PRIORITY_CLASS\",\"REALTIME_PRIORITY_CLASS\",\n \"CREATE_NO_WINDOW\",\"DETACHED_PROCESS\",\n \"CREATE_DEFAULT_ERROR_MODE\",\"CREATE_BREAKAWAY_FROM_JOB\"])\nelse :\n if _can_fork_exec:\n from _posixsubprocess import fork_exec as _fork_exec\n \n _waitpid=os.waitpid\n _waitstatus_to_exitcode=os.waitstatus_to_exitcode\n _WIFSTOPPED=os.WIFSTOPPED\n _WSTOPSIG=os.WSTOPSIG\n _WNOHANG=os.WNOHANG\n else :\n _fork_exec=None\n _waitpid=None\n _waitstatus_to_exitcode=None\n _WIFSTOPPED=None\n _WSTOPSIG=None\n _WNOHANG=None\n import select\n import selectors\n \n \n \nclass SubprocessError(Exception):pass\n\n\nclass CalledProcessError(SubprocessError):\n ''\n\n\n\n\n \n def __init__(self,returncode,cmd,output=None ,stderr=None ):\n self.returncode=returncode\n self.cmd=cmd\n self.output=output\n self.stderr=stderr\n \n def __str__(self):\n if self.returncode and self.returncode <0:\n try :\n return \"Command '%s' died with %r.\"%(\n self.cmd,signal.Signals(-self.returncode))\n except ValueError:\n return \"Command '%s' died with unknown signal %d.\"%(\n self.cmd,-self.returncode)\n else :\n return \"Command '%s' returned non-zero exit status %d.\"%(\n self.cmd,self.returncode)\n \n @property\n def stdout(self):\n ''\n return self.output\n \n @stdout.setter\n def stdout(self,value):\n \n \n self.output=value\n \n \nclass TimeoutExpired(SubprocessError):\n ''\n\n\n\n\n \n def __init__(self,cmd,timeout,output=None ,stderr=None ):\n self.cmd=cmd\n self.timeout=timeout\n self.output=output\n self.stderr=stderr\n \n def __str__(self):\n return (\"Command '%s' timed out after %s seconds\"%\n (self.cmd,self.timeout))\n \n @property\n def stdout(self):\n return self.output\n \n @stdout.setter\n def stdout(self,value):\n \n \n self.output=value\n \n \nif _mswindows:\n class STARTUPINFO:\n def __init__(self,*,dwFlags=0,hStdInput=None ,hStdOutput=None ,\n hStdError=None ,wShowWindow=0,lpAttributeList=None ):\n self.dwFlags=dwFlags\n self.hStdInput=hStdInput\n self.hStdOutput=hStdOutput\n self.hStdError=hStdError\n self.wShowWindow=wShowWindow\n self.lpAttributeList=lpAttributeList or {\"handle_list\":[]}\n \n def copy(self):\n attr_list=self.lpAttributeList.copy()\n if 'handle_list'in attr_list:\n attr_list['handle_list']=list(attr_list['handle_list'])\n \n return STARTUPINFO(dwFlags=self.dwFlags,\n hStdInput=self.hStdInput,\n hStdOutput=self.hStdOutput,\n hStdError=self.hStdError,\n wShowWindow=self.wShowWindow,\n lpAttributeList=attr_list)\n \n \n class Handle(int):\n closed=False\n \n def Close(self,CloseHandle=_winapi.CloseHandle):\n if not self.closed:\n self.closed=True\n CloseHandle(self)\n \n def Detach(self):\n if not self.closed:\n self.closed=True\n return int(self)\n raise ValueError(\"already closed\")\n \n def __repr__(self):\n return \"%s(%d)\"%(self.__class__.__name__,int(self))\n \n __del__=Close\nelse :\n\n\n\n _PIPE_BUF=getattr(select,'PIPE_BUF',512)\n \n \n \n \n if hasattr(selectors,'PollSelector'):\n _PopenSelector=selectors.PollSelector\n else :\n _PopenSelector=selectors.SelectSelector\n \n \nif _mswindows:\n\n\n\n\n\n\n\n\n _active=None\n \n def _cleanup():\n pass\nelse :\n\n\n\n\n _active=[]\n \n def _cleanup():\n if _active is None :\n return\n for inst in _active[:]:\n res=inst._internal_poll(_deadstate=sys.maxsize)\n if res is not None :\n try :\n _active.remove(inst)\n except ValueError:\n \n \n pass\n \nPIPE=-1\nSTDOUT=-2\nDEVNULL=-3\n\n\n\n\n\n\ndef _optim_args_from_interpreter_flags():\n ''\n \n args=[]\n value=sys.flags.optimize\n if value >0:\n args.append('-'+'O'*value)\n return args\n \n \ndef _args_from_interpreter_flags():\n ''\n \n flag_opt_map={\n 'debug':'d',\n \n \n 'dont_write_bytecode':'B',\n 'no_site':'S',\n 'verbose':'v',\n 'bytes_warning':'b',\n 'quiet':'q',\n \n }\n args=_optim_args_from_interpreter_flags()\n for flag,opt in flag_opt_map.items():\n v=getattr(sys.flags,flag)\n if v >0:\n args.append('-'+opt *v)\n \n if sys.flags.isolated:\n args.append('-I')\n else :\n if sys.flags.ignore_environment:\n args.append('-E')\n if sys.flags.no_user_site:\n args.append('-s')\n if sys.flags.safe_path:\n args.append('-P')\n \n \n warnopts=sys.warnoptions[:]\n xoptions=getattr(sys,'_xoptions',{})\n bytes_warning=sys.flags.bytes_warning\n dev_mode=sys.flags.dev_mode\n \n if bytes_warning >1:\n warnopts.remove(\"error::BytesWarning\")\n elif bytes_warning:\n warnopts.remove(\"default::BytesWarning\")\n if dev_mode:\n warnopts.remove('default')\n for opt in warnopts:\n args.append('-W'+opt)\n \n \n if dev_mode:\n args.extend(('-X','dev'))\n for opt in ('faulthandler','tracemalloc','importtime',\n 'showrefcount','utf8'):\n if opt in xoptions:\n value=xoptions[opt]\n if value is True :\n arg=opt\n else :\n arg='%s=%s'%(opt,value)\n args.extend(('-X',arg))\n \n return args\n \n \ndef _text_encoding():\n\n\n if sys.flags.warn_default_encoding:\n f=sys._getframe()\n filename=f.f_code.co_filename\n stacklevel=2\n while f :=f.f_back:\n if f.f_code.co_filename !=filename:\n break\n stacklevel +=1\n warnings.warn(\"'encoding' argument not specified.\",\n EncodingWarning,stacklevel)\n \n if sys.flags.utf8_mode:\n return \"utf-8\"\n else :\n return locale.getencoding()\n \n \ndef call(*popenargs,timeout=None ,**kwargs):\n ''\n\n\n\n\n\n \n with Popen(*popenargs,**kwargs)as p:\n try :\n return p.wait(timeout=timeout)\n except :\n p.kill()\n \n raise\n \n \ndef check_call(*popenargs,**kwargs):\n ''\n\n\n\n\n\n\n\n \n retcode=call(*popenargs,**kwargs)\n if retcode:\n cmd=kwargs.get(\"args\")\n if cmd is None :\n cmd=popenargs[0]\n raise CalledProcessError(retcode,cmd)\n return 0\n \n \ndef check_output(*popenargs,timeout=None ,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n for kw in ('stdout','check'):\n if kw in kwargs:\n raise ValueError(f'{kw} argument not allowed, it will be overridden.')\n \n if 'input'in kwargs and kwargs['input']is None :\n \n \n if kwargs.get('universal_newlines')or kwargs.get('text'):\n empty=''\n else :\n empty=b''\n kwargs['input']=empty\n \n return run(*popenargs,stdout=PIPE,timeout=timeout,check=True ,\n **kwargs).stdout\n \n \nclass CompletedProcess(object):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,args,returncode,stdout=None ,stderr=None ):\n self.args=args\n self.returncode=returncode\n self.stdout=stdout\n self.stderr=stderr\n \n def __repr__(self):\n args=['args={!r}'.format(self.args),\n 'returncode={!r}'.format(self.returncode)]\n if self.stdout is not None :\n args.append('stdout={!r}'.format(self.stdout))\n if self.stderr is not None :\n args.append('stderr={!r}'.format(self.stderr))\n return \"{}({})\".format(type(self).__name__,', '.join(args))\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \n def check_returncode(self):\n ''\n if self.returncode:\n raise CalledProcessError(self.returncode,self.args,self.stdout,\n self.stderr)\n \n \ndef run(*popenargs,\ninput=None ,capture_output=False ,timeout=None ,check=False ,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if input is not None :\n if kwargs.get('stdin')is not None :\n raise ValueError('stdin and input arguments may not both be used.')\n kwargs['stdin']=PIPE\n \n if capture_output:\n if kwargs.get('stdout')is not None or kwargs.get('stderr')is not None :\n raise ValueError('stdout and stderr arguments may not be used '\n 'with capture_output.')\n kwargs['stdout']=PIPE\n kwargs['stderr']=PIPE\n \n with Popen(*popenargs,**kwargs)as process:\n try :\n stdout,stderr=process.communicate(input,timeout=timeout)\n except TimeoutExpired as exc:\n process.kill()\n if _mswindows:\n \n \n \n \n \n exc.stdout,exc.stderr=process.communicate()\n else :\n \n \n process.wait()\n raise\n except :\n process.kill()\n \n raise\n retcode=process.poll()\n if check and retcode:\n raise CalledProcessError(retcode,process.args,\n output=stdout,stderr=stderr)\n return CompletedProcess(process.args,retcode,stdout,stderr)\n \n \ndef list2cmdline(seq):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n result=[]\n needquote=False\n for arg in map(os.fsdecode,seq):\n bs_buf=[]\n \n \n if result:\n result.append(' ')\n \n needquote=(\" \"in arg)or (\"\\t\"in arg)or not arg\n if needquote:\n result.append('\"')\n \n for c in arg:\n if c =='\\\\':\n \n bs_buf.append(c)\n elif c =='\"':\n \n result.append('\\\\'*len(bs_buf)*2)\n bs_buf=[]\n result.append('\\\\\"')\n else :\n \n if bs_buf:\n result.extend(bs_buf)\n bs_buf=[]\n result.append(c)\n \n \n if bs_buf:\n result.extend(bs_buf)\n \n if needquote:\n result.extend(bs_buf)\n result.append('\"')\n \n return ''.join(result)\n \n \n \n \n \ndef getstatusoutput(cmd,*,encoding=None ,errors=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try :\n data=check_output(cmd,shell=True ,text=True ,stderr=STDOUT,\n encoding=encoding,errors=errors)\n exitcode=0\n except CalledProcessError as ex:\n data=ex.output\n exitcode=ex.returncode\n if data[-1:]=='\\n':\n data=data[:-1]\n return exitcode,data\n \ndef getoutput(cmd,*,encoding=None ,errors=None ):\n ''\n\n\n\n\n\n\n\n \n return getstatusoutput(cmd,encoding=encoding,errors=errors)[1]\n \n \n \ndef _use_posix_spawn():\n ''\n\n\n\n\n\n\n\n\n\n\n \n if _mswindows or not hasattr(os,'posix_spawn'):\n \n return False\n \n if sys.platform in ('darwin','sunos5'):\n \n \n return True\n \n \n try :\n ver=os.confstr('CS_GNU_LIBC_VERSION')\n \n parts=ver.split(maxsplit=1)\n if len(parts)!=2:\n \n raise ValueError\n libc=parts[0]\n version=tuple(map(int,parts[1].split('.')))\n \n if sys.platform =='linux'and libc =='glibc'and version >=(2,24):\n \n \n return True\n \n \n \n except (AttributeError,ValueError,OSError):\n \n pass\n \n \n return False\n \n \n \n \n_USE_POSIX_SPAWN=_use_posix_spawn()\n_USE_VFORK=True\n\n\nclass Popen:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n _child_created=False\n \n def __init__(self,args,bufsize=-1,executable=None ,\n stdin=None ,stdout=None ,stderr=None ,\n preexec_fn=None ,close_fds=True ,\n shell=False ,cwd=None ,env=None ,universal_newlines=None ,\n startupinfo=None ,creationflags=0,\n restore_signals=True ,start_new_session=False ,\n pass_fds=(),*,user=None ,group=None ,extra_groups=None ,\n encoding=None ,errors=None ,text=None ,umask=-1,pipesize=-1,\n process_group=None ):\n ''\n if not _can_fork_exec:\n raise OSError(\n errno.ENOTSUP,f\"{sys.platform} does not support processes.\"\n )\n \n _cleanup()\n \n \n \n \n \n self._waitpid_lock=threading.Lock()\n \n self._input=None\n self._communication_started=False\n if bufsize is None :\n bufsize=-1\n if not isinstance(bufsize,int):\n raise TypeError(\"bufsize must be an integer\")\n \n if pipesize is None :\n pipesize=-1\n if not isinstance(pipesize,int):\n raise TypeError(\"pipesize must be an integer\")\n \n if _mswindows:\n if preexec_fn is not None :\n raise ValueError(\"preexec_fn is not supported on Windows \"\n \"platforms\")\n else :\n \n if pass_fds and not close_fds:\n warnings.warn(\"pass_fds overriding close_fds.\",RuntimeWarning)\n close_fds=True\n if startupinfo is not None :\n raise ValueError(\"startupinfo is only supported on Windows \"\n \"platforms\")\n if creationflags !=0:\n raise ValueError(\"creationflags is only supported on Windows \"\n \"platforms\")\n \n self.args=args\n self.stdin=None\n self.stdout=None\n self.stderr=None\n self.pid=None\n self.returncode=None\n self.encoding=encoding\n self.errors=errors\n self.pipesize=pipesize\n \n \n if (text is not None and universal_newlines is not None\n and bool(universal_newlines)!=bool(text)):\n raise SubprocessError('Cannot disambiguate when both text '\n 'and universal_newlines are supplied but '\n 'different. Pass one or the other.')\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n (p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)=self._get_handles(stdin,stdout,stderr)\n \n \n \n \n \n if _mswindows:\n if p2cwrite !=-1:\n p2cwrite=msvcrt.open_osfhandle(p2cwrite.Detach(),0)\n if c2pread !=-1:\n c2pread=msvcrt.open_osfhandle(c2pread.Detach(),0)\n if errread !=-1:\n errread=msvcrt.open_osfhandle(errread.Detach(),0)\n \n self.text_mode=encoding or errors or text or universal_newlines\n if self.text_mode and encoding is None :\n self.encoding=encoding=_text_encoding()\n \n \n \n \n self._sigint_wait_secs=0.25\n \n self._closed_child_pipe_fds=False\n \n if self.text_mode:\n if bufsize ==1:\n line_buffering=True\n \n \n bufsize=-1\n else :\n line_buffering=False\n \n if process_group is None :\n process_group=-1\n \n gid=None\n if group is not None :\n if not hasattr(os,'setregid'):\n raise ValueError(\"The 'group' parameter is not supported on the \"\n \"current platform\")\n \n elif isinstance(group,str):\n try :\n import grp\n except ImportError:\n raise ValueError(\"The group parameter cannot be a string \"\n \"on systems without the grp module\")\n \n gid=grp.getgrnam(group).gr_gid\n elif isinstance(group,int):\n gid=group\n else :\n raise TypeError(\"Group must be a string or an integer, not {}\"\n .format(type(group)))\n \n if gid <0:\n raise ValueError(f\"Group ID cannot be negative, got {gid}\")\n \n gids=None\n if extra_groups is not None :\n if not hasattr(os,'setgroups'):\n raise ValueError(\"The 'extra_groups' parameter is not \"\n \"supported on the current platform\")\n \n elif isinstance(extra_groups,str):\n raise ValueError(\"Groups must be a list, not a string\")\n \n gids=[]\n for extra_group in extra_groups:\n if isinstance(extra_group,str):\n try :\n import grp\n except ImportError:\n raise ValueError(\"Items in extra_groups cannot be \"\n \"strings on systems without the \"\n \"grp module\")\n \n gids.append(grp.getgrnam(extra_group).gr_gid)\n elif isinstance(extra_group,int):\n gids.append(extra_group)\n else :\n raise TypeError(\"Items in extra_groups must be a string \"\n \"or integer, not {}\"\n .format(type(extra_group)))\n \n \n \n for gid_check in gids:\n if gid_check <0:\n raise ValueError(f\"Group ID cannot be negative, got {gid_check}\")\n \n uid=None\n if user is not None :\n if not hasattr(os,'setreuid'):\n raise ValueError(\"The 'user' parameter is not supported on \"\n \"the current platform\")\n \n elif isinstance(user,str):\n try :\n import pwd\n except ImportError:\n raise ValueError(\"The user parameter cannot be a string \"\n \"on systems without the pwd module\")\n uid=pwd.getpwnam(user).pw_uid\n elif isinstance(user,int):\n uid=user\n else :\n raise TypeError(\"User must be a string or an integer\")\n \n if uid <0:\n raise ValueError(f\"User ID cannot be negative, got {uid}\")\n \n try :\n if p2cwrite !=-1:\n self.stdin=io.open(p2cwrite,'wb',bufsize)\n if self.text_mode:\n self.stdin=io.TextIOWrapper(self.stdin,write_through=True ,\n line_buffering=line_buffering,\n encoding=encoding,errors=errors)\n if c2pread !=-1:\n self.stdout=io.open(c2pread,'rb',bufsize)\n if self.text_mode:\n self.stdout=io.TextIOWrapper(self.stdout,\n encoding=encoding,errors=errors)\n if errread !=-1:\n self.stderr=io.open(errread,'rb',bufsize)\n if self.text_mode:\n self.stderr=io.TextIOWrapper(self.stderr,\n encoding=encoding,errors=errors)\n \n self._execute_child(args,executable,preexec_fn,close_fds,\n pass_fds,cwd,env,\n startupinfo,creationflags,shell,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite,\n restore_signals,\n gid,gids,uid,umask,\n start_new_session,process_group)\n except :\n \n for f in filter(None ,(self.stdin,self.stdout,self.stderr)):\n try :\n f.close()\n except OSError:\n pass\n \n if not self._closed_child_pipe_fds:\n to_close=[]\n if stdin ==PIPE:\n to_close.append(p2cread)\n if stdout ==PIPE:\n to_close.append(c2pwrite)\n if stderr ==PIPE:\n to_close.append(errwrite)\n if hasattr(self,'_devnull'):\n to_close.append(self._devnull)\n for fd in to_close:\n try :\n if _mswindows and isinstance(fd,Handle):\n fd.Close()\n else :\n os.close(fd)\n except OSError:\n pass\n \n raise\n \n def __repr__(self):\n obj_repr=(\n f\"<{self.__class__.__name__}: \"\n f\"returncode: {self.returncode} args: {self.args!r}>\"\n )\n if len(obj_repr)>80:\n obj_repr=obj_repr[:76]+\"...>\"\n return obj_repr\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n @property\n def universal_newlines(self):\n \n \n return self.text_mode\n \n @universal_newlines.setter\n def universal_newlines(self,universal_newlines):\n self.text_mode=bool(universal_newlines)\n \n def _translate_newlines(self,data,encoding,errors):\n data=data.decode(encoding,errors)\n return data.replace(\"\\r\\n\",\"\\n\").replace(\"\\r\",\"\\n\")\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,value,traceback):\n if self.stdout:\n self.stdout.close()\n if self.stderr:\n self.stderr.close()\n try :\n if self.stdin:\n self.stdin.close()\n finally :\n if exc_type ==KeyboardInterrupt:\n \n \n \n \n \n \n \n if self._sigint_wait_secs >0:\n try :\n self._wait(timeout=self._sigint_wait_secs)\n except TimeoutExpired:\n pass\n self._sigint_wait_secs=0\n return\n \n \n self.wait()\n \n def __del__(self,_maxsize=sys.maxsize,_warn=warnings.warn):\n if not self._child_created:\n \n return\n if self.returncode is None :\n \n \n _warn(\"subprocess %s is still running\"%self.pid,\n ResourceWarning,source=self)\n \n self._internal_poll(_deadstate=_maxsize)\n if self.returncode is None and _active is not None :\n \n _active.append(self)\n \n def _get_devnull(self):\n if not hasattr(self,'_devnull'):\n self._devnull=os.open(os.devnull,os.O_RDWR)\n return self._devnull\n \n def _stdin_write(self,input):\n if input:\n try :\n self.stdin.write(input)\n except BrokenPipeError:\n pass\n except OSError as exc:\n if exc.errno ==errno.EINVAL:\n \n \n \n pass\n else :\n raise\n \n try :\n self.stdin.close()\n except BrokenPipeError:\n pass\n except OSError as exc:\n if exc.errno ==errno.EINVAL:\n pass\n else :\n raise\n \n def communicate(self,input=None ,timeout=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if self._communication_started and input:\n raise ValueError(\"Cannot send input after starting communication\")\n \n \n \n \n if (timeout is None and not self._communication_started and\n [self.stdin,self.stdout,self.stderr].count(None )>=2):\n stdout=None\n stderr=None\n if self.stdin:\n self._stdin_write(input)\n elif self.stdout:\n stdout=self.stdout.read()\n self.stdout.close()\n elif self.stderr:\n stderr=self.stderr.read()\n self.stderr.close()\n self.wait()\n else :\n if timeout is not None :\n endtime=_time()+timeout\n else :\n endtime=None\n \n try :\n stdout,stderr=self._communicate(input,endtime,timeout)\n except KeyboardInterrupt:\n \n \n if timeout is not None :\n sigint_timeout=min(self._sigint_wait_secs,\n self._remaining_time(endtime))\n else :\n sigint_timeout=self._sigint_wait_secs\n self._sigint_wait_secs=0\n try :\n self._wait(timeout=sigint_timeout)\n except TimeoutExpired:\n pass\n raise\n \n finally :\n self._communication_started=True\n \n sts=self.wait(timeout=self._remaining_time(endtime))\n \n return (stdout,stderr)\n \n \n def poll(self):\n ''\n \n return self._internal_poll()\n \n \n def _remaining_time(self,endtime):\n ''\n if endtime is None :\n return None\n else :\n return endtime -_time()\n \n \n def _check_timeout(self,endtime,orig_timeout,stdout_seq,stderr_seq,\n skip_check_and_raise=False ):\n ''\n if endtime is None :\n return\n if skip_check_and_raise or _time()>endtime:\n raise TimeoutExpired(\n self.args,orig_timeout,\n output=b''.join(stdout_seq)if stdout_seq else None ,\n stderr=b''.join(stderr_seq)if stderr_seq else None )\n \n \n def wait(self,timeout=None ):\n ''\n if timeout is not None :\n endtime=_time()+timeout\n try :\n return self._wait(timeout=timeout)\n except KeyboardInterrupt:\n \n \n \n \n if timeout is not None :\n sigint_timeout=min(self._sigint_wait_secs,\n self._remaining_time(endtime))\n else :\n sigint_timeout=self._sigint_wait_secs\n self._sigint_wait_secs=0\n try :\n self._wait(timeout=sigint_timeout)\n except TimeoutExpired:\n pass\n raise\n \n def _close_pipe_fds(self,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite):\n \n devnull_fd=getattr(self,'_devnull',None )\n \n with contextlib.ExitStack()as stack:\n if _mswindows:\n if p2cread !=-1:\n stack.callback(p2cread.Close)\n if c2pwrite !=-1:\n stack.callback(c2pwrite.Close)\n if errwrite !=-1:\n stack.callback(errwrite.Close)\n else :\n if p2cread !=-1 and p2cwrite !=-1 and p2cread !=devnull_fd:\n stack.callback(os.close,p2cread)\n if c2pwrite !=-1 and c2pread !=-1 and c2pwrite !=devnull_fd:\n stack.callback(os.close,c2pwrite)\n if errwrite !=-1 and errread !=-1 and errwrite !=devnull_fd:\n stack.callback(os.close,errwrite)\n \n if devnull_fd is not None :\n stack.callback(os.close,devnull_fd)\n \n \n self._closed_child_pipe_fds=True\n \n if _mswindows:\n \n \n \n def _get_handles(self,stdin,stdout,stderr):\n ''\n\n \n if stdin is None and stdout is None and stderr is None :\n return (-1,-1,-1,-1,-1,-1)\n \n p2cread,p2cwrite=-1,-1\n c2pread,c2pwrite=-1,-1\n errread,errwrite=-1,-1\n \n if stdin is None :\n p2cread=_winapi.GetStdHandle(_winapi.STD_INPUT_HANDLE)\n if p2cread is None :\n p2cread,_=_winapi.CreatePipe(None ,0)\n p2cread=Handle(p2cread)\n _winapi.CloseHandle(_)\n elif stdin ==PIPE:\n p2cread,p2cwrite=_winapi.CreatePipe(None ,0)\n p2cread,p2cwrite=Handle(p2cread),Handle(p2cwrite)\n elif stdin ==DEVNULL:\n p2cread=msvcrt.get_osfhandle(self._get_devnull())\n elif isinstance(stdin,int):\n p2cread=msvcrt.get_osfhandle(stdin)\n else :\n \n p2cread=msvcrt.get_osfhandle(stdin.fileno())\n p2cread=self._make_inheritable(p2cread)\n \n if stdout is None :\n c2pwrite=_winapi.GetStdHandle(_winapi.STD_OUTPUT_HANDLE)\n if c2pwrite is None :\n _,c2pwrite=_winapi.CreatePipe(None ,0)\n c2pwrite=Handle(c2pwrite)\n _winapi.CloseHandle(_)\n elif stdout ==PIPE:\n c2pread,c2pwrite=_winapi.CreatePipe(None ,0)\n c2pread,c2pwrite=Handle(c2pread),Handle(c2pwrite)\n elif stdout ==DEVNULL:\n c2pwrite=msvcrt.get_osfhandle(self._get_devnull())\n elif isinstance(stdout,int):\n c2pwrite=msvcrt.get_osfhandle(stdout)\n else :\n \n c2pwrite=msvcrt.get_osfhandle(stdout.fileno())\n c2pwrite=self._make_inheritable(c2pwrite)\n \n if stderr is None :\n errwrite=_winapi.GetStdHandle(_winapi.STD_ERROR_HANDLE)\n if errwrite is None :\n _,errwrite=_winapi.CreatePipe(None ,0)\n errwrite=Handle(errwrite)\n _winapi.CloseHandle(_)\n elif stderr ==PIPE:\n errread,errwrite=_winapi.CreatePipe(None ,0)\n errread,errwrite=Handle(errread),Handle(errwrite)\n elif stderr ==STDOUT:\n errwrite=c2pwrite\n elif stderr ==DEVNULL:\n errwrite=msvcrt.get_osfhandle(self._get_devnull())\n elif isinstance(stderr,int):\n errwrite=msvcrt.get_osfhandle(stderr)\n else :\n \n errwrite=msvcrt.get_osfhandle(stderr.fileno())\n errwrite=self._make_inheritable(errwrite)\n \n return (p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n \n def _make_inheritable(self,handle):\n ''\n h=_winapi.DuplicateHandle(\n _winapi.GetCurrentProcess(),handle,\n _winapi.GetCurrentProcess(),0,1,\n _winapi.DUPLICATE_SAME_ACCESS)\n return Handle(h)\n \n \n def _filter_handle_list(self,handle_list):\n ''\n\n \n \n \n \n return list({handle for handle in handle_list\n if handle&0x3 !=0x3\n or _winapi.GetFileType(handle)!=\n _winapi.FILE_TYPE_CHAR})\n \n \n def _execute_child(self,args,executable,preexec_fn,close_fds,\n pass_fds,cwd,env,\n startupinfo,creationflags,shell,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite,\n unused_restore_signals,\n unused_gid,unused_gids,unused_uid,\n unused_umask,\n unused_start_new_session,unused_process_group):\n ''\n \n assert not pass_fds,\"pass_fds not supported on Windows.\"\n \n if isinstance(args,str):\n pass\n elif isinstance(args,bytes):\n if shell:\n raise TypeError('bytes args is not allowed on Windows')\n args=list2cmdline([args])\n elif isinstance(args,os.PathLike):\n if shell:\n raise TypeError('path-like args is not allowed when '\n 'shell is true')\n args=list2cmdline([args])\n else :\n args=list2cmdline(args)\n \n if executable is not None :\n executable=os.fsdecode(executable)\n \n \n if startupinfo is None :\n startupinfo=STARTUPINFO()\n else :\n \n \n startupinfo=startupinfo.copy()\n \n use_std_handles=-1 not in (p2cread,c2pwrite,errwrite)\n if use_std_handles:\n startupinfo.dwFlags |=_winapi.STARTF_USESTDHANDLES\n startupinfo.hStdInput=p2cread\n startupinfo.hStdOutput=c2pwrite\n startupinfo.hStdError=errwrite\n \n attribute_list=startupinfo.lpAttributeList\n have_handle_list=bool(attribute_list and\n \"handle_list\"in attribute_list and\n attribute_list[\"handle_list\"])\n \n \n if have_handle_list or (use_std_handles and close_fds):\n if attribute_list is None :\n attribute_list=startupinfo.lpAttributeList={}\n handle_list=attribute_list[\"handle_list\"]=\\\n list(attribute_list.get(\"handle_list\",[]))\n \n if use_std_handles:\n handle_list +=[int(p2cread),int(c2pwrite),int(errwrite)]\n \n handle_list[:]=self._filter_handle_list(handle_list)\n \n if handle_list:\n if not close_fds:\n warnings.warn(\"startupinfo.lpAttributeList['handle_list'] \"\n \"overriding close_fds\",RuntimeWarning)\n \n \n \n \n close_fds=False\n \n if shell:\n startupinfo.dwFlags |=_winapi.STARTF_USESHOWWINDOW\n startupinfo.wShowWindow=_winapi.SW_HIDE\n comspec=os.environ.get(\"COMSPEC\",\"cmd.exe\")\n args='{} /c \"{}\"'.format(comspec,args)\n \n if cwd is not None :\n cwd=os.fsdecode(cwd)\n \n sys.audit(\"subprocess.Popen\",executable,args,cwd,env)\n \n \n try :\n hp,ht,pid,tid=_winapi.CreateProcess(executable,args,\n \n None ,None ,\n int(not close_fds),\n creationflags,\n env,\n cwd,\n startupinfo)\n finally :\n \n \n \n \n \n \n self._close_pipe_fds(p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n \n self._child_created=True\n self._handle=Handle(hp)\n self.pid=pid\n _winapi.CloseHandle(ht)\n \n def _internal_poll(self,_deadstate=None ,\n _WaitForSingleObject=_winapi.WaitForSingleObject,\n _WAIT_OBJECT_0=_winapi.WAIT_OBJECT_0,\n _GetExitCodeProcess=_winapi.GetExitCodeProcess):\n ''\n\n\n\n\n\n \n if self.returncode is None :\n if _WaitForSingleObject(self._handle,0)==_WAIT_OBJECT_0:\n self.returncode=_GetExitCodeProcess(self._handle)\n return self.returncode\n \n \n def _wait(self,timeout):\n ''\n if timeout is None :\n timeout_millis=_winapi.INFINITE\n else :\n timeout_millis=int(timeout *1000)\n if self.returncode is None :\n \n result=_winapi.WaitForSingleObject(self._handle,\n timeout_millis)\n if result ==_winapi.WAIT_TIMEOUT:\n raise TimeoutExpired(self.args,timeout)\n self.returncode=_winapi.GetExitCodeProcess(self._handle)\n return self.returncode\n \n \n def _readerthread(self,fh,buffer):\n buffer.append(fh.read())\n fh.close()\n \n \n def _communicate(self,input,endtime,orig_timeout):\n \n \n if self.stdout and not hasattr(self,\"_stdout_buff\"):\n self._stdout_buff=[]\n self.stdout_thread=\\\n threading.Thread(target=self._readerthread,\n args=(self.stdout,self._stdout_buff))\n self.stdout_thread.daemon=True\n self.stdout_thread.start()\n if self.stderr and not hasattr(self,\"_stderr_buff\"):\n self._stderr_buff=[]\n self.stderr_thread=\\\n threading.Thread(target=self._readerthread,\n args=(self.stderr,self._stderr_buff))\n self.stderr_thread.daemon=True\n self.stderr_thread.start()\n \n if self.stdin:\n self._stdin_write(input)\n \n \n \n \n if self.stdout is not None :\n self.stdout_thread.join(self._remaining_time(endtime))\n if self.stdout_thread.is_alive():\n raise TimeoutExpired(self.args,orig_timeout)\n if self.stderr is not None :\n self.stderr_thread.join(self._remaining_time(endtime))\n if self.stderr_thread.is_alive():\n raise TimeoutExpired(self.args,orig_timeout)\n \n \n \n stdout=None\n stderr=None\n if self.stdout:\n stdout=self._stdout_buff\n self.stdout.close()\n if self.stderr:\n stderr=self._stderr_buff\n self.stderr.close()\n \n \n stdout=stdout[0]if stdout else None\n stderr=stderr[0]if stderr else None\n \n return (stdout,stderr)\n \n def send_signal(self,sig):\n ''\n \n if self.returncode is not None :\n return\n if sig ==signal.SIGTERM:\n self.terminate()\n elif sig ==signal.CTRL_C_EVENT:\n os.kill(self.pid,signal.CTRL_C_EVENT)\n elif sig ==signal.CTRL_BREAK_EVENT:\n os.kill(self.pid,signal.CTRL_BREAK_EVENT)\n else :\n raise ValueError(\"Unsupported signal: {}\".format(sig))\n \n def terminate(self):\n ''\n \n if self.returncode is not None :\n return\n try :\n _winapi.TerminateProcess(self._handle,1)\n except PermissionError:\n \n \n rc=_winapi.GetExitCodeProcess(self._handle)\n if rc ==_winapi.STILL_ACTIVE:\n raise\n self.returncode=rc\n \n kill=terminate\n \n else :\n \n \n \n def _get_handles(self,stdin,stdout,stderr):\n ''\n\n \n p2cread,p2cwrite=-1,-1\n c2pread,c2pwrite=-1,-1\n errread,errwrite=-1,-1\n \n if stdin is None :\n pass\n elif stdin ==PIPE:\n p2cread,p2cwrite=os.pipe()\n if self.pipesize >0 and hasattr(fcntl,\"F_SETPIPE_SZ\"):\n fcntl.fcntl(p2cwrite,fcntl.F_SETPIPE_SZ,self.pipesize)\n elif stdin ==DEVNULL:\n p2cread=self._get_devnull()\n elif isinstance(stdin,int):\n p2cread=stdin\n else :\n \n p2cread=stdin.fileno()\n \n if stdout is None :\n pass\n elif stdout ==PIPE:\n c2pread,c2pwrite=os.pipe()\n if self.pipesize >0 and hasattr(fcntl,\"F_SETPIPE_SZ\"):\n fcntl.fcntl(c2pwrite,fcntl.F_SETPIPE_SZ,self.pipesize)\n elif stdout ==DEVNULL:\n c2pwrite=self._get_devnull()\n elif isinstance(stdout,int):\n c2pwrite=stdout\n else :\n \n c2pwrite=stdout.fileno()\n \n if stderr is None :\n pass\n elif stderr ==PIPE:\n errread,errwrite=os.pipe()\n if self.pipesize >0 and hasattr(fcntl,\"F_SETPIPE_SZ\"):\n fcntl.fcntl(errwrite,fcntl.F_SETPIPE_SZ,self.pipesize)\n elif stderr ==STDOUT:\n if c2pwrite !=-1:\n errwrite=c2pwrite\n else :\n errwrite=sys.__stdout__.fileno()\n elif stderr ==DEVNULL:\n errwrite=self._get_devnull()\n elif isinstance(stderr,int):\n errwrite=stderr\n else :\n \n errwrite=stderr.fileno()\n \n return (p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n \n def _posix_spawn(self,args,executable,env,restore_signals,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite):\n ''\n if env is None :\n env=os.environ\n \n kwargs={}\n if restore_signals:\n \n sigset=[]\n for signame in ('SIGPIPE','SIGXFZ','SIGXFSZ'):\n signum=getattr(signal,signame,None )\n if signum is not None :\n sigset.append(signum)\n kwargs['setsigdef']=sigset\n \n file_actions=[]\n for fd in (p2cwrite,c2pread,errread):\n if fd !=-1:\n file_actions.append((os.POSIX_SPAWN_CLOSE,fd))\n for fd,fd2 in (\n (p2cread,0),\n (c2pwrite,1),\n (errwrite,2),\n ):\n if fd !=-1:\n file_actions.append((os.POSIX_SPAWN_DUP2,fd,fd2))\n if file_actions:\n kwargs['file_actions']=file_actions\n \n self.pid=os.posix_spawn(executable,args,env,**kwargs)\n self._child_created=True\n \n self._close_pipe_fds(p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n def _execute_child(self,args,executable,preexec_fn,close_fds,\n pass_fds,cwd,env,\n startupinfo,creationflags,shell,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite,\n restore_signals,\n gid,gids,uid,umask,\n start_new_session,process_group):\n ''\n \n if isinstance(args,(str,bytes)):\n args=[args]\n elif isinstance(args,os.PathLike):\n if shell:\n raise TypeError('path-like args is not allowed when '\n 'shell is true')\n args=[args]\n else :\n args=list(args)\n \n if shell:\n \n unix_shell=('/system/bin/sh'if\n hasattr(sys,'getandroidapilevel')else '/bin/sh')\n args=[unix_shell,\"-c\"]+args\n if executable:\n args[0]=executable\n \n if executable is None :\n executable=args[0]\n \n sys.audit(\"subprocess.Popen\",executable,args,cwd,env)\n \n if (_USE_POSIX_SPAWN\n and os.path.dirname(executable)\n and preexec_fn is None\n and not close_fds\n and not pass_fds\n and cwd is None\n and (p2cread ==-1 or p2cread >2)\n and (c2pwrite ==-1 or c2pwrite >2)\n and (errwrite ==-1 or errwrite >2)\n and not start_new_session\n and process_group ==-1\n and gid is None\n and gids is None\n and uid is None\n and umask <0):\n self._posix_spawn(args,executable,env,restore_signals,\n p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n return\n \n orig_executable=executable\n \n \n \n \n errpipe_read,errpipe_write=os.pipe()\n \n low_fds_to_close=[]\n while errpipe_write <3:\n low_fds_to_close.append(errpipe_write)\n errpipe_write=os.dup(errpipe_write)\n for low_fd in low_fds_to_close:\n os.close(low_fd)\n try :\n try :\n \n \n \n \n \n if env is not None :\n env_list=[]\n for k,v in env.items():\n k=os.fsencode(k)\n if b'='in k:\n raise ValueError(\"illegal environment variable name\")\n env_list.append(k+b'='+os.fsencode(v))\n else :\n env_list=None\n executable=os.fsencode(executable)\n if os.path.dirname(executable):\n executable_list=(executable,)\n else :\n \n executable_list=tuple(\n os.path.join(os.fsencode(dir),executable)\n for dir in os.get_exec_path(env))\n fds_to_keep=set(pass_fds)\n fds_to_keep.add(errpipe_write)\n self.pid=_fork_exec(\n args,executable_list,\n close_fds,tuple(sorted(map(int,fds_to_keep))),\n cwd,env_list,\n p2cread,p2cwrite,c2pread,c2pwrite,\n errread,errwrite,\n errpipe_read,errpipe_write,\n restore_signals,start_new_session,\n process_group,gid,gids,uid,umask,\n preexec_fn,_USE_VFORK)\n self._child_created=True\n finally :\n \n os.close(errpipe_write)\n \n self._close_pipe_fds(p2cread,p2cwrite,\n c2pread,c2pwrite,\n errread,errwrite)\n \n \n \n errpipe_data=bytearray()\n while True :\n part=os.read(errpipe_read,50000)\n errpipe_data +=part\n if not part or len(errpipe_data)>50000:\n break\n finally :\n \n os.close(errpipe_read)\n \n if errpipe_data:\n try :\n pid,sts=os.waitpid(self.pid,0)\n if pid ==self.pid:\n self._handle_exitstatus(sts)\n else :\n self.returncode=sys.maxsize\n except ChildProcessError:\n pass\n \n try :\n exception_name,hex_errno,err_msg=(\n errpipe_data.split(b':',2))\n \n \n \n err_msg=err_msg.decode()\n except ValueError:\n exception_name=b'SubprocessError'\n hex_errno=b'0'\n err_msg='Bad exception data from child: {!r}'.format(\n bytes(errpipe_data))\n child_exception_type=getattr(\n builtins,exception_name.decode('ascii'),\n SubprocessError)\n if issubclass(child_exception_type,OSError)and hex_errno:\n errno_num=int(hex_errno,16)\n child_exec_never_called=(err_msg ==\"noexec\")\n if child_exec_never_called:\n err_msg=\"\"\n \n err_filename=cwd\n else :\n err_filename=orig_executable\n if errno_num !=0:\n err_msg=os.strerror(errno_num)\n raise child_exception_type(errno_num,err_msg,err_filename)\n raise child_exception_type(err_msg)\n \n \n def _handle_exitstatus(self,sts,\n _waitstatus_to_exitcode=_waitstatus_to_exitcode,\n _WIFSTOPPED=_WIFSTOPPED,\n _WSTOPSIG=_WSTOPSIG):\n ''\n \n \n if _WIFSTOPPED(sts):\n self.returncode=-_WSTOPSIG(sts)\n else :\n self.returncode=_waitstatus_to_exitcode(sts)\n \n def _internal_poll(self,_deadstate=None ,_waitpid=_waitpid,\n _WNOHANG=_WNOHANG,_ECHILD=errno.ECHILD):\n ''\n\n\n\n\n\n \n if self.returncode is None :\n if not self._waitpid_lock.acquire(False ):\n \n \n return None\n try :\n if self.returncode is not None :\n return self.returncode\n pid,sts=_waitpid(self.pid,_WNOHANG)\n if pid ==self.pid:\n self._handle_exitstatus(sts)\n except OSError as e:\n if _deadstate is not None :\n self.returncode=_deadstate\n elif e.errno ==_ECHILD:\n \n \n \n \n \n self.returncode=0\n finally :\n self._waitpid_lock.release()\n return self.returncode\n \n \n def _try_wait(self,wait_flags):\n ''\n try :\n (pid,sts)=os.waitpid(self.pid,wait_flags)\n except ChildProcessError:\n \n \n \n pid=self.pid\n sts=0\n return (pid,sts)\n \n \n def _wait(self,timeout):\n ''\n if self.returncode is not None :\n return self.returncode\n \n if timeout is not None :\n endtime=_time()+timeout\n \n \n delay=0.0005\n while True :\n if self._waitpid_lock.acquire(False ):\n try :\n if self.returncode is not None :\n break\n (pid,sts)=self._try_wait(os.WNOHANG)\n assert pid ==self.pid or pid ==0\n if pid ==self.pid:\n self._handle_exitstatus(sts)\n break\n finally :\n self._waitpid_lock.release()\n remaining=self._remaining_time(endtime)\n if remaining <=0:\n raise TimeoutExpired(self.args,timeout)\n delay=min(delay *2,remaining,.05)\n time.sleep(delay)\n else :\n while self.returncode is None :\n with self._waitpid_lock:\n if self.returncode is not None :\n break\n (pid,sts)=self._try_wait(0)\n \n \n \n if pid ==self.pid:\n self._handle_exitstatus(sts)\n return self.returncode\n \n \n def _communicate(self,input,endtime,orig_timeout):\n if self.stdin and not self._communication_started:\n \n \n try :\n self.stdin.flush()\n except BrokenPipeError:\n pass\n if not input:\n try :\n self.stdin.close()\n except BrokenPipeError:\n pass\n \n stdout=None\n stderr=None\n \n \n if not self._communication_started:\n self._fileobj2output={}\n if self.stdout:\n self._fileobj2output[self.stdout]=[]\n if self.stderr:\n self._fileobj2output[self.stderr]=[]\n \n if self.stdout:\n stdout=self._fileobj2output[self.stdout]\n if self.stderr:\n stderr=self._fileobj2output[self.stderr]\n \n self._save_input(input)\n \n if self._input:\n input_view=memoryview(self._input)\n \n with _PopenSelector()as selector:\n if self.stdin and input:\n selector.register(self.stdin,selectors.EVENT_WRITE)\n if self.stdout and not self.stdout.closed:\n selector.register(self.stdout,selectors.EVENT_READ)\n if self.stderr and not self.stderr.closed:\n selector.register(self.stderr,selectors.EVENT_READ)\n \n while selector.get_map():\n timeout=self._remaining_time(endtime)\n if timeout is not None and timeout <0:\n self._check_timeout(endtime,orig_timeout,\n stdout,stderr,\n skip_check_and_raise=True )\n raise RuntimeError(\n '_check_timeout(..., skip_check_and_raise=True) '\n 'failed to raise TimeoutExpired.')\n \n ready=selector.select(timeout)\n self._check_timeout(endtime,orig_timeout,stdout,stderr)\n \n \n \n \n for key,events in ready:\n if key.fileobj is self.stdin:\n chunk=input_view[self._input_offset:\n self._input_offset+_PIPE_BUF]\n try :\n self._input_offset +=os.write(key.fd,chunk)\n except BrokenPipeError:\n selector.unregister(key.fileobj)\n key.fileobj.close()\n else :\n if self._input_offset >=len(self._input):\n selector.unregister(key.fileobj)\n key.fileobj.close()\n elif key.fileobj in (self.stdout,self.stderr):\n data=os.read(key.fd,32768)\n if not data:\n selector.unregister(key.fileobj)\n key.fileobj.close()\n self._fileobj2output[key.fileobj].append(data)\n \n self.wait(timeout=self._remaining_time(endtime))\n \n \n if stdout is not None :\n stdout=b''.join(stdout)\n if stderr is not None :\n stderr=b''.join(stderr)\n \n \n \n if self.text_mode:\n if stdout is not None :\n stdout=self._translate_newlines(stdout,\n self.stdout.encoding,\n self.stdout.errors)\n if stderr is not None :\n stderr=self._translate_newlines(stderr,\n self.stderr.encoding,\n self.stderr.errors)\n \n return (stdout,stderr)\n \n \n def _save_input(self,input):\n \n \n \n if self.stdin and self._input is None :\n self._input_offset=0\n self._input=input\n if input is not None and self.text_mode:\n self._input=self._input.encode(self.stdin.encoding,\n self.stdin.errors)\n \n \n def send_signal(self,sig):\n ''\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n self.poll()\n if self.returncode is not None :\n \n return\n \n \n \n \n try :\n os.kill(self.pid,sig)\n except ProcessLookupError:\n \n pass\n \n def terminate(self):\n ''\n \n self.send_signal(signal.SIGTERM)\n \n def kill(self):\n ''\n \n self.send_signal(signal.SIGKILL)\n", ["_posixsubprocess", "_winapi", "builtins", "contextlib", "errno", "fcntl", "grp", "io", "locale", "msvcrt", "os", "pwd", "select", "selectors", "signal", "sys", "threading", "time", "types", "warnings"]], "symtable": [".py", "''\n\nimport _symtable\nfrom _symtable import (USE,DEF_GLOBAL,DEF_NONLOCAL,DEF_LOCAL,DEF_PARAM,\nDEF_IMPORT,DEF_BOUND,DEF_ANNOT,SCOPE_OFF,SCOPE_MASK,FREE,\nLOCAL,GLOBAL_IMPLICIT,GLOBAL_EXPLICIT,CELL)\n\nimport weakref\n\n__all__=[\"symtable\",\"SymbolTable\",\"Class\",\"Function\",\"Symbol\"]\n\ndef symtable(code,filename,compile_type):\n ''\n\n\n\n \n top=_symtable.symtable(code,filename,compile_type)\n return _newSymbolTable(top,filename)\n \nclass SymbolTableFactory:\n def __init__(self):\n self.__memo=weakref.WeakValueDictionary()\n \n def new(self,table,filename):\n if table.type ==_symtable.TYPE_FUNCTION:\n return Function(table,filename)\n if table.type ==_symtable.TYPE_CLASS:\n return Class(table,filename)\n return SymbolTable(table,filename)\n \n def __call__(self,table,filename):\n key=table,filename\n obj=self.__memo.get(key,None )\n if obj is None :\n obj=self.__memo[key]=self.new(table,filename)\n return obj\n \n_newSymbolTable=SymbolTableFactory()\n\n\nclass SymbolTable:\n\n def __init__(self,raw_table,filename):\n self._table=raw_table\n self._filename=filename\n self._symbols={}\n \n def __repr__(self):\n if self.__class__ ==SymbolTable:\n kind=\"\"\n else :\n kind=\"%s \"%self.__class__.__name__\n \n if self._table.name ==\"top\":\n return \"<{0}SymbolTable for module {1}>\".format(kind,self._filename)\n else :\n return \"<{0}SymbolTable for {1} in {2}>\".format(kind,\n self._table.name,\n self._filename)\n \n def get_type(self):\n ''\n\n\n\n \n if self._table.type ==_symtable.TYPE_MODULE:\n return \"module\"\n if self._table.type ==_symtable.TYPE_FUNCTION:\n return \"function\"\n if self._table.type ==_symtable.TYPE_CLASS:\n return \"class\"\n assert self._table.type in (1,2,3),\\\n \"unexpected type: {0}\".format(self._table.type)\n \n def get_id(self):\n ''\n \n return self._table.id\n \n def get_name(self):\n ''\n\n\n\n\n \n return self._table.name\n \n def get_lineno(self):\n ''\n\n \n return self._table.lineno\n \n def is_optimized(self):\n ''\n\n \n return bool(self._table.type ==_symtable.TYPE_FUNCTION)\n \n def is_nested(self):\n ''\n \n return bool(self._table.nested)\n \n def has_children(self):\n ''\n \n return bool(self._table.children)\n \n def get_identifiers(self):\n ''\n \n return self._table.symbols.keys()\n \n def lookup(self,name):\n ''\n\n\n \n sym=self._symbols.get(name)\n if sym is None :\n flags=self._table.symbols[name]\n namespaces=self.__check_children(name)\n module_scope=(self._table.name ==\"top\")\n sym=self._symbols[name]=Symbol(name,flags,namespaces,\n module_scope=module_scope)\n return sym\n \n def get_symbols(self):\n ''\n\n \n return [self.lookup(ident)for ident in self.get_identifiers()]\n \n def __check_children(self,name):\n return [_newSymbolTable(st,self._filename)\n for st in self._table.children\n if st.name ==name]\n \n def get_children(self):\n ''\n \n return [_newSymbolTable(st,self._filename)\n for st in self._table.children]\n \n \nclass Function(SymbolTable):\n\n\n __params=None\n __locals=None\n __frees=None\n __globals=None\n __nonlocals=None\n \n def __idents_matching(self,test_func):\n return tuple(ident for ident in self.get_identifiers()\n if test_func(self._table.symbols[ident]))\n \n def get_parameters(self):\n ''\n \n if self.__params is None :\n self.__params=self.__idents_matching(lambda x:x&DEF_PARAM)\n return self.__params\n \n def get_locals(self):\n ''\n \n if self.__locals is None :\n locs=(LOCAL,CELL)\n test=lambda x:((x >>SCOPE_OFF)&SCOPE_MASK)in locs\n self.__locals=self.__idents_matching(test)\n return self.__locals\n \n def get_globals(self):\n ''\n \n if self.__globals is None :\n glob=(GLOBAL_IMPLICIT,GLOBAL_EXPLICIT)\n test=lambda x:((x >>SCOPE_OFF)&SCOPE_MASK)in glob\n self.__globals=self.__idents_matching(test)\n return self.__globals\n \n def get_nonlocals(self):\n ''\n \n if self.__nonlocals is None :\n self.__nonlocals=self.__idents_matching(lambda x:x&DEF_NONLOCAL)\n return self.__nonlocals\n \n def get_frees(self):\n ''\n \n if self.__frees is None :\n is_free=lambda x:((x >>SCOPE_OFF)&SCOPE_MASK)==FREE\n self.__frees=self.__idents_matching(is_free)\n return self.__frees\n \n \nclass Class(SymbolTable):\n\n __methods=None\n \n def get_methods(self):\n ''\n \n if self.__methods is None :\n d={}\n for st in self._table.children:\n d[st.name]=1\n self.__methods=tuple(d)\n return self.__methods\n \n \nclass Symbol:\n\n def __init__(self,name,flags,namespaces=None ,*,module_scope=False ):\n self.__name=name\n self.__flags=flags\n self.__scope=(flags >>SCOPE_OFF)&SCOPE_MASK\n self.__namespaces=namespaces or ()\n self.__module_scope=module_scope\n \n def __repr__(self):\n return \"\".format(self.__name)\n \n def get_name(self):\n ''\n \n return self.__name\n \n def is_referenced(self):\n ''\n\n \n return bool(self.__flags&_symtable.USE)\n \n def is_parameter(self):\n ''\n \n return bool(self.__flags&DEF_PARAM)\n \n def is_global(self):\n ''\n \n return bool(self.__scope in (GLOBAL_IMPLICIT,GLOBAL_EXPLICIT)\n or (self.__module_scope and self.__flags&DEF_BOUND))\n \n def is_nonlocal(self):\n ''\n return bool(self.__flags&DEF_NONLOCAL)\n \n def is_declared_global(self):\n ''\n \n return bool(self.__scope ==GLOBAL_EXPLICIT)\n \n def is_local(self):\n ''\n \n return bool(self.__scope in (LOCAL,CELL)\n or (self.__module_scope and self.__flags&DEF_BOUND))\n \n def is_annotated(self):\n ''\n \n return bool(self.__flags&DEF_ANNOT)\n \n def is_free(self):\n ''\n\n \n return bool(self.__scope ==FREE)\n \n def is_imported(self):\n ''\n\n \n return bool(self.__flags&DEF_IMPORT)\n \n def is_assigned(self):\n ''\n return bool(self.__flags&DEF_LOCAL)\n \n def is_namespace(self):\n ''\n\n\n\n\n\n\n\n\n \n return bool(self.__namespaces)\n \n def get_namespaces(self):\n ''\n return self.__namespaces\n \n def get_namespace(self):\n ''\n\n\n\n \n if len(self.__namespaces)==0:\n raise ValueError(\"name is not bound to any namespaces\")\n elif len(self.__namespaces)>1:\n raise ValueError(\"name is bound to multiple namespaces\")\n else :\n return self.__namespaces[0]\n \nif __name__ ==\"__main__\":\n import os,sys\n with open(sys.argv[0])as f:\n src=f.read()\n mod=symtable(src,os.path.split(sys.argv[0])[1],\"exec\")\n for ident in mod.get_identifiers():\n info=mod.lookup(ident)\n print(info,info.is_local(),info.is_namespace())\n", ["_symtable", "os", "sys", "weakref"]], "sys": [".py", "\nfrom _sys import *\nimport _sys\n\n_getframe=_sys._getframe\n\nclass _dataclass(tuple):\n\n def __init__(self,**kwargs):\n self.keys=list(kwargs)\n self.__dict__.update(kwargs)\n \n def __getitem__(self,key):\n if isinstance(key,int)and 0 <=key <=len(self.keys):\n return self.__dict__[self.keys[key]]\n raise KeyError(key)\n \n def __iter__(self):\n return(self.__dict__[key]for key in self.keys)\n \n def __len__(self):\n return len(self.keys)\n \n def __repr__(self):\n s=', '.join(f'{k}={self.__dict__[k]}'for k in self.keys)\n return f'sys.{self.__class__.__name__}({s})'\n \n \ndef make_dataclass(name,bases=None):\n bases=[_dataclass]if bases is None else[*bases,_dataclass]\n cls=type(name,bases,{})\n return cls\n \n \n__breakpointhook__=breakpointhook\n\nabiflags=0\n\ndef audit(event,*args):\n ''\n pass\n \nbrython_debug_mode=__BRYTHON__.get_option('debug')\n\nbase_exec_prefix=__BRYTHON__.brython_path\n\nbase_prefix=__BRYTHON__.brython_path\n\nbuiltin_module_names=__BRYTHON__.builtin_module_names\n\nbyteorder='little'\n\ndont_write_bytecode=True\n\nexec_prefix=__BRYTHON__.brython_path\n\nexecutable=__BRYTHON__.brython_path+'brython.js'\n\nargv=orig_argv=[__BRYTHON__.script_path]+list(__BRYTHON__.get_option('args'))\n\ndef displayhook(value):\n if value is not None:\n stdout.write(repr(value))\n \n__displayhook__=displayhook\n\ndef exit(i=None):\n raise SystemExit('')\n \nflags=make_dataclass('flags')(\ndebug=0,\ninspect=0,\ninteractive=0,\noptimize=0,\ndont_write_bytecode=0,\nno_user_site=0,\nno_site=0,\nignore_environment=0,\nverbose=0,\nbytes_warning=0,\nquiet=0,\nhash_randomization=1,\nisolated=0,\ndev_mode=False,\nutf8_mode=0,\nwarn_default_encoding=0\n)\n\ndef getfilesystemencoding(*args,**kw):\n ''\n\n \n return 'utf-8'\n \ndef getfilesystemencodeerrors():\n return \"utf-8\"\n \ndef intern(string):\n return string\n \nint_info=make_dataclass('int_info')(\nbits_per_digit=30,\nsizeof_digit=4,\ndefault_max_str_digits=__BRYTHON__.int_max_str_digits,\nstr_digits_check_threshold=__BRYTHON__.str_digits_check_threshold)\n\ndef get_int_max_str_digits():\n return __BRYTHON__.int_max_str_digits\n \ndef set_int_max_str_digits(value):\n try:\n value=int(value)\n except:\n raise ValueError(f\"'{value.__class__.__name__}' object \"\n \"cannot be interpreted as an integer\")\n if value !=0 and value =other\n \n return NotImplemented\n \n def __gt__(self,other):\n if isinstance(other,tuple):\n return(self.major,self.minor,self.micro)>other\n \n return NotImplemented\n \n def __le__(self,other):\n if isinstance(other,tuple):\n return(self.major,self.minor,self.micro)<=other\n \n return NotImplemented\n \n def __lt__(self,other):\n if isinstance(other,tuple):\n return(self.major,self.minor,self.micro)0:\n for name in tuple(variables):\n value=notdone[name]\n m1=re.search(_findvar1_rx,value)\n m2=re.search(_findvar2_rx,value)\n if m1 and m2:\n m=m1 if m1.start()=\"5\":\n osname=\"solaris\"\n release=f\"{int(release[0])-3}.{release[2:]}\"\n \n \n \n bitness={2147483647:\"32bit\",9223372036854775807:\"64bit\"}\n machine +=f\".{bitness[sys.maxsize]}\"\n \n elif osname[:3]==\"aix\":\n from _aix_support import aix_platform\n return aix_platform()\n elif osname[:6]==\"cygwin\":\n osname=\"cygwin\"\n import re\n rel_re=re.compile(r'[\\d.]+')\n m=rel_re.match(release)\n if m:\n release=m.group()\n elif osname[:6]==\"darwin\":\n import _osx_support\n osname,release,machine=_osx_support.get_platform_osx(\n get_config_vars(),\n osname,release,machine)\n \n return f\"{osname}-{release}-{machine}\"\n \n \ndef get_python_version():\n return _PY_VERSION_SHORT\n \n \ndef expand_makefile_vars(s,vars):\n ''\n\n\n\n\n\n \n import re\n \n \n \n \n \n \n \n while True:\n m=re.search(_findvar1_rx,s)or re.search(_findvar2_rx,s)\n if m:\n (beg,end)=m.span()\n s=s[0:beg]+vars.get(m.group(1))+s[end:]\n else:\n break\n return s\n \n \ndef _print_dict(title,data):\n for index,(key,value)in enumerate(sorted(data.items())):\n if index ==0:\n print(f'{title}: ')\n print(f'\\t{key} = \"{value}\"')\n \n \ndef _main():\n ''\n if '--generate-posix-vars'in sys.argv:\n _generate_posix_vars()\n return\n print(f'Platform: \"{get_platform()}\"')\n print(f'Python version: \"{get_python_version()}\"')\n print(f'Current installation scheme: \"{get_default_scheme()}\"')\n print()\n _print_dict('Paths',get_paths())\n print()\n _print_dict('Variables',get_config_vars())\n \n \nif __name__ =='__main__':\n _main()\n", ["_aix_support", "_imp", "_osx_support", "os", "os.path", "pprint", "re", "sys", "threading", "types", "warnings"]], "tabnanny": [".py", "#! /usr/bin/env python3\n\n\"\"\"The Tab Nanny despises ambiguous indentation. She knows no mercy.\n\ntabnanny -- Detection of ambiguous indentation\n\nFor the time being this module is intended to be called as a script.\nHowever it is possible to import it into an IDE and use the function\ncheck() described below.\n\nWarning: The API provided by this module is likely to change in future\nreleases; such changes may not be backward compatible.\n\"\"\"\n\n\n\n\n\n\n\n__version__=\"6\"\n\nimport os\nimport sys\nimport tokenize\n\n__all__=[\"check\",\"NannyNag\",\"process_tokens\"]\n\nverbose=0\nfilename_only=0\n\ndef errprint(*args):\n sep=\"\"\n for arg in args:\n sys.stderr.write(sep+str(arg))\n sep=\" \"\n sys.stderr.write(\"\\n\")\n sys.exit(1)\n \ndef main():\n import getopt\n \n global verbose,filename_only\n try:\n opts,args=getopt.getopt(sys.argv[1:],\"qv\")\n except getopt.error as msg:\n errprint(msg)\n for o,a in opts:\n if o =='-q':\n filename_only=filename_only+1\n if o =='-v':\n verbose=verbose+1\n if not args:\n errprint(\"Usage:\",sys.argv[0],\"[-v] file_or_directory ...\")\n for arg in args:\n check(arg)\n \nclass NannyNag(Exception):\n ''\n\n\n \n def __init__(self,lineno,msg,line):\n self.lineno,self.msg,self.line=lineno,msg,line\n def get_lineno(self):\n return self.lineno\n def get_msg(self):\n return self.msg\n def get_line(self):\n return self.line\n \ndef check(file):\n ''\n\n\n\n\n\n\n \n \n if os.path.isdir(file)and not os.path.islink(file):\n if verbose:\n print(\"%r: listing directory\"%(file,))\n names=os.listdir(file)\n for name in names:\n fullname=os.path.join(file,name)\n if(os.path.isdir(fullname)and\n not os.path.islink(fullname)or\n os.path.normcase(name[-3:])==\".py\"):\n check(fullname)\n return\n \n try:\n f=tokenize.open(file)\n except OSError as msg:\n errprint(\"%r: I/O Error: %s\"%(file,msg))\n return\n \n if verbose >1:\n print(\"checking %r ...\"%file)\n \n try:\n process_tokens(tokenize.generate_tokens(f.readline))\n \n except tokenize.TokenError as msg:\n errprint(\"%r: Token Error: %s\"%(file,msg))\n return\n \n except SyntaxError as msg:\n errprint(\"%r: Token Error: %s\"%(file,msg))\n return\n \n except IndentationError as msg:\n errprint(\"%r: Indentation Error: %s\"%(file,msg))\n return\n \n except NannyNag as nag:\n badline=nag.get_lineno()\n line=nag.get_line()\n if verbose:\n print(\"%r: *** Line %d: trouble in tab city! ***\"%(file,badline))\n print(\"offending line: %r\"%(line,))\n print(nag.get_msg())\n else:\n if ' 'in file:file='\"'+file+'\"'\n if filename_only:print(file)\n else:print(file,badline,repr(line))\n return\n \n finally:\n f.close()\n \n if verbose:\n print(\"%r: Clean bill of health.\"%(file,))\n \nclass Whitespace:\n\n S,T=' \\t'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def __init__(self,ws):\n self.raw=ws\n S,T=Whitespace.S,Whitespace.T\n count=[]\n b=n=nt=0\n for ch in self.raw:\n if ch ==S:\n n=n+1\n b=b+1\n elif ch ==T:\n n=n+1\n nt=nt+1\n if b >=len(count):\n count=count+[0]*(b -len(count)+1)\n count[b]=count[b]+1\n b=0\n else:\n break\n self.n=n\n self.nt=nt\n self.norm=tuple(count),b\n self.is_simple=len(count)<=1\n \n \n \n def longest_run_of_spaces(self):\n count,trailing=self.norm\n return max(len(count)-1,trailing)\n \n def indent_level(self,tabsize):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n count,trailing=self.norm\n il=0\n for i in range(tabsize,len(count)):\n il=il+i //tabsize *count[i]\n return trailing+tabsize *(il+self.nt)\n \n \n \n def equal(self,other):\n return self.norm ==other.norm\n \n \n \n \n \n def not_equal_witness(self,other):\n n=max(self.longest_run_of_spaces(),\n other.longest_run_of_spaces())+1\n a=[]\n for ts in range(1,n+1):\n if self.indent_level(ts)!=other.indent_level(ts):\n a.append((ts,\n self.indent_level(ts),\n other.indent_level(ts)))\n return a\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n def less(self,other):\n if self.n >=other.n:\n return False\n if self.is_simple and other.is_simple:\n return self.nt <=other.nt\n n=max(self.longest_run_of_spaces(),\n other.longest_run_of_spaces())+1\n \n for ts in range(2,n+1):\n if self.indent_level(ts)>=other.indent_level(ts):\n return False\n return True\n \n \n \n \n \n def not_less_witness(self,other):\n n=max(self.longest_run_of_spaces(),\n other.longest_run_of_spaces())+1\n a=[]\n for ts in range(1,n+1):\n if self.indent_level(ts)>=other.indent_level(ts):\n a.append((ts,\n self.indent_level(ts),\n other.indent_level(ts)))\n return a\n \ndef format_witnesses(w):\n firsts=(str(tup[0])for tup in w)\n prefix=\"at tab size\"\n if len(w)>1:\n prefix=prefix+\"s\"\n return prefix+\" \"+', '.join(firsts)\n \ndef process_tokens(tokens):\n try:\n _process_tokens(tokens)\n except TabError as e:\n raise NannyNag(e.lineno,e.msg,e.text)\n \ndef _process_tokens(tokens):\n INDENT=tokenize.INDENT\n DEDENT=tokenize.DEDENT\n NEWLINE=tokenize.NEWLINE\n JUNK=tokenize.COMMENT,tokenize.NL\n indents=[Whitespace(\"\")]\n check_equal=0\n \n for(type,token,start,end,line)in tokens:\n if type ==NEWLINE:\n \n \n \n \n \n check_equal=1\n \n elif type ==INDENT:\n check_equal=0\n thisguy=Whitespace(token)\n if not indents[-1].less(thisguy):\n witness=indents[-1].not_less_witness(thisguy)\n msg=\"indent not greater e.g. \"+format_witnesses(witness)\n raise NannyNag(start[0],msg,line)\n indents.append(thisguy)\n \n elif type ==DEDENT:\n \n \n \n \n \n \n \n \n \n check_equal=1\n \n del indents[-1]\n \n elif check_equal and type not in JUNK:\n \n \n \n \n \n \n check_equal=0\n thisguy=Whitespace(line)\n if not indents[-1].equal(thisguy):\n witness=indents[-1].not_equal_witness(thisguy)\n msg=\"indent not equal e.g. \"+format_witnesses(witness)\n raise NannyNag(start[0],msg,line)\n \n \nif __name__ =='__main__':\n main()\n", ["getopt", "os", "sys", "tokenize"]], "tarfile": [".py", "#!/usr/bin/env python3\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n''\n\n\nversion=\"0.9.0\"\n__author__=\"Lars Gust\\u00e4bel (lars@gustaebel.de)\"\n__credits__=\"Gustavo Niemeyer, Niels Gust\\u00e4bel, Richard Townsend.\"\n\n\n\n\nfrom builtins import open as bltn_open\nimport sys\nimport os\nimport io\nimport shutil\nimport stat\nimport time\nimport struct\nimport copy\nimport re\nimport warnings\n\ntry:\n import pwd\nexcept ImportError:\n pwd=None\ntry:\n import grp\nexcept ImportError:\n grp=None\n \n \n \n \nsymlink_exception=(AttributeError,NotImplementedError,OSError)\n\n\n__all__=[\"TarFile\",\"TarInfo\",\"is_tarfile\",\"TarError\",\"ReadError\",\n\"CompressionError\",\"StreamError\",\"ExtractError\",\"HeaderError\",\n\"ENCODING\",\"USTAR_FORMAT\",\"GNU_FORMAT\",\"PAX_FORMAT\",\n\"DEFAULT_FORMAT\",\"open\",\"fully_trusted_filter\",\"data_filter\",\n\"tar_filter\",\"FilterError\",\"AbsoluteLinkError\",\n\"OutsideDestinationError\",\"SpecialFileError\",\"AbsolutePathError\",\n\"LinkOutsideDestinationError\"]\n\n\n\n\n\nNUL=b\"\\0\"\nBLOCKSIZE=512\nRECORDSIZE=BLOCKSIZE *20\nGNU_MAGIC=b\"ustar \\0\"\nPOSIX_MAGIC=b\"ustar\\x0000\"\n\nLENGTH_NAME=100\nLENGTH_LINK=100\nLENGTH_PREFIX=155\n\nREGTYPE=b\"0\"\nAREGTYPE=b\"\\0\"\nLNKTYPE=b\"1\"\nSYMTYPE=b\"2\"\nCHRTYPE=b\"3\"\nBLKTYPE=b\"4\"\nDIRTYPE=b\"5\"\nFIFOTYPE=b\"6\"\nCONTTYPE=b\"7\"\n\nGNUTYPE_LONGNAME=b\"L\"\nGNUTYPE_LONGLINK=b\"K\"\nGNUTYPE_SPARSE=b\"S\"\n\nXHDTYPE=b\"x\"\nXGLTYPE=b\"g\"\nSOLARIS_XHDTYPE=b\"X\"\n\nUSTAR_FORMAT=0\nGNU_FORMAT=1\nPAX_FORMAT=2\nDEFAULT_FORMAT=PAX_FORMAT\n\n\n\n\n\nSUPPORTED_TYPES=(REGTYPE,AREGTYPE,LNKTYPE,\nSYMTYPE,DIRTYPE,FIFOTYPE,\nCONTTYPE,CHRTYPE,BLKTYPE,\nGNUTYPE_LONGNAME,GNUTYPE_LONGLINK,\nGNUTYPE_SPARSE)\n\n\nREGULAR_TYPES=(REGTYPE,AREGTYPE,\nCONTTYPE,GNUTYPE_SPARSE)\n\n\nGNU_TYPES=(GNUTYPE_LONGNAME,GNUTYPE_LONGLINK,\nGNUTYPE_SPARSE)\n\n\nPAX_FIELDS=(\"path\",\"linkpath\",\"size\",\"mtime\",\n\"uid\",\"gid\",\"uname\",\"gname\")\n\n\nPAX_NAME_FIELDS={\"path\",\"linkpath\",\"uname\",\"gname\"}\n\n\n\nPAX_NUMBER_FIELDS={\n\"atime\":float,\n\"ctime\":float,\n\"mtime\":float,\n\"uid\":int,\n\"gid\":int,\n\"size\":int\n}\n\n\n\n\nif os.name ==\"nt\":\n ENCODING=\"utf-8\"\nelse:\n ENCODING=sys.getfilesystemencoding()\n \n \n \n \n \ndef stn(s,length,encoding,errors):\n ''\n \n if s is None:\n raise ValueError(\"metadata cannot contain None\")\n s=s.encode(encoding,errors)\n return s[:length]+(length -len(s))*NUL\n \ndef nts(s,encoding,errors):\n ''\n \n p=s.find(b\"\\0\")\n if p !=-1:\n s=s[:p]\n return s.decode(encoding,errors)\n \ndef nti(s):\n ''\n \n \n \n if s[0]in(0o200,0o377):\n n=0\n for i in range(len(s)-1):\n n <<=8\n n +=s[i+1]\n if s[0]==0o377:\n n=-(256 **(len(s)-1)-n)\n else:\n try:\n s=nts(s,\"ascii\",\"strict\")\n n=int(s.strip()or \"0\",8)\n except ValueError:\n raise InvalidHeaderError(\"invalid header\")\n return n\n \ndef itn(n,digits=8,format=DEFAULT_FORMAT):\n ''\n \n \n \n \n \n \n \n \n \n original_n=n\n n=int(n)\n if 0 <=n <8 **(digits -1):\n s=bytes(\"%0*o\"%(digits -1,n),\"ascii\")+NUL\n elif format ==GNU_FORMAT and -256 **(digits -1)<=n <256 **(digits -1):\n if n >=0:\n s=bytearray([0o200])\n else:\n s=bytearray([0o377])\n n=256 **digits+n\n \n for i in range(digits -1):\n s.insert(1,n&0o377)\n n >>=8\n else:\n raise ValueError(\"overflow in number field\")\n \n return s\n \ndef calc_chksums(buf):\n ''\n\n\n\n\n\n\n \n unsigned_chksum=256+sum(struct.unpack_from(\"148B8x356B\",buf))\n signed_chksum=256+sum(struct.unpack_from(\"148b8x356b\",buf))\n return unsigned_chksum,signed_chksum\n \ndef copyfileobj(src,dst,length=None,exception=OSError,bufsize=None):\n ''\n\n \n bufsize=bufsize or 16 *1024\n if length ==0:\n return\n if length is None:\n shutil.copyfileobj(src,dst,bufsize)\n return\n \n blocks,remainder=divmod(length,bufsize)\n for b in range(blocks):\n buf=src.read(bufsize)\n if len(buf)self.bufsize:\n self.fileobj.write(self.buf[:self.bufsize])\n self.buf=self.buf[self.bufsize:]\n \n def close(self):\n ''\n\n \n if self.closed:\n return\n \n self.closed=True\n try:\n if self.mode ==\"w\"and self.comptype !=\"tar\":\n self.buf +=self.cmp.flush()\n \n if self.mode ==\"w\"and self.buf:\n self.fileobj.write(self.buf)\n self.buf=b\"\"\n if self.comptype ==\"gz\":\n self.fileobj.write(struct.pack(\"=0:\n blocks,remainder=divmod(pos -self.pos,self.bufsize)\n for i in range(blocks):\n self.read(self.bufsize)\n self.read(remainder)\n else:\n raise StreamError(\"seeking backwards is not allowed\")\n return self.pos\n \n def read(self,size):\n ''\n assert size is not None\n buf=self._read(size)\n self.pos +=len(buf)\n return buf\n \n def _read(self,size):\n ''\n \n if self.comptype ==\"tar\":\n return self.__read(size)\n \n c=len(self.dbuf)\n t=[self.dbuf]\n while c lastpos:\n self.map.append((False,lastpos,offset,None))\n self.map.append((True,offset,offset+size,realpos))\n realpos +=size\n lastpos=offset+size\n if lastpos 0:\n while True:\n data,start,stop,offset=self.map[self.map_index]\n if start <=self.position \"%(self.__class__.__name__,self.name,id(self))\n \n def replace(self,*,\n name=_KEEP,mtime=_KEEP,mode=_KEEP,linkname=_KEEP,\n uid=_KEEP,gid=_KEEP,uname=_KEEP,gname=_KEEP,\n deep=True,_KEEP=_KEEP):\n ''\n \n if deep:\n result=copy.deepcopy(self)\n else:\n result=copy.copy(self)\n if name is not _KEEP:\n result.name=name\n if mtime is not _KEEP:\n result.mtime=mtime\n if mode is not _KEEP:\n result.mode=mode\n if linkname is not _KEEP:\n result.linkname=linkname\n if uid is not _KEEP:\n result.uid=uid\n if gid is not _KEEP:\n result.gid=gid\n if uname is not _KEEP:\n result.uname=uname\n if gname is not _KEEP:\n result.gname=gname\n return result\n \n def get_info(self):\n ''\n \n if self.mode is None:\n mode=None\n else:\n mode=self.mode&0o7777\n info={\n \"name\":self.name,\n \"mode\":mode,\n \"uid\":self.uid,\n \"gid\":self.gid,\n \"size\":self.size,\n \"mtime\":self.mtime,\n \"chksum\":self.chksum,\n \"type\":self.type,\n \"linkname\":self.linkname,\n \"uname\":self.uname,\n \"gname\":self.gname,\n \"devmajor\":self.devmajor,\n \"devminor\":self.devminor\n }\n \n if info[\"type\"]==DIRTYPE and not info[\"name\"].endswith(\"/\"):\n info[\"name\"]+=\"/\"\n \n return info\n \n def tobuf(self,format=DEFAULT_FORMAT,encoding=ENCODING,errors=\"surrogateescape\"):\n ''\n \n info=self.get_info()\n for name,value in info.items():\n if value is None:\n raise ValueError(\"%s may not be None\"%name)\n \n if format ==USTAR_FORMAT:\n return self.create_ustar_header(info,encoding,errors)\n elif format ==GNU_FORMAT:\n return self.create_gnu_header(info,encoding,errors)\n elif format ==PAX_FORMAT:\n return self.create_pax_header(info,encoding)\n else:\n raise ValueError(\"invalid format\")\n \n def create_ustar_header(self,info,encoding,errors):\n ''\n \n info[\"magic\"]=POSIX_MAGIC\n \n if len(info[\"linkname\"].encode(encoding,errors))>LENGTH_LINK:\n raise ValueError(\"linkname is too long\")\n \n if len(info[\"name\"].encode(encoding,errors))>LENGTH_NAME:\n info[\"prefix\"],info[\"name\"]=self._posix_split_name(info[\"name\"],encoding,errors)\n \n return self._create_header(info,USTAR_FORMAT,encoding,errors)\n \n def create_gnu_header(self,info,encoding,errors):\n ''\n \n info[\"magic\"]=GNU_MAGIC\n \n buf=b\"\"\n if len(info[\"linkname\"].encode(encoding,errors))>LENGTH_LINK:\n buf +=self._create_gnu_long_header(info[\"linkname\"],GNUTYPE_LONGLINK,encoding,errors)\n \n if len(info[\"name\"].encode(encoding,errors))>LENGTH_NAME:\n buf +=self._create_gnu_long_header(info[\"name\"],GNUTYPE_LONGNAME,encoding,errors)\n \n return buf+self._create_header(info,GNU_FORMAT,encoding,errors)\n \n def create_pax_header(self,info,encoding):\n ''\n\n\n \n info[\"magic\"]=POSIX_MAGIC\n pax_headers=self.pax_headers.copy()\n \n \n \n for name,hname,length in(\n (\"name\",\"path\",LENGTH_NAME),(\"linkname\",\"linkpath\",LENGTH_LINK),\n (\"uname\",\"uname\",32),(\"gname\",\"gname\",32)):\n \n if hname in pax_headers:\n \n continue\n \n \n try:\n info[name].encode(\"ascii\",\"strict\")\n except UnicodeEncodeError:\n pax_headers[hname]=info[name]\n continue\n \n if len(info[name])>length:\n pax_headers[hname]=info[name]\n \n \n \n for name,digits in((\"uid\",8),(\"gid\",8),(\"size\",12),(\"mtime\",12)):\n needs_pax=False\n \n val=info[name]\n val_is_float=isinstance(val,float)\n val_int=round(val)if val_is_float else val\n if not 0 <=val_int <8 **(digits -1):\n \n info[name]=0\n needs_pax=True\n elif val_is_float:\n \n \n info[name]=val_int\n needs_pax=True\n \n \n if needs_pax and name not in pax_headers:\n pax_headers[name]=str(val)\n \n \n if pax_headers:\n buf=self._create_pax_generic_header(pax_headers,XHDTYPE,encoding)\n else:\n buf=b\"\"\n \n return buf+self._create_header(info,USTAR_FORMAT,\"ascii\",\"replace\")\n \n @classmethod\n def create_pax_global_header(cls,pax_headers):\n ''\n \n return cls._create_pax_generic_header(pax_headers,XGLTYPE,\"utf-8\")\n \n def _posix_split_name(self,name,encoding,errors):\n ''\n\n \n components=name.split(\"/\")\n for i in range(1,len(components)):\n prefix=\"/\".join(components[:i])\n name=\"/\".join(components[i:])\n if len(prefix.encode(encoding,errors))<=LENGTH_PREFIX and\\\n len(name.encode(encoding,errors))<=LENGTH_NAME:\n break\n else:\n raise ValueError(\"name is too long\")\n \n return prefix,name\n \n @staticmethod\n def _create_header(info,format,encoding,errors):\n ''\n\n \n has_device_fields=info.get(\"type\")in(CHRTYPE,BLKTYPE)\n if has_device_fields:\n devmajor=itn(info.get(\"devmajor\",0),8,format)\n devminor=itn(info.get(\"devminor\",0),8,format)\n else:\n devmajor=stn(\"\",8,encoding,errors)\n devminor=stn(\"\",8,encoding,errors)\n \n \n \n filetype=info.get(\"type\",REGTYPE)\n if filetype is None:\n raise ValueError(\"TarInfo.type must not be None\")\n \n parts=[\n stn(info.get(\"name\",\"\"),100,encoding,errors),\n itn(info.get(\"mode\",0)&0o7777,8,format),\n itn(info.get(\"uid\",0),8,format),\n itn(info.get(\"gid\",0),8,format),\n itn(info.get(\"size\",0),12,format),\n itn(info.get(\"mtime\",0),12,format),\n b\" \",\n filetype,\n stn(info.get(\"linkname\",\"\"),100,encoding,errors),\n info.get(\"magic\",POSIX_MAGIC),\n stn(info.get(\"uname\",\"\"),32,encoding,errors),\n stn(info.get(\"gname\",\"\"),32,encoding,errors),\n devmajor,\n devminor,\n stn(info.get(\"prefix\",\"\"),155,encoding,errors)\n ]\n \n buf=struct.pack(\"%ds\"%BLOCKSIZE,b\"\".join(parts))\n chksum=calc_chksums(buf[-BLOCKSIZE:])[0]\n buf=buf[:-364]+bytes(\"%06o\\0\"%chksum,\"ascii\")+buf[-357:]\n return buf\n \n @staticmethod\n def _create_payload(payload):\n ''\n\n \n blocks,remainder=divmod(len(payload),BLOCKSIZE)\n if remainder >0:\n payload +=(BLOCKSIZE -remainder)*NUL\n return payload\n \n @classmethod\n def _create_gnu_long_header(cls,name,type,encoding,errors):\n ''\n\n \n name=name.encode(encoding,errors)+NUL\n \n info={}\n info[\"name\"]=\"././@LongLink\"\n info[\"type\"]=type\n info[\"size\"]=len(name)\n info[\"magic\"]=GNU_MAGIC\n \n \n return cls._create_header(info,USTAR_FORMAT,encoding,errors)+\\\n cls._create_payload(name)\n \n @classmethod\n def _create_pax_generic_header(cls,pax_headers,type,encoding):\n ''\n\n\n \n \n \n binary=False\n for keyword,value in pax_headers.items():\n try:\n value.encode(\"utf-8\",\"strict\")\n except UnicodeEncodeError:\n binary=True\n break\n \n records=b\"\"\n if binary:\n \n records +=b\"21 hdrcharset=BINARY\\n\"\n \n for keyword,value in pax_headers.items():\n keyword=keyword.encode(\"utf-8\")\n if binary:\n \n \n value=value.encode(encoding,\"surrogateescape\")\n else:\n value=value.encode(\"utf-8\")\n \n l=len(keyword)+len(value)+3\n n=p=0\n while True:\n n=l+len(str(p))\n if n ==p:\n break\n p=n\n records +=bytes(str(p),\"ascii\")+b\" \"+keyword+b\"=\"+value+b\"\\n\"\n \n \n \n info={}\n info[\"name\"]=\"././@PaxHeader\"\n info[\"type\"]=type\n info[\"size\"]=len(records)\n info[\"magic\"]=POSIX_MAGIC\n \n \n return cls._create_header(info,USTAR_FORMAT,\"ascii\",\"replace\")+\\\n cls._create_payload(records)\n \n @classmethod\n def frombuf(cls,buf,encoding,errors):\n ''\n \n if len(buf)==0:\n raise EmptyHeaderError(\"empty header\")\n if len(buf)!=BLOCKSIZE:\n raise TruncatedHeaderError(\"truncated header\")\n if buf.count(NUL)==BLOCKSIZE:\n raise EOFHeaderError(\"end of file header\")\n \n chksum=nti(buf[148:156])\n if chksum not in calc_chksums(buf):\n raise InvalidHeaderError(\"bad checksum\")\n \n obj=cls()\n obj.name=nts(buf[0:100],encoding,errors)\n obj.mode=nti(buf[100:108])\n obj.uid=nti(buf[108:116])\n obj.gid=nti(buf[116:124])\n obj.size=nti(buf[124:136])\n obj.mtime=nti(buf[136:148])\n obj.chksum=chksum\n obj.type=buf[156:157]\n obj.linkname=nts(buf[157:257],encoding,errors)\n obj.uname=nts(buf[265:297],encoding,errors)\n obj.gname=nts(buf[297:329],encoding,errors)\n obj.devmajor=nti(buf[329:337])\n obj.devminor=nti(buf[337:345])\n prefix=nts(buf[345:500],encoding,errors)\n \n \n \n if obj.type ==AREGTYPE and obj.name.endswith(\"/\"):\n obj.type=DIRTYPE\n \n \n \n \n if obj.type ==GNUTYPE_SPARSE:\n pos=386\n structs=[]\n for i in range(4):\n try:\n offset=nti(buf[pos:pos+12])\n numbytes=nti(buf[pos+12:pos+24])\n except ValueError:\n break\n structs.append((offset,numbytes))\n pos +=24\n isextended=bool(buf[482])\n origsize=nti(buf[483:495])\n obj._sparse_structs=(structs,isextended,origsize)\n \n \n if obj.isdir():\n obj.name=obj.name.rstrip(\"/\")\n \n \n if prefix and obj.type not in GNU_TYPES:\n obj.name=prefix+\"/\"+obj.name\n return obj\n \n @classmethod\n def fromtarfile(cls,tarfile):\n ''\n\n \n buf=tarfile.fileobj.read(BLOCKSIZE)\n obj=cls.frombuf(buf,tarfile.encoding,tarfile.errors)\n obj.offset=tarfile.fileobj.tell()-BLOCKSIZE\n return obj._proc_member(tarfile)\n \n \n \n \n \n \n \n \n \n \n \n \n def _proc_member(self,tarfile):\n ''\n\n \n if self.type in(GNUTYPE_LONGNAME,GNUTYPE_LONGLINK):\n return self._proc_gnulong(tarfile)\n elif self.type ==GNUTYPE_SPARSE:\n return self._proc_sparse(tarfile)\n elif self.type in(XHDTYPE,XGLTYPE,SOLARIS_XHDTYPE):\n return self._proc_pax(tarfile)\n else:\n return self._proc_builtin(tarfile)\n \n def _proc_builtin(self,tarfile):\n ''\n\n \n self.offset_data=tarfile.fileobj.tell()\n offset=self.offset_data\n if self.isreg()or self.type not in SUPPORTED_TYPES:\n \n offset +=self._block(self.size)\n tarfile.offset=offset\n \n \n \n self._apply_pax_info(tarfile.pax_headers,tarfile.encoding,tarfile.errors)\n \n \n \n if self.isdir():\n self.name=self.name.rstrip(\"/\")\n \n return self\n \n def _proc_gnulong(self,tarfile):\n ''\n\n \n buf=tarfile.fileobj.read(self._block(self.size))\n \n \n try:\n next=self.fromtarfile(tarfile)\n except HeaderError as e:\n raise SubsequentHeaderError(str(e))from None\n \n \n \n next.offset=self.offset\n if self.type ==GNUTYPE_LONGNAME:\n next.name=nts(buf,tarfile.encoding,tarfile.errors)\n elif self.type ==GNUTYPE_LONGLINK:\n next.linkname=nts(buf,tarfile.encoding,tarfile.errors)\n \n \n \n if next.isdir():\n next.name=next.name.removesuffix(\"/\")\n \n return next\n \n def _proc_sparse(self,tarfile):\n ''\n \n \n structs,isextended,origsize=self._sparse_structs\n del self._sparse_structs\n \n \n while isextended:\n buf=tarfile.fileobj.read(BLOCKSIZE)\n pos=0\n for i in range(21):\n try:\n offset=nti(buf[pos:pos+12])\n numbytes=nti(buf[pos+12:pos+24])\n except ValueError:\n break\n if offset and numbytes:\n structs.append((offset,numbytes))\n pos +=24\n isextended=bool(buf[504])\n self.sparse=structs\n \n self.offset_data=tarfile.fileobj.tell()\n tarfile.offset=self.offset_data+self._block(self.size)\n self.size=origsize\n return self\n \n def _proc_pax(self,tarfile):\n ''\n\n \n \n buf=tarfile.fileobj.read(self._block(self.size))\n \n \n \n \n if self.type ==XGLTYPE:\n pax_headers=tarfile.pax_headers\n else:\n pax_headers=tarfile.pax_headers.copy()\n \n \n \n \n \n \n match=re.search(br\"\\d+ hdrcharset=([^\\n]+)\\n\",buf)\n if match is not None:\n pax_headers[\"hdrcharset\"]=match.group(1).decode(\"utf-8\")\n \n \n \n \n hdrcharset=pax_headers.get(\"hdrcharset\")\n if hdrcharset ==\"BINARY\":\n encoding=tarfile.encoding\n else:\n encoding=\"utf-8\"\n \n \n \n \n \n regex=re.compile(br\"(\\d+) ([^=]+)=\")\n pos=0\n while match :=regex.match(buf,pos):\n length,keyword=match.groups()\n length=int(length)\n if length ==0:\n raise InvalidHeaderError(\"invalid header\")\n value=buf[match.end(2)+1:match.start(1)+length -1]\n \n \n \n \n \n \n \n \n keyword=self._decode_pax_field(keyword,\"utf-8\",\"utf-8\",\n tarfile.errors)\n if keyword in PAX_NAME_FIELDS:\n value=self._decode_pax_field(value,encoding,tarfile.encoding,\n tarfile.errors)\n else:\n value=self._decode_pax_field(value,\"utf-8\",\"utf-8\",\n tarfile.errors)\n \n pax_headers[keyword]=value\n pos +=length\n \n \n try:\n next=self.fromtarfile(tarfile)\n except HeaderError as e:\n raise SubsequentHeaderError(str(e))from None\n \n \n if \"GNU.sparse.map\"in pax_headers:\n \n self._proc_gnusparse_01(next,pax_headers)\n \n elif \"GNU.sparse.size\"in pax_headers:\n \n self._proc_gnusparse_00(next,pax_headers,buf)\n \n elif pax_headers.get(\"GNU.sparse.major\")==\"1\"and pax_headers.get(\"GNU.sparse.minor\")==\"0\":\n \n self._proc_gnusparse_10(next,pax_headers,tarfile)\n \n if self.type in(XHDTYPE,SOLARIS_XHDTYPE):\n \n next._apply_pax_info(pax_headers,tarfile.encoding,tarfile.errors)\n next.offset=self.offset\n \n if \"size\"in pax_headers:\n \n \n \n offset=next.offset_data\n if next.isreg()or next.type not in SUPPORTED_TYPES:\n offset +=next._block(next.size)\n tarfile.offset=offset\n \n return next\n \n def _proc_gnusparse_00(self,next,pax_headers,buf):\n ''\n \n offsets=[]\n for match in re.finditer(br\"\\d+ GNU.sparse.offset=(\\d+)\\n\",buf):\n offsets.append(int(match.group(1)))\n numbytes=[]\n for match in re.finditer(br\"\\d+ GNU.sparse.numbytes=(\\d+)\\n\",buf):\n numbytes.append(int(match.group(1)))\n next.sparse=list(zip(offsets,numbytes))\n \n def _proc_gnusparse_01(self,next,pax_headers):\n ''\n \n sparse=[int(x)for x in pax_headers[\"GNU.sparse.map\"].split(\",\")]\n next.sparse=list(zip(sparse[::2],sparse[1::2]))\n \n def _proc_gnusparse_10(self,next,pax_headers,tarfile):\n ''\n \n fields=None\n sparse=[]\n buf=tarfile.fileobj.read(BLOCKSIZE)\n fields,buf=buf.split(b\"\\n\",1)\n fields=int(fields)\n while len(sparse)0:\n self.fileobj.write(NUL *(RECORDSIZE -remainder))\n finally:\n if not self._extfileobj:\n self.fileobj.close()\n \n def getmember(self,name):\n ''\n\n\n\n \n tarinfo=self._getmember(name.rstrip('/'))\n if tarinfo is None:\n raise KeyError(\"filename %r not found\"%name)\n return tarinfo\n \n def getmembers(self):\n ''\n\n \n self._check()\n if not self._loaded:\n self._load()\n \n return self.members\n \n def getnames(self):\n ''\n\n \n return[tarinfo.name for tarinfo in self.getmembers()]\n \n def gettarinfo(self,name=None,arcname=None,fileobj=None):\n ''\n\n\n\n\n\n\n \n self._check(\"awx\")\n \n \n \n if fileobj is not None:\n name=fileobj.name\n \n \n \n \n if arcname is None:\n arcname=name\n drv,arcname=os.path.splitdrive(arcname)\n arcname=arcname.replace(os.sep,\"/\")\n arcname=arcname.lstrip(\"/\")\n \n \n \n tarinfo=self.tarinfo()\n tarinfo.tarfile=self\n \n \n if fileobj is None:\n if not self.dereference:\n statres=os.lstat(name)\n else:\n statres=os.stat(name)\n else:\n statres=os.fstat(fileobj.fileno())\n linkname=\"\"\n \n stmd=statres.st_mode\n if stat.S_ISREG(stmd):\n inode=(statres.st_ino,statres.st_dev)\n if not self.dereference and statres.st_nlink >1 and\\\n inode in self.inodes and arcname !=self.inodes[inode]:\n \n \n type=LNKTYPE\n linkname=self.inodes[inode]\n else:\n \n \n type=REGTYPE\n if inode[0]:\n self.inodes[inode]=arcname\n elif stat.S_ISDIR(stmd):\n type=DIRTYPE\n elif stat.S_ISFIFO(stmd):\n type=FIFOTYPE\n elif stat.S_ISLNK(stmd):\n type=SYMTYPE\n linkname=os.readlink(name)\n elif stat.S_ISCHR(stmd):\n type=CHRTYPE\n elif stat.S_ISBLK(stmd):\n type=BLKTYPE\n else:\n return None\n \n \n \n tarinfo.name=arcname\n tarinfo.mode=stmd\n tarinfo.uid=statres.st_uid\n tarinfo.gid=statres.st_gid\n if type ==REGTYPE:\n tarinfo.size=statres.st_size\n else:\n tarinfo.size=0\n tarinfo.mtime=statres.st_mtime\n tarinfo.type=type\n tarinfo.linkname=linkname\n if pwd:\n try:\n tarinfo.uname=pwd.getpwuid(tarinfo.uid)[0]\n except KeyError:\n pass\n if grp:\n try:\n tarinfo.gname=grp.getgrgid(tarinfo.gid)[0]\n except KeyError:\n pass\n \n if type in(CHRTYPE,BLKTYPE):\n if hasattr(os,\"major\")and hasattr(os,\"minor\"):\n tarinfo.devmajor=os.major(statres.st_rdev)\n tarinfo.devminor=os.minor(statres.st_rdev)\n return tarinfo\n \n def list(self,verbose=True,*,members=None):\n ''\n\n\n\n \n self._check()\n \n if members is None:\n members=self\n for tarinfo in members:\n if verbose:\n if tarinfo.mode is None:\n _safe_print(\"??????????\")\n else:\n _safe_print(stat.filemode(tarinfo.mode))\n _safe_print(\"%s/%s\"%(tarinfo.uname or tarinfo.uid,\n tarinfo.gname or tarinfo.gid))\n if tarinfo.ischr()or tarinfo.isblk():\n _safe_print(\"%10s\"%\n (\"%d,%d\"%(tarinfo.devmajor,tarinfo.devminor)))\n else:\n _safe_print(\"%10d\"%tarinfo.size)\n if tarinfo.mtime is None:\n _safe_print(\"????-??-?? ??:??:??\")\n else:\n _safe_print(\"%d-%02d-%02d %02d:%02d:%02d\"\\\n %time.localtime(tarinfo.mtime)[:6])\n \n _safe_print(tarinfo.name+(\"/\"if tarinfo.isdir()else \"\"))\n \n if verbose:\n if tarinfo.issym():\n _safe_print(\"-> \"+tarinfo.linkname)\n if tarinfo.islnk():\n _safe_print(\"link to \"+tarinfo.linkname)\n print()\n \n def add(self,name,arcname=None,recursive=True,*,filter=None):\n ''\n\n\n\n\n\n\n\n \n self._check(\"awx\")\n \n if arcname is None:\n arcname=name\n \n \n if self.name is not None and os.path.abspath(name)==self.name:\n self._dbg(2,\"tarfile: Skipped %r\"%name)\n return\n \n self._dbg(1,name)\n \n \n tarinfo=self.gettarinfo(name,arcname)\n \n if tarinfo is None:\n self._dbg(1,\"tarfile: Unsupported type %r\"%name)\n return\n \n \n if filter is not None:\n tarinfo=filter(tarinfo)\n if tarinfo is None:\n self._dbg(2,\"tarfile: Excluded %r\"%name)\n return\n \n \n if tarinfo.isreg():\n with bltn_open(name,\"rb\")as f:\n self.addfile(tarinfo,f)\n \n elif tarinfo.isdir():\n self.addfile(tarinfo)\n if recursive:\n for f in sorted(os.listdir(name)):\n self.add(os.path.join(name,f),os.path.join(arcname,f),\n recursive,filter=filter)\n \n else:\n self.addfile(tarinfo)\n \n def addfile(self,tarinfo,fileobj=None):\n ''\n\n\n\n \n self._check(\"awx\")\n \n tarinfo=copy.copy(tarinfo)\n \n buf=tarinfo.tobuf(self.format,self.encoding,self.errors)\n self.fileobj.write(buf)\n self.offset +=len(buf)\n bufsize=self.copybufsize\n \n if fileobj is not None:\n copyfileobj(fileobj,self.fileobj,tarinfo.size,bufsize=bufsize)\n blocks,remainder=divmod(tarinfo.size,BLOCKSIZE)\n if remainder >0:\n self.fileobj.write(NUL *(BLOCKSIZE -remainder))\n blocks +=1\n self.offset +=blocks *BLOCKSIZE\n \n self.members.append(tarinfo)\n \n def _get_filter_function(self,filter):\n if filter is None:\n filter=self.extraction_filter\n if filter is None:\n warnings.warn(\n 'Python 3.14 will, by default, filter extracted tar '\n +'archives and reject files or modify their metadata. '\n +'Use the filter argument to control this behavior.',\n DeprecationWarning)\n return fully_trusted_filter\n if isinstance(filter,str):\n raise TypeError(\n 'String names are not supported for '\n +'TarFile.extraction_filter. Use a function such as '\n +'tarfile.data_filter directly.')\n return filter\n if callable(filter):\n return filter\n try:\n return _NAMED_FILTERS[filter]\n except KeyError:\n raise ValueError(f\"filter {filter !r} not found\")from None\n \n def extractall(self,path=\".\",members=None,*,numeric_owner=False,\n filter=None):\n ''\n\n\n\n\n\n\n\n\n\n\n \n directories=[]\n \n filter_function=self._get_filter_function(filter)\n if members is None:\n members=self\n \n for member in members:\n tarinfo=self._get_extract_tarinfo(member,filter_function,path)\n if tarinfo is None:\n continue\n if tarinfo.isdir():\n \n \n \n directories.append(tarinfo)\n self._extract_one(tarinfo,path,set_attrs=not tarinfo.isdir(),\n numeric_owner=numeric_owner)\n \n \n directories.sort(key=lambda a:a.name,reverse=True)\n \n \n for tarinfo in directories:\n dirpath=os.path.join(path,tarinfo.name)\n try:\n self.chown(tarinfo,dirpath,numeric_owner=numeric_owner)\n self.utime(tarinfo,dirpath)\n self.chmod(tarinfo,dirpath)\n except ExtractError as e:\n self._handle_nonfatal_error(e)\n \n def extract(self,member,path=\"\",set_attrs=True,*,numeric_owner=False,\n filter=None):\n ''\n\n\n\n\n\n\n\n\n\n\n \n filter_function=self._get_filter_function(filter)\n tarinfo=self._get_extract_tarinfo(member,filter_function,path)\n if tarinfo is not None:\n self._extract_one(tarinfo,path,set_attrs,numeric_owner)\n \n def _get_extract_tarinfo(self,member,filter_function,path):\n ''\n if isinstance(member,str):\n tarinfo=self.getmember(member)\n else:\n tarinfo=member\n \n unfiltered=tarinfo\n try:\n tarinfo=filter_function(tarinfo,path)\n except(OSError,FilterError)as e:\n self._handle_fatal_error(e)\n except ExtractError as e:\n self._handle_nonfatal_error(e)\n if tarinfo is None:\n self._dbg(2,\"tarfile: Excluded %r\"%unfiltered.name)\n return None\n \n if tarinfo.islnk():\n tarinfo=copy.copy(tarinfo)\n tarinfo._link_target=os.path.join(path,tarinfo.linkname)\n return tarinfo\n \n def _extract_one(self,tarinfo,path,set_attrs,numeric_owner):\n ''\n self._check(\"r\")\n \n try:\n self._extract_member(tarinfo,os.path.join(path,tarinfo.name),\n set_attrs=set_attrs,\n numeric_owner=numeric_owner)\n except OSError as e:\n self._handle_fatal_error(e)\n except ExtractError as e:\n self._handle_nonfatal_error(e)\n \n def _handle_nonfatal_error(self,e):\n ''\n if self.errorlevel >1:\n raise\n else:\n self._dbg(1,\"tarfile: %s\"%e)\n \n def _handle_fatal_error(self,e):\n ''\n if self.errorlevel >0:\n raise\n elif isinstance(e,OSError):\n if e.filename is None:\n self._dbg(1,\"tarfile: %s\"%e.strerror)\n else:\n self._dbg(1,\"tarfile: %s %r\"%(e.strerror,e.filename))\n else:\n self._dbg(1,\"tarfile: %s %s\"%(type(e).__name__,e))\n \n def extractfile(self,member):\n ''\n\n\n\n\n \n self._check(\"r\")\n \n if isinstance(member,str):\n tarinfo=self.getmember(member)\n else:\n tarinfo=member\n \n if tarinfo.isreg()or tarinfo.type not in SUPPORTED_TYPES:\n \n return self.fileobject(self,tarinfo)\n \n elif tarinfo.islnk()or tarinfo.issym():\n if isinstance(self.fileobj,_Stream):\n \n \n \n raise StreamError(\"cannot extract (sym)link as file object\")\n else:\n \n return self.extractfile(self._find_link_target(tarinfo))\n else:\n \n \n return None\n \n def _extract_member(self,tarinfo,targetpath,set_attrs=True,\n numeric_owner=False):\n ''\n\n \n \n \n \n targetpath=targetpath.rstrip(\"/\")\n targetpath=targetpath.replace(\"/\",os.sep)\n \n \n upperdirs=os.path.dirname(targetpath)\n if upperdirs and not os.path.exists(upperdirs):\n \n \n os.makedirs(upperdirs)\n \n if tarinfo.islnk()or tarinfo.issym():\n self._dbg(1,\"%s -> %s\"%(tarinfo.name,tarinfo.linkname))\n else:\n self._dbg(1,tarinfo.name)\n \n if tarinfo.isreg():\n self.makefile(tarinfo,targetpath)\n elif tarinfo.isdir():\n self.makedir(tarinfo,targetpath)\n elif tarinfo.isfifo():\n self.makefifo(tarinfo,targetpath)\n elif tarinfo.ischr()or tarinfo.isblk():\n self.makedev(tarinfo,targetpath)\n elif tarinfo.islnk()or tarinfo.issym():\n self.makelink(tarinfo,targetpath)\n elif tarinfo.type not in SUPPORTED_TYPES:\n self.makeunknown(tarinfo,targetpath)\n else:\n self.makefile(tarinfo,targetpath)\n \n if set_attrs:\n self.chown(tarinfo,targetpath,numeric_owner)\n if not tarinfo.issym():\n self.chmod(tarinfo,targetpath)\n self.utime(tarinfo,targetpath)\n \n \n \n \n \n \n def makedir(self,tarinfo,targetpath):\n ''\n \n try:\n if tarinfo.mode is None:\n \n os.mkdir(targetpath)\n else:\n \n \n os.mkdir(targetpath,0o700)\n except FileExistsError:\n pass\n \n def makefile(self,tarinfo,targetpath):\n ''\n \n source=self.fileobj\n source.seek(tarinfo.offset_data)\n bufsize=self.copybufsize\n with bltn_open(targetpath,\"wb\")as target:\n if tarinfo.sparse is not None:\n for offset,size in tarinfo.sparse:\n target.seek(offset)\n copyfileobj(source,target,size,ReadError,bufsize)\n target.seek(tarinfo.size)\n target.truncate()\n else:\n copyfileobj(source,target,tarinfo.size,ReadError,bufsize)\n \n def makeunknown(self,tarinfo,targetpath):\n ''\n\n \n self.makefile(tarinfo,targetpath)\n self._dbg(1,\"tarfile: Unknown file type %r, \"\\\n \"extracted as regular file.\"%tarinfo.type)\n \n def makefifo(self,tarinfo,targetpath):\n ''\n \n if hasattr(os,\"mkfifo\"):\n os.mkfifo(targetpath)\n else:\n raise ExtractError(\"fifo not supported by system\")\n \n def makedev(self,tarinfo,targetpath):\n ''\n \n if not hasattr(os,\"mknod\")or not hasattr(os,\"makedev\"):\n raise ExtractError(\"special devices not supported by system\")\n \n mode=tarinfo.mode\n if mode is None:\n \n mode=0o600\n if tarinfo.isblk():\n mode |=stat.S_IFBLK\n else:\n mode |=stat.S_IFCHR\n \n os.mknod(targetpath,mode,\n os.makedev(tarinfo.devmajor,tarinfo.devminor))\n \n def makelink(self,tarinfo,targetpath):\n ''\n\n\n \n try:\n \n if tarinfo.issym():\n if os.path.lexists(targetpath):\n \n os.unlink(targetpath)\n os.symlink(tarinfo.linkname,targetpath)\n else:\n if os.path.exists(tarinfo._link_target):\n os.link(tarinfo._link_target,targetpath)\n else:\n self._extract_member(self._find_link_target(tarinfo),\n targetpath)\n except symlink_exception:\n try:\n self._extract_member(self._find_link_target(tarinfo),\n targetpath)\n except KeyError:\n raise ExtractError(\"unable to resolve link inside archive\")from None\n \n def chown(self,tarinfo,targetpath,numeric_owner):\n ''\n\n\n\n \n if hasattr(os,\"geteuid\")and os.geteuid()==0:\n \n g=tarinfo.gid\n u=tarinfo.uid\n if not numeric_owner:\n try:\n if grp and tarinfo.gname:\n g=grp.getgrnam(tarinfo.gname)[2]\n except KeyError:\n pass\n try:\n if pwd and tarinfo.uname:\n u=pwd.getpwnam(tarinfo.uname)[2]\n except KeyError:\n pass\n if g is None:\n g=-1\n if u is None:\n u=-1\n try:\n if tarinfo.issym()and hasattr(os,\"lchown\"):\n os.lchown(targetpath,u,g)\n else:\n os.chown(targetpath,u,g)\n except OSError as e:\n raise ExtractError(\"could not change owner\")from e\n \n def chmod(self,tarinfo,targetpath):\n ''\n \n if tarinfo.mode is None:\n return\n try:\n os.chmod(targetpath,tarinfo.mode)\n except OSError as e:\n raise ExtractError(\"could not change mode\")from e\n \n def utime(self,tarinfo,targetpath):\n ''\n \n mtime=tarinfo.mtime\n if mtime is None:\n return\n if not hasattr(os,'utime'):\n return\n try:\n os.utime(targetpath,(mtime,mtime))\n except OSError as e:\n raise ExtractError(\"could not change modification time\")from e\n \n \n def next(self):\n ''\n\n\n \n self._check(\"ra\")\n if self.firstmember is not None:\n m=self.firstmember\n self.firstmember=None\n return m\n \n \n if self.offset !=self.fileobj.tell():\n if self.offset ==0:\n return None\n self.fileobj.seek(self.offset -1)\n if not self.fileobj.read(1):\n raise ReadError(\"unexpected end of data\")\n \n \n tarinfo=None\n while True:\n try:\n tarinfo=self.tarinfo.fromtarfile(self)\n except EOFHeaderError as e:\n if self.ignore_zeros:\n self._dbg(2,\"0x%X: %s\"%(self.offset,e))\n self.offset +=BLOCKSIZE\n continue\n except InvalidHeaderError as e:\n if self.ignore_zeros:\n self._dbg(2,\"0x%X: %s\"%(self.offset,e))\n self.offset +=BLOCKSIZE\n continue\n elif self.offset ==0:\n raise ReadError(str(e))from None\n except EmptyHeaderError:\n if self.offset ==0:\n raise ReadError(\"empty file\")from None\n except TruncatedHeaderError as e:\n if self.offset ==0:\n raise ReadError(str(e))from None\n except SubsequentHeaderError as e:\n raise ReadError(str(e))from None\n except Exception as e:\n try:\n import zlib\n if isinstance(e,zlib.error):\n raise ReadError(f'zlib error: {e}')from None\n else:\n raise e\n except ImportError:\n raise e\n break\n \n if tarinfo is not None:\n self.members.append(tarinfo)\n else:\n self._loaded=True\n \n return tarinfo\n \n \n \n \n def _getmember(self,name,tarinfo=None,normalize=False):\n ''\n\n \n \n members=self.getmembers()\n \n \n skipping=False\n if tarinfo is not None:\n try:\n index=members.index(tarinfo)\n except ValueError:\n \n \n skipping=True\n else:\n \n members=members[:index]\n \n if normalize:\n name=os.path.normpath(name)\n \n for member in reversed(members):\n if skipping:\n if tarinfo.offset ==member.offset:\n skipping=False\n continue\n if normalize:\n member_name=os.path.normpath(member.name)\n else:\n member_name=member.name\n \n if name ==member_name:\n return member\n \n if skipping:\n \n raise ValueError(tarinfo)\n \n def _load(self):\n ''\n\n \n while self.next()is not None:\n pass\n self._loaded=True\n \n def _check(self,mode=None):\n ''\n\n \n if self.closed:\n raise OSError(\"%s is closed\"%self.__class__.__name__)\n if mode is not None and self.mode not in mode:\n raise OSError(\"bad operation for mode %r\"%self.mode)\n \n def _find_link_target(self,tarinfo):\n ''\n\n \n if tarinfo.issym():\n \n linkname=\"/\".join(filter(None,(os.path.dirname(tarinfo.name),tarinfo.linkname)))\n limit=None\n else:\n \n \n linkname=tarinfo.linkname\n limit=tarinfo\n \n member=self._getmember(linkname,tarinfo=limit,normalize=True)\n if member is None:\n raise KeyError(\"linkname %r not found\"%linkname)\n return member\n \n def __iter__(self):\n ''\n \n if self._loaded:\n yield from self.members\n return\n \n \n \n index=0\n \n \n \n if self.firstmember is not None:\n tarinfo=self.next()\n index +=1\n yield tarinfo\n \n while True:\n if index ',''),\n help='Extract tarfile into target dir')\n group.add_argument('-c','--create',nargs='+',\n metavar=('',''),\n help='Create tarfile from sources')\n group.add_argument('-t','--test',metavar='',\n help='Test if a tarfile is valid')\n \n args=parser.parse_args()\n \n if args.filter and args.extract is None:\n parser.exit(1,'--filter is only valid for extraction\\n')\n \n if args.test is not None:\n src=args.test\n if is_tarfile(src):\n with open(src,'r')as tar:\n tar.getmembers()\n print(tar.getmembers(),file=sys.stderr)\n if args.verbose:\n print('{!r} is a tar archive.'.format(src))\n else:\n parser.exit(1,'{!r} is not a tar archive.\\n'.format(src))\n \n elif args.list is not None:\n src=args.list\n if is_tarfile(src):\n with TarFile.open(src,'r:*')as tf:\n tf.list(verbose=args.verbose)\n else:\n parser.exit(1,'{!r} is not a tar archive.\\n'.format(src))\n \n elif args.extract is not None:\n if len(args.extract)==1:\n src=args.extract[0]\n curdir=os.curdir\n elif len(args.extract)==2:\n src,curdir=args.extract\n else:\n parser.exit(1,parser.format_help())\n \n if is_tarfile(src):\n with TarFile.open(src,'r:*')as tf:\n tf.extractall(path=curdir,filter=args.filter)\n if args.verbose:\n if curdir =='.':\n msg='{!r} file is extracted.'.format(src)\n else:\n msg=('{!r} file is extracted '\n 'into {!r} directory.').format(src,curdir)\n print(msg)\n else:\n parser.exit(1,'{!r} is not a tar archive.\\n'.format(src))\n \n elif args.create is not None:\n tar_name=args.create.pop(0)\n _,ext=os.path.splitext(tar_name)\n compressions={\n \n '.gz':'gz',\n '.tgz':'gz',\n \n '.xz':'xz',\n '.txz':'xz',\n \n '.bz2':'bz2',\n '.tbz':'bz2',\n '.tbz2':'bz2',\n '.tb2':'bz2',\n }\n tar_mode='w:'+compressions[ext]if ext in compressions else 'w'\n tar_files=args.create\n \n with TarFile.open(tar_name,tar_mode)as tf:\n for file_name in tar_files:\n tf.add(file_name)\n \n if args.verbose:\n print('{!r} file created.'.format(tar_name))\n \nif __name__ =='__main__':\n main()\n", ["argparse", "builtins", "bz2", "copy", "grp", "gzip", "io", "lzma", "os", "pwd", "re", "shutil", "stat", "struct", "sys", "time", "warnings", "zlib"]], "tb": [".py", "import sys\nfrom browser import console\n\nclass Trace:\n\n def __init__(self):\n self.lines=[]\n \n def write(self,*data):\n self.lines.append(\" \".join([str(x)for x in data]))\n \n def format(self):\n return '\\n'.join(self.lines)+'\\n'\n \ndef format_exc():\n trace=Trace()\n exc_class,exc,tb=sys.exc_info()\n exc_msg=str(exc)\n \n def handle_repeats(filename,lineno,count_repeats):\n if count_repeats >0:\n trace_lines=trace.lines[:]\n for _ in range(2):\n if not filename.startswith('<'):\n trace.write(trace_lines[-2])\n trace.write(trace_lines[-1])\n else:\n trace.write(trace_lines[-1])\n count_repeats -=1\n if count_repeats ==0:\n break\n if count_repeats:\n trace.write(f'[Previous line repeated {count_repeats} '+\n f'more time{\"s\"if count_repeats >1 else \"\"}]')\n \n def show_line():\n trace.write(f' File \"{filename}\", line {lineno}, in {name}')\n if not filename.startswith(\"<\"):\n src=open(filename,encoding='utf-8').read()\n lines=src.split('\\n')\n line=lines[tb.tb_lineno -1]\n trace.write(f\" {line.strip()}\")\n \n show=True\n started=False\n save_filename=None\n save_lineno=None\n save_scope=None\n same_line=False\n count_repeats=0\n \n while tb is not None:\n if show:\n trace.write(\"Traceback (most recent call last):\")\n show=False\n frame=tb.tb_frame\n code=frame.f_code\n lineno=frame.f_lineno\n name=code.co_name\n filename=code.co_filename\n if filename ==save_filename and lineno ==save_lineno\\\n and name ==save_name:\n count_repeats +=1\n tb=tb.tb_next\n continue\n handle_repeats(save_filename,save_lineno,count_repeats)\n save_filename=filename\n save_lineno=lineno\n save_name=name\n count_repeats=0\n show_line()\n tb=tb.tb_next\n \n handle_repeats(filename,lineno,count_repeats)\n \n if isinstance(exc,SyntaxError):\n trace.write(syntax_error(exc.args))\n else:\n message=exc_msg\n if isinstance(exc,AttributeError):\n suggestion=__BRYTHON__.offer_suggestions_for_attribute_error(exc)\n if suggestion is not None:\n message +=f\". Did you mean: '{suggestion}'?\"\n elif isinstance(exc,NameError):\n suggestion=__BRYTHON__.offer_suggestions_for_name_error(exc)\n if suggestion is not None:\n message +=f\". Did you mean: '{suggestion}'?\"\n elif exc.name in __BRYTHON__.stdlib_module_names:\n message +=f\". Did you forget to import '{exc.name}'?\"\n trace.write(f\"{exc_class.__name__}: {message}\")\n \n return trace.format()\n \ndef print_exc(file=None):\n if file is None:\n file=sys.stderr\n file.write(format_exc())\n \ndef syntax_error(args):\n trace=Trace()\n info,[filename,lineno,offset,line,*extra]=args\n trace.write(f' File \"{filename}\", line {lineno}')\n indent=len(line)-len(line.lstrip())\n trace.write(\" \"+line.strip())\n nb_marks=1\n if extra:\n end_lineno,end_offset=extra\n if end_lineno >lineno:\n nb_marks=len(line)-offset\n else:\n nb_marks=end_offset -offset\n nb_marks=max(nb_marks,1)\n trace.write(\" \"+(offset -1)*\" \"+\"^\"*nb_marks)\n trace.write(\"SyntaxError:\",info)\n return trace.format()\n", ["browser", "sys"]], "tempfile": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\n\"NamedTemporaryFile\",\"TemporaryFile\",\n\"SpooledTemporaryFile\",\"TemporaryDirectory\",\n\"mkstemp\",\"mkdtemp\",\n\"mktemp\",\n\"TMP_MAX\",\"gettempprefix\",\n\"tempdir\",\"gettempdir\",\n\"gettempprefixb\",\"gettempdirb\",\n]\n\n\n\n\nimport functools as _functools\nimport warnings as _warnings\nimport io as _io\nimport os as _os\nimport shutil as _shutil\nimport errno as _errno\nfrom random import Random as _Random\nimport sys as _sys\nimport types as _types\nimport weakref as _weakref\nimport _thread\n_allocate_lock=_thread.allocate_lock\n\n_text_openflags=_os.O_RDWR |_os.O_CREAT |_os.O_EXCL\nif hasattr(_os,'O_NOFOLLOW'):\n _text_openflags |=_os.O_NOFOLLOW\n \n_bin_openflags=_text_openflags\nif hasattr(_os,'O_BINARY'):\n _bin_openflags |=_os.O_BINARY\n \nif hasattr(_os,'TMP_MAX'):\n TMP_MAX=_os.TMP_MAX\nelse:\n TMP_MAX=10000\n \n \n \n \n \ntemplate=\"tmp\"\n\n\n\n_once_lock=_allocate_lock()\n\n\ndef _exists(fn):\n try:\n _os.lstat(fn)\n except OSError:\n return False\n else:\n return True\n \n \ndef _infer_return_type(*args):\n ''\n return_type=None\n for arg in args:\n if arg is None:\n continue\n \n if isinstance(arg,_os.PathLike):\n arg=_os.fspath(arg)\n \n if isinstance(arg,bytes):\n if return_type is str:\n raise TypeError(\"Can't mix bytes and non-bytes in \"\n \"path components.\")\n return_type=bytes\n else:\n if return_type is bytes:\n raise TypeError(\"Can't mix bytes and non-bytes in \"\n \"path components.\")\n return_type=str\n if return_type is None:\n if tempdir is None or isinstance(tempdir,str):\n return str\n else:\n \n return bytes\n return return_type\n \n \ndef _sanitize_params(prefix,suffix,dir):\n ''\n output_type=_infer_return_type(prefix,suffix,dir)\n if suffix is None:\n suffix=output_type()\n if prefix is None:\n if output_type is str:\n prefix=template\n else:\n prefix=_os.fsencode(template)\n if dir is None:\n if output_type is str:\n dir=gettempdir()\n else:\n dir=gettempdirb()\n return prefix,suffix,dir,output_type\n \n \nclass _RandomNameSequence:\n ''\n\n\n\n\n \n \n characters=\"abcdefghijklmnopqrstuvwxyz0123456789_\"\n \n @property\n def rng(self):\n cur_pid=_os.getpid()\n if cur_pid !=getattr(self,'_rng_pid',None):\n self._rng=_Random()\n self._rng_pid=cur_pid\n return self._rng\n \n def __iter__(self):\n return self\n \n def __next__(self):\n return ''.join(self.rng.choices(self.characters,k=8))\n \ndef _candidate_tempdir_list():\n ''\n \n \n dirlist=[]\n \n \n for envname in 'TMPDIR','TEMP','TMP':\n dirname=_os.getenv(envname)\n if dirname:dirlist.append(dirname)\n \n \n if _os.name =='nt':\n dirlist.extend([_os.path.expanduser(r'~\\AppData\\Local\\Temp'),\n _os.path.expandvars(r'%SYSTEMROOT%\\Temp'),\n r'c:\\temp',r'c:\\tmp',r'\\temp',r'\\tmp'])\n else:\n dirlist.extend(['/tmp','/var/tmp','/usr/tmp'])\n \n \n try:\n dirlist.append(_os.getcwd())\n except(AttributeError,OSError):\n dirlist.append(_os.curdir)\n \n return dirlist\n \ndef _get_default_tempdir():\n ''\n\n\n\n\n\n \n \n namer=_RandomNameSequence()\n dirlist=_candidate_tempdir_list()\n \n for dir in dirlist:\n if dir !=_os.curdir:\n dir=_os.path.abspath(dir)\n \n for seq in range(100):\n name=next(namer)\n filename=_os.path.join(dir,name)\n try:\n fd=_os.open(filename,_bin_openflags,0o600)\n try:\n try:\n _os.write(fd,b'blat')\n finally:\n _os.close(fd)\n finally:\n _os.unlink(filename)\n return dir\n except FileExistsError:\n pass\n except PermissionError:\n \n \n if(_os.name =='nt'and _os.path.isdir(dir)and\n _os.access(dir,_os.W_OK)):\n continue\n break\n except OSError:\n break\n raise FileNotFoundError(_errno.ENOENT,\n \"No usable temporary directory found in %s\"%\n dirlist)\n \n_name_sequence=None\n\ndef _get_candidate_names():\n ''\n \n global _name_sequence\n if _name_sequence is None:\n _once_lock.acquire()\n try:\n if _name_sequence is None:\n _name_sequence=_RandomNameSequence()\n finally:\n _once_lock.release()\n return _name_sequence\n \n \ndef _mkstemp_inner(dir,pre,suf,flags,output_type):\n ''\n \n dir=_os.path.abspath(dir)\n names=_get_candidate_names()\n if output_type is bytes:\n names=map(_os.fsencode,names)\n \n for seq in range(TMP_MAX):\n name=next(names)\n file=_os.path.join(dir,pre+name+suf)\n _sys.audit(\"tempfile.mkstemp\",file)\n try:\n fd=_os.open(file,flags,0o600)\n except FileExistsError:\n continue\n except PermissionError:\n \n \n if(_os.name =='nt'and _os.path.isdir(dir)and\n _os.access(dir,_os.W_OK)):\n continue\n else:\n raise\n return fd,file\n \n raise FileExistsError(_errno.EEXIST,\n \"No usable temporary file name found\")\n \n \n \n \ndef gettempprefix():\n ''\n return _os.fsdecode(template)\n \ndef gettempprefixb():\n ''\n return _os.fsencode(template)\n \ntempdir=None\n\ndef _gettempdir():\n ''\n global tempdir\n if tempdir is None:\n _once_lock.acquire()\n try:\n if tempdir is None:\n tempdir=_get_default_tempdir()\n finally:\n _once_lock.release()\n return tempdir\n \ndef gettempdir():\n ''\n return _os.fsdecode(_gettempdir())\n \ndef gettempdirb():\n ''\n return _os.fsencode(_gettempdir())\n \ndef mkstemp(suffix=None,prefix=None,dir=None,text=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n prefix,suffix,dir,output_type=_sanitize_params(prefix,suffix,dir)\n \n if text:\n flags=_text_openflags\n else:\n flags=_bin_openflags\n \n return _mkstemp_inner(dir,prefix,suffix,flags,output_type)\n \n \ndef mkdtemp(suffix=None,prefix=None,dir=None):\n ''\n\n\n\n\n\n\n\n\n\n \n \n prefix,suffix,dir,output_type=_sanitize_params(prefix,suffix,dir)\n \n names=_get_candidate_names()\n if output_type is bytes:\n names=map(_os.fsencode,names)\n \n for seq in range(TMP_MAX):\n name=next(names)\n file=_os.path.join(dir,prefix+name+suffix)\n _sys.audit(\"tempfile.mkdtemp\",file)\n try:\n _os.mkdir(file,0o700)\n except FileExistsError:\n continue\n except PermissionError:\n \n \n if(_os.name =='nt'and _os.path.isdir(dir)and\n _os.access(dir,_os.W_OK)):\n continue\n else:\n raise\n return _os.path.abspath(file)\n \n raise FileExistsError(_errno.EEXIST,\n \"No usable temporary directory name found\")\n \ndef mktemp(suffix=\"\",prefix=template,dir=None):\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n if dir is None:\n dir=gettempdir()\n \n names=_get_candidate_names()\n for seq in range(TMP_MAX):\n name=next(names)\n file=_os.path.join(dir,prefix+name+suffix)\n if not _exists(file):\n return file\n \n raise FileExistsError(_errno.EEXIST,\n \"No usable temporary filename found\")\n \n \nclass _TemporaryFileCloser:\n ''\n\n \n \n cleanup_called=False\n close_called=False\n \n def __init__(self,file,name,delete=True,delete_on_close=True):\n self.file=file\n self.name=name\n self.delete=delete\n self.delete_on_close=delete_on_close\n \n def cleanup(self,windows=(_os.name =='nt'),unlink=_os.unlink):\n if not self.cleanup_called:\n self.cleanup_called=True\n try:\n if not self.close_called:\n self.close_called=True\n self.file.close()\n finally:\n \n \n if self.delete and not(windows and self.delete_on_close):\n try:\n unlink(self.name)\n except FileNotFoundError:\n pass\n \n def close(self):\n if not self.close_called:\n self.close_called=True\n try:\n self.file.close()\n finally:\n if self.delete and self.delete_on_close:\n self.cleanup()\n \n def __del__(self):\n self.cleanup()\n \n \nclass _TemporaryFileWrapper:\n ''\n\n\n\n\n \n \n def __init__(self,file,name,delete=True,delete_on_close=True):\n self.file=file\n self.name=name\n self._closer=_TemporaryFileCloser(file,name,delete,\n delete_on_close)\n \n def __getattr__(self,name):\n \n \n \n file=self.__dict__['file']\n a=getattr(file,name)\n if hasattr(a,'__call__'):\n func=a\n @_functools.wraps(func)\n def func_wrapper(*args,**kwargs):\n return func(*args,**kwargs)\n \n \n func_wrapper._closer=self._closer\n a=func_wrapper\n if not isinstance(a,int):\n setattr(self,name,a)\n return a\n \n \n \n def __enter__(self):\n self.file.__enter__()\n return self\n \n \n \n def __exit__(self,exc,value,tb):\n result=self.file.__exit__(exc,value,tb)\n self._closer.cleanup()\n return result\n \n def close(self):\n ''\n\n \n self._closer.close()\n \n \n def __iter__(self):\n \n \n \n \n \n for line in self.file:\n yield line\n \ndef NamedTemporaryFile(mode='w+b',buffering=-1,encoding=None,\nnewline=None,suffix=None,prefix=None,\ndir=None,delete=True,*,errors=None,\ndelete_on_close=True):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n prefix,suffix,dir,output_type=_sanitize_params(prefix,suffix,dir)\n \n flags=_bin_openflags\n \n \n \n if _os.name =='nt'and delete and delete_on_close:\n flags |=_os.O_TEMPORARY\n \n if \"b\"not in mode:\n encoding=_io.text_encoding(encoding)\n \n name=None\n def opener(*args):\n nonlocal name\n fd,name=_mkstemp_inner(dir,prefix,suffix,flags,output_type)\n return fd\n try:\n file=_io.open(dir,mode,buffering=buffering,\n newline=newline,encoding=encoding,errors=errors,\n opener=opener)\n try:\n raw=getattr(file,'buffer',file)\n raw=getattr(raw,'raw',raw)\n raw.name=name\n return _TemporaryFileWrapper(file,name,delete,delete_on_close)\n except:\n file.close()\n raise\n except:\n if name is not None and not(\n _os.name =='nt'and delete and delete_on_close):\n _os.unlink(name)\n raise\n \nif _os.name !='posix'or _sys.platform =='cygwin':\n\n\n TemporaryFile=NamedTemporaryFile\n \nelse:\n\n\n\n _O_TMPFILE_WORKS=hasattr(_os,'O_TMPFILE')\n \n def TemporaryFile(mode='w+b',buffering=-1,encoding=None,\n newline=None,suffix=None,prefix=None,\n dir=None,*,errors=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n global _O_TMPFILE_WORKS\n \n if \"b\"not in mode:\n encoding=_io.text_encoding(encoding)\n \n prefix,suffix,dir,output_type=_sanitize_params(prefix,suffix,dir)\n \n flags=_bin_openflags\n if _O_TMPFILE_WORKS:\n fd=None\n def opener(*args):\n nonlocal fd\n flags2=(flags |_os.O_TMPFILE)&~_os.O_CREAT\n fd=_os.open(dir,flags2,0o600)\n return fd\n try:\n file=_io.open(dir,mode,buffering=buffering,\n newline=newline,encoding=encoding,\n errors=errors,opener=opener)\n raw=getattr(file,'buffer',file)\n raw=getattr(raw,'raw',raw)\n raw.name=fd\n return file\n except IsADirectoryError:\n \n \n \n \n \n _O_TMPFILE_WORKS=False\n except OSError:\n \n \n \n \n \n \n \n pass\n \n \n fd=None\n def opener(*args):\n nonlocal fd\n fd,name=_mkstemp_inner(dir,prefix,suffix,flags,output_type)\n try:\n _os.unlink(name)\n except BaseException as e:\n _os.close(fd)\n raise\n return fd\n file=_io.open(dir,mode,buffering=buffering,\n newline=newline,encoding=encoding,errors=errors,\n opener=opener)\n raw=getattr(file,'buffer',file)\n raw=getattr(raw,'raw',raw)\n raw.name=fd\n return file\n \nclass SpooledTemporaryFile(_io.IOBase):\n ''\n\n\n \n _rolled=False\n \n def __init__(self,max_size=0,mode='w+b',buffering=-1,\n encoding=None,newline=None,\n suffix=None,prefix=None,dir=None,*,errors=None):\n if 'b'in mode:\n self._file=_io.BytesIO()\n else:\n encoding=_io.text_encoding(encoding)\n self._file=_io.TextIOWrapper(_io.BytesIO(),\n encoding=encoding,errors=errors,\n newline=newline)\n self._max_size=max_size\n self._rolled=False\n self._TemporaryFileArgs={'mode':mode,'buffering':buffering,\n 'suffix':suffix,'prefix':prefix,\n 'encoding':encoding,'newline':newline,\n 'dir':dir,'errors':errors}\n \n __class_getitem__=classmethod(_types.GenericAlias)\n \n def _check(self,file):\n if self._rolled:return\n max_size=self._max_size\n if max_size and file.tell()>max_size:\n self.rollover()\n \n def rollover(self):\n if self._rolled:return\n file=self._file\n newfile=self._file=TemporaryFile(**self._TemporaryFileArgs)\n del self._TemporaryFileArgs\n \n pos=file.tell()\n if hasattr(newfile,'buffer'):\n newfile.buffer.write(file.detach().getvalue())\n else:\n newfile.write(file.getvalue())\n newfile.seek(pos,0)\n \n self._rolled=True\n \n \n \n \n \n \n \n def __enter__(self):\n if self._file.closed:\n raise ValueError(\"Cannot enter context with closed file\")\n return self\n \n def __exit__(self,exc,value,tb):\n self._file.close()\n \n \n def __iter__(self):\n return self._file.__iter__()\n \n def __del__(self):\n if not self.closed:\n _warnings.warn(\n \"Unclosed file {!r}\".format(self),\n ResourceWarning,\n stacklevel=2,\n source=self\n )\n self.close()\n \n def close(self):\n self._file.close()\n \n @property\n def closed(self):\n return self._file.closed\n \n @property\n def encoding(self):\n return self._file.encoding\n \n @property\n def errors(self):\n return self._file.errors\n \n def fileno(self):\n self.rollover()\n return self._file.fileno()\n \n def flush(self):\n self._file.flush()\n \n def isatty(self):\n return self._file.isatty()\n \n @property\n def mode(self):\n try:\n return self._file.mode\n except AttributeError:\n return self._TemporaryFileArgs['mode']\n \n @property\n def name(self):\n try:\n return self._file.name\n except AttributeError:\n return None\n \n @property\n def newlines(self):\n return self._file.newlines\n \n def readable(self):\n return self._file.readable()\n \n def read(self,*args):\n return self._file.read(*args)\n \n def read1(self,*args):\n return self._file.read1(*args)\n \n def readinto(self,b):\n return self._file.readinto(b)\n \n def readinto1(self,b):\n return self._file.readinto1(b)\n \n def readline(self,*args):\n return self._file.readline(*args)\n \n def readlines(self,*args):\n return self._file.readlines(*args)\n \n def seekable(self):\n return self._file.seekable()\n \n def seek(self,*args):\n return self._file.seek(*args)\n \n def tell(self):\n return self._file.tell()\n \n def truncate(self,size=None):\n if size is None:\n return self._file.truncate()\n else:\n if size >self._max_size:\n self.rollover()\n return self._file.truncate(size)\n \n def writable(self):\n return self._file.writable()\n \n def write(self,s):\n file=self._file\n rv=file.write(s)\n self._check(file)\n return rv\n \n def writelines(self,iterable):\n file=self._file\n rv=file.writelines(iterable)\n self._check(file)\n return rv\n \n def detach(self):\n return self._file.detach()\n \n \nclass TemporaryDirectory:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,suffix=None,prefix=None,dir=None,\n ignore_cleanup_errors=False,*,delete=True):\n self.name=mkdtemp(suffix,prefix,dir)\n self._ignore_cleanup_errors=ignore_cleanup_errors\n self._delete=delete\n self._finalizer=_weakref.finalize(\n self,self._cleanup,self.name,\n warn_message=\"Implicitly cleaning up {!r}\".format(self),\n ignore_errors=self._ignore_cleanup_errors,delete=self._delete)\n \n @classmethod\n def _rmtree(cls,name,ignore_errors=False):\n def onexc(func,path,exc):\n if isinstance(exc,PermissionError):\n def resetperms(path):\n try:\n _os.chflags(path,0)\n except AttributeError:\n pass\n _os.chmod(path,0o700)\n \n try:\n if path !=name:\n resetperms(_os.path.dirname(path))\n resetperms(path)\n \n try:\n _os.unlink(path)\n \n except(IsADirectoryError,PermissionError):\n cls._rmtree(path,ignore_errors=ignore_errors)\n except FileNotFoundError:\n pass\n elif isinstance(exc,FileNotFoundError):\n pass\n else:\n if not ignore_errors:\n raise\n \n _shutil.rmtree(name,onexc=onexc)\n \n @classmethod\n def _cleanup(cls,name,warn_message,ignore_errors=False,delete=True):\n if delete:\n cls._rmtree(name,ignore_errors=ignore_errors)\n _warnings.warn(warn_message,ResourceWarning)\n \n def __repr__(self):\n return \"<{} {!r}>\".format(self.__class__.__name__,self.name)\n \n def __enter__(self):\n return self.name\n \n def __exit__(self,exc,value,tb):\n if self._delete:\n self.cleanup()\n \n def cleanup(self):\n if self._finalizer.detach()or _os.path.exists(self.name):\n self._rmtree(self.name,ignore_errors=self._ignore_cleanup_errors)\n \n __class_getitem__=classmethod(_types.GenericAlias)\n", ["_thread", "errno", "functools", "io", "os", "random", "shutil", "sys", "types", "warnings", "weakref"]], "textwrap": [".py", "''\n\n\n\n\n\n\nimport re\n\n__all__=['TextWrapper','wrap','fill','dedent','indent','shorten']\n\n\n\n\n_whitespace='\\t\\n\\x0b\\x0c\\r '\n\nclass TextWrapper:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n unicode_whitespace_trans=dict.fromkeys(map(ord,_whitespace),ord(' '))\n \n \n \n \n \n \n \n word_punct=r'[\\w!\"\\'&.,?]'\n letter=r'[^\\d\\W]'\n whitespace=r'[%s]'%re.escape(_whitespace)\n nowhitespace='[^'+whitespace[1:]\n wordsep_re=re.compile(r'''\n ( # any whitespace\n %(ws)s+\n | # em-dash between words\n (?<=%(wp)s) -{2,} (?=\\w)\n | # word, possibly hyphenated\n %(nws)s+? (?:\n # hyphenated word\n -(?: (?<=%(lt)s{2}-) | (?<=%(lt)s-%(lt)s-))\n (?= %(lt)s -? %(lt)s)\n | # end of word\n (?=%(ws)s|\\Z)\n | # em-dash\n (?<=%(wp)s) (?=-{2,}\\w)\n )\n )'''%{'wp':word_punct,'lt':letter,\n 'ws':whitespace,'nws':nowhitespace},\n re.VERBOSE)\n del word_punct,letter,nowhitespace\n \n \n \n \n \n wordsep_simple_re=re.compile(r'(%s+)'%whitespace)\n del whitespace\n \n \n \n sentence_end_re=re.compile(r'[a-z]'\n r'[\\.\\!\\?]'\n r'[\\\"\\']?'\n r'\\Z')\n \n def __init__(self,\n width=70,\n initial_indent=\"\",\n subsequent_indent=\"\",\n expand_tabs=True ,\n replace_whitespace=True ,\n fix_sentence_endings=False ,\n break_long_words=True ,\n drop_whitespace=True ,\n break_on_hyphens=True ,\n tabsize=8,\n *,\n max_lines=None ,\n placeholder=' [...]'):\n self.width=width\n self.initial_indent=initial_indent\n self.subsequent_indent=subsequent_indent\n self.expand_tabs=expand_tabs\n self.replace_whitespace=replace_whitespace\n self.fix_sentence_endings=fix_sentence_endings\n self.break_long_words=break_long_words\n self.drop_whitespace=drop_whitespace\n self.break_on_hyphens=break_on_hyphens\n self.tabsize=tabsize\n self.max_lines=max_lines\n self.placeholder=placeholder\n \n \n \n \n \n def _munge_whitespace(self,text):\n ''\n\n\n\n\n \n if self.expand_tabs:\n text=text.expandtabs(self.tabsize)\n if self.replace_whitespace:\n text=text.translate(self.unicode_whitespace_trans)\n return text\n \n \n def _split(self,text):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self.break_on_hyphens is True :\n chunks=self.wordsep_re.split(text)\n else :\n chunks=self.wordsep_simple_re.split(text)\n chunks=[c for c in chunks if c]\n return chunks\n \n def _fix_sentence_endings(self,chunks):\n ''\n\n\n\n\n\n\n \n i=0\n patsearch=self.sentence_end_re.search\n while i space_left:\n \n \n hyphen=chunk.rfind('-',0,space_left)\n if hyphen >0 and any(c !='-'for c in chunk[:hyphen]):\n end=hyphen+1\n cur_line.append(chunk[:end])\n reversed_chunks[-1]=chunk[end:]\n \n \n \n \n elif not cur_line:\n cur_line.append(reversed_chunks.pop())\n \n \n \n \n \n \n \n def _wrap_chunks(self,chunks):\n ''\n\n\n\n\n\n\n\n\n\n\n \n lines=[]\n if self.width <=0:\n raise ValueError(\"invalid width %r (must be > 0)\"%self.width)\n if self.max_lines is not None :\n if self.max_lines >1:\n indent=self.subsequent_indent\n else :\n indent=self.initial_indent\n if len(indent)+len(self.placeholder.lstrip())>self.width:\n raise ValueError(\"placeholder too large for max width\")\n \n \n \n chunks.reverse()\n \n while chunks:\n \n \n \n cur_line=[]\n cur_len=0\n \n \n if lines:\n indent=self.subsequent_indent\n else :\n indent=self.initial_indent\n \n \n width=self.width -len(indent)\n \n \n \n if self.drop_whitespace and chunks[-1].strip()==''and lines:\n del chunks[-1]\n \n while chunks:\n l=len(chunks[-1])\n \n \n if cur_len+l <=width:\n cur_line.append(chunks.pop())\n cur_len +=l\n \n \n else :\n break\n \n \n \n if chunks and len(chunks[-1])>width:\n self._handle_long_word(chunks,cur_line,cur_len,width)\n cur_len=sum(map(len,cur_line))\n \n \n if self.drop_whitespace and cur_line and cur_line[-1].strip()=='':\n cur_len -=len(cur_line[-1])\n del cur_line[-1]\n \n if cur_line:\n if (self.max_lines is None or\n len(lines)+1 \"%(\n \"locked\"if self._block.locked()else \"unlocked\",\n self.__class__.__module__,\n self.__class__.__qualname__,\n owner,\n self._count,\n hex(id(self))\n )\n \n def _at_fork_reinit(self):\n self._block._at_fork_reinit()\n self._owner=None\n self._count=0\n \n def acquire(self,blocking=True,timeout=-1):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n me=get_ident()\n if self._owner ==me:\n self._count +=1\n return 1\n rc=self._block.acquire(blocking,timeout)\n if rc:\n self._owner=me\n self._count=1\n return rc\n \n __enter__=acquire\n \n def release(self):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self._owner !=get_ident():\n raise RuntimeError(\"cannot release un-acquired lock\")\n self._count=count=self._count -1\n if not count:\n self._owner=None\n self._block.release()\n \n def __exit__(self,t,v,tb):\n self.release()\n \n \n \n def _acquire_restore(self,state):\n self._block.acquire()\n self._count,self._owner=state\n \n def _release_save(self):\n if self._count ==0:\n raise RuntimeError(\"cannot release un-acquired lock\")\n count=self._count\n self._count=0\n owner=self._owner\n self._owner=None\n self._block.release()\n return(count,owner)\n \n def _is_owned(self):\n return self._owner ==get_ident()\n \n_PyRLock=_RLock\n\n\nclass Condition:\n ''\n\n\n\n\n\n\n\n\n \n \n def __init__(self,lock=None):\n if lock is None:\n lock=RLock()\n self._lock=lock\n \n self.acquire=lock.acquire\n self.release=lock.release\n \n \n \n if hasattr(lock,'_release_save'):\n self._release_save=lock._release_save\n if hasattr(lock,'_acquire_restore'):\n self._acquire_restore=lock._acquire_restore\n if hasattr(lock,'_is_owned'):\n self._is_owned=lock._is_owned\n self._waiters=_deque()\n \n def _at_fork_reinit(self):\n self._lock._at_fork_reinit()\n self._waiters.clear()\n \n def __enter__(self):\n return self._lock.__enter__()\n \n def __exit__(self,*args):\n return self._lock.__exit__(*args)\n \n def __repr__(self):\n return \"\"%(self._lock,len(self._waiters))\n \n def _release_save(self):\n self._lock.release()\n \n def _acquire_restore(self,x):\n self._lock.acquire()\n \n def _is_owned(self):\n \n \n if self._lock.acquire(False):\n self._lock.release()\n return False\n else:\n return True\n \n def wait(self,timeout=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not self._is_owned():\n raise RuntimeError(\"cannot wait on un-acquired lock\")\n waiter=_allocate_lock()\n waiter.acquire()\n self._waiters.append(waiter)\n saved_state=self._release_save()\n gotit=False\n try:\n if timeout is None:\n waiter.acquire()\n gotit=True\n else:\n if timeout >0:\n gotit=waiter.acquire(True,timeout)\n else:\n gotit=waiter.acquire(False)\n return gotit\n finally:\n self._acquire_restore(saved_state)\n if not gotit:\n try:\n self._waiters.remove(waiter)\n except ValueError:\n pass\n \n def wait_for(self,predicate,timeout=None):\n ''\n\n\n\n\n\n \n endtime=None\n waittime=timeout\n result=predicate()\n while not result:\n if waittime is not None:\n if endtime is None:\n endtime=_time()+waittime\n else:\n waittime=endtime -_time()\n if waittime <=0:\n break\n self.wait(waittime)\n result=predicate()\n return result\n \n def notify(self,n=1):\n ''\n\n\n\n\n\n\n\n \n if not self._is_owned():\n raise RuntimeError(\"cannot notify on un-acquired lock\")\n waiters=self._waiters\n while waiters and n >0:\n waiter=waiters[0]\n try:\n waiter.release()\n except RuntimeError:\n \n \n \n \n pass\n else:\n n -=1\n try:\n waiters.remove(waiter)\n except ValueError:\n pass\n \n def notify_all(self):\n ''\n\n\n\n\n \n self.notify(len(self._waiters))\n \n def notifyAll(self):\n ''\n\n\n\n \n import warnings\n warnings.warn('notifyAll() is deprecated, use notify_all() instead',\n DeprecationWarning,stacklevel=2)\n self.notify_all()\n \n \nclass Semaphore:\n ''\n\n\n\n\n\n\n \n \n \n \n def __init__(self,value=1):\n if value <0:\n raise ValueError(\"semaphore initial value must be >= 0\")\n self._cond=Condition(Lock())\n self._value=value\n \n def __repr__(self):\n cls=self.__class__\n return(f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}:\"\n f\" value={self._value}>\")\n \n def acquire(self,blocking=True,timeout=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not blocking and timeout is not None:\n raise ValueError(\"can't specify timeout for non-blocking acquire\")\n rc=False\n endtime=None\n with self._cond:\n while self._value ==0:\n if not blocking:\n break\n if timeout is not None:\n if endtime is None:\n endtime=_time()+timeout\n else:\n timeout=endtime -_time()\n if timeout <=0:\n break\n self._cond.wait(timeout)\n else:\n self._value -=1\n rc=True\n return rc\n \n __enter__=acquire\n \n def release(self,n=1):\n ''\n\n\n\n\n \n if n <1:\n raise ValueError('n must be one or more')\n with self._cond:\n self._value +=n\n self._cond.notify(n)\n \n def __exit__(self,t,v,tb):\n self.release()\n \n \nclass BoundedSemaphore(Semaphore):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,value=1):\n super().__init__(value)\n self._initial_value=value\n \n def __repr__(self):\n cls=self.__class__\n return(f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}:\"\n f\" value={self._value}/{self._initial_value}>\")\n \n def release(self,n=1):\n ''\n\n\n\n\n\n\n\n \n if n <1:\n raise ValueError('n must be one or more')\n with self._cond:\n if self._value+n >self._initial_value:\n raise ValueError(\"Semaphore released too many times\")\n self._value +=n\n self._cond.notify(n)\n \n \nclass Event:\n ''\n\n\n\n\n\n \n \n \n \n def __init__(self):\n self._cond=Condition(Lock())\n self._flag=False\n \n def __repr__(self):\n cls=self.__class__\n status='set'if self._flag else 'unset'\n return f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}: {status}>\"\n \n def _at_fork_reinit(self):\n \n self._cond._at_fork_reinit()\n \n def is_set(self):\n ''\n return self._flag\n \n def isSet(self):\n ''\n\n\n\n \n import warnings\n warnings.warn('isSet() is deprecated, use is_set() instead',\n DeprecationWarning,stacklevel=2)\n return self.is_set()\n \n def set(self):\n ''\n\n\n\n\n \n with self._cond:\n self._flag=True\n self._cond.notify_all()\n \n def clear(self):\n ''\n\n\n\n\n \n with self._cond:\n self._flag=False\n \n def wait(self,timeout=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n with self._cond:\n signaled=self._flag\n if not signaled:\n signaled=self._cond.wait(timeout)\n return signaled\n \n \n \n \n \n \n \n \n \n \n \n \n \nclass Barrier:\n ''\n\n\n\n\n\n \n \n def __init__(self,parties,action=None,timeout=None):\n ''\n\n\n\n\n\n\n \n self._cond=Condition(Lock())\n self._action=action\n self._timeout=timeout\n self._parties=parties\n self._state=0\n self._count=0\n \n def __repr__(self):\n cls=self.__class__\n if self.broken:\n return f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}: broken>\"\n return(f\"<{cls.__module__}.{cls.__qualname__} at {id(self):#x}:\"\n f\" waiters={self.n_waiting}/{self.parties}>\")\n \n def wait(self,timeout=None):\n ''\n\n\n\n\n\n\n \n if timeout is None:\n timeout=self._timeout\n with self._cond:\n self._enter()\n index=self._count\n self._count +=1\n try:\n if index+1 ==self._parties:\n \n self._release()\n else:\n \n self._wait(timeout)\n return index\n finally:\n self._count -=1\n \n self._exit()\n \n \n \n def _enter(self):\n while self._state in(-1,1):\n \n self._cond.wait()\n \n if self._state <0:\n raise BrokenBarrierError\n assert self._state ==0\n \n \n \n def _release(self):\n try:\n if self._action:\n self._action()\n \n self._state=1\n self._cond.notify_all()\n except:\n \n self._break()\n raise\n \n \n \n def _wait(self,timeout):\n if not self._cond.wait_for(lambda:self._state !=0,timeout):\n \n self._break()\n raise BrokenBarrierError\n if self._state <0:\n raise BrokenBarrierError\n assert self._state ==1\n \n \n \n def _exit(self):\n if self._count ==0:\n if self._state in(-1,1):\n \n self._state=0\n self._cond.notify_all()\n \n def reset(self):\n ''\n\n\n\n\n \n with self._cond:\n if self._count >0:\n if self._state ==0:\n \n self._state=-1\n elif self._state ==-2:\n \n \n self._state=-1\n else:\n self._state=0\n self._cond.notify_all()\n \n def abort(self):\n ''\n\n\n\n\n \n with self._cond:\n self._break()\n \n def _break(self):\n \n \n self._state=-2\n self._cond.notify_all()\n \n @property\n def parties(self):\n ''\n return self._parties\n \n @property\n def n_waiting(self):\n ''\n \n \n if self._state ==0:\n return self._count\n return 0\n \n @property\n def broken(self):\n ''\n return self._state ==-2\n \n \nclass BrokenBarrierError(RuntimeError):\n pass\n \n \n \n_counter=_count(1).__next__\ndef _newname(name_template):\n return name_template %_counter()\n \n \n \n \n \n_active_limbo_lock=RLock()\n_active={}\n_limbo={}\n_dangling=WeakSet()\n\n\n\n\n_shutdown_locks_lock=_allocate_lock()\n_shutdown_locks=set()\n\ndef _maintain_shutdown_locks():\n ''\n\n\n\n\n\n\n \n \n to_remove=[lock for lock in _shutdown_locks if not lock.locked()]\n _shutdown_locks.difference_update(to_remove)\n \n \n \n \nclass Thread:\n ''\n\n\n\n\n\n \n \n _initialized=False\n \n def __init__(self,group=None,target=None,name=None,\n args=(),kwargs=None,*,daemon=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n assert group is None,\"group argument must be None for now\"\n if kwargs is None:\n kwargs={}\n if name:\n name=str(name)\n else:\n name=_newname(\"Thread-%d\")\n if target is not None:\n try:\n target_name=target.__name__\n name +=f\" ({target_name})\"\n except AttributeError:\n pass\n \n self._target=target\n self._name=name\n self._args=args\n self._kwargs=kwargs\n if daemon is not None:\n if daemon and not _daemon_threads_allowed():\n raise RuntimeError('daemon threads are disabled in this (sub)interpreter')\n self._daemonic=daemon\n else:\n self._daemonic=current_thread().daemon\n self._ident=None\n if _HAVE_THREAD_NATIVE_ID:\n self._native_id=None\n self._tstate_lock=None\n self._started=Event()\n self._is_stopped=False\n self._initialized=True\n \n self._stderr=_sys.stderr\n self._invoke_excepthook=_make_invoke_excepthook()\n \n _dangling.add(self)\n \n def _reset_internal_locks(self,is_alive):\n \n \n self._started._at_fork_reinit()\n if is_alive:\n \n \n \n if self._tstate_lock is not None:\n self._tstate_lock._at_fork_reinit()\n self._tstate_lock.acquire()\n else:\n \n \n self._is_stopped=True\n self._tstate_lock=None\n \n def __repr__(self):\n assert self._initialized,\"Thread.__init__() was not called\"\n status=\"initial\"\n if self._started.is_set():\n status=\"started\"\n self.is_alive()\n if self._is_stopped:\n status=\"stopped\"\n if self._daemonic:\n status +=\" daemon\"\n if self._ident is not None:\n status +=\" %s\"%self._ident\n return \"<%s(%s, %s)>\"%(self.__class__.__name__,self._name,status)\n \n def start(self):\n ''\n\n\n\n\n\n\n\n \n if not self._initialized:\n raise RuntimeError(\"thread.__init__() not called\")\n \n if self._started.is_set():\n raise RuntimeError(\"threads can only be started once\")\n \n with _active_limbo_lock:\n _limbo[self]=self\n try:\n _start_new_thread(self._bootstrap,())\n except Exception:\n with _active_limbo_lock:\n del _limbo[self]\n raise\n self._started.wait()\n \n def run(self):\n ''\n\n\n\n\n\n\n \n try:\n if self._target is not None:\n self._target(*self._args,**self._kwargs)\n finally:\n \n \n del self._target,self._args,self._kwargs\n \n def _bootstrap(self):\n \n \n \n \n \n \n \n \n \n \n \n \n try:\n self._bootstrap_inner()\n except:\n if self._daemonic and _sys is None:\n return\n raise\n \n def _set_ident(self):\n self._ident=get_ident()\n \n if _HAVE_THREAD_NATIVE_ID:\n def _set_native_id(self):\n self._native_id=get_native_id()\n \n def _set_tstate_lock(self):\n ''\n\n\n \n self._tstate_lock=_set_sentinel()\n self._tstate_lock.acquire()\n \n if not self.daemon:\n with _shutdown_locks_lock:\n _maintain_shutdown_locks()\n _shutdown_locks.add(self._tstate_lock)\n \n def _bootstrap_inner(self):\n try:\n self._set_ident()\n self._set_tstate_lock()\n if _HAVE_THREAD_NATIVE_ID:\n self._set_native_id()\n self._started.set()\n with _active_limbo_lock:\n _active[self._ident]=self\n del _limbo[self]\n \n if _trace_hook:\n _sys.settrace(_trace_hook)\n if _profile_hook:\n _sys.setprofile(_profile_hook)\n \n try:\n self.run()\n except:\n self._invoke_excepthook(self)\n finally:\n self._delete()\n \n def _stop(self):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n lock=self._tstate_lock\n if lock is not None:\n assert not lock.locked()\n self._is_stopped=True\n self._tstate_lock=None\n if not self.daemon:\n with _shutdown_locks_lock:\n \n _maintain_shutdown_locks()\n \n def _delete(self):\n ''\n with _active_limbo_lock:\n del _active[get_ident()]\n \n \n \n \n \n def join(self,timeout=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not self._initialized:\n raise RuntimeError(\"Thread.__init__() not called\")\n if not self._started.is_set():\n raise RuntimeError(\"cannot join thread before it is started\")\n if self is current_thread():\n raise RuntimeError(\"cannot join current thread\")\n \n if timeout is None:\n self._wait_for_tstate_lock()\n else:\n \n \n self._wait_for_tstate_lock(timeout=max(timeout,0))\n \n def _wait_for_tstate_lock(self,block=True,timeout=-1):\n \n \n \n \n \n \n lock=self._tstate_lock\n if lock is None:\n \n assert self._is_stopped\n return\n \n try:\n if lock.acquire(block,timeout):\n lock.release()\n self._stop()\n except:\n if lock.locked():\n \n \n \n \n lock.release()\n self._stop()\n raise\n \n @property\n def name(self):\n ''\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n return self._name\n \n @name.setter\n def name(self,name):\n assert self._initialized,\"Thread.__init__() not called\"\n self._name=str(name)\n \n @property\n def ident(self):\n ''\n\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n return self._ident\n \n if _HAVE_THREAD_NATIVE_ID:\n @property\n def native_id(self):\n ''\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n return self._native_id\n \n def is_alive(self):\n ''\n\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n if self._is_stopped or not self._started.is_set():\n return False\n self._wait_for_tstate_lock(False)\n return not self._is_stopped\n \n @property\n def daemon(self):\n ''\n\n\n\n\n\n\n\n\n \n assert self._initialized,\"Thread.__init__() not called\"\n return self._daemonic\n \n @daemon.setter\n def daemon(self,daemonic):\n if not self._initialized:\n raise RuntimeError(\"Thread.__init__() not called\")\n if daemonic and not _daemon_threads_allowed():\n raise RuntimeError('daemon threads are disabled in this interpreter')\n if self._started.is_set():\n raise RuntimeError(\"cannot set daemon status of active thread\")\n self._daemonic=daemonic\n \n def isDaemon(self):\n ''\n\n\n\n \n import warnings\n warnings.warn('isDaemon() is deprecated, get the daemon attribute instead',\n DeprecationWarning,stacklevel=2)\n return self.daemon\n \n def setDaemon(self,daemonic):\n ''\n\n\n\n \n import warnings\n warnings.warn('setDaemon() is deprecated, set the daemon attribute instead',\n DeprecationWarning,stacklevel=2)\n self.daemon=daemonic\n \n def getName(self):\n ''\n\n\n\n \n import warnings\n warnings.warn('getName() is deprecated, get the name attribute instead',\n DeprecationWarning,stacklevel=2)\n return self.name\n \n def setName(self,name):\n ''\n\n\n\n \n import warnings\n warnings.warn('setName() is deprecated, set the name attribute instead',\n DeprecationWarning,stacklevel=2)\n self.name=name\n \n \ntry:\n from _thread import(_excepthook as excepthook,\n _ExceptHookArgs as ExceptHookArgs)\nexcept ImportError:\n\n from traceback import print_exception as _print_exception\n from collections import namedtuple\n \n _ExceptHookArgs=namedtuple(\n 'ExceptHookArgs',\n 'exc_type exc_value exc_traceback thread')\n \n def ExceptHookArgs(args):\n return _ExceptHookArgs(*args)\n \n def excepthook(args,/):\n ''\n\n \n if args.exc_type ==SystemExit:\n \n return\n \n if _sys is not None and _sys.stderr is not None:\n stderr=_sys.stderr\n elif args.thread is not None:\n stderr=args.thread._stderr\n if stderr is None:\n \n \n return\n else:\n \n return\n \n if args.thread is not None:\n name=args.thread.name\n else:\n name=get_ident()\n print(f\"Exception in thread {name}:\",\n file=stderr,flush=True)\n _print_exception(args.exc_type,args.exc_value,args.exc_traceback,\n file=stderr)\n stderr.flush()\n \n \n \n__excepthook__=excepthook\n\n\ndef _make_invoke_excepthook():\n\n\n\n\n old_excepthook=excepthook\n old_sys_excepthook=_sys.excepthook\n if old_excepthook is None:\n raise RuntimeError(\"threading.excepthook is None\")\n if old_sys_excepthook is None:\n raise RuntimeError(\"sys.excepthook is None\")\n \n sys_exc_info=_sys.exc_info\n local_print=print\n local_sys=_sys\n \n def invoke_excepthook(thread):\n global excepthook\n try:\n hook=excepthook\n if hook is None:\n hook=old_excepthook\n \n args=ExceptHookArgs([*sys_exc_info(),thread])\n \n hook(args)\n except Exception as exc:\n exc.__suppress_context__=True\n del exc\n \n if local_sys is not None and local_sys.stderr is not None:\n stderr=local_sys.stderr\n else:\n stderr=thread._stderr\n \n local_print(\"Exception in threading.excepthook:\",\n file=stderr,flush=True)\n \n if local_sys is not None and local_sys.excepthook is not None:\n sys_excepthook=local_sys.excepthook\n else:\n sys_excepthook=old_sys_excepthook\n \n sys_excepthook(*sys_exc_info())\n finally:\n \n args=None\n \n return invoke_excepthook\n \n \n \n \nclass Timer(Thread):\n ''\n\n\n\n\n\n \n \n def __init__(self,interval,function,args=None,kwargs=None):\n Thread.__init__(self)\n self.interval=interval\n self.function=function\n self.args=args if args is not None else[]\n self.kwargs=kwargs if kwargs is not None else{}\n self.finished=Event()\n \n def cancel(self):\n ''\n self.finished.set()\n \n def run(self):\n self.finished.wait(self.interval)\n if not self.finished.is_set():\n self.function(*self.args,**self.kwargs)\n self.finished.set()\n \n \n \n \nclass _MainThread(Thread):\n\n def __init__(self):\n Thread.__init__(self,name=\"MainThread\",daemon=False)\n self._set_tstate_lock()\n self._started.set()\n self._set_ident()\n if _HAVE_THREAD_NATIVE_ID:\n self._set_native_id()\n with _active_limbo_lock:\n _active[self._ident]=self\n \n \n \n \n \n \n \n \n \n \nclass _DummyThread(Thread):\n\n def __init__(self):\n Thread.__init__(self,name=_newname(\"Dummy-%d\"),\n daemon=_daemon_threads_allowed())\n \n self._started.set()\n self._set_ident()\n if _HAVE_THREAD_NATIVE_ID:\n self._set_native_id()\n with _active_limbo_lock:\n _active[self._ident]=self\n \n def _stop(self):\n pass\n \n def is_alive(self):\n assert not self._is_stopped and self._started.is_set()\n return True\n \n def join(self,timeout=None):\n assert False,\"cannot join a dummy thread\"\n \n \n \n \ndef current_thread():\n ''\n\n\n\n\n \n try:\n return _active[get_ident()]\n except KeyError:\n return _DummyThread()\n \ndef currentThread():\n ''\n\n\n\n \n import warnings\n warnings.warn('currentThread() is deprecated, use current_thread() instead',\n DeprecationWarning,stacklevel=2)\n return current_thread()\n \ndef active_count():\n ''\n\n\n\n\n \n \n \n with _active_limbo_lock:\n return len(_active)+len(_limbo)\n \ndef activeCount():\n ''\n\n\n\n \n import warnings\n warnings.warn('activeCount() is deprecated, use active_count() instead',\n DeprecationWarning,stacklevel=2)\n return active_count()\n \ndef _enumerate():\n\n return list(_active.values())+list(_limbo.values())\n \ndef enumerate():\n ''\n\n\n\n\n\n \n with _active_limbo_lock:\n return list(_active.values())+list(_limbo.values())\n \n \n_threading_atexits=[]\n_SHUTTING_DOWN=False\n\ndef _register_atexit(func,*arg,**kwargs):\n ''\n\n\n\n\n\n\n\n \n if _SHUTTING_DOWN:\n raise RuntimeError(\"can't register atexit after shutdown\")\n \n call=functools.partial(func,*arg,**kwargs)\n _threading_atexits.append(call)\n \n \nfrom _thread import stack_size\n\n\n\n\n\n_main_thread=_MainThread()\n\ndef _shutdown():\n ''\n\n \n \n \n \n \n \n if _main_thread._is_stopped:\n \n return\n \n global _SHUTTING_DOWN\n _SHUTTING_DOWN=True\n \n \n \n for atexit_call in reversed(_threading_atexits):\n atexit_call()\n \n \n if _main_thread.ident ==get_ident():\n tlock=_main_thread._tstate_lock\n \n \n assert tlock is not None\n assert tlock.locked()\n tlock.release()\n _main_thread._stop()\n else:\n \n \n \n \n \n pass\n \n \n while True:\n with _shutdown_locks_lock:\n locks=list(_shutdown_locks)\n _shutdown_locks.clear()\n \n if not locks:\n break\n \n for lock in locks:\n \n lock.acquire()\n lock.release()\n \n \n \n \n \ndef main_thread():\n ''\n\n\n\n \n return _main_thread\n \n \n \n \ntry:\n from _thread import _local as local\nexcept ImportError:\n from _threading_local import local\n \n \ndef _after_fork():\n ''\n\n \n \n \n global _active_limbo_lock,_main_thread\n global _shutdown_locks_lock,_shutdown_locks\n _active_limbo_lock=RLock()\n \n \n new_active={}\n \n try:\n current=_active[get_ident()]\n except KeyError:\n \n \n \n current=_MainThread()\n \n _main_thread=current\n \n \n _shutdown_locks_lock=_allocate_lock()\n _shutdown_locks=set()\n \n with _active_limbo_lock:\n \n \n threads=set(_enumerate())\n threads.update(_dangling)\n for thread in threads:\n \n \n if thread is current:\n \n \n thread._reset_internal_locks(True)\n ident=get_ident()\n thread._ident=ident\n new_active[ident]=thread\n else:\n \n thread._reset_internal_locks(False)\n thread._stop()\n \n _limbo.clear()\n _active.clear()\n _active.update(new_active)\n assert len(_active)==1\n \n \nif hasattr(_os,\"register_at_fork\"):\n _os.register_at_fork(after_in_child=_after_fork)\n", ["_collections", "_thread", "_threading_local", "_weakrefset", "collections", "functools", "itertools", "os", "sys", "time", "traceback", "warnings"]], "time": [".py", "from browser import self as window\nimport _locale\nimport javascript\n\n\ndate=javascript.Date.new\nnow=javascript.Date.now\n\n\n\n\n\n\n\n_STRUCT_TM_ITEMS=9\n\n\n\n\n\ndef _get_day_of_year(arg):\n ''\n\n\n\n\n\n\n\n\n\n \n ml=[31,28,31,30,31,30,31,31,30,31,30,31]\n if arg[0]%4 ==0:\n ml[1]+=1\n i=1\n yday=0\n while i mm >13:\n raise ValueError(\"month out of range\")\n \n dd=t[2]\n if dd ==0:dd=1\n if -1 >dd >32:\n raise ValueError(\"day of month out of range\")\n \n hh=t[3]\n if -1 >hh >24:\n raise ValueError(\"hour out of range\")\n \n minu=t[4]\n if -1 >minu >60:\n raise ValueError(\"minute out of range\")\n \n ss=t[5]\n if -1 >ss >62:\n raise ValueError(\"seconds out of range\")\n \n wd=t[6]%7\n if wd <-2:\n raise ValueError(\"day of week out of range\")\n \n dy=t[7]\n if dy ==0:dy=1\n if -1 >dy >367:\n raise ValueError(\"day of year out of range\")\n \n return t[0],mm,dd,hh,minu,ss,wd,dy,t[-1]\n \n \ndef _is_dst(secs=None ):\n ''\n d=date()\n if secs is not None :\n d=date(secs *1000)\n \n \n \n jan=date(d.getFullYear(),0,1)\n jul=date(d.getFullYear(),6,1)\n dst=int(d.getTimezoneOffset()=0 else 6\n tmp=struct_time([d.getUTCFullYear(),\n d.getUTCMonth()+1,d.getUTCDate(),\n d.getUTCHours(),d.getUTCMinutes(),d.getUTCSeconds(),\n wday,0,0])\n tmp.args[7]=_get_day_of_year(tmp.args)\n return tmp\n \ndef localtime(secs=None ):\n d=date()\n if secs is not None :\n d=date(secs *1000)\n dst=_is_dst(secs)\n wday=d.getDay()-1 if d.getDay()-1 >=0 else 6\n tmp=struct_time([d.getFullYear(),\n d.getMonth()+1,d.getDate(),\n d.getHours(),d.getMinutes(),d.getSeconds(),\n wday,0,dst])\n tmp.args[7]=_get_day_of_year(tmp.args)\n return tmp\n \ndef mktime(t):\n if isinstance(t,struct_time):\n d1=date(t.tm_year,t.tm_mon -1,t.tm_mday,\n t.tm_hour,t.tm_min,t.tm_sec,0).getTime()\n elif isinstance(t,tuple):\n d1=date(t[0],t[1]-1,t[2],t[3],t[4],t[5],0).getTime()\n else :\n raise ValueError(\"Tuple or struct_time argument required\")\n d2=date(0).getTime()\n return (d1 -d2)/1000.\n \ndef monotonic():\n return now()/1000.\n \ndef perf_counter():\n return window.performance.now()/1000.\n \ndef process_time():\n return now()/1000.\n \ndef time():\n return float(date().getTime()/1000)\n \ndef sleep(secs):\n ''\n\n \n \n float(secs)\n raise NotImplementedError(\"Blocking functions like time.sleep() are not \"\n \"supported in the browser. Use functions in module browser.timer \"\n \"instead.\")\n \ndef strftime(_format,t=None ):\n def ns(t,nb):\n \n res=str(t)\n while len(res) float\n repeat(string, string) -> list\n default_timer() -> float\n\n\"\"\"\n\nimport gc\nimport sys\nimport time\nimport itertools\n\n__all__=[\"Timer\",\"timeit\",\"repeat\",\"default_timer\"]\n\ndummy_src_name=\"\"\ndefault_number=1000000\ndefault_repeat=5\ndefault_timer=time.perf_counter\n\n_globals=globals\n\n\n\n\ntemplate=\"\"\"\ndef inner(_it, _timer{init}):\n {setup}\n _t0 = _timer()\n for _i in _it:\n {stmt}\n pass\n _t1 = _timer()\n return _t1 - _t0\n\"\"\"\n\ndef reindent(src,indent):\n ''\n return src.replace(\"\\n\",\"\\n\"+\" \"*indent)\n \nclass Timer:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,stmt=\"pass\",setup=\"pass\",timer=default_timer,\n globals=None):\n ''\n self.timer=timer\n local_ns={}\n global_ns=_globals()if globals is None else globals\n init=''\n if isinstance(setup,str):\n \n compile(setup,dummy_src_name,\"exec\")\n stmtprefix=setup+'\\n'\n setup=reindent(setup,4)\n elif callable(setup):\n local_ns['_setup']=setup\n init +=', _setup=_setup'\n stmtprefix=''\n setup='_setup()'\n else:\n raise ValueError(\"setup is neither a string nor callable\")\n if isinstance(stmt,str):\n \n compile(stmtprefix+stmt,dummy_src_name,\"exec\")\n stmt=reindent(stmt,8)\n elif callable(stmt):\n local_ns['_stmt']=stmt\n init +=', _stmt=_stmt'\n stmt='_stmt()'\n else:\n raise ValueError(\"stmt is neither a string nor callable\")\n src=template.format(stmt=stmt,setup=setup,init=init)\n self.src=src\n code=compile(src,dummy_src_name,\"exec\")\n exec(code,global_ns,local_ns)\n self.inner=local_ns[\"inner\"]\n \n def print_exc(self,file=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n import linecache,traceback\n if self.src is not None:\n linecache.cache[dummy_src_name]=(len(self.src),\n None,\n self.src.split(\"\\n\"),\n dummy_src_name)\n \n \n traceback.print_exc(file=file)\n \n def timeit(self,number=default_number):\n ''\n\n\n\n\n\n\n\n \n it=itertools.repeat(None,number)\n gcold=gc.isenabled()\n gc.disable()\n try:\n timing=self.inner(it,self.timer)\n finally:\n if gcold:\n gc.enable()\n return timing\n \n def repeat(self,repeat=default_repeat,number=default_number):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n r=[]\n for i in range(repeat):\n t=self.timeit(number)\n r.append(t)\n return r\n \n def autorange(self,callback=None):\n ''\n\n\n\n\n\n\n\n \n i=1\n while True:\n for j in 1,2,5:\n number=i *j\n time_taken=self.timeit(number)\n if callback:\n callback(number,time_taken)\n if time_taken >=0.2:\n return(number,time_taken)\n i *=10\n \ndef timeit(stmt=\"pass\",setup=\"pass\",timer=default_timer,\nnumber=default_number,globals=None):\n ''\n return Timer(stmt,setup,timer,globals).timeit(number)\n \ndef repeat(stmt=\"pass\",setup=\"pass\",timer=default_timer,\nrepeat=default_repeat,number=default_number,globals=None):\n ''\n return Timer(stmt,setup,timer,globals).repeat(repeat,number)\n \ndef main(args=None,*,_wrap_timer=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if args is None:\n args=sys.argv[1:]\n import getopt\n try:\n opts,args=getopt.getopt(args,\"n:u:s:r:pvh\",\n [\"number=\",\"setup=\",\"repeat=\",\n \"process\",\"verbose\",\"unit=\",\"help\"])\n except getopt.error as err:\n print(err)\n print(\"use -h/--help for command line help\")\n return 2\n \n timer=default_timer\n stmt=\"\\n\".join(args)or \"pass\"\n number=0\n setup=[]\n repeat=default_repeat\n verbose=0\n time_unit=None\n units={\"nsec\":1e-9,\"usec\":1e-6,\"msec\":1e-3,\"sec\":1.0}\n precision=3\n for o,a in opts:\n if o in(\"-n\",\"--number\"):\n number=int(a)\n if o in(\"-s\",\"--setup\"):\n setup.append(a)\n if o in(\"-u\",\"--unit\"):\n if a in units:\n time_unit=a\n else:\n print(\"Unrecognized unit. Please select nsec, usec, msec, or sec.\",\n file=sys.stderr)\n return 2\n if o in(\"-r\",\"--repeat\"):\n repeat=int(a)\n if repeat <=0:\n repeat=1\n if o in(\"-p\",\"--process\"):\n timer=time.process_time\n if o in(\"-v\",\"--verbose\"):\n if verbose:\n precision +=1\n verbose +=1\n if o in(\"-h\",\"--help\"):\n print(__doc__,end=' ')\n return 0\n setup=\"\\n\".join(setup)or \"pass\"\n \n \n \n \n import os\n sys.path.insert(0,os.curdir)\n if _wrap_timer is not None:\n timer=_wrap_timer(timer)\n \n t=Timer(stmt,setup,timer)\n if number ==0:\n \n callback=None\n if verbose:\n def callback(number,time_taken):\n msg=\"{num} loop{s} -> {secs:.{prec}g} secs\"\n plural=(number !=1)\n print(msg.format(num=number,s='s'if plural else '',\n secs=time_taken,prec=precision))\n try:\n number,_=t.autorange(callback)\n except:\n t.print_exc()\n return 1\n \n if verbose:\n print()\n \n try:\n raw_timings=t.repeat(repeat,number)\n except:\n t.print_exc()\n return 1\n \n def format_time(dt):\n unit=time_unit\n \n if unit is not None:\n scale=units[unit]\n else:\n scales=[(scale,unit)for unit,scale in units.items()]\n scales.sort(reverse=True)\n for scale,unit in scales:\n if dt >=scale:\n break\n \n return \"%.*g %s\"%(precision,dt /scale,unit)\n \n if verbose:\n print(\"raw times: %s\"%\", \".join(map(format_time,raw_timings)))\n print()\n timings=[dt /number for dt in raw_timings]\n \n best=min(timings)\n print(\"%d loop%s, best of %d: %s per loop\"\n %(number,'s'if number !=1 else '',\n repeat,format_time(best)))\n \n best=min(timings)\n worst=max(timings)\n if worst >=best *4:\n import warnings\n warnings.warn_explicit(\"The test results are likely unreliable. \"\n \"The worst time (%s) was more than four times \"\n \"slower than the best time (%s).\"\n %(format_time(worst),format_time(best)),\n UserWarning,'',0)\n return None\n \nif __name__ ==\"__main__\":\n sys.exit(main())\n", ["gc", "getopt", "itertools", "linecache", "os", "sys", "time", "traceback", "warnings"]], "token": [".py", "''\n\n\n__all__=['tok_name','ISTERMINAL','ISNONTERMINAL','ISEOF']\n\nENDMARKER=0\nNAME=1\nNUMBER=2\nSTRING=3\nNEWLINE=4\nINDENT=5\nDEDENT=6\nLPAR=7\nRPAR=8\nLSQB=9\nRSQB=10\nCOLON=11\nCOMMA=12\nSEMI=13\nPLUS=14\nMINUS=15\nSTAR=16\nSLASH=17\nVBAR=18\nAMPER=19\nLESS=20\nGREATER=21\nEQUAL=22\nDOT=23\nPERCENT=24\nLBRACE=25\nRBRACE=26\nEQEQUAL=27\nNOTEQUAL=28\nLESSEQUAL=29\nGREATEREQUAL=30\nTILDE=31\nCIRCUMFLEX=32\nLEFTSHIFT=33\nRIGHTSHIFT=34\nDOUBLESTAR=35\nPLUSEQUAL=36\nMINEQUAL=37\nSTAREQUAL=38\nSLASHEQUAL=39\nPERCENTEQUAL=40\nAMPEREQUAL=41\nVBAREQUAL=42\nCIRCUMFLEXEQUAL=43\nLEFTSHIFTEQUAL=44\nRIGHTSHIFTEQUAL=45\nDOUBLESTAREQUAL=46\nDOUBLESLASH=47\nDOUBLESLASHEQUAL=48\nAT=49\nATEQUAL=50\nRARROW=51\nELLIPSIS=52\nCOLONEQUAL=53\nEXCLAMATION=54\nOP=55\nAWAIT=56\nASYNC=57\nTYPE_IGNORE=58\nTYPE_COMMENT=59\nSOFT_KEYWORD=60\nFSTRING_START=61\nFSTRING_MIDDLE=62\nFSTRING_END=63\nCOMMENT=64\nNL=65\n\nERRORTOKEN=66\nENCODING=67\nN_TOKENS=68\n\nNT_OFFSET=256\n\ntok_name={value:name\nfor name,value in globals().items()\nif isinstance(value,int)and not name.startswith('_')}\n__all__.extend(tok_name.values())\n\nEXACT_TOKEN_TYPES={\n'!':EXCLAMATION,\n'!=':NOTEQUAL,\n'%':PERCENT,\n'%=':PERCENTEQUAL,\n'&':AMPER,\n'&=':AMPEREQUAL,\n'(':LPAR,\n')':RPAR,\n'*':STAR,\n'**':DOUBLESTAR,\n'**=':DOUBLESTAREQUAL,\n'*=':STAREQUAL,\n'+':PLUS,\n'+=':PLUSEQUAL,\n',':COMMA,\n'-':MINUS,\n'-=':MINEQUAL,\n'->':RARROW,\n'.':DOT,\n'...':ELLIPSIS,\n'/':SLASH,\n'//':DOUBLESLASH,\n'//=':DOUBLESLASHEQUAL,\n'/=':SLASHEQUAL,\n':':COLON,\n':=':COLONEQUAL,\n';':SEMI,\n'<':LESS,\n'<<':LEFTSHIFT,\n'<<=':LEFTSHIFTEQUAL,\n'<=':LESSEQUAL,\n'=':EQUAL,\n'==':EQEQUAL,\n'>':GREATER,\n'>=':GREATEREQUAL,\n'>>':RIGHTSHIFT,\n'>>=':RIGHTSHIFTEQUAL,\n'@':AT,\n'@=':ATEQUAL,\n'[':LSQB,\n']':RSQB,\n'^':CIRCUMFLEX,\n'^=':CIRCUMFLEXEQUAL,\n'{':LBRACE,\n'|':VBAR,\n'|=':VBAREQUAL,\n'}':RBRACE,\n'~':TILDE,\n}\n\ndef ISTERMINAL(x):\n return x =NT_OFFSET\n \ndef ISEOF(x):\n return x ==ENDMARKER\n", []], "tokenize": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__author__='Ka-Ping Yee '\n__credits__=('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, '\n'Skip Montanaro, Raymond Hettinger, Trent Nelson, '\n'Michael Foord')\nfrom builtins import open as _builtin_open\nfrom codecs import lookup,BOM_UTF8\nimport collections\nimport functools\nfrom io import TextIOWrapper\nimport itertools as _itertools\nimport re\nimport sys\nfrom token import *\nfrom token import EXACT_TOKEN_TYPES\nimport _tokenize\n\ncookie_re=re.compile(r'^[ \\t\\f]*#.*?coding[:=][ \\t]*([-\\w.]+)',re.ASCII)\nblank_re=re.compile(br'^[ \\t\\f]*(?:[#\\r\\n]|$)',re.ASCII)\n\nimport token\n__all__=token.__all__+[\"tokenize\",\"generate_tokens\",\"detect_encoding\",\n\"untokenize\",\"TokenInfo\"]\ndel token\n\nclass TokenInfo(collections.namedtuple('TokenInfo','type string start end line')):\n def __repr__(self):\n annotated_type='%d (%s)'%(self.type,tok_name[self.type])\n return('TokenInfo(type=%s, string=%r, start=%r, end=%r, line=%r)'%\n self._replace(type=annotated_type))\n \n @property\n def exact_type(self):\n if self.type ==OP and self.string in EXACT_TOKEN_TYPES:\n return EXACT_TOKEN_TYPES[self.string]\n else:\n return self.type\n \ndef group(*choices):return '('+'|'.join(choices)+')'\ndef any(*choices):return group(*choices)+'*'\ndef maybe(*choices):return group(*choices)+'?'\n\n\n\nWhitespace=r'[ \\f\\t]*'\nComment=r'#[^\\r\\n]*'\nIgnore=Whitespace+any(r'\\\\\\r?\\n'+Whitespace)+maybe(Comment)\nName=r'\\w+'\n\nHexnumber=r'0[xX](?:_?[0-9a-fA-F])+'\nBinnumber=r'0[bB](?:_?[01])+'\nOctnumber=r'0[oO](?:_?[0-7])+'\nDecnumber=r'(?:0(?:_?0)*|[1-9](?:_?[0-9])*)'\nIntnumber=group(Hexnumber,Binnumber,Octnumber,Decnumber)\nExponent=r'[eE][-+]?[0-9](?:_?[0-9])*'\nPointfloat=group(r'[0-9](?:_?[0-9])*\\.(?:[0-9](?:_?[0-9])*)?',\nr'\\.[0-9](?:_?[0-9])*')+maybe(Exponent)\nExpfloat=r'[0-9](?:_?[0-9])*'+Exponent\nFloatnumber=group(Pointfloat,Expfloat)\nImagnumber=group(r'[0-9](?:_?[0-9])*[jJ]',Floatnumber+r'[jJ]')\nNumber=group(Imagnumber,Floatnumber,Intnumber)\n\n\ndef _all_string_prefixes():\n\n\n\n _valid_string_prefixes=['b','r','u','f','br','fr']\n \n result={''}\n for prefix in _valid_string_prefixes:\n for t in _itertools.permutations(prefix):\n \n \n for u in _itertools.product(*[(c,c.upper())for c in t]):\n result.add(''.join(u))\n return result\n \n@functools.lru_cache\ndef _compile(expr):\n return re.compile(expr,re.UNICODE)\n \n \n \nStringPrefix=group(*_all_string_prefixes())\n\n\nSingle=r\"[^'\\\\]*(?:\\\\.[^'\\\\]*)*'\"\n\nDouble=r'[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"'\n\nSingle3=r\"[^'\\\\]*(?:(?:\\\\.|'(?!''))[^'\\\\]*)*'''\"\n\nDouble3=r'[^\"\\\\]*(?:(?:\\\\.|\"(?!\"\"))[^\"\\\\]*)*\"\"\"'\nTriple=group(StringPrefix+\"'''\",StringPrefix+'\"\"\"')\n\nString=group(StringPrefix+r\"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*'\",\nStringPrefix+r'\"[^\\n\"\\\\]*(?:\\\\.[^\\n\"\\\\]*)*\"')\n\n\n\n\nSpecial=group(*map(re.escape,sorted(EXACT_TOKEN_TYPES,reverse=True)))\nFunny=group(r'\\r?\\n',Special)\n\nPlainToken=group(Number,Funny,String,Name)\nToken=Ignore+PlainToken\n\n\nContStr=group(StringPrefix+r\"'[^\\n'\\\\]*(?:\\\\.[^\\n'\\\\]*)*\"+\ngroup(\"'\",r'\\\\\\r?\\n'),\nStringPrefix+r'\"[^\\n\"\\\\]*(?:\\\\.[^\\n\"\\\\]*)*'+\ngroup('\"',r'\\\\\\r?\\n'))\nPseudoExtras=group(r'\\\\\\r?\\n|\\Z',Comment,Triple)\nPseudoToken=Whitespace+group(PseudoExtras,Number,Funny,ContStr,Name)\n\n\n\n\nendpats={}\nfor _prefix in _all_string_prefixes():\n endpats[_prefix+\"'\"]=Single\n endpats[_prefix+'\"']=Double\n endpats[_prefix+\"'''\"]=Single3\n endpats[_prefix+'\"\"\"']=Double3\ndel _prefix\n\n\n\nsingle_quoted=set()\ntriple_quoted=set()\nfor t in _all_string_prefixes():\n for u in(t+'\"',t+\"'\"):\n single_quoted.add(u)\n for u in(t+'\"\"\"',t+\"'''\"):\n triple_quoted.add(u)\ndel t,u\n\ntabsize=8\n\nclass TokenError(Exception):pass\n\n\nclass StopTokenizing(Exception):pass\n\nclass Untokenizer:\n\n def __init__(self):\n self.tokens=[]\n self.prev_row=1\n self.prev_col=0\n self.encoding=None\n \n def add_whitespace(self,start):\n row,col=start\n if row =len(indent):\n self.tokens.append(indent)\n self.prev_col=len(indent)\n startline=False\n elif tok_type ==FSTRING_MIDDLE:\n if '{'in token or '}'in token:\n end_line,end_col=end\n end=(end_line,end_col+token.count('{')+token.count('}'))\n token=re.sub('{','{{',token)\n token=re.sub('}','}}',token)\n \n \n self.add_whitespace(start)\n self.tokens.append(token)\n self.prev_row,self.prev_col=end\n if tok_type in(NEWLINE,NL):\n self.prev_row +=1\n self.prev_col=0\n return \"\".join(self.tokens)\n \n def compat(self,token,iterable):\n indents=[]\n toks_append=self.tokens.append\n startline=token[0]in(NEWLINE,NL)\n prevstring=False\n \n for tok in _itertools.chain([token],iterable):\n toknum,tokval=tok[:2]\n if toknum ==ENCODING:\n self.encoding=tokval\n continue\n \n if toknum in(NAME,NUMBER):\n tokval +=' '\n \n \n if toknum ==STRING:\n if prevstring:\n tokval=' '+tokval\n prevstring=True\n else:\n prevstring=False\n \n if toknum ==INDENT:\n indents.append(tokval)\n continue\n elif toknum ==DEDENT:\n indents.pop()\n continue\n elif toknum in(NEWLINE,NL):\n startline=True\n elif startline and indents:\n toks_append(indents[-1])\n startline=False\n elif toknum ==FSTRING_MIDDLE:\n if '{'in tokval or '}'in tokval:\n tokval=re.sub('{','{{',tokval)\n tokval=re.sub('}','}}',tokval)\n \n toks_append(tokval)\n \n \ndef untokenize(iterable):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n ut=Untokenizer()\n out=ut.untokenize(iterable)\n if ut.encoding is not None:\n out=out.encode(ut.encoding)\n return out\n \n \ndef _get_normal_name(orig_enc):\n ''\n \n enc=orig_enc[:12].lower().replace(\"_\",\"-\")\n if enc ==\"utf-8\"or enc.startswith(\"utf-8-\"):\n return \"utf-8\"\n if enc in(\"latin-1\",\"iso-8859-1\",\"iso-latin-1\")or\\\n enc.startswith((\"latin-1-\",\"iso-8859-1-\",\"iso-latin-1-\")):\n return \"iso-8859-1\"\n return orig_enc\n \ndef detect_encoding(readline):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n filename=readline.__self__.name\n except AttributeError:\n filename=None\n bom_found=False\n encoding=None\n default='utf-8'\n def read_or_stop():\n try:\n return readline()\n except StopIteration:\n return b''\n \n def find_cookie(line):\n try:\n \n \n \n line_string=line.decode('utf-8')\n except UnicodeDecodeError:\n msg=\"invalid or missing encoding declaration\"\n if filename is not None:\n msg='{} for {!r}'.format(msg,filename)\n raise SyntaxError(msg)\n \n match=cookie_re.match(line_string)\n if not match:\n return None\n encoding=_get_normal_name(match.group(1))\n try:\n codec=lookup(encoding)\n except LookupError:\n \n if filename is None:\n msg=\"unknown encoding: \"+encoding\n else:\n msg=\"unknown encoding for {!r}: {}\".format(filename,\n encoding)\n raise SyntaxError(msg)\n \n if bom_found:\n if encoding !='utf-8':\n \n if filename is None:\n msg='encoding problem: utf-8'\n else:\n msg='encoding problem for {!r}: utf-8'.format(filename)\n raise SyntaxError(msg)\n encoding +='-sig'\n return encoding\n \n first=read_or_stop()\n if first.startswith(BOM_UTF8):\n bom_found=True\n first=first[3:]\n default='utf-8-sig'\n if not first:\n return default,[]\n \n encoding=find_cookie(first)\n if encoding:\n return encoding,[first]\n if not blank_re.match(first):\n return default,[first]\n \n second=read_or_stop()\n if not second:\n return default,[first]\n \n encoding=find_cookie(second)\n if encoding:\n return encoding,[first,second]\n \n return default,[first,second]\n \n \ndef open(filename):\n ''\n\n \n buffer=_builtin_open(filename,'rb')\n try:\n encoding,lines=detect_encoding(buffer.readline)\n buffer.seek(0)\n text=TextIOWrapper(buffer,encoding,line_buffering=True)\n text.mode='r'\n return text\n except:\n buffer.close()\n raise\n \ndef tokenize(readline):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n encoding,consumed=detect_encoding(readline)\n rl_gen=_itertools.chain(consumed,iter(readline,b\"\"))\n if encoding is not None:\n if encoding ==\"utf-8-sig\":\n \n encoding=\"utf-8\"\n yield TokenInfo(ENCODING,encoding,(0,0),(0,0),'')\n yield from _generate_tokens_from_c_tokenizer(rl_gen.__next__,encoding,extra_tokens=True)\n \ndef generate_tokens(readline):\n ''\n\n\n\n \n return _generate_tokens_from_c_tokenizer(readline,extra_tokens=True)\n \ndef main():\n import argparse\n \n \n def perror(message):\n sys.stderr.write(message)\n sys.stderr.write('\\n')\n \n def error(message,filename=None,location=None):\n if location:\n args=(filename,)+location+(message,)\n perror(\"%s:%d:%d: error: %s\"%args)\n elif filename:\n perror(\"%s: error: %s\"%(filename,message))\n else:\n perror(\"error: %s\"%message)\n sys.exit(1)\n \n \n parser=argparse.ArgumentParser(prog='python -m tokenize')\n parser.add_argument(dest='filename',nargs='?',\n metavar='filename.py',\n help='the file to tokenize; defaults to stdin')\n parser.add_argument('-e','--exact',dest='exact',action='store_true',\n help='display token names using the exact type')\n args=parser.parse_args()\n \n try:\n \n if args.filename:\n filename=args.filename\n with _builtin_open(filename,'rb')as f:\n tokens=list(tokenize(f.readline))\n else:\n filename=\"\"\n tokens=_generate_tokens_from_c_tokenizer(\n sys.stdin.readline,extra_tokens=True)\n \n \n \n for token in tokens:\n token_type=token.type\n if args.exact:\n token_type=token.exact_type\n token_range=\"%d,%d-%d,%d:\"%(token.start+token.end)\n print(\"%-20s%-15s%-15r\"%\n (token_range,tok_name[token_type],token.string))\n except IndentationError as err:\n line,column=err.args[1][1:3]\n error(err.args[0],filename,(line,column))\n except TokenError as err:\n line,column=err.args[1]\n error(err.args[0],filename,(line,column))\n except SyntaxError as err:\n error(err,filename)\n except OSError as err:\n error(err)\n except KeyboardInterrupt:\n print(\"interrupted\\n\")\n except Exception as err:\n perror(\"unexpected error: %s\"%err)\n raise\n \ndef _generate_tokens_from_c_tokenizer(source,encoding=None,extra_tokens=False):\n ''\n if encoding is None:\n it=_tokenize.TokenizerIter(source,extra_tokens=extra_tokens)\n else:\n it=_tokenize.TokenizerIter(source,encoding=encoding,extra_tokens=extra_tokens)\n for info in it:\n yield TokenInfo._make(info)\n \n \nif __name__ ==\"__main__\":\n main()\n", ["_tokenize", "argparse", "builtins", "codecs", "collections", "functools", "io", "itertools", "re", "sys", "token"]], "traceback": [".py", "''\n\nimport collections.abc\nimport itertools\nimport linecache\nimport sys\nimport textwrap\nfrom contextlib import suppress\n\n__all__=['extract_stack','extract_tb','format_exception',\n'format_exception_only','format_list','format_stack',\n'format_tb','print_exc','format_exc','print_exception',\n'print_last','print_stack','print_tb','clear_frames',\n'FrameSummary','StackSummary','TracebackException',\n'walk_stack','walk_tb']\n\n\n\n\n\ndef print_list(extracted_list,file=None):\n ''\n \n if file is None:\n file=sys.stderr\n for item in StackSummary.from_list(extracted_list).format():\n print(item,file=file,end=\"\")\n \ndef format_list(extracted_list):\n ''\n\n\n\n\n\n\n\n\n\n \n return StackSummary.from_list(extracted_list).format()\n \n \n \n \n \ndef print_tb(tb,limit=None,file=None):\n ''\n\n\n\n\n\n \n print_list(extract_tb(tb,limit=limit),file=file)\n \ndef format_tb(tb,limit=None):\n ''\n return extract_tb(tb,limit=limit).format()\n \ndef extract_tb(tb,limit=None):\n ''\n\n\n\n\n\n\n\n\n\n\n \n return StackSummary._extract_from_extended_frame_gen(\n _walk_tb_with_full_positions(tb),limit=limit)\n \n \n \n \n \n_cause_message=(\n\"\\nThe above exception was the direct cause \"\n\"of the following exception:\\n\\n\")\n\n_context_message=(\n\"\\nDuring handling of the above exception, \"\n\"another exception occurred:\\n\\n\")\n\n\nclass _Sentinel:\n def __repr__(self):\n return \"\"\n \n_sentinel=_Sentinel()\n\ndef _parse_value_tb(exc,value,tb):\n if(value is _sentinel)!=(tb is _sentinel):\n raise ValueError(\"Both or neither of value and tb must be given\")\n if value is tb is _sentinel:\n if exc is not None:\n if isinstance(exc,BaseException):\n return exc,exc.__traceback__\n \n raise TypeError(f'Exception expected for value, '\n f'{type(exc).__name__} found')\n else:\n return None,None\n return value,tb\n \n \ndef print_exception(exc,/,value=_sentinel,tb=_sentinel,limit=None,\\\nfile=None,chain=True):\n ''\n\n\n\n\n\n\n\n\n \n value,tb=_parse_value_tb(exc,value,tb)\n te=TracebackException(type(value),value,tb,limit=limit,compact=True)\n te.print(file=file,chain=chain)\n \n \ndef format_exception(exc,/,value=_sentinel,tb=_sentinel,limit=None,\\\nchain=True):\n ''\n\n\n\n\n\n\n \n value,tb=_parse_value_tb(exc,value,tb)\n te=TracebackException(type(value),value,tb,limit=limit,compact=True)\n return list(te.format(chain=chain))\n \n \ndef format_exception_only(exc,/,value=_sentinel):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if value is _sentinel:\n value=exc\n te=TracebackException(type(value),value,None,compact=True)\n return list(te.format_exception_only())\n \n \n \n \ndef _format_final_exc_line(etype,value):\n valuestr=_safe_string(value,'exception')\n if value is None or not valuestr:\n line=\"%s\\n\"%etype\n else:\n line=\"%s: %s\\n\"%(etype,valuestr)\n return line\n \ndef _safe_string(value,what,func=str):\n try:\n return func(value)\n except:\n return f'<{what} {func.__name__}() failed>'\n \n \n \ndef print_exc(limit=None,file=None,chain=True):\n ''\n print_exception(sys.exception(),limit=limit,file=file,chain=chain)\n \ndef format_exc(limit=None,chain=True):\n ''\n return \"\".join(format_exception(sys.exception(),limit=limit,chain=chain))\n \ndef print_last(limit=None,file=None,chain=True):\n ''\n if not hasattr(sys,\"last_exc\")and not hasattr(sys,\"last_type\"):\n raise ValueError(\"no last exception\")\n \n if hasattr(sys,\"last_exc\"):\n print_exception(sys.last_exc,limit,file,chain)\n else:\n print_exception(sys.last_type,sys.last_value,sys.last_traceback,\n limit,file,chain)\n \n \n \n \n \n \ndef print_stack(f=None,limit=None,file=None):\n ''\n\n\n\n\n \n if f is None:\n f=sys._getframe().f_back\n print_list(extract_stack(f,limit=limit),file=file)\n \n \ndef format_stack(f=None,limit=None):\n ''\n if f is None:\n f=sys._getframe().f_back\n return format_list(extract_stack(f,limit=limit))\n \n \ndef extract_stack(f=None,limit=None):\n ''\n\n\n\n\n\n\n \n if f is None:\n f=sys._getframe().f_back\n stack=StackSummary.extract(walk_stack(f),limit=limit)\n stack.reverse()\n return stack\n \n \ndef clear_frames(tb):\n ''\n while tb is not None:\n try:\n tb.tb_frame.clear()\n except RuntimeError:\n \n pass\n tb=tb.tb_next\n \n \nclass FrameSummary:\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('filename','lineno','end_lineno','colno','end_colno',\n 'name','_line','locals')\n \n def __init__(self,filename,lineno,name,*,lookup_line=True,\n locals=None,line=None,\n end_lineno=None,colno=None,end_colno=None):\n ''\n\n\n\n\n\n\n\n \n self.filename=filename\n self.lineno=lineno\n self.name=name\n self._line=line\n if lookup_line:\n self.line\n self.locals={k:_safe_string(v,'local',func=repr)\n for k,v in locals.items()}if locals else None\n self.end_lineno=end_lineno\n self.colno=colno\n self.end_colno=end_colno\n \n def __eq__(self,other):\n if isinstance(other,FrameSummary):\n return(self.filename ==other.filename and\n self.lineno ==other.lineno and\n self.name ==other.name and\n self.locals ==other.locals)\n if isinstance(other,tuple):\n return(self.filename,self.lineno,self.name,self.line)==other\n return NotImplemented\n \n def __getitem__(self,pos):\n return(self.filename,self.lineno,self.name,self.line)[pos]\n \n def __iter__(self):\n return iter([self.filename,self.lineno,self.name,self.line])\n \n def __repr__(self):\n return \"\".format(\n filename=self.filename,lineno=self.lineno,name=self.name)\n \n def __len__(self):\n return 4\n \n @property\n def _original_line(self):\n \n self.line\n return self._line\n \n @property\n def line(self):\n if self._line is None:\n if self.lineno is None:\n return None\n self._line=linecache.getline(self.filename,self.lineno)\n return self._line.strip()\n \n \ndef walk_stack(f):\n ''\n\n\n\n \n if f is None:\n f=sys._getframe().f_back.f_back.f_back.f_back\n while f is not None:\n yield f,f.f_lineno\n f=f.f_back\n \n \ndef walk_tb(tb):\n ''\n\n\n\n \n while tb is not None:\n yield tb.tb_frame,tb.tb_lineno\n tb=tb.tb_next\n \n \ndef _walk_tb_with_full_positions(tb):\n\n\n while tb is not None:\n positions=_get_code_position(tb.tb_frame.f_code,tb.tb_lasti)\n \n \n if positions[0]is None:\n yield tb.tb_frame,(tb.tb_lineno,)+positions[1:]\n else:\n yield tb.tb_frame,positions\n tb=tb.tb_next\n \n \ndef _get_code_position(code,instruction_index):\n if instruction_index <0:\n return(None,None,None,None)\n positions_gen=code.co_positions()\n return next(itertools.islice(positions_gen,instruction_index //2,None))\n \n \n_RECURSIVE_CUTOFF=3\n\nclass StackSummary(list):\n ''\n \n @classmethod\n def extract(klass,frame_gen,*,limit=None,lookup_lines=True,\n capture_locals=False):\n ''\n\n\n\n\n\n\n\n\n\n \n def extended_frame_gen():\n for f,lineno in frame_gen:\n yield f,(lineno,None,None,None)\n \n return klass._extract_from_extended_frame_gen(\n extended_frame_gen(),limit=limit,lookup_lines=lookup_lines,\n capture_locals=capture_locals)\n \n @classmethod\n def _extract_from_extended_frame_gen(klass,frame_gen,*,limit=None,\n lookup_lines=True,capture_locals=False):\n \n \n \n \n if limit is None:\n limit=getattr(sys,'tracebacklimit',None)\n if limit is not None and limit <0:\n limit=0\n if limit is not None:\n if limit >=0:\n frame_gen=itertools.islice(frame_gen,limit)\n else:\n frame_gen=collections.deque(frame_gen,maxlen=-limit)\n \n result=klass()\n fnames=set()\n for f,(lineno,end_lineno,colno,end_colno)in frame_gen:\n co=f.f_code\n filename=co.co_filename\n name=co.co_name\n \n fnames.add(filename)\n linecache.lazycache(filename,f.f_globals)\n \n if capture_locals:\n f_locals=f.f_locals\n else:\n f_locals=None\n result.append(FrameSummary(\n filename,lineno,name,lookup_line=False,locals=f_locals,\n end_lineno=end_lineno,colno=colno,end_colno=end_colno))\n for filename in fnames:\n linecache.checkcache(filename)\n \n if lookup_lines:\n for f in result:\n f.line\n return result\n \n @classmethod\n def from_list(klass,a_list):\n ''\n\n\n \n \n \n \n \n result=StackSummary()\n for frame in a_list:\n if isinstance(frame,FrameSummary):\n result.append(frame)\n else:\n filename,lineno,name,line=frame\n result.append(FrameSummary(filename,lineno,name,line=line))\n return result\n \n def format_frame_summary(self,frame_summary):\n ''\n\n\n\n \n row=[]\n row.append(' File \"{}\", line {}, in {}\\n'.format(\n frame_summary.filename,frame_summary.lineno,frame_summary.name))\n if frame_summary.line:\n stripped_line=frame_summary.line.strip()\n row.append(' {}\\n'.format(stripped_line))\n \n orig_line_len=len(frame_summary._original_line)\n frame_line_len=len(frame_summary.line.lstrip())\n stripped_characters=orig_line_len -frame_line_len\n if(\n frame_summary.colno is not None\n and frame_summary.end_colno is not None\n ):\n start_offset=_byte_offset_to_character_offset(\n frame_summary._original_line,frame_summary.colno)+1\n end_offset=_byte_offset_to_character_offset(\n frame_summary._original_line,frame_summary.end_colno)+1\n \n anchors=None\n if frame_summary.lineno ==frame_summary.end_lineno:\n with suppress(Exception):\n anchors=_extract_caret_anchors_from_line_segment(\n frame_summary._original_line[start_offset -1:end_offset -1]\n )\n else:\n end_offset=stripped_characters+len(stripped_line)\n \n \n if end_offset -start_offset 0):\n row.append(' ')\n row.append(' '*(start_offset -stripped_characters))\n \n if anchors:\n row.append(anchors.primary_char *(anchors.left_end_offset))\n row.append(anchors.secondary_char *(anchors.right_start_offset -anchors.left_end_offset))\n row.append(anchors.primary_char *(end_offset -start_offset -anchors.right_start_offset))\n else:\n row.append('^'*(end_offset -start_offset))\n \n row.append('\\n')\n \n if frame_summary.locals:\n for name,value in sorted(frame_summary.locals.items()):\n row.append(' {name} = {value}\\n'.format(name=name,value=value))\n \n return ''.join(row)\n \n def format(self):\n ''\n\n\n\n\n\n\n\n\n\n \n result=[]\n last_file=None\n last_line=None\n last_name=None\n count=0\n for frame_summary in self:\n formatted_frame=self.format_frame_summary(frame_summary)\n if formatted_frame is None:\n continue\n if(last_file is None or last_file !=frame_summary.filename or\n last_line is None or last_line !=frame_summary.lineno or\n last_name is None or last_name !=frame_summary.name):\n if count >_RECURSIVE_CUTOFF:\n count -=_RECURSIVE_CUTOFF\n result.append(\n f' [Previous line repeated {count} more '\n f'time{\"s\"if count >1 else \"\"}]\\n'\n )\n last_file=frame_summary.filename\n last_line=frame_summary.lineno\n last_name=frame_summary.name\n count=0\n count +=1\n if count >_RECURSIVE_CUTOFF:\n continue\n result.append(formatted_frame)\n \n if count >_RECURSIVE_CUTOFF:\n count -=_RECURSIVE_CUTOFF\n result.append(\n f' [Previous line repeated {count} more '\n f'time{\"s\"if count >1 else \"\"}]\\n'\n )\n return result\n \n \ndef _byte_offset_to_character_offset(str,offset):\n as_utf8=str.encode('utf-8')\n return len(as_utf8[:offset].decode(\"utf-8\",errors=\"replace\"))\n \n \n_Anchors=collections.namedtuple(\n\"_Anchors\",\n[\n\"left_end_offset\",\n\"right_start_offset\",\n\"primary_char\",\n\"secondary_char\",\n],\ndefaults=[\"~\",\"^\"]\n)\n\ndef _extract_caret_anchors_from_line_segment(segment):\n import ast\n \n try:\n tree=ast.parse(segment)\n except SyntaxError:\n return None\n \n if len(tree.body)!=1:\n return None\n \n normalize=lambda offset:_byte_offset_to_character_offset(segment,offset)\n statement=tree.body[0]\n match statement:\n case ast.Expr(expr):\n match expr:\n case ast.BinOp():\n operator_start=normalize(expr.left.end_col_offset)\n operator_end=normalize(expr.right.col_offset)\n operator_str=segment[operator_start:operator_end]\n operator_offset=len(operator_str)-len(operator_str.lstrip())\n \n left_anchor=expr.left.end_col_offset+operator_offset\n right_anchor=left_anchor+1\n if(\n operator_offset+1 \"\n stype=smod+'.'+stype\n \n if not issubclass(self.exc_type,SyntaxError):\n yield _format_final_exc_line(stype,self._str)\n else:\n yield from self._format_syntax_error(stype)\n \n if(\n isinstance(self.__notes__,collections.abc.Sequence)\n and not isinstance(self.__notes__,(str,bytes))\n ):\n for note in self.__notes__:\n note=_safe_string(note,'note')\n yield from[l+'\\n'for l in note.split('\\n')]\n elif self.__notes__ is not None:\n yield \"{}\\n\".format(_safe_string(self.__notes__,'__notes__',func=repr))\n \n def _format_syntax_error(self,stype):\n ''\n \n filename_suffix=''\n if self.lineno is not None:\n yield ' File \"{}\", line {}\\n'.format(\n self.filename or \"\",self.lineno)\n elif self.filename is not None:\n filename_suffix=' ({})'.format(self.filename)\n \n text=self.text\n if text is not None:\n \n \n \n rtext=text.rstrip('\\n')\n ltext=rtext.lstrip(' \\n\\f')\n spaces=len(rtext)-len(ltext)\n yield ' {}\\n'.format(ltext)\n \n if self.offset is not None:\n offset=self.offset\n end_offset=self.end_offset if self.end_offset not in{None,0}else offset\n if offset ==end_offset or end_offset ==-1:\n end_offset=offset+1\n \n \n colno=offset -1 -spaces\n end_colno=end_offset -1 -spaces\n if colno >=0:\n \n caretspace=((c if c.isspace()else ' ')for c in ltext[:colno])\n yield ' {}{}'.format(\"\".join(caretspace),('^'*(end_colno -colno)+\"\\n\"))\n msg=self.msg or \"\"\n yield \"{}: {}{}\\n\".format(stype,msg,filename_suffix)\n \n def format(self,*,chain=True,_ctx=None):\n ''\n\n\n\n\n\n\n\n\n\n \n \n if _ctx is None:\n _ctx=_ExceptionPrintContext()\n \n output=[]\n exc=self\n if chain:\n while exc:\n if exc.__cause__ is not None:\n chained_msg=_cause_message\n chained_exc=exc.__cause__\n elif(exc.__context__ is not None and\n not exc.__suppress_context__):\n chained_msg=_context_message\n chained_exc=exc.__context__\n else:\n chained_msg=None\n chained_exc=None\n \n output.append((chained_msg,exc))\n exc=chained_exc\n else:\n output.append((None,exc))\n \n for msg,exc in reversed(output):\n if msg is not None:\n yield from _ctx.emit(msg)\n if exc.exceptions is None:\n if exc.stack:\n yield from _ctx.emit('Traceback (most recent call last):\\n')\n yield from _ctx.emit(exc.stack.format())\n yield from _ctx.emit(exc.format_exception_only())\n elif _ctx.exception_group_depth >self.max_group_depth:\n \n yield from _ctx.emit(\n f\"... (max_group_depth is {self.max_group_depth})\\n\")\n else:\n \n is_toplevel=(_ctx.exception_group_depth ==0)\n if is_toplevel:\n _ctx.exception_group_depth +=1\n \n if exc.stack:\n yield from _ctx.emit(\n 'Exception Group Traceback (most recent call last):\\n',\n margin_char='+'if is_toplevel else None)\n yield from _ctx.emit(exc.stack.format())\n \n yield from _ctx.emit(exc.format_exception_only())\n num_excs=len(exc.exceptions)\n if num_excs <=self.max_group_width:\n n=num_excs\n else:\n n=self.max_group_width+1\n _ctx.need_close=False\n for i in range(n):\n last_exc=(i ==n -1)\n if last_exc:\n \n _ctx.need_close=True\n \n if self.max_group_width is not None:\n truncated=(i >=self.max_group_width)\n else:\n truncated=False\n title=f'{i+1}'if not truncated else '...'\n yield(_ctx.indent()+\n ('+-'if i ==0 else ' ')+\n f'+---------------- {title} ----------------\\n')\n _ctx.exception_group_depth +=1\n if not truncated:\n yield from exc.exceptions[i].format(chain=chain,_ctx=_ctx)\n else:\n remaining=num_excs -self.max_group_width\n plural='s'if remaining >1 else ''\n yield from _ctx.emit(\n f\"and {remaining} more exception{plural}\\n\")\n \n if last_exc and _ctx.need_close:\n yield(_ctx.indent()+\n \"+------------------------------------\\n\")\n _ctx.need_close=False\n _ctx.exception_group_depth -=1\n \n if is_toplevel:\n assert _ctx.exception_group_depth ==1\n _ctx.exception_group_depth=0\n \n \n def print(self,*,file=None,chain=True):\n ''\n if file is None:\n file=sys.stderr\n for line in self.format(chain=chain):\n print(line,file=file,end=\"\")\n \n \n_MAX_CANDIDATE_ITEMS=750\n_MAX_STRING_SIZE=40\n_MOVE_COST=2\n_CASE_COST=1\n\n\ndef _substitution_cost(ch_a,ch_b):\n if ch_a ==ch_b:\n return 0\n if ch_a.lower()==ch_b.lower():\n return _CASE_COST\n return _MOVE_COST\n \n \ndef _compute_suggestion_error(exc_value,tb,wrong_name):\n if wrong_name is None or not isinstance(wrong_name,str):\n return None\n if isinstance(exc_value,AttributeError):\n obj=exc_value.obj\n try:\n d=dir(obj)\n except Exception:\n return None\n elif isinstance(exc_value,ImportError):\n try:\n mod=__import__(exc_value.name)\n d=dir(mod)\n except Exception:\n return None\n else:\n assert isinstance(exc_value,NameError)\n \n if tb is None:\n return None\n while tb.tb_next is not None:\n tb=tb.tb_next\n frame=tb.tb_frame\n d=(\n list(frame.f_locals)\n +list(frame.f_globals)\n +list(frame.f_builtins)\n )\n \n \n \n if 'self'in frame.f_locals:\n self=frame.f_locals['self']\n if hasattr(self,wrong_name):\n return f\"self.{wrong_name}\"\n \n \n \n if len(d)>_MAX_CANDIDATE_ITEMS:\n return None\n wrong_name_len=len(wrong_name)\n if wrong_name_len >_MAX_STRING_SIZE:\n return None\n best_distance=wrong_name_len\n suggestion=None\n for possible_name in d:\n if possible_name ==wrong_name:\n \n continue\n \n max_distance=(len(possible_name)+wrong_name_len+3)*_MOVE_COST //6\n \n max_distance=min(max_distance,best_distance -1)\n current_distance=_levenshtein_distance(wrong_name,possible_name,max_distance)\n if current_distance >max_distance:\n continue\n if not suggestion or current_distance _MAX_STRING_SIZE or len(b)>_MAX_STRING_SIZE:\n return max_cost+1\n \n \n if len(b)max_cost:\n return max_cost+1\n \n \n \n \n row=list(range(_MOVE_COST,_MOVE_COST *(len(a)+1),_MOVE_COST))\n \n result=0\n for bindex in range(len(b)):\n bchar=b[bindex]\n distance=result=bindex *_MOVE_COST\n minimum=sys.maxsize\n for index in range(len(a)):\n \n substitute=distance+_substitution_cost(bchar,a[index])\n \n distance=row[index]\n \n \n insert_delete=min(result,distance)+_MOVE_COST\n result=min(insert_delete,substitute)\n \n \n row[index]=result\n if result max_cost:\n \n return max_cost+1\n return result\n", ["ast", "collections.abc", "contextlib", "itertools", "linecache", "sys", "textwrap"]], "turtle": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport math\nimport sys\n\nfrom math import cos,sin\n\nfrom browser import console,document,html,timer\nimport _svg as svg\n\n\n\n\n\n\n_CFG={\n\n\n\"canvwidth\":500,\n\"canvheight\":500,\n\n\n\"mode\":\"standard\",\n\n\n\n\"shape\":\"classic\",\n\"pencolor\":\"black\",\n\"fillcolor\":\"black\",\n\n\"visible\":True ,\n\n\n\n\n\n\n\n\"turtle_canvas_wrapper\":None ,\n\"turtle_canvas_id\":\"turtle-canvas\",\n\"min_duration\":\"1ms\"\n}\n\n_cfg_copy=_CFG.copy()\n\n\ndef set_defaults(**params):\n ''\n _CFG.update(**params)\n Screen().reset()\n \n \nclass FormattedTuple(tuple):\n ''\n def __new__(cls,x,y):\n return tuple.__new__(cls,(x,y))\n def __repr__(self):\n return \"(%.2f, %.2f)\"%self\n \ndef create_circle(r):\n ''\n circle=svg.circle(x=0,y=0,r=r,stroke=\"black\",fill=\"black\")\n circle.setAttribute(\"stroke-width\",1)\n return circle\n \n \ndef create_polygon(points):\n ''\n points=[\"%s,%s \"%(x,y)for x,y in points]\n polygon=svg.polygon(points=points,stroke=\"black\",fill=\"black\")\n polygon.setAttribute(\"stroke-width\",1)\n return polygon\n \n \ndef create_rectangle(width=2,height=2,rx=None ,ry=None ):\n ''\n \n rectangle=svg.rect(x=-width /2,y=-height /2,width=width,\n height=height,stroke=\"black\",fill=\"black\")\n rectangle.setAttribute(\"stroke-width\",1)\n if rx is not None :\n rectangle.setAttribute(\"rx\",rx)\n if ry is not None :\n rectangle.setAttribute(\"ry\",ry)\n return rectangle\n \n \ndef create_square(size=2,r=None ):\n ''\n \n return create_rectangle(width=size,height=size,rx=r,ry=r)\n \n \nclass TurtleGraphicsError(Exception):\n ''\n \n pass\n \n \nclass Singleton(type):\n _instances={}\n def __call__(cls,*args,**kwargs):\n if cls not in cls._instances:\n cls._instances[cls]=super(Singleton,cls).__call__(*args,**kwargs)\n return cls._instances[cls]\n \n \nclass Screen(metaclass=Singleton):\n\n def __init__(self):\n self.shapes={\n 'arrow':(create_polygon,((-10,0),(10,0),(0,10))),\n 'turtle':(create_polygon,((0,16),(-2,14),(-1,10),(-4,7),\n (-7,9),(-9,8),(-6,5),(-7,1),(-5,-3),(-8,-6),\n (-6,-8),(-4,-5),(0,-7),(4,-5),(6,-8),(8,-6),\n (5,-3),(7,1),(6,5),(9,8),(7,9),(4,7),(1,10),\n (2,14))),\n 'classic':(create_polygon,((0,0),(-5,-9),(0,-7),(5,-9))),\n 'triangle':(create_polygon,((10,-5.77),(0,11.55),(-10,-5.77))),\n 'square':(create_square,20),\n 'circle':(create_circle,10)\n }\n self.reset()\n self._set_geometry()\n \n def bgcolor(self,color=None ):\n ''\n\n \n if color is None :\n return self.background_color\n self.background_color=color\n width=_CFG['canvwidth']\n height=_CFG['canvheight']\n if self.mode()in ['logo','standard']:\n x=-width //2\n y=-height //2\n else :\n x=0\n y=-height\n \n self.frame_index +=1\n rect=svg.rect(x=x,y=y,width=width,height=height,fill=color,\n style={'display':'none'})\n an=svg.animate(Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"display\",attributeType=\"CSS\",\n From=\"block\",to=\"block\",\n dur=_CFG[\"min_duration\"],fill='freeze')\n an.setAttribute('begin',\"animation_frame%s.end\"%(self.frame_index -1))\n rect <=an\n \n self.background_canvas <=rect\n \n def _convert_coordinates(self,x,y):\n ''\n\n\n\n\n\n \n return x *self.yscale,self.y_points_down *y *self.yscale\n \n \n def create_svg_turtle(self,_turtle,name):\n if name in self.shapes:\n fn=self.shapes[name][0]\n arg=self.shapes[name][1]\n else :\n print(\"Unknown turtle '%s'; the default turtle will be used\")\n fn=self.shapes[_CVG[\"shape\"]][0]\n arg=self.shapes[_CVG[\"shape\"]][1]\n shape=fn(arg)\n if self._mode =='standard'or self._mode =='world':\n rotation=-90\n else :\n rotation=0\n return shape,rotation\n \n def _dot(self,pos,size,color):\n ''\n if color is None :\n color='black'\n if size is None or size <1:\n size=1\n self.frame_index +=1\n \n \n radius=size /2\n \n x,y=self._convert_coordinates(pos[0],pos[1])\n \n circle=svg.circle(cx=x,cy=y,r=radius,fill=color,\n style={'display':'none'})\n an=svg.animate(Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"display\",attributeType=\"CSS\",\n From=\"block\",to=\"block\",\n dur=_CFG[\"min_duration\"],fill='freeze')\n an.setAttribute('begin',\"animation_frame%s.end\"%(self.frame_index -1))\n circle <=an\n self.canvas <=circle\n \n def _drawline(self,_turtle,coordlist=None ,\n color=None ,width=1,speed=None ):\n ''\n\n\n\n\n \n \n outline=color[0]\n fill=color[1]\n \n x0,y0=coordlist[0]\n x1,y1=coordlist[1]\n \n x0,y0=self._convert_coordinates(x0,y0)\n x1,y1=self._convert_coordinates(x1,y1)\n \n \n if speed ==0:\n duration=_CFG[\"min_duration\"]\n else :\n dist=_turtle._distance\n if speed is None or speed ==1:\n duration=0.02 *dist\n else :\n duration=0.02 *dist /speed **1.2\n if duration <0.001:\n duration=_CFG[\"min_duration\"]\n else :\n duration=\"%6.3fs\"%duration\n \n drawing=_turtle._drawing\n \n _line=svg.line(x1=x0,y1=y0,x2=x0,y2=y0,\n style={'stroke':outline,'stroke-width':width})\n if not drawing:\n _line.setAttribute('opacity',0)\n \n \n begin=\"animation_frame%s.end\"%self.frame_index\n self.frame_index +=1\n _an1=svg.animate(Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"x2\",attributeType=\"XML\",\n From=x0,to=x1,dur=duration,fill='freeze',\n begin=begin)\n _line <=_an1\n \n \n if drawing:\n _an2=svg.animate(attributeName=\"y2\",attributeType=\"XML\",\n begin=begin,\n From=y0,to=y1,dur=duration,fill='freeze')\n _line <=_an2\n \n if width >2:\n _line_cap=svg.set(attributeName=\"stroke-linecap\",\n begin=begin,\n attributeType=\"xml\",to=\"round\",dur=duration,fill='freeze')\n _line <=_line_cap\n \n self.canvas <=_line\n return begin,duration,(x0,y0),(x1,y1)\n \n def _drawpoly(self,coordlist,outline=None ,fill=None ,width=None ):\n ''\n\n\n\n\n \n self.frame_index +=1\n shape=[\"%s,%s\"%self._convert_coordinates(x,y)for x,y in coordlist]\n \n style={'display':'none'}\n if fill is not None :\n style['fill']=fill\n if outline is not None :\n style['stroke']=outline\n if width is not None :\n style['stroke-width']=width\n else :\n style['stroke-width']=1\n \n polygon=svg.polygon(points=\" \".join(shape),style=style)\n \n an=svg.animate(Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"display\",attributeType=\"CSS\",\n From=\"block\",to=\"block\",\n dur=_CFG[\"min_duration\"],fill='freeze')\n \n an.setAttribute('begin',\"animation_frame%s.end\"%(self.frame_index -1))\n polygon <=an\n self.canvas <=polygon\n \n \n def _new_frame(self):\n ''\n \n previous_end=\"animation_frame%s.end\"%self.frame_index\n self.frame_index +=1\n new_frame_id=\"animation_frame%s\"%self.frame_index\n return previous_end,new_frame_id\n \n def mode(self,_mode=None ):\n if _mode is None :\n return self._mode\n _CFG['mode']=_mode\n self.reset()\n \n \n def reset(self):\n self._turtles=[]\n self.frame_index=0\n self.background_color=\"white\"\n self._set_geometry()\n \n def _set_geometry(self):\n self.width=_CFG[\"canvwidth\"]\n self.height=_CFG[\"canvheight\"]\n self.x_offset=self.y_offset=0\n self.xscale=self.yscale=1\n \n self.y_points_down=-1\n self._mode=_CFG[\"mode\"].lower()\n if self._mode in ['logo','standard']:\n self.translate_canvas=(self.width //2,self.height //2)\n elif self._mode =='world':\n self.translate_canvas=(0,self.height)\n self._setup_canvas()\n \n def _setup_canvas(self):\n self.svg_scene=svg.svg(Id=_CFG[\"turtle_canvas_id\"],width=self.width,\n height=self.height)\n translate=\"translate(%d %d)\"%self.translate_canvas\n \n \n self.svg_scene <=svg.animate(\n Id=\"animation_frame%s\"%self.frame_index,\n attributeName=\"width\",attributeType=\"CSS\",\n From=self.width,to=self.width,begin=\"0s\",\n dur=_CFG[\"min_duration\"],fill='freeze')\n \n \n \n \n self.background_canvas=svg.g(transform=translate)\n self.canvas=svg.g(transform=translate)\n self.writing_canvas=svg.g(transform=translate)\n self.turtle_canvas=svg.g(transform=translate)\n \n self.svg_scene <=self.background_canvas\n self.svg_scene <=self.canvas\n self.svg_scene <=self.writing_canvas\n self.svg_scene <=self.turtle_canvas\n \n \n def setworldcoordinates(self,llx,lly,urx,ury):\n ''\n\n\n\n\n\n\n\n\n\n\n \n self._mode=\"world\"\n \n if urx 2:\n self.screen._drawpoly(self._fillpath,outline=self._pencolor,\n fill=self._fillcolor,)\n else :\n print(\"No path to fill.\")\n self._fillpath=None\n \n def dot(self,size=None ,color=None ):\n ''\n \n if size is None :\n size=max(self._pensize+4,2 *self._pensize)\n if color is None :\n color=self._pencolor\n item=self.screen._dot((self._x,self._y),size,color=color)\n \n def _write(self,txt,align,font,color=None ):\n ''\n \n if color is None :\n color=self._pencolor\n self.screen._write((self._x,self._y),txt,align,font,color)\n \n \n def write(self,arg,align=\"left\",font=(\"Arial\",8,\"normal\"),color=None ):\n ''\n\n\n\n\n\n\n \n self._write(str(arg),align.lower(),font,color=color)\n \n def begin_poly(self):\n ''\n \n self._poly=[(self._x,self._y)]\n self._creatingPoly=True\n \n def end_poly(self):\n ''\n \n self._creatingPoly=False\n \n def get_poly(self):\n ''\n \n \n if self._poly is not None :\n return tuple(self._poly)\n \n def getscreen(self):\n ''\n \n return self.screen\n \n def getturtle(self):\n ''\n\n\n \n return self\n getpen=getturtle\n \n def _make_copy(self,name=None ):\n ''\n\n \n \n if name is None :\n name=self.name\n \n \n \n \n \n _turtle,rotation=self.screen.create_svg_turtle(self,name=name)\n _turtle.setAttribute(\"opacity\",0)\n _turtle.setAttribute(\"fill\",self._fillcolor)\n _turtle.setAttribute(\"stroke\",self._pencolor)\n \n \n \n previous_end,new_frame_id=self.screen._new_frame()\n x,y=self.screen._convert_coordinates(self._x,self._y)\n _turtle <=svg.animateMotion(begin=previous_end,dur=_CFG[\"min_duration\"],\n fill=\"remove\")\n \n _turtle <=svg.animateMotion(Id=new_frame_id,\n From=\"%s,%s\"%(x,y),to=\"%s,%s\"%(x,y),\n dur=_CFG[\"min_duration\"],begin=previous_end,\n fill=\"freeze\")\n _turtle <=svg.animateTransform(attributeName=\"transform\",\n type=\"rotate\",\n From=\"%s,%s,%s\"%(self._old_heading,0,0),\n to=\"%s,%s,%s\"%(self._old_heading,0,0),\n begin=previous_end,\n dur=_CFG[\"min_duration\"],fill=\"freeze\")\n _turtle <=svg.animate(begin=previous_end,\n dur=_CFG[\"min_duration\"],fill=\"freeze\",\n attributeName=\"opacity\",attributeType=\"XML\",\n From=0,to=1)\n return _turtle\n \n def stamp(self):\n ''\n \n _turtle=self._make_copy(name=self.name)\n self.screen.canvas <=_turtle\n \n \n def clone(self):\n ''\n \n n=Turtle(self.name)\n \n attrs=vars(self)\n new_dict={}\n for attr in attrs:\n if isinstance(getattr(self,attr),(int,str,float)):\n new_dict[attr]=getattr(self,attr)\n n.__dict__.update(**new_dict)\n \n if not n._shown:\n n._shown=True\n n.hideturtle()\n n.left(0)\n n.fd(0)\n n.color(n.color())\n return n\n \n \nPen=Turtle\n\n\ndef done():\n Screen().show_scene()\nshow_scene=done\n\n\ndef replay_scene():\n ''\n if (_CFG[\"turtle_canvas_id\"]in document and\n document[_CFG[\"turtle_canvas_id\"]]is not None ):\n element=document[_CFG[\"turtle_canvas_id\"]]\n element.parentNode.removeChild(element)\n show_scene()\n \n \ndef restart():\n ''\n _CFG.update(_cfg_copy)\n Screen().reset()\n Turtle._pen=None\n \n if (_CFG[\"turtle_canvas_id\"]in document and\n document[_CFG[\"turtle_canvas_id\"]]is not None ):\n element=document[_CFG[\"turtle_canvas_id\"]]\n element.parentNode.removeChild(element)\n \n \n \n_tg_screen_functions=['addshape','bgcolor','bgpic','bye',\n'clearscreen','colormode','delay','exitonclick','getcanvas',\n'getshapes','listen','mainloop','mode','numinput',\n'onkey','onkeypress','onkeyrelease','onscreenclick','ontimer',\n'register_shape','resetscreen','screensize','setup',\n'setworldcoordinates','textinput','title','tracer','turtles','update',\n'window_height','window_width']\n\n_tg_turtle_functions=['back','backward','begin_fill','begin_poly','bk',\n'circle','clear','clearstamp','clearstamps','clone','color',\n'degrees','distance','dot','down','end_fill','end_poly','fd',\n'fillcolor','filling','forward','get_poly','getpen','getscreen','get_shapepoly',\n'getturtle','goto','heading','hideturtle','home','ht','isdown',\n'isvisible','left','lt','onclick','ondrag','onrelease','pd',\n'pen','pencolor','pendown','pensize','penup','pos','position',\n'pu','radians','right','reset','resizemode','rt',\n'seth','setheading','setpos','setposition','settiltangle',\n'setundobuffer','setx','sety','shape','shapesize','shapetransform','shearfactor','showturtle',\n'speed','st','stamp','tilt','tiltangle','towards',\n'turtlesize','undo','undobufferentries','up','width',\n'write','xcor','ycor']\n\n\n__all__=(_tg_screen_functions+_tg_turtle_functions+\n['done','restart','replay_scene','Turtle','Screen'])\n\n\n\n\n\n__func_body=\"\"\"\\\ndef {name}(*args, **kw):\n if {obj} is None:\n {obj} = {init}\n return {obj}.{name}(*args, **kw)\n\"\"\"\n\ndef _make_global_funcs(functions,cls,obj,init):\n for methodname in functions:\n try :\n method=getattr(cls,methodname)\n except AttributeError:\n print(\"methodname missing:\",methodname)\n continue\n defstr=__func_body.format(obj=obj,init=init,name=methodname)\n exec(defstr,globals())\n \n_make_global_funcs(_tg_turtle_functions,Turtle,'Turtle._pen','Turtle()')\n\n_make_global_funcs(_tg_screen_functions,Screen,'Turtle.screen','Screen()')\n", ["_svg", "browser", "browser.timer", "math", "sys"]], "types": [".py", "''\n\n\nimport sys\n\n\n\n\n\n\ndef _f():pass\nFunctionType=type(_f)\nLambdaType=type(lambda:None)\nCodeType=type(_f.__code__)\nMappingProxyType=type(type.__dict__)\nSimpleNamespace=type(sys.implementation)\n\ndef _cell_factory():\n a=1\n def f():\n nonlocal a\n return f.__closure__[0]\nCellType=type(_cell_factory())\n\ndef _g():\n yield 1\nGeneratorType=type(_g())\n\nasync def _c():pass\n_c=_c()\nCoroutineType=type(_c)\n_c.close()\n\nasync def _ag():\n yield\n_ag=_ag()\nAsyncGeneratorType=type(_ag)\n\nclass _C:\n def _m(self):pass\nMethodType=type(_C()._m)\n\nBuiltinFunctionType=type(len)\nBuiltinMethodType=type([].append)\n\nWrapperDescriptorType=type(object.__init__)\nMethodWrapperType=type(object().__str__)\nMethodDescriptorType=type(str.join)\nClassMethodDescriptorType=type(dict.__dict__['fromkeys'])\n\nModuleType=type(sys)\n\ntry:\n raise TypeError\nexcept TypeError as exc:\n TracebackType=type(exc.__traceback__)\n FrameType=type(exc.__traceback__.tb_frame)\n \nGetSetDescriptorType=type(FunctionType.__code__)\nMemberDescriptorType=type(FunctionType.__globals__)\n\ndel sys,_f,_g,_C,_c,_ag,_cell_factory\n\n\n\ndef new_class(name,bases=(),kwds=None,exec_body=None):\n ''\n resolved_bases=resolve_bases(bases)\n meta,ns,kwds=prepare_class(name,resolved_bases,kwds)\n if exec_body is not None:\n exec_body(ns)\n if resolved_bases is not bases:\n ns['__orig_bases__']=bases\n return meta(name,resolved_bases,ns,**kwds)\n \ndef resolve_bases(bases):\n ''\n new_bases=list(bases)\n updated=False\n shift=0\n for i,base in enumerate(bases):\n if isinstance(base,type):\n continue\n if not hasattr(base,\"__mro_entries__\"):\n continue\n new_base=base.__mro_entries__(bases)\n updated=True\n if not isinstance(new_base,tuple):\n raise TypeError(\"__mro_entries__ must return a tuple\")\n else:\n new_bases[i+shift:i+shift+1]=new_base\n shift +=len(new_base)-1\n if not updated:\n return bases\n return tuple(new_bases)\n \ndef prepare_class(name,bases=(),kwds=None):\n ''\n\n\n\n\n\n\n\n\n \n if kwds is None:\n kwds={}\n else:\n kwds=dict(kwds)\n if 'metaclass'in kwds:\n meta=kwds.pop('metaclass')\n else:\n if bases:\n meta=type(bases[0])\n else:\n meta=type\n if isinstance(meta,type):\n \n \n meta=_calculate_meta(meta,bases)\n if hasattr(meta,'__prepare__'):\n ns=meta.__prepare__(name,bases,**kwds)\n else:\n ns={}\n return meta,ns,kwds\n \ndef _calculate_meta(meta,bases):\n ''\n winner=meta\n for base in bases:\n base_meta=type(base)\n if issubclass(winner,base_meta):\n continue\n if issubclass(base_meta,winner):\n winner=base_meta\n continue\n \n raise TypeError(\"metaclass conflict: \"\n \"the metaclass of a derived class \"\n \"must be a (non-strict) subclass \"\n \"of the metaclasses of all its bases\")\n return winner\n \n \ndef get_original_bases(cls,/):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n return cls.__orig_bases__\n except AttributeError:\n try:\n return cls.__bases__\n except AttributeError:\n raise TypeError(\n f'Expected an instance of type, not {type(cls).__name__ !r}'\n )from None\n \n \nclass DynamicClassAttribute:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,fget=None,fset=None,fdel=None,doc=None):\n self.fget=fget\n self.fset=fset\n self.fdel=fdel\n \n self.__doc__=doc or fget.__doc__\n self.overwrite_doc=doc is None\n \n self.__isabstractmethod__=bool(getattr(fget,'__isabstractmethod__',False))\n \n def __get__(self,instance,ownerclass=None):\n if instance is None:\n if self.__isabstractmethod__:\n return self\n raise AttributeError()\n elif self.fget is None:\n raise AttributeError(\"unreadable attribute\")\n return self.fget(instance)\n \n def __set__(self,instance,value):\n if self.fset is None:\n raise AttributeError(\"can't set attribute\")\n self.fset(instance,value)\n \n def __delete__(self,instance):\n if self.fdel is None:\n raise AttributeError(\"can't delete attribute\")\n self.fdel(instance)\n \n def getter(self,fget):\n fdoc=fget.__doc__ if self.overwrite_doc else None\n result=type(self)(fget,self.fset,self.fdel,fdoc or self.__doc__)\n result.overwrite_doc=self.overwrite_doc\n return result\n \n def setter(self,fset):\n result=type(self)(self.fget,fset,self.fdel,self.__doc__)\n result.overwrite_doc=self.overwrite_doc\n return result\n \n def deleter(self,fdel):\n result=type(self)(self.fget,self.fset,fdel,self.__doc__)\n result.overwrite_doc=self.overwrite_doc\n return result\n \n \nclass _GeneratorWrapper:\n\n def __init__(self,gen):\n self.__wrapped=gen\n self.__isgen=gen.__class__ is GeneratorType\n self.__name__=getattr(gen,'__name__',None)\n self.__qualname__=getattr(gen,'__qualname__',None)\n def send(self,val):\n return self.__wrapped.send(val)\n def throw(self,tp,*rest):\n return self.__wrapped.throw(tp,*rest)\n def close(self):\n return self.__wrapped.close()\n @property\n def gi_code(self):\n return self.__wrapped.gi_code\n @property\n def gi_frame(self):\n return self.__wrapped.gi_frame\n @property\n def gi_running(self):\n return self.__wrapped.gi_running\n @property\n def gi_yieldfrom(self):\n return self.__wrapped.gi_yieldfrom\n cr_code=gi_code\n cr_frame=gi_frame\n cr_running=gi_running\n cr_await=gi_yieldfrom\n def __next__(self):\n return next(self.__wrapped)\n def __iter__(self):\n if self.__isgen:\n return self.__wrapped\n return self\n __await__=__iter__\n \ndef coroutine(func):\n ''\n \n if not callable(func):\n raise TypeError('types.coroutine() expects a callable')\n \n if(func.__class__ is FunctionType and\n getattr(func,'__code__',None).__class__ is CodeType):\n \n co_flags=func.__code__.co_flags\n \n \n \n if co_flags&0x180:\n return func\n \n \n \n if co_flags&0x20:\n \n co=func.__code__\n \n func.__code__=co.replace(co_flags=co.co_flags |0x100)\n return func\n \n \n \n \n \n \n import functools\n import _collections_abc\n @functools.wraps(func)\n def wrapped(*args,**kwargs):\n coro=func(*args,**kwargs)\n if(coro.__class__ is CoroutineType or\n coro.__class__ is GeneratorType and coro.gi_code.co_flags&0x100):\n \n return coro\n if(isinstance(coro,_collections_abc.Generator)and\n not isinstance(coro,_collections_abc.Coroutine)):\n \n \n \n return _GeneratorWrapper(coro)\n \n \n return coro\n \n return wrapped\n \nGenericAlias=type(list[int])\nUnionType=type(int |str)\n\nEllipsisType=type(Ellipsis)\nNoneType=type(None)\nNotImplementedType=type(NotImplemented)\n\n__all__=[n for n in globals()if n[:1]!='_']\n", ["_collections_abc", "functools", "sys"]], "typing": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfrom abc import abstractmethod,ABCMeta\nimport collections\nfrom collections import defaultdict\nimport collections.abc\nimport copyreg\nimport contextlib\nimport functools\nimport operator\nimport re as stdlib_re\nimport sys\nimport types\nimport warnings\nfrom types import WrapperDescriptorType,MethodWrapperType,MethodDescriptorType,GenericAlias\n\nfrom _typing import(\n_idfunc,\nTypeVar,\nParamSpec,\nTypeVarTuple,\nParamSpecArgs,\nParamSpecKwargs,\nTypeAliasType,\nGeneric,\n)\n\n\n__all__=[\n\n'Annotated',\n'Any',\n'Callable',\n'ClassVar',\n'Concatenate',\n'Final',\n'ForwardRef',\n'Generic',\n'Literal',\n'Optional',\n'ParamSpec',\n'Protocol',\n'Tuple',\n'Type',\n'TypeVar',\n'TypeVarTuple',\n'Union',\n\n\n'AbstractSet',\n'ByteString',\n'Container',\n'ContextManager',\n'Hashable',\n'ItemsView',\n'Iterable',\n'Iterator',\n'KeysView',\n'Mapping',\n'MappingView',\n'MutableMapping',\n'MutableSequence',\n'MutableSet',\n'Sequence',\n'Sized',\n'ValuesView',\n'Awaitable',\n'AsyncIterator',\n'AsyncIterable',\n'Coroutine',\n'Collection',\n'AsyncGenerator',\n'AsyncContextManager',\n\n\n'Reversible',\n'SupportsAbs',\n'SupportsBytes',\n'SupportsComplex',\n'SupportsFloat',\n'SupportsIndex',\n'SupportsInt',\n'SupportsRound',\n\n\n'ChainMap',\n'Counter',\n'Deque',\n'Dict',\n'DefaultDict',\n'List',\n'OrderedDict',\n'Set',\n'FrozenSet',\n'NamedTuple',\n'TypedDict',\n'Generator',\n\n\n'BinaryIO',\n'IO',\n'Match',\n'Pattern',\n'TextIO',\n\n\n'AnyStr',\n'assert_type',\n'assert_never',\n'cast',\n'clear_overloads',\n'dataclass_transform',\n'final',\n'get_args',\n'get_origin',\n'get_overloads',\n'get_type_hints',\n'is_typeddict',\n'LiteralString',\n'Never',\n'NewType',\n'no_type_check',\n'no_type_check_decorator',\n'NoReturn',\n'NotRequired',\n'overload',\n'override',\n'ParamSpecArgs',\n'ParamSpecKwargs',\n'Required',\n'reveal_type',\n'runtime_checkable',\n'Self',\n'Text',\n'TYPE_CHECKING',\n'TypeAlias',\n'TypeGuard',\n'TypeAliasType',\n'Unpack',\n]\n\n\n\n\n\n\ndef _type_convert(arg,module=None,*,allow_special_forms=False):\n ''\n if arg is None:\n return type(None)\n if isinstance(arg,str):\n return ForwardRef(arg,module=module,is_class=allow_special_forms)\n return arg\n \n \ndef _type_check(arg,msg,is_argument=True,module=None,*,allow_special_forms=False):\n ''\n\n\n\n\n\n\n\n\n\n \n invalid_generic_forms=(Generic,Protocol)\n if not allow_special_forms:\n invalid_generic_forms +=(ClassVar,)\n if is_argument:\n invalid_generic_forms +=(Final,)\n \n arg=_type_convert(arg,module=module,allow_special_forms=allow_special_forms)\n if(isinstance(arg,_GenericAlias)and\n arg.__origin__ in invalid_generic_forms):\n raise TypeError(f\"{arg} is not valid as type argument\")\n if arg in(Any,LiteralString,NoReturn,Never,Self,TypeAlias):\n return arg\n if allow_special_forms and arg in(ClassVar,Final):\n return arg\n if isinstance(arg,_SpecialForm)or arg in(Generic,Protocol):\n raise TypeError(f\"Plain {arg} is not valid as type argument\")\n if type(arg)is tuple:\n raise TypeError(f\"{msg} Got {arg !r:.100}.\")\n return arg\n \n \ndef _is_param_expr(arg):\n return arg is ...or isinstance(arg,\n (tuple,list,ParamSpec,_ConcatenateGenericAlias))\n \n \ndef _should_unflatten_callable_args(typ,args):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n return(\n typ.__origin__ is collections.abc.Callable\n and not(len(args)==2 and _is_param_expr(args[0]))\n )\n \n \ndef _type_repr(obj):\n ''\n\n\n\n\n\n \n \n \n \n if isinstance(obj,type):\n if obj.__module__ =='builtins':\n return obj.__qualname__\n return f'{obj.__module__}.{obj.__qualname__}'\n if obj is ...:\n return '...'\n if isinstance(obj,types.FunctionType):\n return obj.__name__\n if isinstance(obj,tuple):\n \n return '['+', '.join(_type_repr(t)for t in obj)+']'\n return repr(obj)\n \n \ndef _collect_parameters(args):\n ''\n\n\n\n\n\n \n parameters=[]\n for t in args:\n if isinstance(t,type):\n \n pass\n elif isinstance(t,tuple):\n \n \n for x in t:\n for collected in _collect_parameters([x]):\n if collected not in parameters:\n parameters.append(collected)\n elif hasattr(t,'__typing_subst__'):\n if t not in parameters:\n parameters.append(t)\n else:\n for x in getattr(t,'__parameters__',()):\n if x not in parameters:\n parameters.append(x)\n return tuple(parameters)\n \n \ndef _check_generic(cls,parameters,elen):\n ''\n\n\n \n if not elen:\n raise TypeError(f\"{cls} is not a generic class\")\n alen=len(parameters)\n if alen !=elen:\n raise TypeError(f\"Too {'many'if alen >elen else 'few'} arguments for {cls};\"\n f\" actual {alen}, expected {elen}\")\n \ndef _unpack_args(args):\n newargs=[]\n for arg in args:\n subargs=getattr(arg,'__typing_unpacked_tuple_args__',None)\n if subargs is not None and not(subargs and subargs[-1]is ...):\n newargs.extend(subargs)\n else:\n newargs.append(arg)\n return newargs\n \ndef _deduplicate(params):\n\n all_params=set(params)\n if len(all_params)','eval')\n except SyntaxError:\n raise SyntaxError(f\"Forward reference must be an expression -- got {arg !r}\")\n \n self.__forward_arg__=arg\n self.__forward_code__=code\n self.__forward_evaluated__=False\n self.__forward_value__=None\n self.__forward_is_argument__=is_argument\n self.__forward_is_class__=is_class\n self.__forward_module__=module\n \n def _evaluate(self,globalns,localns,recursive_guard):\n if self.__forward_arg__ in recursive_guard:\n return self\n if not self.__forward_evaluated__ or localns is not globalns:\n if globalns is None and localns is None:\n globalns=localns={}\n elif globalns is None:\n globalns=localns\n elif localns is None:\n localns=globalns\n if self.__forward_module__ is not None:\n globalns=getattr(\n sys.modules.get(self.__forward_module__,None),'__dict__',globalns\n )\n type_=_type_check(\n eval(self.__forward_code__,globalns,localns),\n \"Forward references must evaluate to types.\",\n is_argument=self.__forward_is_argument__,\n allow_special_forms=self.__forward_is_class__,\n )\n self.__forward_value__=_eval_type(\n type_,globalns,localns,recursive_guard |{self.__forward_arg__}\n )\n self.__forward_evaluated__=True\n return self.__forward_value__\n \n def __eq__(self,other):\n if not isinstance(other,ForwardRef):\n return NotImplemented\n if self.__forward_evaluated__ and other.__forward_evaluated__:\n return(self.__forward_arg__ ==other.__forward_arg__ and\n self.__forward_value__ ==other.__forward_value__)\n return(self.__forward_arg__ ==other.__forward_arg__ and\n self.__forward_module__ ==other.__forward_module__)\n \n def __hash__(self):\n return hash((self.__forward_arg__,self.__forward_module__))\n \n def __or__(self,other):\n return Union[self,other]\n \n def __ror__(self,other):\n return Union[other,self]\n \n def __repr__(self):\n if self.__forward_module__ is None:\n module_repr=''\n else:\n module_repr=f', module={self.__forward_module__ !r}'\n return f'ForwardRef({self.__forward_arg__ !r}{module_repr})'\n \n \ndef _is_unpacked_typevartuple(x:Any)->bool:\n return((not isinstance(x,type))and\n getattr(x,'__typing_is_unpacked_typevartuple__',False))\n \n \ndef _is_typevar_like(x:Any)->bool:\n return isinstance(x,(TypeVar,ParamSpec))or _is_unpacked_typevartuple(x)\n \n \nclass _PickleUsingNameMixin:\n ''\n \n def __reduce__(self):\n return self.__name__\n \n \ndef _typevar_subst(self,arg):\n msg=\"Parameters to generic types must be types.\"\n arg=_type_check(arg,msg,is_argument=True)\n if((isinstance(arg,_GenericAlias)and arg.__origin__ is Unpack)or\n (isinstance(arg,GenericAlias)and getattr(arg,'__unpacked__',False))):\n raise TypeError(f\"{arg} is not valid as type argument\")\n return arg\n \n \ndef _typevartuple_prepare_subst(self,alias,args):\n params=alias.__parameters__\n typevartuple_index=params.index(self)\n for param in params[typevartuple_index+1:]:\n if isinstance(param,TypeVarTuple):\n raise TypeError(f\"More than one TypeVarTuple parameter in {alias}\")\n \n alen=len(args)\n plen=len(params)\n left=typevartuple_index\n right=plen -typevartuple_index -1\n var_tuple_index=None\n fillarg=None\n for k,arg in enumerate(args):\n if not isinstance(arg,type):\n subargs=getattr(arg,'__typing_unpacked_tuple_args__',None)\n if subargs and len(subargs)==2 and subargs[-1]is ...:\n if var_tuple_index is not None:\n raise TypeError(\"More than one unpacked arbitrary-length tuple argument\")\n var_tuple_index=k\n fillarg=subargs[0]\n if var_tuple_index is not None:\n left=min(left,var_tuple_index)\n right=min(right,alen -var_tuple_index -1)\n elif left+right >alen:\n raise TypeError(f\"Too few arguments for {alias};\"\n f\" actual {alen}, expected at least {plen -1}\")\n \n return(\n *args[:left],\n *([fillarg]*(typevartuple_index -left)),\n tuple(args[left:alen -right]),\n *([fillarg]*(plen -right -left -typevartuple_index -1)),\n *args[alen -right:],\n )\n \n \ndef _paramspec_subst(self,arg):\n if isinstance(arg,(list,tuple)):\n arg=tuple(_type_check(a,\"Expected a type.\")for a in arg)\n elif not _is_param_expr(arg):\n raise TypeError(f\"Expected a list of types, an ellipsis, \"\n f\"ParamSpec, or Concatenate. Got {arg}\")\n return arg\n \n \ndef _paramspec_prepare_subst(self,alias,args):\n params=alias.__parameters__\n i=params.index(self)\n if i >=len(args):\n raise TypeError(f\"Too few arguments for {alias}\")\n \n if len(params)==1 and not _is_param_expr(args[0]):\n assert i ==0\n args=(args,)\n \n elif isinstance(args[i],list):\n args=(*args[:i],tuple(args[i]),*args[i+1:])\n return args\n \n \n@_tp_cache\ndef _generic_class_getitem(cls,params):\n ''\n\n\n\n\n\n\n\n \n if not isinstance(params,tuple):\n params=(params,)\n \n params=tuple(_type_convert(p)for p in params)\n is_generic_or_protocol=cls in(Generic,Protocol)\n \n if is_generic_or_protocol:\n \n if not params:\n raise TypeError(\n f\"Parameter list to {cls.__qualname__}[...] cannot be empty\"\n )\n if not all(_is_typevar_like(p)for p in params):\n raise TypeError(\n f\"Parameters to {cls.__name__}[...] must all be type variables \"\n f\"or parameter specification variables.\")\n if len(set(params))!=len(params):\n raise TypeError(\n f\"Parameters to {cls.__name__}[...] must all be unique\")\n else:\n \n for param in cls.__parameters__:\n prepare=getattr(param,'__typing_prepare_subst__',None)\n if prepare is not None:\n params=prepare(cls,params)\n _check_generic(cls,params,len(cls.__parameters__))\n \n new_args=[]\n for param,new_arg in zip(cls.__parameters__,params):\n if isinstance(param,TypeVarTuple):\n new_args.extend(new_arg)\n else:\n new_args.append(new_arg)\n params=tuple(new_args)\n \n return _GenericAlias(cls,params)\n \n \ndef _generic_init_subclass(cls,*args,**kwargs):\n super(Generic,cls).__init_subclass__(*args,**kwargs)\n tvars=[]\n if '__orig_bases__'in cls.__dict__:\n error=Generic in cls.__orig_bases__\n else:\n error=(Generic in cls.__bases__ and\n cls.__name__ !='Protocol'and\n type(cls)!=_TypedDictMeta)\n if error:\n raise TypeError(\"Cannot inherit from plain Generic\")\n if '__orig_bases__'in cls.__dict__:\n tvars=_collect_parameters(cls.__orig_bases__)\n \n \n \n \n \n gvars=None\n for base in cls.__orig_bases__:\n if(isinstance(base,_GenericAlias)and\n base.__origin__ is Generic):\n if gvars is not None:\n raise TypeError(\n \"Cannot inherit from Generic[...] multiple times.\")\n gvars=base.__parameters__\n if gvars is not None:\n tvarset=set(tvars)\n gvarset=set(gvars)\n if not tvarset <=gvarset:\n s_vars=', '.join(str(t)for t in tvars if t not in gvarset)\n s_args=', '.join(str(g)for g in gvars)\n raise TypeError(f\"Some type variables ({s_vars}) are\"\n f\" not listed in Generic[{s_args}]\")\n tvars=gvars\n cls.__parameters__=tuple(tvars)\n \n \ndef _is_dunder(attr):\n return attr.startswith('__')and attr.endswith('__')\n \nclass _BaseGenericAlias(_Final,_root=True):\n ''\n\n\n\n\n\n\n \n \n def __init__(self,origin,*,inst=True,name=None):\n self._inst=inst\n self._name=name\n self.__origin__=origin\n self.__slots__=None\n \n def __call__(self,*args,**kwargs):\n if not self._inst:\n raise TypeError(f\"Type {self._name} cannot be instantiated; \"\n f\"use {self.__origin__.__name__}() instead\")\n result=self.__origin__(*args,**kwargs)\n try:\n result.__orig_class__=self\n except AttributeError:\n pass\n return result\n \n def __mro_entries__(self,bases):\n res=[]\n if self.__origin__ not in bases:\n res.append(self.__origin__)\n i=bases.index(self)\n for b in bases[i+1:]:\n if isinstance(b,_BaseGenericAlias)or issubclass(b,Generic):\n break\n else:\n res.append(Generic)\n return tuple(res)\n \n def __getattr__(self,attr):\n if attr in{'__name__','__qualname__'}:\n return self._name or self.__origin__.__name__\n \n \n \n if '__origin__'in self.__dict__ and not _is_dunder(attr):\n return getattr(self.__origin__,attr)\n raise AttributeError(attr)\n \n def __setattr__(self,attr,val):\n if _is_dunder(attr)or attr in{'_name','_inst','_nparams'}:\n super().__setattr__(attr,val)\n else:\n setattr(self.__origin__,attr,val)\n \n def __instancecheck__(self,obj):\n return self.__subclasscheck__(type(obj))\n \n def __subclasscheck__(self,cls):\n raise TypeError(\"Subscripted generics cannot be used with\"\n \" class and instance checks\")\n \n def __dir__(self):\n return list(set(super().__dir__()\n +[attr for attr in dir(self.__origin__)if not _is_dunder(attr)]))\n \n \n \n \n \n \n \n \n \n \n \n \n \nclass _GenericAlias(_BaseGenericAlias,_root=True):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n def __init__(self,origin,args,*,inst=True,name=None):\n super().__init__(origin,inst=inst,name=name)\n if not isinstance(args,tuple):\n args=(args,)\n self.__args__=tuple(...if a is _TypingEllipsis else\n a for a in args)\n self.__parameters__=_collect_parameters(args)\n if not name:\n self.__module__=origin.__module__\n \n def __eq__(self,other):\n if not isinstance(other,_GenericAlias):\n return NotImplemented\n return(self.__origin__ ==other.__origin__\n and self.__args__ ==other.__args__)\n \n def __hash__(self):\n return hash((self.__origin__,self.__args__))\n \n def __or__(self,right):\n return Union[self,right]\n \n def __ror__(self,left):\n return Union[left,self]\n \n @_tp_cache\n def __getitem__(self,args):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if self.__origin__ in(Generic,Protocol):\n \n raise TypeError(f\"Cannot subscript already-subscripted {self}\")\n if not self.__parameters__:\n raise TypeError(f\"{self} is not a generic class\")\n \n \n if not isinstance(args,tuple):\n args=(args,)\n args=tuple(_type_convert(p)for p in args)\n args=_unpack_args(args)\n new_args=self._determine_new_args(args)\n r=self.copy_with(new_args)\n return r\n \n def _determine_new_args(self,args):\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n params=self.__parameters__\n \n for param in params:\n prepare=getattr(param,'__typing_prepare_subst__',None)\n if prepare is not None:\n args=prepare(self,args)\n alen=len(args)\n plen=len(params)\n if alen !=plen:\n raise TypeError(f\"Too {'many'if alen >plen else 'few'} arguments for {self};\"\n f\" actual {alen}, expected {plen}\")\n new_arg_by_param=dict(zip(params,args))\n return tuple(self._make_substitution(self.__args__,new_arg_by_param))\n \n def _make_substitution(self,args,new_arg_by_param):\n ''\n new_args=[]\n for old_arg in args:\n if isinstance(old_arg,type):\n new_args.append(old_arg)\n continue\n \n substfunc=getattr(old_arg,'__typing_subst__',None)\n if substfunc:\n new_arg=substfunc(new_arg_by_param[old_arg])\n else:\n subparams=getattr(old_arg,'__parameters__',())\n if not subparams:\n new_arg=old_arg\n else:\n subargs=[]\n for x in subparams:\n if isinstance(x,TypeVarTuple):\n subargs.extend(new_arg_by_param[x])\n else:\n subargs.append(new_arg_by_param[x])\n new_arg=old_arg[tuple(subargs)]\n \n if self.__origin__ ==collections.abc.Callable and isinstance(new_arg,tuple):\n \n \n \n \n \n \n \n \n \n \n new_args.extend(new_arg)\n elif _is_unpacked_typevartuple(old_arg):\n \n \n \n \n \n \n \n \n \n new_args.extend(new_arg)\n elif isinstance(old_arg,tuple):\n \n \n \n \n \n \n \n new_args.append(\n tuple(self._make_substitution(old_arg,new_arg_by_param)),\n )\n else:\n new_args.append(new_arg)\n return new_args\n \n def copy_with(self,args):\n return self.__class__(self.__origin__,args,name=self._name,inst=self._inst)\n \n def __repr__(self):\n if self._name:\n name='typing.'+self._name\n else:\n name=_type_repr(self.__origin__)\n if self.__args__:\n args=\", \".join([_type_repr(a)for a in self.__args__])\n else:\n \n args=\"()\"\n return f'{name}[{args}]'\n \n def __reduce__(self):\n if self._name:\n origin=globals()[self._name]\n else:\n origin=self.__origin__\n args=tuple(self.__args__)\n if len(args)==1 and not isinstance(args[0],tuple):\n args,=args\n return operator.getitem,(origin,args)\n \n def __mro_entries__(self,bases):\n if isinstance(self.__origin__,_SpecialForm):\n raise TypeError(f\"Cannot subclass {self !r}\")\n \n if self._name:\n return super().__mro_entries__(bases)\n if self.__origin__ is Generic:\n if Protocol in bases:\n return()\n i=bases.index(self)\n for b in bases[i+1:]:\n if isinstance(b,_BaseGenericAlias)and b is not self:\n return()\n return(self.__origin__,)\n \n def __iter__(self):\n yield Unpack[self]\n \n \n \n \n \n \nclass _SpecialGenericAlias(_NotIterable,_BaseGenericAlias,_root=True):\n def __init__(self,origin,nparams,*,inst=True,name=None):\n if name is None:\n name=origin.__name__\n super().__init__(origin,inst=inst,name=name)\n self._nparams=nparams\n if origin.__module__ =='builtins':\n self.__doc__=f'A generic version of {origin.__qualname__}.'\n else:\n self.__doc__=f'A generic version of {origin.__module__}.{origin.__qualname__}.'\n \n @_tp_cache\n def __getitem__(self,params):\n if not isinstance(params,tuple):\n params=(params,)\n msg=\"Parameters to generic types must be types.\"\n params=tuple(_type_check(p,msg)for p in params)\n _check_generic(self,params,self._nparams)\n return self.copy_with(params)\n \n def copy_with(self,params):\n return _GenericAlias(self.__origin__,params,\n name=self._name,inst=self._inst)\n \n def __repr__(self):\n return 'typing.'+self._name\n \n def __subclasscheck__(self,cls):\n if isinstance(cls,_SpecialGenericAlias):\n return issubclass(cls.__origin__,self.__origin__)\n if not isinstance(cls,_GenericAlias):\n return issubclass(cls,self.__origin__)\n return super().__subclasscheck__(cls)\n \n def __reduce__(self):\n return self._name\n \n def __or__(self,right):\n return Union[self,right]\n \n def __ror__(self,left):\n return Union[left,self]\n \n \nclass _DeprecatedGenericAlias(_SpecialGenericAlias,_root=True):\n def __init__(\n self,origin,nparams,*,removal_version,inst=True,name=None\n ):\n super().__init__(origin,nparams,inst=inst,name=name)\n self._removal_version=removal_version\n \n def __instancecheck__(self,inst):\n import warnings\n warnings._deprecated(\n f\"{self.__module__}.{self._name}\",remove=self._removal_version\n )\n return super().__instancecheck__(inst)\n \n \nclass _CallableGenericAlias(_NotIterable,_GenericAlias,_root=True):\n def __repr__(self):\n assert self._name =='Callable'\n args=self.__args__\n if len(args)==2 and _is_param_expr(args[0]):\n return super().__repr__()\n return(f'typing.Callable'\n f'[[{\", \".join([_type_repr(a)for a in args[:-1]])}], '\n f'{_type_repr(args[-1])}]')\n \n def __reduce__(self):\n args=self.__args__\n if not(len(args)==2 and _is_param_expr(args[0])):\n args=list(args[:-1]),args[-1]\n return operator.getitem,(Callable,args)\n \n \nclass _CallableType(_SpecialGenericAlias,_root=True):\n def copy_with(self,params):\n return _CallableGenericAlias(self.__origin__,params,\n name=self._name,inst=self._inst)\n \n def __getitem__(self,params):\n if not isinstance(params,tuple)or len(params)!=2:\n raise TypeError(\"Callable must be used as \"\n \"Callable[[arg, ...], result].\")\n args,result=params\n \n \n \n if isinstance(args,list):\n params=(tuple(args),result)\n else:\n params=(args,result)\n return self.__getitem_inner__(params)\n \n @_tp_cache\n def __getitem_inner__(self,params):\n args,result=params\n msg=\"Callable[args, result]: result must be a type.\"\n result=_type_check(result,msg)\n if args is Ellipsis:\n return self.copy_with((_TypingEllipsis,result))\n if not isinstance(args,tuple):\n args=(args,)\n args=tuple(_type_convert(arg)for arg in args)\n params=args+(result,)\n return self.copy_with(params)\n \n \nclass _TupleType(_SpecialGenericAlias,_root=True):\n @_tp_cache\n def __getitem__(self,params):\n if not isinstance(params,tuple):\n params=(params,)\n if len(params)>=2 and params[-1]is ...:\n msg=\"Tuple[t, ...]: t must be a type.\"\n params=tuple(_type_check(p,msg)for p in params[:-1])\n return self.copy_with((*params,_TypingEllipsis))\n msg=\"Tuple[t0, t1, ...]: each t must be a type.\"\n params=tuple(_type_check(p,msg)for p in params)\n return self.copy_with(params)\n \n \nclass _UnionGenericAlias(_NotIterable,_GenericAlias,_root=True):\n def copy_with(self,params):\n return Union[params]\n \n def __eq__(self,other):\n if not isinstance(other,(_UnionGenericAlias,types.UnionType)):\n return NotImplemented\n return set(self.__args__)==set(other.__args__)\n \n def __hash__(self):\n return hash(frozenset(self.__args__))\n \n def __repr__(self):\n args=self.__args__\n if len(args)==2:\n if args[0]is type(None):\n return f'typing.Optional[{_type_repr(args[1])}]'\n elif args[1]is type(None):\n return f'typing.Optional[{_type_repr(args[0])}]'\n return super().__repr__()\n \n def __instancecheck__(self,obj):\n return self.__subclasscheck__(type(obj))\n \n def __subclasscheck__(self,cls):\n for arg in self.__args__:\n if issubclass(cls,arg):\n return True\n \n def __reduce__(self):\n func,(origin,args)=super().__reduce__()\n return func,(Union,args)\n \n \ndef _value_and_type_iter(parameters):\n return((p,type(p))for p in parameters)\n \n \nclass _LiteralGenericAlias(_GenericAlias,_root=True):\n def __eq__(self,other):\n if not isinstance(other,_LiteralGenericAlias):\n return NotImplemented\n \n return set(_value_and_type_iter(self.__args__))==set(_value_and_type_iter(other.__args__))\n \n def __hash__(self):\n return hash(frozenset(_value_and_type_iter(self.__args__)))\n \n \nclass _ConcatenateGenericAlias(_GenericAlias,_root=True):\n def copy_with(self,params):\n if isinstance(params[-1],(list,tuple)):\n return(*params[:-1],*params[-1])\n if isinstance(params[-1],_ConcatenateGenericAlias):\n params=(*params[:-1],*params[-1].__args__)\n return super().copy_with(params)\n \n \n@_SpecialForm\ndef Unpack(self,parameters):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n item=_type_check(parameters,f'{self} accepts only single type.')\n return _UnpackGenericAlias(origin=self,args=(item,))\n \n \nclass _UnpackGenericAlias(_GenericAlias,_root=True):\n def __repr__(self):\n \n \n return f'typing.Unpack[{_type_repr(self.__args__[0])}]'\n \n def __getitem__(self,args):\n if self.__typing_is_unpacked_typevartuple__:\n return args\n return super().__getitem__(args)\n \n @property\n def __typing_unpacked_tuple_args__(self):\n assert self.__origin__ is Unpack\n assert len(self.__args__)==1\n arg,=self.__args__\n if isinstance(arg,_GenericAlias):\n assert arg.__origin__ is tuple\n return arg.__args__\n return None\n \n @property\n def __typing_is_unpacked_typevartuple__(self):\n assert self.__origin__ is Unpack\n assert len(self.__args__)==1\n return isinstance(self.__args__[0],TypeVarTuple)\n \n \nclass _TypingEllipsis:\n ''\n \n \n_TYPING_INTERNALS=frozenset({\n'__parameters__','__orig_bases__','__orig_class__',\n'_is_protocol','_is_runtime_protocol','__protocol_attrs__',\n'__callable_proto_members_only__','__type_params__',\n})\n\n_SPECIAL_NAMES=frozenset({\n'__abstractmethods__','__annotations__','__dict__','__doc__',\n'__init__','__module__','__new__','__slots__',\n'__subclasshook__','__weakref__','__class_getitem__'\n})\n\n\nEXCLUDED_ATTRIBUTES=_TYPING_INTERNALS |_SPECIAL_NAMES |{'_MutableMapping__marker'}\n\n\ndef _get_protocol_attrs(cls):\n ''\n\n\n\n \n attrs=set()\n for base in cls.__mro__[:-1]:\n if base.__name__ in{'Protocol','Generic'}:\n continue\n annotations=getattr(base,'__annotations__',{})\n for attr in(*base.__dict__,*annotations):\n if not attr.startswith('_abc_')and attr not in EXCLUDED_ATTRIBUTES:\n attrs.add(attr)\n return attrs\n \n \ndef _no_init_or_replace_init(self,*args,**kwargs):\n cls=type(self)\n \n if cls._is_protocol:\n raise TypeError('Protocols cannot be instantiated')\n \n \n \n if cls.__init__ is not _no_init_or_replace_init:\n return\n \n \n \n \n \n \n \n for base in cls.__mro__:\n init=base.__dict__.get('__init__',_no_init_or_replace_init)\n if init is not _no_init_or_replace_init:\n cls.__init__=init\n break\n else:\n \n cls.__init__=object.__init__\n \n cls.__init__(self,*args,**kwargs)\n \n \ndef _caller(depth=1,default='__main__'):\n try:\n return sys._getframemodulename(depth+1)or default\n except AttributeError:\n pass\n try:\n return sys._getframe(depth+1).f_globals.get('__name__',default)\n except(AttributeError,ValueError):\n pass\n return None\n \ndef _allow_reckless_class_checks(depth=2):\n ''\n\n\n\n \n return _caller(depth)in{'abc','functools',None}\n \n \n_PROTO_ALLOWLIST={\n'collections.abc':[\n'Callable','Awaitable','Iterable','Iterator','AsyncIterable',\n'Hashable','Sized','Container','Collection','Reversible','Buffer',\n],\n'contextlib':['AbstractContextManager','AbstractAsyncContextManager'],\n}\n\n\n@functools.cache\ndef _lazy_load_getattr_static():\n\n\n from inspect import getattr_static\n return getattr_static\n \n \n_cleanups.append(_lazy_load_getattr_static.cache_clear)\n\ndef _pickle_psargs(psargs):\n return ParamSpecArgs,(psargs.__origin__,)\n \ncopyreg.pickle(ParamSpecArgs,_pickle_psargs)\n\ndef _pickle_pskwargs(pskwargs):\n return ParamSpecKwargs,(pskwargs.__origin__,)\n \ncopyreg.pickle(ParamSpecKwargs,_pickle_pskwargs)\n\ndel _pickle_psargs,_pickle_pskwargs\n\n\nclass _ProtocolMeta(ABCMeta):\n\n\n def __new__(mcls,name,bases,namespace,/,**kwargs):\n if name ==\"Protocol\"and bases ==(Generic,):\n pass\n elif Protocol in bases:\n for base in bases:\n if not(\n base in{object,Generic}\n or base.__name__ in _PROTO_ALLOWLIST.get(base.__module__,[])\n or(\n issubclass(base,Generic)\n and getattr(base,\"_is_protocol\",False)\n )\n ):\n raise TypeError(\n f\"Protocols can only inherit from other protocols, \"\n f\"got {base !r}\"\n )\n return super().__new__(mcls,name,bases,namespace,**kwargs)\n \n def __init__(cls,*args,**kwargs):\n super().__init__(*args,**kwargs)\n if getattr(cls,\"_is_protocol\",False):\n cls.__protocol_attrs__=_get_protocol_attrs(cls)\n \n \n cls.__callable_proto_members_only__=all(\n callable(getattr(cls,attr,None))for attr in cls.__protocol_attrs__\n )\n \n def __subclasscheck__(cls,other):\n if cls is Protocol:\n return type.__subclasscheck__(cls,other)\n if(\n getattr(cls,'_is_protocol',False)\n and not _allow_reckless_class_checks()\n ):\n if not isinstance(other,type):\n \n raise TypeError('issubclass() arg 1 must be a class')\n if(\n not cls.__callable_proto_members_only__\n and cls.__dict__.get(\"__subclasshook__\")is _proto_hook\n ):\n raise TypeError(\n \"Protocols with non-method members don't support issubclass()\"\n )\n if not getattr(cls,'_is_runtime_protocol',False):\n raise TypeError(\n \"Instance and class checks can only be used with \"\n \"@runtime_checkable protocols\"\n )\n return super().__subclasscheck__(other)\n \n def __instancecheck__(cls,instance):\n \n \n if cls is Protocol:\n return type.__instancecheck__(cls,instance)\n if not getattr(cls,\"_is_protocol\",False):\n \n return super().__instancecheck__(instance)\n \n if(\n not getattr(cls,'_is_runtime_protocol',False)and\n not _allow_reckless_class_checks()\n ):\n raise TypeError(\"Instance and class checks can only be used with\"\n \" @runtime_checkable protocols\")\n \n if super().__instancecheck__(instance):\n return True\n \n getattr_static=_lazy_load_getattr_static()\n for attr in cls.__protocol_attrs__:\n try:\n val=getattr_static(instance,attr)\n except AttributeError:\n break\n if val is None and callable(getattr(cls,attr,None)):\n break\n else:\n return True\n \n return False\n \n \n@classmethod\ndef _proto_hook(cls,other):\n if not cls.__dict__.get('_is_protocol',False):\n return NotImplemented\n \n for attr in cls.__protocol_attrs__:\n for base in other.__mro__:\n \n if attr in base.__dict__:\n if base.__dict__[attr]is None:\n return NotImplemented\n break\n \n \n annotations=getattr(base,'__annotations__',{})\n if(isinstance(annotations,collections.abc.Mapping)and\n attr in annotations and\n issubclass(other,Generic)and getattr(other,'_is_protocol',False)):\n break\n else:\n return NotImplemented\n return True\n \n \nclass Protocol(Generic,metaclass=_ProtocolMeta):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=()\n _is_protocol=True\n _is_runtime_protocol=False\n \n def __init_subclass__(cls,*args,**kwargs):\n super().__init_subclass__(*args,**kwargs)\n \n \n if not cls.__dict__.get('_is_protocol',False):\n cls._is_protocol=any(b is Protocol for b in cls.__bases__)\n \n \n if '__subclasshook__'not in cls.__dict__:\n cls.__subclasshook__=_proto_hook\n \n \n if cls._is_protocol and cls.__init__ is Protocol.__init__:\n cls.__init__=_no_init_or_replace_init\n \n \nclass _AnnotatedAlias(_NotIterable,_GenericAlias,_root=True):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,origin,metadata):\n if isinstance(origin,_AnnotatedAlias):\n metadata=origin.__metadata__+metadata\n origin=origin.__origin__\n super().__init__(origin,origin,name='Annotated')\n self.__metadata__=metadata\n \n def copy_with(self,params):\n assert len(params)==1\n new_type=params[0]\n return _AnnotatedAlias(new_type,self.__metadata__)\n \n def __repr__(self):\n return \"typing.Annotated[{}, {}]\".format(\n _type_repr(self.__origin__),\n \", \".join(repr(a)for a in self.__metadata__)\n )\n \n def __reduce__(self):\n return operator.getitem,(\n Annotated,(self.__origin__,)+self.__metadata__\n )\n \n def __eq__(self,other):\n if not isinstance(other,_AnnotatedAlias):\n return NotImplemented\n return(self.__origin__ ==other.__origin__\n and self.__metadata__ ==other.__metadata__)\n \n def __hash__(self):\n return hash((self.__origin__,self.__metadata__))\n \n def __getattr__(self,attr):\n if attr in{'__name__','__qualname__'}:\n return 'Annotated'\n return super().__getattr__(attr)\n \n def __mro_entries__(self,bases):\n return(self.__origin__,)\n \n \nclass Annotated:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n def __new__(cls,*args,**kwargs):\n raise TypeError(\"Type Annotated cannot be instantiated.\")\n \n @_tp_cache\n def __class_getitem__(cls,params):\n if not isinstance(params,tuple)or len(params)<2:\n raise TypeError(\"Annotated[...] should be used \"\n \"with at least two arguments (a type and an \"\n \"annotation).\")\n if _is_unpacked_typevartuple(params[0]):\n raise TypeError(\"Annotated[...] should not be used with an \"\n \"unpacked TypeVarTuple\")\n msg=\"Annotated[t, ...]: t must be a type.\"\n origin=_type_check(params[0],msg,allow_special_forms=True)\n metadata=tuple(params[1:])\n return _AnnotatedAlias(origin,metadata)\n \n def __init_subclass__(cls,*args,**kwargs):\n raise TypeError(\n \"Cannot subclass {}.Annotated\".format(cls.__module__)\n )\n \n \ndef runtime_checkable(cls):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not issubclass(cls,Generic)or not getattr(cls,'_is_protocol',False):\n raise TypeError('@runtime_checkable can be only applied to protocol classes,'\n ' got %r'%cls)\n cls._is_runtime_protocol=True\n return cls\n \n \ndef cast(typ,val):\n ''\n\n\n\n\n\n \n return val\n \n \ndef assert_type(val,typ,/):\n ''\n\n\n\n\n\n\n\n\n\n\n \n return val\n \n \n_allowed_types=(types.FunctionType,types.BuiltinFunctionType,\ntypes.MethodType,types.ModuleType,\nWrapperDescriptorType,MethodWrapperType,MethodDescriptorType)\n\n\ndef get_type_hints(obj,globalns=None,localns=None,include_extras=False):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if getattr(obj,'__no_type_check__',None):\n return{}\n \n if isinstance(obj,type):\n hints={}\n for base in reversed(obj.__mro__):\n if globalns is None:\n base_globals=getattr(sys.modules.get(base.__module__,None),'__dict__',{})\n else:\n base_globals=globalns\n ann=base.__dict__.get('__annotations__',{})\n if isinstance(ann,types.GetSetDescriptorType):\n ann={}\n base_locals=dict(vars(base))if localns is None else localns\n if localns is None and globalns is None:\n \n \n \n \n \n \n base_globals,base_locals=base_locals,base_globals\n for name,value in ann.items():\n if value is None:\n value=type(None)\n if isinstance(value,str):\n value=ForwardRef(value,is_argument=False,is_class=True)\n value=_eval_type(value,base_globals,base_locals)\n hints[name]=value\n return hints if include_extras else{k:_strip_annotations(t)for k,t in hints.items()}\n \n if globalns is None:\n if isinstance(obj,types.ModuleType):\n globalns=obj.__dict__\n else:\n nsobj=obj\n \n while hasattr(nsobj,'__wrapped__'):\n nsobj=nsobj.__wrapped__\n globalns=getattr(nsobj,'__globals__',{})\n if localns is None:\n localns=globalns\n elif localns is None:\n localns=globalns\n hints=getattr(obj,'__annotations__',None)\n if hints is None:\n \n if isinstance(obj,_allowed_types):\n return{}\n else:\n raise TypeError('{!r} is not a module, class, method, '\n 'or function.'.format(obj))\n hints=dict(hints)\n for name,value in hints.items():\n if value is None:\n value=type(None)\n if isinstance(value,str):\n \n \n value=ForwardRef(\n value,\n is_argument=not isinstance(obj,types.ModuleType),\n is_class=False,\n )\n hints[name]=_eval_type(value,globalns,localns)\n return hints if include_extras else{k:_strip_annotations(t)for k,t in hints.items()}\n \n \ndef _strip_annotations(t):\n ''\n if isinstance(t,_AnnotatedAlias):\n return _strip_annotations(t.__origin__)\n if hasattr(t,\"__origin__\")and t.__origin__ in(Required,NotRequired):\n return _strip_annotations(t.__args__[0])\n if isinstance(t,_GenericAlias):\n stripped_args=tuple(_strip_annotations(a)for a in t.__args__)\n if stripped_args ==t.__args__:\n return t\n return t.copy_with(stripped_args)\n if isinstance(t,GenericAlias):\n stripped_args=tuple(_strip_annotations(a)for a in t.__args__)\n if stripped_args ==t.__args__:\n return t\n return GenericAlias(t.__origin__,stripped_args)\n if isinstance(t,types.UnionType):\n stripped_args=tuple(_strip_annotations(a)for a in t.__args__)\n if stripped_args ==t.__args__:\n return t\n return functools.reduce(operator.or_,stripped_args)\n \n return t\n \n \ndef get_origin(tp):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(tp,_AnnotatedAlias):\n return Annotated\n if isinstance(tp,(_BaseGenericAlias,GenericAlias,\n ParamSpecArgs,ParamSpecKwargs)):\n return tp.__origin__\n if tp is Generic:\n return Generic\n if isinstance(tp,types.UnionType):\n return types.UnionType\n return None\n \n \ndef get_args(tp):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(tp,_AnnotatedAlias):\n return(tp.__origin__,)+tp.__metadata__\n if isinstance(tp,(_GenericAlias,GenericAlias)):\n res=tp.__args__\n if _should_unflatten_callable_args(tp,res):\n res=(list(res[:-1]),res[-1])\n return res\n if isinstance(tp,types.UnionType):\n return tp.__args__\n return()\n \n \ndef is_typeddict(tp):\n ''\n\n\n\n\n\n\n\n\n\n \n return isinstance(tp,_TypedDictMeta)\n \n \n_ASSERT_NEVER_REPR_MAX_LENGTH=100\n\n\ndef assert_never(arg:Never,/)->Never:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n value=repr(arg)\n if len(value)>_ASSERT_NEVER_REPR_MAX_LENGTH:\n value=value[:_ASSERT_NEVER_REPR_MAX_LENGTH]+'...'\n raise AssertionError(f\"Expected code to be unreachable, but got: {value}\")\n \n \ndef no_type_check(arg):\n ''\n\n\n\n\n\n\n \n if isinstance(arg,type):\n for key in dir(arg):\n obj=getattr(arg,key)\n if(\n not hasattr(obj,'__qualname__')\n or obj.__qualname__ !=f'{arg.__qualname__}.{obj.__name__}'\n or getattr(obj,'__module__',None)!=arg.__module__\n ):\n \n \n \n continue\n \n if isinstance(obj,types.FunctionType):\n obj.__no_type_check__=True\n if isinstance(obj,types.MethodType):\n obj.__func__.__no_type_check__=True\n \n if isinstance(obj,type):\n no_type_check(obj)\n try:\n arg.__no_type_check__=True\n except TypeError:\n pass\n return arg\n \n \ndef no_type_check_decorator(decorator):\n ''\n\n\n\n \n @functools.wraps(decorator)\n def wrapped_decorator(*args,**kwds):\n func=decorator(*args,**kwds)\n func=no_type_check(func)\n return func\n \n return wrapped_decorator\n \n \ndef _overload_dummy(*args,**kwds):\n ''\n raise NotImplementedError(\n \"You should not call an overloaded function. \"\n \"A series of @overload-decorated functions \"\n \"outside a stub module should always be followed \"\n \"by an implementation that is not @overload-ed.\")\n \n \n \n_overload_registry=defaultdict(functools.partial(defaultdict,dict))\n\n\ndef overload(func):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n f=getattr(func,\"__func__\",func)\n try:\n _overload_registry[f.__module__][f.__qualname__][f.__code__.co_firstlineno]=func\n except AttributeError:\n \n pass\n return _overload_dummy\n \n \ndef get_overloads(func):\n ''\n \n f=getattr(func,\"__func__\",func)\n if f.__module__ not in _overload_registry:\n return[]\n mod_dict=_overload_registry[f.__module__]\n if f.__qualname__ not in mod_dict:\n return[]\n return list(mod_dict[f.__qualname__].values())\n \n \ndef clear_overloads():\n ''\n _overload_registry.clear()\n \n \ndef final(f):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n f.__final__=True\n except(AttributeError,TypeError):\n \n \n \n pass\n return f\n \n \n \n \n \nT=TypeVar('T')\nKT=TypeVar('KT')\nVT=TypeVar('VT')\nT_co=TypeVar('T_co',covariant=True)\nV_co=TypeVar('V_co',covariant=True)\nVT_co=TypeVar('VT_co',covariant=True)\nT_contra=TypeVar('T_contra',contravariant=True)\n\nCT_co=TypeVar('CT_co',covariant=True,bound=type)\n\n\n\n\nAnyStr=TypeVar('AnyStr',bytes,str)\n\n\n\n_alias=_SpecialGenericAlias\n\nHashable=_alias(collections.abc.Hashable,0)\nAwaitable=_alias(collections.abc.Awaitable,1)\nCoroutine=_alias(collections.abc.Coroutine,3)\nAsyncIterable=_alias(collections.abc.AsyncIterable,1)\nAsyncIterator=_alias(collections.abc.AsyncIterator,1)\nIterable=_alias(collections.abc.Iterable,1)\nIterator=_alias(collections.abc.Iterator,1)\nReversible=_alias(collections.abc.Reversible,1)\nSized=_alias(collections.abc.Sized,0)\nContainer=_alias(collections.abc.Container,1)\nCollection=_alias(collections.abc.Collection,1)\nCallable=_CallableType(collections.abc.Callable,2)\nCallable.__doc__=\\\n\"\"\"Deprecated alias to collections.abc.Callable.\n\n Callable[[int], str] signifies a function that takes a single\n parameter of type int and returns a str.\n\n The subscription syntax must always be used with exactly two\n values: the argument list and the return type.\n The argument list must be a list of types, a ParamSpec,\n Concatenate or ellipsis. The return type must be a single type.\n\n There is no syntax to indicate optional or keyword arguments;\n such function types are rarely used as callback types.\n \"\"\"\nAbstractSet=_alias(collections.abc.Set,1,name='AbstractSet')\nMutableSet=_alias(collections.abc.MutableSet,1)\n\nMapping=_alias(collections.abc.Mapping,2)\nMutableMapping=_alias(collections.abc.MutableMapping,2)\nSequence=_alias(collections.abc.Sequence,1)\nMutableSequence=_alias(collections.abc.MutableSequence,1)\nByteString=_DeprecatedGenericAlias(\ncollections.abc.ByteString,0,removal_version=(3,14)\n)\n\nTuple=_TupleType(tuple,-1,inst=False,name='Tuple')\nTuple.__doc__=\\\n\"\"\"Deprecated alias to builtins.tuple.\n\n Tuple[X, Y] is the cross-product type of X and Y.\n\n Example: Tuple[T1, T2] is a tuple of two elements corresponding\n to type variables T1 and T2. Tuple[int, float, str] is a tuple\n of an int, a float and a string.\n\n To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].\n \"\"\"\nList=_alias(list,1,inst=False,name='List')\nDeque=_alias(collections.deque,1,name='Deque')\nSet=_alias(set,1,inst=False,name='Set')\nFrozenSet=_alias(frozenset,1,inst=False,name='FrozenSet')\nMappingView=_alias(collections.abc.MappingView,1)\nKeysView=_alias(collections.abc.KeysView,1)\nItemsView=_alias(collections.abc.ItemsView,2)\nValuesView=_alias(collections.abc.ValuesView,1)\nContextManager=_alias(contextlib.AbstractContextManager,1,name='ContextManager')\nAsyncContextManager=_alias(contextlib.AbstractAsyncContextManager,1,name='AsyncContextManager')\nDict=_alias(dict,2,inst=False,name='Dict')\nDefaultDict=_alias(collections.defaultdict,2,name='DefaultDict')\nOrderedDict=_alias(collections.OrderedDict,2)\nCounter=_alias(collections.Counter,1)\nChainMap=_alias(collections.ChainMap,2)\nGenerator=_alias(collections.abc.Generator,3)\nAsyncGenerator=_alias(collections.abc.AsyncGenerator,2)\nType=_alias(type,1,inst=False,name='Type')\nType.__doc__=\\\n\"\"\"Deprecated alias to builtins.type.\n\n builtins.type or typing.Type can be used to annotate class objects.\n For example, suppose we have the following classes::\n\n class User: ... # Abstract base for User classes\n class BasicUser(User): ...\n class ProUser(User): ...\n class TeamUser(User): ...\n\n And a function that takes a class argument that's a subclass of\n User and returns an instance of the corresponding class::\n\n def new_user[U](user_class: Type[U]) -> U:\n user = user_class()\n # (Here we could write the user object to a database)\n return user\n\n joe = new_user(BasicUser)\n\n At this point the type checker knows that joe has type BasicUser.\n \"\"\"\n\n\n@runtime_checkable\nclass SupportsInt(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __int__(self)->int:\n pass\n \n \n@runtime_checkable\nclass SupportsFloat(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __float__(self)->float:\n pass\n \n \n@runtime_checkable\nclass SupportsComplex(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __complex__(self)->complex:\n pass\n \n \n@runtime_checkable\nclass SupportsBytes(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __bytes__(self)->bytes:\n pass\n \n \n@runtime_checkable\nclass SupportsIndex(Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __index__(self)->int:\n pass\n \n \n@runtime_checkable\nclass SupportsAbs[T](Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __abs__(self)->T:\n pass\n \n \n@runtime_checkable\nclass SupportsRound[T](Protocol):\n ''\n \n __slots__=()\n \n @abstractmethod\n def __round__(self,ndigits:int=0)->T:\n pass\n \n \ndef _make_nmtuple(name,types,module,defaults=()):\n fields=[n for n,t in types]\n types={n:_type_check(t,f\"field {n} annotation must be a type\")\n for n,t in types}\n nm_tpl=collections.namedtuple(name,fields,\n defaults=defaults,module=module)\n nm_tpl.__annotations__=nm_tpl.__new__.__annotations__=types\n return nm_tpl\n \n \n \n_prohibited=frozenset({'__new__','__init__','__slots__','__getnewargs__',\n'_fields','_field_defaults',\n'_make','_replace','_asdict','_source'})\n\n_special=frozenset({'__module__','__name__','__annotations__'})\n\n\nclass NamedTupleMeta(type):\n def __new__(cls,typename,bases,ns):\n assert _NamedTuple in bases\n for base in bases:\n if base is not _NamedTuple and base is not Generic:\n raise TypeError(\n 'can only inherit from a NamedTuple type and Generic')\n bases=tuple(tuple if base is _NamedTuple else base for base in bases)\n types=ns.get('__annotations__',{})\n default_names=[]\n for field_name in types:\n if field_name in ns:\n default_names.append(field_name)\n elif default_names:\n raise TypeError(f\"Non-default namedtuple field {field_name} \"\n f\"cannot follow default field\"\n f\"{'s'if len(default_names)>1 else ''} \"\n f\"{', '.join(default_names)}\")\n nm_tpl=_make_nmtuple(typename,types.items(),\n defaults=[ns[n]for n in default_names],\n module=ns['__module__'])\n nm_tpl.__bases__=bases\n if Generic in bases:\n class_getitem=_generic_class_getitem\n nm_tpl.__class_getitem__=classmethod(class_getitem)\n \n for key in ns:\n if key in _prohibited:\n raise AttributeError(\"Cannot overwrite NamedTuple attribute \"+key)\n elif key not in _special and key not in nm_tpl._fields:\n setattr(nm_tpl,key,ns[key])\n if Generic in bases:\n nm_tpl.__init_subclass__()\n return nm_tpl\n \n \ndef NamedTuple(typename,fields=None,/,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if fields is None:\n fields=kwargs.items()\n elif kwargs:\n raise TypeError(\"Either list of fields or keywords\"\n \" can be provided to NamedTuple, not both\")\n nt=_make_nmtuple(typename,fields,module=_caller())\n nt.__orig_bases__=(NamedTuple,)\n return nt\n \n_NamedTuple=type.__new__(NamedTupleMeta,'NamedTuple',(),{})\n\ndef _namedtuple_mro_entries(bases):\n assert NamedTuple in bases\n return(_NamedTuple,)\n \nNamedTuple.__mro_entries__=_namedtuple_mro_entries\n\n\nclass _TypedDictMeta(type):\n def __new__(cls,name,bases,ns,total=True):\n ''\n\n\n\n\n\n \n for base in bases:\n if type(base)is not _TypedDictMeta and base is not Generic:\n raise TypeError('cannot inherit from both a TypedDict type '\n 'and a non-TypedDict base class')\n \n if any(issubclass(b,Generic)for b in bases):\n generic_base=(Generic,)\n else:\n generic_base=()\n \n tp_dict=type.__new__(_TypedDictMeta,name,(*generic_base,dict),ns)\n \n if not hasattr(tp_dict,'__orig_bases__'):\n tp_dict.__orig_bases__=bases\n \n annotations={}\n own_annotations=ns.get('__annotations__',{})\n msg=\"TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a type\"\n own_annotations={\n n:_type_check(tp,msg,module=tp_dict.__module__)\n for n,tp in own_annotations.items()\n }\n required_keys=set()\n optional_keys=set()\n \n for base in bases:\n annotations.update(base.__dict__.get('__annotations__',{}))\n required_keys.update(base.__dict__.get('__required_keys__',()))\n optional_keys.update(base.__dict__.get('__optional_keys__',()))\n \n annotations.update(own_annotations)\n for annotation_key,annotation_type in own_annotations.items():\n annotation_origin=get_origin(annotation_type)\n if annotation_origin is Annotated:\n annotation_args=get_args(annotation_type)\n if annotation_args:\n annotation_type=annotation_args[0]\n annotation_origin=get_origin(annotation_type)\n \n if annotation_origin is Required:\n required_keys.add(annotation_key)\n elif annotation_origin is NotRequired:\n optional_keys.add(annotation_key)\n elif total:\n required_keys.add(annotation_key)\n else:\n optional_keys.add(annotation_key)\n \n tp_dict.__annotations__=annotations\n tp_dict.__required_keys__=frozenset(required_keys)\n tp_dict.__optional_keys__=frozenset(optional_keys)\n if not hasattr(tp_dict,'__total__'):\n tp_dict.__total__=total\n return tp_dict\n \n __call__=dict\n \n def __subclasscheck__(cls,other):\n \n raise TypeError('TypedDict does not support instance and class checks')\n \n __instancecheck__=__subclasscheck__\n \n \ndef TypedDict(typename,fields=None,/,*,total=True,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if fields is None:\n fields=kwargs\n elif kwargs:\n raise TypeError(\"TypedDict takes either a dict or keyword arguments,\"\n \" but not both\")\n if kwargs:\n warnings.warn(\n \"The kwargs-based syntax for TypedDict definitions is deprecated \"\n \"in Python 3.11, will be removed in Python 3.13, and may not be \"\n \"understood by third-party type checkers.\",\n DeprecationWarning,\n stacklevel=2,\n )\n \n ns={'__annotations__':dict(fields)}\n module=_caller()\n if module is not None:\n \n ns['__module__']=module\n \n td=_TypedDictMeta(typename,(),ns,total=total)\n td.__orig_bases__=(TypedDict,)\n return td\n \n_TypedDict=type.__new__(_TypedDictMeta,'TypedDict',(),{})\nTypedDict.__mro_entries__=lambda bases:(_TypedDict,)\n\n\n@_SpecialForm\ndef Required(self,parameters):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n item=_type_check(parameters,f'{self._name} accepts only a single type.')\n return _GenericAlias(self,(item,))\n \n \n@_SpecialForm\ndef NotRequired(self,parameters):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n item=_type_check(parameters,f'{self._name} accepts only a single type.')\n return _GenericAlias(self,(item,))\n \n \nclass NewType:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __call__=_idfunc\n \n def __init__(self,name,tp):\n self.__qualname__=name\n if '.'in name:\n name=name.rpartition('.')[-1]\n self.__name__=name\n self.__supertype__=tp\n def_mod=_caller()\n if def_mod !='typing':\n self.__module__=def_mod\n \n def __mro_entries__(self,bases):\n \n \n superclass_name=self.__name__\n \n class Dummy:\n def __init_subclass__(cls):\n subclass_name=cls.__name__\n raise TypeError(\n f\"Cannot subclass an instance of NewType. Perhaps you were looking for: \"\n f\"`{subclass_name} = NewType({subclass_name !r}, {superclass_name})`\"\n )\n \n return(Dummy,)\n \n def __repr__(self):\n return f'{self.__module__}.{self.__qualname__}'\n \n def __reduce__(self):\n return self.__qualname__\n \n def __or__(self,other):\n return Union[self,other]\n \n def __ror__(self,other):\n return Union[other,self]\n \n \n \nText=str\n\n\n\nTYPE_CHECKING=False\n\n\nclass IO(Generic[AnyStr]):\n ''\n\n\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n @property\n @abstractmethod\n def mode(self)->str:\n pass\n \n @property\n @abstractmethod\n def name(self)->str:\n pass\n \n @abstractmethod\n def close(self)->None:\n pass\n \n @property\n @abstractmethod\n def closed(self)->bool:\n pass\n \n @abstractmethod\n def fileno(self)->int:\n pass\n \n @abstractmethod\n def flush(self)->None:\n pass\n \n @abstractmethod\n def isatty(self)->bool:\n pass\n \n @abstractmethod\n def read(self,n:int=-1)->AnyStr:\n pass\n \n @abstractmethod\n def readable(self)->bool:\n pass\n \n @abstractmethod\n def readline(self,limit:int=-1)->AnyStr:\n pass\n \n @abstractmethod\n def readlines(self,hint:int=-1)->List[AnyStr]:\n pass\n \n @abstractmethod\n def seek(self,offset:int,whence:int=0)->int:\n pass\n \n @abstractmethod\n def seekable(self)->bool:\n pass\n \n @abstractmethod\n def tell(self)->int:\n pass\n \n @abstractmethod\n def truncate(self,size:int=None)->int:\n pass\n \n @abstractmethod\n def writable(self)->bool:\n pass\n \n @abstractmethod\n def write(self,s:AnyStr)->int:\n pass\n \n @abstractmethod\n def writelines(self,lines:List[AnyStr])->None:\n pass\n \n @abstractmethod\n def __enter__(self)->'IO[AnyStr]':\n pass\n \n @abstractmethod\n def __exit__(self,type,value,traceback)->None:\n pass\n \n \nclass BinaryIO(IO[bytes]):\n ''\n \n __slots__=()\n \n @abstractmethod\n def write(self,s:Union[bytes,bytearray])->int:\n pass\n \n @abstractmethod\n def __enter__(self)->'BinaryIO':\n pass\n \n \nclass TextIO(IO[str]):\n ''\n \n __slots__=()\n \n @property\n @abstractmethod\n def buffer(self)->BinaryIO:\n pass\n \n @property\n @abstractmethod\n def encoding(self)->str:\n pass\n \n @property\n @abstractmethod\n def errors(self)->Optional[str]:\n pass\n \n @property\n @abstractmethod\n def line_buffering(self)->bool:\n pass\n \n @property\n @abstractmethod\n def newlines(self)->Any:\n pass\n \n @abstractmethod\n def __enter__(self)->'TextIO':\n pass\n \n \nclass _DeprecatedType(type):\n def __getattribute__(cls,name):\n if name not in(\"__dict__\",\"__module__\")and name in cls.__dict__:\n warnings.warn(\n f\"{cls.__name__} is deprecated, import directly \"\n f\"from typing instead. {cls.__name__} will be removed \"\n \"in Python 3.12.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return super().__getattribute__(name)\n \n \nclass io(metaclass=_DeprecatedType):\n ''\n \n __all__=['IO','TextIO','BinaryIO']\n IO=IO\n TextIO=TextIO\n BinaryIO=BinaryIO\n \n \nio.__name__=__name__+'.io'\nsys.modules[io.__name__]=io\n\nPattern=_alias(stdlib_re.Pattern,1)\nMatch=_alias(stdlib_re.Match,1)\n\nclass re(metaclass=_DeprecatedType):\n ''\n \n __all__=['Pattern','Match']\n Pattern=Pattern\n Match=Match\n \n \nre.__name__=__name__+'.re'\nsys.modules[re.__name__]=re\n\n\ndef reveal_type[T](obj:T,/)->T:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n print(f\"Runtime type is {type(obj).__name__ !r}\",file=sys.stderr)\n return obj\n \n \nclass _IdentityCallable(Protocol):\n def __call__[T](self,arg:T,/)->T:\n ...\n \n \ndef dataclass_transform(\n*,\neq_default:bool=True,\norder_default:bool=False,\nkw_only_default:bool=False,\nfrozen_default:bool=False,\nfield_specifiers:tuple[type[Any]|Callable[...,Any],...]=(),\n**kwargs:Any,\n)->_IdentityCallable:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def decorator(cls_or_fn):\n cls_or_fn.__dataclass_transform__={\n \"eq_default\":eq_default,\n \"order_default\":order_default,\n \"kw_only_default\":kw_only_default,\n \"frozen_default\":frozen_default,\n \"field_specifiers\":field_specifiers,\n \"kwargs\":kwargs,\n }\n return cls_or_fn\n return decorator\n \n \ntype _Func=Callable[...,Any]\n\n\ndef override[F:_Func](method:F,/)->F:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n try:\n method.__override__=True\n except(AttributeError,TypeError):\n \n \n \n pass\n return method\n", ["_typing", "abc", "collections", "collections.abc", "contextlib", "copyreg", "functools", "inspect", "operator", "re", "sys", "types", "warnings"]], "uu": [".py", "#! /usr/bin/env python3\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"\"Implementation of the UUencode and UUdecode functions.\n\nencode(in_file, out_file [,name, mode], *, backtick=False)\ndecode(in_file [, out_file, mode, quiet])\n\"\"\"\n\nimport binascii\nimport os\nimport sys\nimport warnings\n\nwarnings._deprecated(__name__,remove=(3,13))\n\n__all__=[\"Error\",\"encode\",\"decode\"]\n\nclass Error(Exception):\n pass\n \ndef encode(in_file,out_file,name=None,mode=None,*,backtick=False):\n ''\n \n \n \n opened_files=[]\n try:\n if in_file =='-':\n in_file=sys.stdin.buffer\n elif isinstance(in_file,str):\n if name is None:\n name=os.path.basename(in_file)\n if mode is None:\n try:\n mode=os.stat(in_file).st_mode\n except AttributeError:\n pass\n in_file=open(in_file,'rb')\n opened_files.append(in_file)\n \n \n \n if out_file =='-':\n out_file=sys.stdout.buffer\n elif isinstance(out_file,str):\n out_file=open(out_file,'wb')\n opened_files.append(out_file)\n \n \n \n if name is None:\n name='-'\n if mode is None:\n mode=0o666\n \n \n \n \n name=name.replace('\\n','\\\\n')\n name=name.replace('\\r','\\\\r')\n \n \n \n \n out_file.write(('begin %o %s\\n'%((mode&0o777),name)).encode(\"ascii\"))\n data=in_file.read(45)\n while len(data)>0:\n out_file.write(binascii.b2a_uu(data,backtick=backtick))\n data=in_file.read(45)\n if backtick:\n out_file.write(b'`\\nend\\n')\n else:\n out_file.write(b' \\nend\\n')\n finally:\n for f in opened_files:\n f.close()\n \n \ndef decode(in_file,out_file=None,mode=None,quiet=False):\n ''\n \n \n \n opened_files=[]\n if in_file =='-':\n in_file=sys.stdin.buffer\n elif isinstance(in_file,str):\n in_file=open(in_file,'rb')\n opened_files.append(in_file)\n \n try:\n \n \n \n while True:\n hdr=in_file.readline()\n if not hdr:\n raise Error('No valid begin line found in input file')\n if not hdr.startswith(b'begin'):\n continue\n hdrfields=hdr.split(b' ',2)\n if len(hdrfields)==3 and hdrfields[0]==b'begin':\n try:\n int(hdrfields[1],8)\n break\n except ValueError:\n pass\n if out_file is None:\n \n out_file=hdrfields[2].rstrip(b' \\t\\r\\n\\f').decode(\"ascii\")\n if os.path.exists(out_file):\n raise Error(f'Cannot overwrite existing file: {out_file}')\n if(out_file.startswith(os.sep)or\n f'..{os.sep}'in out_file or(\n os.altsep and\n (out_file.startswith(os.altsep)or\n f'..{os.altsep}'in out_file))\n ):\n raise Error(f'Refusing to write to {out_file} due to directory traversal')\n if mode is None:\n mode=int(hdrfields[1],8)\n \n \n \n if out_file =='-':\n out_file=sys.stdout.buffer\n elif isinstance(out_file,str):\n fp=open(out_file,'wb')\n os.chmod(out_file,mode)\n out_file=fp\n opened_files.append(out_file)\n \n \n \n s=in_file.readline()\n while s and s.strip(b' \\t\\r\\n\\f')!=b'end':\n try:\n data=binascii.a2b_uu(s)\n except binascii.Error as v:\n \n nbytes=(((s[0]-32)&63)*4+5)//3\n data=binascii.a2b_uu(s[:nbytes])\n if not quiet:\n sys.stderr.write(\"Warning: %s\\n\"%v)\n out_file.write(data)\n s=in_file.readline()\n if not s:\n raise Error('Truncated input file')\n finally:\n for f in opened_files:\n f.close()\n \ndef test():\n ''\n \n import optparse\n parser=optparse.OptionParser(usage='usage: %prog [-d] [-t] [input [output]]')\n parser.add_option('-d','--decode',dest='decode',help='Decode (instead of encode)?',default=False,action='store_true')\n parser.add_option('-t','--text',dest='text',help='data is text, encoded format unix-compatible text?',default=False,action='store_true')\n \n (options,args)=parser.parse_args()\n if len(args)>2:\n parser.error('incorrect number of arguments')\n sys.exit(1)\n \n \n input=sys.stdin.buffer\n output=sys.stdout.buffer\n if len(args)>0:\n input=args[0]\n if len(args)>1:\n output=args[1]\n \n if options.decode:\n if options.text:\n if isinstance(output,str):\n output=open(output,'wb')\n else:\n print(sys.argv[0],': cannot do -t to stdout')\n sys.exit(1)\n decode(input,output)\n else:\n if options.text:\n if isinstance(input,str):\n input=open(input,'rb')\n else:\n print(sys.argv[0],': cannot do -t from stdin')\n sys.exit(1)\n encode(input,output)\n \nif __name__ =='__main__':\n test()\n", ["binascii", "optparse", "os", "sys", "warnings"]], "uuid": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport os\nimport sys\n\nfrom enum import Enum,_simple_enum\n\n\n__author__='Ka-Ping Yee '\n\n\nif sys.platform in('win32','darwin','emscripten','wasi'):\n _AIX=_LINUX=False\nelse:\n import platform\n _platform_system=platform.system()\n _AIX=_platform_system =='AIX'\n _LINUX=_platform_system =='Linux'\n \n_MAC_DELIM=b':'\n_MAC_OMITS_LEADING_ZEROES=False\nif _AIX:\n _MAC_DELIM=b'.'\n _MAC_OMITS_LEADING_ZEROES=True\n \nRESERVED_NCS,RFC_4122,RESERVED_MICROSOFT,RESERVED_FUTURE=[\n'reserved for NCS compatibility','specified in RFC 4122',\n'reserved for Microsoft compatibility','reserved for future definition']\n\nint_=int\nbytes_=bytes\n\n\n@_simple_enum(Enum)\nclass SafeUUID:\n safe=0\n unsafe=-1\n unknown=None\n \n \nclass UUID:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __slots__=('int','is_safe','__weakref__')\n \n def __init__(self,hex=None,bytes=None,bytes_le=None,fields=None,\n int=None,version=None,\n *,is_safe=SafeUUID.unknown):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if[hex,bytes,bytes_le,fields,int].count(None)!=4:\n raise TypeError('one of the hex, bytes, bytes_le, fields, '\n 'or int arguments must be given')\n if hex is not None:\n hex=hex.replace('urn:','').replace('uuid:','')\n hex=hex.strip('{}').replace('-','')\n if len(hex)!=32:\n raise ValueError('badly formed hexadecimal UUID string')\n int=int_(hex,16)\n if bytes_le is not None:\n if len(bytes_le)!=16:\n raise ValueError('bytes_le is not a 16-char string')\n bytes=(bytes_le[4 -1::-1]+bytes_le[6 -1:4 -1:-1]+\n bytes_le[8 -1:6 -1:-1]+bytes_le[8:])\n if bytes is not None:\n if len(bytes)!=16:\n raise ValueError('bytes is not a 16-char string')\n assert isinstance(bytes,bytes_),repr(bytes)\n int=int_.from_bytes(bytes)\n if fields is not None:\n if len(fields)!=6:\n raise ValueError('fields is not a 6-tuple')\n (time_low,time_mid,time_hi_version,\n clock_seq_hi_variant,clock_seq_low,node)=fields\n if not 0 <=time_low <1 <<32:\n raise ValueError('field 1 out of range (need a 32-bit value)')\n if not 0 <=time_mid <1 <<16:\n raise ValueError('field 2 out of range (need a 16-bit value)')\n if not 0 <=time_hi_version <1 <<16:\n raise ValueError('field 3 out of range (need a 16-bit value)')\n if not 0 <=clock_seq_hi_variant <1 <<8:\n raise ValueError('field 4 out of range (need an 8-bit value)')\n if not 0 <=clock_seq_low <1 <<8:\n raise ValueError('field 5 out of range (need an 8-bit value)')\n if not 0 <=node <1 <<48:\n raise ValueError('field 6 out of range (need a 48-bit value)')\n clock_seq=(clock_seq_hi_variant <<8)|clock_seq_low\n int=((time_low <<96)|(time_mid <<80)|\n (time_hi_version <<64)|(clock_seq <<48)|node)\n if int is not None:\n if not 0 <=int <1 <<128:\n raise ValueError('int is out of range (need a 128-bit value)')\n if version is not None:\n if not 1 <=version <=5:\n raise ValueError('illegal version number')\n \n int &=~(0xc000 <<48)\n int |=0x8000 <<48\n \n int &=~(0xf000 <<64)\n int |=version <<76\n object.__setattr__(self,'int',int)\n object.__setattr__(self,'is_safe',is_safe)\n \n def __getstate__(self):\n d={'int':self.int}\n if self.is_safe !=SafeUUID.unknown:\n \n \n d['is_safe']=self.is_safe.value\n return d\n \n def __setstate__(self,state):\n object.__setattr__(self,'int',state['int'])\n \n object.__setattr__(self,'is_safe',\n SafeUUID(state['is_safe'])\n if 'is_safe'in state else SafeUUID.unknown)\n \n def __eq__(self,other):\n if isinstance(other,UUID):\n return self.int ==other.int\n return NotImplemented\n \n \n \n \n def __lt__(self,other):\n if isinstance(other,UUID):\n return self.int other.int\n return NotImplemented\n \n def __le__(self,other):\n if isinstance(other,UUID):\n return self.int <=other.int\n return NotImplemented\n \n def __ge__(self,other):\n if isinstance(other,UUID):\n return self.int >=other.int\n return NotImplemented\n \n def __hash__(self):\n return hash(self.int)\n \n def __int__(self):\n return self.int\n \n def __repr__(self):\n return '%s(%r)'%(self.__class__.__name__,str(self))\n \n def __setattr__(self,name,value):\n raise TypeError('UUID objects are immutable')\n \n def __str__(self):\n hex='%032x'%self.int\n return '%s-%s-%s-%s-%s'%(\n hex[:8],hex[8:12],hex[12:16],hex[16:20],hex[20:])\n \n @property\n def bytes(self):\n return self.int.to_bytes(16)\n \n @property\n def bytes_le(self):\n bytes=self.bytes\n return(bytes[4 -1::-1]+bytes[6 -1:4 -1:-1]+bytes[8 -1:6 -1:-1]+\n bytes[8:])\n \n @property\n def fields(self):\n return(self.time_low,self.time_mid,self.time_hi_version,\n self.clock_seq_hi_variant,self.clock_seq_low,self.node)\n \n @property\n def time_low(self):\n return self.int >>96\n \n @property\n def time_mid(self):\n return(self.int >>80)&0xffff\n \n @property\n def time_hi_version(self):\n return(self.int >>64)&0xffff\n \n @property\n def clock_seq_hi_variant(self):\n return(self.int >>56)&0xff\n \n @property\n def clock_seq_low(self):\n return(self.int >>48)&0xff\n \n @property\n def time(self):\n return(((self.time_hi_version&0x0fff)<<48)|\n (self.time_mid <<32)|self.time_low)\n \n @property\n def clock_seq(self):\n return(((self.clock_seq_hi_variant&0x3f)<<8)|\n self.clock_seq_low)\n \n @property\n def node(self):\n return self.int&0xffffffffffff\n \n @property\n def hex(self):\n return '%032x'%self.int\n \n @property\n def urn(self):\n return 'urn:uuid:'+str(self)\n \n @property\n def variant(self):\n if not self.int&(0x8000 <<48):\n return RESERVED_NCS\n elif not self.int&(0x4000 <<48):\n return RFC_4122\n elif not self.int&(0x2000 <<48):\n return RESERVED_MICROSOFT\n else:\n return RESERVED_FUTURE\n \n @property\n def version(self):\n \n if self.variant ==RFC_4122:\n return int((self.int >>76)&0xf)\n \n \ndef _get_command_stdout(command,*args):\n import io,os,shutil,subprocess\n \n try:\n path_dirs=os.environ.get('PATH',os.defpath).split(os.pathsep)\n path_dirs.extend(['/sbin','/usr/sbin'])\n executable=shutil.which(command,path=os.pathsep.join(path_dirs))\n if executable is None:\n return None\n \n \n \n env=dict(os.environ)\n env['LC_ALL']='C'\n \n if args !=('',):\n command=(executable,*args)\n else:\n command=(executable,)\n proc=subprocess.Popen(command,\n stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL,\n env=env)\n if not proc:\n return None\n stdout,stderr=proc.communicate()\n return io.BytesIO(stdout)\n except(OSError,subprocess.SubprocessError):\n return None\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \ndef _is_universal(mac):\n return not(mac&(1 <<41))\n \n \ndef _find_mac_near_keyword(command,args,keywords,get_word_index):\n ''\n\n\n\n\n\n\n \n stdout=_get_command_stdout(command,args)\n if stdout is None:\n return None\n \n first_local_mac=None\n for line in stdout:\n words=line.lower().rstrip().split()\n for i in range(len(words)):\n if words[i]in keywords:\n try:\n word=words[get_word_index(i)]\n mac=int(word.replace(_MAC_DELIM,b''),16)\n except(ValueError,IndexError):\n \n \n \n \n \n pass\n else:\n if _is_universal(mac):\n return mac\n first_local_mac=first_local_mac or mac\n return first_local_mac or None\n \n \ndef _parse_mac(word):\n\n\n\n\n\n\n parts=word.split(_MAC_DELIM)\n if len(parts)!=6:\n return\n if _MAC_OMITS_LEADING_ZEROES:\n \n \n \n \n if not all(1 <=len(part)<=2 for part in parts):\n return\n hexstr=b''.join(part.rjust(2,b'0')for part in parts)\n else:\n if not all(len(part)==2 for part in parts):\n return\n hexstr=b''.join(parts)\n try:\n return int(hexstr,16)\n except ValueError:\n return\n \n \ndef _find_mac_under_heading(command,args,heading):\n ''\n\n\n\n\n \n stdout=_get_command_stdout(command,args)\n if stdout is None:\n return None\n \n keywords=stdout.readline().rstrip().split()\n try:\n column_index=keywords.index(heading)\n except ValueError:\n return None\n \n first_local_mac=None\n for line in stdout:\n words=line.rstrip().split()\n try:\n word=words[column_index]\n except IndexError:\n continue\n \n mac=_parse_mac(word)\n if mac is None:\n continue\n if _is_universal(mac):\n return mac\n if first_local_mac is None:\n first_local_mac=mac\n \n return first_local_mac\n \n \n \n \ndef _ifconfig_getnode():\n ''\n \n keywords=(b'hwaddr',b'ether',b'address:',b'lladdr')\n for args in('','-a','-av'):\n mac=_find_mac_near_keyword('ifconfig',args,keywords,lambda i:i+1)\n if mac:\n return mac\n return None\n \ndef _ip_getnode():\n ''\n \n mac=_find_mac_near_keyword('ip','link',[b'link/ether'],lambda i:i+1)\n if mac:\n return mac\n return None\n \ndef _arp_getnode():\n ''\n import os,socket\n if not hasattr(socket,\"gethostbyname\"):\n return None\n try:\n ip_addr=socket.gethostbyname(socket.gethostname())\n except OSError:\n return None\n \n \n mac=_find_mac_near_keyword('arp','-an',[os.fsencode(ip_addr)],lambda i:-1)\n if mac:\n return mac\n \n \n mac=_find_mac_near_keyword('arp','-an',[os.fsencode(ip_addr)],lambda i:i+1)\n if mac:\n return mac\n \n \n mac=_find_mac_near_keyword('arp','-an',[os.fsencode('(%s)'%ip_addr)],\n lambda i:i+2)\n \n if mac:\n return mac\n return None\n \ndef _lanscan_getnode():\n ''\n \n return _find_mac_near_keyword('lanscan','-ai',[b'lan0'],lambda i:0)\n \ndef _netstat_getnode():\n ''\n \n return _find_mac_under_heading('netstat','-ian',b'Address')\n \ndef _ipconfig_getnode():\n ''\n \n return _windll_getnode()\n \ndef _netbios_getnode():\n ''\n \n return _windll_getnode()\n \n \n \ntry:\n import _uuid\n _generate_time_safe=getattr(_uuid,\"generate_time_safe\",None)\n _UuidCreate=getattr(_uuid,\"UuidCreate\",None)\n _has_uuid_generate_time_safe=_uuid.has_uuid_generate_time_safe\nexcept ImportError:\n _uuid=None\n _generate_time_safe=None\n _UuidCreate=None\n _has_uuid_generate_time_safe=None\n \n \ndef _load_system_functions():\n ''\n \n \ndef _unix_getnode():\n ''\n if _generate_time_safe:\n uuid_time,_=_generate_time_safe()\n return UUID(bytes=uuid_time).node\n \ndef _windll_getnode():\n ''\n if _UuidCreate:\n uuid_bytes=_UuidCreate()\n return UUID(bytes_le=uuid_bytes).node\n \ndef _random_getnode():\n ''\n \n \n \n \n \n \n \n \n \n \n import random\n return random.getrandbits(48)|(1 <<40)\n \n \n \n \n \n \n \n \nif _LINUX:\n _OS_GETTERS=[_ip_getnode,_ifconfig_getnode]\nelif sys.platform =='darwin':\n _OS_GETTERS=[_ifconfig_getnode,_arp_getnode,_netstat_getnode]\nelif sys.platform =='win32':\n\n _OS_GETTERS=[]\nelif _AIX:\n _OS_GETTERS=[_netstat_getnode]\nelse:\n _OS_GETTERS=[_ifconfig_getnode,_ip_getnode,_arp_getnode,\n _netstat_getnode,_lanscan_getnode]\nif os.name =='posix':\n _GETTERS=[_unix_getnode]+_OS_GETTERS\nelif os.name =='nt':\n _GETTERS=[_windll_getnode]+_OS_GETTERS\nelse:\n _GETTERS=_OS_GETTERS\n \n_node=None\n\ndef getnode():\n ''\n\n\n\n\n\n \n global _node\n if _node is not None:\n return _node\n \n for getter in _GETTERS+[_random_getnode]:\n try:\n _node=getter()\n except:\n continue\n if(_node is not None)and(0 <=_node <(1 <<48)):\n return _node\n assert False,'_random_getnode() returned invalid value: {}'.format(_node)\n \n \n_last_timestamp=None\n\ndef uuid1(node=None,clock_seq=None):\n ''\n\n\n \n \n \n \n if _generate_time_safe is not None and node is clock_seq is None:\n uuid_time,safely_generated=_generate_time_safe()\n try:\n is_safe=SafeUUID(safely_generated)\n except ValueError:\n is_safe=SafeUUID.unknown\n return UUID(bytes=uuid_time,is_safe=is_safe)\n \n global _last_timestamp\n import time\n nanoseconds=time.time_ns()\n \n \n timestamp=nanoseconds //100+0x01b21dd213814000\n if _last_timestamp is not None and timestamp <=_last_timestamp:\n timestamp=_last_timestamp+1\n _last_timestamp=timestamp\n if clock_seq is None:\n import random\n clock_seq=random.getrandbits(14)\n time_low=timestamp&0xffffffff\n time_mid=(timestamp >>32)&0xffff\n time_hi_version=(timestamp >>48)&0x0fff\n clock_seq_low=clock_seq&0xff\n clock_seq_hi_variant=(clock_seq >>8)&0x3f\n if node is None:\n node=getnode()\n return UUID(fields=(time_low,time_mid,time_hi_version,\n clock_seq_hi_variant,clock_seq_low,node),version=1)\n \ndef uuid3(namespace,name):\n ''\n if isinstance(name,str):\n name=bytes(name,\"utf-8\")\n from hashlib import md5\n digest=md5(\n namespace.bytes+name,\n usedforsecurity=False\n ).digest()\n return UUID(bytes=digest[:16],version=3)\n \ndef uuid4():\n ''\n return UUID(bytes=os.urandom(16),version=4)\n \ndef uuid5(namespace,name):\n ''\n if isinstance(name,str):\n name=bytes(name,\"utf-8\")\n from hashlib import sha1\n hash=sha1(namespace.bytes+name).digest()\n return UUID(bytes=hash[:16],version=5)\n \n \ndef main():\n ''\n uuid_funcs={\n \"uuid1\":uuid1,\n \"uuid3\":uuid3,\n \"uuid4\":uuid4,\n \"uuid5\":uuid5\n }\n uuid_namespace_funcs=(\"uuid3\",\"uuid5\")\n namespaces={\n \"@dns\":NAMESPACE_DNS,\n \"@url\":NAMESPACE_URL,\n \"@oid\":NAMESPACE_OID,\n \"@x500\":NAMESPACE_X500\n }\n \n import argparse\n parser=argparse.ArgumentParser(\n description=\"Generates a uuid using the selected uuid function.\")\n parser.add_argument(\"-u\",\"--uuid\",choices=uuid_funcs.keys(),default=\"uuid4\",\n help=\"The function to use to generate the uuid. \"\n \"By default uuid4 function is used.\")\n parser.add_argument(\"-n\",\"--namespace\",\n help=\"The namespace is a UUID, or '@ns' where 'ns' is a \"\n \"well-known predefined UUID addressed by namespace name. \"\n \"Such as @dns, @url, @oid, and @x500. \"\n \"Only required for uuid3/uuid5 functions.\")\n parser.add_argument(\"-N\",\"--name\",\n help=\"The name used as part of generating the uuid. \"\n \"Only required for uuid3/uuid5 functions.\")\n \n args=parser.parse_args()\n uuid_func=uuid_funcs[args.uuid]\n namespace=args.namespace\n name=args.name\n \n if args.uuid in uuid_namespace_funcs:\n if not namespace or not name:\n parser.error(\n \"Incorrect number of arguments. \"\n f\"{args.uuid} requires a namespace and a name. \"\n \"Run 'python -m uuid -h' for more information.\"\n )\n namespace=namespaces[namespace]if namespace in namespaces else UUID(namespace)\n print(uuid_func(namespace,name))\n else:\n print(uuid_func())\n \n \n \n \nNAMESPACE_DNS=UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_URL=UUID('6ba7b811-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_OID=UUID('6ba7b812-9dad-11d1-80b4-00c04fd430c8')\nNAMESPACE_X500=UUID('6ba7b814-9dad-11d1-80b4-00c04fd430c8')\n\nif __name__ ==\"__main__\":\n main()\n", ["_uuid", "argparse", "enum", "hashlib", "io", "os", "platform", "random", "shutil", "socket", "subprocess", "sys", "time"]], "VFS_import": [".py", "import os\nimport sys\nfrom browser import doc\n\n\n\n\n\n\nVFS=dict(JSObject(__BRYTHON__.py_VFS))\nclass VFSModuleFinder:\n def __init__(self,path_entry):\n print(\"in VFSModuleFinder\")\n if path_entry.startswith('/libs')or path_entry.startswith('/Lib'):\n self.path_entry=path_entry\n else :\n raise ImportError()\n \n def __str__(self):\n return '<%s for \"%s\">'%(self.__class__.__name__,self.path_entry)\n \n def find_module(self,fullname,path=None ):\n path=path or self.path_entry\n \n for _ext in ['js','pyj','py']:\n _filepath=os.path.join(self.path_entry,'%s.%s'%(fullname,_ext))\n if _filepath in VFS:\n print(\"module found at %s:%s\"%(_filepath,fullname))\n return VFSModuleLoader(_filepath,fullname)\n \n print('module %s not found'%fullname)\n raise ImportError()\n return None\n \nclass VFSModuleLoader:\n ''\n \n def __init__(self,filepath,name):\n self._filepath=filepath\n self._name=name\n \n def get_source(self):\n if self._filepath in VFS:\n return JSObject(readFromVFS(self._filepath))\n \n raise ImportError('could not find source for %s'%fullname)\n \n def is_package(self):\n return '.'in self._name\n \n def load_module(self):\n if self._name in sys.modules:\n \n mod=sys.modules[self._name]\n return mod\n \n _src=self.get_source()\n if self._filepath.endswith('.js'):\n mod=JSObject(import_js_module(_src,self._filepath,self._name))\n elif self._filepath.endswith('.py'):\n mod=JSObject(import_py_module(_src,self._filepath,self._name))\n elif self._filepath.endswith('.pyj'):\n mod=JSObject(import_pyj_module(_src,self._filepath,self._name))\n else :\n raise ImportError('Invalid Module: %s'%self._filepath)\n \n \n mod.__file__=self._filepath\n mod.__name__=self._name\n mod.__path__=os.path.abspath(self._filepath)\n mod.__loader__=self\n mod.__package__='.'.join(self._name.split('.')[:-1])\n \n if self.is_package():\n print('adding path for package')\n \n \n mod.__path__=[self.path_entry]\n else :\n print('imported as regular module')\n \n print('creating a new module object for \"%s\"'%self._name)\n sys.modules.setdefault(self._name,mod)\n JSObject(__BRYTHON__.imported)[self._name]=mod\n \n return mod\n \nJSObject(__BRYTHON__.path_hooks.insert(0,VFSModuleFinder))\n", ["browser", "os", "sys"]], "warnings": [".py", "''\n\nimport sys\n\n\n__all__=[\"warn\",\"warn_explicit\",\"showwarning\",\n\"formatwarning\",\"filterwarnings\",\"simplefilter\",\n\"resetwarnings\",\"catch_warnings\"]\n\ndef showwarning(message,category,filename,lineno,file=None,line=None):\n ''\n msg=WarningMessage(message,category,filename,lineno,file,line)\n _showwarnmsg_impl(msg)\n \ndef formatwarning(message,category,filename,lineno,line=None):\n ''\n msg=WarningMessage(message,category,filename,lineno,None,line)\n return _formatwarnmsg_impl(msg)\n \ndef _showwarnmsg_impl(msg):\n file=msg.file\n if file is None:\n file=sys.stderr\n if file is None:\n \n \n return\n text=_formatwarnmsg(msg)\n try:\n file.write(text)\n except OSError:\n \n pass\n \ndef _formatwarnmsg_impl(msg):\n category=msg.category.__name__\n s=f\"{msg.filename}:{msg.lineno}: {category}: {msg.message}\\n\"\n \n if msg.line is None:\n try:\n import linecache\n line=linecache.getline(msg.filename,msg.lineno)\n except Exception:\n \n \n line=None\n linecache=None\n else:\n line=msg.line\n if line:\n line=line.strip()\n s +=\" %s\\n\"%line\n \n if msg.source is not None:\n try:\n import tracemalloc\n \n \n except Exception:\n \n tracing=True\n tb=None\n else:\n tracing=tracemalloc.is_tracing()\n try:\n tb=tracemalloc.get_object_traceback(msg.source)\n except Exception:\n \n \n tb=None\n \n if tb is not None:\n s +='Object allocated at (most recent call last):\\n'\n for frame in tb:\n s +=(' File \"%s\", lineno %s\\n'\n %(frame.filename,frame.lineno))\n \n try:\n if linecache is not None:\n line=linecache.getline(frame.filename,frame.lineno)\n else:\n line=None\n except Exception:\n line=None\n if line:\n line=line.strip()\n s +=' %s\\n'%line\n elif not tracing:\n s +=(f'{category}: Enable tracemalloc to get the object '\n f'allocation traceback\\n')\n return s\n \n \n_showwarning_orig=showwarning\n\ndef _showwarnmsg(msg):\n ''\n try:\n sw=showwarning\n except NameError:\n pass\n else:\n if sw is not _showwarning_orig:\n \n if not callable(sw):\n raise TypeError(\"warnings.showwarning() must be set to a \"\n \"function or method\")\n \n sw(msg.message,msg.category,msg.filename,msg.lineno,\n msg.file,msg.line)\n return\n _showwarnmsg_impl(msg)\n \n \n_formatwarning_orig=formatwarning\n\ndef _formatwarnmsg(msg):\n ''\n try:\n fw=formatwarning\n except NameError:\n pass\n else:\n if fw is not _formatwarning_orig:\n \n return fw(msg.message,msg.category,\n msg.filename,msg.lineno,msg.line)\n return _formatwarnmsg_impl(msg)\n \ndef filterwarnings(action,message=\"\",category=Warning,module=\"\",lineno=0,\nappend=False):\n ''\n\n\n\n\n\n\n\n\n \n assert action in(\"error\",\"ignore\",\"always\",\"default\",\"module\",\n \"once\"),\"invalid action: %r\"%(action,)\n assert isinstance(message,str),\"message must be a string\"\n assert isinstance(category,type),\"category must be a class\"\n assert issubclass(category,Warning),\"category must be a Warning subclass\"\n assert isinstance(module,str),\"module must be a string\"\n assert isinstance(lineno,int)and lineno >=0,\\\n \"lineno must be an int >= 0\"\n \n if message or module:\n import re\n \n if message:\n message=re.compile(message,re.I)\n else:\n message=None\n if module:\n module=re.compile(module)\n else:\n module=None\n \n _add_filter(action,message,category,module,lineno,append=append)\n \ndef simplefilter(action,category=Warning,lineno=0,append=False):\n ''\n\n\n\n\n\n\n\n \n assert action in(\"error\",\"ignore\",\"always\",\"default\",\"module\",\n \"once\"),\"invalid action: %r\"%(action,)\n assert isinstance(lineno,int)and lineno >=0,\\\n \"lineno must be an int >= 0\"\n _add_filter(action,None,category,None,lineno,append=append)\n \ndef _add_filter(*item,append):\n\n\n if not append:\n try:\n filters.remove(item)\n except ValueError:\n pass\n filters.insert(0,item)\n else:\n if item not in filters:\n filters.append(item)\n _filters_mutated()\n \ndef resetwarnings():\n ''\n filters[:]=[]\n _filters_mutated()\n \nclass _OptionError(Exception):\n ''\n pass\n \n \ndef _processoptions(args):\n for arg in args:\n try:\n _setoption(arg)\n except _OptionError as msg:\n print(\"Invalid -W option ignored:\",msg,file=sys.stderr)\n \n \ndef _setoption(arg):\n parts=arg.split(':')\n if len(parts)>5:\n raise _OptionError(\"too many fields (max 5): %r\"%(arg,))\n while len(parts)<5:\n parts.append('')\n action,message,category,module,lineno=[s.strip()\n for s in parts]\n action=_getaction(action)\n category=_getcategory(category)\n if message or module:\n import re\n if message:\n message=re.escape(message)\n if module:\n module=re.escape(module)+r'\\Z'\n if lineno:\n try:\n lineno=int(lineno)\n if lineno <0:\n raise ValueError\n except(ValueError,OverflowError):\n raise _OptionError(\"invalid lineno %r\"%(lineno,))from None\n else:\n lineno=0\n filterwarnings(action,message,category,module,lineno)\n \n \ndef _getaction(action):\n if not action:\n return \"default\"\n if action ==\"all\":return \"always\"\n for a in('default','always','ignore','module','once','error'):\n if a.startswith(action):\n return a\n raise _OptionError(\"invalid action: %r\"%(action,))\n \n \ndef _getcategory(category):\n if not category:\n return Warning\n if '.'not in category:\n import builtins as m\n klass=category\n else:\n module,_,klass=category.rpartition('.')\n try:\n m=__import__(module,None,None,[klass])\n except ImportError:\n raise _OptionError(\"invalid module name: %r\"%(module,))from None\n try:\n cat=getattr(m,klass)\n except AttributeError:\n raise _OptionError(\"unknown warning category: %r\"%(category,))from None\n if not issubclass(cat,Warning):\n raise _OptionError(\"invalid warning category: %r\"%(category,))\n return cat\n \n \ndef _is_internal_filename(filename):\n return 'importlib'in filename and '_bootstrap'in filename\n \n \ndef _is_filename_to_skip(filename,skip_file_prefixes):\n return any(filename.startswith(prefix)for prefix in skip_file_prefixes)\n \n \ndef _is_internal_frame(frame):\n ''\n return _is_internal_filename(frame.f_code.co_filename)\n \n \ndef _next_external_frame(frame,skip_file_prefixes):\n ''\n frame=frame.f_back\n while frame is not None and(\n _is_internal_filename(filename :=frame.f_code.co_filename)or\n _is_filename_to_skip(filename,skip_file_prefixes)):\n frame=frame.f_back\n return frame\n \n \n \ndef warn(message,category=None,stacklevel=1,source=None,\n*,skip_file_prefixes=()):\n ''\n \n if isinstance(message,Warning):\n category=message.__class__\n \n if category is None:\n category=UserWarning\n if not(isinstance(category,type)and issubclass(category,Warning)):\n raise TypeError(\"category must be a Warning subclass, \"\n \"not '{:s}'\".format(type(category).__name__))\n if not isinstance(skip_file_prefixes,tuple):\n \n raise TypeError('skip_file_prefixes must be a tuple of strs.')\n if skip_file_prefixes:\n stacklevel=max(2,stacklevel)\n \n try:\n if stacklevel <=1 or _is_internal_frame(sys._getframe(1)):\n \n \n frame=sys._getframe(stacklevel)\n else:\n frame=sys._getframe(1)\n \n for x in range(stacklevel -1):\n frame=_next_external_frame(frame,skip_file_prefixes)\n if frame is None:\n raise ValueError\n except ValueError:\n globals=sys.__dict__\n filename=\"sys\"\n lineno=1\n else:\n globals=frame.f_globals\n filename=frame.f_code.co_filename\n lineno=frame.f_lineno\n if '__name__'in globals:\n module=globals['__name__']\n else:\n module=\"\"\n registry=globals.setdefault(\"__warningregistry__\",{})\n warn_explicit(message,category,filename,lineno,module,registry,\n globals,source)\n \ndef warn_explicit(message,category,filename,lineno,\nmodule=None,registry=None,module_globals=None,\nsource=None):\n lineno=int(lineno)\n if module is None:\n module=filename or \"\"\n if module[-3:].lower()==\".py\":\n module=module[:-3]\n if registry is None:\n registry={}\n if registry.get('version',0)!=_filters_version:\n registry.clear()\n registry['version']=_filters_version\n if isinstance(message,Warning):\n text=str(message)\n category=message.__class__\n else:\n text=message\n message=category(message)\n key=(text,category,lineno)\n \n if registry.get(key):\n return\n \n for item in filters:\n action,msg,cat,mod,ln=item\n if((msg is None or msg.match(text))and\n issubclass(category,cat)and\n (mod is None or mod.match(module))and\n (ln ==0 or lineno ==ln)):\n break\n else:\n action=defaultaction\n \n if action ==\"ignore\":\n return\n \n \n \n import linecache\n linecache.getlines(filename,module_globals)\n \n if action ==\"error\":\n raise message\n \n if action ==\"once\":\n registry[key]=1\n oncekey=(text,category)\n if onceregistry.get(oncekey):\n return\n onceregistry[oncekey]=1\n elif action ==\"always\":\n pass\n elif action ==\"module\":\n registry[key]=1\n altkey=(text,category,0)\n if registry.get(altkey):\n return\n registry[altkey]=1\n elif action ==\"default\":\n registry[key]=1\n else:\n \n raise RuntimeError(\n \"Unrecognized action (%r) in warnings.filters:\\n %s\"%\n (action,item))\n \n msg=WarningMessage(message,category,filename,lineno,source)\n _showwarnmsg(msg)\n \n \nclass WarningMessage(object):\n\n _WARNING_DETAILS=(\"message\",\"category\",\"filename\",\"lineno\",\"file\",\n \"line\",\"source\")\n \n def __init__(self,message,category,filename,lineno,file=None,\n line=None,source=None):\n self.message=message\n self.category=category\n self.filename=filename\n self.lineno=lineno\n self.file=file\n self.line=line\n self.source=source\n self._category_name=category.__name__ if category else None\n \n def __str__(self):\n return(\"{message : %r, category : %r, filename : %r, lineno : %s, \"\n \"line : %r}\"%(self.message,self._category_name,\n self.filename,self.lineno,self.line))\n \n \nclass catch_warnings(object):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,*,record=False,module=None,\n action=None,category=Warning,lineno=0,append=False):\n ''\n\n\n\n\n\n \n self._record=record\n self._module=sys.modules['warnings']if module is None else module\n self._entered=False\n if action is None:\n self._filter=None\n else:\n self._filter=(action,category,lineno,append)\n \n def __repr__(self):\n args=[]\n if self._record:\n args.append(\"record=True\")\n if self._module is not sys.modules['warnings']:\n args.append(\"module=%r\"%self._module)\n name=type(self).__name__\n return \"%s(%s)\"%(name,\", \".join(args))\n \n def __enter__(self):\n if self._entered:\n raise RuntimeError(\"Cannot enter %r twice\"%self)\n self._entered=True\n self._filters=self._module.filters\n self._module.filters=self._filters[:]\n self._module._filters_mutated()\n self._showwarning=self._module.showwarning\n self._showwarnmsg_impl=self._module._showwarnmsg_impl\n if self._filter is not None:\n simplefilter(*self._filter)\n if self._record:\n log=[]\n self._module._showwarnmsg_impl=log.append\n \n \n self._module.showwarning=self._module._showwarning_orig\n return log\n else:\n return None\n \n def __exit__(self,*exc_info):\n if not self._entered:\n raise RuntimeError(\"Cannot exit %r without entering first\"%self)\n self._module.filters=self._filters\n self._module._filters_mutated()\n self._module.showwarning=self._showwarning\n self._module._showwarnmsg_impl=self._showwarnmsg_impl\n \n \n_DEPRECATED_MSG=\"{name!r} is deprecated and slated for removal in Python {remove}\"\n\ndef _deprecated(name,message=_DEPRECATED_MSG,*,remove,_version=sys.version_info):\n ''\n\n\n\n\n\n\n\n \n remove_formatted=f\"{remove[0]}.{remove[1]}\"\n if(_version[:2]>remove)or(_version[:2]==remove and _version[3]!=\"alpha\"):\n msg=f\"{name !r} was slated for removal after Python {remove_formatted} alpha\"\n raise RuntimeError(msg)\n else:\n msg=message.format(name=name,remove=remove_formatted)\n warn(msg,DeprecationWarning,stacklevel=3)\n \n \n \ndef _warn_unawaited_coroutine(coro):\n msg_lines=[\n f\"coroutine '{coro.__qualname__}' was never awaited\\n\"\n ]\n if coro.cr_origin is not None:\n import linecache,traceback\n def extract():\n for filename,lineno,funcname in reversed(coro.cr_origin):\n line=linecache.getline(filename,lineno)\n yield(filename,lineno,funcname,line)\n msg_lines.append(\"Coroutine created at (most recent call last)\\n\")\n msg_lines +=traceback.format_list(list(extract()))\n msg=\"\".join(msg_lines).rstrip(\"\\n\")\n \n \n \n \n \n \n warn(msg,category=RuntimeWarning,stacklevel=2,source=coro)\n \n \n \n \n \n \n \n \n \n \ntry:\n from _warnings import(filters,_defaultaction,_onceregistry,\n warn,warn_explicit,_filters_mutated)\n defaultaction=_defaultaction\n onceregistry=_onceregistry\n _warnings_defaults=True\nexcept ImportError:\n filters=[]\n defaultaction=\"default\"\n onceregistry={}\n \n _filters_version=1\n \n def _filters_mutated():\n global _filters_version\n _filters_version +=1\n \n _warnings_defaults=False\n \n \n \n_processoptions(sys.warnoptions)\nif not _warnings_defaults:\n\n if not hasattr(sys,'gettotalrefcount'):\n filterwarnings(\"default\",category=DeprecationWarning,\n module=\"__main__\",append=1)\n simplefilter(\"ignore\",category=DeprecationWarning,append=1)\n simplefilter(\"ignore\",category=PendingDeprecationWarning,append=1)\n simplefilter(\"ignore\",category=ImportWarning,append=1)\n simplefilter(\"ignore\",category=ResourceWarning,append=1)\n \ndel _warnings_defaults\n", ["_warnings", "builtins", "linecache", "re", "sys", "traceback", "tracemalloc"]], "weakref": [".py", "''\n\n\n\n\n\n\n\n\n\n\nfrom _weakref import (\ngetweakrefcount,\ngetweakrefs,\nref,\nproxy,\nCallableProxyType,\nProxyType,\nReferenceType,\n_remove_dead_weakref)\n\nfrom _weakrefset import WeakSet,_IterationGuard\n\nimport _collections_abc\nimport sys\nimport itertools\n\nProxyTypes=(ProxyType,CallableProxyType)\n\n__all__=[\"ref\",\"proxy\",\"getweakrefcount\",\"getweakrefs\",\n\"WeakKeyDictionary\",\"ReferenceType\",\"ProxyType\",\n\"CallableProxyType\",\"ProxyTypes\",\"WeakValueDictionary\",\n\"WeakSet\",\"WeakMethod\",\"finalize\"]\n\n\n_collections_abc.MutableSet.register(WeakSet)\n\nclass WeakMethod(ref):\n ''\n\n\n \n \n __slots__=\"_func_ref\",\"_meth_type\",\"_alive\",\"__weakref__\"\n \n def __new__(cls,meth,callback=None ):\n try :\n obj=meth.__self__\n func=meth.__func__\n except AttributeError:\n raise TypeError(\"argument should be a bound method, not {}\"\n .format(type(meth)))from None\n def _cb(arg):\n \n \n self=self_wr()\n if self._alive:\n self._alive=False\n if callback is not None :\n callback(self)\n self=ref.__new__(cls,obj,_cb)\n self._func_ref=ref(func,_cb)\n self._meth_type=type(meth)\n self._alive=True\n self_wr=ref(self)\n return self\n \n def __call__(self):\n obj=super().__call__()\n func=self._func_ref()\n if obj is None or func is None :\n return None\n return self._meth_type(func,obj)\n \n def __eq__(self,other):\n if isinstance(other,WeakMethod):\n if not self._alive or not other._alive:\n return self is other\n return ref.__eq__(self,other)and self._func_ref ==other._func_ref\n return NotImplemented\n \n def __ne__(self,other):\n if isinstance(other,WeakMethod):\n if not self._alive or not other._alive:\n return self is not other\n return ref.__ne__(self,other)or self._func_ref !=other._func_ref\n return NotImplemented\n \n __hash__=ref.__hash__\n \n \nclass WeakValueDictionary(_collections_abc.MutableMapping):\n ''\n\n\n\n \n \n \n \n \n \n \n def __init__(self,other=(),/,**kw):\n def remove(wr,selfref=ref(self),_atomic_removal=_remove_dead_weakref):\n self=selfref()\n if self is not None :\n if self._iterating:\n self._pending_removals.append(wr.key)\n else :\n \n \n _atomic_removal(self.data,wr.key)\n self._remove=remove\n \n self._pending_removals=[]\n self._iterating=set()\n self.data={}\n self.update(other,**kw)\n \n def _commit_removals(self,_atomic_removal=_remove_dead_weakref):\n pop=self._pending_removals.pop\n d=self.data\n \n \n while True :\n try :\n key=pop()\n except IndexError:\n return\n _atomic_removal(d,key)\n \n def __getitem__(self,key):\n if self._pending_removals:\n self._commit_removals()\n o=self.data[key]()\n if o is None :\n raise KeyError(key)\n else :\n return o\n \n def __delitem__(self,key):\n if self._pending_removals:\n self._commit_removals()\n del self.data[key]\n \n def __len__(self):\n if self._pending_removals:\n self._commit_removals()\n return len(self.data)\n \n def __contains__(self,key):\n if self._pending_removals:\n self._commit_removals()\n try :\n o=self.data[key]()\n except KeyError:\n return False\n return o is not None\n \n def __repr__(self):\n return \"<%s at %#x>\"%(self.__class__.__name__,id(self))\n \n def __setitem__(self,key,value):\n if self._pending_removals:\n self._commit_removals()\n self.data[key]=KeyedRef(value,self._remove,key)\n \n def copy(self):\n if self._pending_removals:\n self._commit_removals()\n new=WeakValueDictionary()\n with _IterationGuard(self):\n for key,wr in self.data.items():\n o=wr()\n if o is not None :\n new[key]=o\n return new\n \n __copy__=copy\n \n def __deepcopy__(self,memo):\n from copy import deepcopy\n if self._pending_removals:\n self._commit_removals()\n new=self.__class__()\n with _IterationGuard(self):\n for key,wr in self.data.items():\n o=wr()\n if o is not None :\n new[deepcopy(key,memo)]=o\n return new\n \n def get(self,key,default=None ):\n if self._pending_removals:\n self._commit_removals()\n try :\n wr=self.data[key]\n except KeyError:\n return default\n else :\n o=wr()\n if o is None :\n \n return default\n else :\n return o\n \n def items(self):\n if self._pending_removals:\n self._commit_removals()\n with _IterationGuard(self):\n for k,wr in self.data.items():\n v=wr()\n if v is not None :\n yield k,v\n \n def keys(self):\n if self._pending_removals:\n self._commit_removals()\n with _IterationGuard(self):\n for k,wr in self.data.items():\n if wr()is not None :\n yield k\n \n __iter__=keys\n \n def itervaluerefs(self):\n ''\n\n\n\n\n\n\n\n \n if self._pending_removals:\n self._commit_removals()\n with _IterationGuard(self):\n yield from self.data.values()\n \n def values(self):\n if self._pending_removals:\n self._commit_removals()\n with _IterationGuard(self):\n for wr in self.data.values():\n obj=wr()\n if obj is not None :\n yield obj\n \n def popitem(self):\n if self._pending_removals:\n self._commit_removals()\n while True :\n key,wr=self.data.popitem()\n o=wr()\n if o is not None :\n return key,o\n \n def pop(self,key,*args):\n if self._pending_removals:\n self._commit_removals()\n try :\n o=self.data.pop(key)()\n except KeyError:\n o=None\n if o is None :\n if args:\n return args[0]\n else :\n raise KeyError(key)\n else :\n return o\n \n def setdefault(self,key,default=None ):\n try :\n o=self.data[key]()\n except KeyError:\n o=None\n if o is None :\n if self._pending_removals:\n self._commit_removals()\n self.data[key]=KeyedRef(default,self._remove,key)\n return default\n else :\n return o\n \n def update(self,other=None ,/,**kwargs):\n if self._pending_removals:\n self._commit_removals()\n d=self.data\n if other is not None :\n if not hasattr(other,\"items\"):\n other=dict(other)\n for key,o in other.items():\n d[key]=KeyedRef(o,self._remove,key)\n for key,o in kwargs.items():\n d[key]=KeyedRef(o,self._remove,key)\n \n def valuerefs(self):\n ''\n\n\n\n\n\n\n\n \n if self._pending_removals:\n self._commit_removals()\n return list(self.data.values())\n \n def __ior__(self,other):\n self.update(other)\n return self\n \n def __or__(self,other):\n if isinstance(other,_collections_abc.Mapping):\n c=self.copy()\n c.update(other)\n return c\n return NotImplemented\n \n def __ror__(self,other):\n if isinstance(other,_collections_abc.Mapping):\n c=self.__class__()\n c.update(other)\n c.update(self)\n return c\n return NotImplemented\n \n \nclass KeyedRef(ref):\n ''\n\n\n\n\n\n\n \n \n __slots__=\"key\",\n \n def __new__(type,ob,callback,key):\n self=ref.__new__(type,ob,callback)\n self.key=key\n return self\n \n def __init__(self,ob,callback,key):\n super().__init__(ob,callback)\n \n \nclass WeakKeyDictionary(_collections_abc.MutableMapping):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,dict=None ):\n self.data={}\n def remove(k,selfref=ref(self)):\n self=selfref()\n if self is not None :\n if self._iterating:\n self._pending_removals.append(k)\n else :\n try :\n del self.data[k]\n except KeyError:\n pass\n self._remove=remove\n \n self._pending_removals=[]\n self._iterating=set()\n self._dirty_len=False\n if dict is not None :\n self.update(dict)\n \n def _commit_removals(self):\n \n \n \n \n pop=self._pending_removals.pop\n d=self.data\n while True :\n try :\n key=pop()\n except IndexError:\n return\n \n try :\n del d[key]\n except KeyError:\n pass\n \n def _scrub_removals(self):\n d=self.data\n self._pending_removals=[k for k in self._pending_removals if k in d]\n self._dirty_len=False\n \n def __delitem__(self,key):\n self._dirty_len=True\n del self.data[ref(key)]\n \n def __getitem__(self,key):\n return self.data[ref(key)]\n \n def __len__(self):\n if self._dirty_len and self._pending_removals:\n \n \n self._scrub_removals()\n return len(self.data)-len(self._pending_removals)\n \n def __repr__(self):\n return \"<%s at %#x>\"%(self.__class__.__name__,id(self))\n \n def __setitem__(self,key,value):\n self.data[ref(key,self._remove)]=value\n \n def copy(self):\n new=WeakKeyDictionary()\n with _IterationGuard(self):\n for key,value in self.data.items():\n o=key()\n if o is not None :\n new[o]=value\n return new\n \n __copy__=copy\n \n def __deepcopy__(self,memo):\n from copy import deepcopy\n new=self.__class__()\n with _IterationGuard(self):\n for key,value in self.data.items():\n o=key()\n if o is not None :\n new[o]=deepcopy(value,memo)\n return new\n \n def get(self,key,default=None ):\n return self.data.get(ref(key),default)\n \n def __contains__(self,key):\n try :\n wr=ref(key)\n except TypeError:\n return False\n return wr in self.data\n \n def items(self):\n with _IterationGuard(self):\n for wr,value in self.data.items():\n key=wr()\n if key is not None :\n yield key,value\n \n def keys(self):\n with _IterationGuard(self):\n for wr in self.data:\n obj=wr()\n if obj is not None :\n yield obj\n \n __iter__=keys\n \n def values(self):\n with _IterationGuard(self):\n for wr,value in self.data.items():\n if wr()is not None :\n yield value\n \n def keyrefs(self):\n ''\n\n\n\n\n\n\n\n \n return list(self.data)\n \n def popitem(self):\n self._dirty_len=True\n while True :\n key,value=self.data.popitem()\n o=key()\n if o is not None :\n return o,value\n \n def pop(self,key,*args):\n self._dirty_len=True\n return self.data.pop(ref(key),*args)\n \n def setdefault(self,key,default=None ):\n return self.data.setdefault(ref(key,self._remove),default)\n \n def update(self,dict=None ,/,**kwargs):\n d=self.data\n if dict is not None :\n if not hasattr(dict,\"items\"):\n dict=type({})(dict)\n for key,value in dict.items():\n d[ref(key,self._remove)]=value\n if len(kwargs):\n self.update(kwargs)\n \n def __ior__(self,other):\n self.update(other)\n return self\n \n def __or__(self,other):\n if isinstance(other,_collections_abc.Mapping):\n c=self.copy()\n c.update(other)\n return c\n return NotImplemented\n \n def __ror__(self,other):\n if isinstance(other,_collections_abc.Mapping):\n c=self.__class__()\n c.update(other)\n c.update(self)\n return c\n return NotImplemented\n \n \nclass finalize:\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n __slots__=()\n _registry={}\n _shutdown=False\n _index_iter=itertools.count()\n _dirty=False\n _registered_with_atexit=False\n \n class _Info:\n __slots__=(\"weakref\",\"func\",\"args\",\"kwargs\",\"atexit\",\"index\")\n \n def __init__(self,obj,func,/,*args,**kwargs):\n if not self._registered_with_atexit:\n \n \n import atexit\n atexit.register(self._exitfunc)\n finalize._registered_with_atexit=True\n info=self._Info()\n info.weakref=ref(obj,self)\n info.func=func\n info.args=args\n info.kwargs=kwargs or None\n info.atexit=True\n info.index=next(self._index_iter)\n self._registry[self]=info\n finalize._dirty=True\n \n def __call__(self,_=None ):\n ''\n \n info=self._registry.pop(self,None )\n if info and not self._shutdown:\n return info.func(*info.args,**(info.kwargs or {}))\n \n def detach(self):\n ''\n \n info=self._registry.get(self)\n obj=info and info.weakref()\n if obj is not None and self._registry.pop(self,None ):\n return (obj,info.func,info.args,info.kwargs or {})\n \n def peek(self):\n ''\n \n info=self._registry.get(self)\n obj=info and info.weakref()\n if obj is not None :\n return (obj,info.func,info.args,info.kwargs or {})\n \n @property\n def alive(self):\n ''\n return self in self._registry\n \n @property\n def atexit(self):\n ''\n info=self._registry.get(self)\n return bool(info)and info.atexit\n \n @atexit.setter\n def atexit(self,value):\n info=self._registry.get(self)\n if info:\n info.atexit=bool(value)\n \n def __repr__(self):\n info=self._registry.get(self)\n obj=info and info.weakref()\n if obj is None :\n return '<%s object at %#x; dead>'%(type(self).__name__,id(self))\n else :\n return '<%s object at %#x; for %r at %#x>'%\\\n (type(self).__name__,id(self),type(obj).__name__,id(obj))\n \n @classmethod\n def _select_for_exit(cls):\n \n L=[(f,i)for (f,i)in cls._registry.items()if i.atexit]\n L.sort(key=lambda item:item[1].index)\n return [f for (f,i)in L]\n \n @classmethod\n def _exitfunc(cls):\n \n \n \n reenable_gc=False\n try :\n if cls._registry:\n import gc\n if gc.isenabled():\n reenable_gc=True\n gc.disable()\n pending=None\n while True :\n if pending is None or finalize._dirty:\n pending=cls._select_for_exit()\n finalize._dirty=False\n if not pending:\n break\n f=pending.pop()\n try :\n \n \n \n \n f()\n except Exception:\n sys.excepthook(*sys.exc_info())\n assert f not in cls._registry\n finally :\n \n finalize._shutdown=True\n if reenable_gc:\n gc.enable()\n", ["_collections_abc", "_weakref", "_weakrefset", "atexit", "copy", "gc", "itertools", "sys"]], "webbrowser": [".py", "\n\nfrom browser import window\n\ndef open(url,new=0,autoraise=True ):\n window.open(url)\n \ndef open_new(url):\n return window.open(url,\"_blank\")\n \ndef open_new_tab(url):\n return open(url)\n \n", ["browser"]], "zipfile": [".py", "''\n\n\n\n\nimport binascii\nimport importlib.util\nimport io\nimport itertools\nimport os\nimport posixpath\nimport shutil\nimport stat\nimport struct\nimport sys\nimport threading\nimport time\nimport contextlib\nimport pathlib\n\ntry :\n import zlib\n crc32=zlib.crc32\nexcept ImportError:\n zlib=None\n crc32=binascii.crc32\n \ntry :\n import bz2\nexcept ImportError:\n bz2=None\n \ntry :\n import lzma\nexcept ImportError:\n lzma=None\n \n__all__=[\"BadZipFile\",\"BadZipfile\",\"error\",\n\"ZIP_STORED\",\"ZIP_DEFLATED\",\"ZIP_BZIP2\",\"ZIP_LZMA\",\n\"is_zipfile\",\"ZipInfo\",\"ZipFile\",\"PyZipFile\",\"LargeZipFile\",\n\"Path\"]\n\nclass BadZipFile(Exception):\n pass\n \n \nclass LargeZipFile(Exception):\n ''\n\n\n \n \nerror=BadZipfile=BadZipFile\n\n\nZIP64_LIMIT=(1 <<31)-1\nZIP_FILECOUNT_LIMIT=(1 <<16)-1\nZIP_MAX_COMMENT=(1 <<16)-1\n\n\nZIP_STORED=0\nZIP_DEFLATED=8\nZIP_BZIP2=12\nZIP_LZMA=14\n\n\nDEFAULT_VERSION=20\nZIP64_VERSION=45\nBZIP2_VERSION=46\nLZMA_VERSION=63\n\nMAX_EXTRACT_VERSION=63\n\n\n\n\n\n\n\n\n\nstructEndArchive=b\"<4s4H2LH\"\nstringEndArchive=b\"PK\\005\\006\"\nsizeEndCentDir=struct.calcsize(structEndArchive)\n\n_ECD_SIGNATURE=0\n_ECD_DISK_NUMBER=1\n_ECD_DISK_START=2\n_ECD_ENTRIES_THIS_DISK=3\n_ECD_ENTRIES_TOTAL=4\n_ECD_SIZE=5\n_ECD_OFFSET=6\n_ECD_COMMENT_SIZE=7\n\n\n_ECD_COMMENT=8\n_ECD_LOCATION=9\n\n\n\nstructCentralDir=\"<4s4B4HL2L5H2L\"\nstringCentralDir=b\"PK\\001\\002\"\nsizeCentralDir=struct.calcsize(structCentralDir)\n\n\n_CD_SIGNATURE=0\n_CD_CREATE_VERSION=1\n_CD_CREATE_SYSTEM=2\n_CD_EXTRACT_VERSION=3\n_CD_EXTRACT_SYSTEM=4\n_CD_FLAG_BITS=5\n_CD_COMPRESS_TYPE=6\n_CD_TIME=7\n_CD_DATE=8\n_CD_CRC=9\n_CD_COMPRESSED_SIZE=10\n_CD_UNCOMPRESSED_SIZE=11\n_CD_FILENAME_LENGTH=12\n_CD_EXTRA_FIELD_LENGTH=13\n_CD_COMMENT_LENGTH=14\n_CD_DISK_NUMBER_START=15\n_CD_INTERNAL_FILE_ATTRIBUTES=16\n_CD_EXTERNAL_FILE_ATTRIBUTES=17\n_CD_LOCAL_HEADER_OFFSET=18\n\n\n\n_MASK_ENCRYPTED=1 <<0\n\n_MASK_COMPRESS_OPTION_1=1 <<1\n\n\n\n\n_MASK_USE_DATA_DESCRIPTOR=1 <<3\n\n\n_MASK_COMPRESSED_PATCH=1 <<5\n_MASK_STRONG_ENCRYPTION=1 <<6\n\n\n\n\n_MASK_UTF_FILENAME=1 <<11\n\n\n\n\n\n\n\n\n\nstructFileHeader=\"<4s2B4HL2L2H\"\nstringFileHeader=b\"PK\\003\\004\"\nsizeFileHeader=struct.calcsize(structFileHeader)\n\n_FH_SIGNATURE=0\n_FH_EXTRACT_VERSION=1\n_FH_EXTRACT_SYSTEM=2\n_FH_GENERAL_PURPOSE_FLAG_BITS=3\n_FH_COMPRESSION_METHOD=4\n_FH_LAST_MOD_TIME=5\n_FH_LAST_MOD_DATE=6\n_FH_CRC=7\n_FH_COMPRESSED_SIZE=8\n_FH_UNCOMPRESSED_SIZE=9\n_FH_FILENAME_LENGTH=10\n_FH_EXTRA_FIELD_LENGTH=11\n\n\nstructEndArchive64Locator=\"<4sLQL\"\nstringEndArchive64Locator=b\"PK\\x06\\x07\"\nsizeEndCentDir64Locator=struct.calcsize(structEndArchive64Locator)\n\n\n\nstructEndArchive64=\"<4sQ2H2L4Q\"\nstringEndArchive64=b\"PK\\x06\\x06\"\nsizeEndCentDir64=struct.calcsize(structEndArchive64)\n\n_CD64_SIGNATURE=0\n_CD64_DIRECTORY_RECSIZE=1\n_CD64_CREATE_VERSION=2\n_CD64_EXTRACT_VERSION=3\n_CD64_DISK_NUMBER=4\n_CD64_DISK_NUMBER_START=5\n_CD64_NUMBER_ENTRIES_THIS_DISK=6\n_CD64_NUMBER_ENTRIES_TOTAL=7\n_CD64_DIRECTORY_SIZE=8\n_CD64_OFFSET_START_CENTDIR=9\n\n_DD_SIGNATURE=0x08074b50\n\n_EXTRA_FIELD_STRUCT=struct.Struct('1:\n raise BadZipFile(\"zipfiles that span multiple disks are not supported\")\n \n \n fpin.seek(offset -sizeEndCentDir64Locator -sizeEndCentDir64,2)\n data=fpin.read(sizeEndCentDir64)\n if len(data)!=sizeEndCentDir64:\n return endrec\n sig,sz,create_version,read_version,disk_num,disk_dir,\\\n dircount,dircount2,dirsize,diroffset=\\\n struct.unpack(structEndArchive64,data)\n if sig !=stringEndArchive64:\n return endrec\n \n \n endrec[_ECD_SIGNATURE]=sig\n endrec[_ECD_DISK_NUMBER]=disk_num\n endrec[_ECD_DISK_START]=disk_dir\n endrec[_ECD_ENTRIES_THIS_DISK]=dircount\n endrec[_ECD_ENTRIES_TOTAL]=dircount2\n endrec[_ECD_SIZE]=dirsize\n endrec[_ECD_OFFSET]=diroffset\n return endrec\n \n \ndef _EndRecData(fpin):\n ''\n\n\n \n \n \n fpin.seek(0,2)\n filesize=fpin.tell()\n \n \n \n \n try :\n fpin.seek(-sizeEndCentDir,2)\n except OSError:\n return None\n data=fpin.read()\n if (len(data)==sizeEndCentDir and\n data[0:4]==stringEndArchive and\n data[-2:]==b\"\\000\\000\"):\n \n endrec=struct.unpack(structEndArchive,data)\n endrec=list(endrec)\n \n \n endrec.append(b\"\")\n endrec.append(filesize -sizeEndCentDir)\n \n \n return _EndRecData64(fpin,-sizeEndCentDir,endrec)\n \n \n \n \n \n \n maxCommentStart=max(filesize -(1 <<16)-sizeEndCentDir,0)\n fpin.seek(maxCommentStart,0)\n data=fpin.read()\n start=data.rfind(stringEndArchive)\n if start >=0:\n \n recData=data[start:start+sizeEndCentDir]\n if len(recData)!=sizeEndCentDir:\n \n return None\n endrec=list(struct.unpack(structEndArchive,recData))\n commentSize=endrec[_ECD_COMMENT_SIZE]\n comment=data[start+sizeEndCentDir:start+sizeEndCentDir+commentSize]\n endrec.append(comment)\n endrec.append(maxCommentStart+start)\n \n \n return _EndRecData64(fpin,maxCommentStart+start -filesize,\n endrec)\n \n \n return None\n \n \nclass ZipInfo(object):\n ''\n \n __slots__=(\n 'orig_filename',\n 'filename',\n 'date_time',\n 'compress_type',\n '_compresslevel',\n 'comment',\n 'extra',\n 'create_system',\n 'create_version',\n 'extract_version',\n 'reserved',\n 'flag_bits',\n 'volume',\n 'internal_attr',\n 'external_attr',\n 'header_offset',\n 'CRC',\n 'compress_size',\n 'file_size',\n '_raw_time',\n )\n \n def __init__(self,filename=\"NoName\",date_time=(1980,1,1,0,0,0)):\n self.orig_filename=filename\n \n \n \n null_byte=filename.find(chr(0))\n if null_byte >=0:\n filename=filename[0:null_byte]\n \n \n \n if os.sep !=\"/\"and os.sep in filename:\n filename=filename.replace(os.sep,\"/\")\n \n self.filename=filename\n self.date_time=date_time\n \n if date_time[0]<1980:\n raise ValueError('ZIP does not support timestamps before 1980')\n \n \n self.compress_type=ZIP_STORED\n self._compresslevel=None\n self.comment=b\"\"\n self.extra=b\"\"\n if sys.platform =='win32':\n self.create_system=0\n else :\n \n self.create_system=3\n self.create_version=DEFAULT_VERSION\n self.extract_version=DEFAULT_VERSION\n self.reserved=0\n self.flag_bits=0\n self.volume=0\n self.internal_attr=0\n self.external_attr=0\n self.compress_size=0\n self.file_size=0\n \n \n \n \n def __repr__(self):\n result=['<%s filename=%r'%(self.__class__.__name__,self.filename)]\n if self.compress_type !=ZIP_STORED:\n result.append(' compress_type=%s'%\n compressor_names.get(self.compress_type,\n self.compress_type))\n hi=self.external_attr >>16\n lo=self.external_attr&0xFFFF\n if hi:\n result.append(' filemode=%r'%stat.filemode(hi))\n if lo:\n result.append(' external_attr=%#x'%lo)\n isdir=self.is_dir()\n if not isdir or self.file_size:\n result.append(' file_size=%r'%self.file_size)\n if ((not isdir or self.compress_size)and\n (self.compress_type !=ZIP_STORED or\n self.file_size !=self.compress_size)):\n result.append(' compress_size=%r'%self.compress_size)\n result.append('>')\n return ''.join(result)\n \n def FileHeader(self,zip64=None ):\n ''\n dt=self.date_time\n dosdate=(dt[0]-1980)<<9 |dt[1]<<5 |dt[2]\n dostime=dt[3]<<11 |dt[4]<<5 |(dt[5]//2)\n if self.flag_bits&_MASK_USE_DATA_DESCRIPTOR:\n \n CRC=compress_size=file_size=0\n else :\n CRC=self.CRC\n compress_size=self.compress_size\n file_size=self.file_size\n \n extra=self.extra\n \n min_version=0\n if zip64 is None :\n zip64=file_size >ZIP64_LIMIT or compress_size >ZIP64_LIMIT\n if zip64:\n fmt='ZIP64_LIMIT or compress_size >ZIP64_LIMIT:\n if not zip64:\n raise LargeZipFile(\"Filesize would require ZIP64 extensions\")\n \n \n file_size=0xffffffff\n compress_size=0xffffffff\n min_version=ZIP64_VERSION\n \n if self.compress_type ==ZIP_BZIP2:\n min_version=max(BZIP2_VERSION,min_version)\n elif self.compress_type ==ZIP_LZMA:\n min_version=max(LZMA_VERSION,min_version)\n \n self.extract_version=max(min_version,self.extract_version)\n self.create_version=max(min_version,self.create_version)\n filename,flag_bits=self._encodeFilenameFlags()\n header=struct.pack(structFileHeader,stringFileHeader,\n self.extract_version,self.reserved,flag_bits,\n self.compress_type,dostime,dosdate,CRC,\n compress_size,file_size,\n len(filename),len(extra))\n return header+filename+extra\n \n def _encodeFilenameFlags(self):\n try :\n return self.filename.encode('ascii'),self.flag_bits\n except UnicodeEncodeError:\n return self.filename.encode('utf-8'),self.flag_bits |_MASK_UTF_FILENAME\n \n def _decodeExtra(self):\n \n extra=self.extra\n unpack=struct.unpack\n while len(extra)>=4:\n tp,ln=unpack('len(extra):\n raise BadZipFile(\"Corrupt extra field %04x (size=%d)\"%(tp,ln))\n if tp ==0x0001:\n data=extra[4:ln+4]\n \n try :\n if self.file_size in (0xFFFF_FFFF_FFFF_FFFF,0xFFFF_FFFF):\n field=\"File size\"\n self.file_size,=unpack('2107:\n date_time=(2107,12,31,23,59,59)\n \n if arcname is None :\n arcname=filename\n arcname=os.path.normpath(os.path.splitdrive(arcname)[1])\n while arcname[0]in (os.sep,os.altsep):\n arcname=arcname[1:]\n if isdir:\n arcname +='/'\n zinfo=cls(arcname,date_time)\n zinfo.external_attr=(st.st_mode&0xFFFF)<<16\n if isdir:\n zinfo.file_size=0\n zinfo.external_attr |=0x10\n else :\n zinfo.file_size=st.st_size\n \n return zinfo\n \n def is_dir(self):\n ''\n return self.filename[-1]=='/'\n \n \n \n \n \n \n_crctable=None\ndef _gen_crc(crc):\n for j in range(8):\n if crc&1:\n crc=(crc >>1)^0xEDB88320\n else :\n crc >>=1\n return crc\n \n \n \n \n \n \n \n \n \ndef _ZipDecrypter(pwd):\n key0=305419896\n key1=591751049\n key2=878082192\n \n global _crctable\n if _crctable is None :\n _crctable=list(map(_gen_crc,range(256)))\n crctable=_crctable\n \n def crc32(ch,crc):\n ''\n return (crc >>8)^crctable[(crc ^ch)&0xFF]\n \n def update_keys(c):\n nonlocal key0,key1,key2\n key0=crc32(c,key0)\n key1=(key1+(key0&0xFF))&0xFFFFFFFF\n key1=(key1 *134775813+1)&0xFFFFFFFF\n key2=crc32(key1 >>24,key2)\n \n for p in pwd:\n update_keys(p)\n \n def decrypter(data):\n ''\n result=bytearray()\n append=result.append\n for c in data:\n k=key2 |2\n c ^=((k *(k ^1))>>8)&0xFF\n update_keys(c)\n append(c)\n return bytes(result)\n \n return decrypter\n \n \nclass LZMACompressor:\n\n def __init__(self):\n self._comp=None\n \n def _init(self):\n props=lzma._encode_filter_properties({'id':lzma.FILTER_LZMA1})\n self._comp=lzma.LZMACompressor(lzma.FORMAT_RAW,filters=[\n lzma._decode_filter_properties(lzma.FILTER_LZMA1,props)\n ])\n return struct.pack('>8)&0xff\n else :\n \n check_byte=(zipinfo.CRC >>24)&0xff\n h=self._init_decrypter()\n if h !=check_byte:\n raise RuntimeError(\"Bad password for file %r\"%zipinfo.orig_filename)\n \n \n def _init_decrypter(self):\n self._decrypter=_ZipDecrypter(self._pwd)\n \n \n \n \n \n header=self._fileobj.read(12)\n self._compress_left -=12\n return self._decrypter(header)[11]\n \n def __repr__(self):\n result=['<%s.%s'%(self.__class__.__module__,\n self.__class__.__qualname__)]\n if not self.closed:\n result.append(' name=%r mode=%r'%(self.name,self.mode))\n if self._compress_type !=ZIP_STORED:\n result.append(' compress_type=%s'%\n compressor_names.get(self._compress_type,\n self._compress_type))\n else :\n result.append(' [closed]')\n result.append('>')\n return ''.join(result)\n \n def readline(self,limit=-1):\n ''\n\n\n \n \n if limit <0:\n \n i=self._readbuffer.find(b'\\n',self._offset)+1\n if i >0:\n line=self._readbuffer[self._offset:i]\n self._offset=i\n return line\n \n return io.BufferedIOBase.readline(self,limit)\n \n def peek(self,n=1):\n ''\n if n >len(self._readbuffer)-self._offset:\n chunk=self.read(n)\n if len(chunk)>self._offset:\n self._readbuffer=chunk+self._readbuffer[self._offset:]\n self._offset=0\n else :\n self._offset -=len(chunk)\n \n \n return self._readbuffer[self._offset:self._offset+512]\n \n def readable(self):\n if self.closed:\n raise ValueError(\"I/O operation on closed file.\")\n return True\n \n def read(self,n=-1):\n ''\n\n \n if self.closed:\n raise ValueError(\"read from closed file.\")\n if n is None or n <0:\n buf=self._readbuffer[self._offset:]\n self._readbuffer=b''\n self._offset=0\n while not self._eof:\n buf +=self._read1(self.MAX_N)\n return buf\n \n end=n+self._offset\n if end 0 and not self._eof:\n data=self._read1(n)\n if n 0:\n while not self._eof:\n data=self._read1(n)\n if n len(data):\n data +=self._read2(n -len(data))\n else :\n data=self._read2(n)\n \n if self._compress_type ==ZIP_STORED:\n self._eof=self._compress_left <=0\n elif self._compress_type ==ZIP_DEFLATED:\n n=max(n,self.MIN_READ_SIZE)\n data=self._decompressor.decompress(data,n)\n self._eof=(self._decompressor.eof or\n self._compress_left <=0 and\n not self._decompressor.unconsumed_tail)\n if self._eof:\n data +=self._decompressor.flush()\n else :\n data=self._decompressor.decompress(data)\n self._eof=self._decompressor.eof or self._compress_left <=0\n \n data=data[:self._left]\n self._left -=len(data)\n if self._left <=0:\n self._eof=True\n self._update_crc(data)\n return data\n \n def _read2(self,n):\n if self._compress_left <=0:\n return b''\n \n n=max(n,self.MIN_READ_SIZE)\n n=min(n,self._compress_left)\n \n data=self._fileobj.read(n)\n self._compress_left -=len(data)\n if not data:\n raise EOFError\n \n if self._decrypter is not None :\n data=self._decrypter(data)\n return data\n \n def close(self):\n try :\n if self._close_fileobj:\n self._fileobj.close()\n finally :\n super().close()\n \n def seekable(self):\n if self.closed:\n raise ValueError(\"I/O operation on closed file.\")\n return self._seekable\n \n def seek(self,offset,whence=0):\n if self.closed:\n raise ValueError(\"seek on closed file.\")\n if not self._seekable:\n raise io.UnsupportedOperation(\"underlying stream is not seekable\")\n curr_pos=self.tell()\n if whence ==0:\n new_pos=offset\n elif whence ==1:\n new_pos=curr_pos+offset\n elif whence ==2:\n new_pos=self._orig_file_size+offset\n else :\n raise ValueError(\"whence must be os.SEEK_SET (0), \"\n \"os.SEEK_CUR (1), or os.SEEK_END (2)\")\n \n if new_pos >self._orig_file_size:\n new_pos=self._orig_file_size\n \n if new_pos <0:\n new_pos=0\n \n read_offset=new_pos -curr_pos\n buff_offset=read_offset+self._offset\n \n if buff_offset >=0 and buff_offset 0:\n read_len=min(self.MAX_SEEK_READ,read_offset)\n self.read(read_len)\n read_offset -=read_len\n \n return self.tell()\n \n def tell(self):\n if self.closed:\n raise ValueError(\"tell on closed file.\")\n if not self._seekable:\n raise io.UnsupportedOperation(\"underlying stream is not seekable\")\n filepos=self._orig_file_size -self._left -len(self._readbuffer)+self._offset\n return filepos\n \n \nclass _ZipWriteFile(io.BufferedIOBase):\n def __init__(self,zf,zinfo,zip64):\n self._zinfo=zinfo\n self._zip64=zip64\n self._zipfile=zf\n self._compressor=_get_compressor(zinfo.compress_type,\n zinfo._compresslevel)\n self._file_size=0\n self._compress_size=0\n self._crc=0\n \n @property\n def _fileobj(self):\n return self._zipfile.fp\n \n def writable(self):\n return True\n \n def write(self,data):\n if self.closed:\n raise ValueError('I/O operation on closed file.')\n \n \n if isinstance(data,(bytes,bytearray)):\n nbytes=len(data)\n else :\n data=memoryview(data)\n nbytes=data.nbytes\n self._file_size +=nbytes\n \n self._crc=crc32(data,self._crc)\n if self._compressor:\n data=self._compressor.compress(data)\n self._compress_size +=len(data)\n self._fileobj.write(data)\n return nbytes\n \n def close(self):\n if self.closed:\n return\n try :\n super().close()\n \n if self._compressor:\n buf=self._compressor.flush()\n self._compress_size +=len(buf)\n self._fileobj.write(buf)\n self._zinfo.compress_size=self._compress_size\n else :\n self._zinfo.compress_size=self._file_size\n self._zinfo.CRC=self._crc\n self._zinfo.file_size=self._file_size\n \n \n if self._zinfo.flag_bits&_MASK_USE_DATA_DESCRIPTOR:\n \n fmt='ZIP64_LIMIT:\n raise RuntimeError(\n 'File size unexpectedly exceeded ZIP64 limit')\n if self._compress_size >ZIP64_LIMIT:\n raise RuntimeError(\n 'Compressed size unexpectedly exceeded ZIP64 limit')\n \n \n \n \n self._zipfile.start_dir=self._fileobj.tell()\n self._fileobj.seek(self._zinfo.header_offset)\n self._fileobj.write(self._zinfo.FileHeader(self._zip64))\n self._fileobj.seek(self._zipfile.start_dir)\n \n \n self._zipfile.filelist.append(self._zinfo)\n self._zipfile.NameToInfo[self._zinfo.filename]=self._zinfo\n finally :\n self._zipfile._writing=False\n \n \n \nclass ZipFile:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n fp=None\n _windows_illegal_name_trans_table=None\n \n def __init__(self,file,mode=\"r\",compression=ZIP_STORED,allowZip64=True ,\n compresslevel=None ,*,strict_timestamps=True ,metadata_encoding=None ):\n ''\n \n if mode not in ('r','w','x','a'):\n raise ValueError(\"ZipFile requires mode 'r', 'w', 'x', or 'a'\")\n \n _check_compression(compression)\n \n self._allowZip64=allowZip64\n self._didModify=False\n self.debug=0\n self.NameToInfo={}\n self.filelist=[]\n self.compression=compression\n self.compresslevel=compresslevel\n self.mode=mode\n self.pwd=None\n self._comment=b''\n self._strict_timestamps=strict_timestamps\n self.metadata_encoding=metadata_encoding\n \n \n if self.metadata_encoding and mode !='r':\n raise ValueError(\n \"metadata_encoding is only supported for reading files\")\n \n \n if isinstance(file,os.PathLike):\n file=os.fspath(file)\n if isinstance(file,str):\n \n self._filePassed=0\n self.filename=file\n modeDict={'r':'rb','w':'w+b','x':'x+b','a':'r+b',\n 'r+b':'w+b','w+b':'wb','x+b':'xb'}\n filemode=modeDict[mode]\n while True :\n try :\n self.fp=io.open(file,filemode)\n except OSError:\n if filemode in modeDict:\n filemode=modeDict[filemode]\n continue\n raise\n break\n else :\n self._filePassed=1\n self.fp=file\n self.filename=getattr(file,'name',None )\n self._fileRefCnt=1\n self._lock=threading.RLock()\n self._seekable=True\n self._writing=False\n \n try :\n if mode =='r':\n self._RealGetContents()\n elif mode in ('w','x'):\n \n \n self._didModify=True\n try :\n self.start_dir=self.fp.tell()\n except (AttributeError,OSError):\n self.fp=_Tellable(self.fp)\n self.start_dir=0\n self._seekable=False\n else :\n \n try :\n self.fp.seek(self.start_dir)\n except (AttributeError,OSError):\n self._seekable=False\n elif mode =='a':\n try :\n \n self._RealGetContents()\n \n self.fp.seek(self.start_dir)\n except BadZipFile:\n \n self.fp.seek(0,2)\n \n \n \n self._didModify=True\n self.start_dir=self.fp.tell()\n else :\n raise ValueError(\"Mode must be 'r', 'w', 'x', or 'a'\")\n except :\n fp=self.fp\n self.fp=None\n self._fpclose(fp)\n raise\n \n def __enter__(self):\n return self\n \n def __exit__(self,type,value,traceback):\n self.close()\n \n def __repr__(self):\n result=['<%s.%s'%(self.__class__.__module__,\n self.__class__.__qualname__)]\n if self.fp is not None :\n if self._filePassed:\n result.append(' file=%r'%self.fp)\n elif self.filename is not None :\n result.append(' filename=%r'%self.filename)\n result.append(' mode=%r'%self.mode)\n else :\n result.append(' [closed]')\n result.append('>')\n return ''.join(result)\n \n def _RealGetContents(self):\n ''\n fp=self.fp\n try :\n endrec=_EndRecData(fp)\n except OSError:\n raise BadZipFile(\"File is not a zip file\")\n if not endrec:\n raise BadZipFile(\"File is not a zip file\")\n if self.debug >1:\n print(endrec)\n size_cd=endrec[_ECD_SIZE]\n offset_cd=endrec[_ECD_OFFSET]\n self._comment=endrec[_ECD_COMMENT]\n \n \n concat=endrec[_ECD_LOCATION]-size_cd -offset_cd\n if endrec[_ECD_SIGNATURE]==stringEndArchive64:\n \n concat -=(sizeEndCentDir64+sizeEndCentDir64Locator)\n \n if self.debug >2:\n inferred=concat+offset_cd\n print(\"given, inferred, offset\",offset_cd,inferred,concat)\n \n self.start_dir=offset_cd+concat\n if self.start_dir <0:\n raise BadZipFile(\"Bad offset for central directory\")\n fp.seek(self.start_dir,0)\n data=fp.read(size_cd)\n fp=io.BytesIO(data)\n total=0\n while total 2:\n print(centdir)\n filename=fp.read(centdir[_CD_FILENAME_LENGTH])\n flags=centdir[_CD_FLAG_BITS]\n if flags&_MASK_UTF_FILENAME:\n \n filename=filename.decode('utf-8')\n else :\n \n filename=filename.decode(self.metadata_encoding or 'cp437')\n \n x=ZipInfo(filename)\n x.extra=fp.read(centdir[_CD_EXTRA_FIELD_LENGTH])\n x.comment=fp.read(centdir[_CD_COMMENT_LENGTH])\n x.header_offset=centdir[_CD_LOCAL_HEADER_OFFSET]\n (x.create_version,x.create_system,x.extract_version,x.reserved,\n x.flag_bits,x.compress_type,t,d,\n x.CRC,x.compress_size,x.file_size)=centdir[1:12]\n if x.extract_version >MAX_EXTRACT_VERSION:\n raise NotImplementedError(\"zip file version %.1f\"%\n (x.extract_version /10))\n x.volume,x.internal_attr,x.external_attr=centdir[15:18]\n \n x._raw_time=t\n x.date_time=((d >>9)+1980,(d >>5)&0xF,d&0x1F,\n t >>11,(t >>5)&0x3F,(t&0x1F)*2)\n \n x._decodeExtra()\n x.header_offset=x.header_offset+concat\n self.filelist.append(x)\n self.NameToInfo[x.filename]=x\n \n \n total=(total+sizeCentralDir+centdir[_CD_FILENAME_LENGTH]\n +centdir[_CD_EXTRA_FIELD_LENGTH]\n +centdir[_CD_COMMENT_LENGTH])\n \n if self.debug >2:\n print(\"total\",total)\n \n \n def namelist(self):\n ''\n return [data.filename for data in self.filelist]\n \n def infolist(self):\n ''\n \n return self.filelist\n \n def printdir(self,file=None ):\n ''\n print(\"%-46s %19s %12s\"%(\"File Name\",\"Modified \",\"Size\"),\n file=file)\n for zinfo in self.filelist:\n date=\"%d-%02d-%02d %02d:%02d:%02d\"%zinfo.date_time[:6]\n print(\"%-46s %s %12d\"%(zinfo.filename,date,zinfo.file_size),\n file=file)\n \n def testzip(self):\n ''\n chunk_size=2 **20\n for zinfo in self.filelist:\n try :\n \n \n with self.open(zinfo.filename,\"r\")as f:\n while f.read(chunk_size):\n pass\n except BadZipFile:\n return zinfo.filename\n \n def getinfo(self,name):\n ''\n info=self.NameToInfo.get(name)\n if info is None :\n raise KeyError(\n 'There is no item named %r in the archive'%name)\n \n return info\n \n def setpassword(self,pwd):\n ''\n if pwd and not isinstance(pwd,bytes):\n raise TypeError(\"pwd: expected bytes, got %s\"%type(pwd).__name__)\n if pwd:\n self.pwd=pwd\n else :\n self.pwd=None\n \n @property\n def comment(self):\n ''\n return self._comment\n \n @comment.setter\n def comment(self,comment):\n if not isinstance(comment,bytes):\n raise TypeError(\"comment: expected bytes, got %s\"%type(comment).__name__)\n \n if len(comment)>ZIP_MAX_COMMENT:\n import warnings\n warnings.warn('Archive comment is too long; truncating to %d bytes'\n %ZIP_MAX_COMMENT,stacklevel=2)\n comment=comment[:ZIP_MAX_COMMENT]\n self._comment=comment\n self._didModify=True\n \n def read(self,name,pwd=None ):\n ''\n with self.open(name,\"r\",pwd)as fp:\n return fp.read()\n \n def open(self,name,mode=\"r\",pwd=None ,*,force_zip64=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if mode not in {\"r\",\"w\"}:\n raise ValueError('open() requires mode \"r\" or \"w\"')\n if pwd and (mode ==\"w\"):\n raise ValueError(\"pwd is only supported for reading files\")\n if not self.fp:\n raise ValueError(\n \"Attempt to use ZIP archive that was already closed\")\n \n \n if isinstance(name,ZipInfo):\n \n zinfo=name\n elif mode =='w':\n zinfo=ZipInfo(name)\n zinfo.compress_type=self.compression\n zinfo._compresslevel=self.compresslevel\n else :\n \n zinfo=self.getinfo(name)\n \n if mode =='w':\n return self._open_to_write(zinfo,force_zip64=force_zip64)\n \n if self._writing:\n raise ValueError(\"Can't read from the ZIP file while there \"\n \"is an open writing handle on it. \"\n \"Close the writing handle before trying to read.\")\n \n \n self._fileRefCnt +=1\n zef_file=_SharedFile(self.fp,zinfo.header_offset,\n self._fpclose,self._lock,lambda :self._writing)\n try :\n \n fheader=zef_file.read(sizeFileHeader)\n if len(fheader)!=sizeFileHeader:\n raise BadZipFile(\"Truncated file header\")\n fheader=struct.unpack(structFileHeader,fheader)\n if fheader[_FH_SIGNATURE]!=stringFileHeader:\n raise BadZipFile(\"Bad magic number for file header\")\n \n fname=zef_file.read(fheader[_FH_FILENAME_LENGTH])\n if fheader[_FH_EXTRA_FIELD_LENGTH]:\n zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH])\n \n if zinfo.flag_bits&_MASK_COMPRESSED_PATCH:\n \n raise NotImplementedError(\"compressed patched data (flag bit 5)\")\n \n if zinfo.flag_bits&_MASK_STRONG_ENCRYPTION:\n \n raise NotImplementedError(\"strong encryption (flag bit 6)\")\n \n if fheader[_FH_GENERAL_PURPOSE_FLAG_BITS]&_MASK_UTF_FILENAME:\n \n fname_str=fname.decode(\"utf-8\")\n else :\n fname_str=fname.decode(self.metadata_encoding or \"cp437\")\n \n if fname_str !=zinfo.orig_filename:\n raise BadZipFile(\n 'File name in directory %r and header %r differ.'\n %(zinfo.orig_filename,fname))\n \n \n is_encrypted=zinfo.flag_bits&_MASK_ENCRYPTED\n if is_encrypted:\n if not pwd:\n pwd=self.pwd\n if pwd and not isinstance(pwd,bytes):\n raise TypeError(\"pwd: expected bytes, got %s\"%type(pwd).__name__)\n if not pwd:\n raise RuntimeError(\"File %r is encrypted, password \"\n \"required for extraction\"%name)\n else :\n pwd=None\n \n return ZipExtFile(zef_file,mode,zinfo,pwd,True )\n except :\n zef_file.close()\n raise\n \n def _open_to_write(self,zinfo,force_zip64=False ):\n if force_zip64 and not self._allowZip64:\n raise ValueError(\n \"force_zip64 is True, but allowZip64 was False when opening \"\n \"the ZIP file.\"\n )\n if self._writing:\n raise ValueError(\"Can't write to the ZIP file while there is \"\n \"another write handle open on it. \"\n \"Close the first handle before opening another.\")\n \n \n zinfo.compress_size=0\n zinfo.CRC=0\n \n zinfo.flag_bits=0x00\n if zinfo.compress_type ==ZIP_LZMA:\n \n zinfo.flag_bits |=_MASK_COMPRESS_OPTION_1\n if not self._seekable:\n zinfo.flag_bits |=_MASK_USE_DATA_DESCRIPTOR\n \n if not zinfo.external_attr:\n zinfo.external_attr=0o600 <<16\n \n \n zip64=self._allowZip64 and\\\n (force_zip64 or zinfo.file_size *1.05 >ZIP64_LIMIT)\n \n if self._seekable:\n self.fp.seek(self.start_dir)\n zinfo.header_offset=self.fp.tell()\n \n self._writecheck(zinfo)\n self._didModify=True\n \n self.fp.write(zinfo.FileHeader(zip64))\n \n self._writing=True\n return _ZipWriteFile(self,zinfo,zip64)\n \n def extract(self,member,path=None ,pwd=None ):\n ''\n\n\n\n \n if path is None :\n path=os.getcwd()\n else :\n path=os.fspath(path)\n \n return self._extract_member(member,path,pwd)\n \n def extractall(self,path=None ,members=None ,pwd=None ):\n ''\n\n\n\n \n if members is None :\n members=self.namelist()\n \n if path is None :\n path=os.getcwd()\n else :\n path=os.fspath(path)\n \n for zipinfo in members:\n self._extract_member(zipinfo,path,pwd)\n \n @classmethod\n def _sanitize_windows_name(cls,arcname,pathsep):\n ''\n table=cls._windows_illegal_name_trans_table\n if not table:\n illegal=':<>|\"?*'\n table=str.maketrans(illegal,'_'*len(illegal))\n cls._windows_illegal_name_trans_table=table\n arcname=arcname.translate(table)\n \n arcname=(x.rstrip('.')for x in arcname.split(pathsep))\n \n arcname=pathsep.join(x for x in arcname if x)\n return arcname\n \n def _extract_member(self,member,targetpath,pwd):\n ''\n\n \n if not isinstance(member,ZipInfo):\n member=self.getinfo(member)\n \n \n \n arcname=member.filename.replace('/',os.path.sep)\n \n if os.path.altsep:\n arcname=arcname.replace(os.path.altsep,os.path.sep)\n \n \n arcname=os.path.splitdrive(arcname)[1]\n invalid_path_parts=('',os.path.curdir,os.path.pardir)\n arcname=os.path.sep.join(x for x in arcname.split(os.path.sep)\n if x not in invalid_path_parts)\n if os.path.sep =='\\\\':\n \n arcname=self._sanitize_windows_name(arcname,os.path.sep)\n \n targetpath=os.path.join(targetpath,arcname)\n targetpath=os.path.normpath(targetpath)\n \n \n upperdirs=os.path.dirname(targetpath)\n if upperdirs and not os.path.exists(upperdirs):\n os.makedirs(upperdirs)\n \n if member.is_dir():\n if not os.path.isdir(targetpath):\n os.mkdir(targetpath)\n return targetpath\n \n with self.open(member,pwd=pwd)as source,\\\n open(targetpath,\"wb\")as target:\n shutil.copyfileobj(source,target)\n \n return targetpath\n \n def _writecheck(self,zinfo):\n ''\n if zinfo.filename in self.NameToInfo:\n import warnings\n warnings.warn('Duplicate name: %r'%zinfo.filename,stacklevel=3)\n if self.mode not in ('w','x','a'):\n raise ValueError(\"write() requires mode 'w', 'x', or 'a'\")\n if not self.fp:\n raise ValueError(\n \"Attempt to write ZIP archive that was already closed\")\n _check_compression(zinfo.compress_type)\n if not self._allowZip64:\n requires_zip64=None\n if len(self.filelist)>=ZIP_FILECOUNT_LIMIT:\n requires_zip64=\"Files count\"\n elif zinfo.file_size >ZIP64_LIMIT:\n requires_zip64=\"Filesize\"\n elif zinfo.header_offset >ZIP64_LIMIT:\n requires_zip64=\"Zipfile size\"\n if requires_zip64:\n raise LargeZipFile(requires_zip64+\n \" would require ZIP64 extensions\")\n \n def write(self,filename,arcname=None ,\n compress_type=None ,compresslevel=None ):\n ''\n \n if not self.fp:\n raise ValueError(\n \"Attempt to write to ZIP archive that was already closed\")\n if self._writing:\n raise ValueError(\n \"Can't write to ZIP archive while an open writing handle exists\"\n )\n \n zinfo=ZipInfo.from_file(filename,arcname,\n strict_timestamps=self._strict_timestamps)\n \n if zinfo.is_dir():\n zinfo.compress_size=0\n zinfo.CRC=0\n self.mkdir(zinfo)\n else :\n if compress_type is not None :\n zinfo.compress_type=compress_type\n else :\n zinfo.compress_type=self.compression\n \n if compresslevel is not None :\n zinfo._compresslevel=compresslevel\n else :\n zinfo._compresslevel=self.compresslevel\n \n with open(filename,\"rb\")as src,self.open(zinfo,'w')as dest:\n shutil.copyfileobj(src,dest,1024 *8)\n \n def writestr(self,zinfo_or_arcname,data,\n compress_type=None ,compresslevel=None ):\n ''\n\n\n\n \n if isinstance(data,str):\n data=data.encode(\"utf-8\")\n if not isinstance(zinfo_or_arcname,ZipInfo):\n zinfo=ZipInfo(filename=zinfo_or_arcname,\n date_time=time.localtime(time.time())[:6])\n zinfo.compress_type=self.compression\n zinfo._compresslevel=self.compresslevel\n if zinfo.filename[-1]=='/':\n zinfo.external_attr=0o40775 <<16\n zinfo.external_attr |=0x10\n else :\n zinfo.external_attr=0o600 <<16\n else :\n zinfo=zinfo_or_arcname\n \n if not self.fp:\n raise ValueError(\n \"Attempt to write to ZIP archive that was already closed\")\n if self._writing:\n raise ValueError(\n \"Can't write to ZIP archive while an open writing handle exists.\"\n )\n \n if compress_type is not None :\n zinfo.compress_type=compress_type\n \n if compresslevel is not None :\n zinfo._compresslevel=compresslevel\n \n zinfo.file_size=len(data)\n with self._lock:\n with self.open(zinfo,mode='w')as dest:\n dest.write(data)\n \n def mkdir(self,zinfo_or_directory_name,mode=511):\n ''\n if isinstance(zinfo_or_directory_name,ZipInfo):\n zinfo=zinfo_or_directory_name\n if not zinfo.is_dir():\n raise ValueError(\"The given ZipInfo does not describe a directory\")\n elif isinstance(zinfo_or_directory_name,str):\n directory_name=zinfo_or_directory_name\n if not directory_name.endswith(\"/\"):\n directory_name +=\"/\"\n zinfo=ZipInfo(directory_name)\n zinfo.compress_size=0\n zinfo.CRC=0\n zinfo.external_attr=((0o40000 |mode)&0xFFFF)<<16\n zinfo.file_size=0\n zinfo.external_attr |=0x10\n else :\n raise TypeError(\"Expected type str or ZipInfo\")\n \n with self._lock:\n if self._seekable:\n self.fp.seek(self.start_dir)\n zinfo.header_offset=self.fp.tell()\n if zinfo.compress_type ==ZIP_LZMA:\n \n zinfo.flag_bits |=_MASK_COMPRESS_OPTION_1\n \n self._writecheck(zinfo)\n self._didModify=True\n \n self.filelist.append(zinfo)\n self.NameToInfo[zinfo.filename]=zinfo\n self.fp.write(zinfo.FileHeader(False ))\n self.start_dir=self.fp.tell()\n \n def __del__(self):\n ''\n self.close()\n \n def close(self):\n ''\n \n if self.fp is None :\n return\n \n if self._writing:\n raise ValueError(\"Can't close the ZIP file while there is \"\n \"an open writing handle on it. \"\n \"Close the writing handle before closing the zip.\")\n \n try :\n if self.mode in ('w','x','a')and self._didModify:\n with self._lock:\n if self._seekable:\n self.fp.seek(self.start_dir)\n self._write_end_record()\n finally :\n fp=self.fp\n self.fp=None\n self._fpclose(fp)\n \n def _write_end_record(self):\n for zinfo in self.filelist:\n dt=zinfo.date_time\n dosdate=(dt[0]-1980)<<9 |dt[1]<<5 |dt[2]\n dostime=dt[3]<<11 |dt[4]<<5 |(dt[5]//2)\n extra=[]\n if zinfo.file_size >ZIP64_LIMIT\\\n or zinfo.compress_size >ZIP64_LIMIT:\n extra.append(zinfo.file_size)\n extra.append(zinfo.compress_size)\n file_size=0xffffffff\n compress_size=0xffffffff\n else :\n file_size=zinfo.file_size\n compress_size=zinfo.compress_size\n \n if zinfo.header_offset >ZIP64_LIMIT:\n extra.append(zinfo.header_offset)\n header_offset=0xffffffff\n else :\n header_offset=zinfo.header_offset\n \n extra_data=zinfo.extra\n min_version=0\n if extra:\n \n extra_data=_strip_extra(extra_data,(1,))\n extra_data=struct.pack(\n 'ZIP_FILECOUNT_LIMIT:\n requires_zip64=\"Files count\"\n elif centDirOffset >ZIP64_LIMIT:\n requires_zip64=\"Central directory offset\"\n elif centDirSize >ZIP64_LIMIT:\n requires_zip64=\"Central directory size\"\n if requires_zip64:\n \n if not self._allowZip64:\n raise LargeZipFile(requires_zip64+\n \" would require ZIP64 extensions\")\n zip64endrec=struct.pack(\n structEndArchive64,stringEndArchive64,\n 44,45,45,0,0,centDirCount,centDirCount,\n centDirSize,centDirOffset)\n self.fp.write(zip64endrec)\n \n zip64locrec=struct.pack(\n structEndArchive64Locator,\n stringEndArchive64Locator,0,pos2,1)\n self.fp.write(zip64locrec)\n centDirCount=min(centDirCount,0xFFFF)\n centDirSize=min(centDirSize,0xFFFFFFFF)\n centDirOffset=min(centDirOffset,0xFFFFFFFF)\n \n endrec=struct.pack(structEndArchive,stringEndArchive,\n 0,0,centDirCount,centDirCount,\n centDirSize,centDirOffset,len(self._comment))\n self.fp.write(endrec)\n self.fp.write(self._comment)\n if self.mode ==\"a\":\n self.fp.truncate()\n self.fp.flush()\n \n def _fpclose(self,fp):\n assert self._fileRefCnt >0\n self._fileRefCnt -=1\n if not self._fileRefCnt and not self._filePassed:\n fp.close()\n \n \nclass PyZipFile(ZipFile):\n ''\n \n def __init__(self,file,mode=\"r\",compression=ZIP_STORED,\n allowZip64=True ,optimize=-1):\n ZipFile.__init__(self,file,mode=mode,compression=compression,\n allowZip64=allowZip64)\n self._optimize=optimize\n \n def writepy(self,pathname,basename=\"\",filterfunc=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n pathname=os.fspath(pathname)\n if filterfunc and not filterfunc(pathname):\n if self.debug:\n label='path'if os.path.isdir(pathname)else 'file'\n print('%s %r skipped by filterfunc'%(label,pathname))\n return\n dir,name=os.path.split(pathname)\n if os.path.isdir(pathname):\n initname=os.path.join(pathname,\"__init__.py\")\n if os.path.isfile(initname):\n \n if basename:\n basename=\"%s/%s\"%(basename,name)\n else :\n basename=name\n if self.debug:\n print(\"Adding package in\",pathname,\"as\",basename)\n fname,arcname=self._get_codename(initname[0:-3],basename)\n if self.debug:\n print(\"Adding\",arcname)\n self.write(fname,arcname)\n dirlist=sorted(os.listdir(pathname))\n dirlist.remove(\"__init__.py\")\n \n for filename in dirlist:\n path=os.path.join(pathname,filename)\n root,ext=os.path.splitext(filename)\n if os.path.isdir(path):\n if os.path.isfile(os.path.join(path,\"__init__.py\")):\n \n self.writepy(path,basename,\n filterfunc=filterfunc)\n elif ext ==\".py\":\n if filterfunc and not filterfunc(path):\n if self.debug:\n print('file %r skipped by filterfunc'%path)\n continue\n fname,arcname=self._get_codename(path[0:-3],\n basename)\n if self.debug:\n print(\"Adding\",arcname)\n self.write(fname,arcname)\n else :\n \n if self.debug:\n print(\"Adding files from directory\",pathname)\n for filename in sorted(os.listdir(pathname)):\n path=os.path.join(pathname,filename)\n root,ext=os.path.splitext(filename)\n if ext ==\".py\":\n if filterfunc and not filterfunc(path):\n if self.debug:\n print('file %r skipped by filterfunc'%path)\n continue\n fname,arcname=self._get_codename(path[0:-3],\n basename)\n if self.debug:\n print(\"Adding\",arcname)\n self.write(fname,arcname)\n else :\n if pathname[-3:]!=\".py\":\n raise RuntimeError(\n 'Files added with writepy() must end with \".py\"')\n fname,arcname=self._get_codename(pathname[0:-3],basename)\n if self.debug:\n print(\"Adding file\",arcname)\n self.write(fname,arcname)\n \n def _get_codename(self,pathname,basename):\n ''\n\n\n\n\n \n def _compile(file,optimize=-1):\n import py_compile\n if self.debug:\n print(\"Compiling\",file)\n try :\n py_compile.compile(file,doraise=True ,optimize=optimize)\n except py_compile.PyCompileError as err:\n print(err.msg)\n return False\n return True\n \n file_py=pathname+\".py\"\n file_pyc=pathname+\".pyc\"\n pycache_opt0=importlib.util.cache_from_source(file_py,optimization='')\n pycache_opt1=importlib.util.cache_from_source(file_py,optimization=1)\n pycache_opt2=importlib.util.cache_from_source(file_py,optimization=2)\n if self._optimize ==-1:\n \n if (os.path.isfile(file_pyc)and\n os.stat(file_pyc).st_mtime >=os.stat(file_py).st_mtime):\n \n arcname=fname=file_pyc\n elif (os.path.isfile(pycache_opt0)and\n os.stat(pycache_opt0).st_mtime >=os.stat(file_py).st_mtime):\n \n \n fname=pycache_opt0\n arcname=file_pyc\n elif (os.path.isfile(pycache_opt1)and\n os.stat(pycache_opt1).st_mtime >=os.stat(file_py).st_mtime):\n \n \n fname=pycache_opt1\n arcname=file_pyc\n elif (os.path.isfile(pycache_opt2)and\n os.stat(pycache_opt2).st_mtime >=os.stat(file_py).st_mtime):\n \n \n fname=pycache_opt2\n arcname=file_pyc\n else :\n \n if _compile(file_py):\n if sys.flags.optimize ==0:\n fname=pycache_opt0\n elif sys.flags.optimize ==1:\n fname=pycache_opt1\n else :\n fname=pycache_opt2\n arcname=file_pyc\n else :\n fname=arcname=file_py\n else :\n \n if self._optimize ==0:\n fname=pycache_opt0\n arcname=file_pyc\n else :\n arcname=file_pyc\n if self._optimize ==1:\n fname=pycache_opt1\n elif self._optimize ==2:\n fname=pycache_opt2\n else :\n msg=\"invalid value for 'optimize': {!r}\".format(self._optimize)\n raise ValueError(msg)\n if not (os.path.isfile(fname)and\n os.stat(fname).st_mtime >=os.stat(file_py).st_mtime):\n if not _compile(file_py,optimize=self._optimize):\n fname=arcname=file_py\n archivename=os.path.split(arcname)[1]\n if basename:\n archivename=\"%s/%s\"%(basename,archivename)\n return (fname,archivename)\n \n \ndef _parents(path):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return itertools.islice(_ancestry(path),1,None )\n \n \ndef _ancestry(path):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n path=path.rstrip(posixpath.sep)\n while path and path !=posixpath.sep:\n yield path\n path,tail=posixpath.split(path)\n \n \n_dedupe=dict.fromkeys\n''\n\n\ndef _difference(minuend,subtrahend):\n ''\n\n\n \n return itertools.filterfalse(set(subtrahend).__contains__,minuend)\n \n \nclass CompleteDirs(ZipFile):\n ''\n\n\n \n \n @staticmethod\n def _implied_dirs(names):\n parents=itertools.chain.from_iterable(map(_parents,names))\n as_dirs=(p+posixpath.sep for p in parents)\n return _dedupe(_difference(as_dirs,names))\n \n def namelist(self):\n names=super(CompleteDirs,self).namelist()\n return names+list(self._implied_dirs(names))\n \n def _name_set(self):\n return set(self.namelist())\n \n def resolve_dir(self,name):\n ''\n\n\n \n names=self._name_set()\n dirname=name+'/'\n dir_match=name not in names and dirname in names\n return dirname if dir_match else name\n \n @classmethod\n def make(cls,source):\n ''\n\n\n \n if isinstance(source,CompleteDirs):\n return source\n \n if not isinstance(source,ZipFile):\n return cls(source)\n \n \n if 'r'not in source.mode:\n cls=CompleteDirs\n \n source.__class__=cls\n return source\n \n \nclass FastLookup(CompleteDirs):\n ''\n\n\n \n \n def namelist(self):\n with contextlib.suppress(AttributeError):\n return self.__names\n self.__names=super(FastLookup,self).namelist()\n return self.__names\n \n def _name_set(self):\n with contextlib.suppress(AttributeError):\n return self.__lookup\n self.__lookup=super(FastLookup,self)._name_set()\n return self.__lookup\n \n \nclass Path:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n __repr=\"{self.__class__.__name__}({self.root.filename!r}, {self.at!r})\"\n \n def __init__(self,root,at=\"\"):\n ''\n\n\n\n\n\n\n\n \n self.root=FastLookup.make(root)\n self.at=at\n \n def open(self,mode='r',*args,pwd=None ,**kwargs):\n ''\n\n\n\n \n if self.is_dir():\n raise IsADirectoryError(self)\n zip_mode=mode[0]\n if not self.exists()and zip_mode =='r':\n raise FileNotFoundError(self)\n stream=self.root.open(self.at,zip_mode,pwd=pwd)\n if 'b'in mode:\n if args or kwargs:\n raise ValueError(\"encoding args invalid for binary operation\")\n return stream\n else :\n kwargs[\"encoding\"]=io.text_encoding(kwargs.get(\"encoding\"))\n return io.TextIOWrapper(stream,*args,**kwargs)\n \n @property\n def name(self):\n return pathlib.Path(self.at).name or self.filename.name\n \n @property\n def suffix(self):\n return pathlib.Path(self.at).suffix or self.filename.suffix\n \n @property\n def suffixes(self):\n return pathlib.Path(self.at).suffixes or self.filename.suffixes\n \n @property\n def stem(self):\n return pathlib.Path(self.at).stem or self.filename.stem\n \n @property\n def filename(self):\n return pathlib.Path(self.root.filename).joinpath(self.at)\n \n def read_text(self,*args,**kwargs):\n kwargs[\"encoding\"]=io.text_encoding(kwargs.get(\"encoding\"))\n with self.open('r',*args,**kwargs)as strm:\n return strm.read()\n \n def read_bytes(self):\n with self.open('rb')as strm:\n return strm.read()\n \n def _is_child(self,path):\n return posixpath.dirname(path.at.rstrip(\"/\"))==self.at.rstrip(\"/\")\n \n def _next(self,at):\n return self.__class__(self.root,at)\n \n def is_dir(self):\n return not self.at or self.at.endswith(\"/\")\n \n def is_file(self):\n return self.exists()and not self.is_dir()\n \n def exists(self):\n return self.at in self.root._name_set()\n \n def iterdir(self):\n if not self.is_dir():\n raise ValueError(\"Can't listdir a file\")\n subs=map(self._next,self.root.namelist())\n return filter(self._is_child,subs)\n \n def __str__(self):\n return posixpath.join(self.root.filename,self.at)\n \n def __repr__(self):\n return self.__repr.format(self=self)\n \n def joinpath(self,*other):\n next=posixpath.join(self.at,*other)\n return self._next(self.root.resolve_dir(next))\n \n __truediv__=joinpath\n \n @property\n def parent(self):\n if not self.at:\n return self.filename.parent\n parent_at=posixpath.dirname(self.at.rstrip('/'))\n if parent_at:\n parent_at +='/'\n return self._next(parent_at)\n \n \ndef main(args=None ):\n import argparse\n \n description='A simple command-line interface for zipfile module.'\n parser=argparse.ArgumentParser(description=description)\n group=parser.add_mutually_exclusive_group(required=True )\n group.add_argument('-l','--list',metavar='',\n help='Show listing of a zipfile')\n group.add_argument('-e','--extract',nargs=2,\n metavar=('',''),\n help='Extract zipfile into target dir')\n group.add_argument('-c','--create',nargs='+',\n metavar=('',''),\n help='Create zipfile from sources')\n group.add_argument('-t','--test',metavar='',\n help='Test if a zipfile is valid')\n parser.add_argument('--metadata-encoding',metavar='',\n help='Specify encoding of member names for -l, -e and -t')\n args=parser.parse_args(args)\n \n encoding=args.metadata_encoding\n \n if args.test is not None :\n src=args.test\n with ZipFile(src,'r',metadata_encoding=encoding)as zf:\n badfile=zf.testzip()\n if badfile:\n print(\"The following enclosed file is corrupted: {!r}\".format(badfile))\n print(\"Done testing\")\n \n elif args.list is not None :\n src=args.list\n with ZipFile(src,'r',metadata_encoding=encoding)as zf:\n zf.printdir()\n \n elif args.extract is not None :\n src,curdir=args.extract\n with ZipFile(src,'r',metadata_encoding=encoding)as zf:\n zf.extractall(curdir)\n \n elif args.create is not None :\n if encoding:\n print(\"Non-conforming encodings not supported with -c.\",\n file=sys.stderr)\n sys.exit(1)\n \n zip_name=args.create.pop(0)\n files=args.create\n \n def addToZip(zf,path,zippath):\n if os.path.isfile(path):\n zf.write(path,zippath,ZIP_DEFLATED)\n elif os.path.isdir(path):\n if zippath:\n zf.write(path,zippath)\n for nm in sorted(os.listdir(path)):\n addToZip(zf,\n os.path.join(path,nm),os.path.join(zippath,nm))\n \n \n with ZipFile(zip_name,'w')as zf:\n for path in files:\n zippath=os.path.basename(path)\n if not zippath:\n zippath=os.path.basename(os.path.dirname(path))\n if zippath in ('',os.curdir,os.pardir):\n zippath=''\n addToZip(zf,path,zippath)\n \n \nif __name__ ==\"__main__\":\n main()\n", ["argparse", "binascii", "bz2", "contextlib", "importlib.util", "io", "itertools", "lzma", "os", "pathlib", "posixpath", "py_compile", "shutil", "stat", "struct", "sys", "threading", "time", "warnings", "zlib"]], "zipimport": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport _frozen_importlib_external as _bootstrap_external\nfrom _frozen_importlib_external import _unpack_uint16,_unpack_uint32\nimport _frozen_importlib as _bootstrap\nimport _imp\nimport _io\nimport marshal\nimport sys\nimport time\nimport _warnings\n\n__all__=['ZipImportError','zipimporter']\n\n\npath_sep=_bootstrap_external.path_sep\nalt_path_sep=_bootstrap_external.path_separators[1:]\n\n\nclass ZipImportError(ImportError):\n pass\n \n \n_zip_directory_cache={}\n\n_module_type=type(sys)\n\nEND_CENTRAL_DIR_SIZE=22\nSTRING_END_ARCHIVE=b'PK\\x05\\x06'\nMAX_COMMENT_LEN=(1 <<16)-1\n\nclass zipimporter(_bootstrap_external._LoaderBasics):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n def __init__(self,path):\n if not isinstance(path,str):\n raise TypeError(f\"expected str, not {type(path)!r}\")\n if not path:\n raise ZipImportError('archive path is empty',path=path)\n if alt_path_sep:\n path=path.replace(alt_path_sep,path_sep)\n \n prefix=[]\n while True:\n try:\n st=_bootstrap_external._path_stat(path)\n except(OSError,ValueError):\n \n \n dirname,basename=_bootstrap_external._path_split(path)\n if dirname ==path:\n raise ZipImportError('not a Zip file',path=path)\n path=dirname\n prefix.append(basename)\n else:\n \n if(st.st_mode&0o170000)!=0o100000:\n \n raise ZipImportError('not a Zip file',path=path)\n break\n \n try:\n files=_zip_directory_cache[path]\n except KeyError:\n files=_read_directory(path)\n _zip_directory_cache[path]=files\n self._files=files\n self.archive=path\n \n self.prefix=_bootstrap_external._path_join(*prefix[::-1])\n if self.prefix:\n self.prefix +=path_sep\n \n \n def find_spec(self,fullname,target=None):\n ''\n\n\n \n module_info=_get_module_info(self,fullname)\n if module_info is not None:\n return _bootstrap.spec_from_loader(fullname,self,is_package=module_info)\n else:\n \n \n \n \n \n modpath=_get_module_path(self,fullname)\n if _is_dir(self,modpath):\n \n \n \n path=f'{self.archive}{path_sep}{modpath}'\n spec=_bootstrap.ModuleSpec(name=fullname,loader=None,\n is_package=True)\n spec.submodule_search_locations.append(path)\n return spec\n else:\n return None\n \n def get_code(self,fullname):\n ''\n\n\n\n \n code,ispackage,modpath=_get_module_code(self,fullname)\n return code\n \n \n def get_data(self,pathname):\n ''\n\n\n\n \n if alt_path_sep:\n pathname=pathname.replace(alt_path_sep,path_sep)\n \n key=pathname\n if pathname.startswith(self.archive+path_sep):\n key=pathname[len(self.archive+path_sep):]\n \n try:\n toc_entry=self._files[key]\n except KeyError:\n raise OSError(0,'',key)\n return _get_data(self.archive,toc_entry)\n \n \n \n def get_filename(self,fullname):\n ''\n\n\n\n \n \n \n code,ispackage,modpath=_get_module_code(self,fullname)\n return modpath\n \n \n def get_source(self,fullname):\n ''\n\n\n\n\n \n mi=_get_module_info(self,fullname)\n if mi is None:\n raise ZipImportError(f\"can't find module {fullname !r}\",name=fullname)\n \n path=_get_module_path(self,fullname)\n if mi:\n fullpath=_bootstrap_external._path_join(path,'__init__.py')\n else:\n fullpath=f'{path}.py'\n \n try:\n toc_entry=self._files[fullpath]\n except KeyError:\n \n return None\n return _get_data(self.archive,toc_entry).decode()\n \n \n \n def is_package(self,fullname):\n ''\n\n\n\n \n mi=_get_module_info(self,fullname)\n if mi is None:\n raise ZipImportError(f\"can't find module {fullname !r}\",name=fullname)\n return mi\n \n \n \n def load_module(self,fullname):\n ''\n\n\n\n\n\n\n \n msg=(\"zipimport.zipimporter.load_module() is deprecated and slated for \"\n \"removal in Python 3.12; use exec_module() instead\")\n _warnings.warn(msg,DeprecationWarning)\n code,ispackage,modpath=_get_module_code(self,fullname)\n mod=sys.modules.get(fullname)\n if mod is None or not isinstance(mod,_module_type):\n mod=_module_type(fullname)\n sys.modules[fullname]=mod\n mod.__loader__=self\n \n try:\n if ispackage:\n \n \n path=_get_module_path(self,fullname)\n fullpath=_bootstrap_external._path_join(self.archive,path)\n mod.__path__=[fullpath]\n \n if not hasattr(mod,'__builtins__'):\n mod.__builtins__=__builtins__\n _bootstrap_external._fix_up_module(mod.__dict__,fullname,modpath)\n exec(code,mod.__dict__)\n except:\n del sys.modules[fullname]\n raise\n \n try:\n mod=sys.modules[fullname]\n except KeyError:\n raise ImportError(f'Loaded module {fullname !r} not found in sys.modules')\n _bootstrap._verbose_message('import {} # loaded from Zip {}',fullname,modpath)\n return mod\n \n \n def get_resource_reader(self,fullname):\n ''\n\n\n\n \n try:\n if not self.is_package(fullname):\n return None\n except ZipImportError:\n return None\n from importlib.readers import ZipReader\n return ZipReader(self,fullname)\n \n \n def invalidate_caches(self):\n ''\n try:\n self._files=_read_directory(self.archive)\n _zip_directory_cache[self.archive]=self._files\n except ZipImportError:\n _zip_directory_cache.pop(self.archive,None)\n self._files={}\n \n \n def __repr__(self):\n return f''\n \n \n \n \n \n \n \n_zip_searchorder=(\n(path_sep+'__init__.pyc',True,True),\n(path_sep+'__init__.py',False,True),\n('.pyc',True,False),\n('.py',False,False),\n)\n\n\n\ndef _get_module_path(self,fullname):\n return self.prefix+fullname.rpartition('.')[2]\n \n \ndef _is_dir(self,path):\n\n\n\n dirpath=path+path_sep\n \n return dirpath in self._files\n \n \ndef _get_module_info(self,fullname):\n path=_get_module_path(self,fullname)\n for suffix,isbytecode,ispackage in _zip_searchorder:\n fullpath=path+suffix\n if fullpath in self._files:\n return ispackage\n return None\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \ndef _read_directory(archive):\n try:\n fp=_io.open_code(archive)\n except OSError:\n raise ZipImportError(f\"can't open Zip file: {archive !r}\",path=archive)\n \n with fp:\n \n \n \n start_offset=fp.tell()\n try:\n try:\n fp.seek(-END_CENTRAL_DIR_SIZE,2)\n header_position=fp.tell()\n buffer=fp.read(END_CENTRAL_DIR_SIZE)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n if len(buffer)!=END_CENTRAL_DIR_SIZE:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n if buffer[:4]!=STRING_END_ARCHIVE:\n \n \n try:\n fp.seek(0,2)\n file_size=fp.tell()\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",\n path=archive)\n max_comment_start=max(file_size -MAX_COMMENT_LEN -\n END_CENTRAL_DIR_SIZE,0)\n try:\n fp.seek(max_comment_start)\n data=fp.read()\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",\n path=archive)\n pos=data.rfind(STRING_END_ARCHIVE)\n if pos <0:\n raise ZipImportError(f'not a Zip file: {archive !r}',\n path=archive)\n buffer=data[pos:pos+END_CENTRAL_DIR_SIZE]\n if len(buffer)!=END_CENTRAL_DIR_SIZE:\n raise ZipImportError(f\"corrupt Zip file: {archive !r}\",\n path=archive)\n header_position=file_size -len(data)+pos\n \n header_size=_unpack_uint32(buffer[12:16])\n header_offset=_unpack_uint32(buffer[16:20])\n if header_position header_offset:\n raise ZipImportError(f'bad local header offset: {archive !r}',path=archive)\n file_offset +=arc_offset\n \n try:\n name=fp.read(name_size)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n if len(name)!=name_size:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n \n \n \n try:\n if len(fp.read(header_size -name_size))!=header_size -name_size:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n \n if flags&0x800:\n \n name=name.decode()\n else:\n \n try:\n name=name.decode('ascii')\n except UnicodeDecodeError:\n name=name.decode('latin1').translate(cp437_table)\n \n name=name.replace('/',path_sep)\n path=_bootstrap_external._path_join(archive,name)\n t=(path,compress,data_size,file_size,file_offset,time,date,crc)\n files[name]=t\n count +=1\n finally:\n fp.seek(start_offset)\n _bootstrap._verbose_message('zipimport: found {} names in {!r}',count,archive)\n return files\n \n \n \n \n \n \n \ncp437_table=(\n\n'\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\t\\n\\x0b\\x0c\\r\\x0e\\x0f'\n'\\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17\\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f'\n' !\"#$%&\\'()*+,-./'\n'0123456789:;<=>?'\n'@ABCDEFGHIJKLMNO'\n'PQRSTUVWXYZ[\\\\]^_'\n'`abcdefghijklmno'\n'pqrstuvwxyz{|}~\\x7f'\n\n'\\xc7\\xfc\\xe9\\xe2\\xe4\\xe0\\xe5\\xe7'\n'\\xea\\xeb\\xe8\\xef\\xee\\xec\\xc4\\xc5'\n'\\xc9\\xe6\\xc6\\xf4\\xf6\\xf2\\xfb\\xf9'\n'\\xff\\xd6\\xdc\\xa2\\xa3\\xa5\\u20a7\\u0192'\n'\\xe1\\xed\\xf3\\xfa\\xf1\\xd1\\xaa\\xba'\n'\\xbf\\u2310\\xac\\xbd\\xbc\\xa1\\xab\\xbb'\n'\\u2591\\u2592\\u2593\\u2502\\u2524\\u2561\\u2562\\u2556'\n'\\u2555\\u2563\\u2551\\u2557\\u255d\\u255c\\u255b\\u2510'\n'\\u2514\\u2534\\u252c\\u251c\\u2500\\u253c\\u255e\\u255f'\n'\\u255a\\u2554\\u2569\\u2566\\u2560\\u2550\\u256c\\u2567'\n'\\u2568\\u2564\\u2565\\u2559\\u2558\\u2552\\u2553\\u256b'\n'\\u256a\\u2518\\u250c\\u2588\\u2584\\u258c\\u2590\\u2580'\n'\\u03b1\\xdf\\u0393\\u03c0\\u03a3\\u03c3\\xb5\\u03c4'\n'\\u03a6\\u0398\\u03a9\\u03b4\\u221e\\u03c6\\u03b5\\u2229'\n'\\u2261\\xb1\\u2265\\u2264\\u2320\\u2321\\xf7\\u2248'\n'\\xb0\\u2219\\xb7\\u221a\\u207f\\xb2\\u25a0\\xa0'\n)\n\n_importing_zlib=False\n\n\n\n\ndef _get_decompress_func():\n global _importing_zlib\n if _importing_zlib:\n \n \n _bootstrap._verbose_message('zipimport: zlib UNAVAILABLE')\n raise ZipImportError(\"can't decompress data; zlib not available\")\n \n _importing_zlib=True\n try:\n from zlib import decompress\n except Exception:\n _bootstrap._verbose_message('zipimport: zlib UNAVAILABLE')\n raise ZipImportError(\"can't decompress data; zlib not available\")\n finally:\n _importing_zlib=False\n \n _bootstrap._verbose_message('zipimport: zlib available')\n return decompress\n \n \ndef _get_data(archive,toc_entry):\n datapath,compress,data_size,file_size,file_offset,time,date,crc=toc_entry\n if data_size <0:\n raise ZipImportError('negative data size')\n \n with _io.open_code(archive)as fp:\n \n try:\n fp.seek(file_offset)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n buffer=fp.read(30)\n if len(buffer)!=30:\n raise EOFError('EOF read where not expected')\n \n if buffer[:4]!=b'PK\\x03\\x04':\n \n raise ZipImportError(f'bad local file header: {archive !r}',path=archive)\n \n name_size=_unpack_uint16(buffer[26:28])\n extra_size=_unpack_uint16(buffer[28:30])\n header_size=30+name_size+extra_size\n file_offset +=header_size\n try:\n fp.seek(file_offset)\n except OSError:\n raise ZipImportError(f\"can't read Zip file: {archive !r}\",path=archive)\n raw_data=fp.read(data_size)\n if len(raw_data)!=data_size:\n raise OSError(\"zipimport: can't read data\")\n \n if compress ==0:\n \n return raw_data\n \n \n try:\n decompress=_get_decompress_func()\n except Exception:\n raise ZipImportError(\"can't decompress data; zlib not available\")\n return decompress(raw_data,-15)\n \n \n \n \n \ndef _eq_mtime(t1,t2):\n\n return abs(t1 -t2)<=1\n \n \n \n \n \ndef _unmarshal_code(self,pathname,fullpath,fullname,data):\n exc_details={\n 'name':fullname,\n 'path':fullpath,\n }\n \n flags=_bootstrap_external._classify_pyc(data,fullname,exc_details)\n \n hash_based=flags&0b1 !=0\n if hash_based:\n check_source=flags&0b10 !=0\n if(_imp.check_hash_based_pycs !='never'and\n (check_source or _imp.check_hash_based_pycs =='always')):\n source_bytes=_get_pyc_source(self,fullpath)\n if source_bytes is not None:\n source_hash=_imp.source_hash(\n _bootstrap_external._RAW_MAGIC_NUMBER,\n source_bytes,\n )\n \n _bootstrap_external._validate_hash_pyc(\n data,source_hash,fullname,exc_details)\n else:\n source_mtime,source_size=\\\n _get_mtime_and_size_of_source(self,fullpath)\n \n if source_mtime:\n \n \n if(not _eq_mtime(_unpack_uint32(data[8:12]),source_mtime)or\n _unpack_uint32(data[12:16])!=source_size):\n _bootstrap._verbose_message(\n f'bytecode is stale for {fullname !r}')\n return None\n \n code=marshal.loads(data[16:])\n if not isinstance(code,_code_type):\n raise TypeError(f'compiled module {pathname !r} is not a code object')\n return code\n \n_code_type=type(_unmarshal_code.__code__)\n\n\n\n\ndef _normalize_line_endings(source):\n source=source.replace(b'\\r\\n',b'\\n')\n source=source.replace(b'\\r',b'\\n')\n return source\n \n \n \ndef _compile_source(pathname,source):\n source=_normalize_line_endings(source)\n return compile(source,pathname,'exec',dont_inherit=True)\n \n \n \ndef _parse_dostime(d,t):\n return time.mktime((\n (d >>9)+1980,\n (d >>5)&0xF,\n d&0x1F,\n t >>11,\n (t >>5)&0x3F,\n (t&0x1F)*2,\n -1,-1,-1))\n \n \n \n \ndef _get_mtime_and_size_of_source(self,path):\n try:\n \n assert path[-1:]in('c','o')\n path=path[:-1]\n toc_entry=self._files[path]\n \n \n time=toc_entry[5]\n date=toc_entry[6]\n uncompressed_size=toc_entry[3]\n return _parse_dostime(date,time),uncompressed_size\n except(KeyError,IndexError,TypeError):\n return 0,0\n \n \n \n \n \ndef _get_pyc_source(self,path):\n\n assert path[-1:]in('c','o')\n path=path[:-1]\n \n try:\n toc_entry=self._files[path]\n except KeyError:\n return None\n else:\n return _get_data(self.archive,toc_entry)\n \n \n \n \ndef _get_module_code(self,fullname):\n path=_get_module_path(self,fullname)\n import_error=None\n for suffix,isbytecode,ispackage in _zip_searchorder:\n fullpath=path+suffix\n _bootstrap._verbose_message('trying {}{}{}',self.archive,path_sep,fullpath,verbosity=2)\n try:\n toc_entry=self._files[fullpath]\n except KeyError:\n pass\n else:\n modpath=toc_entry[0]\n data=_get_data(self.archive,toc_entry)\n code=None\n if isbytecode:\n try:\n code=_unmarshal_code(self,modpath,fullpath,fullname,data)\n except ImportError as exc:\n import_error=exc\n else:\n code=_compile_source(modpath,data)\n if code is None:\n \n \n continue\n modpath=toc_entry[0]\n return code,ispackage,modpath\n else:\n if import_error:\n msg=f\"module load failed: {import_error}\"\n raise ZipImportError(msg,name=fullname)from import_error\n else:\n raise ZipImportError(f\"can't find module {fullname !r}\",name=fullname)\n", ["_frozen_importlib", "_frozen_importlib_external", "_imp", "_io", "_warnings", "importlib.readers", "marshal", "sys", "time", "zlib"]], "zlib": [".py", "from _zlib_utils import lz_generator,crc32\n\nDEFLATED=8\nDEF_BUF_SIZE=16384\nDEF_MEM_LEVEL=8\nMAX_WBITS=15\nZLIB_RUNTIME_VERSION='1.2.11'\nZLIB_VERSION='1.2.11'\nZ_BEST_COMPRESSION=9\nZ_BEST_SPEED=1\nZ_BLOCK=5\nZ_DEFAULT_COMPRESSION=-1\nZ_DEFAULT_STRATEGY=0\nZ_FILTERED=1\nZ_FINISH=4\nZ_FIXED=4\nZ_FULL_FLUSH=3\nZ_HUFFMAN_ONLY=2\nZ_NO_COMPRESSION=0\nZ_NO_FLUSH=0\nZ_PARTIAL_FLUSH=1\nZ_RLE=3\nZ_SYNC_FLUSH=2\nZ_TREES=6\n\nclass BitIO:\n\n def __init__(self,bytestream=b''):\n self.bytestream=bytearray(bytestream)\n self.bytenum=0\n self.bitnum=0\n \n @property\n def pos(self):\n return self.bytenum *8+self.bitnum\n \n def read(self,nb,order=\"lsf\",trace=False ):\n result=0\n coef=1 if order ==\"lsf\"else 2 **(nb -1)\n for _ in range(nb):\n if self.bitnum ==8:\n if self.bytenum ==len(self.bytestream)-1:\n return None\n self.bytenum +=1\n self.bitnum=0\n mask=2 **self.bitnum\n if trace:\n print(\"byte\",self.bytenum,\"bitnum\",self.bitnum,\n \"bit\",int(bool(mask&self.bytestream[self.bytenum])))\n result +=coef *bool(mask&self.bytestream[self.bytenum])\n self.bitnum +=1\n if order ==\"lsf\":\n coef *=2\n else :\n coef //=2\n return result\n \n def move(self,nb):\n if nb ==0:\n return\n elif nb >0:\n bitpos=self.bitnum+nb\n while bitpos >7:\n self.bytenum +=1\n if self.bytenum ==len(self.bytestream):\n raise Exception(\"can't move {} bits\".format(nb))\n bitpos -=8\n self.bitnum=bitpos\n else :\n bitpos=self.bitnum+nb\n while bitpos <0:\n self.bytenum -=1\n if self.bytenum ==-1:\n raise Exception(\"can't move {} bits\".format(nb))\n bitpos +=8\n self.bitnum=bitpos\n \n def show(self):\n res=\"\"\n for x in self.bytestream:\n s=str(bin(x))[2:]\n s=\"0\"*(8 -len(s))+s\n res +=s+\" \"\n return res\n \n def write(self,*bits):\n for bit in bits:\n if not self.bytestream:\n self.bytestream.append(0)\n byte=self.bytestream[self.bytenum]\n if self.bitnum ==8:\n if self.bytenum ==len(self.bytestream)-1:\n byte=0\n self.bytestream +=bytes([byte])\n self.bytenum +=1\n self.bitnum=0\n mask=2 **self.bitnum\n if bit:\n byte |=mask\n else :\n byte &=~mask\n self.bytestream[self.bytenum]=byte\n self.bitnum +=1\n \n def write_int(self,value,nb,order=\"lsf\"):\n ''\n if value >=2 **nb:\n raise ValueError(\"can't write value on {} bits\".format(nb))\n bits=[]\n while value:\n bits.append(value&1)\n value >>=1\n \n bits=bits+[0]*(nb -len(bits))\n if order !=\"lsf\":\n bits.reverse()\n assert len(bits)==nb\n self.write(*bits)\n \nclass Error(Exception):\n pass\n \n \nclass ResizeError(Exception):\n pass\n \n \nclass Node:\n\n def __init__(self,char=None ,weight=0,level=0):\n self.char=char\n self.is_leaf=char is not None\n self.level=level\n self.weight=weight\n \n def add(self,children):\n self.children=children\n for child in self.children:\n child.parent=self\n child.level=self.level+1\n \n \nclass Tree:\n\n def __init__(self,root):\n self.root=root\n \n def length(self):\n self.root.level=0\n node=self.root\n nb_levels=0\n def set_level(node):\n nonlocal nb_levels\n for child in node.children:\n child.level=node.level+1\n nb_levels=max(nb_levels,child.level)\n if not child.is_leaf:\n set_level(child)\n set_level(self.root)\n return nb_levels\n \n def reduce_tree(self):\n ''\n\n\n \n currentlen=self.length()\n deepest=self.nodes_at(currentlen)\n deepest_leaves=[node for node in deepest if node.is_leaf]\n rightmost_leaf=deepest_leaves[-1]\n sibling=rightmost_leaf.parent.children[0]\n \n \n parent=rightmost_leaf.parent\n grand_parent=parent.parent\n rank=grand_parent.children.index(parent)\n children=grand_parent.children\n children[rank]=rightmost_leaf\n grand_parent.add(children)\n \n \n up_level=rightmost_leaf.level -2\n while up_level >0:\n nodes=self.nodes_at(up_level)\n leaf_nodes=[node for node in nodes if node.is_leaf]\n if leaf_nodes:\n leftmost_leaf=leaf_nodes[0]\n \n parent=leftmost_leaf.parent\n rank=parent.children.index(leftmost_leaf)\n new_node=Node()\n new_node.level=leftmost_leaf.level\n children=[sibling,leftmost_leaf]\n new_node.add(children)\n parent.children[rank]=new_node\n new_node.parent=parent\n break\n else :\n up_level -=1\n if up_level ==0:\n raise ResizeError\n \n def nodes_at(self,level,top=None ):\n ''\n res=[]\n if top is None :\n top=self.root\n if top.level ==level:\n res=[top]\n elif not top.is_leaf:\n for child in top.children:\n res +=self.nodes_at(level,child)\n return res\n \n def reduce(self,maxlevels):\n ''\n while self.length()>maxlevels:\n self.reduce_tree()\n \n def codes(self,node=None ,code=''):\n ''\n \n if node is None :\n self.dic={}\n node=self.root\n if node.is_leaf:\n self.dic[node.char]=code\n else :\n for i,child in enumerate(node.children):\n self.codes(child,code+str(i))\n return self.dic\n \n \ndef codelengths_from_frequencies(freqs):\n ''\n\n\n\n \n freqs=sorted(freqs.items(),\n key=lambda item:(item[1],-item[0]),reverse=True )\n nodes=[Node(char=key,weight=value)for (key,value)in freqs]\n while len(nodes)>1:\n right,left=nodes.pop(),nodes.pop()\n node=Node(weight=right.weight+left.weight)\n node.add([left,right])\n if not nodes:\n nodes.append(node)\n else :\n pos=0\n while pos node.weight:\n pos +=1\n nodes.insert(pos,node)\n \n top=nodes[0]\n tree=Tree(top)\n tree.reduce(15)\n \n codes=tree.codes()\n \n code_items=list(codes.items())\n code_items.sort(key=lambda item:(len(item[1]),item[0]))\n return [(car,len(value))for car,value in code_items]\n \ndef normalized(codelengths):\n car,codelength=codelengths[0]\n value=0\n codes={car:\"0\"*codelength}\n \n for (newcar,nbits)in codelengths[1:]:\n value +=1\n bvalue=str(bin(value))[2:]\n bvalue=\"0\"*(codelength -len(bvalue))+bvalue\n if nbits >codelength:\n codelength=nbits\n bvalue +=\"0\"*(codelength -len(bvalue))\n value=int(bvalue,2)\n assert len(bvalue)==nbits\n codes[newcar]=bvalue\n \n return codes\n \ndef make_tree(node,codes):\n if not hasattr(node,\"parent\"):\n node.code=''\n children=[]\n for bit in '01':\n next_code=node.code+bit\n if next_code in codes:\n child=Node(char=codes[next_code])\n else :\n child=Node()\n child.code=next_code\n children.append(child)\n node.add(children)\n for child in children:\n if not child.is_leaf:\n make_tree(child,codes)\n \ndef decompresser(codelengths):\n lengths=list(codelengths.items())\n \n lengths=[x for x in lengths if x[1]>0]\n lengths.sort(key=lambda item:(item[1],item[0]))\n codes=normalized(lengths)\n codes={value:key for key,value in codes.items()}\n root=Node()\n make_tree(root,codes)\n return {\"root\":root,\"codes\":codes}\n \ndef tree_from_codelengths(codelengths):\n return decompresser(codelengths)[\"root\"]\n \nclass error(Exception):\n pass\n \n \nfixed_codelengths={}\nfor car in range(144):\n fixed_codelengths[car]=8\nfor car in range(144,256):\n fixed_codelengths[car]=9\nfor car in range(256,280):\n fixed_codelengths[car]=7\nfor car in range(280,288):\n fixed_codelengths[car]=8\n \nfixed_decomp=decompresser(fixed_codelengths)\nfixed_lit_len_tree=fixed_decomp[\"root\"]\nfixed_lit_len_codes={value:key\nfor (key,value)in fixed_decomp[\"codes\"].items()}\n\ndef cl_encode(lengths):\n ''\n \n dic={char:len(code)for (char,code)in lengths.items()}\n items=[dic.get(i,0)for i in range(max(dic)+1)]\n pos=0\n while pos 3:\n yield (16,3)\n nb -=3\n yield (16,nb)\n pos +=repeat+1\n \ndef read_codelengths(reader,root,num):\n ''\n\n \n node=root\n lengths=[]\n nb=0\n while len(lengths)256:\n \n if child.char <265:\n length=child.char -254\n elif child.char <269:\n length=11+2 *(child.char -265)+reader.read(1)\n elif child.char <273:\n length=19+4 *(child.char -269)+reader.read(2)\n elif child.char <277:\n length=35+8 *(child.char -273)+reader.read(3)\n elif child.char <281:\n length=67+16 *(child.char -277)+reader.read(4)\n elif child.char <285:\n length=131+31 *(child.char -281)+reader.read(5)\n elif child.char ==285:\n length=258\n return (\"length\",length)\n else :\n node=child\n \ndef adler32(source):\n a=1\n b=0\n for byte in source:\n a +=byte\n a %=65521\n b +=a\n b %=65521\n return a,b\n \n \ndef compress_dynamic(out,source,store,lit_len_count,distance_count):\n\n lit_len_count[256]=1\n \n \n \n \n \n \n lit_len_codes=normalized(codelengths_from_frequencies(lit_len_count))\n HLIT=1+max(lit_len_codes)-257\n \n \n \n \n \n \n coded_lit_len=list(cl_encode(lit_len_codes))\n \n \n distance_codes=normalized(codelengths_from_frequencies(distance_count))\n HDIST=max(distance_codes)\n coded_distance=list(cl_encode(distance_codes))\n \n \n codelengths_count={}\n for coded in coded_lit_len,coded_distance:\n for item in coded:\n length=item[0]if isinstance(item,tuple)else item\n codelengths_count[length]=codelengths_count.get(length,0)+1\n \n \n codelengths_codes=normalized(\n codelengths_from_frequencies(codelengths_count))\n codelengths_dict={char:len(value)\n for (char,value)in codelengths_codes.items()}\n \n alphabet=(16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,\n 15)\n \n \n codelengths_list=[codelengths_dict.get(car,0)for car in alphabet]\n \n while codelengths_list[-1]==0:\n codelengths_list.pop()\n HCLEN=len(codelengths_list)-4\n \n out.write(0,1)\n \n out.write_int(HLIT,5)\n out.write_int(HDIST,5)\n out.write_int(HCLEN,4)\n \n \n for length,car in zip(codelengths_list,alphabet):\n out.write_int(length,3)\n \n \n for item in coded_lit_len+coded_distance:\n if isinstance(item,tuple):\n length,extra=item\n code=codelengths_codes[length]\n value,nbits=int(code,2),len(code)\n out.write_int(value,nbits,order=\"msf\")\n if length ==16:\n out.write_int(extra,2)\n elif length ==17:\n out.write_int(extra,3)\n elif length ==18:\n out.write_int(extra,7)\n else :\n code=codelengths_codes[item]\n value,nbits=int(code,2),len(code)\n out.write_int(value,nbits,order=\"msf\")\n \n \n for item in store:\n if isinstance(item,tuple):\n length,extra_length,distance,extra_distance=item\n \n code=lit_len_codes[length]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \n value,nb=extra_length\n if nb:\n out.write_int(value,nb)\n \n code=distance_codes[distance]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \n value,nb=extra_distance\n if nb:\n out.write_int(value,nb)\n else :\n literal=item\n code=lit_len_codes[item]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \ndef compress_fixed(out,source,items):\n ''\n out.write(1,0)\n \n for item in items:\n if isinstance(item,tuple):\n length,extra_length,distance,extra_distance=item\n \n code=fixed_lit_len_codes[length]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \n value,nb=extra_length\n if nb:\n out.write_int(value,nb)\n \n out.write_int(distance,5,order=\"msf\")\n \n value,nb=extra_distance\n if nb:\n out.write_int(value,nb)\n else :\n literal=item\n code=fixed_lit_len_codes[item]\n value,nb=int(code,2),len(code)\n out.write_int(value,nb,order=\"msf\")\n \ndef compress(data,/,level=-1,wbits=MAX_WBITS):\n\n window_size=32 *1024\n \n \n out=BitIO()\n \n \n out.write_int(8,4)\n size=window_size >>8\n nb=0\n while size >1:\n size >>=1\n nb +=1\n out.write_int(nb,4)\n out.write_int(0x9c,8)\n header=out.bytestream\n compressor=_Compressor(level)\n payload=compressor.compress(data)+compressor.flush()\n a,b=adler32(data)\n checksum=divmod(b,256)+divmod(a,256)\n return header+payload+bytes(checksum)\n \ndef convert32bits(n):\n result=[]\n for _ in range(4):\n n,rest=divmod(n,256)\n result.append(rest)\n return result\n \nclass _Compressor:\n\n def __init__(self,level=-1,method=DEFLATED,wbits=MAX_WBITS,\n memLevel=DEF_MEM_LEVEL,strategy=Z_DEFAULT_STRATEGY,\n zdict=None ):\n self.level=level\n self.method=method\n self.wbits=wbits\n self.window_size=32 *1024\n self.memLevel=memLevel\n self.strategy=strategy\n self.zdict=zdict\n self._flushed=False\n \n def compress(self,source):\n \n \n lit_len_count={}\n \n \n distance_count={}\n \n store=[]\n replaced=0\n nb_tuples=0\n \n for item in lz_generator(source,self.window_size):\n if isinstance(item,tuple):\n nb_tuples +=1\n length,distance=item\n replaced +=length\n \n \n length_code,*extra_length=length_to_code(length)\n \n lit_len_count[length_code]=lit_len_count.get(length_code,0)+1\n \n \n \n distance_code,*extra_dist=distance_to_code(distance)\n \n distance_count[distance_code]=\\\n distance_count.get(distance_code,0)+1\n \n \n store.append((length_code,extra_length,distance_code,\n extra_dist))\n else :\n literal=item\n lit_len_count[literal]=lit_len_count.get(literal,0)+1\n store.append(literal)\n \n store.append(256)\n \n \n \n \n score=replaced -100 -(nb_tuples *20 //8)\n \n \n out=BitIO()\n \n out.write(1)\n \n if score <0:\n compress_fixed(out,source,store)\n else :\n compress_dynamic(out,source,store,lit_len_count,distance_count)\n \n \n while out.bitnum !=8:\n out.write(0)\n \n self._compressed=bytes(out.bytestream)\n \n return b''\n \n def flush(self,mode=Z_FINISH):\n if self._flushed:\n raise Error('inconsistent flush state')\n self._flushed=True\n return self._compressed\n \n \ndef compressobj(level=-1,method=DEFLATED,wbits=MAX_WBITS,\nmemLevel=DEF_MEM_LEVEL,strategy=Z_DEFAULT_STRATEGY,\nzdict=None ):\n return _Compressor(level,method,wbits,memLevel,strategy,zdict)\n \n \ndef decompress(data,/,wbits=MAX_WBITS,bufsize=DEF_BUF_SIZE):\n if wbits >0:\n decompressor=_Decompressor(wbits,bufsize)\n source=BitIO(data)\n assert source.read(4)==8\n nb=source.read(4)\n window_size=2 **(nb+8)\n assert source.read(8)==0x9c\n checksum=data[-4:]\n a=256 *checksum[2]+checksum[3]\n b=256 *checksum[0]+checksum[1]\n assert a,b ==adler32(data)\n return decompressor.decompress(data[2:-4])\n else :\n decompressor=_Decompressor(-wbits,bufsize)\n return decompressor.decompress(data)\n \nclass _Decompressor:\n\n def __init__(self,wbits=MAX_WBITS,bufsize=DEF_BUF_SIZE,zdict=None ):\n self.wbits=wbits\n self.bufsize=bufsize\n self.zdict=zdict\n self.eof=False\n self.unconsumed_tail=b''\n self.unused_data=b''\n \n def decompress(self,data,max_length=0):\n self.data=data\n if data ==b'':\n return data\n \n reader=self._reader=BitIO(data)\n \n result=bytearray()\n \n while True :\n BFINAL=reader.read(1)\n \n BTYPE=reader.read(2)\n \n if BTYPE ==0b01:\n \n \n root=fixed_lit_len_tree\n \n while True :\n \n _type,value=read_literal_or_length(reader,root)\n if _type =='eob':\n break\n elif _type =='literal':\n result.append(value)\n elif _type =='length':\n length=value\n \n dist_code=reader.read(5,\"msf\")\n if dist_code <3:\n distance=dist_code+1\n else :\n nb=(dist_code //2)-1\n extra=reader.read(nb)\n half,delta=divmod(dist_code,2)\n distance=(1+(2 **half)+\n delta *(2 **(half -1))+extra)\n for _ in range(length):\n result.append(result[-distance])\n \n node=root\n else :\n node=child\n elif BTYPE ==0b10:\n \n \n \n lit_len_tree,distance_tree=dynamic_trees(reader)\n \n while True :\n \n _type,value=read_literal_or_length(reader,lit_len_tree)\n if _type =='eob':\n break\n elif _type =='literal':\n result.append(value)\n elif _type =='length':\n \n length=value\n distance=read_distance(reader,distance_tree)\n for _ in range(length):\n result.append(result[-distance])\n \n if BFINAL:\n rank=reader.bytenum\n self.unused_data=bytes(data[rank+1:])\n self.eof=True\n return bytes(result)\n \ndef decompressobj(wbits=MAX_WBITS,zdict=None ):\n return _Decompressor(wbits,zdict)\n", ["_zlib_utils"]], "_codecs": [".py", "\ndef ascii_decode(*args,**kw):\n pass\n \ndef ascii_encode(*args,**kw):\n pass\n \ndef charbuffer_encode(*args,**kw):\n pass\n \ndef charmap_build(decoding_table):\n return {car:i for (i,car)in enumerate(decoding_table)}\n \ndef charmap_decode(input,errors,decoding_table):\n res=''\n for car in input:\n code=decoding_table[car]\n if code is None :\n raise UnicodeDecodeError(input)\n res +=code\n return res,len(input)\n \ndef charmap_encode(input,errors,encoding_table):\n t=[]\n for car in input:\n code=encoding_table.get(car)\n if code is None :\n raise UnicodeEncodeError(input)\n t.append(code)\n return bytes(t),len(input)\n \ndef decode(obj,encoding=\"utf-8\",errors=\"strict\"):\n ''\n\n\n\n\n\n \n return __BRYTHON__.decode(obj,encoding,errors)\n \ndef encode(obj,encoding=\"utf-8\",errors=\"strict\"):\n ''\n\n\n\n\n\n \n return __BRYTHON__.encode(obj,encoding,errors)\n \ndef escape_decode(*args,**kw):\n pass\n \ndef escape_encode(*args,**kw):\n pass\n \ndef latin_1_decode(*args,**kw):\n pass\n \ndef latin_1_encode(*args,**kw):\n pass\n \ndef lookup(encoding):\n ''\n\n \n if encoding in ('utf-8','utf_8'):\n from browser import console\n import encodings.utf_8\n return encodings.utf_8.getregentry()\n \n LookupError(encoding)\n \ndef lookup_error(*args,**kw):\n ''\n\n \n pass\n \ndef mbcs_decode(*args,**kw):\n pass\n \ndef mbcs_encode(*args,**kw):\n pass\n \ndef raw_unicode_escape_decode(*args,**kw):\n pass\n \ndef raw_unicode_escape_encode(*args,**kw):\n pass\n \ndef readbuffer_encode(*args,**kw):\n pass\n \ndef register(*args,**kw):\n ''\n\n\n\n \n pass\n \ndef register_error(*args,**kw):\n ''\n\n\n\n\n \n pass\n \ndef unicode_escape_decode(*args,**kw):\n pass\n \ndef unicode_escape_encode(*args,**kw):\n pass\n \ndef unicode_internal_decode(*args,**kw):\n pass\n \ndef unicode_internal_encode(*args,**kw):\n pass\n \ndef utf_16_be_decode(*args,**kw):\n pass\n \ndef utf_16_be_encode(*args,**kw):\n pass\n \ndef utf_16_decode(*args,**kw):\n pass\n \ndef utf_16_encode(*args,**kw):\n pass\n \ndef utf_16_ex_decode(*args,**kw):\n pass\n \ndef utf_16_le_decode(*args,**kw):\n pass\n \ndef utf_16_le_encode(*args,**kw):\n pass\n \ndef utf_32_be_decode(*args,**kw):\n pass\n \ndef utf_32_be_encode(*args,**kw):\n pass\n \ndef utf_32_decode(*args,**kw):\n pass\n \ndef utf_32_encode(*args,**kw):\n pass\n \ndef utf_32_ex_decode(*args,**kw):\n pass\n \ndef utf_32_le_decode(*args,**kw):\n pass\n \ndef utf_32_le_encode(*args,**kw):\n pass\n \ndef utf_7_decode(*args,**kw):\n pass\n \ndef utf_7_encode(*args,**kw):\n pass\n \ndef utf_8_decode(decoder,bytes_obj,errors,*args):\n return (bytes_obj.decode(\"utf-8\"),len(bytes_obj))\n \ndef utf_8_encode(*args,**kw):\n input=args[0]\n if len(args)==2:\n errors=args[1]\n else :\n errors=kw.get('errors','strict')\n \n \n return (bytes(input,'utf-8'),len(input))\n", ["browser", "encodings.utf_8"]], "_codecs_jp": [".py", "from encoding_cp932 import encoding_table,decoding_table\n\n\n\nclass Codec:\n\n def encode(self,input,errors='strict'):\n b=[]\n for pos,car in enumerate(input):\n cp=ord(car)\n try :\n code=encoding_table[cp]\n high=((code >>8)&0xff)\n low=code&0xff\n if high:\n b.append(high)\n b.append(low)\n except IndexError:\n raise UnicodeEncodeError(pos)\n return [bytes(b),len(input)]\n \n def decode(self,input,errors='strict'):\n i=0\n string=''\n while i self.maxlen:\n self.popleft()\n \n def appendleft(self,x):\n self.state +=1\n self.leftndx -=1\n if self.leftndx ==-1:\n newblock=[None ]*BLOCKSIZ\n self.left[LFTLNK]=newblock\n newblock[RGTLNK]=self.left\n self.left=newblock\n self.leftndx=n -1\n self.length +=1\n self.left[self.leftndx]=x\n if self.maxlen is not None and self.length >self.maxlen:\n self.pop()\n \n def extend(self,iterable):\n if iterable is self:\n iterable=list(iterable)\n for elem in iterable:\n self.append(elem)\n \n def extendleft(self,iterable):\n if iterable is self:\n iterable=list(iterable)\n for elem in iterable:\n self.appendleft(elem)\n \n def pop(self):\n if self.left is self.right and self.leftndx >self.rightndx:\n \n raise IndexError(\"pop from an empty deque\")\n x=self.right[self.rightndx]\n self.right[self.rightndx]=None\n self.length -=1\n self.rightndx -=1\n self.state +=1\n if self.rightndx ==-1:\n prevblock=self.right[LFTLNK]\n if prevblock is None :\n \n self.rightndx=n //2\n self.leftndx=n //2+1\n else :\n prevblock[RGTLNK]=None\n self.right[LFTLNK]=None\n self.right=prevblock\n self.rightndx=n -1\n return x\n \n def popleft(self):\n if self.left is self.right and self.leftndx >self.rightndx:\n \n raise IndexError(\"pop from an empty deque\")\n x=self.left[self.leftndx]\n self.left[self.leftndx]=None\n self.length -=1\n self.leftndx +=1\n self.state +=1\n if self.leftndx ==n:\n prevblock=self.left[RGTLNK]\n if prevblock is None :\n \n self.rightndx=n //2\n self.leftndx=n //2+1\n else :\n prevblock[LFTLNK]=None\n self.left[RGTLNK]=None\n self.left=prevblock\n self.leftndx=0\n return x\n \n def count(self,value):\n c=0\n for item in self:\n if item ==value:\n c +=1\n return c\n \n def remove(self,value):\n \n for i in range(len(self)):\n if self[i]==value:\n del self[i]\n return\n raise ValueError(\"deque.remove(x): x not in deque\")\n \n def rotate(self,n=1):\n length=len(self)\n if length ==0:\n return\n halflen=(length+1)>>1\n if n >halflen or n <-halflen:\n n %=length\n if n >halflen:\n n -=length\n elif n <-halflen:\n n +=length\n while n >0:\n self.appendleft(self.pop())\n n -=1\n while n <0:\n self.append(self.popleft())\n n +=1\n \n def reverse(self):\n ''\n leftblock=self.left\n rightblock=self.right\n leftindex=self.leftndx\n rightindex=self.rightndx\n for i in range(self.length //2):\n \n assert leftblock !=rightblock or leftindex =0:\n block=self.left\n while block:\n l,r=0,n\n if block is self.left:\n l=self.leftndx\n if block is self.right:\n r=self.rightndx+1\n span=r -l\n if index =negative_span:\n return block,r+index\n index -=negative_span\n block=block[LFTLNK]\n raise IndexError(\"deque index out of range\")\n \n def __getitem__(self,index):\n block,index=self.__getref(index)\n return block[index]\n \n def __setitem__(self,index,value):\n block,index=self.__getref(index)\n block[index]=value\n \n def __delitem__(self,index):\n length=len(self)\n if index >=0:\n if index >=length:\n raise IndexError(\"deque index out of range\")\n self.rotate(-index)\n self.popleft()\n self.rotate(index)\n else :\n \n index=index ^(2 **31)\n if index >=length:\n raise IndexError(\"deque index out of range\")\n self.rotate(index)\n self.pop()\n self.rotate(-index)\n \n def __reduce_ex__(self,proto):\n return type(self),(list(self),self.maxlen)\n \n def __hash__(self):\n \n raise TypeError(\"deque objects are unhashable\")\n \n def __copy__(self):\n return self.__class__(self,self.maxlen)\n \n \n def __eq__(self,other):\n if isinstance(other,deque):\n return list(self)==list(other)\n else :\n return NotImplemented\n \n def __ne__(self,other):\n if isinstance(other,deque):\n return list(self)!=list(other)\n else :\n return NotImplemented\n \n def __lt__(self,other):\n if isinstance(other,deque):\n return list(self)list(other)\n else :\n return NotImplemented\n \n def __ge__(self,other):\n if isinstance(other,deque):\n return list(self)>=list(other)\n else :\n return NotImplemented\n \n def __iadd__(self,other):\n self.extend(other)\n return self\n \n \nclass deque_iterator(object):\n\n def __init__(self,deq,itergen):\n self.counter=len(deq)\n def giveup():\n self.counter=0\n \n raise RuntimeError(\"deque mutated during iteration\")\n self._gen=itergen(deq.state,giveup)\n \n def __next__(self):\n res=self._gen.__next__()\n self.counter -=1\n return res\n \n def __iter__(self):\n return self\n \nclass defaultdict(dict):\n\n def __init__(self,*args,**kwds):\n if len(args)>0:\n default_factory=args[0]\n args=args[1:]\n if not callable(default_factory)and default_factory is not None :\n raise TypeError(\"first argument must be callable\")\n else :\n default_factory=None\n dict.__init__(self,*args,**kwds)\n self.default_factory=default_factory\n self.update(*args,**kwds)\n super(defaultdict,self).__init__(*args,**kwds)\n \n def __missing__(self,key):\n \n if self.default_factory is None :\n raise KeyError(key)\n self[key]=value=self.default_factory()\n return value\n \n def __repr__(self,recurse=set()):\n if id(self)in recurse:\n return \"defaultdict(...)\"\n try :\n recurse.add(id(self))\n return \"defaultdict(%s, %s)\"%(repr(self.default_factory),super(defaultdict,self).__repr__())\n finally :\n recurse.remove(id(self))\n \n def copy(self):\n return type(self)(self.default_factory,self)\n \n def __copy__(self):\n return self.copy()\n \n def __reduce__(self):\n \n \n \n \n \n \n \n \n \n \n \n return (type(self),(self.default_factory,),None ,None ,self.items())\n \nfrom operator import itemgetter as _itemgetter\nfrom keyword import iskeyword as _iskeyword\nimport sys as _sys\n\ndef namedtuple(typename,field_names,verbose=False ,rename=False ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n if isinstance(field_names,str):\n field_names=field_names.replace(',',' ').split()\n field_names=tuple(map(str,field_names))\n if rename:\n names=list(field_names)\n seen=set()\n for i,name in enumerate(names):\n if (not min(c.isalnum()or c =='_'for c in name)or _iskeyword(name)\n or not name or name[0].isdigit()or name.startswith('_')\n or name in seen):\n names[i]='_%d'%i\n seen.add(name)\n field_names=tuple(names)\n for name in (typename,)+field_names:\n if not min(c.isalnum()or c =='_'for c in name):\n raise ValueError('Type names and field names can only contain alphanumeric characters and underscores: %r'%name)\n if _iskeyword(name):\n raise ValueError('Type names and field names cannot be a keyword: %r'%name)\n if name[0].isdigit():\n raise ValueError('Type names and field names cannot start with a number: %r'%name)\n seen_names=set()\n for name in field_names:\n if name.startswith('_')and not rename:\n raise ValueError('Field names cannot start with an underscore: %r'%name)\n if name in seen_names:\n raise ValueError('Encountered duplicate field name: %r'%name)\n seen_names.add(name)\n \n \n numfields=len(field_names)\n argtxt=repr(field_names).replace(\"'\",\"\")[1:-1]\n reprtxt=', '.join('%s=%%r'%name for name in field_names)\n \n template='''class %(typename)s(tuple):\n '%(typename)s(%(argtxt)s)' \\n\n __slots__ = () \\n\n _fields = %(field_names)r \\n\n def __new__(_cls, %(argtxt)s):\n return tuple.__new__(_cls, (%(argtxt)s)) \\n\n @classmethod\n def _make(cls, iterable, new=tuple.__new__, len=len):\n 'Make a new %(typename)s object from a sequence or iterable'\n result = new(cls, iterable)\n if len(result) != %(numfields)d:\n raise TypeError('Expected %(numfields)d arguments, got %%d' %% len(result))\n return result \\n\n def __repr__(self):\n return '%(typename)s(%(reprtxt)s)' %% self \\n\n def _asdict(self):\n 'Return a new dict which maps field names to their values'\n return dict(zip(self._fields, self)) \\n\n def _replace(_self, **kwds):\n 'Return a new %(typename)s object replacing specified fields with new values'\n result = _self._make(map(kwds.pop, %(field_names)r, _self))\n if kwds:\n raise ValueError('Got unexpected field names: %%r' %% kwds.keys())\n return result \\n\n def __getnewargs__(self):\n return tuple(self) \\n\\n'''%locals()\n for i,name in enumerate(field_names):\n template +=' %s = _property(_itemgetter(%d))\\n'%(name,i)\n \n if verbose:\n print(template)\n \n \n namespace=dict(_itemgetter=_itemgetter,__name__='namedtuple_%s'%typename,\n _property=property,_tuple=tuple)\n try :\n exec(template,namespace)\n except SyntaxError as e:\n raise SyntaxError(e.message+':\\n'+template)\n result=namespace[typename]\n \n \n \n \n \n try :\n result.__module__=_sys._getframe(1).f_globals.get('__name__','__main__')\n except (AttributeError,ValueError):\n pass\n \n return result\n \nif __name__ =='__main__':\n Point=namedtuple('Point',['x','y'])\n p=Point(11,y=22)\n print(p[0]+p[1])\n x,y=p\n print(x,y)\n print(p.x+p.y)\n print(p)\n", ["keyword", "operator", "sys"]], "_collections_abc": [".py", "\n\n\n\"\"\"Abstract Base Classes (ABCs) for collections, according to PEP 3119.\n\nUnit tests are in test_collections.\n\"\"\"\n\nfrom abc import ABCMeta,abstractmethod\nimport sys\n\nGenericAlias=type(list[int])\nEllipsisType=type(...)\ndef _f():pass\nFunctionType=type(_f)\ndel _f\n\n__all__=[\"Awaitable\",\"Coroutine\",\n\"AsyncIterable\",\"AsyncIterator\",\"AsyncGenerator\",\n\"Hashable\",\"Iterable\",\"Iterator\",\"Generator\",\"Reversible\",\n\"Sized\",\"Container\",\"Callable\",\"Collection\",\n\"Set\",\"MutableSet\",\n\"Mapping\",\"MutableMapping\",\n\"MappingView\",\"KeysView\",\"ItemsView\",\"ValuesView\",\n\"Sequence\",\"MutableSequence\",\n\"ByteString\",\n]\n\n\n\n\n\n__name__=\"collections.abc\"\n\n\n\n\n\n\n\n\nbytes_iterator=type(iter(b''))\nbytearray_iterator=type(iter(bytearray()))\n\ndict_keyiterator=type(iter({}.keys()))\ndict_valueiterator=type(iter({}.values()))\ndict_itemiterator=type(iter({}.items()))\nlist_iterator=type(iter([]))\nlist_reverseiterator=type(iter(reversed([])))\nrange_iterator=type(iter(range(0)))\nlongrange_iterator=type(iter(range(1 <<1000)))\nset_iterator=type(iter(set()))\nstr_iterator=type(iter(\"\"))\ntuple_iterator=type(iter(()))\nzip_iterator=type(iter(zip()))\n\ndict_keys=type({}.keys())\ndict_values=type({}.values())\ndict_items=type({}.items())\n\nmappingproxy=type(type.__dict__)\ngenerator=type((lambda :(yield ))())\n\nasync def _coro():pass\n_coro=_coro()\ncoroutine=type(_coro)\n_coro.close()\ndel _coro\n\nasync def _ag():yield\n_ag=_ag()\nasync_generator=type(_ag)\ndel _ag\n\n\n\n\ndef _check_methods(C,*methods):\n mro=C.__mro__\n for method in methods:\n for B in mro:\n if method in B.__dict__:\n if B.__dict__[method]is None :\n return NotImplemented\n break\n else :\n return NotImplemented\n return True\n \nclass Hashable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __hash__(self):\n return 0\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Hashable:\n return _check_methods(C,\"__hash__\")\n return NotImplemented\n \n \nclass Awaitable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __await__(self):\n yield\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Awaitable:\n return _check_methods(C,\"__await__\")\n return NotImplemented\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass Coroutine(Awaitable):\n\n __slots__=()\n \n @abstractmethod\n def send(self,value):\n ''\n\n \n raise StopIteration\n \n @abstractmethod\n def throw(self,typ,val=None ,tb=None ):\n ''\n\n \n if val is None :\n if tb is None :\n raise typ\n val=typ()\n if tb is not None :\n val=val.with_traceback(tb)\n raise val\n \n def close(self):\n ''\n \n try :\n self.throw(GeneratorExit)\n except (GeneratorExit,StopIteration):\n pass\n else :\n raise RuntimeError(\"coroutine ignored GeneratorExit\")\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Coroutine:\n return _check_methods(C,'__await__','send','throw','close')\n return NotImplemented\n \n \nCoroutine.register(coroutine)\n\n\nclass AsyncIterable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __aiter__(self):\n return AsyncIterator()\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is AsyncIterable:\n return _check_methods(C,\"__aiter__\")\n return NotImplemented\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass AsyncIterator(AsyncIterable):\n\n __slots__=()\n \n @abstractmethod\n async def __anext__(self):\n ''\n raise StopAsyncIteration\n \n def __aiter__(self):\n return self\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is AsyncIterator:\n return _check_methods(C,\"__anext__\",\"__aiter__\")\n return NotImplemented\n \n \nclass AsyncGenerator(AsyncIterator):\n\n __slots__=()\n \n async def __anext__(self):\n ''\n\n \n return await self.asend(None )\n \n @abstractmethod\n async def asend(self,value):\n ''\n\n \n raise StopAsyncIteration\n \n @abstractmethod\n async def athrow(self,typ,val=None ,tb=None ):\n ''\n\n \n if val is None :\n if tb is None :\n raise typ\n val=typ()\n if tb is not None :\n val=val.with_traceback(tb)\n raise val\n \n async def aclose(self):\n ''\n \n try :\n await self.athrow(GeneratorExit)\n except (GeneratorExit,StopAsyncIteration):\n pass\n else :\n raise RuntimeError(\"asynchronous generator ignored GeneratorExit\")\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is AsyncGenerator:\n return _check_methods(C,'__aiter__','__anext__',\n 'asend','athrow','aclose')\n return NotImplemented\n \n \nAsyncGenerator.register(async_generator)\n\n\nclass Iterable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __iter__(self):\n while False :\n yield None\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Iterable:\n return _check_methods(C,\"__iter__\")\n return NotImplemented\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass Iterator(Iterable):\n\n __slots__=()\n \n @abstractmethod\n def __next__(self):\n ''\n raise StopIteration\n \n def __iter__(self):\n return self\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Iterator:\n return _check_methods(C,'__iter__','__next__')\n return NotImplemented\n \n \nIterator.register(bytes_iterator)\nIterator.register(bytearray_iterator)\n\nIterator.register(dict_keyiterator)\nIterator.register(dict_valueiterator)\nIterator.register(dict_itemiterator)\nIterator.register(list_iterator)\nIterator.register(list_reverseiterator)\nIterator.register(range_iterator)\nIterator.register(longrange_iterator)\nIterator.register(set_iterator)\nIterator.register(str_iterator)\nIterator.register(tuple_iterator)\nIterator.register(zip_iterator)\n\n\nclass Reversible(Iterable):\n\n __slots__=()\n \n @abstractmethod\n def __reversed__(self):\n while False :\n yield None\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Reversible:\n return _check_methods(C,\"__reversed__\",\"__iter__\")\n return NotImplemented\n \n \nclass Generator(Iterator):\n\n __slots__=()\n \n def __next__(self):\n ''\n\n \n return self.send(None )\n \n @abstractmethod\n def send(self,value):\n ''\n\n \n raise StopIteration\n \n @abstractmethod\n def throw(self,typ,val=None ,tb=None ):\n ''\n\n \n if val is None :\n if tb is None :\n raise typ\n val=typ()\n if tb is not None :\n val=val.with_traceback(tb)\n raise val\n \n def close(self):\n ''\n \n try :\n self.throw(GeneratorExit)\n except (GeneratorExit,StopIteration):\n pass\n else :\n raise RuntimeError(\"generator ignored GeneratorExit\")\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Generator:\n return _check_methods(C,'__iter__','__next__',\n 'send','throw','close')\n return NotImplemented\n \n \nGenerator.register(generator)\n\n\nclass Sized(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __len__(self):\n return 0\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Sized:\n return _check_methods(C,\"__len__\")\n return NotImplemented\n \n \nclass Container(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __contains__(self,x):\n return False\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Container:\n return _check_methods(C,\"__contains__\")\n return NotImplemented\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass Collection(Sized,Iterable,Container):\n\n __slots__=()\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Collection:\n return _check_methods(C,\"__len__\",\"__iter__\",\"__contains__\")\n return NotImplemented\n \n \nclass _CallableGenericAlias(GenericAlias):\n ''\n\n\n\n\n\n\n \n \n __slots__=()\n \n def __new__(cls,origin,args):\n return cls.__create_ga(origin,args)\n \n @classmethod\n def __create_ga(cls,origin,args):\n if not isinstance(args,tuple)or len(args)!=2:\n raise TypeError(\n \"Callable must be used as Callable[[arg, ...], result].\")\n t_args,t_result=args\n if isinstance(t_args,(list,tuple)):\n ga_args=tuple(t_args)+(t_result,)\n \n \n \n else :\n ga_args=args\n return super().__new__(cls,origin,ga_args)\n \n @property\n def __parameters__(self):\n params=[]\n for arg in self.__args__:\n \n if hasattr(arg,\"__parameters__\")and isinstance(arg.__parameters__,tuple):\n params.extend(arg.__parameters__)\n else :\n if _is_typevarlike(arg):\n params.append(arg)\n return tuple(dict.fromkeys(params))\n \n def __repr__(self):\n if _has_special_args(self.__args__):\n return super().__repr__()\n return (f'collections.abc.Callable'\n f'[[{\", \".join([_type_repr(a) for a in self.__args__[:-1]])}], '\n f'{_type_repr(self.__args__[-1])}]')\n \n def __reduce__(self):\n args=self.__args__\n if not _has_special_args(args):\n args=list(args[:-1]),args[-1]\n return _CallableGenericAlias,(Callable,args)\n \n def __getitem__(self,item):\n \n \n \n \n \n \n \n param_len=len(self.__parameters__)\n if param_len ==0:\n raise TypeError(f'{self} is not a generic class')\n if (param_len ==1\n and isinstance(item,(tuple,list))\n and len(item)>1)or not isinstance(item,tuple):\n item=(item,)\n item_len=len(item)\n if item_len !=param_len:\n raise TypeError(f'Too {\"many\" if item_len > param_len else \"few\"}'\n f' arguments for {self};'\n f' actual {item_len}, expected {param_len}')\n subst=dict(zip(self.__parameters__,item))\n new_args=[]\n for arg in self.__args__:\n if _is_typevarlike(arg):\n arg=subst[arg]\n \n elif hasattr(arg,'__parameters__')and isinstance(arg.__parameters__,tuple):\n subparams=arg.__parameters__\n if subparams:\n subargs=tuple(subst[x]for x in subparams)\n arg=arg[subargs]\n new_args.append(arg)\n \n \n if not isinstance(new_args[0],(tuple,list)):\n t_result=new_args[-1]\n t_args=new_args[:-1]\n new_args=(t_args,t_result)\n return _CallableGenericAlias(Callable,tuple(new_args))\n \ndef _is_typevarlike(arg):\n obj=type(arg)\n \n return (obj.__module__ =='typing'\n and obj.__name__ in {'ParamSpec','TypeVar'})\n \ndef _has_special_args(args):\n ''\n\n \n if len(args)!=2:\n return False\n obj=args[0]\n if obj is Ellipsis:\n return True\n obj=type(obj)\n names=('ParamSpec','_ConcatenateGenericAlias')\n return obj.__module__ =='typing'and any(obj.__name__ ==name for name in names)\n \n \ndef _type_repr(obj):\n ''\n\n\n\n \n if isinstance(obj,GenericAlias):\n return repr(obj)\n if isinstance(obj,type):\n if obj.__module__ =='builtins':\n return obj.__qualname__\n return f'{obj.__module__}.{obj.__qualname__}'\n if obj is Ellipsis:\n return '...'\n if isinstance(obj,FunctionType):\n return obj.__name__\n return repr(obj)\n \n \nclass Callable(metaclass=ABCMeta):\n\n __slots__=()\n \n @abstractmethod\n def __call__(self,*args,**kwds):\n return False\n \n @classmethod\n def __subclasshook__(cls,C):\n if cls is Callable:\n return _check_methods(C,\"__call__\")\n return NotImplemented\n \n __class_getitem__=classmethod(_CallableGenericAlias)\n \n \n \n \n \nclass Set(Collection):\n ''\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n def __le__(self,other):\n if not isinstance(other,Set):\n return NotImplemented\n if len(self)>len(other):\n return False\n for elem in self:\n if elem not in other:\n return False\n return True\n \n def __lt__(self,other):\n if not isinstance(other,Set):\n return NotImplemented\n return len(self)len(other)and self.__ge__(other)\n \n def __ge__(self,other):\n if not isinstance(other,Set):\n return NotImplemented\n if len(self)>11)^(h >>25)\n h=h *69069+907133923\n h &=MASK\n if h >MAX:\n h -=MASK+1\n if h ==-1:\n h=590923713\n return h\n \n \nSet.register(frozenset)\n\n\nclass MutableSet(Set):\n ''\n\n\n\n\n\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def add(self,value):\n ''\n raise NotImplementedError\n \n @abstractmethod\n def discard(self,value):\n ''\n raise NotImplementedError\n \n def remove(self,value):\n ''\n if value not in self:\n raise KeyError(value)\n self.discard(value)\n \n def pop(self):\n ''\n it=iter(self)\n try :\n value=next(it)\n except StopIteration:\n raise KeyError from None\n self.discard(value)\n return value\n \n def clear(self):\n ''\n try :\n while True :\n self.pop()\n except KeyError:\n pass\n \n def __ior__(self,it):\n for value in it:\n self.add(value)\n return self\n \n def __iand__(self,it):\n for value in (self -it):\n self.discard(value)\n return self\n \n def __ixor__(self,it):\n if it is self:\n self.clear()\n else :\n if not isinstance(it,Set):\n it=self._from_iterable(it)\n for value in it:\n if value in self:\n self.discard(value)\n else :\n self.add(value)\n return self\n \n def __isub__(self,it):\n if it is self:\n self.clear()\n else :\n for value in it:\n self.discard(value)\n return self\n \n \nMutableSet.register(set)\n\n\n\n\nclass Mapping(Collection):\n ''\n\n\n\n\n \n \n __slots__=()\n \n \n __abc_tpflags__=1 <<6\n \n @abstractmethod\n def __getitem__(self,key):\n raise KeyError\n \n def get(self,key,default=None ):\n ''\n try :\n return self[key]\n except KeyError:\n return default\n \n def __contains__(self,key):\n try :\n self[key]\n except KeyError:\n return False\n else :\n return True\n \n def keys(self):\n ''\n return KeysView(self)\n \n def items(self):\n ''\n return ItemsView(self)\n \n def values(self):\n ''\n return ValuesView(self)\n \n def __eq__(self,other):\n if not isinstance(other,Mapping):\n return NotImplemented\n return dict(self.items())==dict(other.items())\n \n __reversed__=None\n \nMapping.register(mappingproxy)\n\n\nclass MappingView(Sized):\n\n __slots__='_mapping',\n \n def __init__(self,mapping):\n self._mapping=mapping\n \n def __len__(self):\n return len(self._mapping)\n \n def __repr__(self):\n return '{0.__class__.__name__}({0._mapping!r})'.format(self)\n \n __class_getitem__=classmethod(GenericAlias)\n \n \nclass KeysView(MappingView,Set):\n\n __slots__=()\n \n @classmethod\n def _from_iterable(self,it):\n return set(it)\n \n def __contains__(self,key):\n return key in self._mapping\n \n def __iter__(self):\n yield from self._mapping\n \n \nKeysView.register(dict_keys)\n\n\nclass ItemsView(MappingView,Set):\n\n __slots__=()\n \n @classmethod\n def _from_iterable(self,it):\n return set(it)\n \n def __contains__(self,item):\n key,value=item\n try :\n v=self._mapping[key]\n except KeyError:\n return False\n else :\n return v is value or v ==value\n \n def __iter__(self):\n for key in self._mapping:\n yield (key,self._mapping[key])\n \n \nItemsView.register(dict_items)\n\n\nclass ValuesView(MappingView,Collection):\n\n __slots__=()\n \n def __contains__(self,value):\n for key in self._mapping:\n v=self._mapping[key]\n if v is value or v ==value:\n return True\n return False\n \n def __iter__(self):\n for key in self._mapping:\n yield self._mapping[key]\n \n \nValuesView.register(dict_values)\n\n\nclass MutableMapping(Mapping):\n ''\n\n\n\n\n\n \n \n __slots__=()\n \n @abstractmethod\n def __setitem__(self,key,value):\n raise KeyError\n \n @abstractmethod\n def __delitem__(self,key):\n raise KeyError\n \n __marker=object()\n \n def pop(self,key,default=__marker):\n ''\n\n \n try :\n value=self[key]\n except KeyError:\n if default is self.__marker:\n raise\n return default\n else :\n del self[key]\n return value\n \n def popitem(self):\n ''\n\n \n try :\n key=next(iter(self))\n except StopIteration:\n raise KeyError from None\n value=self[key]\n del self[key]\n return key,value\n \n def clear(self):\n ''\n try :\n while True :\n self.popitem()\n except KeyError:\n pass\n \n def update(self,other=(),/,**kwds):\n ''\n\n\n\n \n if isinstance(other,Mapping):\n for key in other:\n self[key]=other[key]\n elif hasattr(other,\"keys\"):\n for key in other.keys():\n self[key]=other[key]\n else :\n for key,value in other:\n self[key]=value\n for key,value in kwds.items():\n self[key]=value\n \n def setdefault(self,key,default=None ):\n ''\n try :\n return self[key]\n except KeyError:\n self[key]=default\n return default\n \n \nMutableMapping.register(dict)\n\n\n\n\nclass Sequence(Reversible,Collection):\n ''\n\n\n\n \n \n __slots__=()\n \n \n __abc_tpflags__=1 <<5\n \n @abstractmethod\n def __getitem__(self,index):\n raise IndexError\n \n def __iter__(self):\n i=0\n try :\n while True :\n v=self[i]\n yield v\n i +=1\n except IndexError:\n return\n \n def __contains__(self,value):\n for v in self:\n if v is value or v ==value:\n return True\n return False\n \n def __reversed__(self):\n for i in reversed(range(len(self))):\n yield self[i]\n \n def index(self,value,start=0,stop=None ):\n ''\n\n\n\n\n \n if start is not None and start <0:\n start=max(len(self)+start,0)\n if stop is not None and stop <0:\n stop +=len(self)\n \n i=start\n while stop is None or i 0:\n data=self.read(min(io.DEFAULT_BUFFER_SIZE,offset))\n if not data:\n break\n offset -=len(data)\n \n return self._pos\n \n def tell(self):\n ''\n return self._pos\n", ["io", "sys"]], "_contextvars": [".py", "''\n\n\nclass Context(object):\n\n __contains__=\"\"\n \n copy=\"\"\n \n def get(self,*args):\n pass\n \n items=\"\"\n \n keys=\"\"\n \n run=\"\"\n \n values=\"\"\n \nclass ContextVar:\n\n def __init__(self,name,**kw):\n ''\n self.name=name\n if \"default\"in kw:\n self.default=kw[\"default\"]\n \n def get(self,*args):\n if hasattr(self,\"value\"):\n return self.value\n elif len(args)==1:\n return args[0]\n elif hasattr(self,\"default\"):\n return self.default\n raise LookupError(self.name)\n \n def reset(self,token):\n if token.old_value ==Token.MISSING:\n del self.value\n else :\n self.value=token.old_value\n \n def set(self,value):\n self.value=value\n return Token(self)\n \nclass Token(object):\n\n MISSING=\"\"\n \n def __init__(self,contextvar):\n self.var=contextvar\n try :\n self.old_value=contextvar.get()\n except LookupError:\n self.old_value=Token.MISSING\n \ndef copy_context(*args,**kw):\n pass\n", []], "_csv": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__version__=\"1.0\"\n\nQUOTE_MINIMAL,QUOTE_ALL,QUOTE_NONNUMERIC,QUOTE_NONE,QUOTE_STRINGS,QUOTE_NOTNULL=range(6)\n_dialects={}\n_field_limit=128 *1024\n\nclass Error(Exception):\n pass\n \nclass Dialect(object):\n ''\n\n \n \n __slots__=[\"_delimiter\",\"_doublequote\",\"_escapechar\",\n \"_lineterminator\",\"_quotechar\",\"_quoting\",\n \"_skipinitialspace\",\"_strict\"]\n \n def __new__(cls,dialect,**kwargs):\n \n for name in kwargs:\n if '_'+name not in Dialect.__slots__:\n raise TypeError(\"unexpected keyword argument '%s'\"%\n (name,))\n \n if dialect is not None:\n if isinstance(dialect,str):\n dialect=get_dialect(dialect)\n \n \n if(isinstance(dialect,Dialect)\n and all(value is None for value in kwargs.values())):\n return dialect\n \n self=object.__new__(cls)\n \n \n def set_char(x):\n if x is None:\n return None\n if isinstance(x,str)and len(x)<=1:\n return x\n raise TypeError(\"%r must be a 1-character string\"%(name,))\n def set_str(x):\n if isinstance(x,str):\n return x\n raise TypeError(\"%r must be a string\"%(name,))\n def set_quoting(x):\n if x in range(4):\n return x\n raise TypeError(\"bad 'quoting' value\")\n \n attributes={\"delimiter\":(',',set_char),\n \"doublequote\":(True,bool),\n \"escapechar\":(None,set_char),\n \"lineterminator\":(\"\\r\\n\",set_str),\n \"quotechar\":('\"',set_char),\n \"quoting\":(QUOTE_MINIMAL,set_quoting),\n \"skipinitialspace\":(False,bool),\n \"strict\":(False,bool),\n }\n \n \n notset=object()\n for name in Dialect.__slots__:\n name=name[1:]\n value=notset\n if name in kwargs:\n value=kwargs[name]\n elif dialect is not None:\n value=getattr(dialect,name,notset)\n \n \n if value is notset:\n value=attributes[name][0]\n if name =='quoting'and not self.quotechar:\n value=QUOTE_NONE\n else:\n converter=attributes[name][1]\n if converter:\n value=converter(value)\n \n setattr(self,'_'+name,value)\n \n if not self.delimiter:\n raise TypeError(\"delimiter must be set\")\n \n if self.quoting !=QUOTE_NONE and not self.quotechar:\n raise TypeError(\"quotechar must be set if quoting enabled\")\n \n if not self.lineterminator:\n raise TypeError(\"lineterminator must be set\")\n \n return self\n \n delimiter=property(lambda self:self._delimiter)\n doublequote=property(lambda self:self._doublequote)\n escapechar=property(lambda self:self._escapechar)\n lineterminator=property(lambda self:self._lineterminator)\n quotechar=property(lambda self:self._quotechar)\n quoting=property(lambda self:self._quoting)\n skipinitialspace=property(lambda self:self._skipinitialspace)\n strict=property(lambda self:self._strict)\n \n \ndef _call_dialect(dialect_inst,kwargs):\n return Dialect(dialect_inst,**kwargs)\n \ndef register_dialect(name,dialect=None,**kwargs):\n ''\n \n if not isinstance(name,str):\n raise TypeError(\"dialect name must be a string or unicode\")\n \n dialect=_call_dialect(dialect,kwargs)\n _dialects[name]=dialect\n \ndef unregister_dialect(name):\n ''\n \n try:\n del _dialects[name]\n except KeyError:\n raise Error(\"unknown dialect\")\n \ndef get_dialect(name):\n ''\n \n try:\n return _dialects[name]\n except KeyError:\n raise Error(\"unknown dialect\")\n \ndef list_dialects():\n ''\n \n return list(_dialects)\n \nclass Reader(object):\n ''\n\n\n \n \n \n (START_RECORD,START_FIELD,ESCAPED_CHAR,IN_FIELD,\n IN_QUOTED_FIELD,ESCAPE_IN_QUOTED_FIELD,QUOTE_IN_QUOTED_FIELD,\n EAT_CRNL)=range(8)\n \n def __init__(self,iterator,dialect=None,**kwargs):\n self.dialect=_call_dialect(dialect,kwargs)\n \n \n \n self._delimiter=self.dialect.delimiter if self.dialect.delimiter else '\\0'\n self._quotechar=self.dialect.quotechar if self.dialect.quotechar else '\\0'\n self._escapechar=self.dialect.escapechar if self.dialect.escapechar else '\\0'\n self._doublequote=self.dialect.doublequote\n self._quoting=self.dialect.quoting\n self._skipinitialspace=self.dialect.skipinitialspace\n self._strict=self.dialect.strict\n \n self.input_iter=iter(iterator)\n self.line_num=0\n \n self._parse_reset()\n \n def _parse_reset(self):\n self.field=''\n self.fields=[]\n self.state=self.START_RECORD\n self.numeric_field=False\n \n def __iter__(self):\n return self\n \n def __next__(self):\n self._parse_reset()\n while True:\n try:\n line=next(self.input_iter)\n except StopIteration:\n \n if len(self.field)>0:\n raise Error(\"newline inside string\")\n raise\n \n self.line_num +=1\n \n if '\\0'in line:\n raise Error(\"line contains NULL byte\")\n self._parse_process_char(line)\n self._parse_eol()\n \n if self.state ==self.START_RECORD:\n break\n \n fields=self.fields\n self.fields=[]\n return fields\n \n def _parse_process_char(self,line):\n pos=0\n while pos pos:\n self._parse_add_str(line[pos:pos2])\n pos=pos2\n self._parse_save_field()\n self.state=self.EAT_CRNL\n break\n elif line[pos2]==self._escapechar[0]:\n \n if pos2 >pos:\n self._parse_add_str(line[pos:pos2])\n pos=pos2\n self.state=self.ESCAPED_CHAR\n break\n elif line[pos2]==self._delimiter[0]:\n \n if pos2 >pos:\n self._parse_add_str(line[pos:pos2])\n pos=pos2\n self._parse_save_field()\n self.state=self.START_FIELD\n break\n \n pos2 +=1\n else:\n if pos2 >pos:\n self._parse_add_str(line[pos:pos2])\n pos=pos2\n continue\n \n elif self.state ==self.START_RECORD:\n if line[pos]=='\\n'or line[pos]=='\\r':\n self.state=self.EAT_CRNL\n else:\n self.state=self.START_FIELD\n \n continue\n \n elif self.state ==self.START_FIELD:\n if line[pos]=='\\n'or line[pos]=='\\r':\n \n self._parse_save_field()\n self.state=self.EAT_CRNL\n elif(line[pos]==self._quotechar[0]\n and self._quoting !=QUOTE_NONE):\n \n self.state=self.IN_QUOTED_FIELD\n elif line[pos]==self._escapechar[0]:\n \n self.state=self.ESCAPED_CHAR\n elif self._skipinitialspace and line[pos]==' ':\n \n pass\n elif line[pos]==self._delimiter[0]:\n \n self._parse_save_field()\n else:\n \n if self._quoting ==QUOTE_NONNUMERIC:\n self.numeric_field=True\n self.state=self.IN_FIELD\n continue\n \n elif self.state ==self.ESCAPED_CHAR:\n self._parse_add_char(line[pos])\n self.state=self.IN_FIELD\n \n elif self.state ==self.IN_QUOTED_FIELD:\n if line[pos]==self._escapechar:\n \n self.state=self.ESCAPE_IN_QUOTED_FIELD\n elif(line[pos]==self._quotechar\n and self._quoting !=QUOTE_NONE):\n if self._doublequote:\n \n self.state=self.QUOTE_IN_QUOTED_FIELD\n else:\n \n self.state=self.IN_FIELD\n else:\n \n self._parse_add_char(line[pos])\n \n elif self.state ==self.ESCAPE_IN_QUOTED_FIELD:\n self._parse_add_char(line[pos])\n self.state=self.IN_QUOTED_FIELD\n \n elif self.state ==self.QUOTE_IN_QUOTED_FIELD:\n \n if(line[pos]==self._quotechar\n and self._quoting !=QUOTE_NONE):\n \n self._parse_add_char(line[pos])\n self.state=self.IN_QUOTED_FIELD\n elif line[pos]==self._delimiter[0]:\n \n self._parse_save_field()\n self.state=self.START_FIELD\n elif line[pos]=='\\r'or line[pos]=='\\n':\n \n self._parse_save_field()\n self.state=self.EAT_CRNL\n elif not self._strict:\n self._parse_add_char(line[pos])\n self.state=self.IN_FIELD\n else:\n raise Error(\"'%c' expected after '%c'\"%\n (self._delimiter,self._quotechar))\n \n elif self.state ==self.EAT_CRNL:\n if line[pos]=='\\r'or line[pos]=='\\n':\n pass\n else:\n raise Error(\"new-line character seen in unquoted field - \"\n \"do you need to open the file \"\n \"in universal-newline mode?\")\n \n else:\n raise RuntimeError(\"unknown state: %r\"%(self.state,))\n \n pos +=1\n \n def _parse_eol(self):\n if self.state ==self.EAT_CRNL:\n self.state=self.START_RECORD\n elif self.state ==self.START_RECORD:\n \n pass\n elif self.state ==self.IN_FIELD:\n \n \n self._parse_save_field()\n self.state=self.START_RECORD\n elif self.state ==self.START_FIELD:\n \n self._parse_save_field()\n self.state=self.START_RECORD\n elif self.state ==self.ESCAPED_CHAR:\n self._parse_add_char('\\n')\n self.state=self.IN_FIELD\n elif self.state ==self.IN_QUOTED_FIELD:\n pass\n elif self.state ==self.ESCAPE_IN_QUOTED_FIELD:\n self._parse_add_char('\\n')\n self.state=self.IN_QUOTED_FIELD\n elif self.state ==self.QUOTE_IN_QUOTED_FIELD:\n \n self._parse_save_field()\n self.state=self.START_RECORD\n else:\n raise RuntimeError(\"unknown state: %r\"%(self.state,))\n \n def _parse_save_field(self):\n field,self.field=self.field,''\n if self.numeric_field:\n self.numeric_field=False\n field=float(field)\n self.fields.append(field)\n \n def _parse_add_char(self,c):\n if len(self.field)+1 >_field_limit:\n raise Error(\"field larget than field limit (%d)\"%(_field_limit))\n self.field +=c\n \n def _parse_add_str(self,s):\n if len(self.field)+len(s)>_field_limit:\n raise Error(\"field larget than field limit (%d)\"%(_field_limit))\n self.field +=s\n \n \nclass Writer(object):\n ''\n\n\n \n \n def __init__(self,file,dialect=None,**kwargs):\n if not(hasattr(file,'write')and callable(file.write)):\n raise TypeError(\"argument 1 must have a 'write' method\")\n self.writeline=file.write\n self.dialect=_call_dialect(dialect,kwargs)\n \n def _join_reset(self):\n self.rec=[]\n self.num_fields=0\n \n def _join_append(self,field,quoted,quote_empty):\n dialect=self.dialect\n \n if self.num_fields >0:\n self.rec.append(dialect.delimiter)\n \n if dialect.quoting ==QUOTE_NONE:\n need_escape=tuple(dialect.lineterminator)+(\n dialect.escapechar,\n dialect.delimiter,dialect.quotechar)\n \n else:\n for c in tuple(dialect.lineterminator)+(\n dialect.delimiter,dialect.escapechar):\n if c and c in field:\n quoted=True\n \n need_escape=()\n if dialect.quotechar in field:\n if dialect.doublequote:\n field=field.replace(dialect.quotechar,\n dialect.quotechar *2)\n quoted=True\n else:\n need_escape=(dialect.quotechar,)\n \n \n for c in need_escape:\n if c and c in field:\n if not dialect.escapechar:\n raise Error(\"need to escape, but no escapechar set\")\n field=field.replace(c,dialect.escapechar+c)\n \n \n if field ==''and quote_empty:\n if dialect.quoting ==QUOTE_NONE:\n raise Error(\"single empty field record must be quoted\")\n quoted=1\n \n if quoted:\n field=dialect.quotechar+field+dialect.quotechar\n \n self.rec.append(field)\n self.num_fields +=1\n \n \n \n def writerow(self,row):\n dialect=self.dialect\n try:\n rowlen=len(row)\n except TypeError:\n raise Error(\"sequence expected\")\n \n \n self._join_reset()\n \n for field in row:\n quoted=False\n if dialect.quoting ==QUOTE_NONNUMERIC:\n try:\n float(field)\n except:\n quoted=True\n \n \n elif dialect.quoting ==QUOTE_ALL:\n quoted=True\n \n if field is None:\n self._join_append(\"\",quoted,rowlen ==1)\n else:\n self._join_append(str(field),quoted,rowlen ==1)\n \n \n self.rec.append(dialect.lineterminator)\n \n self.writeline(''.join(self.rec))\n \n def writerows(self,rows):\n for row in rows:\n self.writerow(row)\n \ndef reader(*args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n return Reader(*args,**kwargs)\n \ndef writer(*args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n return Writer(*args,**kwargs)\n \n \nundefined=object()\ndef field_size_limit(limit=undefined):\n ''\n\n\n\n \n \n global _field_limit\n old_limit=_field_limit\n \n if limit is not undefined:\n if not isinstance(limit,(int,long)):\n raise TypeError(\"int expected, got %s\"%\n (limit.__class__.__name__,))\n _field_limit=limit\n \n return old_limit\n", []], "_dummy_thread": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['error','start_new_thread','exit','get_ident','allocate_lock',\n'interrupt_main','LockType','RLock']\n\n\nTIMEOUT_MAX=2 **31\n\n\n\n\n\n\nerror=RuntimeError\n\ndef start_new_thread(function,args,kwargs={}):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if type(args)!=type(tuple()):\n raise TypeError(\"2nd arg must be a tuple\")\n if type(kwargs)!=type(dict()):\n raise TypeError(\"3rd arg must be a dict\")\n global _main\n _main=False\n try :\n function(*args,**kwargs)\n except SystemExit:\n pass\n except :\n import traceback\n traceback.print_exc()\n _main=True\n global _interrupt\n if _interrupt:\n _interrupt=False\n raise KeyboardInterrupt\n \ndef exit():\n ''\n raise SystemExit\n \ndef get_ident():\n ''\n\n\n\n\n \n return 1\n \ndef allocate_lock():\n ''\n return LockType()\n \ndef stack_size(size=None ):\n ''\n if size is not None :\n raise error(\"setting thread stack size not supported\")\n return 0\n \ndef _set_sentinel():\n ''\n return LockType()\n \nclass LockType(object):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self):\n self.locked_status=False\n \n def acquire(self,waitflag=None ,timeout=-1):\n ''\n\n\n\n\n\n\n\n\n \n if waitflag is None or waitflag:\n self.locked_status=True\n return True\n else :\n if not self.locked_status:\n self.locked_status=True\n return True\n else :\n if timeout >0:\n import time\n time.sleep(timeout)\n return False\n \n __enter__=acquire\n \n def __exit__(self,typ,val,tb):\n self.release()\n \n def release(self):\n ''\n \n \n if not self.locked_status:\n raise error\n self.locked_status=False\n return True\n \n def locked(self):\n return self.locked_status\n \n def __repr__(self):\n return \"<%s %s.%s object at %s>\"%(\n \"locked\"if self.locked_status else \"unlocked\",\n self.__class__.__module__,\n self.__class__.__qualname__,\n hex(id(self))\n )\n \n \nclass RLock(LockType):\n ''\n\n\n\n\n\n \n def __init__(self):\n super().__init__()\n self._levels=0\n \n def acquire(self,waitflag=None ,timeout=-1):\n ''\n \n locked=super().acquire(waitflag,timeout)\n if locked:\n self._levels +=1\n return locked\n \n def release(self):\n ''\n \n if self._levels ==0:\n raise error\n if self._levels ==1:\n super().release()\n self._levels -=1\n \n \n_interrupt=False\n\n_main=True\n\ndef interrupt_main():\n ''\n \n if _main:\n raise KeyboardInterrupt\n else :\n global _interrupt\n _interrupt=True\n", ["time", "traceback"]], "_frozen_importlib": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n_bootstrap_external=None\n_thread=None\nimport _weakref\n\nimport _imp\nimport sys\n\ndef _wrap(new,old):\n ''\n for replace in ['__module__','__name__','__qualname__','__doc__']:\n if hasattr(old,replace):\n setattr(new,replace,getattr(old,replace))\n new.__dict__.update(old.__dict__)\n \n \ndef _new_module(name):\n return type(sys)(name)\n \n \n \n \n \n \n_module_locks={}\n\n_blocking_on={}\n\n\nclass _DeadlockError(RuntimeError):\n pass\n \n \nclass _ModuleLock:\n ''\n\n\n \n \n def __init__(self,name):\n self.lock=_thread.allocate_lock()\n self.wakeup=_thread.allocate_lock()\n self.name=name\n self.owner=None\n self.count=0\n self.waiters=0\n \n def has_deadlock(self):\n \n me=_thread.get_ident()\n tid=self.owner\n while True :\n lock=_blocking_on.get(tid)\n if lock is None :\n return False\n tid=lock.owner\n if tid ==me:\n return True\n \n def acquire(self):\n ''\n\n\n\n \n tid=_thread.get_ident()\n _blocking_on[tid]=self\n try :\n while True :\n with self.lock:\n if self.count ==0 or self.owner ==tid:\n self.owner=tid\n self.count +=1\n return True\n if self.has_deadlock():\n raise _DeadlockError('deadlock detected by %r'%self)\n if self.wakeup.acquire(False ):\n self.waiters +=1\n \n self.wakeup.acquire()\n self.wakeup.release()\n finally :\n del _blocking_on[tid]\n \n def release(self):\n tid=_thread.get_ident()\n with self.lock:\n if self.owner !=tid:\n raise RuntimeError('cannot release un-acquired lock')\n assert self.count >0\n self.count -=1\n if self.count ==0:\n self.owner=None\n if self.waiters:\n self.waiters -=1\n self.wakeup.release()\n \n def __repr__(self):\n return '_ModuleLock({!r}) at {}'.format(self.name,id(self))\n \n \nclass _DummyModuleLock:\n ''\n \n \n def __init__(self,name):\n self.name=name\n self.count=0\n \n def acquire(self):\n self.count +=1\n return True\n \n def release(self):\n if self.count ==0:\n raise RuntimeError('cannot release un-acquired lock')\n self.count -=1\n \n def __repr__(self):\n return '_DummyModuleLock({!r}) at {}'.format(self.name,id(self))\n \n \nclass _ModuleLockManager:\n\n def __init__(self,name):\n self._name=name\n self._lock=None\n \n def __enter__(self):\n self._lock=_get_module_lock(self._name)\n self._lock.acquire()\n \n def __exit__(self,*args,**kwargs):\n self._lock.release()\n \n \n \n \ndef _get_module_lock(name):\n ''\n\n\n \n \n _imp.acquire_lock()\n try :\n try :\n lock=_module_locks[name]()\n except KeyError:\n lock=None\n \n if lock is None :\n if _thread is None :\n lock=_DummyModuleLock(name)\n else :\n lock=_ModuleLock(name)\n \n def cb(ref,name=name):\n _imp.acquire_lock()\n try :\n \n \n \n if _module_locks.get(name)is ref:\n del _module_locks[name]\n finally :\n _imp.release_lock()\n \n _module_locks[name]=_weakref.ref(lock,cb)\n finally :\n _imp.release_lock()\n \n return lock\n \n \ndef _lock_unlock_module(name):\n ''\n\n\n\n \n lock=_get_module_lock(name)\n try :\n lock.acquire()\n except _DeadlockError:\n \n \n pass\n else :\n lock.release()\n \n \ndef _call_with_frames_removed(f,*args,**kwds):\n ''\n\n\n\n\n\n \n return f(*args,**kwds)\n \n \ndef _verbose_message(message,*args,verbosity=1):\n ''\n if sys.flags.verbose >=verbosity:\n if not message.startswith(('#','import ')):\n message='# '+message\n print(message.format(*args),file=sys.stderr)\n \n \ndef _requires_builtin(fxn):\n ''\n def _requires_builtin_wrapper(self,fullname):\n if fullname not in sys.builtin_module_names:\n raise ImportError('{!r} is not a built-in module'.format(fullname),\n name=fullname)\n return fxn(self,fullname)\n _wrap(_requires_builtin_wrapper,fxn)\n return _requires_builtin_wrapper\n \n \ndef _requires_frozen(fxn):\n ''\n def _requires_frozen_wrapper(self,fullname):\n if not _imp.is_frozen(fullname):\n raise ImportError('{!r} is not a frozen module'.format(fullname),\n name=fullname)\n return fxn(self,fullname)\n _wrap(_requires_frozen_wrapper,fxn)\n return _requires_frozen_wrapper\n \n \n \ndef _load_module_shim(self,fullname):\n ''\n\n\n\n \n spec=spec_from_loader(fullname,self)\n if fullname in sys.modules:\n module=sys.modules[fullname]\n _exec(spec,module)\n return sys.modules[fullname]\n else :\n return _load(spec)\n \n \n \ndef _module_repr(module):\n\n loader=getattr(module,'__loader__',None )\n if hasattr(loader,'module_repr'):\n \n \n \n try :\n return loader.module_repr(module)\n except Exception:\n pass\n try :\n spec=module.__spec__\n except AttributeError:\n pass\n else :\n if spec is not None :\n return _module_repr_from_spec(spec)\n \n \n \n try :\n name=module.__name__\n except AttributeError:\n name='?'\n try :\n filename=module.__file__\n except AttributeError:\n if loader is None :\n return ''.format(name)\n else :\n return ''.format(name,loader)\n else :\n return ''.format(name,filename)\n \n \nclass _installed_safely:\n\n def __init__(self,module):\n self._module=module\n self._spec=module.__spec__\n \n def __enter__(self):\n \n \n \n self._spec._initializing=True\n sys.modules[self._spec.name]=self._module\n \n def __exit__(self,*args):\n try :\n spec=self._spec\n if any(arg is not None for arg in args):\n try :\n del sys.modules[spec.name]\n except KeyError:\n pass\n else :\n _verbose_message('import {!r} # {!r}',spec.name,spec.loader)\n finally :\n self._spec._initializing=False\n \n \nclass ModuleSpec:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,name,loader,*,origin=None ,loader_state=None ,\n is_package=None ):\n self.name=name\n self.loader=loader\n self.origin=origin\n self.loader_state=loader_state\n self.submodule_search_locations=[]if is_package else None\n \n \n self._set_fileattr=False\n self._cached=None\n \n def __repr__(self):\n args=['name={!r}'.format(self.name),\n 'loader={!r}'.format(self.loader)]\n if self.origin is not None :\n args.append('origin={!r}'.format(self.origin))\n if self.submodule_search_locations is not None :\n args.append('submodule_search_locations={}'\n .format(self.submodule_search_locations))\n return '{}({})'.format(self.__class__.__name__,', '.join(args))\n \n def __eq__(self,other):\n smsl=self.submodule_search_locations\n try :\n return (self.name ==other.name and\n self.loader ==other.loader and\n self.origin ==other.origin and\n smsl ==other.submodule_search_locations and\n self.cached ==other.cached and\n self.has_location ==other.has_location)\n except AttributeError:\n return False\n \n @property\n def cached(self):\n if self._cached is None :\n if self.origin is not None and self._set_fileattr:\n if _bootstrap_external is None :\n raise NotImplementedError\n self._cached=_bootstrap_external._get_cached(self.origin)\n return self._cached\n \n @cached.setter\n def cached(self,cached):\n self._cached=cached\n \n @property\n def parent(self):\n ''\n if self.submodule_search_locations is None :\n return self.name.rpartition('.')[0]\n else :\n return self.name\n \n @property\n def has_location(self):\n return self._set_fileattr\n \n @has_location.setter\n def has_location(self,value):\n self._set_fileattr=bool(value)\n \n \ndef spec_from_loader(name,loader,*,origin=None ,is_package=None ):\n ''\n if hasattr(loader,'get_filename'):\n if _bootstrap_external is None :\n raise NotImplementedError\n spec_from_file_location=_bootstrap_external.spec_from_file_location\n \n if is_package is None :\n return spec_from_file_location(name,loader=loader)\n search=[]if is_package else None\n return spec_from_file_location(name,loader=loader,\n submodule_search_locations=search)\n \n if is_package is None :\n if hasattr(loader,'is_package'):\n try :\n is_package=loader.is_package(name)\n except ImportError:\n is_package=None\n else :\n \n is_package=False\n \n return ModuleSpec(name,loader,origin=origin,is_package=is_package)\n \n \ndef _spec_from_module(module,loader=None ,origin=None ):\n\n try :\n spec=module.__spec__\n except AttributeError:\n pass\n else :\n if spec is not None :\n return spec\n \n name=module.__name__\n if loader is None :\n try :\n loader=module.__loader__\n except AttributeError:\n \n pass\n try :\n location=module.__file__\n except AttributeError:\n location=None\n if origin is None :\n if location is None :\n try :\n origin=loader._ORIGIN\n except AttributeError:\n origin=None\n else :\n origin=location\n try :\n cached=module.__cached__\n except AttributeError:\n cached=None\n try :\n submodule_search_locations=list(module.__path__)\n except AttributeError:\n submodule_search_locations=None\n \n spec=ModuleSpec(name,loader,origin=origin)\n spec._set_fileattr=False if location is None else True\n spec.cached=cached\n spec.submodule_search_locations=submodule_search_locations\n return spec\n \n \ndef _init_module_attrs(spec,module,*,override=False ):\n\n\n\n if (override or getattr(module,'__name__',None )is None ):\n try :\n module.__name__=spec.name\n except AttributeError:\n pass\n \n if override or getattr(module,'__loader__',None )is None :\n loader=spec.loader\n if loader is None :\n \n if spec.submodule_search_locations is not None :\n if _bootstrap_external is None :\n raise NotImplementedError\n _NamespaceLoader=_bootstrap_external._NamespaceLoader\n \n loader=_NamespaceLoader.__new__(_NamespaceLoader)\n loader._path=spec.submodule_search_locations\n spec.loader=loader\n \n \n \n \n \n \n \n \n \n \n module.__file__=None\n try :\n module.__loader__=loader\n except AttributeError:\n pass\n \n if override or getattr(module,'__package__',None )is None :\n try :\n module.__package__=spec.parent\n except AttributeError:\n pass\n \n try :\n module.__spec__=spec\n except AttributeError:\n pass\n \n if override or getattr(module,'__path__',None )is None :\n if spec.submodule_search_locations is not None :\n try :\n module.__path__=spec.submodule_search_locations\n except AttributeError:\n pass\n \n if spec.has_location:\n if override or getattr(module,'__file__',None )is None :\n try :\n module.__file__=spec.origin\n except AttributeError:\n pass\n \n if override or getattr(module,'__cached__',None )is None :\n if spec.cached is not None :\n try :\n module.__cached__=spec.cached\n except AttributeError:\n pass\n return module\n \n \ndef module_from_spec(spec):\n ''\n \n module=None\n if hasattr(spec.loader,'create_module'):\n \n \n module=spec.loader.create_module(spec)\n elif hasattr(spec.loader,'exec_module'):\n raise ImportError('loaders that define exec_module() '\n 'must also define create_module()')\n if module is None :\n module=_new_module(spec.name)\n _init_module_attrs(spec,module)\n return module\n \n \ndef _module_repr_from_spec(spec):\n ''\n \n name='?'if spec.name is None else spec.name\n if spec.origin is None :\n if spec.loader is None :\n return ''.format(name)\n else :\n return ''.format(name,spec.loader)\n else :\n if spec.has_location:\n return ''.format(name,spec.origin)\n else :\n return ''.format(spec.name,spec.origin)\n \n \n \ndef _exec(spec,module):\n ''\n name=spec.name\n with _ModuleLockManager(name):\n if sys.modules.get(name)is not module:\n msg='module {!r} not in sys.modules'.format(name)\n raise ImportError(msg,name=name)\n if spec.loader is None :\n if spec.submodule_search_locations is None :\n raise ImportError('missing loader',name=spec.name)\n \n _init_module_attrs(spec,module,override=True )\n return module\n _init_module_attrs(spec,module,override=True )\n if not hasattr(spec.loader,'exec_module'):\n \n \n \n spec.loader.load_module(name)\n else :\n spec.loader.exec_module(module)\n return sys.modules[name]\n \n \ndef _load_backward_compatible(spec):\n\n\n\n spec.loader.load_module(spec.name)\n \n module=sys.modules[spec.name]\n if getattr(module,'__loader__',None )is None :\n try :\n module.__loader__=spec.loader\n except AttributeError:\n pass\n if getattr(module,'__package__',None )is None :\n try :\n \n \n \n module.__package__=module.__name__\n if not hasattr(module,'__path__'):\n module.__package__=spec.name.rpartition('.')[0]\n except AttributeError:\n pass\n if getattr(module,'__spec__',None )is None :\n try :\n module.__spec__=spec\n except AttributeError:\n pass\n return module\n \ndef _load_unlocked(spec):\n\n if spec.loader is not None :\n \n if not hasattr(spec.loader,'exec_module'):\n return _load_backward_compatible(spec)\n \n module=module_from_spec(spec)\n with _installed_safely(module):\n if spec.loader is None :\n if spec.submodule_search_locations is None :\n raise ImportError('missing loader',name=spec.name)\n \n else :\n spec.loader.exec_module(module)\n \n \n \n \n return sys.modules[spec.name]\n \n \n \ndef _load(spec):\n ''\n\n\n\n\n\n\n \n with _ModuleLockManager(spec.name):\n return _load_unlocked(spec)\n \n \n \n \nclass BuiltinImporter:\n\n ''\n\n\n\n\n \n \n @staticmethod\n def module_repr(module):\n ''\n\n\n\n \n return ''.format(module.__name__)\n \n @classmethod\n def find_spec(cls,fullname,path=None ,target=None ):\n if path is not None :\n return None\n if _imp.is_builtin(fullname):\n return spec_from_loader(fullname,cls,origin='built-in')\n else :\n return None\n \n @classmethod\n def find_module(cls,fullname,path=None ):\n ''\n\n\n\n\n\n \n spec=cls.find_spec(fullname,path)\n return spec.loader if spec is not None else None\n \n @classmethod\n def create_module(self,spec):\n ''\n if spec.name not in sys.builtin_module_names:\n raise ImportError('{!r} is not a built-in module'.format(spec.name),\n name=spec.name)\n return _call_with_frames_removed(_imp.create_builtin,spec)\n \n @classmethod\n def exec_module(self,module):\n ''\n _call_with_frames_removed(_imp.exec_builtin,module)\n \n @classmethod\n @_requires_builtin\n def get_code(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_builtin\n def get_source(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_builtin\n def is_package(cls,fullname):\n ''\n return False\n \n load_module=classmethod(_load_module_shim)\n \n \nclass FrozenImporter:\n\n ''\n\n\n\n\n \n \n @staticmethod\n def module_repr(m):\n ''\n\n\n\n \n return ''.format(m.__name__)\n \n @classmethod\n def find_spec(cls,fullname,path=None ,target=None ):\n if _imp.is_frozen(fullname):\n return spec_from_loader(fullname,cls,origin='frozen')\n else :\n return None\n \n @classmethod\n def find_module(cls,fullname,path=None ):\n ''\n\n\n\n \n return cls if _imp.is_frozen(fullname)else None\n \n @classmethod\n def create_module(cls,spec):\n ''\n \n @staticmethod\n def exec_module(module):\n name=module.__spec__.name\n if not _imp.is_frozen(name):\n raise ImportError('{!r} is not a frozen module'.format(name),\n name=name)\n code=_call_with_frames_removed(_imp.get_frozen_object,name)\n exec(code,module.__dict__)\n \n @classmethod\n def load_module(cls,fullname):\n ''\n\n\n\n \n return _load_module_shim(cls,fullname)\n \n @classmethod\n @_requires_frozen\n def get_code(cls,fullname):\n ''\n return _imp.get_frozen_object(fullname)\n \n @classmethod\n @_requires_frozen\n def get_source(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_frozen\n def is_package(cls,fullname):\n ''\n return _imp.is_frozen_package(fullname)\n \n \n \n \nclass _ImportLockContext:\n\n ''\n \n def __enter__(self):\n ''\n _imp.acquire_lock()\n \n def __exit__(self,exc_type,exc_value,exc_traceback):\n ''\n _imp.release_lock()\n \n \ndef _resolve_name(name,package,level):\n ''\n bits=package.rsplit('.',level -1)\n if len(bits)= 0')\n if level >0:\n if not isinstance(package,str):\n raise TypeError('__package__ not set to a string')\n elif not package:\n raise ImportError('attempted relative import with no known parent '\n 'package')\n if not name and level ==0:\n raise ValueError('Empty module name')\n \n \n_ERR_MSG_PREFIX='No module named '\n_ERR_MSG=_ERR_MSG_PREFIX+'{!r}'\n\ndef _find_and_load_unlocked(name,import_):\n path=None\n parent=name.rpartition('.')[0]\n if parent:\n if parent not in sys.modules:\n _call_with_frames_removed(import_,parent)\n \n if name in sys.modules:\n return sys.modules[name]\n parent_module=sys.modules[parent]\n try :\n path=parent_module.__path__\n except AttributeError:\n msg=(_ERR_MSG+'; {!r} is not a package').format(name,parent)\n raise ModuleNotFoundError(msg,name=name)from None\n spec=_find_spec(name,path)\n if spec is None :\n raise ModuleNotFoundError(_ERR_MSG.format(name),name=name)\n else :\n module=_load_unlocked(spec)\n if parent:\n \n parent_module=sys.modules[parent]\n setattr(parent_module,name.rpartition('.')[2],module)\n return module\n \n \n_NEEDS_LOADING=object()\n\n\ndef _find_and_load(name,import_):\n ''\n with _ModuleLockManager(name):\n module=sys.modules.get(name,_NEEDS_LOADING)\n if module is _NEEDS_LOADING:\n return _find_and_load_unlocked(name,import_)\n \n if module is None :\n message=('import of {} halted; '\n 'None in sys.modules'.format(name))\n raise ModuleNotFoundError(message,name=name)\n \n _lock_unlock_module(name)\n return module\n \n \ndef _gcd_import(name,package=None ,level=0):\n ''\n\n\n\n\n\n\n \n _sanity_check(name,package,level)\n if level >0:\n name=_resolve_name(name,package,level)\n return _find_and_load(name,_gcd_import)\n \n \ndef _handle_fromlist(module,fromlist,import_,*,recursive=False ):\n ''\n\n\n\n\n\n \n \n \n if hasattr(module,'__path__'):\n for x in fromlist:\n if not isinstance(x,str):\n if recursive:\n where=module.__name__+'.__all__'\n else :\n where=\"``from list''\"\n raise TypeError(f\"Item in {where} must be str, \"\n f\"not {type(x).__name__}\")\n elif x =='*':\n if not recursive and hasattr(module,'__all__'):\n _handle_fromlist(module,module.__all__,import_,\n recursive=True )\n elif not hasattr(module,x):\n from_name='{}.{}'.format(module.__name__,x)\n try :\n _call_with_frames_removed(import_,from_name)\n except ModuleNotFoundError as exc:\n \n \n \n if (exc.name ==from_name and\n sys.modules.get(from_name,_NEEDS_LOADING)is not None ):\n continue\n raise\n return module\n \n \ndef _calc___package__(globals):\n ''\n\n\n\n\n \n package=globals.get('__package__')\n spec=globals.get('__spec__')\n if package is not None :\n if spec is not None and package !=spec.parent:\n _warnings.warn(\"__package__ != __spec__.parent \"\n f\"({package!r} != {spec.parent!r})\",\n ImportWarning,stacklevel=3)\n return package\n elif spec is not None :\n return spec.parent\n else :\n _warnings.warn(\"can't resolve package from __spec__ or __package__, \"\n \"falling back on __name__ and __path__\",\n ImportWarning,stacklevel=3)\n package=globals['__name__']\n if '__path__'not in globals:\n package=package.rpartition('.')[0]\n return package\n \n \ndef __import__(name,globals=None ,locals=None ,fromlist=(),level=0):\n ''\n\n\n\n\n\n\n\n\n \n if level ==0:\n module=_gcd_import(name)\n else :\n globals_=globals if globals is not None else {}\n package=_calc___package__(globals_)\n module=_gcd_import(name,package,level)\n if not fromlist:\n \n \n if level ==0:\n return _gcd_import(name.partition('.')[0])\n elif not name:\n return module\n else :\n \n \n cut_off=len(name)-len(name.partition('.')[0])\n \n \n return sys.modules[module.__name__[:len(module.__name__)-cut_off]]\n else :\n return _handle_fromlist(module,fromlist,_gcd_import)\n \n \ndef _builtin_from_name(name):\n spec=BuiltinImporter.find_spec(name)\n if spec is None :\n raise ImportError('no built-in module named '+name)\n return _load_unlocked(spec)\n \n \nmodule_type=type(sys)\nfor name,module in sys.modules.items():\n if isinstance(module,module_type):\n if name in sys.builtin_module_names:\n loader=BuiltinImporter\n elif _imp.is_frozen(name):\n loader=FrozenImporter\n else :\n continue\n spec=_spec_from_module(module,loader)\n _init_module_attrs(spec,module)\n \n \nself_module=sys.modules[__name__]\n\n\nfor builtin_name in ('_warnings',):\n if builtin_name not in sys.modules:\n builtin_module=_builtin_from_name(builtin_name)\n else :\n builtin_module=sys.modules[builtin_name]\n setattr(self_module,builtin_name,builtin_module)\n \n \ndef _install(sys_module,_imp_module):\n ''\n _setup(sys_module,_imp_module)\n \n sys.meta_path.append(BuiltinImporter)\n sys.meta_path.append(FrozenImporter)\n \n \ndef _install_external_importers():\n ''\n global _bootstrap_external\n import _frozen_importlib_external\n _bootstrap_external=_frozen_importlib_external\n _frozen_importlib_external._install(sys.modules[__name__])\n \n", ["_frozen_importlib_external", "_imp", "_weakref", "sys"]], "_functools": [".py", "from reprlib import recursive_repr\n\nclass partial:\n ''\n\n \n \n __slots__=\"func\",\"args\",\"keywords\",\"__dict__\",\"__weakref__\"\n \n def __new__(*args,**keywords):\n if not args:\n raise TypeError(\"descriptor '__new__' of partial needs an argument\")\n if len(args)<2:\n raise TypeError(\"type 'partial' takes at least one argument\")\n cls,func,*args=args\n if not callable(func):\n raise TypeError(\"the first argument must be callable\")\n args=tuple(args)\n \n if hasattr(func,\"func\")and isinstance(func.args,tuple):\n args=func.args+args\n tmpkw=func.keywords.copy()\n tmpkw.update(keywords)\n keywords=tmpkw\n del tmpkw\n func=func.func\n \n self=super(partial,cls).__new__(cls)\n \n self.func=func\n self.args=args\n self.keywords=keywords\n return self\n \n def __call__(*args,**keywords):\n if not args:\n raise TypeError(\"descriptor '__call__' of partial needs an argument\")\n self,*args=args\n newkeywords=self.keywords.copy()\n newkeywords.update(keywords)\n return self.func(*self.args,*args,**newkeywords)\n \n @recursive_repr()\n def __repr__(self):\n qualname=type(self).__qualname__\n args=[repr(self.func)]\n args.extend(repr(x)for x in self.args)\n args.extend(f\"{k}={v!r}\"for (k,v)in self.keywords.items())\n if type(self).__module__ ==\"functools\":\n return f\"functools.{qualname}({', '.join(args)})\"\n return f\"{qualname}({', '.join(args)})\"\n \n def __reduce__(self):\n return type(self),(self.func,),(self.func,self.args,\n self.keywords or None ,self.__dict__ or None )\n \n def __setstate__(self,state):\n if not isinstance(state,tuple):\n raise TypeError(\"argument to __setstate__ must be a tuple\")\n if len(state)!=4:\n raise TypeError(f\"expected 4 items in state, got {len(state)}\")\n func,args,kwds,namespace=state\n if (not callable(func)or not isinstance(args,tuple)or\n (kwds is not None and not isinstance(kwds,dict))or\n (namespace is not None and not isinstance(namespace,dict))):\n raise TypeError(\"invalid partial state\")\n \n args=tuple(args)\n if kwds is None :\n kwds={}\n elif type(kwds)is not dict:\n kwds=dict(kwds)\n if namespace is None :\n namespace={}\n \n self.__dict__=namespace\n self.func=func\n self.args=args\n self.keywords=kwds\n \ndef reduce(func,iterable,initializer=None ):\n args=iter(iterable)\n if initializer is not None :\n res=initializer\n else :\n res=next(args)\n while True :\n try :\n res=func(res,next(args))\n except StopIteration:\n return res\n", ["reprlib"]], "_imp": [".py", "''\nimport sys\n\ndef _fix_co_filename(*args,**kw):\n ''\n\n\n\n \n pass\n \ndef acquire_lock(*args,**kw):\n ''\n\n \n pass\n \ncheck_hash_based_pycs=\"\"\"default\"\"\"\n\ndef create_builtin(spec):\n ''\n return __import__(spec.name)\n \ndef create_dynamic(*args,**kw):\n ''\n pass\n \ndef exec_builtin(*args,**kw):\n ''\n pass\n \ndef exec_dynamic(*args,**kw):\n ''\n pass\n \ndef extension_suffixes(*args,**kw):\n ''\n return []\n \ndef get_frozen_object(*args,**kw):\n ''\n pass\n \ndef init_frozen(*args,**kw):\n ''\n pass\n \ndef is_builtin(module_name):\n\n return module_name in __BRYTHON__.builtin_module_names\n \ndef is_frozen(*args,**kw):\n ''\n return False\n \ndef is_frozen_package(*args,**kw):\n ''\n pass\n \ndef lock_held(*args,**kw):\n ''\n \n return False\n \ndef release_lock(*args,**kw):\n ''\n \n pass\n \ndef source_hash(*args,**kw):\n pass\n", ["sys"]], "_io": [".py", "''\n\n\n\nimport os\nimport abc\nimport codecs\nimport errno\n\ntry :\n from _thread import allocate_lock as Lock\nexcept ImportError:\n from _dummy_thread import allocate_lock as Lock\n \n \nfrom _io_classes import *\nimport _io_classes\n_IOBase=_io_classes._IOBase\n_RawIOBase=_io_classes._RawIOBase\n_BufferedIOBase=_io_classes._BufferedIOBase\n_TextIOBase=_io_classes._TextIOBase\n\nSEEK_SET=0\nSEEK_CUR=1\nSEEK_END=2\n\nvalid_seek_flags={0,1,2}\nif hasattr(os,'SEEK_HOLE'):\n valid_seek_flags.add(os.SEEK_HOLE)\n valid_seek_flags.add(os.SEEK_DATA)\n \n \nDEFAULT_BUFFER_SIZE=8 *1024\n\n\n\n\n\n\nBlockingIOError=BlockingIOError\n\n\ndef __open(file,mode=\"r\",buffering=-1,encoding=None ,errors=None ,\nnewline=None ,closefd=True ,opener=None ):\n\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if not isinstance(file,(str,bytes,int)):\n raise TypeError(\"invalid file: %r\"%file)\n if not isinstance(mode,str):\n raise TypeError(\"invalid mode: %r\"%mode)\n if not isinstance(buffering,int):\n raise TypeError(\"invalid buffering: %r\"%buffering)\n if encoding is not None and not isinstance(encoding,str):\n raise TypeError(\"invalid encoding: %r\"%encoding)\n if errors is not None and not isinstance(errors,str):\n raise TypeError(\"invalid errors: %r\"%errors)\n modes=set(mode)\n if modes -set(\"axrwb+tU\")or len(mode)>len(modes):\n raise ValueError(\"invalid mode: %r\"%mode)\n creating=\"x\"in modes\n reading=\"r\"in modes\n writing=\"w\"in modes\n appending=\"a\"in modes\n updating=\"+\"in modes\n text=\"t\"in modes\n binary=\"b\"in modes\n if \"U\"in modes:\n if creating or writing or appending:\n raise ValueError(\"can't use U and writing mode at once\")\n reading=True\n if text and binary:\n raise ValueError(\"can't have text and binary mode at once\")\n if creating+reading+writing+appending >1:\n raise ValueError(\"can't have read/write/append mode at once\")\n if not (creating or reading or writing or appending):\n raise ValueError(\"must have exactly one of read/write/append mode\")\n if binary and encoding is not None :\n raise ValueError(\"binary mode doesn't take an encoding argument\")\n if binary and errors is not None :\n raise ValueError(\"binary mode doesn't take an errors argument\")\n if binary and newline is not None :\n raise ValueError(\"binary mode doesn't take a newline argument\")\n raw=FileIO(file,\n (creating and \"x\"or \"\")+\n (reading and \"r\"or \"\")+\n (writing and \"w\"or \"\")+\n (appending and \"a\"or \"\")+\n (updating and \"+\"or \"\"),\n closefd,opener=opener)\n line_buffering=False\n if buffering ==1 or buffering <0 and raw.isatty():\n buffering=-1\n line_buffering=True\n if buffering <0:\n buffering=DEFAULT_BUFFER_SIZE\n try :\n bs=os.fstat(raw.fileno()).st_blksize\n except (os.error,AttributeError):\n pass\n else :\n if bs >1:\n buffering=bs\n if buffering <0:\n raise ValueError(\"invalid buffering size\")\n if buffering ==0:\n if binary:\n return raw\n raise ValueError(\"can't have unbuffered text I/O\")\n if updating:\n buffer=BufferedRandom(raw,buffering)\n elif creating or writing or appending:\n buffer=BufferedWriter(raw,buffering)\n elif reading:\n buffer=BufferedReader(raw,buffering)\n else :\n raise ValueError(\"unknown mode: %r\"%mode)\n if binary:\n return buffer\n text=TextIOWrapper(buffer,encoding,errors,newline,line_buffering)\n text.mode=mode\n return text\n \nopen=__open\n\ndef open_code(file):\n return __builtins__.open(file,encoding=\"utf-8\")\n \ndef text_encoding(encoding,stacklevel=2):\n if encoding is None :\n return \"locale\"\n return encoding\n \nclass DocDescriptor:\n ''\n \n def __get__(self,obj,typ):\n return (\n \"open(file, mode='r', buffering=-1, encoding=None, \"\n \"errors=None, newline=None, closefd=True)\\n\\n\"+\n open.__doc__)\n \nclass OpenWrapper:\n ''\n\n\n\n\n\n \n __doc__=DocDescriptor()\n \n def __new__(cls,*args,**kwargs):\n return open(*args,**kwargs)\n \n \n \n \nclass UnsupportedOperation(ValueError,IOError):\n pass\n \n", ["_dummy_thread", "_io_classes", "_thread", "abc", "codecs", "errno", "os"]], "_markupbase": [".py", "''\n\n\n\n\n\n\nimport re\n\n_declname_match=re.compile(r'[a-zA-Z][-_.a-zA-Z0-9]*\\s*').match\n_declstringlit_match=re.compile(r'(\\'[^\\']*\\'|\"[^\"]*\")\\s*').match\n_commentclose=re.compile(r'--\\s*>')\n_markedsectionclose=re.compile(r']\\s*]\\s*>')\n\n\n\n\n_msmarkedsectionclose=re.compile(r']\\s*>')\n\ndel re\n\n\nclass ParserBase:\n ''\n \n \n def __init__(self):\n if self.__class__ is ParserBase:\n raise RuntimeError(\n \"_markupbase.ParserBase must be subclassed\")\n \n def reset(self):\n self.lineno=1\n self.offset=0\n \n def getpos(self):\n ''\n return self.lineno,self.offset\n \n \n \n \n \n def updatepos(self,i,j):\n if i >=j:\n return j\n rawdata=self.rawdata\n nlines=rawdata.count(\"\\n\",i,j)\n if nlines:\n self.lineno=self.lineno+nlines\n pos=rawdata.rindex(\"\\n\",i,j)\n self.offset=j -(pos+1)\n else :\n self.offset=self.offset+j -i\n return j\n \n _decl_otherchars=''\n \n \n def parse_declaration(self,i):\n \n \n \n \n \n \n \n \n \n \n rawdata=self.rawdata\n j=i+2\n assert rawdata[i:j]==\"\":\n \n return j+1\n if rawdata[j:j+1]in (\"-\",\"\"):\n \n \n return -1\n \n n=len(rawdata)\n if rawdata[j:j+2]=='--':\n \n return self.parse_comment(i)\n elif rawdata[j]=='[':\n \n \n \n \n return self.parse_marked_section(i)\n else :\n decltype,j=self._scan_name(j,i)\n if j <0:\n return j\n if decltype ==\"doctype\":\n self._decl_otherchars=''\n while j \":\n \n data=rawdata[i+2:j]\n if decltype ==\"doctype\":\n self.handle_decl(data)\n else :\n \n \n \n \n self.unknown_decl(data)\n return j+1\n if c in \"\\\"'\":\n m=_declstringlit_match(rawdata,j)\n if not m:\n return -1\n j=m.end()\n elif c in \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\":\n name,j=self._scan_name(j,i)\n elif c in self._decl_otherchars:\n j=j+1\n elif c ==\"[\":\n \n if decltype ==\"doctype\":\n j=self._parse_doctype_subset(j+1,i)\n elif decltype in {\"attlist\",\"linktype\",\"link\",\"element\"}:\n \n \n \n \n raise AssertionError(\"unsupported '[' char in %s declaration\"%decltype)\n else :\n raise AssertionError(\"unexpected '[' char in declaration\")\n else :\n raise AssertionError(\"unexpected %r char in declaration\"%rawdata[j])\n if j <0:\n return j\n return -1\n \n \n \n def parse_marked_section(self,i,report=1):\n rawdata=self.rawdata\n assert rawdata[i:i+3]=='n:\n \n return -1\n if rawdata[j:j+4]==\"\n \n \"\"\"%(self.OutputString(attrs).replace('\"',r'\\\"'))\n \n def OutputString(self,attrs=None ):\n \n \n result=[]\n append=result.append\n \n \n append(\"%s=%s\"%(self.key,self.coded_value))\n \n \n if attrs is None :\n attrs=self._reserved\n items=sorted(self.items())\n for key,value in items:\n if value ==\"\":\n continue\n if key not in attrs:\n continue\n if key ==\"expires\"and isinstance(value,int):\n append(\"%s=%s\"%(self._reserved[key],_getdate(value)))\n elif key ==\"max-age\"and isinstance(value,int):\n append(\"%s=%d\"%(self._reserved[key],value))\n elif key ==\"secure\":\n append(str(self._reserved[key]))\n elif key ==\"httponly\":\n append(str(self._reserved[key]))\n else :\n append(\"%s=%s\"%(self._reserved[key],value))\n \n \n return _semispacejoin(result)\n \n \n \n \n \n \n \n \n \n \n \n_LegalCharsPatt=r\"[\\w\\d!#%&'~_`><@,:/\\$\\*\\+\\-\\.\\^\\|\\)\\(\\?\\}\\{\\=]\"\n_CookiePattern=re.compile(r\"\"\"\n (?x) # This is a verbose pattern\n (?P # Start of group 'key'\n \"\"\"+_LegalCharsPatt+r\"\"\"+? # Any word of at least one letter\n ) # End of group 'key'\n ( # Optional group: there may not be a value.\n \\s*=\\s* # Equal Sign\n (?P # Start of group 'val'\n \"(?:[^\\\\\"]|\\\\.)*\" # Any doublequoted string\n | # or\n \\w{3},\\s[\\w\\d\\s-]{9,11}\\s[\\d:]{8}\\sGMT # Special case for \"expires\" attr\n | # or\n \"\"\"+_LegalCharsPatt+r\"\"\"* # Any word or empty string\n ) # End of group 'val'\n )? # End of optional value group\n \\s* # Any number of spaces.\n (\\s+|;|$) # Ending either at space, semicolon, or EOS.\n \"\"\",re.ASCII)\n\n\n\n\n\nclass BaseCookie(dict):\n ''\n \n def value_decode(self,val):\n ''\n\n\n\n\n \n return val,val\n \n def value_encode(self,val):\n ''\n\n\n\n \n strval=str(val)\n return strval,strval\n \n def __init__(self,input=None ):\n if input:\n self.load(input)\n \n def __set(self,key,real_value,coded_value):\n ''\n M=self.get(key,Morsel())\n M.set(key,real_value,coded_value)\n dict.__setitem__(self,key,M)\n \n def __setitem__(self,key,value):\n ''\n rval,cval=self.value_encode(value)\n self.__set(key,rval,cval)\n \n def output(self,attrs=None ,header=\"Set-Cookie:\",sep=\"\\015\\012\"):\n ''\n result=[]\n items=sorted(self.items())\n for key,value in items:\n result.append(value.output(attrs,header))\n return sep.join(result)\n \n __str__=output\n \n def __repr__(self):\n l=[]\n items=sorted(self.items())\n for key,value in items:\n l.append('%s=%s'%(key,repr(value.value)))\n return '<%s: %s>'%(self.__class__.__name__,_spacejoin(l))\n \n def js_output(self,attrs=None ):\n ''\n result=[]\n items=sorted(self.items())\n for key,value in items:\n result.append(value.js_output(attrs))\n return _nulljoin(result)\n \n def load(self,rawdata):\n ''\n\n\n\n \n if isinstance(rawdata,str):\n self.__parse_string(rawdata)\n else :\n \n for key,value in rawdata.items():\n self[key]=value\n return\n \n def __parse_string(self,str,patt=_CookiePattern):\n i=0\n n=len(str)\n M=None\n \n while 0 <=i 0\n self.count -=1\n if self.count ==0:\n self.owner=None\n if self.waiters:\n self.waiters -=1\n self.wakeup.release()\n \n def __repr__(self):\n return '_ModuleLock({!r}) at {}'.format(self.name,id(self))\n \n \nclass _DummyModuleLock:\n ''\n \n \n def __init__(self,name):\n self.name=name\n self.count=0\n \n def acquire(self):\n self.count +=1\n return True\n \n def release(self):\n if self.count ==0:\n raise RuntimeError('cannot release un-acquired lock')\n self.count -=1\n \n def __repr__(self):\n return '_DummyModuleLock({!r}) at {}'.format(self.name,id(self))\n \n \nclass _ModuleLockManager:\n\n def __init__(self,name):\n self._name=name\n self._lock=None\n \n def __enter__(self):\n self._lock=_get_module_lock(self._name)\n self._lock.acquire()\n \n def __exit__(self,*args,**kwargs):\n self._lock.release()\n \n \n \n \ndef _get_module_lock(name):\n ''\n\n\n \n \n _imp.acquire_lock()\n try :\n try :\n lock=_module_locks[name]()\n except KeyError:\n lock=None\n \n if lock is None :\n if _thread is None :\n lock=_DummyModuleLock(name)\n else :\n lock=_ModuleLock(name)\n \n def cb(ref,name=name):\n _imp.acquire_lock()\n try :\n \n \n \n if _module_locks.get(name)is ref:\n del _module_locks[name]\n finally :\n _imp.release_lock()\n \n _module_locks[name]=_weakref.ref(lock,cb)\n finally :\n _imp.release_lock()\n \n return lock\n \n \ndef _lock_unlock_module(name):\n ''\n\n\n\n \n lock=_get_module_lock(name)\n try :\n lock.acquire()\n except _DeadlockError:\n \n \n pass\n else :\n lock.release()\n \n \ndef _call_with_frames_removed(f,*args,**kwds):\n ''\n\n\n\n\n\n \n return f(*args,**kwds)\n \n \ndef _verbose_message(message,*args,verbosity=1):\n ''\n if sys.flags.verbose >=verbosity:\n if not message.startswith(('#','import ')):\n message='# '+message\n print(message.format(*args),file=sys.stderr)\n \n \ndef _requires_builtin(fxn):\n ''\n def _requires_builtin_wrapper(self,fullname):\n if fullname not in sys.builtin_module_names:\n raise ImportError('{!r} is not a built-in module'.format(fullname),\n name=fullname)\n return fxn(self,fullname)\n _wrap(_requires_builtin_wrapper,fxn)\n return _requires_builtin_wrapper\n \n \ndef _requires_frozen(fxn):\n ''\n def _requires_frozen_wrapper(self,fullname):\n if not _imp.is_frozen(fullname):\n raise ImportError('{!r} is not a frozen module'.format(fullname),\n name=fullname)\n return fxn(self,fullname)\n _wrap(_requires_frozen_wrapper,fxn)\n return _requires_frozen_wrapper\n \n \n \ndef _load_module_shim(self,fullname):\n ''\n\n\n\n \n spec=spec_from_loader(fullname,self)\n if fullname in sys.modules:\n module=sys.modules[fullname]\n _exec(spec,module)\n return sys.modules[fullname]\n else :\n return _load(spec)\n \n \n \ndef _module_repr(module):\n\n loader=getattr(module,'__loader__',None )\n if hasattr(loader,'module_repr'):\n \n \n \n try :\n return loader.module_repr(module)\n except Exception:\n pass\n try :\n spec=module.__spec__\n except AttributeError:\n pass\n else :\n if spec is not None :\n return _module_repr_from_spec(spec)\n \n \n \n try :\n name=module.__name__\n except AttributeError:\n name='?'\n try :\n filename=module.__file__\n except AttributeError:\n if loader is None :\n return ''.format(name)\n else :\n return ''.format(name,loader)\n else :\n return ''.format(name,filename)\n \n \nclass _installed_safely:\n\n def __init__(self,module):\n self._module=module\n self._spec=module.__spec__\n \n def __enter__(self):\n \n \n \n self._spec._initializing=True\n sys.modules[self._spec.name]=self._module\n \n def __exit__(self,*args):\n try :\n spec=self._spec\n if any(arg is not None for arg in args):\n try :\n del sys.modules[spec.name]\n except KeyError:\n pass\n else :\n _verbose_message('import {!r} # {!r}',spec.name,spec.loader)\n finally :\n self._spec._initializing=False\n \n \nclass ModuleSpec:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,name,loader,*,origin=None ,loader_state=None ,\n is_package=None ):\n self.name=name\n self.loader=loader\n self.origin=origin\n self.loader_state=loader_state\n self.submodule_search_locations=[]if is_package else None\n \n \n self._set_fileattr=False\n self._cached=None\n \n def __repr__(self):\n args=['name={!r}'.format(self.name),\n 'loader={!r}'.format(self.loader)]\n if self.origin is not None :\n args.append('origin={!r}'.format(self.origin))\n if self.submodule_search_locations is not None :\n args.append('submodule_search_locations={}'\n .format(self.submodule_search_locations))\n return '{}({})'.format(self.__class__.__name__,', '.join(args))\n \n def __eq__(self,other):\n smsl=self.submodule_search_locations\n try :\n return (self.name ==other.name and\n self.loader ==other.loader and\n self.origin ==other.origin and\n smsl ==other.submodule_search_locations and\n self.cached ==other.cached and\n self.has_location ==other.has_location)\n except AttributeError:\n return False\n \n @property\n def cached(self):\n if self._cached is None :\n if self.origin is not None and self._set_fileattr:\n if _bootstrap_external is None :\n raise NotImplementedError\n self._cached=_bootstrap_external._get_cached(self.origin)\n return self._cached\n \n @cached.setter\n def cached(self,cached):\n self._cached=cached\n \n @property\n def parent(self):\n ''\n if self.submodule_search_locations is None :\n return self.name.rpartition('.')[0]\n else :\n return self.name\n \n @property\n def has_location(self):\n return self._set_fileattr\n \n @has_location.setter\n def has_location(self,value):\n self._set_fileattr=bool(value)\n \n \ndef spec_from_loader(name,loader,*,origin=None ,is_package=None ):\n ''\n if hasattr(loader,'get_filename'):\n if _bootstrap_external is None :\n raise NotImplementedError\n spec_from_file_location=_bootstrap_external.spec_from_file_location\n \n if is_package is None :\n return spec_from_file_location(name,loader=loader)\n search=[]if is_package else None\n return spec_from_file_location(name,loader=loader,\n submodule_search_locations=search)\n \n if is_package is None :\n if hasattr(loader,'is_package'):\n try :\n is_package=loader.is_package(name)\n except ImportError:\n is_package=None\n else :\n \n is_package=False\n \n return ModuleSpec(name,loader,origin=origin,is_package=is_package)\n \n \ndef _spec_from_module(module,loader=None ,origin=None ):\n\n try :\n spec=module.__spec__\n except AttributeError:\n pass\n else :\n if spec is not None :\n return spec\n \n name=module.__name__\n if loader is None :\n try :\n loader=module.__loader__\n except AttributeError:\n \n pass\n try :\n location=module.__file__\n except AttributeError:\n location=None\n if origin is None :\n if location is None :\n try :\n origin=loader._ORIGIN\n except AttributeError:\n origin=None\n else :\n origin=location\n try :\n cached=module.__cached__\n except AttributeError:\n cached=None\n try :\n submodule_search_locations=list(module.__path__)\n except AttributeError:\n submodule_search_locations=None\n \n spec=ModuleSpec(name,loader,origin=origin)\n spec._set_fileattr=False if location is None else True\n spec.cached=cached\n spec.submodule_search_locations=submodule_search_locations\n return spec\n \n \ndef _init_module_attrs(spec,module,*,override=False ):\n\n\n\n if (override or getattr(module,'__name__',None )is None ):\n try :\n module.__name__=spec.name\n except AttributeError:\n pass\n \n if override or getattr(module,'__loader__',None )is None :\n loader=spec.loader\n if loader is None :\n \n if spec.submodule_search_locations is not None :\n if _bootstrap_external is None :\n raise NotImplementedError\n _NamespaceLoader=_bootstrap_external._NamespaceLoader\n \n loader=_NamespaceLoader.__new__(_NamespaceLoader)\n loader._path=spec.submodule_search_locations\n spec.loader=loader\n \n \n \n \n \n \n \n \n \n \n module.__file__=None\n try :\n module.__loader__=loader\n except AttributeError:\n pass\n \n if override or getattr(module,'__package__',None )is None :\n try :\n module.__package__=spec.parent\n except AttributeError:\n pass\n \n try :\n module.__spec__=spec\n except AttributeError:\n pass\n \n if override or getattr(module,'__path__',None )is None :\n if spec.submodule_search_locations is not None :\n try :\n module.__path__=spec.submodule_search_locations\n except AttributeError:\n pass\n \n if spec.has_location:\n if override or getattr(module,'__file__',None )is None :\n try :\n module.__file__=spec.origin\n except AttributeError:\n pass\n \n if override or getattr(module,'__cached__',None )is None :\n if spec.cached is not None :\n try :\n module.__cached__=spec.cached\n except AttributeError:\n pass\n return module\n \n \ndef module_from_spec(spec):\n ''\n \n module=None\n if hasattr(spec.loader,'create_module'):\n \n \n module=spec.loader.create_module(spec)\n elif hasattr(spec.loader,'exec_module'):\n raise ImportError('loaders that define exec_module() '\n 'must also define create_module()')\n if module is None :\n module=_new_module(spec.name)\n _init_module_attrs(spec,module)\n return module\n \n \ndef _module_repr_from_spec(spec):\n ''\n \n name='?'if spec.name is None else spec.name\n if spec.origin is None :\n if spec.loader is None :\n return ''.format(name)\n else :\n return ''.format(name,spec.loader)\n else :\n if spec.has_location:\n return ''.format(name,spec.origin)\n else :\n return ''.format(spec.name,spec.origin)\n \n \n \ndef _exec(spec,module):\n ''\n name=spec.name\n with _ModuleLockManager(name):\n if sys.modules.get(name)is not module:\n msg='module {!r} not in sys.modules'.format(name)\n raise ImportError(msg,name=name)\n if spec.loader is None :\n if spec.submodule_search_locations is None :\n raise ImportError('missing loader',name=spec.name)\n \n _init_module_attrs(spec,module,override=True )\n return module\n _init_module_attrs(spec,module,override=True )\n if not hasattr(spec.loader,'exec_module'):\n \n \n \n spec.loader.load_module(name)\n else :\n spec.loader.exec_module(module)\n return sys.modules[name]\n \n \ndef _load_backward_compatible(spec):\n\n\n\n spec.loader.load_module(spec.name)\n \n module=sys.modules[spec.name]\n if getattr(module,'__loader__',None )is None :\n try :\n module.__loader__=spec.loader\n except AttributeError:\n pass\n if getattr(module,'__package__',None )is None :\n try :\n \n \n \n module.__package__=module.__name__\n if not hasattr(module,'__path__'):\n module.__package__=spec.name.rpartition('.')[0]\n except AttributeError:\n pass\n if getattr(module,'__spec__',None )is None :\n try :\n module.__spec__=spec\n except AttributeError:\n pass\n return module\n \ndef _load_unlocked(spec):\n\n if spec.loader is not None :\n \n if not hasattr(spec.loader,'exec_module'):\n return _load_backward_compatible(spec)\n \n module=module_from_spec(spec)\n with _installed_safely(module):\n if spec.loader is None :\n if spec.submodule_search_locations is None :\n raise ImportError('missing loader',name=spec.name)\n \n else :\n spec.loader.exec_module(module)\n \n \n \n \n return sys.modules[spec.name]\n \n \n \ndef _load(spec):\n ''\n\n\n\n\n\n\n \n with _ModuleLockManager(spec.name):\n return _load_unlocked(spec)\n \n \n \n \nclass BuiltinImporter:\n\n ''\n\n\n\n\n \n \n @staticmethod\n def module_repr(module):\n ''\n\n\n\n \n return ''.format(module.__name__)\n \n @classmethod\n def find_spec(cls,fullname,path=None ,target=None ):\n if path is not None :\n return None\n if _imp.is_builtin(fullname):\n return spec_from_loader(fullname,cls,origin='built-in')\n else :\n return None\n \n @classmethod\n def find_module(cls,fullname,path=None ):\n ''\n\n\n\n\n\n \n spec=cls.find_spec(fullname,path)\n return spec.loader if spec is not None else None\n \n @classmethod\n def create_module(self,spec):\n ''\n if spec.name not in sys.builtin_module_names:\n raise ImportError('{!r} is not a built-in module'.format(spec.name),\n name=spec.name)\n return _call_with_frames_removed(_imp.create_builtin,spec)\n \n @classmethod\n def exec_module(self,module):\n ''\n _call_with_frames_removed(_imp.exec_builtin,module)\n \n @classmethod\n @_requires_builtin\n def get_code(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_builtin\n def get_source(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_builtin\n def is_package(cls,fullname):\n ''\n return False\n \n load_module=classmethod(_load_module_shim)\n \n \nclass FrozenImporter:\n\n ''\n\n\n\n\n \n \n @staticmethod\n def module_repr(m):\n ''\n\n\n\n \n return ''.format(m.__name__)\n \n @classmethod\n def find_spec(cls,fullname,path=None ,target=None ):\n if _imp.is_frozen(fullname):\n return spec_from_loader(fullname,cls,origin='frozen')\n else :\n return None\n \n @classmethod\n def find_module(cls,fullname,path=None ):\n ''\n\n\n\n \n return cls if _imp.is_frozen(fullname)else None\n \n @classmethod\n def create_module(cls,spec):\n ''\n \n @staticmethod\n def exec_module(module):\n name=module.__spec__.name\n if not _imp.is_frozen(name):\n raise ImportError('{!r} is not a frozen module'.format(name),\n name=name)\n code=_call_with_frames_removed(_imp.get_frozen_object,name)\n exec(code,module.__dict__)\n \n @classmethod\n def load_module(cls,fullname):\n ''\n\n\n\n \n return _load_module_shim(cls,fullname)\n \n @classmethod\n @_requires_frozen\n def get_code(cls,fullname):\n ''\n return _imp.get_frozen_object(fullname)\n \n @classmethod\n @_requires_frozen\n def get_source(cls,fullname):\n ''\n return None\n \n @classmethod\n @_requires_frozen\n def is_package(cls,fullname):\n ''\n return _imp.is_frozen_package(fullname)\n \n \n \n \nclass _ImportLockContext:\n\n ''\n \n def __enter__(self):\n ''\n _imp.acquire_lock()\n \n def __exit__(self,exc_type,exc_value,exc_traceback):\n ''\n _imp.release_lock()\n \n \ndef _resolve_name(name,package,level):\n ''\n bits=package.rsplit('.',level -1)\n if len(bits)= 0')\n if level >0:\n if not isinstance(package,str):\n raise TypeError('__package__ not set to a string')\n elif not package:\n raise ImportError('attempted relative import with no known parent '\n 'package')\n if not name and level ==0:\n raise ValueError('Empty module name')\n \n \n_ERR_MSG_PREFIX='No module named '\n_ERR_MSG=_ERR_MSG_PREFIX+'{!r}'\n\ndef _find_and_load_unlocked(name,import_):\n path=None\n parent=name.rpartition('.')[0]\n if parent:\n if parent not in sys.modules:\n _call_with_frames_removed(import_,parent)\n \n if name in sys.modules:\n return sys.modules[name]\n parent_module=sys.modules[parent]\n try :\n path=parent_module.__path__\n except AttributeError:\n msg=(_ERR_MSG+'; {!r} is not a package').format(name,parent)\n raise ModuleNotFoundError(msg,name=name)from None\n spec=_find_spec(name,path)\n if spec is None :\n raise ModuleNotFoundError(_ERR_MSG.format(name),name=name)\n else :\n module=_load_unlocked(spec)\n if parent:\n \n parent_module=sys.modules[parent]\n setattr(parent_module,name.rpartition('.')[2],module)\n return module\n \n \n_NEEDS_LOADING=object()\n\n\ndef _find_and_load(name,import_):\n ''\n with _ModuleLockManager(name):\n module=sys.modules.get(name,_NEEDS_LOADING)\n if module is _NEEDS_LOADING:\n return _find_and_load_unlocked(name,import_)\n \n if module is None :\n message=('import of {} halted; '\n 'None in sys.modules'.format(name))\n raise ModuleNotFoundError(message,name=name)\n \n _lock_unlock_module(name)\n return module\n \n \ndef _gcd_import(name,package=None ,level=0):\n ''\n\n\n\n\n\n\n \n _sanity_check(name,package,level)\n if level >0:\n name=_resolve_name(name,package,level)\n return _find_and_load(name,_gcd_import)\n \n \ndef _handle_fromlist(module,fromlist,import_,*,recursive=False ):\n ''\n\n\n\n\n\n \n \n \n if hasattr(module,'__path__'):\n for x in fromlist:\n if not isinstance(x,str):\n if recursive:\n where=module.__name__+'.__all__'\n else :\n where=\"``from list''\"\n raise TypeError(f\"Item in {where} must be str, \"\n f\"not {type(x).__name__}\")\n elif x =='*':\n if not recursive and hasattr(module,'__all__'):\n _handle_fromlist(module,module.__all__,import_,\n recursive=True )\n elif not hasattr(module,x):\n from_name='{}.{}'.format(module.__name__,x)\n try :\n _call_with_frames_removed(import_,from_name)\n except ModuleNotFoundError as exc:\n \n \n \n if (exc.name ==from_name and\n sys.modules.get(from_name,_NEEDS_LOADING)is not None ):\n continue\n raise\n return module\n \n \ndef _calc___package__(globals):\n ''\n\n\n\n\n \n package=globals.get('__package__')\n spec=globals.get('__spec__')\n if package is not None :\n if spec is not None and package !=spec.parent:\n _warnings.warn(\"__package__ != __spec__.parent \"\n f\"({package!r} != {spec.parent!r})\",\n ImportWarning,stacklevel=3)\n return package\n elif spec is not None :\n return spec.parent\n else :\n _warnings.warn(\"can't resolve package from __spec__ or __package__, \"\n \"falling back on __name__ and __path__\",\n ImportWarning,stacklevel=3)\n package=globals['__name__']\n if '__path__'not in globals:\n package=package.rpartition('.')[0]\n return package\n \n \ndef __import__(name,globals=None ,locals=None ,fromlist=(),level=0):\n ''\n\n\n\n\n\n\n\n\n \n if level ==0:\n module=_gcd_import(name)\n else :\n globals_=globals if globals is not None else {}\n package=_calc___package__(globals_)\n module=_gcd_import(name,package,level)\n if not fromlist:\n \n \n if level ==0:\n return _gcd_import(name.partition('.')[0])\n elif not name:\n return module\n else :\n \n \n cut_off=len(name)-len(name.partition('.')[0])\n \n \n return sys.modules[module.__name__[:len(module.__name__)-cut_off]]\n else :\n return _handle_fromlist(module,fromlist,_gcd_import)\n \n \ndef _builtin_from_name(name):\n spec=BuiltinImporter.find_spec(name)\n if spec is None :\n raise ImportError('no built-in module named '+name)\n return _load_unlocked(spec)\n \n \ndef _setup(sys_module,_imp_module):\n ''\n\n\n\n\n\n \n global _imp,sys\n _imp=_imp_module\n sys=sys_module\n \n \n module_type=type(sys)\n for name,module in sys.modules.items():\n if isinstance(module,module_type):\n if name in sys.builtin_module_names:\n loader=BuiltinImporter\n elif _imp.is_frozen(name):\n loader=FrozenImporter\n else :\n continue\n spec=_spec_from_module(module,loader)\n _init_module_attrs(spec,module)\n \n \n self_module=sys.modules[__name__]\n \n \n for builtin_name in ('_warnings',):\n if builtin_name not in sys.modules:\n builtin_module=_builtin_from_name(builtin_name)\n else :\n builtin_module=sys.modules[builtin_name]\n setattr(self_module,builtin_name,builtin_module)\n \n \ndef _install(sys_module,_imp_module):\n ''\n _setup(sys_module,_imp_module)\n \n sys.meta_path.append(BuiltinImporter)\n sys.meta_path.append(FrozenImporter)\n \n \ndef _install_external_importers():\n ''\n global _bootstrap_external\n import _frozen_importlib_external\n _bootstrap_external=_frozen_importlib_external\n _frozen_importlib_external._install(sys.modules[__name__])\n", ["_frozen_importlib_external", "_weakref"]], "importlib._bootstrap_external": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n_bootstrap=None\n\n\nimport _imp\nimport _io\nimport sys\nimport _warnings\nimport marshal\n\n\n_MS_WINDOWS=(sys.platform =='win32')\nif _MS_WINDOWS:\n import nt as _os\n import winreg\nelse:\n import posix as _os\n \n \nif _MS_WINDOWS:\n path_separators=['\\\\','/']\nelse:\n path_separators=['/']\n \nassert all(len(sep)==1 for sep in path_separators)\npath_sep=path_separators[0]\npath_sep_tuple=tuple(path_separators)\npath_separators=''.join(path_separators)\n_pathseps_with_colon={f':{s}'for s in path_separators}\n\n\n\n_CASE_INSENSITIVE_PLATFORMS_STR_KEY='win',\n_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY='cygwin','darwin'\n_CASE_INSENSITIVE_PLATFORMS=(_CASE_INSENSITIVE_PLATFORMS_BYTES_KEY\n+_CASE_INSENSITIVE_PLATFORMS_STR_KEY)\n\n\ndef _make_relax_case():\n if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS):\n if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS_STR_KEY):\n key='PYTHONCASEOK'\n else:\n key=b'PYTHONCASEOK'\n \n def _relax_case():\n ''\n return not sys.flags.ignore_environment and key in _os.environ\n else:\n def _relax_case():\n ''\n return False\n return _relax_case\n \n_relax_case=_make_relax_case()\n\n\ndef _pack_uint32(x):\n ''\n return(int(x)&0xFFFFFFFF).to_bytes(4,'little')\n \n \ndef _unpack_uint32(data):\n ''\n assert len(data)==4\n return int.from_bytes(data,'little')\n \ndef _unpack_uint16(data):\n ''\n assert len(data)==2\n return int.from_bytes(data,'little')\n \n \nif _MS_WINDOWS:\n def _path_join(*path_parts):\n ''\n if not path_parts:\n return \"\"\n if len(path_parts)==1:\n return path_parts[0]\n root=\"\"\n path=[]\n for new_root,tail in map(_os._path_splitroot,path_parts):\n if new_root.startswith(path_sep_tuple)or new_root.endswith(path_sep_tuple):\n root=new_root.rstrip(path_separators)or root\n path=[path_sep+tail]\n elif new_root.endswith(':'):\n if root.casefold()!=new_root.casefold():\n \n \n root=new_root\n path=[tail]\n else:\n path.append(tail)\n else:\n root=new_root or root\n path.append(tail)\n path=[p.rstrip(path_separators)for p in path if p]\n if len(path)==1 and not path[0]:\n \n return root+path_sep\n return root+path_sep.join(path)\n \nelse:\n def _path_join(*path_parts):\n ''\n return path_sep.join([part.rstrip(path_separators)\n for part in path_parts if part])\n \n \ndef _path_split(path):\n ''\n i=max(path.rfind(p)for p in path_separators)\n if i <0:\n return '',path\n return path[:i],path[i+1:]\n \n \ndef _path_stat(path):\n ''\n\n\n\n\n \n return _os.stat(path)\n \n \ndef _path_is_mode_type(path,mode):\n ''\n try:\n stat_info=_path_stat(path)\n except OSError:\n return False\n return(stat_info.st_mode&0o170000)==mode\n \n \ndef _path_isfile(path):\n ''\n return _path_is_mode_type(path,0o100000)\n \n \ndef _path_isdir(path):\n ''\n if not path:\n path=_os.getcwd()\n return _path_is_mode_type(path,0o040000)\n \n \nif _MS_WINDOWS:\n def _path_isabs(path):\n ''\n if not path:\n return False\n root=_os._path_splitroot(path)[0].replace('/','\\\\')\n return len(root)>1 and(root.startswith('\\\\\\\\')or root.endswith('\\\\'))\n \nelse:\n def _path_isabs(path):\n ''\n return path.startswith(path_separators)\n \n \ndef _path_abspath(path):\n ''\n if not _path_isabs(path):\n for sep in path_separators:\n path=path.removeprefix(f\".{sep}\")\n return _path_join(_os.getcwd(),path)\n else:\n return path\n \n \ndef _write_atomic(path,data,mode=0o666):\n ''\n\n \n \n path_tmp=f'{path}.{id(path)}'\n fd=_os.open(path_tmp,\n _os.O_EXCL |_os.O_CREAT |_os.O_WRONLY,mode&0o666)\n try:\n \n \n with _io.FileIO(fd,'wb')as file:\n file.write(data)\n _os.replace(path_tmp,path)\n except OSError:\n try:\n _os.unlink(path_tmp)\n except OSError:\n pass\n raise\n \n \n_code_type=type(_write_atomic.__code__)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nMAGIC_NUMBER=(3531).to_bytes(2,'little')+b'\\r\\n'\n\n_RAW_MAGIC_NUMBER=int.from_bytes(MAGIC_NUMBER,'little')\n\n_PYCACHE='__pycache__'\n_OPT='opt-'\n\nSOURCE_SUFFIXES=['.py']\nif _MS_WINDOWS:\n SOURCE_SUFFIXES.append('.pyw')\n \nEXTENSION_SUFFIXES=_imp.extension_suffixes()\n\nBYTECODE_SUFFIXES=['.pyc']\n\nDEBUG_BYTECODE_SUFFIXES=OPTIMIZED_BYTECODE_SUFFIXES=BYTECODE_SUFFIXES\n\ndef cache_from_source(path,debug_override=None,*,optimization=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if debug_override is not None:\n _warnings.warn('the debug_override parameter is deprecated; use '\n \"'optimization' instead\",DeprecationWarning)\n if optimization is not None:\n message='debug_override or optimization must be set to None'\n raise TypeError(message)\n optimization=''if debug_override else 1\n path=_os.fspath(path)\n head,tail=_path_split(path)\n base,sep,rest=tail.rpartition('.')\n tag=sys.implementation.cache_tag\n if tag is None:\n raise NotImplementedError('sys.implementation.cache_tag is None')\n almost_filename=''.join([(base if base else rest),sep,tag])\n if optimization is None:\n if sys.flags.optimize ==0:\n optimization=''\n else:\n optimization=sys.flags.optimize\n optimization=str(optimization)\n if optimization !='':\n if not optimization.isalnum():\n raise ValueError(f'{optimization !r} is not alphanumeric')\n almost_filename=f'{almost_filename}.{_OPT}{optimization}'\n filename=almost_filename+BYTECODE_SUFFIXES[0]\n if sys.pycache_prefix is not None:\n \n \n \n \n \n \n \n \n head=_path_abspath(head)\n \n \n \n \n if head[1]==':'and head[0]not in path_separators:\n head=head[2:]\n \n \n \n return _path_join(\n sys.pycache_prefix,\n head.lstrip(path_separators),\n filename,\n )\n return _path_join(head,_PYCACHE,filename)\n \n \ndef source_from_cache(path):\n ''\n\n\n\n\n\n\n \n if sys.implementation.cache_tag is None:\n raise NotImplementedError('sys.implementation.cache_tag is None')\n path=_os.fspath(path)\n head,pycache_filename=_path_split(path)\n found_in_pycache_prefix=False\n if sys.pycache_prefix is not None:\n stripped_path=sys.pycache_prefix.rstrip(path_separators)\n if head.startswith(stripped_path+path_sep):\n head=head[len(stripped_path):]\n found_in_pycache_prefix=True\n if not found_in_pycache_prefix:\n head,pycache=_path_split(head)\n if pycache !=_PYCACHE:\n raise ValueError(f'{_PYCACHE} not bottom-level directory in '\n f'{path !r}')\n dot_count=pycache_filename.count('.')\n if dot_count not in{2,3}:\n raise ValueError(f'expected only 2 or 3 dots in {pycache_filename !r}')\n elif dot_count ==3:\n optimization=pycache_filename.rsplit('.',2)[-2]\n if not optimization.startswith(_OPT):\n raise ValueError(\"optimization portion of filename does not start \"\n f\"with {_OPT !r}\")\n opt_level=optimization[len(_OPT):]\n if not opt_level.isalnum():\n raise ValueError(f\"optimization level {optimization !r} is not an \"\n \"alphanumeric value\")\n base_filename=pycache_filename.partition('.')[0]\n return _path_join(head,base_filename+SOURCE_SUFFIXES[0])\n \n \ndef _get_sourcefile(bytecode_path):\n ''\n\n\n\n\n \n if len(bytecode_path)==0:\n return None\n rest,_,extension=bytecode_path.rpartition('.')\n if not rest or extension.lower()[-3:-1]!='py':\n return bytecode_path\n try:\n source_path=source_from_cache(bytecode_path)\n except(NotImplementedError,ValueError):\n source_path=bytecode_path[:-1]\n return source_path if _path_isfile(source_path)else bytecode_path\n \n \ndef _get_cached(filename):\n if filename.endswith(tuple(SOURCE_SUFFIXES)):\n try:\n return cache_from_source(filename)\n except NotImplementedError:\n pass\n elif filename.endswith(tuple(BYTECODE_SUFFIXES)):\n return filename\n else:\n return None\n \n \ndef _calc_mode(path):\n ''\n try:\n mode=_path_stat(path).st_mode\n except OSError:\n mode=0o666\n \n \n mode |=0o200\n return mode\n \n \ndef _check_name(method):\n ''\n\n\n\n\n\n \n def _check_name_wrapper(self,name=None,*args,**kwargs):\n if name is None:\n name=self.name\n elif self.name !=name:\n raise ImportError('loader for %s cannot handle %s'%\n (self.name,name),name=name)\n return method(self,name,*args,**kwargs)\n \n \n \n if _bootstrap is not None:\n _wrap=_bootstrap._wrap\n else:\n def _wrap(new,old):\n for replace in['__module__','__name__','__qualname__','__doc__']:\n if hasattr(old,replace):\n setattr(new,replace,getattr(old,replace))\n new.__dict__.update(old.__dict__)\n \n _wrap(_check_name_wrapper,method)\n return _check_name_wrapper\n \n \ndef _classify_pyc(data,name,exc_details):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n magic=data[:4]\n if magic !=MAGIC_NUMBER:\n message=f'bad magic number in {name !r}: {magic !r}'\n _bootstrap._verbose_message('{}',message)\n raise ImportError(message,**exc_details)\n if len(data)<16:\n message=f'reached EOF while reading pyc header of {name !r}'\n _bootstrap._verbose_message('{}',message)\n raise EOFError(message)\n flags=_unpack_uint32(data[4:8])\n \n if flags&~0b11:\n message=f'invalid flags {flags !r} in {name !r}'\n raise ImportError(message,**exc_details)\n return flags\n \n \ndef _validate_timestamp_pyc(data,source_mtime,source_size,name,\nexc_details):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if _unpack_uint32(data[8:12])!=(source_mtime&0xFFFFFFFF):\n message=f'bytecode is stale for {name !r}'\n _bootstrap._verbose_message('{}',message)\n raise ImportError(message,**exc_details)\n if(source_size is not None and\n _unpack_uint32(data[12:16])!=(source_size&0xFFFFFFFF)):\n raise ImportError(f'bytecode is stale for {name !r}',**exc_details)\n \n \ndef _validate_hash_pyc(data,source_hash,name,exc_details):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if data[8:16]!=source_hash:\n raise ImportError(\n f'hash in bytecode doesn\\'t match hash of source {name !r}',\n **exc_details,\n )\n \n \ndef _compile_bytecode(data,name=None,bytecode_path=None,source_path=None):\n ''\n code=marshal.loads(data)\n if isinstance(code,_code_type):\n _bootstrap._verbose_message('code object from {!r}',bytecode_path)\n if source_path is not None:\n _imp._fix_co_filename(code,source_path)\n return code\n else:\n raise ImportError(f'Non-code object in {bytecode_path !r}',\n name=name,path=bytecode_path)\n \n \ndef _code_to_timestamp_pyc(code,mtime=0,source_size=0):\n ''\n data=bytearray(MAGIC_NUMBER)\n data.extend(_pack_uint32(0))\n data.extend(_pack_uint32(mtime))\n data.extend(_pack_uint32(source_size))\n data.extend(marshal.dumps(code))\n return data\n \n \ndef _code_to_hash_pyc(code,source_hash,checked=True):\n ''\n data=bytearray(MAGIC_NUMBER)\n flags=0b1 |checked <<1\n data.extend(_pack_uint32(flags))\n assert len(source_hash)==8\n data.extend(source_hash)\n data.extend(marshal.dumps(code))\n return data\n \n \ndef decode_source(source_bytes):\n ''\n\n\n \n import tokenize\n source_bytes_readline=_io.BytesIO(source_bytes).readline\n encoding=tokenize.detect_encoding(source_bytes_readline)\n newline_decoder=_io.IncrementalNewlineDecoder(None,True)\n return newline_decoder.decode(source_bytes.decode(encoding[0]))\n \n \n \n \n_POPULATE=object()\n\n\ndef spec_from_file_location(name,location=None,*,loader=None,\nsubmodule_search_locations=_POPULATE):\n ''\n\n\n\n\n\n\n\n\n \n if location is None:\n \n \n \n location=''\n if hasattr(loader,'get_filename'):\n \n try:\n location=loader.get_filename(name)\n except ImportError:\n pass\n else:\n location=_os.fspath(location)\n try:\n location=_path_abspath(location)\n except OSError:\n pass\n \n \n \n \n \n \n \n spec=_bootstrap.ModuleSpec(name,loader,origin=location)\n spec._set_fileattr=True\n \n \n if loader is None:\n for loader_class,suffixes in _get_supported_file_loaders():\n if location.endswith(tuple(suffixes)):\n loader=loader_class(name,location)\n spec.loader=loader\n break\n else:\n return None\n \n \n if submodule_search_locations is _POPULATE:\n \n if hasattr(loader,'is_package'):\n try:\n is_package=loader.is_package(name)\n except ImportError:\n pass\n else:\n if is_package:\n spec.submodule_search_locations=[]\n else:\n spec.submodule_search_locations=submodule_search_locations\n if spec.submodule_search_locations ==[]:\n if location:\n dirname=_path_split(location)[0]\n spec.submodule_search_locations.append(dirname)\n \n return spec\n \n \ndef _bless_my_loader(module_globals):\n ''\n\n\n \n \n \n \n \n \n \n \n if not isinstance(module_globals,dict):\n return None\n \n missing=object()\n loader=module_globals.get('__loader__',None)\n spec=module_globals.get('__spec__',missing)\n \n if loader is None:\n if spec is missing:\n \n \n return None\n elif spec is None:\n raise ValueError('Module globals is missing a __spec__.loader')\n \n spec_loader=getattr(spec,'loader',missing)\n \n if spec_loader in(missing,None):\n if loader is None:\n exc=AttributeError if spec_loader is missing else ValueError\n raise exc('Module globals is missing a __spec__.loader')\n _warnings.warn(\n 'Module globals is missing a __spec__.loader',\n DeprecationWarning)\n spec_loader=loader\n \n assert spec_loader is not None\n if loader is not None and loader !=spec_loader:\n _warnings.warn(\n 'Module globals; __loader__ != __spec__.loader',\n DeprecationWarning)\n return loader\n \n return spec_loader\n \n \n \n \nclass WindowsRegistryFinder:\n\n ''\n \n REGISTRY_KEY=(\n 'Software\\\\Python\\\\PythonCore\\\\{sys_version}'\n '\\\\Modules\\\\{fullname}')\n REGISTRY_KEY_DEBUG=(\n 'Software\\\\Python\\\\PythonCore\\\\{sys_version}'\n '\\\\Modules\\\\{fullname}\\\\Debug')\n DEBUG_BUILD=(_MS_WINDOWS and '_d.pyd'in EXTENSION_SUFFIXES)\n \n @staticmethod\n def _open_registry(key):\n try:\n return winreg.OpenKey(winreg.HKEY_CURRENT_USER,key)\n except OSError:\n return winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,key)\n \n @classmethod\n def _search_registry(cls,fullname):\n if cls.DEBUG_BUILD:\n registry_key=cls.REGISTRY_KEY_DEBUG\n else:\n registry_key=cls.REGISTRY_KEY\n key=registry_key.format(fullname=fullname,\n sys_version='%d.%d'%sys.version_info[:2])\n try:\n with cls._open_registry(key)as hkey:\n filepath=winreg.QueryValue(hkey,'')\n except OSError:\n return None\n return filepath\n \n @classmethod\n def find_spec(cls,fullname,path=None,target=None):\n filepath=cls._search_registry(fullname)\n if filepath is None:\n return None\n try:\n _path_stat(filepath)\n except OSError:\n return None\n for loader,suffixes in _get_supported_file_loaders():\n if filepath.endswith(tuple(suffixes)):\n spec=_bootstrap.spec_from_loader(fullname,\n loader(fullname,filepath),\n origin=filepath)\n return spec\n \n \nclass _LoaderBasics:\n\n ''\n \n \n def is_package(self,fullname):\n ''\n \n filename=_path_split(self.get_filename(fullname))[1]\n filename_base=filename.rsplit('.',1)[0]\n tail_name=fullname.rpartition('.')[2]\n return filename_base =='__init__'and tail_name !='__init__'\n \n def create_module(self,spec):\n ''\n \n def exec_module(self,module):\n ''\n code=self.get_code(module.__name__)\n if code is None:\n raise ImportError(f'cannot load module {module.__name__ !r} when '\n 'get_code() returns None')\n _bootstrap._call_with_frames_removed(exec,code,module.__dict__)\n \n def load_module(self,fullname):\n ''\n \n return _bootstrap._load_module_shim(self,fullname)\n \n \nclass SourceLoader(_LoaderBasics):\n\n def path_mtime(self,path):\n ''\n\n\n\n \n raise OSError\n \n def path_stats(self,path):\n ''\n\n\n\n\n\n\n\n\n\n \n return{'mtime':self.path_mtime(path)}\n \n def _cache_bytecode(self,source_path,cache_path,data):\n ''\n\n\n\n\n \n \n return self.set_data(cache_path,data)\n \n def set_data(self,path,data):\n ''\n\n\n \n \n \n def get_source(self,fullname):\n ''\n path=self.get_filename(fullname)\n try:\n source_bytes=self.get_data(path)\n except OSError as exc:\n raise ImportError('source not available through get_data()',\n name=fullname)from exc\n return decode_source(source_bytes)\n \n def source_to_code(self,data,path,*,_optimize=-1):\n ''\n\n\n \n return _bootstrap._call_with_frames_removed(compile,data,path,'exec',\n dont_inherit=True,optimize=_optimize)\n \n def get_code(self,fullname):\n ''\n\n\n\n\n \n source_path=self.get_filename(fullname)\n source_mtime=None\n source_bytes=None\n source_hash=None\n hash_based=False\n check_source=True\n try:\n bytecode_path=cache_from_source(source_path)\n except NotImplementedError:\n bytecode_path=None\n else:\n try:\n st=self.path_stats(source_path)\n except OSError:\n pass\n else:\n source_mtime=int(st['mtime'])\n try:\n data=self.get_data(bytecode_path)\n except OSError:\n pass\n else:\n exc_details={\n 'name':fullname,\n 'path':bytecode_path,\n }\n try:\n flags=_classify_pyc(data,fullname,exc_details)\n bytes_data=memoryview(data)[16:]\n hash_based=flags&0b1 !=0\n if hash_based:\n check_source=flags&0b10 !=0\n if(_imp.check_hash_based_pycs !='never'and\n (check_source or\n _imp.check_hash_based_pycs =='always')):\n source_bytes=self.get_data(source_path)\n source_hash=_imp.source_hash(\n _RAW_MAGIC_NUMBER,\n source_bytes,\n )\n _validate_hash_pyc(data,source_hash,fullname,\n exc_details)\n else:\n _validate_timestamp_pyc(\n data,\n source_mtime,\n st['size'],\n fullname,\n exc_details,\n )\n except(ImportError,EOFError):\n pass\n else:\n _bootstrap._verbose_message('{} matches {}',bytecode_path,\n source_path)\n return _compile_bytecode(bytes_data,name=fullname,\n bytecode_path=bytecode_path,\n source_path=source_path)\n if source_bytes is None:\n source_bytes=self.get_data(source_path)\n code_object=self.source_to_code(source_bytes,source_path)\n _bootstrap._verbose_message('code object from {}',source_path)\n if(not sys.dont_write_bytecode and bytecode_path is not None and\n source_mtime is not None):\n if hash_based:\n if source_hash is None:\n source_hash=_imp.source_hash(_RAW_MAGIC_NUMBER,\n source_bytes)\n data=_code_to_hash_pyc(code_object,source_hash,check_source)\n else:\n data=_code_to_timestamp_pyc(code_object,source_mtime,\n len(source_bytes))\n try:\n self._cache_bytecode(source_path,bytecode_path,data)\n except NotImplementedError:\n pass\n return code_object\n \n \nclass FileLoader:\n\n ''\n \n \n def __init__(self,fullname,path):\n ''\n \n self.name=fullname\n self.path=path\n \n def __eq__(self,other):\n return(self.__class__ ==other.__class__ and\n self.__dict__ ==other.__dict__)\n \n def __hash__(self):\n return hash(self.name)^hash(self.path)\n \n @_check_name\n def load_module(self,fullname):\n ''\n\n\n\n \n \n \n \n return super(FileLoader,self).load_module(fullname)\n \n @_check_name\n def get_filename(self,fullname):\n ''\n return self.path\n \n def get_data(self,path):\n ''\n if isinstance(self,(SourceLoader,ExtensionFileLoader)):\n with _io.open_code(str(path))as file:\n return file.read()\n else:\n with _io.FileIO(path,'r')as file:\n return file.read()\n \n @_check_name\n def get_resource_reader(self,module):\n from importlib.readers import FileReader\n return FileReader(self)\n \n \nclass SourceFileLoader(FileLoader,SourceLoader):\n\n ''\n \n def path_stats(self,path):\n ''\n st=_path_stat(path)\n return{'mtime':st.st_mtime,'size':st.st_size}\n \n def _cache_bytecode(self,source_path,bytecode_path,data):\n \n mode=_calc_mode(source_path)\n return self.set_data(bytecode_path,data,_mode=mode)\n \n def set_data(self,path,data,*,_mode=0o666):\n ''\n parent,filename=_path_split(path)\n path_parts=[]\n \n while parent and not _path_isdir(parent):\n parent,part=_path_split(parent)\n path_parts.append(part)\n \n for part in reversed(path_parts):\n parent=_path_join(parent,part)\n try:\n _os.mkdir(parent)\n except FileExistsError:\n \n continue\n except OSError as exc:\n \n \n _bootstrap._verbose_message('could not create {!r}: {!r}',\n parent,exc)\n return\n try:\n _write_atomic(path,data,_mode)\n _bootstrap._verbose_message('created {!r}',path)\n except OSError as exc:\n \n _bootstrap._verbose_message('could not create {!r}: {!r}',path,\n exc)\n \n \nclass SourcelessFileLoader(FileLoader,_LoaderBasics):\n\n ''\n \n def get_code(self,fullname):\n path=self.get_filename(fullname)\n data=self.get_data(path)\n \n \n exc_details={\n 'name':fullname,\n 'path':path,\n }\n _classify_pyc(data,fullname,exc_details)\n return _compile_bytecode(\n memoryview(data)[16:],\n name=fullname,\n bytecode_path=path,\n )\n \n def get_source(self,fullname):\n ''\n return None\n \n \nclass ExtensionFileLoader(FileLoader,_LoaderBasics):\n\n ''\n\n\n\n \n \n def __init__(self,name,path):\n self.name=name\n self.path=path\n \n def __eq__(self,other):\n return(self.__class__ ==other.__class__ and\n self.__dict__ ==other.__dict__)\n \n def __hash__(self):\n return hash(self.name)^hash(self.path)\n \n def create_module(self,spec):\n ''\n module=_bootstrap._call_with_frames_removed(\n _imp.create_dynamic,spec)\n _bootstrap._verbose_message('extension module {!r} loaded from {!r}',\n spec.name,self.path)\n return module\n \n def exec_module(self,module):\n ''\n _bootstrap._call_with_frames_removed(_imp.exec_dynamic,module)\n _bootstrap._verbose_message('extension module {!r} executed from {!r}',\n self.name,self.path)\n \n def is_package(self,fullname):\n ''\n file_name=_path_split(self.path)[1]\n return any(file_name =='__init__'+suffix\n for suffix in EXTENSION_SUFFIXES)\n \n def get_code(self,fullname):\n ''\n return None\n \n def get_source(self,fullname):\n ''\n return None\n \n @_check_name\n def get_filename(self,fullname):\n ''\n return self.path\n \n \nclass _NamespacePath:\n ''\n\n\n\n \n \n \n \n _epoch=0\n \n def __init__(self,name,path,path_finder):\n self._name=name\n self._path=path\n self._last_parent_path=tuple(self._get_parent_path())\n self._last_epoch=self._epoch\n self._path_finder=path_finder\n \n def _find_parent_path_names(self):\n ''\n parent,dot,me=self._name.rpartition('.')\n if dot =='':\n \n return 'sys','path'\n \n \n return parent,'__path__'\n \n def _get_parent_path(self):\n parent_module_name,path_attr_name=self._find_parent_path_names()\n return getattr(sys.modules[parent_module_name],path_attr_name)\n \n def _recalculate(self):\n \n parent_path=tuple(self._get_parent_path())\n if parent_path !=self._last_parent_path or self._epoch !=self._last_epoch:\n spec=self._path_finder(self._name,parent_path)\n \n \n if spec is not None and spec.loader is None:\n if spec.submodule_search_locations:\n self._path=spec.submodule_search_locations\n self._last_parent_path=parent_path\n self._last_epoch=self._epoch\n return self._path\n \n def __iter__(self):\n return iter(self._recalculate())\n \n def __getitem__(self,index):\n return self._recalculate()[index]\n \n def __setitem__(self,index,path):\n self._path[index]=path\n \n def __len__(self):\n return len(self._recalculate())\n \n def __repr__(self):\n return f'_NamespacePath({self._path !r})'\n \n def __contains__(self,item):\n return item in self._recalculate()\n \n def append(self,item):\n self._path.append(item)\n \n \n \n \n \nclass NamespaceLoader:\n def __init__(self,name,path,path_finder):\n self._path=_NamespacePath(name,path,path_finder)\n \n def is_package(self,fullname):\n return True\n \n def get_source(self,fullname):\n return ''\n \n def get_code(self,fullname):\n return compile('','','exec',dont_inherit=True)\n \n def create_module(self,spec):\n ''\n \n def exec_module(self,module):\n pass\n \n def load_module(self,fullname):\n ''\n\n\n\n \n \n _bootstrap._verbose_message('namespace module loaded with path {!r}',\n self._path)\n \n return _bootstrap._load_module_shim(self,fullname)\n \n def get_resource_reader(self,module):\n from importlib.readers import NamespaceReader\n return NamespaceReader(self._path)\n \n \n \n_NamespaceLoader=NamespaceLoader\n\n\n\n\nclass PathFinder:\n\n ''\n \n @staticmethod\n def invalidate_caches():\n ''\n \n for name,finder in list(sys.path_importer_cache.items()):\n \n \n if finder is None or not _path_isabs(name):\n del sys.path_importer_cache[name]\n elif hasattr(finder,'invalidate_caches'):\n finder.invalidate_caches()\n \n \n _NamespacePath._epoch +=1\n \n @staticmethod\n def _path_hooks(path):\n ''\n if sys.path_hooks is not None and not sys.path_hooks:\n _warnings.warn('sys.path_hooks is empty',ImportWarning)\n for hook in sys.path_hooks:\n try:\n return hook(path)\n except ImportError:\n continue\n else:\n return None\n \n @classmethod\n def _path_importer_cache(cls,path):\n ''\n\n\n\n\n \n if path =='':\n try:\n path=_os.getcwd()\n except FileNotFoundError:\n \n \n return None\n try:\n finder=sys.path_importer_cache[path]\n except KeyError:\n finder=cls._path_hooks(path)\n sys.path_importer_cache[path]=finder\n return finder\n \n @classmethod\n def _get_spec(cls,fullname,path,target=None):\n ''\n \n \n namespace_path=[]\n for entry in path:\n if not isinstance(entry,str):\n continue\n finder=cls._path_importer_cache(entry)\n if finder is not None:\n spec=finder.find_spec(fullname,target)\n if spec is None:\n continue\n if spec.loader is not None:\n return spec\n portions=spec.submodule_search_locations\n if portions is None:\n raise ImportError('spec missing loader')\n \n \n \n \n namespace_path.extend(portions)\n else:\n spec=_bootstrap.ModuleSpec(fullname,None)\n spec.submodule_search_locations=namespace_path\n return spec\n \n @classmethod\n def find_spec(cls,fullname,path=None,target=None):\n ''\n\n\n \n if path is None:\n path=sys.path\n spec=cls._get_spec(fullname,path,target)\n if spec is None:\n return None\n elif spec.loader is None:\n namespace_path=spec.submodule_search_locations\n if namespace_path:\n \n \n spec.origin=None\n spec.submodule_search_locations=_NamespacePath(fullname,namespace_path,cls._get_spec)\n return spec\n else:\n return None\n else:\n return spec\n \n @staticmethod\n def find_distributions(*args,**kwargs):\n ''\n\n\n\n\n\n\n \n from importlib.metadata import MetadataPathFinder\n return MetadataPathFinder.find_distributions(*args,**kwargs)\n \n \nclass FileFinder:\n\n ''\n\n\n\n\n \n \n def __init__(self,path,*loader_details):\n ''\n\n \n loaders=[]\n for loader,suffixes in loader_details:\n loaders.extend((suffix,loader)for suffix in suffixes)\n self._loaders=loaders\n \n if not path or path =='.':\n self.path=_os.getcwd()\n else:\n self.path=_path_abspath(path)\n self._path_mtime=-1\n self._path_cache=set()\n self._relaxed_path_cache=set()\n \n def invalidate_caches(self):\n ''\n self._path_mtime=-1\n \n def _get_spec(self,loader_class,fullname,path,smsl,target):\n loader=loader_class(fullname,path)\n return spec_from_file_location(fullname,path,loader=loader,\n submodule_search_locations=smsl)\n \n def find_spec(self,fullname,target=None):\n ''\n\n\n \n is_namespace=False\n tail_module=fullname.rpartition('.')[2]\n try:\n mtime=_path_stat(self.path or _os.getcwd()).st_mtime\n except OSError:\n mtime=-1\n if mtime !=self._path_mtime:\n self._fill_cache()\n self._path_mtime=mtime\n \n if _relax_case():\n cache=self._relaxed_path_cache\n cache_module=tail_module.lower()\n else:\n cache=self._path_cache\n cache_module=tail_module\n \n if cache_module in cache:\n base_path=_path_join(self.path,tail_module)\n for suffix,loader_class in self._loaders:\n init_filename='__init__'+suffix\n full_path=_path_join(base_path,init_filename)\n if _path_isfile(full_path):\n return self._get_spec(loader_class,fullname,full_path,[base_path],target)\n else:\n \n \n is_namespace=_path_isdir(base_path)\n \n for suffix,loader_class in self._loaders:\n try:\n full_path=_path_join(self.path,tail_module+suffix)\n except ValueError:\n return None\n _bootstrap._verbose_message('trying {}',full_path,verbosity=2)\n if cache_module+suffix in cache:\n if _path_isfile(full_path):\n return self._get_spec(loader_class,fullname,full_path,\n None,target)\n if is_namespace:\n _bootstrap._verbose_message('possible namespace for {}',base_path)\n spec=_bootstrap.ModuleSpec(fullname,None)\n spec.submodule_search_locations=[base_path]\n return spec\n return None\n \n def _fill_cache(self):\n ''\n path=self.path\n try:\n contents=_os.listdir(path or _os.getcwd())\n except(FileNotFoundError,PermissionError,NotADirectoryError):\n \n \n contents=[]\n \n \n if not sys.platform.startswith('win'):\n self._path_cache=set(contents)\n else:\n \n \n \n \n \n lower_suffix_contents=set()\n for item in contents:\n name,dot,suffix=item.partition('.')\n if dot:\n new_name=f'{name}.{suffix.lower()}'\n else:\n new_name=name\n lower_suffix_contents.add(new_name)\n self._path_cache=lower_suffix_contents\n if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS):\n self._relaxed_path_cache={fn.lower()for fn in contents}\n \n @classmethod\n def path_hook(cls,*loader_details):\n ''\n\n\n\n\n\n\n \n def path_hook_for_FileFinder(path):\n ''\n if not _path_isdir(path):\n raise ImportError('only directories are supported',path=path)\n return cls(path,*loader_details)\n \n return path_hook_for_FileFinder\n \n def __repr__(self):\n return f'FileFinder({self.path !r})'\n \n \n \n \ndef _fix_up_module(ns,name,pathname,cpathname=None):\n\n loader=ns.get('__loader__')\n spec=ns.get('__spec__')\n if not loader:\n if spec:\n loader=spec.loader\n elif pathname ==cpathname:\n loader=SourcelessFileLoader(name,pathname)\n else:\n loader=SourceFileLoader(name,pathname)\n if not spec:\n spec=spec_from_file_location(name,pathname,loader=loader)\n if cpathname:\n spec.cached=_path_abspath(cpathname)\n try:\n ns['__spec__']=spec\n ns['__loader__']=loader\n ns['__file__']=pathname\n ns['__cached__']=cpathname\n except Exception:\n \n pass\n \n \ndef _get_supported_file_loaders():\n ''\n\n\n \n extensions=ExtensionFileLoader,_imp.extension_suffixes()\n source=SourceFileLoader,SOURCE_SUFFIXES\n bytecode=SourcelessFileLoader,BYTECODE_SUFFIXES\n return[extensions,source,bytecode]\n \n \ndef _set_bootstrap_module(_bootstrap_module):\n global _bootstrap\n _bootstrap=_bootstrap_module\n \n \ndef _install(_bootstrap_module):\n ''\n _set_bootstrap_module(_bootstrap_module)\n supported_loaders=_get_supported_file_loaders()\n sys.path_hooks.extend([FileFinder.path_hook(*supported_loaders)])\n sys.meta_path.append(PathFinder)\n", ["_imp", "_io", "_warnings", "importlib.metadata", "importlib.readers", "marshal", "nt", "posix", "sys", "tokenize", "winreg"]], "importlib": [".py", "''\n__all__=['__import__','import_module','invalidate_caches','reload']\n\n\n\n\n\n\n\n\n\nimport _imp\nimport sys\n\ntry:\n import _frozen_importlib as _bootstrap\nexcept ImportError:\n from. import _bootstrap\n _bootstrap._setup(sys,_imp)\nelse:\n\n\n _bootstrap.__name__='importlib._bootstrap'\n _bootstrap.__package__='importlib'\n try:\n _bootstrap.__file__=__file__.replace('__init__.py','_bootstrap.py')\n except NameError:\n \n \n pass\n sys.modules['importlib._bootstrap']=_bootstrap\n \ntry:\n import _frozen_importlib_external as _bootstrap_external\nexcept ImportError:\n from. import _bootstrap_external\n _bootstrap_external._set_bootstrap_module(_bootstrap)\n _bootstrap._bootstrap_external=_bootstrap_external\nelse:\n _bootstrap_external.__name__='importlib._bootstrap_external'\n _bootstrap_external.__package__='importlib'\n try:\n _bootstrap_external.__file__=__file__.replace('__init__.py','_bootstrap_external.py')\n except NameError:\n \n \n pass\n sys.modules['importlib._bootstrap_external']=_bootstrap_external\n \n \n_pack_uint32=_bootstrap_external._pack_uint32\n_unpack_uint32=_bootstrap_external._unpack_uint32\n\n\n\n\nimport warnings\n\n\n\n\nfrom._bootstrap import __import__\n\n\ndef invalidate_caches():\n ''\n \n for finder in sys.meta_path:\n if hasattr(finder,'invalidate_caches'):\n finder.invalidate_caches()\n \n \ndef import_module(name,package=None):\n ''\n\n\n\n\n\n \n level=0\n if name.startswith('.'):\n if not package:\n raise TypeError(\"the 'package' argument is required to perform a \"\n f\"relative import for {name !r}\")\n for character in name:\n if character !='.':\n break\n level +=1\n return _bootstrap._gcd_import(name[level:],package,level)\n \n \n_RELOADING={}\n\n\ndef reload(module):\n ''\n\n\n\n \n try:\n name=module.__spec__.name\n except AttributeError:\n try:\n name=module.__name__\n except AttributeError:\n raise TypeError(\"reload() argument must be a module\")\n \n if sys.modules.get(name)is not module:\n raise ImportError(f\"module {name} not in sys.modules\",name=name)\n if name in _RELOADING:\n return _RELOADING[name]\n _RELOADING[name]=module\n try:\n parent_name=name.rpartition('.')[0]\n if parent_name:\n try:\n parent=sys.modules[parent_name]\n except KeyError:\n raise ImportError(f\"parent {parent_name !r} not in sys.modules\",\n name=parent_name)from None\n else:\n pkgpath=parent.__path__\n else:\n pkgpath=None\n target=module\n spec=module.__spec__=_bootstrap._find_spec(name,pkgpath,target)\n if spec is None:\n raise ModuleNotFoundError(f\"spec not found for the module {name !r}\",name=name)\n _bootstrap._exec(spec,module)\n \n return sys.modules[name]\n finally:\n try:\n del _RELOADING[name]\n except KeyError:\n pass\n", ["_frozen_importlib", "_frozen_importlib_external", "_imp", "importlib", "importlib._bootstrap", "importlib._bootstrap_external", "sys", "warnings"], 1], "importlib.metadata._adapters": [".py", "import re\nimport textwrap\nimport email.message\n\nfrom ._text import FoldedCase\n\n\nclass Message(email.message.Message):\n multiple_use_keys=set(\n map(\n FoldedCase,\n [\n 'Classifier',\n 'Obsoletes-Dist',\n 'Platform',\n 'Project-URL',\n 'Provides-Dist',\n 'Provides-Extra',\n 'Requires-Dist',\n 'Requires-External',\n 'Supported-Platform',\n 'Dynamic',\n ],\n )\n )\n ''\n\n \n \n def __new__(cls,orig:email.message.Message):\n res=super().__new__(cls)\n vars(res).update(vars(orig))\n return res\n \n def __init__(self,*args,**kwargs):\n self._headers=self._repair_headers()\n \n \n def __iter__(self):\n return super().__iter__()\n \n def _repair_headers(self):\n def redent(value):\n ''\n if not value or '\\n'not in value:\n return value\n return textwrap.dedent(' '*8+value)\n \n headers=[(key,redent(value))for key,value in vars(self)['_headers']]\n if self._payload:\n headers.append(('Description',self.get_payload()))\n return headers\n \n @property\n def json(self):\n ''\n\n\n \n \n def transform(key):\n value=self.get_all(key)if key in self.multiple_use_keys else self[key]\n if key =='Keywords':\n value=re.split(r'\\s+',value)\n tk=key.lower().replace('-','_')\n return tk,value\n \n return dict(map(transform,map(FoldedCase,self)))\n", ["email.message", "importlib.metadata._text", "re", "textwrap"]], "importlib.metadata._collections": [".py", "import collections\n\n\n\nclass FreezableDefaultDict(collections.defaultdict):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __missing__(self,key):\n return getattr(self,'_frozen',super().__missing__)(key)\n \n def freeze(self):\n self._frozen=lambda key:self.default_factory()\n \n \nclass Pair(collections.namedtuple('Pair','name value')):\n @classmethod\n def parse(cls,text):\n return cls(*map(str.strip,text.split(\"=\",1)))\n", ["collections"]], "importlib.metadata._functools": [".py", "import types\nimport functools\n\n\n\ndef method_cache(method,cache_wrapper=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n cache_wrapper=cache_wrapper or functools.lru_cache()\n \n def wrapper(self,*args,**kwargs):\n \n bound_method=types.MethodType(method,self)\n cached_method=cache_wrapper(bound_method)\n setattr(self,method.__name__,cached_method)\n return cached_method(*args,**kwargs)\n \n \n wrapper.cache_clear=lambda :None\n \n return wrapper\n \n \n \ndef pass_none(func):\n ''\n\n\n\n\n\n\n \n \n @functools.wraps(func)\n def wrapper(param,*args,**kwargs):\n if param is not None :\n return func(param,*args,**kwargs)\n \n return wrapper\n", ["functools", "types"]], "importlib.metadata._itertools": [".py", "from itertools import filterfalse\n\n\ndef unique_everseen(iterable,key=None ):\n ''\n \n \n seen=set()\n seen_add=seen.add\n if key is None :\n for element in filterfalse(seen.__contains__,iterable):\n seen_add(element)\n yield element\n else :\n for element in iterable:\n k=key(element)\n if k not in seen:\n seen_add(k)\n yield element\n \n \n \ndef always_iterable(obj,base_type=(str,bytes)):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if obj is None :\n return iter(())\n \n if (base_type is not None )and isinstance(obj,base_type):\n return iter((obj,))\n \n try :\n return iter(obj)\n except TypeError:\n return iter((obj,))\n", ["itertools"]], "importlib.metadata._meta": [".py", "from typing import Any,Dict,Iterator,List,Protocol,TypeVar,Union\n\n\n_T=TypeVar(\"_T\")\n\n\nclass PackageMetadata(Protocol):\n def __len__(self)->int:\n ...\n \n def __contains__(self,item:str)->bool:\n ...\n \n def __getitem__(self,key:str)->str:\n ...\n \n def __iter__(self)->Iterator[str]:\n ...\n \n def get_all(self,name:str,failobj:_T=...)->Union[List[Any],_T]:\n ''\n\n \n \n @property\n def json(self)->Dict[str,Union[str,List[str]]]:\n ''\n\n \n \n \nclass SimplePath(Protocol):\n ''\n\n \n \n def joinpath(self)->'SimplePath':\n ...\n \n def __truediv__(self)->'SimplePath':\n ...\n \n def parent(self)->'SimplePath':\n ...\n \n def read_text(self)->str:\n ...\n", ["typing"]], "importlib.metadata._text": [".py", "import re\n\nfrom ._functools import method_cache\n\n\n\nclass FoldedCase(str):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __lt__(self,other):\n return self.lower()other.lower()\n \n def __eq__(self,other):\n return self.lower()==other.lower()\n \n def __ne__(self,other):\n return self.lower()!=other.lower()\n \n def __hash__(self):\n return hash(self.lower())\n \n def __contains__(self,other):\n return super().lower().__contains__(other.lower())\n \n def in_(self,other):\n ''\n return self in FoldedCase(other)\n \n \n @method_cache\n def lower(self):\n return super().lower()\n \n def index(self,sub):\n return self.lower().index(sub.lower())\n \n def split(self,splitter=' ',maxsplit=0):\n pattern=re.compile(re.escape(splitter),re.I)\n return pattern.split(self,maxsplit)\n", ["importlib.metadata._functools", "re"]], "importlib.metadata": [".py", "import os\nimport re\nimport abc\nimport csv\nimport sys\nimport email\nimport pathlib\nimport zipfile\nimport operator\nimport textwrap\nimport warnings\nimport functools\nimport itertools\nimport posixpath\nimport collections\n\nfrom . import _adapters,_meta\nfrom ._collections import FreezableDefaultDict,Pair\nfrom ._functools import method_cache,pass_none\nfrom ._itertools import always_iterable,unique_everseen\nfrom ._meta import PackageMetadata,SimplePath\n\nfrom contextlib import suppress\nfrom importlib import import_module\nfrom importlib.abc import MetaPathFinder\nfrom itertools import starmap\nfrom typing import List,Mapping,Optional,Union\n\n\n__all__=[\n'Distribution',\n'DistributionFinder',\n'PackageMetadata',\n'PackageNotFoundError',\n'distribution',\n'distributions',\n'entry_points',\n'files',\n'metadata',\n'packages_distributions',\n'requires',\n'version',\n]\n\n\nclass PackageNotFoundError(ModuleNotFoundError):\n ''\n \n def __str__(self):\n return f\"No package metadata was found for {self.name}\"\n \n @property\n def name(self):\n (name,)=self.args\n return name\n \n \nclass Sectioned:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n _sample=textwrap.dedent(\n \"\"\"\n [sec1]\n # comments ignored\n a = 1\n b = 2\n\n [sec2]\n a = 2\n \"\"\"\n ).lstrip()\n \n @classmethod\n def section_pairs(cls,text):\n return (\n section._replace(value=Pair.parse(section.value))\n for section in cls.read(text,filter_=cls.valid)\n if section.name is not None\n )\n \n @staticmethod\n def read(text,filter_=None ):\n lines=filter(filter_,map(str.strip,text.splitlines()))\n name=None\n for value in lines:\n section_match=value.startswith('[')and value.endswith(']')\n if section_match:\n name=value.strip('[]')\n continue\n yield Pair(name,value)\n \n @staticmethod\n def valid(line):\n return line and not line.startswith('#')\n \n \nclass DeprecatedTuple:\n ''\n\n\n\n\n\n\n\n\n\n\n \n \n _warn=functools.partial(\n warnings.warn,\n \"EntryPoint tuple interface is deprecated. Access members by name.\",\n DeprecationWarning,\n stacklevel=2,\n )\n \n def __getitem__(self,item):\n self._warn()\n return self._key()[item]\n \n \nclass EntryPoint(DeprecatedTuple):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n pattern=re.compile(\n r'(?P[\\w.]+)\\s*'\n r'(:\\s*(?P[\\w.]+)\\s*)?'\n r'((?P\\[.*\\])\\s*)?$'\n )\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n name:str\n value:str\n group:str\n \n dist:Optional['Distribution']=None\n \n def __init__(self,name,value,group):\n vars(self).update(name=name,value=value,group=group)\n \n def load(self):\n ''\n\n\n \n match=self.pattern.match(self.value)\n module=import_module(match.group('module'))\n attrs=filter(None ,(match.group('attr')or '').split('.'))\n return functools.reduce(getattr,attrs,module)\n \n @property\n def module(self):\n match=self.pattern.match(self.value)\n return match.group('module')\n \n @property\n def attr(self):\n match=self.pattern.match(self.value)\n return match.group('attr')\n \n @property\n def extras(self):\n match=self.pattern.match(self.value)\n return re.findall(r'\\w+',match.group('extras')or '')\n \n def _for(self,dist):\n vars(self).update(dist=dist)\n return self\n \n def __iter__(self):\n ''\n\n \n msg=(\n \"Construction of dict of EntryPoints is deprecated in \"\n \"favor of EntryPoints.\"\n )\n warnings.warn(msg,DeprecationWarning)\n return iter((self.name,self))\n \n def matches(self,**params):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n attrs=(getattr(self,param)for param in params)\n return all(map(operator.eq,params.values(),attrs))\n \n def _key(self):\n return self.name,self.value,self.group\n \n def __lt__(self,other):\n return self._key()'\n \n \nclass Distribution:\n ''\n \n @abc.abstractmethod\n def read_text(self,filename):\n ''\n\n\n\n \n \n @abc.abstractmethod\n def locate_file(self,path):\n ''\n\n\n \n \n @classmethod\n def from_name(cls,name:str):\n ''\n\n\n\n\n\n\n\n \n if not name:\n raise ValueError(\"A distribution name is required.\")\n try :\n return next(cls.discover(name=name))\n except StopIteration:\n raise PackageNotFoundError(name)\n \n @classmethod\n def discover(cls,**kwargs):\n ''\n\n\n\n\n\n\n \n context=kwargs.pop('context',None )\n if context and kwargs:\n raise ValueError(\"cannot accept context and kwargs\")\n context=context or DistributionFinder.Context(**kwargs)\n return itertools.chain.from_iterable(\n resolver(context)for resolver in cls._discover_resolvers()\n )\n \n @staticmethod\n def at(path):\n ''\n\n\n\n \n return PathDistribution(pathlib.Path(path))\n \n @staticmethod\n def _discover_resolvers():\n ''\n declared=(\n getattr(finder,'find_distributions',None )for finder in sys.meta_path\n )\n return filter(None ,declared)\n \n @property\n def metadata(self)->_meta.PackageMetadata:\n ''\n\n\n\n \n text=(\n self.read_text('METADATA')\n or self.read_text('PKG-INFO')\n \n \n \n or self.read_text('')\n )\n return _adapters.Message(email.message_from_string(text))\n \n @property\n def name(self):\n ''\n return self.metadata['Name']\n \n @property\n def _normalized_name(self):\n ''\n return Prepared.normalize(self.name)\n \n @property\n def version(self):\n ''\n return self.metadata['Version']\n \n @property\n def entry_points(self):\n return EntryPoints._from_text_for(self.read_text('entry_points.txt'),self)\n \n @property\n def files(self):\n ''\n\n\n\n\n\n\n\n \n \n def make_file(name,hash=None ,size_str=None ):\n result=PackagePath(name)\n result.hash=FileHash(hash)if hash else None\n result.size=int(size_str)if size_str else None\n result.dist=self\n return result\n \n @pass_none\n def make_files(lines):\n return list(starmap(make_file,csv.reader(lines)))\n \n return make_files(self._read_files_distinfo()or self._read_files_egginfo())\n \n def _read_files_distinfo(self):\n ''\n\n \n text=self.read_text('RECORD')\n return text and text.splitlines()\n \n def _read_files_egginfo(self):\n ''\n\n\n \n text=self.read_text('SOURCES.txt')\n return text and map('\"{}\"'.format,text.splitlines())\n \n @property\n def requires(self):\n ''\n reqs=self._read_dist_info_reqs()or self._read_egg_info_reqs()\n return reqs and list(reqs)\n \n def _read_dist_info_reqs(self):\n return self.metadata.get_all('Requires-Dist')\n \n def _read_egg_info_reqs(self):\n source=self.read_text('requires.txt')\n return pass_none(self._deps_from_requires_text)(source)\n \n @classmethod\n def _deps_from_requires_text(cls,source):\n return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source))\n \n @staticmethod\n def _convert_egg_info_reqs_to_simple_reqs(sections):\n ''\n\n\n\n\n\n\n\n \n \n def make_condition(name):\n return name and f'extra == \"{name}\"'\n \n def quoted_marker(section):\n section=section or ''\n extra,sep,markers=section.partition(':')\n if extra and markers:\n markers=f'({markers})'\n conditions=list(filter(None ,[markers,make_condition(extra)]))\n return '; '+' and '.join(conditions)if conditions else ''\n \n def url_req_space(req):\n ''\n\n\n \n \n return ' '*('@'in req)\n \n for section in sections:\n space=url_req_space(section.value)\n yield section.value+space+quoted_marker(section.name)\n \n \nclass DistributionFinder(MetaPathFinder):\n ''\n\n \n \n class Context:\n ''\n\n\n\n\n\n\n\n\n \n \n name=None\n ''\n\n\n \n \n def __init__(self,**kwargs):\n vars(self).update(kwargs)\n \n @property\n def path(self):\n ''\n\n\n\n\n\n \n return vars(self).get('path',sys.path)\n \n @abc.abstractmethod\n def find_distributions(self,context=Context()):\n ''\n\n\n\n\n\n \n \n \nclass FastPath:\n ''\n\n\n\n\n\n \n \n @functools.lru_cache()\n def __new__(cls,root):\n return super().__new__(cls)\n \n def __init__(self,root):\n self.root=root\n \n def joinpath(self,child):\n return pathlib.Path(self.root,child)\n \n def children(self):\n with suppress(Exception):\n return os.listdir(self.root or '.')\n with suppress(Exception):\n return self.zip_children()\n return []\n \n def zip_children(self):\n zip_path=zipfile.Path(self.root)\n names=zip_path.root.namelist()\n self.joinpath=zip_path.joinpath\n \n return dict.fromkeys(child.split(posixpath.sep,1)[0]for child in names)\n \n def search(self,name):\n return self.lookup(self.mtime).search(name)\n \n @property\n def mtime(self):\n with suppress(OSError):\n return os.stat(self.root).st_mtime\n self.lookup.cache_clear()\n \n @method_cache\n def lookup(self,mtime):\n return Lookup(self)\n \n \nclass Lookup:\n def __init__(self,path:FastPath):\n base=os.path.basename(path.root).lower()\n base_is_egg=base.endswith(\".egg\")\n self.infos=FreezableDefaultDict(list)\n self.eggs=FreezableDefaultDict(list)\n \n for child in path.children():\n low=child.lower()\n if low.endswith((\".dist-info\",\".egg-info\")):\n \n name=low.rpartition(\".\")[0].partition(\"-\")[0]\n normalized=Prepared.normalize(name)\n self.infos[normalized].append(path.joinpath(child))\n elif base_is_egg and low ==\"egg-info\":\n name=base.rpartition(\".\")[0].partition(\"-\")[0]\n legacy_normalized=Prepared.legacy_normalize(name)\n self.eggs[legacy_normalized].append(path.joinpath(child))\n \n self.infos.freeze()\n self.eggs.freeze()\n \n def search(self,prepared):\n infos=(\n self.infos[prepared.normalized]\n if prepared\n else itertools.chain.from_iterable(self.infos.values())\n )\n eggs=(\n self.eggs[prepared.legacy_normalized]\n if prepared\n else itertools.chain.from_iterable(self.eggs.values())\n )\n return itertools.chain(infos,eggs)\n \n \nclass Prepared:\n ''\n\n \n \n normalized=None\n legacy_normalized=None\n \n def __init__(self,name):\n self.name=name\n if name is None :\n return\n self.normalized=self.normalize(name)\n self.legacy_normalized=self.legacy_normalize(name)\n \n @staticmethod\n def normalize(name):\n ''\n\n \n return re.sub(r\"[-_.]+\",\"-\",name).lower().replace('-','_')\n \n @staticmethod\n def legacy_normalize(name):\n ''\n\n\n \n return name.lower().replace('-','_')\n \n def __bool__(self):\n return bool(self.name)\n \n \nclass MetadataPathFinder(DistributionFinder):\n @classmethod\n def find_distributions(cls,context=DistributionFinder.Context()):\n ''\n\n\n\n\n\n\n \n found=cls._search_paths(context.name,context.path)\n return map(PathDistribution,found)\n \n @classmethod\n def _search_paths(cls,name,paths):\n ''\n prepared=Prepared(name)\n return itertools.chain.from_iterable(\n path.search(prepared)for path in map(FastPath,paths)\n )\n \n def invalidate_caches(cls):\n FastPath.__new__.cache_clear()\n \n \nclass PathDistribution(Distribution):\n def __init__(self,path:SimplePath):\n ''\n\n\n \n self._path=path\n \n def read_text(self,filename):\n with suppress(\n FileNotFoundError,\n IsADirectoryError,\n KeyError,\n NotADirectoryError,\n PermissionError,\n ):\n return self._path.joinpath(filename).read_text(encoding='utf-8')\n \n read_text.__doc__=Distribution.read_text.__doc__\n \n def locate_file(self,path):\n return self._path.parent /path\n \n @property\n def _normalized_name(self):\n ''\n\n\n \n stem=os.path.basename(str(self._path))\n return (\n pass_none(Prepared.normalize)(self._name_from_stem(stem))\n or super()._normalized_name\n )\n \n @staticmethod\n def _name_from_stem(stem):\n ''\n\n\n\n\n\n\n\n \n filename,ext=os.path.splitext(stem)\n if ext not in ('.dist-info','.egg-info'):\n return\n name,sep,rest=filename.partition('-')\n return name\n \n \ndef distribution(distribution_name):\n ''\n\n\n\n \n return Distribution.from_name(distribution_name)\n \n \ndef distributions(**kwargs):\n ''\n\n\n \n return Distribution.discover(**kwargs)\n \n \ndef metadata(distribution_name)->_meta.PackageMetadata:\n ''\n\n\n\n \n return Distribution.from_name(distribution_name).metadata\n \n \ndef version(distribution_name):\n ''\n\n\n\n\n \n return distribution(distribution_name).version\n \n \n_unique=functools.partial(\nunique_everseen,\nkey=operator.attrgetter('_normalized_name'),\n)\n''\n\n\n\n\ndef entry_points(**params)->Union[EntryPoints,SelectableGroups]:\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n eps=itertools.chain.from_iterable(\n dist.entry_points for dist in _unique(distributions())\n )\n return SelectableGroups.load(eps).select(**params)\n \n \ndef files(distribution_name):\n ''\n\n\n\n \n return distribution(distribution_name).files\n \n \ndef requires(distribution_name):\n ''\n\n\n\n\n \n return distribution(distribution_name).requires\n \n \ndef packages_distributions()->Mapping[str,List[str]]:\n ''\n\n\n\n\n\n\n\n \n pkg_to_dist=collections.defaultdict(list)\n for dist in distributions():\n for pkg in _top_level_declared(dist)or _top_level_inferred(dist):\n pkg_to_dist[pkg].append(dist.metadata['Name'])\n return dict(pkg_to_dist)\n \n \ndef _top_level_declared(dist):\n return (dist.read_text('top_level.txt')or '').split()\n \n \ndef _top_level_inferred(dist):\n return {\n f.parts[0]if len(f.parts)>1 else f.with_suffix('').name\n for f in always_iterable(dist.files)\n if f.suffix ==\".py\"\n }\n", ["abc", "collections", "contextlib", "csv", "email", "functools", "importlib", "importlib.abc", "importlib.metadata", "importlib.metadata._adapters", "importlib.metadata._collections", "importlib.metadata._functools", "importlib.metadata._itertools", "importlib.metadata._meta", "itertools", "operator", "os", "pathlib", "posixpath", "re", "sys", "textwrap", "typing", "warnings", "zipfile"], 1], "importlib.resources.abc": [".py", "import abc\nimport io\nimport os\nfrom typing import Any,BinaryIO,Iterable,Iterator,NoReturn,Text,Optional\nfrom typing import runtime_checkable,Protocol\nfrom typing import Union\n\n\nStrPath=Union[str,os.PathLike[str]]\n\n__all__=[\"ResourceReader\",\"Traversable\",\"TraversableResources\"]\n\n\nclass ResourceReader(metaclass=abc.ABCMeta):\n ''\n \n @abc.abstractmethod\n def open_resource(self,resource:Text)->BinaryIO:\n ''\n\n\n\n \n \n \n \n raise FileNotFoundError\n \n @abc.abstractmethod\n def resource_path(self,resource:Text)->Text:\n ''\n\n\n\n\n \n \n \n \n raise FileNotFoundError\n \n @abc.abstractmethod\n def is_resource(self,path:Text)->bool:\n ''\n\n\n \n raise FileNotFoundError\n \n @abc.abstractmethod\n def contents(self)->Iterable[str]:\n ''\n raise FileNotFoundError\n \n \n@runtime_checkable\nclass Traversable(Protocol):\n ''\n\n\n\n\n\n \n \n @abc.abstractmethod\n def iterdir(self)->Iterator[\"Traversable\"]:\n ''\n\n \n \n def read_bytes(self)->bytes:\n ''\n\n \n with self.open('rb')as strm:\n return strm.read()\n \n def read_text(self,encoding:Optional[str]=None )->str:\n ''\n\n \n with self.open(encoding=encoding)as strm:\n return strm.read()\n \n @abc.abstractmethod\n def is_dir(self)->bool:\n ''\n\n \n \n @abc.abstractmethod\n def is_file(self)->bool:\n ''\n\n \n \n @abc.abstractmethod\n def joinpath(self,*descendants:StrPath)->\"Traversable\":\n ''\n\n\n\n\n\n \n \n def __truediv__(self,child:StrPath)->\"Traversable\":\n ''\n\n \n return self.joinpath(child)\n \n @abc.abstractmethod\n def open(self,mode='r',*args,**kwargs):\n ''\n\n\n\n\n\n \n \n @abc.abstractproperty\n def name(self)->str:\n ''\n\n \n \n \nclass TraversableResources(ResourceReader):\n ''\n\n\n \n \n @abc.abstractmethod\n def files(self)->\"Traversable\":\n ''\n \n def open_resource(self,resource:StrPath)->io.BufferedReader:\n return self.files().joinpath(resource).open('rb')\n \n def resource_path(self,resource:Any)->NoReturn:\n raise FileNotFoundError(resource)\n \n def is_resource(self,path:StrPath)->bool:\n return self.files().joinpath(path).is_file()\n \n def contents(self)->Iterator[str]:\n return (item.name for item in self.files().iterdir())\n", ["abc", "io", "os", "typing"]], "importlib.resources.readers": [".py", "import collections\nimport operator\nimport pathlib\nimport zipfile\n\nfrom . import abc\n\nfrom ._itertools import unique_everseen\n\n\ndef remove_duplicates(items):\n return iter(collections.OrderedDict.fromkeys(items))\n \n \nclass FileReader(abc.TraversableResources):\n def __init__(self,loader):\n self.path=pathlib.Path(loader.path).parent\n \n def resource_path(self,resource):\n ''\n\n\n\n \n return str(self.path.joinpath(resource))\n \n def files(self):\n return self.path\n \n \nclass ZipReader(abc.TraversableResources):\n def __init__(self,loader,module):\n _,_,name=module.rpartition('.')\n self.prefix=loader.prefix.replace('\\\\','/')+name+'/'\n self.archive=loader.archive\n \n def open_resource(self,resource):\n try :\n return super().open_resource(resource)\n except KeyError as exc:\n raise FileNotFoundError(exc.args[0])\n \n def is_resource(self,path):\n \n \n target=self.files().joinpath(path)\n return target.is_file()and target.exists()\n \n def files(self):\n return zipfile.Path(self.archive,self.prefix)\n \n \nclass MultiplexedPath(abc.Traversable):\n ''\n\n\n\n\n \n \n def __init__(self,*paths):\n self._paths=list(map(pathlib.Path,remove_duplicates(paths)))\n if not self._paths:\n message='MultiplexedPath must contain at least one path'\n raise FileNotFoundError(message)\n if not all(path.is_dir()for path in self._paths):\n raise NotADirectoryError('MultiplexedPath only supports directories')\n \n def iterdir(self):\n files=(file for path in self._paths for file in path.iterdir())\n return unique_everseen(files,key=operator.attrgetter('name'))\n \n def read_bytes(self):\n raise FileNotFoundError(f'{self} is not a file')\n \n def read_text(self,*args,**kwargs):\n raise FileNotFoundError(f'{self} is not a file')\n \n def is_dir(self):\n return True\n \n def is_file(self):\n return False\n \n def joinpath(self,child):\n \n for file in self.iterdir():\n if file.name ==child:\n return file\n \n return self._paths[0]/child\n \n __truediv__=joinpath\n \n def open(self,*args,**kwargs):\n raise FileNotFoundError(f'{self} is not a file')\n \n @property\n def name(self):\n return self._paths[0].name\n \n def __repr__(self):\n paths=', '.join(f\"'{path}'\"for path in self._paths)\n return f'MultiplexedPath({paths})'\n \n \nclass NamespaceReader(abc.TraversableResources):\n def __init__(self,namespace_path):\n if 'NamespacePath'not in str(namespace_path):\n raise ValueError('Invalid path')\n self.path=MultiplexedPath(*list(namespace_path))\n \n def resource_path(self,resource):\n ''\n\n\n\n \n return str(self.path.joinpath(resource))\n \n def files(self):\n return self.path\n", ["collections", "importlib.resources", "importlib.resources._itertools", "importlib.resources.abc", "operator", "pathlib", "zipfile"]], "importlib.resources.simple": [".py", "''\n\n\n\nimport abc\nimport io\nimport itertools\nfrom typing import BinaryIO,List\n\nfrom .abc import Traversable,TraversableResources\n\n\nclass SimpleReader(abc.ABC):\n ''\n\n\n \n \n @abc.abstractproperty\n def package(self):\n \n ''\n\n \n \n @abc.abstractmethod\n def children(self):\n \n ''\n\n\n \n \n @abc.abstractmethod\n def resources(self):\n \n ''\n\n \n \n @abc.abstractmethod\n def open_binary(self,resource):\n \n ''\n\n \n \n @property\n def name(self):\n return self.package.split('.')[-1]\n \n \nclass ResourceHandle(Traversable):\n ''\n\n \n \n def __init__(self,parent,name):\n \n self.parent=parent\n self.name=name\n \n def is_file(self):\n return True\n \n def is_dir(self):\n return False\n \n def open(self,mode='r',*args,**kwargs):\n stream=self.parent.reader.open_binary(self.name)\n if 'b'not in mode:\n stream=io.TextIOWrapper(*args,**kwargs)\n return stream\n \n def joinpath(self,name):\n raise RuntimeError(\"Cannot traverse into a resource\")\n \n \nclass ResourceContainer(Traversable):\n ''\n\n \n \n def __init__(self,reader):\n \n self.reader=reader\n \n def is_dir(self):\n return True\n \n def is_file(self):\n return False\n \n def iterdir(self):\n files=(ResourceHandle(self,name)for name in self.reader.resources)\n dirs=map(ResourceContainer,self.reader.children())\n return itertools.chain(files,dirs)\n \n def open(self,*args,**kwargs):\n raise IsADirectoryError()\n \n @staticmethod\n def _flatten(compound_names):\n for name in compound_names:\n yield from name.split('/')\n \n def joinpath(self,*descendants):\n if not descendants:\n return self\n names=self._flatten(descendants)\n target=next(names)\n return next(\n traversable for traversable in self.iterdir()if traversable.name ==target\n ).joinpath(*names)\n \n \nclass TraversableReader(TraversableResources,SimpleReader):\n ''\n\n\n\n \n \n def files(self):\n return ResourceContainer(self)\n", ["abc", "importlib.resources.abc", "io", "itertools", "typing"]], "importlib.resources._adapters": [".py", "from contextlib import suppress\nfrom io import TextIOWrapper\n\nfrom . import abc\n\n\nclass SpecLoaderAdapter:\n ''\n\n \n \n def __init__(self,spec,adapter=lambda spec:spec.loader):\n self.spec=spec\n self.loader=adapter(spec)\n \n def __getattr__(self,name):\n return getattr(self.spec,name)\n \n \nclass TraversableResourcesLoader:\n ''\n\n \n \n def __init__(self,spec):\n self.spec=spec\n \n def get_resource_reader(self,name):\n return CompatibilityFiles(self.spec)._native()\n \n \ndef _io_wrapper(file,mode='r',*args,**kwargs):\n if mode =='r':\n return TextIOWrapper(file,*args,**kwargs)\n elif mode =='rb':\n return file\n raise ValueError(\n \"Invalid mode value '{}', only 'r' and 'rb' are supported\".format(mode)\n )\n \n \nclass CompatibilityFiles:\n ''\n\n\n \n \n class SpecPath(abc.Traversable):\n ''\n\n\n \n \n def __init__(self,spec,reader):\n self._spec=spec\n self._reader=reader\n \n def iterdir(self):\n if not self._reader:\n return iter(())\n return iter(\n CompatibilityFiles.ChildPath(self._reader,path)\n for path in self._reader.contents()\n )\n \n def is_file(self):\n return False\n \n is_dir=is_file\n \n def joinpath(self,other):\n if not self._reader:\n return CompatibilityFiles.OrphanPath(other)\n return CompatibilityFiles.ChildPath(self._reader,other)\n \n @property\n def name(self):\n return self._spec.name\n \n def open(self,mode='r',*args,**kwargs):\n return _io_wrapper(self._reader.open_resource(None ),mode,*args,**kwargs)\n \n class ChildPath(abc.Traversable):\n ''\n\n\n \n \n def __init__(self,reader,name):\n self._reader=reader\n self._name=name\n \n def iterdir(self):\n return iter(())\n \n def is_file(self):\n return self._reader.is_resource(self.name)\n \n def is_dir(self):\n return not self.is_file()\n \n def joinpath(self,other):\n return CompatibilityFiles.OrphanPath(self.name,other)\n \n @property\n def name(self):\n return self._name\n \n def open(self,mode='r',*args,**kwargs):\n return _io_wrapper(\n self._reader.open_resource(self.name),mode,*args,**kwargs\n )\n \n class OrphanPath(abc.Traversable):\n ''\n\n\n \n \n def __init__(self,*path_parts):\n if len(path_parts)<1:\n raise ValueError('Need at least one path part to construct a path')\n self._path=path_parts\n \n def iterdir(self):\n return iter(())\n \n def is_file(self):\n return False\n \n is_dir=is_file\n \n def joinpath(self,other):\n return CompatibilityFiles.OrphanPath(*self._path,other)\n \n @property\n def name(self):\n return self._path[-1]\n \n def open(self,mode='r',*args,**kwargs):\n raise FileNotFoundError(\"Can't open orphan path\")\n \n def __init__(self,spec):\n self.spec=spec\n \n @property\n def _reader(self):\n with suppress(AttributeError):\n return self.spec.loader.get_resource_reader(self.spec.name)\n \n def _native(self):\n ''\n\n \n reader=self._reader\n return reader if hasattr(reader,'files')else self\n \n def __getattr__(self,attr):\n return getattr(self._reader,attr)\n \n def files(self):\n return CompatibilityFiles.SpecPath(self.spec,self._reader)\n \n \ndef wrap_spec(package):\n ''\n\n\n \n return SpecLoaderAdapter(package.__spec__,TraversableResourcesLoader)\n", ["contextlib", "importlib.resources", "importlib.resources.abc", "io"]], "importlib.resources._common": [".py", "import os\nimport pathlib\nimport tempfile\nimport functools\nimport contextlib\nimport types\nimport importlib\n\nfrom typing import Union,Optional\nfrom .abc import ResourceReader,Traversable\n\nfrom ._adapters import wrap_spec\n\nPackage=Union[types.ModuleType,str]\n\n\ndef files(package):\n\n ''\n\n \n return from_package(get_package(package))\n \n \ndef get_resource_reader(package):\n\n ''\n\n \n \n \n \n \n \n spec=package.__spec__\n reader=getattr(spec.loader,'get_resource_reader',None )\n if reader is None :\n return None\n return reader(spec.name)\n \n \ndef resolve(cand):\n\n return cand if isinstance(cand,types.ModuleType)else importlib.import_module(cand)\n \n \ndef get_package(package):\n\n ''\n\n\n \n resolved=resolve(package)\n if wrap_spec(resolved).submodule_search_locations is None :\n raise TypeError(f'{package !r} is not a package')\n return resolved\n \n \ndef from_package(package):\n ''\n\n\n \n spec=wrap_spec(package)\n reader=spec.loader.get_resource_reader(spec.name)\n return reader.files()\n \n \n@contextlib.contextmanager\ndef _tempfile(reader,suffix='',\n\n\n*,_os_remove=os.remove):\n\n\n\n fd,raw_path=tempfile.mkstemp(suffix=suffix)\n try :\n try :\n os.write(fd,reader())\n finally :\n os.close(fd)\n del reader\n yield pathlib.Path(raw_path)\n finally :\n try :\n _os_remove(raw_path)\n except FileNotFoundError:\n pass\n \n \n@functools.singledispatch\ndef as_file(path):\n ''\n\n\n \n return _tempfile(path.read_bytes,suffix=path.name)\n \n \n@as_file.register(pathlib.Path)\n@contextlib.contextmanager\ndef _(path):\n ''\n\n \n yield path\n", ["contextlib", "functools", "importlib", "importlib.resources._adapters", "importlib.resources.abc", "os", "pathlib", "tempfile", "types", "typing"]], "importlib.resources._itertools": [".py", "from itertools import filterfalse\n\nfrom typing import (\nCallable,\nIterable,\nIterator,\nOptional,\nSet,\nTypeVar,\nUnion,\n)\n\n\n_T=TypeVar('_T')\n_U=TypeVar('_U')\n\n\ndef unique_everseen(\niterable:Iterable[_T],key:Optional[Callable[[_T],_U]]=None\n)->Iterator[_T]:\n ''\n \n \n seen:Set[Union[_T,_U]]=set()\n seen_add=seen.add\n if key is None :\n for element in filterfalse(seen.__contains__,iterable):\n seen_add(element)\n yield element\n else :\n for element in iterable:\n k=key(element)\n if k not in seen:\n seen_add(k)\n yield element\n", ["itertools", "typing"]], "importlib.resources._legacy": [".py", "import functools\nimport os\nimport pathlib\nimport types\nimport warnings\n\nfrom typing import Union,Iterable,ContextManager,BinaryIO,TextIO,Any\n\nfrom . import _common\n\nPackage=Union[types.ModuleType,str]\nResource=str\n\n\ndef deprecated(func):\n @functools.wraps(func)\n def wrapper(*args,**kwargs):\n warnings.warn(\n f\"{func.__name__} is deprecated. Use files() instead. \"\n \"Refer to https://importlib-resources.readthedocs.io\"\n \"/en/latest/using.html#migrating-from-legacy for migration advice.\",\n DeprecationWarning,\n stacklevel=2,\n )\n return func(*args,**kwargs)\n \n return wrapper\n \n \ndef normalize_path(path):\n\n ''\n\n\n \n str_path=str(path)\n parent,file_name=os.path.split(str_path)\n if parent:\n raise ValueError(f'{path !r} must be only a file name')\n return file_name\n \n \n@deprecated\ndef open_binary(package:Package,resource:Resource)->BinaryIO:\n ''\n return (_common.files(package)/normalize_path(resource)).open('rb')\n \n \n@deprecated\ndef read_binary(package:Package,resource:Resource)->bytes:\n ''\n return (_common.files(package)/normalize_path(resource)).read_bytes()\n \n \n@deprecated\ndef open_text(\npackage:Package,\nresource:Resource,\nencoding:str='utf-8',\nerrors:str='strict',\n)->TextIO:\n ''\n return (_common.files(package)/normalize_path(resource)).open(\n 'r',encoding=encoding,errors=errors\n )\n \n \n@deprecated\ndef read_text(\npackage:Package,\nresource:Resource,\nencoding:str='utf-8',\nerrors:str='strict',\n)->str:\n ''\n\n\n\n \n with open_text(package,resource,encoding,errors)as fp:\n return fp.read()\n \n \n@deprecated\ndef contents(package:Package)->Iterable[str]:\n ''\n\n\n\n\n \n return [path.name for path in _common.files(package).iterdir()]\n \n \n@deprecated\ndef is_resource(package:Package,name:str)->bool:\n ''\n\n\n \n resource=normalize_path(name)\n return any(\n traversable.name ==resource and traversable.is_file()\n for traversable in _common.files(package).iterdir()\n )\n \n \n@deprecated\ndef path(\npackage:Package,\nresource:Resource,\n)->ContextManager[pathlib.Path]:\n ''\n\n\n\n\n\n\n \n return _common.as_file(_common.files(package)/normalize_path(resource))\n", ["functools", "importlib.resources", "importlib.resources._common", "os", "pathlib", "types", "typing", "warnings"]], "importlib.resources": [".py", "''\n\nfrom ._common import (\nas_file,\nfiles,\nPackage,\n)\n\nfrom ._legacy import (\ncontents,\nopen_binary,\nread_binary,\nopen_text,\nread_text,\nis_resource,\npath,\nResource,\n)\n\nfrom .abc import ResourceReader\n\n\n__all__=[\n'Package',\n'Resource',\n'ResourceReader',\n'as_file',\n'contents',\n'files',\n'is_resource',\n'open_binary',\n'open_text',\n'path',\n'read_binary',\n'read_text',\n]\n", ["importlib.resources._common", "importlib.resources._legacy", "importlib.resources.abc"], 1], "json.encoder": [".py", "''\n\nimport re\n\ntry :\n from _json import encode_basestring_ascii as c_encode_basestring_ascii\nexcept ImportError:\n c_encode_basestring_ascii=None\ntry :\n from _json import encode_basestring as c_encode_basestring\nexcept ImportError:\n c_encode_basestring=None\ntry :\n from _json import make_encoder as c_make_encoder\nexcept ImportError:\n c_make_encoder=None\n \nESCAPE=re.compile(r'[\\x00-\\x1f\\\\\"\\b\\f\\n\\r\\t]')\nESCAPE_ASCII=re.compile(r'([\\\\\"]|[^\\ -~])')\nHAS_UTF8=re.compile(b'[\\x80-\\xff]')\nESCAPE_DCT={\n'\\\\':'\\\\\\\\',\n'\"':'\\\\\"',\n'\\b':'\\\\b',\n'\\f':'\\\\f',\n'\\n':'\\\\n',\n'\\r':'\\\\r',\n'\\t':'\\\\t',\n}\nfor i in range(0x20):\n ESCAPE_DCT.setdefault(chr(i),'\\\\u{0:04x}'.format(i))\n \ndel i\n\nINFINITY=float('inf')\n\ndef py_encode_basestring(s):\n ''\n\n \n def replace(match):\n return ESCAPE_DCT[match.group(0)]\n return '\"'+ESCAPE.sub(replace,s)+'\"'\n \n \nencode_basestring=(c_encode_basestring or py_encode_basestring)\n\n\ndef py_encode_basestring_ascii(s):\n ''\n\n \n def replace(match):\n s=match.group(0)\n try :\n return ESCAPE_DCT[s]\n except KeyError:\n n=ord(s)\n if n <0x10000:\n return '\\\\u{0:04x}'.format(n)\n \n else :\n \n n -=0x10000\n s1=0xd800 |((n >>10)&0x3ff)\n s2=0xdc00 |(n&0x3ff)\n return '\\\\u{0:04x}\\\\u{1:04x}'.format(s1,s2)\n return '\"'+ESCAPE_ASCII.sub(replace,s)+'\"'\n \n \nencode_basestring_ascii=(\nc_encode_basestring_ascii or py_encode_basestring_ascii)\n\nclass JSONEncoder(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n item_separator=', '\n key_separator=': '\n def __init__(self,*,skipkeys=False ,ensure_ascii=True ,\n check_circular=True ,allow_nan=True ,sort_keys=False ,\n indent=None ,separators=None ,default=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n self.skipkeys=skipkeys\n self.ensure_ascii=ensure_ascii\n self.check_circular=check_circular\n self.allow_nan=allow_nan\n self.sort_keys=sort_keys\n self.indent=indent\n if separators is not None :\n self.item_separator,self.key_separator=separators\n elif indent is not None :\n self.item_separator=','\n if default is not None :\n self.default=default\n \n def default(self,o):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n raise TypeError(f'Object of type {o.__class__.__name__} '\n f'is not JSON serializable')\n \n def encode(self,o):\n ''\n\n\n\n\n\n \n \n if isinstance(o,str):\n if self.ensure_ascii:\n return encode_basestring_ascii(o)\n else :\n return encode_basestring(o)\n \n \n \n chunks=self.iterencode(o,_one_shot=True )\n if not isinstance(chunks,(list,tuple)):\n chunks=list(chunks)\n return ''.join(chunks)\n \n def iterencode(self,o,_one_shot=False ):\n ''\n\n\n\n\n\n\n\n \n if self.check_circular:\n markers={}\n else :\n markers=None\n if self.ensure_ascii:\n _encoder=encode_basestring_ascii\n else :\n _encoder=encode_basestring\n \n def floatstr(o,allow_nan=self.allow_nan,\n _repr=float.__repr__,_inf=INFINITY,_neginf=-INFINITY):\n \n \n \n \n if o !=o:\n text='NaN'\n elif o ==_inf:\n text='Infinity'\n elif o ==_neginf:\n text='-Infinity'\n else :\n return _repr(o)\n \n if not allow_nan:\n raise ValueError(\n \"Out of range float values are not JSON compliant: \"+\n repr(o))\n \n return text\n \n \n if (_one_shot and c_make_encoder is not None\n and self.indent is None ):\n _iterencode=c_make_encoder(\n markers,self.default,_encoder,self.indent,\n self.key_separator,self.item_separator,self.sort_keys,\n self.skipkeys,self.allow_nan)\n else :\n _iterencode=_make_iterencode(\n markers,self.default,_encoder,self.indent,floatstr,\n self.key_separator,self.item_separator,self.sort_keys,\n self.skipkeys,_one_shot)\n return _iterencode(o,0)\n \ndef _make_iterencode(markers,_default,_encoder,_indent,_floatstr,\n_key_separator,_item_separator,_sort_keys,_skipkeys,_one_shot,\n\nValueError=ValueError,\ndict=dict,\nfloat=float,\nid=id,\nint=int,\nisinstance=isinstance,\nlist=list,\nstr=str,\ntuple=tuple,\n_intstr=int.__repr__,\n):\n\n if _indent is not None and not isinstance(_indent,str):\n _indent=' '*_indent\n \n def _iterencode_list(lst,_current_indent_level):\n if not lst:\n yield '[]'\n return\n if markers is not None :\n markerid=id(lst)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid]=lst\n buf='['\n if _indent is not None :\n _current_indent_level +=1\n newline_indent='\\n'+_indent *_current_indent_level\n separator=_item_separator+newline_indent\n buf +=newline_indent\n else :\n newline_indent=None\n separator=_item_separator\n first=True\n for value in lst:\n if first:\n first=False\n else :\n buf=separator\n if isinstance(value,str):\n yield buf+_encoder(value)\n elif value is None :\n yield buf+'null'\n elif value is True :\n yield buf+'true'\n elif value is False :\n yield buf+'false'\n elif isinstance(value,int):\n \n \n \n yield buf+_intstr(value)\n elif isinstance(value,float):\n \n yield buf+_floatstr(value)\n else :\n yield buf\n if isinstance(value,(list,tuple)):\n chunks=_iterencode_list(value,_current_indent_level)\n elif isinstance(value,dict):\n chunks=_iterencode_dict(value,_current_indent_level)\n else :\n chunks=_iterencode(value,_current_indent_level)\n yield from chunks\n if newline_indent is not None :\n _current_indent_level -=1\n yield '\\n'+_indent *_current_indent_level\n yield ']'\n if markers is not None :\n del markers[markerid]\n \n def _iterencode_dict(dct,_current_indent_level):\n if not dct:\n yield '{}'\n return\n if markers is not None :\n markerid=id(dct)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid]=dct\n yield '{'\n if _indent is not None :\n _current_indent_level +=1\n newline_indent='\\n'+_indent *_current_indent_level\n item_separator=_item_separator+newline_indent\n yield newline_indent\n else :\n newline_indent=None\n item_separator=_item_separator\n first=True\n if _sort_keys:\n items=sorted(dct.items())\n else :\n items=dct.items()\n for key,value in items:\n if isinstance(key,str):\n pass\n \n \n elif isinstance(key,float):\n \n key=_floatstr(key)\n elif key is True :\n key='true'\n elif key is False :\n key='false'\n elif key is None :\n key='null'\n elif isinstance(key,int):\n \n key=_intstr(key)\n elif _skipkeys:\n continue\n else :\n raise TypeError(f'keys must be str, int, float, bool or None, '\n f'not {key.__class__.__name__}')\n if first:\n first=False\n else :\n yield item_separator\n yield _encoder(key)\n yield _key_separator\n if isinstance(value,str):\n yield _encoder(value)\n elif value is None :\n yield 'null'\n elif value is True :\n yield 'true'\n elif value is False :\n yield 'false'\n elif isinstance(value,int):\n \n yield _intstr(value)\n elif isinstance(value,float):\n \n yield _floatstr(value)\n else :\n if isinstance(value,(list,tuple)):\n chunks=_iterencode_list(value,_current_indent_level)\n elif isinstance(value,dict):\n chunks=_iterencode_dict(value,_current_indent_level)\n else :\n chunks=_iterencode(value,_current_indent_level)\n yield from chunks\n if newline_indent is not None :\n _current_indent_level -=1\n yield '\\n'+_indent *_current_indent_level\n yield '}'\n if markers is not None :\n del markers[markerid]\n \n def _iterencode(o,_current_indent_level):\n if isinstance(o,str):\n yield _encoder(o)\n elif o is None :\n yield 'null'\n elif o is True :\n yield 'true'\n elif o is False :\n yield 'false'\n elif isinstance(o,int):\n \n yield _intstr(o)\n elif isinstance(o,float):\n \n yield _floatstr(o)\n elif isinstance(o,(list,tuple)):\n yield from _iterencode_list(o,_current_indent_level)\n elif isinstance(o,dict):\n yield from _iterencode_dict(o,_current_indent_level)\n else :\n if markers is not None :\n markerid=id(o)\n if markerid in markers:\n raise ValueError(\"Circular reference detected\")\n markers[markerid]=o\n o=_default(o)\n yield from _iterencode(o,_current_indent_level)\n if markers is not None :\n del markers[markerid]\n return _iterencode\n", ["_json", "re"]], "json": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__version__='2.0.9'\n__all__=[\n'dump','dumps','load','loads',\n'JSONDecoder','JSONDecodeError','JSONEncoder',\n]\n\n__author__='Bob Ippolito '\n\n\n\n\n\nclass codecs:\n\n BOM_UTF8=b'\\xef\\xbb\\xbf'\n BOM_LE=BOM_UTF16_LE=b'\\xff\\xfe'\n BOM_BE=BOM_UTF16_BE=b'\\xfe\\xff'\n BOM_UTF32_LE=b'\\xff\\xfe\\x00\\x00'\n BOM_UTF32_BE=b'\\x00\\x00\\xfe\\xff'\n \n \nimport _json\nfrom .encoder import JSONEncoder\n\nJSONDecoder=_json.JSONDecoder\n\nclass decoder:\n JSONDecoder=_json.JSONDecoder\n \nclass JSONDecodeError(ValueError):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,msg,doc,pos):\n lineno=doc.count('\\n',0,pos)+1\n colno=pos -doc.rfind('\\n',0,pos)\n errmsg='%s: line %d column %d (char %d)'%(msg,lineno,colno,pos)\n ValueError.__init__(self,errmsg)\n self.msg=msg\n self.doc=doc\n self.pos=pos\n self.lineno=lineno\n self.colno=colno\n \n def __reduce__(self):\n return self.__class__,(self.msg,self.doc,self.pos)\n \ndef dump(obj,fp,**kw):\n fp.write(dumps(obj,**kw))\n \ndef dumps(obj,*,skipkeys=False ,ensure_ascii=True ,check_circular=True ,\nallow_nan=True ,cls=None ,indent=None ,separators=None ,\ndefault=None ,sort_keys=False ,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if cls is None :\n return _json.dumps(obj,1,**kw)\n return cls(\n skipkeys=skipkeys,ensure_ascii=ensure_ascii,\n check_circular=check_circular,allow_nan=allow_nan,indent=indent,\n separators=separators,default=default,sort_keys=sort_keys,\n **kw).encode(obj)\n \ndef detect_encoding(b):\n bstartswith=b.startswith\n if bstartswith((codecs.BOM_UTF32_BE,codecs.BOM_UTF32_LE)):\n return 'utf-32'\n if bstartswith((codecs.BOM_UTF16_BE,codecs.BOM_UTF16_LE)):\n return 'utf-16'\n if bstartswith(codecs.BOM_UTF8):\n return 'utf-8-sig'\n \n if len(b)>=4:\n if not b[0]:\n \n \n return 'utf-16-be'if b[1]else 'utf-32-be'\n if not b[1]:\n \n \n \n return 'utf-16-le'if b[2]or b[3]else 'utf-32-le'\n elif len(b)==2:\n if not b[0]:\n \n return 'utf-16-be'\n if not b[1]:\n \n return 'utf-16-le'\n \n return 'utf-8'\n \n \ndef load(fp,*,cls=None ,object_hook=None ,parse_float=None ,\nparse_int=None ,parse_constant=None ,object_pairs_hook=None ,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n return loads(fp.read(),\n cls=cls,object_hook=object_hook,\n parse_float=parse_float,parse_int=parse_int,\n parse_constant=parse_constant,object_pairs_hook=object_pairs_hook,**kw)\n \n \ndef loads(s,*,cls=None ,**kw):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(s,str):\n if s.startswith('\\ufeff'):\n raise JSONDecodeError(\"Unexpected UTF-8 BOM (decode using utf-8-sig)\",\n s,0)\n else :\n if not isinstance(s,(bytes,bytearray)):\n raise TypeError(f'the JSON object must be str, bytes or bytearray, '\n f'not {s.__class__.__name__}')\n s=s.decode(detect_encoding(s),'surrogatepass')\n \n \n if \"encoding\"in kw:\n import warnings\n warnings.warn(\n \"'encoding' is ignored and deprecated. It will be removed in Python 3.9\",\n DeprecationWarning,\n stacklevel=2\n )\n del kw['encoding']\n \n if cls is None :\n \n \n return _json.loads(s,**kw)\n if object_hook is not None :\n kw['object_hook']=object_hook\n if object_pairs_hook is not None :\n kw['object_pairs_hook']=object_pairs_hook\n if parse_float is not None :\n kw['parse_float']=parse_float\n if parse_int is not None :\n kw['parse_int']=parse_int\n if parse_constant is not None :\n kw['parse_constant']=parse_constant\n return cls(**kw).decode(s)\n", ["_json", "json.encoder", "warnings"], 1], "logging.brython_handlers": [".py", "import logging\n\nfrom browser.ajax import ajax\n\n\nclass XMLHTTPHandler(logging.Handler):\n ''\n\n\n \n def __init__(self,url,method=\"GET\"):\n ''\n\n\n \n logging.Handler.__init__(self)\n method=method.upper()\n if method not in [\"GET\",\"POST\"]:\n raise ValueError(\"method must be GET or POST\")\n self.url=url\n self.method=method\n \n def mapLogRecord(self,record):\n ''\n\n\n\n \n return record.__dict__\n \n def emit(self,record):\n ''\n\n\n\n \n try :\n req=ajax.open(self.method,self.url,sync=False )\n req.send(self.mapLogRecord(record))\n except :\n self.handleError(record)\n", ["browser.ajax", "logging"]], "logging.config": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"\"\nConfiguration functions for the logging package for Python. The core package\nis based on PEP 282 and comments thereto in comp.lang.python, and influenced\nby Apache's log4j system.\n\nCopyright (C) 2001-2022 Vinay Sajip. All Rights Reserved.\n\nTo use, simply 'import logging' and log away!\n\"\"\"\n\nimport errno\nimport functools\nimport io\nimport logging\nimport logging.handlers\nimport os\nimport queue\nimport re\nimport struct\nimport threading\nimport traceback\n\nfrom socketserver import ThreadingTCPServer,StreamRequestHandler\n\n\nDEFAULT_LOGGING_CONFIG_PORT=9030\n\nRESET_ERROR=errno.ECONNRESET\n\n\n\n\n\n\n_listener=None\n\ndef fileConfig(fname,defaults=None,disable_existing_loggers=True,encoding=None):\n ''\n\n\n\n\n\n\n \n import configparser\n \n if isinstance(fname,str):\n if not os.path.exists(fname):\n raise FileNotFoundError(f\"{fname} doesn't exist\")\n elif not os.path.getsize(fname):\n raise RuntimeError(f'{fname} is an empty file')\n \n if isinstance(fname,configparser.RawConfigParser):\n cp=fname\n else:\n try:\n cp=configparser.ConfigParser(defaults)\n if hasattr(fname,'readline'):\n cp.read_file(fname)\n else:\n encoding=io.text_encoding(encoding)\n cp.read(fname,encoding=encoding)\n except configparser.ParsingError as e:\n raise RuntimeError(f'{fname} is invalid: {e}')\n \n formatters=_create_formatters(cp)\n \n \n logging._acquireLock()\n try:\n _clearExistingHandlers()\n \n \n handlers=_install_handlers(cp,formatters)\n _install_loggers(cp,handlers,disable_existing_loggers)\n finally:\n logging._releaseLock()\n \n \ndef _resolve(name):\n ''\n name=name.split('.')\n used=name.pop(0)\n found=__import__(used)\n for n in name:\n used=used+'.'+n\n try:\n found=getattr(found,n)\n except AttributeError:\n __import__(used)\n found=getattr(found,n)\n return found\n \ndef _strip_spaces(alist):\n return map(str.strip,alist)\n \ndef _create_formatters(cp):\n ''\n flist=cp[\"formatters\"][\"keys\"]\n if not len(flist):\n return{}\n flist=flist.split(\",\")\n flist=_strip_spaces(flist)\n formatters={}\n for form in flist:\n sectname=\"formatter_%s\"%form\n fs=cp.get(sectname,\"format\",raw=True,fallback=None)\n dfs=cp.get(sectname,\"datefmt\",raw=True,fallback=None)\n stl=cp.get(sectname,\"style\",raw=True,fallback='%')\n defaults=cp.get(sectname,\"defaults\",raw=True,fallback=None)\n \n c=logging.Formatter\n class_name=cp[sectname].get(\"class\")\n if class_name:\n c=_resolve(class_name)\n \n if defaults is not None:\n defaults=eval(defaults,vars(logging))\n f=c(fs,dfs,stl,defaults=defaults)\n else:\n f=c(fs,dfs,stl)\n formatters[form]=f\n return formatters\n \n \ndef _install_handlers(cp,formatters):\n ''\n hlist=cp[\"handlers\"][\"keys\"]\n if not len(hlist):\n return{}\n hlist=hlist.split(\",\")\n hlist=_strip_spaces(hlist)\n handlers={}\n fixups=[]\n for hand in hlist:\n section=cp[\"handler_%s\"%hand]\n klass=section[\"class\"]\n fmt=section.get(\"formatter\",\"\")\n try:\n klass=eval(klass,vars(logging))\n except(AttributeError,NameError):\n klass=_resolve(klass)\n args=section.get(\"args\",'()')\n args=eval(args,vars(logging))\n kwargs=section.get(\"kwargs\",'{}')\n kwargs=eval(kwargs,vars(logging))\n h=klass(*args,**kwargs)\n h.name=hand\n if \"level\"in section:\n level=section[\"level\"]\n h.setLevel(level)\n if len(fmt):\n h.setFormatter(formatters[fmt])\n if issubclass(klass,logging.handlers.MemoryHandler):\n target=section.get(\"target\",\"\")\n if len(target):\n fixups.append((h,target))\n handlers[hand]=h\n \n for h,t in fixups:\n h.setTarget(handlers[t])\n return handlers\n \ndef _handle_existing_loggers(existing,child_loggers,disable_existing):\n ''\n\n\n\n\n\n\n\n\n \n root=logging.root\n for log in existing:\n logger=root.manager.loggerDict[log]\n if log in child_loggers:\n if not isinstance(logger,logging.PlaceHolder):\n logger.setLevel(logging.NOTSET)\n logger.handlers=[]\n logger.propagate=True\n else:\n logger.disabled=disable_existing\n \ndef _install_loggers(cp,handlers,disable_existing):\n ''\n \n \n llist=cp[\"loggers\"][\"keys\"]\n llist=llist.split(\",\")\n llist=list(_strip_spaces(llist))\n llist.remove(\"root\")\n section=cp[\"logger_root\"]\n root=logging.root\n log=root\n if \"level\"in section:\n level=section[\"level\"]\n log.setLevel(level)\n for h in root.handlers[:]:\n root.removeHandler(h)\n hlist=section[\"handlers\"]\n if len(hlist):\n hlist=hlist.split(\",\")\n hlist=_strip_spaces(hlist)\n for hand in hlist:\n log.addHandler(handlers[hand])\n \n \n \n \n \n \n \n \n \n \n existing=list(root.manager.loggerDict.keys())\n \n \n \n \n existing.sort()\n \n \n child_loggers=[]\n \n for log in llist:\n section=cp[\"logger_%s\"%log]\n qn=section[\"qualname\"]\n propagate=section.getint(\"propagate\",fallback=1)\n logger=logging.getLogger(qn)\n if qn in existing:\n i=existing.index(qn)+1\n prefixed=qn+\".\"\n pflen=len(prefixed)\n num_existing=len(existing)\n while i [a-z]+)://(?P.*)$')\n \n WORD_PATTERN=re.compile(r'^\\s*(\\w+)\\s*')\n DOT_PATTERN=re.compile(r'^\\.\\s*(\\w+)\\s*')\n INDEX_PATTERN=re.compile(r'^\\[\\s*(\\w+)\\s*\\]\\s*')\n DIGIT_PATTERN=re.compile(r'^\\d+$')\n \n value_converters={\n 'ext':'ext_convert',\n 'cfg':'cfg_convert',\n }\n \n \n importer=staticmethod(__import__)\n \n def __init__(self,config):\n self.config=ConvertingDict(config)\n self.config.configurator=self\n \n def resolve(self,s):\n ''\n\n\n \n name=s.split('.')\n used=name.pop(0)\n try:\n found=self.importer(used)\n for frag in name:\n used +='.'+frag\n try:\n found=getattr(found,frag)\n except AttributeError:\n self.importer(used)\n found=getattr(found,frag)\n return found\n except ImportError as e:\n v=ValueError('Cannot resolve %r: %s'%(s,e))\n raise v from e\n \n def ext_convert(self,value):\n ''\n return self.resolve(value)\n \n def cfg_convert(self,value):\n ''\n rest=value\n m=self.WORD_PATTERN.match(rest)\n if m is None:\n raise ValueError(\"Unable to convert %r\"%value)\n else:\n rest=rest[m.end():]\n d=self.config[m.groups()[0]]\n \n while rest:\n m=self.DOT_PATTERN.match(rest)\n if m:\n d=d[m.groups()[0]]\n else:\n m=self.INDEX_PATTERN.match(rest)\n if m:\n idx=m.groups()[0]\n if not self.DIGIT_PATTERN.match(idx):\n d=d[idx]\n else:\n try:\n n=int(idx)\n d=d[n]\n except TypeError:\n d=d[idx]\n if m:\n rest=rest[m.end():]\n else:\n raise ValueError('Unable to convert '\n '%r at %r'%(value,rest))\n \n return d\n \n def convert(self,value):\n ''\n\n\n\n \n if not isinstance(value,ConvertingDict)and isinstance(value,dict):\n value=ConvertingDict(value)\n value.configurator=self\n elif not isinstance(value,ConvertingList)and isinstance(value,list):\n value=ConvertingList(value)\n value.configurator=self\n elif not isinstance(value,ConvertingTuple)and\\\n isinstance(value,tuple)and not hasattr(value,'_fields'):\n value=ConvertingTuple(value)\n value.configurator=self\n elif isinstance(value,str):\n m=self.CONVERT_PATTERN.match(value)\n if m:\n d=m.groupdict()\n prefix=d['prefix']\n converter=self.value_converters.get(prefix,None)\n if converter:\n suffix=d['suffix']\n converter=getattr(self,converter)\n value=converter(suffix)\n return value\n \n def configure_custom(self,config):\n ''\n c=config.pop('()')\n if not callable(c):\n c=self.resolve(c)\n props=config.pop('.',None)\n \n kwargs={k:config[k]for k in config if valid_ident(k)}\n result=c(**kwargs)\n if props:\n for name,value in props.items():\n setattr(result,name,value)\n return result\n \n def as_tuple(self,value):\n ''\n if isinstance(value,list):\n value=tuple(value)\n return value\n \nclass DictConfigurator(BaseConfigurator):\n ''\n\n\n \n \n def configure(self):\n ''\n \n config=self.config\n if 'version'not in config:\n raise ValueError(\"dictionary doesn't specify a version\")\n if config['version']!=1:\n raise ValueError(\"Unsupported version: %s\"%config['version'])\n incremental=config.pop('incremental',False)\n EMPTY_DICT={}\n logging._acquireLock()\n try:\n if incremental:\n handlers=config.get('handlers',EMPTY_DICT)\n for name in handlers:\n if name not in logging._handlers:\n raise ValueError('No handler found with '\n 'name %r'%name)\n else:\n try:\n handler=logging._handlers[name]\n handler_config=handlers[name]\n level=handler_config.get('level',None)\n if level:\n handler.setLevel(logging._checkLevel(level))\n except Exception as e:\n raise ValueError('Unable to configure handler '\n '%r'%name)from e\n loggers=config.get('loggers',EMPTY_DICT)\n for name in loggers:\n try:\n self.configure_logger(name,loggers[name],True)\n except Exception as e:\n raise ValueError('Unable to configure logger '\n '%r'%name)from e\n root=config.get('root',None)\n if root:\n try:\n self.configure_root(root,True)\n except Exception as e:\n raise ValueError('Unable to configure root '\n 'logger')from e\n else:\n disable_existing=config.pop('disable_existing_loggers',True)\n \n _clearExistingHandlers()\n \n \n formatters=config.get('formatters',EMPTY_DICT)\n for name in formatters:\n try:\n formatters[name]=self.configure_formatter(\n formatters[name])\n except Exception as e:\n raise ValueError('Unable to configure '\n 'formatter %r'%name)from e\n \n filters=config.get('filters',EMPTY_DICT)\n for name in filters:\n try:\n filters[name]=self.configure_filter(filters[name])\n except Exception as e:\n raise ValueError('Unable to configure '\n 'filter %r'%name)from e\n \n \n \n \n handlers=config.get('handlers',EMPTY_DICT)\n deferred=[]\n for name in sorted(handlers):\n try:\n handler=self.configure_handler(handlers[name])\n handler.name=name\n handlers[name]=handler\n except Exception as e:\n if ' not configured yet'in str(e.__cause__):\n deferred.append(name)\n else:\n raise ValueError('Unable to configure handler '\n '%r'%name)from e\n \n \n for name in deferred:\n try:\n handler=self.configure_handler(handlers[name])\n handler.name=name\n handlers[name]=handler\n except Exception as e:\n raise ValueError('Unable to configure handler '\n '%r'%name)from e\n \n \n \n \n \n \n \n \n \n \n \n root=logging.root\n existing=list(root.manager.loggerDict.keys())\n \n \n \n \n existing.sort()\n \n \n child_loggers=[]\n \n loggers=config.get('loggers',EMPTY_DICT)\n for name in loggers:\n if name in existing:\n i=existing.index(name)+1\n prefixed=name+\".\"\n pflen=len(prefixed)\n num_existing=len(existing)\n while i L\",chunk)[0]\n chunk=self.connection.recv(slen)\n while len(chunk)0:\n mode='a'\n if \"b\"not in mode:\n encoding=io.text_encoding(encoding)\n BaseRotatingHandler.__init__(self,filename,mode,encoding=encoding,\n delay=delay,errors=errors)\n self.maxBytes=maxBytes\n self.backupCount=backupCount\n \n def doRollover(self):\n ''\n\n \n if self.stream:\n self.stream.close()\n self.stream=None\n if self.backupCount >0:\n for i in range(self.backupCount -1,0,-1):\n sfn=self.rotation_filename(\"%s.%d\"%(self.baseFilename,i))\n dfn=self.rotation_filename(\"%s.%d\"%(self.baseFilename,\n i+1))\n if os.path.exists(sfn):\n if os.path.exists(dfn):\n os.remove(dfn)\n os.rename(sfn,dfn)\n dfn=self.rotation_filename(self.baseFilename+\".1\")\n if os.path.exists(dfn):\n os.remove(dfn)\n self.rotate(self.baseFilename,dfn)\n if not self.delay:\n self.stream=self._open()\n \n def shouldRollover(self,record):\n ''\n\n\n\n\n \n \n if os.path.exists(self.baseFilename)and not os.path.isfile(self.baseFilename):\n return False\n if self.stream is None :\n self.stream=self._open()\n if self.maxBytes >0:\n msg=\"%s\\n\"%self.format(record)\n self.stream.seek(0,2)\n if self.stream.tell()+len(msg)>=self.maxBytes:\n return True\n return False\n \nclass TimedRotatingFileHandler(BaseRotatingHandler):\n ''\n\n\n\n\n\n \n def __init__(self,filename,when='h',interval=1,backupCount=0,\n encoding=None ,delay=False ,utc=False ,atTime=None ,\n errors=None ):\n encoding=io.text_encoding(encoding)\n BaseRotatingHandler.__init__(self,filename,'a',encoding=encoding,\n delay=delay,errors=errors)\n self.when=when.upper()\n self.backupCount=backupCount\n self.utc=utc\n self.atTime=atTime\n \n \n \n \n \n \n \n \n \n \n \n \n if self.when =='S':\n self.interval=1\n self.suffix=\"%Y-%m-%d_%H-%M-%S\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}-\\d{2}(\\.\\w+)?$\"\n elif self.when =='M':\n self.interval=60\n self.suffix=\"%Y-%m-%d_%H-%M\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}_\\d{2}-\\d{2}(\\.\\w+)?$\"\n elif self.when =='H':\n self.interval=60 *60\n self.suffix=\"%Y-%m-%d_%H\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}_\\d{2}(\\.\\w+)?$\"\n elif self.when =='D'or self.when =='MIDNIGHT':\n self.interval=60 *60 *24\n self.suffix=\"%Y-%m-%d\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}(\\.\\w+)?$\"\n elif self.when.startswith('W'):\n self.interval=60 *60 *24 *7\n if len(self.when)!=2:\n raise ValueError(\"You must specify a day for weekly rollover from 0 to 6 (0 is Monday): %s\"%self.when)\n if self.when[1]<'0'or self.when[1]>'6':\n raise ValueError(\"Invalid day specified for weekly rollover: %s\"%self.when)\n self.dayOfWeek=int(self.when[1])\n self.suffix=\"%Y-%m-%d\"\n self.extMatch=r\"^\\d{4}-\\d{2}-\\d{2}(\\.\\w+)?$\"\n else :\n raise ValueError(\"Invalid rollover interval specified: %s\"%self.when)\n \n self.extMatch=re.compile(self.extMatch,re.ASCII)\n self.interval=self.interval *interval\n \n \n filename=self.baseFilename\n if os.path.exists(filename):\n t=os.stat(filename)[ST_MTIME]\n else :\n t=int(time.time())\n self.rolloverAt=self.computeRollover(t)\n \n def computeRollover(self,currentTime):\n ''\n\n \n result=currentTime+self.interval\n \n \n \n \n \n \n \n if self.when =='MIDNIGHT'or self.when.startswith('W'):\n \n if self.utc:\n t=time.gmtime(currentTime)\n else :\n t=time.localtime(currentTime)\n currentHour=t[3]\n currentMinute=t[4]\n currentSecond=t[5]\n currentDay=t[6]\n \n if self.atTime is None :\n rotate_ts=_MIDNIGHT\n else :\n rotate_ts=((self.atTime.hour *60+self.atTime.minute)*60+\n self.atTime.second)\n \n r=rotate_ts -((currentHour *60+currentMinute)*60+\n currentSecond)\n if r <0:\n \n \n \n r +=_MIDNIGHT\n currentDay=(currentDay+1)%7\n result=currentTime+r\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if self.when.startswith('W'):\n day=currentDay\n if day !=self.dayOfWeek:\n if day =self.rolloverAt:\n \n if os.path.exists(self.baseFilename)and not os.path.isfile(self.baseFilename):\n \n \n self.rolloverAt=self.computeRollover(t)\n return False\n \n return True\n return False\n \n def getFilesToDelete(self):\n ''\n\n\n\n \n dirName,baseName=os.path.split(self.baseFilename)\n fileNames=os.listdir(dirName)\n result=[]\n \n n,e=os.path.splitext(baseName)\n prefix=n+'.'\n plen=len(prefix)\n for fileName in fileNames:\n if self.namer is None :\n \n if not fileName.startswith(baseName):\n continue\n else :\n \n \n \n if (not fileName.startswith(baseName)and fileName.endswith(e)and\n len(fileName)>(plen+1)and not fileName[plen+1].isdigit()):\n continue\n \n if fileName[:plen]==prefix:\n suffix=fileName[plen:]\n \n \n parts=suffix.split('.')\n for part in parts:\n if self.extMatch.match(part):\n result.append(os.path.join(dirName,fileName))\n break\n if len(result)0:\n for s in self.getFilesToDelete():\n os.remove(s)\n if not self.delay:\n self.stream=self._open()\n newRolloverAt=self.computeRollover(currentTime)\n while newRolloverAt <=currentTime:\n newRolloverAt=newRolloverAt+self.interval\n \n if (self.when =='MIDNIGHT'or self.when.startswith('W'))and not self.utc:\n dstAtRollover=time.localtime(newRolloverAt)[-1]\n if dstNow !=dstAtRollover:\n if not dstNow:\n addend=-3600\n else :\n addend=3600\n newRolloverAt +=addend\n self.rolloverAt=newRolloverAt\n \nclass WatchedFileHandler(logging.FileHandler):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,filename,mode='a',encoding=None ,delay=False ,\n errors=None ):\n if \"b\"not in mode:\n encoding=io.text_encoding(encoding)\n logging.FileHandler.__init__(self,filename,mode=mode,\n encoding=encoding,delay=delay,\n errors=errors)\n self.dev,self.ino=-1,-1\n self._statstream()\n \n def _statstream(self):\n if self.stream:\n sres=os.fstat(self.stream.fileno())\n self.dev,self.ino=sres[ST_DEV],sres[ST_INO]\n \n def reopenIfNeeded(self):\n ''\n\n\n\n\n\n \n \n \n \n \n try :\n \n sres=os.stat(self.baseFilename)\n except FileNotFoundError:\n sres=None\n \n if not sres or sres[ST_DEV]!=self.dev or sres[ST_INO]!=self.ino:\n if self.stream is not None :\n \n self.stream.flush()\n self.stream.close()\n self.stream=None\n \n self.stream=self._open()\n self._statstream()\n \n def emit(self,record):\n ''\n\n\n\n\n \n self.reopenIfNeeded()\n logging.FileHandler.emit(self,record)\n \n \nclass SocketHandler(logging.Handler):\n ''\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,host,port):\n ''\n\n\n\n\n\n \n logging.Handler.__init__(self)\n self.host=host\n self.port=port\n if port is None :\n self.address=host\n else :\n self.address=(host,port)\n self.sock=None\n self.closeOnError=False\n self.retryTime=None\n \n \n \n self.retryStart=1.0\n self.retryMax=30.0\n self.retryFactor=2.0\n \n def makeSocket(self,timeout=1):\n ''\n\n\n \n if self.port is not None :\n result=socket.create_connection(self.address,timeout=timeout)\n else :\n result=socket.socket(socket.AF_UNIX,socket.SOCK_STREAM)\n result.settimeout(timeout)\n try :\n result.connect(self.address)\n except OSError:\n result.close()\n raise\n return result\n \n def createSocket(self):\n ''\n\n\n\n \n now=time.time()\n \n \n \n if self.retryTime is None :\n attempt=True\n else :\n attempt=(now >=self.retryTime)\n if attempt:\n try :\n self.sock=self.makeSocket()\n self.retryTime=None\n except OSError:\n \n if self.retryTime is None :\n self.retryPeriod=self.retryStart\n else :\n self.retryPeriod=self.retryPeriod *self.retryFactor\n if self.retryPeriod >self.retryMax:\n self.retryPeriod=self.retryMax\n self.retryTime=now+self.retryPeriod\n \n def send(self,s):\n ''\n\n\n\n\n \n if self.sock is None :\n self.createSocket()\n \n \n \n if self.sock:\n try :\n self.sock.sendall(s)\n except OSError:\n self.sock.close()\n self.sock=None\n \n def makePickle(self,record):\n ''\n\n\n \n ei=record.exc_info\n if ei:\n \n dummy=self.format(record)\n \n \n \n d=dict(record.__dict__)\n d['msg']=record.getMessage()\n d['args']=None\n d['exc_info']=None\n \n d.pop('message',None )\n s=pickle.dumps(d,1)\n slen=struct.pack(\">L\",len(s))\n return slen+s\n \n def handleError(self,record):\n ''\n\n\n\n\n\n \n if self.closeOnError and self.sock:\n self.sock.close()\n self.sock=None\n else :\n logging.Handler.handleError(self,record)\n \n def emit(self,record):\n ''\n\n\n\n\n\n\n \n try :\n s=self.makePickle(record)\n self.send(s)\n except Exception:\n self.handleError(record)\n \n def close(self):\n ''\n\n \n self.acquire()\n try :\n sock=self.sock\n if sock:\n self.sock=None\n sock.close()\n logging.Handler.close(self)\n finally :\n self.release()\n \nclass DatagramHandler(SocketHandler):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,host,port):\n ''\n\n \n SocketHandler.__init__(self,host,port)\n self.closeOnError=False\n \n def makeSocket(self):\n ''\n\n\n \n if self.port is None :\n family=socket.AF_UNIX\n else :\n family=socket.AF_INET\n s=socket.socket(family,socket.SOCK_DGRAM)\n return s\n \n def send(self,s):\n ''\n\n\n\n\n\n \n if self.sock is None :\n self.createSocket()\n self.sock.sendto(s,self.address)\n \nclass SysLogHandler(logging.Handler):\n ''\n\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n LOG_EMERG=0\n LOG_ALERT=1\n LOG_CRIT=2\n LOG_ERR=3\n LOG_WARNING=4\n LOG_NOTICE=5\n LOG_INFO=6\n LOG_DEBUG=7\n \n \n LOG_KERN=0\n LOG_USER=1\n LOG_MAIL=2\n LOG_DAEMON=3\n LOG_AUTH=4\n LOG_SYSLOG=5\n LOG_LPR=6\n LOG_NEWS=7\n LOG_UUCP=8\n LOG_CRON=9\n LOG_AUTHPRIV=10\n LOG_FTP=11\n LOG_NTP=12\n LOG_SECURITY=13\n LOG_CONSOLE=14\n LOG_SOLCRON=15\n \n \n LOG_LOCAL0=16\n LOG_LOCAL1=17\n LOG_LOCAL2=18\n LOG_LOCAL3=19\n LOG_LOCAL4=20\n LOG_LOCAL5=21\n LOG_LOCAL6=22\n LOG_LOCAL7=23\n \n priority_names={\n \"alert\":LOG_ALERT,\n \"crit\":LOG_CRIT,\n \"critical\":LOG_CRIT,\n \"debug\":LOG_DEBUG,\n \"emerg\":LOG_EMERG,\n \"err\":LOG_ERR,\n \"error\":LOG_ERR,\n \"info\":LOG_INFO,\n \"notice\":LOG_NOTICE,\n \"panic\":LOG_EMERG,\n \"warn\":LOG_WARNING,\n \"warning\":LOG_WARNING,\n }\n \n facility_names={\n \"auth\":LOG_AUTH,\n \"authpriv\":LOG_AUTHPRIV,\n \"console\":LOG_CONSOLE,\n \"cron\":LOG_CRON,\n \"daemon\":LOG_DAEMON,\n \"ftp\":LOG_FTP,\n \"kern\":LOG_KERN,\n \"lpr\":LOG_LPR,\n \"mail\":LOG_MAIL,\n \"news\":LOG_NEWS,\n \"ntp\":LOG_NTP,\n \"security\":LOG_SECURITY,\n \"solaris-cron\":LOG_SOLCRON,\n \"syslog\":LOG_SYSLOG,\n \"user\":LOG_USER,\n \"uucp\":LOG_UUCP,\n \"local0\":LOG_LOCAL0,\n \"local1\":LOG_LOCAL1,\n \"local2\":LOG_LOCAL2,\n \"local3\":LOG_LOCAL3,\n \"local4\":LOG_LOCAL4,\n \"local5\":LOG_LOCAL5,\n \"local6\":LOG_LOCAL6,\n \"local7\":LOG_LOCAL7,\n }\n \n \n \n \n \n priority_map={\n \"DEBUG\":\"debug\",\n \"INFO\":\"info\",\n \"WARNING\":\"warning\",\n \"ERROR\":\"error\",\n \"CRITICAL\":\"critical\"\n }\n \n def __init__(self,address=('localhost',SYSLOG_UDP_PORT),\n facility=LOG_USER,socktype=None ):\n ''\n\n\n\n\n\n\n\n\n\n \n logging.Handler.__init__(self)\n \n self.address=address\n self.facility=facility\n self.socktype=socktype\n self.socket=None\n self.createSocket()\n \n def _connect_unixsocket(self,address):\n use_socktype=self.socktype\n if use_socktype is None :\n use_socktype=socket.SOCK_DGRAM\n self.socket=socket.socket(socket.AF_UNIX,use_socktype)\n try :\n self.socket.connect(address)\n \n self.socktype=use_socktype\n except OSError:\n self.socket.close()\n if self.socktype is not None :\n \n raise\n use_socktype=socket.SOCK_STREAM\n self.socket=socket.socket(socket.AF_UNIX,use_socktype)\n try :\n self.socket.connect(address)\n \n self.socktype=use_socktype\n except OSError:\n self.socket.close()\n raise\n \n def createSocket(self):\n address=self.address\n socktype=self.socktype\n \n if isinstance(address,str):\n self.unixsocket=True\n \n \n \n \n try :\n self._connect_unixsocket(address)\n except OSError:\n pass\n else :\n self.unixsocket=False\n if socktype is None :\n socktype=socket.SOCK_DGRAM\n host,port=address\n ress=socket.getaddrinfo(host,port,0,socktype)\n if not ress:\n raise OSError(\"getaddrinfo returns an empty list\")\n for res in ress:\n af,socktype,proto,_,sa=res\n err=sock=None\n try :\n sock=socket.socket(af,socktype,proto)\n if socktype ==socket.SOCK_STREAM:\n sock.connect(sa)\n break\n except OSError as exc:\n err=exc\n if sock is not None :\n sock.close()\n if err is not None :\n raise err\n self.socket=sock\n self.socktype=socktype\n \n def encodePriority(self,facility,priority):\n ''\n\n\n\n\n \n if isinstance(facility,str):\n facility=self.facility_names[facility]\n if isinstance(priority,str):\n priority=self.priority_names[priority]\n return (facility <<3)|priority\n \n def close(self):\n ''\n\n \n self.acquire()\n try :\n sock=self.socket\n if sock:\n self.socket=None\n sock.close()\n logging.Handler.close(self)\n finally :\n self.release()\n \n def mapPriority(self,levelName):\n ''\n\n\n\n\n\n \n return self.priority_map.get(levelName,\"warning\")\n \n ident=''\n append_nul=True\n \n def emit(self,record):\n ''\n\n\n\n\n \n try :\n msg=self.format(record)\n if self.ident:\n msg=self.ident+msg\n if self.append_nul:\n msg +='\\000'\n \n \n \n prio='<%d>'%self.encodePriority(self.facility,\n self.mapPriority(record.levelname))\n prio=prio.encode('utf-8')\n \n msg=msg.encode('utf-8')\n msg=prio+msg\n \n if not self.socket:\n self.createSocket()\n \n if self.unixsocket:\n try :\n self.socket.send(msg)\n except OSError:\n self.socket.close()\n self._connect_unixsocket(self.address)\n self.socket.send(msg)\n elif self.socktype ==socket.SOCK_DGRAM:\n self.socket.sendto(msg,self.address)\n else :\n self.socket.sendall(msg)\n except Exception:\n self.handleError(record)\n \nclass SMTPHandler(logging.Handler):\n ''\n\n \n def __init__(self,mailhost,fromaddr,toaddrs,subject,\n credentials=None ,secure=None ,timeout=5.0):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n logging.Handler.__init__(self)\n if isinstance(mailhost,(list,tuple)):\n self.mailhost,self.mailport=mailhost\n else :\n self.mailhost,self.mailport=mailhost,None\n if isinstance(credentials,(list,tuple)):\n self.username,self.password=credentials\n else :\n self.username=None\n self.fromaddr=fromaddr\n if isinstance(toaddrs,str):\n toaddrs=[toaddrs]\n self.toaddrs=toaddrs\n self.subject=subject\n self.secure=secure\n self.timeout=timeout\n \n def getSubject(self,record):\n ''\n\n\n\n\n \n return self.subject\n \n def emit(self,record):\n ''\n\n\n\n \n try :\n import smtplib\n from email.message import EmailMessage\n import email.utils\n \n port=self.mailport\n if not port:\n port=smtplib.SMTP_PORT\n smtp=smtplib.SMTP(self.mailhost,port,timeout=self.timeout)\n msg=EmailMessage()\n msg['From']=self.fromaddr\n msg['To']=','.join(self.toaddrs)\n msg['Subject']=self.getSubject(record)\n msg['Date']=email.utils.localtime()\n msg.set_content(self.format(record))\n if self.username:\n if self.secure is not None :\n smtp.ehlo()\n smtp.starttls(*self.secure)\n smtp.ehlo()\n smtp.login(self.username,self.password)\n smtp.send_message(msg)\n smtp.quit()\n except Exception:\n self.handleError(record)\n \nclass NTEventLogHandler(logging.Handler):\n ''\n\n\n\n\n\n\n\n \n def __init__(self,appname,dllname=None ,logtype=\"Application\"):\n logging.Handler.__init__(self)\n try :\n import win32evtlogutil,win32evtlog\n self.appname=appname\n self._welu=win32evtlogutil\n if not dllname:\n dllname=os.path.split(self._welu.__file__)\n dllname=os.path.split(dllname[0])\n dllname=os.path.join(dllname[0],r'win32service.pyd')\n self.dllname=dllname\n self.logtype=logtype\n \n \n \n try :\n self._welu.AddSourceToRegistry(appname,dllname,logtype)\n except Exception as e:\n \n \n if getattr(e,'winerror',None )!=5:\n raise\n self.deftype=win32evtlog.EVENTLOG_ERROR_TYPE\n self.typemap={\n logging.DEBUG:win32evtlog.EVENTLOG_INFORMATION_TYPE,\n logging.INFO:win32evtlog.EVENTLOG_INFORMATION_TYPE,\n logging.WARNING:win32evtlog.EVENTLOG_WARNING_TYPE,\n logging.ERROR:win32evtlog.EVENTLOG_ERROR_TYPE,\n logging.CRITICAL:win32evtlog.EVENTLOG_ERROR_TYPE,\n }\n except ImportError:\n print(\"The Python Win32 extensions for NT (service, event \"\\\n \"logging) appear not to be available.\")\n self._welu=None\n \n def getMessageID(self,record):\n ''\n\n\n\n\n\n \n return 1\n \n def getEventCategory(self,record):\n ''\n\n\n\n\n \n return 0\n \n def getEventType(self,record):\n ''\n\n\n\n\n\n\n\n\n \n return self.typemap.get(record.levelno,self.deftype)\n \n def emit(self,record):\n ''\n\n\n\n\n \n if self._welu:\n try :\n id=self.getMessageID(record)\n cat=self.getEventCategory(record)\n type=self.getEventType(record)\n msg=self.format(record)\n self._welu.ReportEvent(self.appname,id,cat,type,[msg])\n except Exception:\n self.handleError(record)\n \n def close(self):\n ''\n\n\n\n\n\n\n\n \n \n logging.Handler.close(self)\n \nclass HTTPHandler(logging.Handler):\n ''\n\n\n \n def __init__(self,host,url,method=\"GET\",secure=False ,credentials=None ,\n context=None ):\n ''\n\n\n \n logging.Handler.__init__(self)\n method=method.upper()\n if method not in [\"GET\",\"POST\"]:\n raise ValueError(\"method must be GET or POST\")\n if not secure and context is not None :\n raise ValueError(\"context parameter only makes sense \"\n \"with secure=True\")\n self.host=host\n self.url=url\n self.method=method\n self.secure=secure\n self.credentials=credentials\n self.context=context\n \n def mapLogRecord(self,record):\n ''\n\n\n\n \n return record.__dict__\n \n def getConnection(self,host,secure):\n ''\n\n\n\n\n \n import http.client\n if secure:\n connection=http.client.HTTPSConnection(host,context=self.context)\n else :\n connection=http.client.HTTPConnection(host)\n return connection\n \n def emit(self,record):\n ''\n\n\n\n \n try :\n import urllib.parse\n host=self.host\n h=self.getConnection(host,self.secure)\n url=self.url\n data=urllib.parse.urlencode(self.mapLogRecord(record))\n if self.method ==\"GET\":\n if (url.find('?')>=0):\n sep='&'\n else :\n sep='?'\n url=url+\"%c%s\"%(sep,data)\n h.putrequest(self.method,url)\n \n \n i=host.find(\":\")\n if i >=0:\n host=host[:i]\n \n \n \n if self.method ==\"POST\":\n h.putheader(\"Content-type\",\n \"application/x-www-form-urlencoded\")\n h.putheader(\"Content-length\",str(len(data)))\n if self.credentials:\n import base64\n s=('%s:%s'%self.credentials).encode('utf-8')\n s='Basic '+base64.b64encode(s).strip().decode('ascii')\n h.putheader('Authorization',s)\n h.endheaders()\n if self.method ==\"POST\":\n h.send(data.encode('utf-8'))\n h.getresponse()\n except Exception:\n self.handleError(record)\n \nclass BufferingHandler(logging.Handler):\n ''\n\n\n\n \n def __init__(self,capacity):\n ''\n\n \n logging.Handler.__init__(self)\n self.capacity=capacity\n self.buffer=[]\n \n def shouldFlush(self,record):\n ''\n\n\n\n\n \n return (len(self.buffer)>=self.capacity)\n \n def emit(self,record):\n ''\n\n\n\n\n \n self.buffer.append(record)\n if self.shouldFlush(record):\n self.flush()\n \n def flush(self):\n ''\n\n\n\n \n self.acquire()\n try :\n self.buffer.clear()\n finally :\n self.release()\n \n def close(self):\n ''\n\n\n\n \n try :\n self.flush()\n finally :\n logging.Handler.close(self)\n \nclass MemoryHandler(BufferingHandler):\n ''\n\n\n\n \n def __init__(self,capacity,flushLevel=logging.ERROR,target=None ,\n flushOnClose=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n \n BufferingHandler.__init__(self,capacity)\n self.flushLevel=flushLevel\n self.target=target\n \n self.flushOnClose=flushOnClose\n \n def shouldFlush(self,record):\n ''\n\n \n return (len(self.buffer)>=self.capacity)or\\\n (record.levelno >=self.flushLevel)\n \n def setTarget(self,target):\n ''\n\n \n self.acquire()\n try :\n self.target=target\n finally :\n self.release()\n \n def flush(self):\n ''\n\n\n\n\n\n \n self.acquire()\n try :\n if self.target:\n for record in self.buffer:\n self.target.handle(record)\n self.buffer.clear()\n finally :\n self.release()\n \n def close(self):\n ''\n\n\n \n try :\n if self.flushOnClose:\n self.flush()\n finally :\n self.acquire()\n try :\n self.target=None\n BufferingHandler.close(self)\n finally :\n self.release()\n \n \nclass QueueHandler(logging.Handler):\n ''\n\n\n\n\n\n\n\n \n \n def __init__(self,queue):\n ''\n\n \n logging.Handler.__init__(self)\n self.queue=queue\n \n def enqueue(self,record):\n ''\n\n\n\n\n\n \n self.queue.put_nowait(record)\n \n def prepare(self,record):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \n \n \n msg=self.format(record)\n \n record=copy.copy(record)\n record.message=msg\n record.msg=msg\n record.args=None\n record.exc_info=None\n record.exc_text=None\n record.stack_info=None\n return record\n \n def emit(self,record):\n ''\n\n\n\n \n try :\n self.enqueue(self.prepare(record))\n except Exception:\n self.handleError(record)\n \n \nclass QueueListener(object):\n ''\n\n\n\n \n _sentinel=None\n \n def __init__(self,queue,*handlers,respect_handler_level=False ):\n ''\n\n\n \n self.queue=queue\n self.handlers=handlers\n self._thread=None\n self.respect_handler_level=respect_handler_level\n \n def dequeue(self,block):\n ''\n\n\n\n\n \n return self.queue.get(block)\n \n def start(self):\n ''\n\n\n\n\n \n self._thread=t=threading.Thread(target=self._monitor)\n t.daemon=True\n t.start()\n \n def prepare(self,record):\n ''\n\n\n\n\n\n \n return record\n \n def handle(self,record):\n ''\n\n\n\n\n \n record=self.prepare(record)\n for handler in self.handlers:\n if not self.respect_handler_level:\n process=True\n else :\n process=record.levelno >=handler.level\n if process:\n handler.handle(record)\n \n def _monitor(self):\n ''\n\n\n\n\n\n \n q=self.queue\n has_task_done=hasattr(q,'task_done')\n while True :\n try :\n record=self.dequeue(True )\n if record is self._sentinel:\n if has_task_done:\n q.task_done()\n break\n self.handle(record)\n if has_task_done:\n q.task_done()\n except queue.Empty:\n break\n \n def enqueue_sentinel(self):\n ''\n\n\n\n\n\n \n self.queue.put_nowait(self._sentinel)\n \n def stop(self):\n ''\n\n\n\n\n\n \n self.enqueue_sentinel()\n self._thread.join()\n self._thread=None\n", ["base64", "copy", "email.message", "email.utils", "http.client", "io", "logging", "os", "pickle", "queue", "re", "smtplib", "socket", "stat", "struct", "threading", "time", "urllib.parse", "win32evtlog", "win32evtlogutil"]], "logging": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\"\"\"\nLogging package for Python. Based on PEP 282 and comments thereto in\ncomp.lang.python.\n\nCopyright (C) 2001-2019 Vinay Sajip. All Rights Reserved.\n\nTo use, simply 'import logging' and log away!\n\"\"\"\n\nimport sys,os,time,io,re,traceback,warnings,weakref,collections.abc\n\nfrom string import Template\nfrom string import Formatter as StrFormatter\n\n\n__all__=['BASIC_FORMAT','BufferingFormatter','CRITICAL','DEBUG','ERROR',\n'FATAL','FileHandler','Filter','Formatter','Handler','INFO',\n'LogRecord','Logger','LoggerAdapter','NOTSET','NullHandler',\n'StreamHandler','WARN','WARNING','addLevelName','basicConfig',\n'captureWarnings','critical','debug','disable','error',\n'exception','fatal','getLevelName','getLogger','getLoggerClass',\n'info','log','makeLogRecord','setLoggerClass','shutdown',\n'warn','warning','getLogRecordFactory','setLogRecordFactory',\n'lastResort','raiseExceptions']\n\nimport threading\n\n__author__=\"Vinay Sajip \"\n__status__=\"production\"\n\n__version__=\"0.5.1.2\"\n__date__=\"07 February 2010\"\n\n\n\n\n\n\n\n\n_startTime=time.time()\n\n\n\n\n\nraiseExceptions=True\n\n\n\n\nlogThreads=True\n\n\n\n\nlogMultiprocessing=True\n\n\n\n\nlogProcesses=True\n\n\n\n\n\n\n\n\n\n\n\n\nCRITICAL=50\nFATAL=CRITICAL\nERROR=40\nWARNING=30\nWARN=WARNING\nINFO=20\nDEBUG=10\nNOTSET=0\n\n_levelToName={\nCRITICAL:'CRITICAL',\nERROR:'ERROR',\nWARNING:'WARNING',\nINFO:'INFO',\nDEBUG:'DEBUG',\nNOTSET:'NOTSET',\n}\n_nameToLevel={\n'CRITICAL':CRITICAL,\n'FATAL':FATAL,\n'ERROR':ERROR,\n'WARN':WARNING,\n'WARNING':WARNING,\n'INFO':INFO,\n'DEBUG':DEBUG,\n'NOTSET':NOTSET,\n}\n\ndef getLevelName(level):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n \n result=_levelToName.get(level)\n if result is not None :\n return result\n result=_nameToLevel.get(level)\n if result is not None :\n return result\n return \"Level %s\"%level\n \ndef addLevelName(level,levelName):\n ''\n\n\n\n \n _acquireLock()\n try :\n _levelToName[level]=levelName\n _nameToLevel[levelName]=level\n finally :\n _releaseLock()\n \nif hasattr(sys,'_getframe'):\n currentframe=lambda :sys._getframe(3)\nelse :\n def currentframe():\n ''\n try :\n raise Exception\n except Exception:\n return sys.exc_info()[2].tb_frame.f_back\n \n \n \n \n \n \n \n \n \n \n \n \n \n_srcfile=os.path.normcase(addLevelName.__code__.co_filename)\n\n\n\n\n\n\n\n\n\n\n\ndef _checkLevel(level):\n if isinstance(level,int):\n rv=level\n elif str(level)==level:\n if level not in _nameToLevel:\n raise ValueError(\"Unknown level: %r\"%level)\n rv=_nameToLevel[level]\n else :\n raise TypeError(\"Level not an integer or a valid string: %r\"%level)\n return rv\n \n \n \n \n \n \n \n \n \n \n \n \n \n_lock=threading.RLock()\n\ndef _acquireLock():\n ''\n\n\n\n \n if _lock:\n _lock.acquire()\n \ndef _releaseLock():\n ''\n\n \n if _lock:\n _lock.release()\n \n \n \n \nif not hasattr(os,'register_at_fork'):\n def _register_at_fork_reinit_lock(instance):\n pass\nelse :\n\n\n\n _at_fork_reinit_lock_weakset=weakref.WeakSet()\n \n def _register_at_fork_reinit_lock(instance):\n _acquireLock()\n try :\n _at_fork_reinit_lock_weakset.add(instance)\n finally :\n _releaseLock()\n \n def _after_at_fork_child_reinit_locks():\n for handler in _at_fork_reinit_lock_weakset:\n handler._at_fork_reinit()\n \n \n \n _lock._at_fork_reinit()\n \n os.register_at_fork(before=_acquireLock,\n after_in_child=_after_at_fork_child_reinit_locks,\n after_in_parent=_releaseLock)\n \n \n \n \n \n \nclass LogRecord(object):\n ''\n\n\n\n\n\n\n\n\n\n \n def __init__(self,name,level,pathname,lineno,\n msg,args,exc_info,func=None ,sinfo=None ,**kwargs):\n ''\n\n \n ct=time.time()\n self.name=name\n self.msg=msg\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n if (args and len(args)==1 and isinstance(args[0],collections.abc.Mapping)\n and args[0]):\n args=args[0]\n self.args=args\n self.levelname=getLevelName(level)\n self.levelno=level\n self.pathname=pathname\n try :\n self.filename=os.path.basename(pathname)\n self.module=os.path.splitext(self.filename)[0]\n except (TypeError,ValueError,AttributeError):\n self.filename=pathname\n self.module=\"Unknown module\"\n self.exc_info=exc_info\n self.exc_text=None\n self.stack_info=sinfo\n self.lineno=lineno\n self.funcName=func\n self.created=ct\n self.msecs=(ct -int(ct))*1000\n self.relativeCreated=(self.created -_startTime)*1000\n if logThreads:\n self.thread=threading.get_ident()\n self.threadName=threading.current_thread().name\n else :\n self.thread=None\n self.threadName=None\n if not logMultiprocessing:\n self.processName=None\n else :\n self.processName='MainProcess'\n mp=sys.modules.get('multiprocessing')\n if mp is not None :\n \n \n \n \n try :\n self.processName=mp.current_process().name\n except Exception:\n pass\n if logProcesses and hasattr(os,'getpid'):\n self.process=os.getpid()\n else :\n self.process=None\n \n def __repr__(self):\n return ''%(self.name,self.levelno,\n self.pathname,self.lineno,self.msg)\n \n def getMessage(self):\n ''\n\n\n\n\n \n msg=str(self.msg)\n if self.args:\n msg=msg %self.args\n return msg\n \n \n \n \n_logRecordFactory=LogRecord\n\ndef setLogRecordFactory(factory):\n ''\n\n\n\n\n \n global _logRecordFactory\n _logRecordFactory=factory\n \ndef getLogRecordFactory():\n ''\n\n \n \n return _logRecordFactory\n \ndef makeLogRecord(dict):\n ''\n\n\n\n\n \n rv=_logRecordFactory(None ,None ,\"\",0,\"\",(),None ,None )\n rv.__dict__.update(dict)\n return rv\n \n \n \n \n \n_str_formatter=StrFormatter()\ndel StrFormatter\n\n\nclass PercentStyle(object):\n\n default_format='%(message)s'\n asctime_format='%(asctime)s'\n asctime_search='%(asctime)'\n validation_pattern=re.compile(r'%\\(\\w+\\)[#0+ -]*(\\*|\\d+)?(\\.(\\*|\\d+))?[diouxefgcrsa%]',re.I)\n \n def __init__(self,fmt):\n self._fmt=fmt or self.default_format\n \n def usesTime(self):\n return self._fmt.find(self.asctime_search)>=0\n \n def validate(self):\n ''\n if not self.validation_pattern.search(self._fmt):\n raise ValueError(\"Invalid format '%s' for '%s' style\"%(self._fmt,self.default_format[0]))\n \n def _format(self,record):\n return self._fmt %record.__dict__\n \n def format(self,record):\n try :\n return self._format(record)\n except KeyError as e:\n raise ValueError('Formatting field not found in record: %s'%e)\n \n \nclass StrFormatStyle(PercentStyle):\n default_format='{message}'\n asctime_format='{asctime}'\n asctime_search='{asctime'\n \n fmt_spec=re.compile(r'^(.?[<>=^])?[+ -]?#?0?(\\d+|{\\w+})?[,_]?(\\.(\\d+|{\\w+}))?[bcdefgnosx%]?$',re.I)\n field_spec=re.compile(r'^(\\d+|\\w+)(\\.\\w+|\\[[^]]+\\])*$')\n \n def _format(self,record):\n return self._fmt.format(**record.__dict__)\n \n def validate(self):\n ''\n fields=set()\n try :\n for _,fieldname,spec,conversion in _str_formatter.parse(self._fmt):\n if fieldname:\n if not self.field_spec.match(fieldname):\n raise ValueError('invalid field name/expression: %r'%fieldname)\n fields.add(fieldname)\n if conversion and conversion not in 'rsa':\n raise ValueError('invalid conversion: %r'%conversion)\n if spec and not self.fmt_spec.match(spec):\n raise ValueError('bad specifier: %r'%spec)\n except ValueError as e:\n raise ValueError('invalid format: %s'%e)\n if not fields:\n raise ValueError('invalid format: no fields')\n \n \nclass StringTemplateStyle(PercentStyle):\n default_format='${message}'\n asctime_format='${asctime}'\n asctime_search='${asctime}'\n \n def __init__(self,fmt):\n self._fmt=fmt or self.default_format\n self._tpl=Template(self._fmt)\n \n def usesTime(self):\n fmt=self._fmt\n return fmt.find('$asctime')>=0 or fmt.find(self.asctime_format)>=0\n \n def validate(self):\n pattern=Template.pattern\n fields=set()\n for m in pattern.finditer(self._fmt):\n d=m.groupdict()\n if d['named']:\n fields.add(d['named'])\n elif d['braced']:\n fields.add(d['braced'])\n elif m.group(0)=='$':\n raise ValueError('invalid format: bare \\'$\\' not allowed')\n if not fields:\n raise ValueError('invalid format: no fields')\n \n def _format(self,record):\n return self._tpl.substitute(**record.__dict__)\n \n \nBASIC_FORMAT=\"%(levelname)s:%(name)s:%(message)s\"\n\n_STYLES={\n'%':(PercentStyle,BASIC_FORMAT),\n'{':(StrFormatStyle,'{levelname}:{name}:{message}'),\n'$':(StringTemplateStyle,'${levelname}:${name}:${message}'),\n}\n\nclass Formatter(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n converter=time.localtime\n \n def __init__(self,fmt=None ,datefmt=None ,style='%',validate=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if style not in _STYLES:\n raise ValueError('Style must be one of: %s'%','.join(\n _STYLES.keys()))\n self._style=_STYLES[style][0](fmt)\n if validate:\n self._style.validate()\n \n self._fmt=self._style._fmt\n self.datefmt=datefmt\n \n default_time_format='%Y-%m-%d %H:%M:%S'\n default_msec_format='%s,%03d'\n \n def formatTime(self,record,datefmt=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n ct=self.converter(record.created)\n if datefmt:\n s=time.strftime(datefmt,ct)\n else :\n s=time.strftime(self.default_time_format,ct)\n if self.default_msec_format:\n s=self.default_msec_format %(s,record.msecs)\n return s\n \n def formatException(self,ei):\n ''\n\n\n\n\n \n sio=io.StringIO()\n tb=ei[2]\n \n \n \n traceback.print_exception(ei[0],ei[1],tb,None ,sio)\n s=sio.getvalue()\n sio.close()\n if s[-1:]==\"\\n\":\n s=s[:-1]\n return s\n \n def usesTime(self):\n ''\n\n \n return self._style.usesTime()\n \n def formatMessage(self,record):\n return self._style.format(record)\n \n def formatStack(self,stack_info):\n ''\n\n\n\n\n\n\n\n\n \n return stack_info\n \n def format(self,record):\n ''\n\n\n\n\n\n\n\n\n\n\n \n record.message=record.getMessage()\n if self.usesTime():\n record.asctime=self.formatTime(record,self.datefmt)\n s=self.formatMessage(record)\n if record.exc_info:\n \n \n if not record.exc_text:\n record.exc_text=self.formatException(record.exc_info)\n if record.exc_text:\n if s[-1:]!=\"\\n\":\n s=s+\"\\n\"\n s=s+record.exc_text\n if record.stack_info:\n if s[-1:]!=\"\\n\":\n s=s+\"\\n\"\n s=s+self.formatStack(record.stack_info)\n return s\n \n \n \n \n_defaultFormatter=Formatter()\n\nclass BufferingFormatter(object):\n ''\n\n \n def __init__(self,linefmt=None ):\n ''\n\n\n \n if linefmt:\n self.linefmt=linefmt\n else :\n self.linefmt=_defaultFormatter\n \n def formatHeader(self,records):\n ''\n\n \n return \"\"\n \n def formatFooter(self,records):\n ''\n\n \n return \"\"\n \n def format(self,records):\n ''\n\n \n rv=\"\"\n if len(records)>0:\n rv=rv+self.formatHeader(records)\n for record in records:\n rv=rv+self.linefmt.format(record)\n rv=rv+self.formatFooter(records)\n return rv\n \n \n \n \n \nclass Filter(object):\n ''\n\n\n\n\n\n\n\n\n \n def __init__(self,name=''):\n ''\n\n\n\n\n\n \n self.name=name\n self.nlen=len(name)\n \n def filter(self,record):\n ''\n\n\n\n\n \n if self.nlen ==0:\n return True\n elif self.name ==record.name:\n return True\n elif record.name.find(self.name,0,self.nlen)!=0:\n return False\n return (record.name[self.nlen]==\".\")\n \nclass Filterer(object):\n ''\n\n\n \n def __init__(self):\n ''\n\n \n self.filters=[]\n \n def addFilter(self,filter):\n ''\n\n \n if not (filter in self.filters):\n self.filters.append(filter)\n \n def removeFilter(self,filter):\n ''\n\n \n if filter in self.filters:\n self.filters.remove(filter)\n \n def filter(self,record):\n ''\n\n\n\n\n\n\n\n\n\n \n rv=True\n for f in self.filters:\n if hasattr(f,'filter'):\n result=f.filter(record)\n else :\n result=f(record)\n if not result:\n rv=False\n break\n return rv\n \n \n \n \n \n_handlers=weakref.WeakValueDictionary()\n_handlerList=[]\n\ndef _removeHandlerRef(wr):\n ''\n\n \n \n \n \n \n acquire,release,handlers=_acquireLock,_releaseLock,_handlerList\n if acquire and release and handlers:\n acquire()\n try :\n if wr in handlers:\n handlers.remove(wr)\n finally :\n release()\n \ndef _addHandlerRef(handler):\n ''\n\n \n _acquireLock()\n try :\n _handlerList.append(weakref.ref(handler,_removeHandlerRef))\n finally :\n _releaseLock()\n \nclass Handler(Filterer):\n ''\n\n\n\n\n\n\n \n def __init__(self,level=NOTSET):\n ''\n\n\n \n Filterer.__init__(self)\n self._name=None\n self.level=_checkLevel(level)\n self.formatter=None\n \n _addHandlerRef(self)\n self.createLock()\n \n def get_name(self):\n return self._name\n \n def set_name(self,name):\n _acquireLock()\n try :\n if self._name in _handlers:\n del _handlers[self._name]\n self._name=name\n if name:\n _handlers[name]=self\n finally :\n _releaseLock()\n \n name=property(get_name,set_name)\n \n def createLock(self):\n ''\n\n \n self.lock=threading.RLock()\n _register_at_fork_reinit_lock(self)\n \n def _at_fork_reinit(self):\n self.lock._at_fork_reinit()\n \n def acquire(self):\n ''\n\n \n if self.lock:\n self.lock.acquire()\n \n def release(self):\n ''\n\n \n if self.lock:\n self.lock.release()\n \n def setLevel(self,level):\n ''\n\n \n self.level=_checkLevel(level)\n \n def format(self,record):\n ''\n\n\n\n\n \n if self.formatter:\n fmt=self.formatter\n else :\n fmt=_defaultFormatter\n return fmt.format(record)\n \n def emit(self,record):\n ''\n\n\n\n\n \n raise NotImplementedError('emit must be implemented '\n 'by Handler subclasses')\n \n def handle(self,record):\n ''\n\n\n\n\n\n\n \n rv=self.filter(record)\n if rv:\n self.acquire()\n try :\n self.emit(record)\n finally :\n self.release()\n return rv\n \n def setFormatter(self,fmt):\n ''\n\n \n self.formatter=fmt\n \n def flush(self):\n ''\n\n\n\n\n \n pass\n \n def close(self):\n ''\n\n\n\n\n\n\n \n \n _acquireLock()\n try :\n if self._name and self._name in _handlers:\n del _handlers[self._name]\n finally :\n _releaseLock()\n \n def handleError(self,record):\n ''\n\n\n\n\n\n\n\n\n\n \n if raiseExceptions and sys.stderr:\n t,v,tb=sys.exc_info()\n try :\n sys.stderr.write('--- Logging error ---\\n')\n traceback.print_exception(t,v,tb,None ,sys.stderr)\n sys.stderr.write('Call stack:\\n')\n \n \n frame=tb.tb_frame\n while (frame and os.path.dirname(frame.f_code.co_filename)==\n __path__[0]):\n frame=frame.f_back\n if frame:\n traceback.print_stack(frame,file=sys.stderr)\n else :\n \n sys.stderr.write('Logged from file %s, line %s\\n'%(\n record.filename,record.lineno))\n \n try :\n sys.stderr.write('Message: %r\\n'\n 'Arguments: %s\\n'%(record.msg,\n record.args))\n except RecursionError:\n raise\n except Exception:\n sys.stderr.write('Unable to print the message and arguments'\n ' - possible formatting error.\\nUse the'\n ' traceback above to help find the error.\\n'\n )\n except OSError:\n pass\n finally :\n del t,v,tb\n \n def __repr__(self):\n level=getLevelName(self.level)\n return '<%s (%s)>'%(self.__class__.__name__,level)\n \nclass StreamHandler(Handler):\n ''\n\n\n\n \n \n terminator='\\n'\n \n def __init__(self,stream=None ):\n ''\n\n\n\n \n Handler.__init__(self)\n if stream is None :\n stream=sys.stderr\n self.stream=stream\n \n def flush(self):\n ''\n\n \n self.acquire()\n try :\n if self.stream and hasattr(self.stream,\"flush\"):\n self.stream.flush()\n finally :\n self.release()\n \n def emit(self,record):\n ''\n\n\n\n\n\n\n\n\n \n try :\n msg=self.format(record)\n stream=self.stream\n \n stream.write(msg+self.terminator)\n self.flush()\n except RecursionError:\n raise\n except Exception:\n self.handleError(record)\n \n def setStream(self,stream):\n ''\n\n\n\n\n\n \n if stream is self.stream:\n result=None\n else :\n result=self.stream\n self.acquire()\n try :\n self.flush()\n self.stream=stream\n finally :\n self.release()\n return result\n \n def __repr__(self):\n level=getLevelName(self.level)\n name=getattr(self.stream,'name','')\n \n name=str(name)\n if name:\n name +=' '\n return '<%s %s(%s)>'%(self.__class__.__name__,name,level)\n \n \nclass FileHandler(StreamHandler):\n ''\n\n \n def __init__(self,filename,mode='a',encoding=None ,delay=False ,errors=None ):\n ''\n\n \n \n filename=os.fspath(filename)\n \n \n self.baseFilename=os.path.abspath(filename)\n self.mode=mode\n self.encoding=encoding\n self.errors=errors\n self.delay=delay\n if delay:\n \n \n Handler.__init__(self)\n self.stream=None\n else :\n StreamHandler.__init__(self,self._open())\n \n def close(self):\n ''\n\n \n self.acquire()\n try :\n try :\n if self.stream:\n try :\n self.flush()\n finally :\n stream=self.stream\n self.stream=None\n if hasattr(stream,\"close\"):\n stream.close()\n finally :\n \n \n StreamHandler.close(self)\n finally :\n self.release()\n \n def _open(self):\n ''\n\n\n \n return open(self.baseFilename,self.mode,encoding=self.encoding,\n errors=self.errors)\n \n def emit(self,record):\n ''\n\n\n\n\n \n if self.stream is None :\n self.stream=self._open()\n StreamHandler.emit(self,record)\n \n def __repr__(self):\n level=getLevelName(self.level)\n return '<%s %s (%s)>'%(self.__class__.__name__,self.baseFilename,level)\n \n \nclass _StderrHandler(StreamHandler):\n ''\n\n\n\n \n def __init__(self,level=NOTSET):\n ''\n\n \n Handler.__init__(self,level)\n \n @property\n def stream(self):\n return sys.stderr\n \n \n_defaultLastResort=_StderrHandler(WARNING)\nlastResort=_defaultLastResort\n\n\n\n\n\nclass PlaceHolder(object):\n ''\n\n\n\n \n def __init__(self,alogger):\n ''\n\n \n self.loggerMap={alogger:None }\n \n def append(self,alogger):\n ''\n\n \n if alogger not in self.loggerMap:\n self.loggerMap[alogger]=None\n \n \n \n \n \ndef setLoggerClass(klass):\n ''\n\n\n\n \n if klass !=Logger:\n if not issubclass(klass,Logger):\n raise TypeError(\"logger not derived from logging.Logger: \"\n +klass.__name__)\n global _loggerClass\n _loggerClass=klass\n \ndef getLoggerClass():\n ''\n\n \n return _loggerClass\n \nclass Manager(object):\n ''\n\n\n \n def __init__(self,rootnode):\n ''\n\n \n self.root=rootnode\n self.disable=0\n self.emittedNoHandlerWarning=False\n self.loggerDict={}\n self.loggerClass=None\n self.logRecordFactory=None\n \n def getLogger(self,name):\n ''\n\n\n\n\n\n\n\n\n \n rv=None\n if not isinstance(name,str):\n raise TypeError('A logger name must be a string')\n _acquireLock()\n try :\n if name in self.loggerDict:\n rv=self.loggerDict[name]\n if isinstance(rv,PlaceHolder):\n ph=rv\n rv=(self.loggerClass or _loggerClass)(name)\n rv.manager=self\n self.loggerDict[name]=rv\n self._fixupChildren(ph,rv)\n self._fixupParents(rv)\n else :\n rv=(self.loggerClass or _loggerClass)(name)\n rv.manager=self\n self.loggerDict[name]=rv\n self._fixupParents(rv)\n finally :\n _releaseLock()\n return rv\n \n def setLoggerClass(self,klass):\n ''\n\n \n if klass !=Logger:\n if not issubclass(klass,Logger):\n raise TypeError(\"logger not derived from logging.Logger: \"\n +klass.__name__)\n self.loggerClass=klass\n \n def setLogRecordFactory(self,factory):\n ''\n\n\n \n self.logRecordFactory=factory\n \n def _fixupParents(self,alogger):\n ''\n\n\n \n name=alogger.name\n i=name.rfind(\".\")\n rv=None\n while (i >0)and not rv:\n substr=name[:i]\n if substr not in self.loggerDict:\n self.loggerDict[substr]=PlaceHolder(alogger)\n else :\n obj=self.loggerDict[substr]\n if isinstance(obj,Logger):\n rv=obj\n else :\n assert isinstance(obj,PlaceHolder)\n obj.append(alogger)\n i=name.rfind(\".\",0,i -1)\n if not rv:\n rv=self.root\n alogger.parent=rv\n \n def _fixupChildren(self,ph,alogger):\n ''\n\n\n \n name=alogger.name\n namelen=len(name)\n for c in ph.loggerMap.keys():\n \n if c.parent.name[:namelen]!=name:\n alogger.parent=c.parent\n c.parent=alogger\n \n def _clear_cache(self):\n ''\n\n\n \n \n _acquireLock()\n for logger in self.loggerDict.values():\n if isinstance(logger,Logger):\n logger._cache.clear()\n self.root._cache.clear()\n _releaseLock()\n \n \n \n \n \nclass Logger(Filterer):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __init__(self,name,level=NOTSET):\n ''\n\n \n Filterer.__init__(self)\n self.name=name\n self.level=_checkLevel(level)\n self.parent=None\n self.propagate=True\n self.handlers=[]\n self.disabled=False\n self._cache={}\n \n def setLevel(self,level):\n ''\n\n \n self.level=_checkLevel(level)\n self.manager._clear_cache()\n \n def debug(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(DEBUG):\n self._log(DEBUG,msg,args,**kwargs)\n \n def info(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(INFO):\n self._log(INFO,msg,args,**kwargs)\n \n def warning(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(WARNING):\n self._log(WARNING,msg,args,**kwargs)\n \n def warn(self,msg,*args,**kwargs):\n warnings.warn(\"The 'warn' method is deprecated, \"\n \"use 'warning' instead\",DeprecationWarning,2)\n self.warning(msg,*args,**kwargs)\n \n def error(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(ERROR):\n self._log(ERROR,msg,args,**kwargs)\n \n def exception(self,msg,*args,exc_info=True ,**kwargs):\n ''\n\n \n self.error(msg,*args,exc_info=exc_info,**kwargs)\n \n def critical(self,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if self.isEnabledFor(CRITICAL):\n self._log(CRITICAL,msg,args,**kwargs)\n \n fatal=critical\n \n def log(self,level,msg,*args,**kwargs):\n ''\n\n\n\n\n\n\n \n if not isinstance(level,int):\n if raiseExceptions:\n raise TypeError(\"level must be an integer\")\n else :\n return\n if self.isEnabledFor(level):\n self._log(level,msg,args,**kwargs)\n \n def findCaller(self,stack_info=False ,stacklevel=1):\n ''\n\n\n \n f=currentframe()\n \n \n if f is not None :\n f=f.f_back\n orig_f=f\n while f and stacklevel >1:\n f=f.f_back\n stacklevel -=1\n if not f:\n f=orig_f\n rv=\"(unknown file)\",0,\"(unknown function)\",None\n while hasattr(f,\"f_code\"):\n co=f.f_code\n filename=os.path.normcase(co.co_filename)\n if filename ==_srcfile:\n f=f.f_back\n continue\n sinfo=None\n if stack_info:\n sio=io.StringIO()\n sio.write('Stack (most recent call last):\\n')\n traceback.print_stack(f,file=sio)\n sinfo=sio.getvalue()\n if sinfo[-1]=='\\n':\n sinfo=sinfo[:-1]\n sio.close()\n rv=(co.co_filename,f.f_lineno,co.co_name,sinfo)\n break\n return rv\n \n def makeRecord(self,name,level,fn,lno,msg,args,exc_info,\n func=None ,extra=None ,sinfo=None ):\n ''\n\n\n \n rv=_logRecordFactory(name,level,fn,lno,msg,args,exc_info,func,\n sinfo)\n if extra is not None :\n for key in extra:\n if (key in [\"message\",\"asctime\"])or (key in rv.__dict__):\n raise KeyError(\"Attempt to overwrite %r in LogRecord\"%key)\n rv.__dict__[key]=extra[key]\n return rv\n \n def _log(self,level,msg,args,exc_info=None ,extra=None ,stack_info=False ,\n stacklevel=1):\n ''\n\n\n \n sinfo=None\n if _srcfile:\n \n \n \n try :\n fn,lno,func,sinfo=self.findCaller(stack_info,stacklevel)\n except ValueError:\n fn,lno,func=\"(unknown file)\",0,\"(unknown function)\"\n else :\n fn,lno,func=\"(unknown file)\",0,\"(unknown function)\"\n if exc_info:\n if isinstance(exc_info,BaseException):\n exc_info=(type(exc_info),exc_info,exc_info.__traceback__)\n elif not isinstance(exc_info,tuple):\n exc_info=sys.exc_info()\n record=self.makeRecord(self.name,level,fn,lno,msg,args,\n exc_info,func,extra,sinfo)\n self.handle(record)\n \n def handle(self,record):\n ''\n\n\n\n\n \n if (not self.disabled)and self.filter(record):\n self.callHandlers(record)\n \n def addHandler(self,hdlr):\n ''\n\n \n _acquireLock()\n try :\n if not (hdlr in self.handlers):\n self.handlers.append(hdlr)\n finally :\n _releaseLock()\n \n def removeHandler(self,hdlr):\n ''\n\n \n _acquireLock()\n try :\n if hdlr in self.handlers:\n self.handlers.remove(hdlr)\n finally :\n _releaseLock()\n \n def hasHandlers(self):\n ''\n\n\n\n\n\n\n\n \n c=self\n rv=False\n while c:\n if c.handlers:\n rv=True\n break\n if not c.propagate:\n break\n else :\n c=c.parent\n return rv\n \n def callHandlers(self,record):\n ''\n\n\n\n\n\n\n\n \n c=self\n found=0\n while c:\n for hdlr in c.handlers:\n found=found+1\n if record.levelno >=hdlr.level:\n hdlr.handle(record)\n if not c.propagate:\n c=None\n else :\n c=c.parent\n if (found ==0):\n if lastResort:\n if record.levelno >=lastResort.level:\n lastResort.handle(record)\n elif raiseExceptions and not self.manager.emittedNoHandlerWarning:\n sys.stderr.write(\"No handlers could be found for logger\"\n \" \\\"%s\\\"\\n\"%self.name)\n self.manager.emittedNoHandlerWarning=True\n \n def getEffectiveLevel(self):\n ''\n\n\n\n\n \n logger=self\n while logger:\n if logger.level:\n return logger.level\n logger=logger.parent\n return NOTSET\n \n def isEnabledFor(self,level):\n ''\n\n \n if self.disabled:\n return False\n \n try :\n return self._cache[level]\n except KeyError:\n _acquireLock()\n try :\n if self.manager.disable >=level:\n is_enabled=self._cache[level]=False\n else :\n is_enabled=self._cache[level]=(\n level >=self.getEffectiveLevel()\n )\n finally :\n _releaseLock()\n return is_enabled\n \n def getChild(self,suffix):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n if self.root is not self:\n suffix='.'.join((self.name,suffix))\n return self.manager.getLogger(suffix)\n \n def __repr__(self):\n level=getLevelName(self.getEffectiveLevel())\n return '<%s %s (%s)>'%(self.__class__.__name__,self.name,level)\n \n def __reduce__(self):\n \n \n if getLogger(self.name)is not self:\n import pickle\n raise pickle.PicklingError('logger cannot be pickled')\n return getLogger,(self.name,)\n \n \nclass RootLogger(Logger):\n ''\n\n\n\n \n def __init__(self,level):\n ''\n\n \n Logger.__init__(self,\"root\",level)\n \n def __reduce__(self):\n return getLogger,()\n \n_loggerClass=Logger\n\nclass LoggerAdapter(object):\n ''\n\n\n \n \n def __init__(self,logger,extra):\n ''\n\n\n\n\n\n\n\n\n \n self.logger=logger\n self.extra=extra\n \n def process(self,msg,kwargs):\n ''\n\n\n\n\n\n\n\n \n kwargs[\"extra\"]=self.extra\n return msg,kwargs\n \n \n \n \n def debug(self,msg,*args,**kwargs):\n ''\n\n \n self.log(DEBUG,msg,*args,**kwargs)\n \n def info(self,msg,*args,**kwargs):\n ''\n\n \n self.log(INFO,msg,*args,**kwargs)\n \n def warning(self,msg,*args,**kwargs):\n ''\n\n \n self.log(WARNING,msg,*args,**kwargs)\n \n def warn(self,msg,*args,**kwargs):\n warnings.warn(\"The 'warn' method is deprecated, \"\n \"use 'warning' instead\",DeprecationWarning,2)\n self.warning(msg,*args,**kwargs)\n \n def error(self,msg,*args,**kwargs):\n ''\n\n \n self.log(ERROR,msg,*args,**kwargs)\n \n def exception(self,msg,*args,exc_info=True ,**kwargs):\n ''\n\n \n self.log(ERROR,msg,*args,exc_info=exc_info,**kwargs)\n \n def critical(self,msg,*args,**kwargs):\n ''\n\n \n self.log(CRITICAL,msg,*args,**kwargs)\n \n def log(self,level,msg,*args,**kwargs):\n ''\n\n\n \n if self.isEnabledFor(level):\n msg,kwargs=self.process(msg,kwargs)\n self.logger.log(level,msg,*args,**kwargs)\n \n def isEnabledFor(self,level):\n ''\n\n \n return self.logger.isEnabledFor(level)\n \n def setLevel(self,level):\n ''\n\n \n self.logger.setLevel(level)\n \n def getEffectiveLevel(self):\n ''\n\n \n return self.logger.getEffectiveLevel()\n \n def hasHandlers(self):\n ''\n\n \n return self.logger.hasHandlers()\n \n def _log(self,level,msg,args,exc_info=None ,extra=None ,stack_info=False ):\n ''\n\n \n return self.logger._log(\n level,\n msg,\n args,\n exc_info=exc_info,\n extra=extra,\n stack_info=stack_info,\n )\n \n @property\n def manager(self):\n return self.logger.manager\n \n @manager.setter\n def manager(self,value):\n self.logger.manager=value\n \n @property\n def name(self):\n return self.logger.name\n \n def __repr__(self):\n logger=self.logger\n level=getLevelName(logger.getEffectiveLevel())\n return '<%s %s (%s)>'%(self.__class__.__name__,logger.name,level)\n \nroot=RootLogger(WARNING)\nLogger.root=root\nLogger.manager=Manager(Logger.root)\n\n\n\n\n\ndef basicConfig(**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n _acquireLock()\n try :\n force=kwargs.pop('force',False )\n encoding=kwargs.pop('encoding',None )\n errors=kwargs.pop('errors','backslashreplace')\n if force:\n for h in root.handlers[:]:\n root.removeHandler(h)\n h.close()\n if len(root.handlers)==0:\n handlers=kwargs.pop(\"handlers\",None )\n if handlers is None :\n if \"stream\"in kwargs and \"filename\"in kwargs:\n raise ValueError(\"'stream' and 'filename' should not be \"\n \"specified together\")\n else :\n if \"stream\"in kwargs or \"filename\"in kwargs:\n raise ValueError(\"'stream' or 'filename' should not be \"\n \"specified together with 'handlers'\")\n if handlers is None :\n filename=kwargs.pop(\"filename\",None )\n mode=kwargs.pop(\"filemode\",'a')\n if filename:\n if 'b'in mode:\n errors=None\n h=FileHandler(filename,mode,\n encoding=encoding,errors=errors)\n else :\n stream=kwargs.pop(\"stream\",None )\n h=StreamHandler(stream)\n handlers=[h]\n dfs=kwargs.pop(\"datefmt\",None )\n style=kwargs.pop(\"style\",'%')\n if style not in _STYLES:\n raise ValueError('Style must be one of: %s'%','.join(\n _STYLES.keys()))\n fs=kwargs.pop(\"format\",_STYLES[style][1])\n fmt=Formatter(fs,dfs,style)\n for h in handlers:\n if h.formatter is None :\n h.setFormatter(fmt)\n root.addHandler(h)\n level=kwargs.pop(\"level\",None )\n if level is not None :\n root.setLevel(level)\n if kwargs:\n keys=', '.join(kwargs.keys())\n raise ValueError('Unrecognised argument(s): %s'%keys)\n finally :\n _releaseLock()\n \n \n \n \n \n \ndef getLogger(name=None ):\n ''\n\n\n\n \n if not name or isinstance(name,str)and name ==root.name:\n return root\n return Logger.manager.getLogger(name)\n \ndef critical(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.critical(msg,*args,**kwargs)\n \nfatal=critical\n\ndef error(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.error(msg,*args,**kwargs)\n \ndef exception(msg,*args,exc_info=True ,**kwargs):\n ''\n\n\n\n \n error(msg,*args,exc_info=exc_info,**kwargs)\n \ndef warning(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.warning(msg,*args,**kwargs)\n \ndef warn(msg,*args,**kwargs):\n warnings.warn(\"The 'warn' function is deprecated, \"\n \"use 'warning' instead\",DeprecationWarning,2)\n warning(msg,*args,**kwargs)\n \ndef info(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.info(msg,*args,**kwargs)\n \ndef debug(msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.debug(msg,*args,**kwargs)\n \ndef log(level,msg,*args,**kwargs):\n ''\n\n\n\n \n if len(root.handlers)==0:\n basicConfig()\n root.log(level,msg,*args,**kwargs)\n \ndef disable(level=CRITICAL):\n ''\n\n \n root.manager.disable=level\n root.manager._clear_cache()\n \ndef shutdown(handlerList=_handlerList):\n ''\n\n\n\n\n \n for wr in reversed(handlerList[:]):\n \n \n try :\n h=wr()\n if h:\n try :\n h.acquire()\n h.flush()\n h.close()\n except (OSError,ValueError):\n \n \n \n \n pass\n finally :\n h.release()\n except :\n if raiseExceptions:\n raise\n \n \n \nimport atexit\natexit.register(shutdown)\n\n\n\nclass NullHandler(Handler):\n ''\n\n\n\n\n\n\n\n \n def handle(self,record):\n ''\n \n def emit(self,record):\n ''\n \n def createLock(self):\n self.lock=None\n \n def _at_fork_reinit(self):\n pass\n \n \n \n_warnings_showwarning=None\n\ndef _showwarning(message,category,filename,lineno,file=None ,line=None ):\n ''\n\n\n\n\n\n \n if file is not None :\n if _warnings_showwarning is not None :\n _warnings_showwarning(message,category,filename,lineno,file,line)\n else :\n s=warnings.formatwarning(message,category,filename,lineno,line)\n logger=getLogger(\"py.warnings\")\n if not logger.handlers:\n logger.addHandler(NullHandler())\n logger.warning(\"%s\",s)\n \ndef captureWarnings(capture):\n ''\n\n\n\n \n global _warnings_showwarning\n if capture:\n if _warnings_showwarning is None :\n _warnings_showwarning=warnings.showwarning\n warnings.showwarning=_showwarning\n else :\n if _warnings_showwarning is not None :\n warnings.showwarning=_warnings_showwarning\n _warnings_showwarning=None\n", ["atexit", "collections.abc", "io", "os", "pickle", "re", "string", "sys", "threading", "time", "traceback", "warnings", "weakref"], 1], "multiprocessing.connection": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['Client','Listener','Pipe']\n\nfrom queue import Queue\n\n\nfamilies=[None ]\n\n\nclass Listener(object):\n\n def __init__(self,address=None ,family=None ,backlog=1):\n self._backlog_queue=Queue(backlog)\n \n def accept(self):\n return Connection(*self._backlog_queue.get())\n \n def close(self):\n self._backlog_queue=None\n \n address=property(lambda self:self._backlog_queue)\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,exc_tb):\n self.close()\n \n \ndef Client(address):\n _in,_out=Queue(),Queue()\n address.put((_out,_in))\n return Connection(_in,_out)\n \n \ndef Pipe(duplex=True ):\n a,b=Queue(),Queue()\n return Connection(a,b),Connection(b,a)\n \n \nclass Connection(object):\n\n def __init__(self,_in,_out):\n self._out=_out\n self._in=_in\n self.send=self.send_bytes=_out.put\n self.recv=self.recv_bytes=_in.get\n \n def poll(self,timeout=0.0):\n if self._in.qsize()>0:\n return True\n if timeout <=0.0:\n return False\n self._in.not_empty.acquire()\n self._in.not_empty.wait(timeout)\n self._in.not_empty.release()\n return self._in.qsize()>0\n \n def close(self):\n pass\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,exc_tb):\n self.close()\n", ["queue"]], "multiprocessing.pool": [".py", "\n\n\n\n\n\n\n\n\n__all__=['Pool']\n\n\n\n\n\nimport threading\nimport queue\nimport itertools\nimport collections\nimport time\n\nfrom multiprocessing import Process,cpu_count,TimeoutError\nfrom multiprocessing.util import Finalize,debug\n\n\n\n\n\nRUN=0\nCLOSE=1\nTERMINATE=2\n\n\n\n\n\njob_counter=itertools.count()\n\ndef mapstar(args):\n return list(map(*args))\n \ndef starmapstar(args):\n return list(itertools.starmap(args[0],args[1]))\n \n \n \n \n \nclass MaybeEncodingError(Exception):\n ''\n \n \n def __init__(self,exc,value):\n self.exc=repr(exc)\n self.value=repr(value)\n super(MaybeEncodingError,self).__init__(self.exc,self.value)\n \n def __str__(self):\n return \"Error sending result: '%s'. Reason: '%s'\"%(self.value,\n self.exc)\n \n def __repr__(self):\n return \"\"%str(self)\n \n \ndef worker(inqueue,outqueue,initializer=None ,initargs=(),maxtasks=None ):\n assert maxtasks is None or (type(maxtasks)==int and maxtasks >0)\n put=outqueue.put\n get=inqueue.get\n if hasattr(inqueue,'_writer'):\n inqueue._writer.close()\n outqueue._reader.close()\n \n if initializer is not None :\n initializer(*initargs)\n \n completed=0\n while maxtasks is None or (maxtasks and completed 1\n task_batches=Pool._get_tasks(func,iterable,chunksize)\n result=IMapIterator(self._cache)\n self._taskqueue.put((((result._job,i,mapstar,(x,),{})\n for i,x in enumerate(task_batches)),result._set_length))\n return (item for chunk in result for item in chunk)\n \n def imap_unordered(self,func,iterable,chunksize=1):\n ''\n\n \n if self._state !=RUN:\n raise ValueError(\"Pool not running\")\n if chunksize ==1:\n result=IMapUnorderedIterator(self._cache)\n self._taskqueue.put((((result._job,i,func,(x,),{})\n for i,x in enumerate(iterable)),result._set_length))\n return result\n else :\n assert chunksize >1\n task_batches=Pool._get_tasks(func,iterable,chunksize)\n result=IMapUnorderedIterator(self._cache)\n self._taskqueue.put((((result._job,i,mapstar,(x,),{})\n for i,x in enumerate(task_batches)),result._set_length))\n return (item for chunk in result for item in chunk)\n \n def apply_async(self,func,args=(),kwds={},callback=None ,\n error_callback=None ):\n ''\n\n \n if self._state !=RUN:\n raise ValueError(\"Pool not running\")\n result=ApplyResult(self._cache,callback,error_callback)\n self._taskqueue.put(([(result._job,None ,func,args,kwds)],None ))\n return result\n \n def map_async(self,func,iterable,chunksize=None ,callback=None ,\n error_callback=None ):\n ''\n\n \n return self._map_async(func,iterable,mapstar,chunksize,callback,\n error_callback)\n \n def _map_async(self,func,iterable,mapper,chunksize=None ,callback=None ,\n error_callback=None ):\n ''\n\n \n if self._state !=RUN:\n raise ValueError(\"Pool not running\")\n if not hasattr(iterable,'__len__'):\n iterable=list(iterable)\n \n if chunksize is None :\n chunksize,extra=divmod(len(iterable),len(self._pool)*4)\n if extra:\n chunksize +=1\n if len(iterable)==0:\n chunksize=0\n \n task_batches=Pool._get_tasks(func,iterable,chunksize)\n result=MapResult(self._cache,chunksize,len(iterable),callback,\n error_callback=error_callback)\n self._taskqueue.put((((result._job,i,mapper,(x,),{})\n for i,x in enumerate(task_batches)),None ))\n return result\n \n @staticmethod\n def _handle_workers(pool):\n thread=threading.current_thread()\n \n \n \n while thread._state ==RUN or (pool._cache and thread._state !=TERMINATE):\n pool._maintain_pool()\n time.sleep(0.1)\n \n pool._taskqueue.put(None )\n debug('worker handler exiting')\n \n @staticmethod\n def _handle_tasks(taskqueue,put,outqueue,pool):\n thread=threading.current_thread()\n \n for taskseq,set_length in iter(taskqueue.get,None ):\n i=-1\n for i,task in enumerate(taskseq):\n if thread._state:\n debug('task handler found thread._state != RUN')\n break\n try :\n put(task)\n except IOError:\n debug('could not put task on queue')\n break\n else :\n if set_length:\n debug('doing set_length()')\n set_length(i+1)\n continue\n break\n else :\n debug('task handler got sentinel')\n \n \n try :\n \n debug('task handler sending sentinel to result handler')\n outqueue.put(None )\n \n \n debug('task handler sending sentinel to workers')\n for p in pool:\n put(None )\n except IOError:\n debug('task handler got IOError when sending sentinels')\n \n debug('task handler exiting')\n \n @staticmethod\n def _handle_results(outqueue,get,cache):\n thread=threading.current_thread()\n \n while 1:\n try :\n task=get()\n except (IOError,EOFError):\n debug('result handler got EOFError/IOError -- exiting')\n return\n \n if thread._state:\n assert thread._state ==TERMINATE\n debug('result handler found thread._state=TERMINATE')\n break\n \n if task is None :\n debug('result handler got sentinel')\n break\n \n job,i,obj=task\n try :\n cache[job]._set(i,obj)\n except KeyError:\n pass\n \n while cache and thread._state !=TERMINATE:\n try :\n task=get()\n except (IOError,EOFError):\n debug('result handler got EOFError/IOError -- exiting')\n return\n \n if task is None :\n debug('result handler ignoring extra sentinel')\n continue\n job,i,obj=task\n try :\n cache[job]._set(i,obj)\n except KeyError:\n pass\n \n if hasattr(outqueue,'_reader'):\n debug('ensuring that outqueue is not full')\n \n \n \n try :\n for i in range(10):\n if not outqueue._reader.poll():\n break\n get()\n except (IOError,EOFError):\n pass\n \n debug('result handler exiting: len(cache)=%s, thread._state=%s',\n len(cache),thread._state)\n \n @staticmethod\n def _get_tasks(func,it,size):\n it=iter(it)\n while 1:\n x=tuple(itertools.islice(it,size))\n if not x:\n return\n yield (func,x)\n \n def __reduce__(self):\n raise NotImplementedError(\n 'pool objects cannot be passed between processes or pickled'\n )\n \n def close(self):\n debug('closing pool')\n if self._state ==RUN:\n self._state=CLOSE\n self._worker_handler._state=CLOSE\n \n def terminate(self):\n debug('terminating pool')\n self._state=TERMINATE\n self._worker_handler._state=TERMINATE\n self._terminate()\n \n def join(self):\n debug('joining pool')\n assert self._state in (CLOSE,TERMINATE)\n self._worker_handler.join()\n self._task_handler.join()\n self._result_handler.join()\n for p in self._pool:\n p.join()\n \n @staticmethod\n def _help_stuff_finish(inqueue,task_handler,size):\n \n debug('removing tasks from inqueue until task handler finished')\n inqueue._rlock.acquire()\n while task_handler.is_alive()and inqueue._reader.poll():\n inqueue._reader.recv()\n time.sleep(0)\n \n @classmethod\n def _terminate_pool(cls,taskqueue,inqueue,outqueue,pool,\n worker_handler,task_handler,result_handler,cache):\n \n debug('finalizing pool')\n \n worker_handler._state=TERMINATE\n task_handler._state=TERMINATE\n \n debug('helping task handler/workers to finish')\n cls._help_stuff_finish(inqueue,task_handler,len(pool))\n \n assert result_handler.is_alive()or len(cache)==0\n \n result_handler._state=TERMINATE\n outqueue.put(None )\n \n \n \n debug('joining worker handler')\n if threading.current_thread()is not worker_handler:\n worker_handler.join()\n \n \n if pool and hasattr(pool[0],'terminate'):\n debug('terminating workers')\n for p in pool:\n if p.exitcode is None :\n p.terminate()\n \n debug('joining task handler')\n if threading.current_thread()is not task_handler:\n task_handler.join()\n \n debug('joining result handler')\n if threading.current_thread()is not result_handler:\n result_handler.join()\n \n if pool and hasattr(pool[0],'terminate'):\n debug('joining pool workers')\n for p in pool:\n if p.is_alive():\n \n debug('cleaning up worker %d'%p.pid)\n p.join()\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_val,exc_tb):\n self.terminate()\n \n \n \n \n \nclass ApplyResult(object):\n\n def __init__(self,cache,callback,error_callback):\n self._event=threading.Event()\n self._job=next(job_counter)\n self._cache=cache\n self._callback=callback\n self._error_callback=error_callback\n cache[self._job]=self\n \n def ready(self):\n return self._event.is_set()\n \n def successful(self):\n assert self.ready()\n return self._success\n \n def wait(self,timeout=None ):\n self._event.wait(timeout)\n \n def get(self,timeout=None ):\n self.wait(timeout)\n if not self.ready():\n raise TimeoutError\n if self._success:\n return self._value\n else :\n raise self._value\n \n def _set(self,i,obj):\n self._success,self._value=obj\n if self._callback and self._success:\n self._callback(self._value)\n if self._error_callback and not self._success:\n self._error_callback(self._value)\n self._event.set()\n del self._cache[self._job]\n \nAsyncResult=ApplyResult\n\n\n\n\n\nclass MapResult(ApplyResult):\n\n def __init__(self,cache,chunksize,length,callback,error_callback):\n ApplyResult.__init__(self,cache,callback,\n error_callback=error_callback)\n self._success=True\n self._value=[None ]*length\n self._chunksize=chunksize\n if chunksize <=0:\n self._number_left=0\n self._event.set()\n del cache[self._job]\n else :\n self._number_left=length //chunksize+bool(length %chunksize)\n \n def _set(self,i,success_result):\n success,result=success_result\n if success:\n self._value[i *self._chunksize:(i+1)*self._chunksize]=result\n self._number_left -=1\n if self._number_left ==0:\n if self._callback:\n self._callback(self._value)\n del self._cache[self._job]\n self._event.set()\n else :\n self._success=False\n self._value=result\n if self._error_callback:\n self._error_callback(self._value)\n del self._cache[self._job]\n self._event.set()\n \n \n \n \n \nclass IMapIterator(object):\n\n def __init__(self,cache):\n self._cond=threading.Condition(threading.Lock())\n self._job=next(job_counter)\n self._cache=cache\n self._items=collections.deque()\n self._index=0\n self._length=None\n self._unsorted={}\n cache[self._job]=self\n \n def __iter__(self):\n return self\n \n def next(self,timeout=None ):\n self._cond.acquire()\n try :\n try :\n item=self._items.popleft()\n except IndexError:\n if self._index ==self._length:\n raise StopIteration\n self._cond.wait(timeout)\n try :\n item=self._items.popleft()\n except IndexError:\n if self._index ==self._length:\n raise StopIteration\n raise TimeoutError\n finally :\n self._cond.release()\n \n success,value=item\n if success:\n return value\n raise value\n \n __next__=next\n \n def _set(self,i,obj):\n self._cond.acquire()\n try :\n if self._index ==i:\n self._items.append(obj)\n self._index +=1\n while self._index in self._unsorted:\n obj=self._unsorted.pop(self._index)\n self._items.append(obj)\n self._index +=1\n self._cond.notify()\n else :\n self._unsorted[i]=obj\n \n if self._index ==self._length:\n del self._cache[self._job]\n finally :\n self._cond.release()\n \n def _set_length(self,length):\n self._cond.acquire()\n try :\n self._length=length\n if self._index ==self._length:\n self._cond.notify()\n del self._cache[self._job]\n finally :\n self._cond.release()\n \n \n \n \n \nclass IMapUnorderedIterator(IMapIterator):\n\n def _set(self,i,obj):\n self._cond.acquire()\n try :\n self._items.append(obj)\n self._index +=1\n self._cond.notify()\n if self._index ==self._length:\n del self._cache[self._job]\n finally :\n self._cond.release()\n \n \n \n \n \nclass ThreadPool(Pool):\n\n from .dummy import Process\n \n def __init__(self,processes=None ,initializer=None ,initargs=()):\n Pool.__init__(self,processes,initializer,initargs)\n \n def _setup_queues(self):\n self._inqueue=queue.Queue()\n self._outqueue=queue.Queue()\n self._quick_put=self._inqueue.put\n self._quick_get=self._outqueue.get\n \n @staticmethod\n def _help_stuff_finish(inqueue,task_handler,size):\n \n inqueue.not_empty.acquire()\n try :\n inqueue.queue.clear()\n inqueue.queue.extend([None ]*size)\n inqueue.not_empty.notify_all()\n finally :\n inqueue.not_empty.release()\n", ["collections", "itertools", "multiprocessing", "multiprocessing.Process", "multiprocessing.dummy", "multiprocessing.queues", "multiprocessing.util", "queue", "threading", "time"]], "multiprocessing.process": [".py", "\n\n\n\n\n\n\n\n\n__all__=['Process','current_process','active_children']\n\n\n\n\n\nimport os\nimport sys\nimport signal\nimport itertools\nfrom _weakrefset import WeakSet\n\n\nfrom _multiprocessing import Process\n\n\n\n\ntry :\n ORIGINAL_DIR=os.path.abspath(os.getcwd())\nexcept OSError:\n ORIGINAL_DIR=None\n \n \n \n \n \ndef current_process():\n ''\n\n \n return _current_process\n \ndef active_children():\n ''\n\n \n _cleanup()\n return list(_current_process._children)\n \n \n \n \n \ndef _cleanup():\n\n for p in list(_current_process._children):\n if p._popen.poll()is not None :\n _current_process._children.discard(p)\n \n \n \n \n \n \n \n \n \n \n \n \nclass AuthenticationString(bytes):\n def __reduce__(self):\n from .forking import Popen\n if not Popen.thread_is_spawning():\n raise TypeError(\n 'Pickling an AuthenticationString object is '\n 'disallowed for security reasons'\n )\n return AuthenticationString,(bytes(self),)\n \n \n \n \n \nclass _MainProcess(Process):\n\n def __init__(self):\n self._identity=()\n self._daemonic=False\n self._name='MainProcess'\n self._parent_pid=None\n self._popen=None\n self._counter=itertools.count(1)\n self._children=set()\n self._authkey=AuthenticationString(os.urandom(32))\n self._tempdir=None\n \n_current_process=_MainProcess()\ndel _MainProcess\n\n\n\n\n\n_exitcode_to_name={}\n\nfor name,signum in list(signal.__dict__.items()):\n if name[:3]=='SIG'and '_'not in name:\n _exitcode_to_name[-signum]=name\n \n \n_dangling=WeakSet()\n", ["_multiprocessing", "_weakrefset", "itertools", "multiprocessing.forking", "os", "signal", "sys"]], "multiprocessing.util": [".py", "\n\n\n\n\n\n\n\n\nimport sys\nimport functools\nimport os\nimport itertools\nimport weakref\nimport atexit\nimport threading\n\nfrom subprocess import _args_from_interpreter_flags\n\nfrom multiprocessing.process import current_process,active_children\n\n__all__=[\n'sub_debug','debug','info','sub_warning','get_logger',\n'log_to_stderr','get_temp_dir','register_after_fork',\n'is_exiting','Finalize','ForkAwareThreadLock','ForkAwareLocal',\n'SUBDEBUG','SUBWARNING',\n]\n\n\n\n\n\nNOTSET=0\nSUBDEBUG=5\nDEBUG=10\nINFO=20\nSUBWARNING=25\n\nLOGGER_NAME='multiprocessing'\nDEFAULT_LOGGING_FORMAT='[%(levelname)s/%(processName)s] %(message)s'\n\n_logger=None\n_log_to_stderr=False\n\ndef sub_debug(msg,*args):\n if _logger:\n _logger.log(SUBDEBUG,msg,*args)\n \ndef debug(msg,*args):\n if _logger:\n _logger.log(DEBUG,msg,*args)\n \ndef info(msg,*args):\n if _logger:\n _logger.log(INFO,msg,*args)\n \ndef sub_warning(msg,*args):\n if _logger:\n _logger.log(SUBWARNING,msg,*args)\n \ndef get_logger():\n ''\n\n \n global _logger\n import logging\n \n logging._acquireLock()\n try :\n if not _logger:\n \n _logger=logging.getLogger(LOGGER_NAME)\n _logger.propagate=0\n logging.addLevelName(SUBDEBUG,'SUBDEBUG')\n logging.addLevelName(SUBWARNING,'SUBWARNING')\n \n \n if hasattr(atexit,'unregister'):\n atexit.unregister(_exit_function)\n atexit.register(_exit_function)\n else :\n atexit._exithandlers.remove((_exit_function,(),{}))\n atexit._exithandlers.append((_exit_function,(),{}))\n \n finally :\n logging._releaseLock()\n \n return _logger\n \ndef log_to_stderr(level=None ):\n ''\n\n \n global _log_to_stderr\n import logging\n \n logger=get_logger()\n formatter=logging.Formatter(DEFAULT_LOGGING_FORMAT)\n handler=logging.StreamHandler()\n handler.setFormatter(formatter)\n logger.addHandler(handler)\n \n if level:\n logger.setLevel(level)\n _log_to_stderr=True\n return _logger\n \n \n \n \n \ndef get_temp_dir():\n\n if current_process()._tempdir is None :\n import shutil,tempfile\n tempdir=tempfile.mkdtemp(prefix='pymp-')\n info('created temp directory %s',tempdir)\n Finalize(None ,shutil.rmtree,args=[tempdir],exitpriority=-100)\n current_process()._tempdir=tempdir\n return current_process()._tempdir\n \n \n \n \n \n_afterfork_registry=weakref.WeakValueDictionary()\n_afterfork_counter=itertools.count()\n\ndef _run_after_forkers():\n items=list(_afterfork_registry.items())\n items.sort()\n for (index,ident,func),obj in items:\n try :\n func(obj)\n except Exception as e:\n info('after forker raised exception %s',e)\n \ndef register_after_fork(obj,func):\n _afterfork_registry[(next(_afterfork_counter),id(obj),func)]=obj\n \n \n \n \n \n_finalizer_registry={}\n_finalizer_counter=itertools.count()\n\n\nclass Finalize(object):\n ''\n\n \n def __init__(self,obj,callback,args=(),kwargs=None ,exitpriority=None ):\n assert exitpriority is None or type(exitpriority)is int\n \n if obj is not None :\n self._weakref=weakref.ref(obj,self)\n else :\n assert exitpriority is not None\n \n self._callback=callback\n self._args=args\n self._kwargs=kwargs or {}\n self._key=(exitpriority,next(_finalizer_counter))\n self._pid=os.getpid()\n \n _finalizer_registry[self._key]=self\n \n def __call__(self,wr=None ,\n \n \n _finalizer_registry=_finalizer_registry,\n sub_debug=sub_debug,getpid=os.getpid):\n ''\n\n \n try :\n del _finalizer_registry[self._key]\n except KeyError:\n sub_debug('finalizer no longer registered')\n else :\n if self._pid !=getpid():\n sub_debug('finalizer ignored because different process')\n res=None\n else :\n sub_debug('finalizer calling %s with args %s and kwargs %s',\n self._callback,self._args,self._kwargs)\n res=self._callback(*self._args,**self._kwargs)\n self._weakref=self._callback=self._args=\\\n self._kwargs=self._key=None\n return res\n \n def cancel(self):\n ''\n\n \n try :\n del _finalizer_registry[self._key]\n except KeyError:\n pass\n else :\n self._weakref=self._callback=self._args=\\\n self._kwargs=self._key=None\n \n def still_active(self):\n ''\n\n \n return self._key in _finalizer_registry\n \n def __repr__(self):\n try :\n obj=self._weakref()\n except (AttributeError,TypeError):\n obj=None\n \n if obj is None :\n return ''\n \n x=''\n \n \ndef _run_finalizers(minpriority=None ):\n ''\n\n\n\n\n \n if _finalizer_registry is None :\n \n \n \n return\n \n if minpriority is None :\n f=lambda p:p[0][0]is not None\n else :\n f=lambda p:p[0][0]is not None and p[0][0]>=minpriority\n \n items=[x for x in list(_finalizer_registry.items())if f(x)]\n items.sort(reverse=True )\n \n for key,finalizer in items:\n sub_debug('calling %s',finalizer)\n try :\n finalizer()\n except Exception:\n import traceback\n traceback.print_exc()\n \n if minpriority is None :\n _finalizer_registry.clear()\n \n \n \n \n \ndef is_exiting():\n ''\n\n \n return _exiting or _exiting is None\n \n_exiting=False\n\ndef _exit_function(info=info,debug=debug,_run_finalizers=_run_finalizers,\nactive_children=active_children,\ncurrent_process=current_process):\n\n\n\n\n global _exiting\n \n if not _exiting:\n _exiting=True\n \n info('process shutting down')\n debug('running all \"atexit\" finalizers with priority >= 0')\n _run_finalizers(0)\n \n if current_process()is not None :\n \n \n \n \n \n \n \n \n \n \n \n \n \n for p in active_children():\n if p._daemonic:\n info('calling terminate() for daemon %s',p.name)\n p._popen.terminate()\n \n for p in active_children():\n info('calling join() for process %s',p.name)\n p.join()\n \n debug('running the remaining \"atexit\" finalizers')\n _run_finalizers()\n \natexit.register(_exit_function)\n\n\n\n\n\nclass ForkAwareThreadLock(object):\n def __init__(self):\n self._reset()\n register_after_fork(self,ForkAwareThreadLock._reset)\n \n def _reset(self):\n self._lock=threading.Lock()\n self.acquire=self._lock.acquire\n self.release=self._lock.release\n \nclass ForkAwareLocal(threading.local):\n def __init__(self):\n register_after_fork(self,lambda obj:obj.__dict__.clear())\n def __reduce__(self):\n return type(self),()\n", ["atexit", "functools", "itertools", "logging", "multiprocessing.process", "os", "shutil", "subprocess", "sys", "tempfile", "threading", "traceback", "weakref"]], "multiprocessing": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__version__='0.70a1'\n\n__all__=[\n'Process','current_process','active_children','freeze_support',\n'Manager','Pipe','cpu_count','log_to_stderr','get_logger',\n'allow_connection_pickling','BufferTooShort','TimeoutError',\n'Lock','RLock','Semaphore','BoundedSemaphore','Condition',\n'Event','Barrier','Queue','SimpleQueue','JoinableQueue','Pool',\n'Value','Array','RawValue','RawArray','SUBDEBUG','SUBWARNING',\n]\n\n__author__='R. Oudkerk (r.m.oudkerk@gmail.com)'\n\n\n\n\n\nimport os\nimport sys\n\nfrom multiprocessing.process import Process,current_process,active_children\nfrom multiprocessing.util import SUBDEBUG,SUBWARNING\n\n\n\n\n\nclass ProcessError(Exception):\n pass\n \nclass BufferTooShort(ProcessError):\n pass\n \nclass TimeoutError(ProcessError):\n pass\n \nclass AuthenticationError(ProcessError):\n pass\n \nimport _multiprocessing\n\n\n\n\n\ndef Manager():\n ''\n\n\n\n\n \n from multiprocessing.managers import SyncManager\n m=SyncManager()\n m.start()\n return m\n \n \n \n \n \n \n \n \n \ndef cpu_count():\n ''\n\n \n if sys.platform =='win32':\n try :\n num=int(os.environ['NUMBER_OF_PROCESSORS'])\n except (ValueError,KeyError):\n num=0\n elif 'bsd'in sys.platform or sys.platform =='darwin':\n comm='/sbin/sysctl -n hw.ncpu'\n if sys.platform =='darwin':\n comm='/usr'+comm\n try :\n with os.popen(comm)as p:\n num=int(p.read())\n except ValueError:\n num=0\n else :\n try :\n num=os.sysconf('SC_NPROCESSORS_ONLN')\n except (ValueError,OSError,AttributeError):\n num=0\n \n if num >=1:\n return num\n else :\n raise NotImplementedError('cannot determine number of cpus')\n \ndef freeze_support():\n ''\n\n\n \n if sys.platform =='win32'and getattr(sys,'frozen',False ):\n from multiprocessing.forking import freeze_support\n freeze_support()\n \ndef get_logger():\n ''\n\n \n from multiprocessing.util import get_logger\n return get_logger()\n \ndef log_to_stderr(level=None ):\n ''\n\n \n from multiprocessing.util import log_to_stderr\n return log_to_stderr(level)\n \n \n \n \n \n \n \n \n \n \n \n \n \n \ndef Lock():\n ''\n\n \n from multiprocessing.synchronize import Lock\n return Lock()\n \ndef RLock():\n ''\n\n \n from multiprocessing.synchronize import RLock\n return RLock()\n \ndef Condition(lock=None ):\n ''\n\n \n from multiprocessing.synchronize import Condition\n return Condition(lock)\n \ndef Semaphore(value=1):\n ''\n\n \n from multiprocessing.synchronize import Semaphore\n return Semaphore(value)\n \ndef BoundedSemaphore(value=1):\n ''\n\n \n from multiprocessing.synchronize import BoundedSemaphore\n return BoundedSemaphore(value)\n \ndef Event():\n ''\n\n \n from multiprocessing.synchronize import Event\n return Event()\n \ndef Barrier(parties,action=None ,timeout=None ):\n ''\n\n \n from multiprocessing.synchronize import Barrier\n return Barrier(parties,action,timeout)\n \ndef Queue(maxsize=0):\n ''\n\n \n from multiprocessing.queues import Queue\n return Queue(maxsize)\n \ndef JoinableQueue(maxsize=0):\n ''\n\n \n from multiprocessing.queues import JoinableQueue\n return JoinableQueue(maxsize)\n \ndef SimpleQueue():\n ''\n\n \n from multiprocessing.queues import SimpleQueue\n return SimpleQueue()\n \ndef Pool(processes=None ,initializer=None ,initargs=(),maxtasksperchild=None ):\n ''\n\n \n from multiprocessing.pool import Pool\n return Pool(processes,initializer,initargs,maxtasksperchild)\n \ndef RawValue(typecode_or_type,*args):\n ''\n\n \n from multiprocessing.sharedctypes import RawValue\n return RawValue(typecode_or_type,*args)\n \ndef RawArray(typecode_or_type,size_or_initializer):\n ''\n\n \n from multiprocessing.sharedctypes import RawArray\n return RawArray(typecode_or_type,size_or_initializer)\n \ndef Value(typecode_or_type,*args,lock=True ):\n ''\n\n \n from multiprocessing.sharedctypes import Value\n return Value(typecode_or_type,*args,lock=lock)\n \ndef Array(typecode_or_type,size_or_initializer,*,lock=True ):\n ''\n\n \n from multiprocessing.sharedctypes import Array\n return Array(typecode_or_type,size_or_initializer,lock=lock)\n \n \n \n \n \nif sys.platform =='win32':\n\n def set_executable(executable):\n ''\n\n\n\n \n from multiprocessing.forking import set_executable\n set_executable(executable)\n \n __all__ +=['set_executable']\n", ["_multiprocessing", "multiprocessing.forking", "multiprocessing.managers", "multiprocessing.pool", "multiprocessing.process", "multiprocessing.queues", "multiprocessing.sharedctypes", "multiprocessing.synchronize", "multiprocessing.util", "os", "sys"], 1], "multiprocessing.dummy.connection": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['Client','Listener','Pipe']\n\nfrom queue import Queue\n\n\nfamilies=[None ]\n\n\nclass Listener(object):\n\n def __init__(self,address=None ,family=None ,backlog=1):\n self._backlog_queue=Queue(backlog)\n \n def accept(self):\n return Connection(*self._backlog_queue.get())\n \n def close(self):\n self._backlog_queue=None\n \n address=property(lambda self:self._backlog_queue)\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,exc_tb):\n self.close()\n \n \ndef Client(address):\n _in,_out=Queue(),Queue()\n address.put((_out,_in))\n return Connection(_in,_out)\n \n \ndef Pipe(duplex=True ):\n a,b=Queue(),Queue()\n return Connection(a,b),Connection(b,a)\n \n \nclass Connection(object):\n\n def __init__(self,_in,_out):\n self._out=_out\n self._in=_in\n self.send=self.send_bytes=_out.put\n self.recv=self.recv_bytes=_in.get\n \n def poll(self,timeout=0.0):\n if self._in.qsize()>0:\n return True\n if timeout <=0.0:\n return False\n self._in.not_empty.acquire()\n self._in.not_empty.wait(timeout)\n self._in.not_empty.release()\n return self._in.qsize()>0\n \n def close(self):\n pass\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,exc_tb):\n self.close()\n", ["queue"]], "multiprocessing.dummy": [".py", "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=[\n'Process','current_process','active_children','freeze_support',\n'Lock','RLock','Semaphore','BoundedSemaphore','Condition',\n'Event','Barrier','Queue','Manager','Pipe','Pool','JoinableQueue'\n]\n\n\n\n\n\nimport threading\nimport sys\nimport weakref\n\n\n\nfrom multiprocessing.dummy.connection import Pipe\nfrom threading import Lock,RLock,Semaphore,BoundedSemaphore\nfrom threading import Event,Condition,Barrier\nfrom queue import Queue\n\n\n\n\n\nclass DummyProcess(threading.Thread):\n\n def __init__(self,group=None ,target=None ,name=None ,args=(),kwargs={}):\n threading.Thread.__init__(self,group,target,name,args,kwargs)\n self._pid=None\n self._children=weakref.WeakKeyDictionary()\n self._start_called=False\n self._parent=current_process()\n \n def start(self):\n assert self._parent is current_process()\n self._start_called=True\n if hasattr(self._parent,'_children'):\n self._parent._children[self]=None\n threading.Thread.start(self)\n \n @property\n def exitcode(self):\n if self._start_called and not self.is_alive():\n return 0\n else :\n return None\n \n \n \n \n \nProcess=DummyProcess\ncurrent_process=threading.current_thread\ncurrent_process()._children=weakref.WeakKeyDictionary()\n\ndef active_children():\n children=current_process()._children\n for p in list(children):\n if not p.is_alive():\n children.pop(p,None )\n return list(children)\n \ndef freeze_support():\n pass\n \n \n \n \n \nclass Namespace(object):\n def __init__(self,**kwds):\n self.__dict__.update(kwds)\n def __repr__(self):\n items=list(self.__dict__.items())\n temp=[]\n for name,value in items:\n if not name.startswith('_'):\n temp.append('%s=%r'%(name,value))\n temp.sort()\n return 'Namespace(%s)'%str.join(', ',temp)\n \ndict=dict\nlist=list\n\n\n\n\n\nclass Value(object):\n def __init__(self,typecode,value,lock=True ):\n self._typecode=typecode\n self._value=value\n def _get(self):\n return self._value\n def _set(self,value):\n self._value=value\n value=property(_get,_set)\n def __repr__(self):\n return '<%r(%r, %r)>'%(type(self).__name__,self._typecode,self._value)\n \ndef Manager():\n return sys.modules[__name__]\n \ndef shutdown():\n pass\n \ndef Pool(processes=None ,initializer=None ,initargs=()):\n from multiprocessing.pool import ThreadPool\n return ThreadPool(processes,initializer,initargs)\n \nJoinableQueue=Queue\n", ["multiprocessing.dummy.connection", "multiprocessing.pool", "queue", "sys", "threading", "weakref"], 1], "pydoc_data.topics": [".py", "\n\ntopics={'assert':'The \"assert\" statement\\n'\n'**********************\\n'\n'\\n'\n'Assert statements are a convenient way to insert debugging '\n'assertions\\n'\n'into a program:\\n'\n'\\n'\n' assert_stmt ::= \"assert\" expression [\",\" expression]\\n'\n'\\n'\n'The simple form, \"assert expression\", is equivalent to\\n'\n'\\n'\n' if __debug__:\\n'\n' if not expression: raise AssertionError\\n'\n'\\n'\n'The extended form, \"assert expression1, expression2\", is '\n'equivalent to\\n'\n'\\n'\n' if __debug__:\\n'\n' if not expression1: raise AssertionError(expression2)\\n'\n'\\n'\n'These equivalences assume that \"__debug__\" and \"AssertionError\" '\n'refer\\n'\n'to the built-in variables with those names. In the current\\n'\n'implementation, the built-in variable \"__debug__\" is \"True\" under\\n'\n'normal circumstances, \"False\" when optimization is requested '\n'(command\\n'\n'line option \"-O\"). The current code generator emits no code for '\n'an\\n'\n'assert statement when optimization is requested at compile time. '\n'Note\\n'\n'that it is unnecessary to include the source code for the '\n'expression\\n'\n'that failed in the error message; it will be displayed as part of '\n'the\\n'\n'stack trace.\\n'\n'\\n'\n'Assignments to \"__debug__\" are illegal. The value for the '\n'built-in\\n'\n'variable is determined when the interpreter starts.\\n',\n'assignment':'Assignment statements\\n'\n'*********************\\n'\n'\\n'\n'Assignment statements are used to (re)bind names to values and '\n'to\\n'\n'modify attributes or items of mutable objects:\\n'\n'\\n'\n' assignment_stmt ::= (target_list \"=\")+ (starred_expression '\n'| yield_expression)\\n'\n' target_list ::= target (\",\" target)* [\",\"]\\n'\n' target ::= identifier\\n'\n' | \"(\" [target_list] \")\"\\n'\n' | \"[\" [target_list] \"]\"\\n'\n' | attributeref\\n'\n' | subscription\\n'\n' | slicing\\n'\n' | \"*\" target\\n'\n'\\n'\n'(See section Primaries for the syntax definitions for '\n'*attributeref*,\\n'\n'*subscription*, and *slicing*.)\\n'\n'\\n'\n'An assignment statement evaluates the expression list '\n'(remember that\\n'\n'this can be a single expression or a comma-separated list, the '\n'latter\\n'\n'yielding a tuple) and assigns the single resulting object to '\n'each of\\n'\n'the target lists, from left to right.\\n'\n'\\n'\n'Assignment is defined recursively depending on the form of the '\n'target\\n'\n'(list). When a target is part of a mutable object (an '\n'attribute\\n'\n'reference, subscription or slicing), the mutable object must\\n'\n'ultimately perform the assignment and decide about its '\n'validity, and\\n'\n'may raise an exception if the assignment is unacceptable. The '\n'rules\\n'\n'observed by various types and the exceptions raised are given '\n'with the\\n'\n'definition of the object types (see section The standard type\\n'\n'hierarchy).\\n'\n'\\n'\n'Assignment of an object to a target list, optionally enclosed '\n'in\\n'\n'parentheses or square brackets, is recursively defined as '\n'follows.\\n'\n'\\n'\n'* If the target list is a single target with no trailing '\n'comma,\\n'\n' optionally in parentheses, the object is assigned to that '\n'target.\\n'\n'\\n'\n'* Else: The object must be an iterable with the same number of '\n'items\\n'\n' as there are targets in the target list, and the items are '\n'assigned,\\n'\n' from left to right, to the corresponding targets.\\n'\n'\\n'\n' * If the target list contains one target prefixed with an '\n'asterisk,\\n'\n' called a \u201cstarred\u201d target: The object must be an iterable '\n'with at\\n'\n' least as many items as there are targets in the target '\n'list, minus\\n'\n' one. The first items of the iterable are assigned, from '\n'left to\\n'\n' right, to the targets before the starred target. The '\n'final items\\n'\n' of the iterable are assigned to the targets after the '\n'starred\\n'\n' target. A list of the remaining items in the iterable is '\n'then\\n'\n' assigned to the starred target (the list can be empty).\\n'\n'\\n'\n' * Else: The object must be an iterable with the same number '\n'of items\\n'\n' as there are targets in the target list, and the items '\n'are\\n'\n' assigned, from left to right, to the corresponding '\n'targets.\\n'\n'\\n'\n'Assignment of an object to a single target is recursively '\n'defined as\\n'\n'follows.\\n'\n'\\n'\n'* If the target is an identifier (name):\\n'\n'\\n'\n' * If the name does not occur in a \"global\" or \"nonlocal\" '\n'statement\\n'\n' in the current code block: the name is bound to the object '\n'in the\\n'\n' current local namespace.\\n'\n'\\n'\n' * Otherwise: the name is bound to the object in the global '\n'namespace\\n'\n' or the outer namespace determined by \"nonlocal\", '\n'respectively.\\n'\n'\\n'\n' The name is rebound if it was already bound. This may cause '\n'the\\n'\n' reference count for the object previously bound to the name '\n'to reach\\n'\n' zero, causing the object to be deallocated and its '\n'destructor (if it\\n'\n' has one) to be called.\\n'\n'\\n'\n'* If the target is an attribute reference: The primary '\n'expression in\\n'\n' the reference is evaluated. It should yield an object with\\n'\n' assignable attributes; if this is not the case, \"TypeError\" '\n'is\\n'\n' raised. That object is then asked to assign the assigned '\n'object to\\n'\n' the given attribute; if it cannot perform the assignment, it '\n'raises\\n'\n' an exception (usually but not necessarily '\n'\"AttributeError\").\\n'\n'\\n'\n' Note: If the object is a class instance and the attribute '\n'reference\\n'\n' occurs on both sides of the assignment operator, the '\n'right-hand side\\n'\n' expression, \"a.x\" can access either an instance attribute or '\n'(if no\\n'\n' instance attribute exists) a class attribute. The left-hand '\n'side\\n'\n' target \"a.x\" is always set as an instance attribute, '\n'creating it if\\n'\n' necessary. Thus, the two occurrences of \"a.x\" do not '\n'necessarily\\n'\n' refer to the same attribute: if the right-hand side '\n'expression\\n'\n' refers to a class attribute, the left-hand side creates a '\n'new\\n'\n' instance attribute as the target of the assignment:\\n'\n'\\n'\n' class Cls:\\n'\n' x = 3 # class variable\\n'\n' inst = Cls()\\n'\n' inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x '\n'as 3\\n'\n'\\n'\n' This description does not necessarily apply to descriptor\\n'\n' attributes, such as properties created with \"property()\".\\n'\n'\\n'\n'* If the target is a subscription: The primary expression in '\n'the\\n'\n' reference is evaluated. It should yield either a mutable '\n'sequence\\n'\n' object (such as a list) or a mapping object (such as a '\n'dictionary).\\n'\n' Next, the subscript expression is evaluated.\\n'\n'\\n'\n' If the primary is a mutable sequence object (such as a '\n'list), the\\n'\n' subscript must yield an integer. If it is negative, the '\n'sequence\u2019s\\n'\n' length is added to it. The resulting value must be a '\n'nonnegative\\n'\n' integer less than the sequence\u2019s length, and the sequence is '\n'asked\\n'\n' to assign the assigned object to its item with that index. '\n'If the\\n'\n' index is out of range, \"IndexError\" is raised (assignment to '\n'a\\n'\n' subscripted sequence cannot add new items to a list).\\n'\n'\\n'\n' If the primary is a mapping object (such as a dictionary), '\n'the\\n'\n' subscript must have a type compatible with the mapping\u2019s key '\n'type,\\n'\n' and the mapping is then asked to create a key/datum pair '\n'which maps\\n'\n' the subscript to the assigned object. This can either '\n'replace an\\n'\n' existing key/value pair with the same key value, or insert a '\n'new\\n'\n' key/value pair (if no key with the same value existed).\\n'\n'\\n'\n' For user-defined objects, the \"__setitem__()\" method is '\n'called with\\n'\n' appropriate arguments.\\n'\n'\\n'\n'* If the target is a slicing: The primary expression in the '\n'reference\\n'\n' is evaluated. It should yield a mutable sequence object '\n'(such as a\\n'\n' list). The assigned object should be a sequence object of '\n'the same\\n'\n' type. Next, the lower and upper bound expressions are '\n'evaluated,\\n'\n' insofar they are present; defaults are zero and the '\n'sequence\u2019s\\n'\n' length. The bounds should evaluate to integers. If either '\n'bound is\\n'\n' negative, the sequence\u2019s length is added to it. The '\n'resulting\\n'\n' bounds are clipped to lie between zero and the sequence\u2019s '\n'length,\\n'\n' inclusive. Finally, the sequence object is asked to replace '\n'the\\n'\n' slice with the items of the assigned sequence. The length '\n'of the\\n'\n' slice may be different from the length of the assigned '\n'sequence,\\n'\n' thus changing the length of the target sequence, if the '\n'target\\n'\n' sequence allows it.\\n'\n'\\n'\n'**CPython implementation detail:** In the current '\n'implementation, the\\n'\n'syntax for targets is taken to be the same as for expressions, '\n'and\\n'\n'invalid syntax is rejected during the code generation phase, '\n'causing\\n'\n'less detailed error messages.\\n'\n'\\n'\n'Although the definition of assignment implies that overlaps '\n'between\\n'\n'the left-hand side and the right-hand side are \u2018simultaneous\u2019 '\n'(for\\n'\n'example \"a, b = b, a\" swaps two variables), overlaps *within* '\n'the\\n'\n'collection of assigned-to variables occur left-to-right, '\n'sometimes\\n'\n'resulting in confusion. For instance, the following program '\n'prints\\n'\n'\"[0, 2]\":\\n'\n'\\n'\n' x = [0, 1]\\n'\n' i = 0\\n'\n' i, x[i] = 1, 2 # i is updated, then x[i] is '\n'updated\\n'\n' print(x)\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3132** - Extended Iterable Unpacking\\n'\n' The specification for the \"*target\" feature.\\n'\n'\\n'\n'\\n'\n'Augmented assignment statements\\n'\n'===============================\\n'\n'\\n'\n'Augmented assignment is the combination, in a single '\n'statement, of a\\n'\n'binary operation and an assignment statement:\\n'\n'\\n'\n' augmented_assignment_stmt ::= augtarget augop '\n'(expression_list | yield_expression)\\n'\n' augtarget ::= identifier | attributeref | '\n'subscription | slicing\\n'\n' augop ::= \"+=\" | \"-=\" | \"*=\" | \"@=\" | '\n'\"/=\" | \"//=\" | \"%=\" | \"**=\"\\n'\n' | \">>=\" | \"<<=\" | \"&=\" | \"^=\" | \"|=\"\\n'\n'\\n'\n'(See section Primaries for the syntax definitions of the last '\n'three\\n'\n'symbols.)\\n'\n'\\n'\n'An augmented assignment evaluates the target (which, unlike '\n'normal\\n'\n'assignment statements, cannot be an unpacking) and the '\n'expression\\n'\n'list, performs the binary operation specific to the type of '\n'assignment\\n'\n'on the two operands, and assigns the result to the original '\n'target.\\n'\n'The target is only evaluated once.\\n'\n'\\n'\n'An augmented assignment expression like \"x += 1\" can be '\n'rewritten as\\n'\n'\"x = x + 1\" to achieve a similar, but not exactly equal '\n'effect. In the\\n'\n'augmented version, \"x\" is only evaluated once. Also, when '\n'possible,\\n'\n'the actual operation is performed *in-place*, meaning that '\n'rather than\\n'\n'creating a new object and assigning that to the target, the '\n'old object\\n'\n'is modified instead.\\n'\n'\\n'\n'Unlike normal assignments, augmented assignments evaluate the '\n'left-\\n'\n'hand side *before* evaluating the right-hand side. For '\n'example, \"a[i]\\n'\n'+= f(x)\" first looks-up \"a[i]\", then it evaluates \"f(x)\" and '\n'performs\\n'\n'the addition, and lastly, it writes the result back to '\n'\"a[i]\".\\n'\n'\\n'\n'With the exception of assigning to tuples and multiple targets '\n'in a\\n'\n'single statement, the assignment done by augmented assignment\\n'\n'statements is handled the same way as normal assignments. '\n'Similarly,\\n'\n'with the exception of the possible *in-place* behavior, the '\n'binary\\n'\n'operation performed by augmented assignment is the same as the '\n'normal\\n'\n'binary operations.\\n'\n'\\n'\n'For targets which are attribute references, the same caveat '\n'about\\n'\n'class and instance attributes applies as for regular '\n'assignments.\\n'\n'\\n'\n'\\n'\n'Annotated assignment statements\\n'\n'===============================\\n'\n'\\n'\n'*Annotation* assignment is the combination, in a single '\n'statement, of\\n'\n'a variable or attribute annotation and an optional assignment\\n'\n'statement:\\n'\n'\\n'\n' annotated_assignment_stmt ::= augtarget \":\" expression\\n'\n' [\"=\" (starred_expression | '\n'yield_expression)]\\n'\n'\\n'\n'The difference from normal Assignment statements is that only '\n'single\\n'\n'target is allowed.\\n'\n'\\n'\n'For simple names as assignment targets, if in class or module '\n'scope,\\n'\n'the annotations are evaluated and stored in a special class or '\n'module\\n'\n'attribute \"__annotations__\" that is a dictionary mapping from '\n'variable\\n'\n'names (mangled if private) to evaluated annotations. This '\n'attribute is\\n'\n'writable and is automatically created at the start of class or '\n'module\\n'\n'body execution, if annotations are found statically.\\n'\n'\\n'\n'For expressions as assignment targets, the annotations are '\n'evaluated\\n'\n'if in class or module scope, but not stored.\\n'\n'\\n'\n'If a name is annotated in a function scope, then this name is '\n'local\\n'\n'for that scope. Annotations are never evaluated and stored in '\n'function\\n'\n'scopes.\\n'\n'\\n'\n'If the right hand side is present, an annotated assignment '\n'performs\\n'\n'the actual assignment before evaluating annotations (where\\n'\n'applicable). If the right hand side is not present for an '\n'expression\\n'\n'target, then the interpreter evaluates the target except for '\n'the last\\n'\n'\"__setitem__()\" or \"__setattr__()\" call.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 526** - Syntax for Variable Annotations\\n'\n' The proposal that added syntax for annotating the types '\n'of\\n'\n' variables (including class variables and instance '\n'variables),\\n'\n' instead of expressing them through comments.\\n'\n'\\n'\n' **PEP 484** - Type hints\\n'\n' The proposal that added the \"typing\" module to provide a '\n'standard\\n'\n' syntax for type annotations that can be used in static '\n'analysis\\n'\n' tools and IDEs.\\n'\n'\\n'\n'Changed in version 3.8: Now annotated assignments allow same\\n'\n'expressions in the right hand side as the regular '\n'assignments.\\n'\n'Previously, some expressions (like un-parenthesized tuple '\n'expressions)\\n'\n'caused a syntax error.\\n',\n'async':'Coroutines\\n'\n'**********\\n'\n'\\n'\n'New in version 3.5.\\n'\n'\\n'\n'\\n'\n'Coroutine function definition\\n'\n'=============================\\n'\n'\\n'\n' async_funcdef ::= [decorators] \"async\" \"def\" funcname \"(\" '\n'[parameter_list] \")\"\\n'\n' [\"->\" expression] \":\" suite\\n'\n'\\n'\n'Execution of Python coroutines can be suspended and resumed at '\n'many\\n'\n'points (see *coroutine*). \"await\" expressions, \"async for\" and '\n'\"async\\n'\n'with\" can only be used in the body of a coroutine function.\\n'\n'\\n'\n'Functions defined with \"async def\" syntax are always coroutine\\n'\n'functions, even if they do not contain \"await\" or \"async\" '\n'keywords.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use a \"yield from\" expression inside the '\n'body\\n'\n'of a coroutine function.\\n'\n'\\n'\n'An example of a coroutine function:\\n'\n'\\n'\n' async def func(param1, param2):\\n'\n' do_stuff()\\n'\n' await some_coroutine()\\n'\n'\\n'\n'Changed in version 3.7: \"await\" and \"async\" are now keywords;\\n'\n'previously they were only treated as such inside the body of a\\n'\n'coroutine function.\\n'\n'\\n'\n'\\n'\n'The \"async for\" statement\\n'\n'=========================\\n'\n'\\n'\n' async_for_stmt ::= \"async\" for_stmt\\n'\n'\\n'\n'An *asynchronous iterable* provides an \"__aiter__\" method that\\n'\n'directly returns an *asynchronous iterator*, which can call\\n'\n'asynchronous code in its \"__anext__\" method.\\n'\n'\\n'\n'The \"async for\" statement allows convenient iteration over\\n'\n'asynchronous iterables.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' async for TARGET in ITER:\\n'\n' SUITE\\n'\n' else:\\n'\n' SUITE2\\n'\n'\\n'\n'Is semantically equivalent to:\\n'\n'\\n'\n' iter = (ITER)\\n'\n' iter = type(iter).__aiter__(iter)\\n'\n' running = True\\n'\n'\\n'\n' while running:\\n'\n' try:\\n'\n' TARGET = await type(iter).__anext__(iter)\\n'\n' except StopAsyncIteration:\\n'\n' running = False\\n'\n' else:\\n'\n' SUITE\\n'\n' else:\\n'\n' SUITE2\\n'\n'\\n'\n'See also \"__aiter__()\" and \"__anext__()\" for details.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use an \"async for\" statement outside the '\n'body\\n'\n'of a coroutine function.\\n'\n'\\n'\n'\\n'\n'The \"async with\" statement\\n'\n'==========================\\n'\n'\\n'\n' async_with_stmt ::= \"async\" with_stmt\\n'\n'\\n'\n'An *asynchronous context manager* is a *context manager* that is '\n'able\\n'\n'to suspend execution in its *enter* and *exit* methods.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' async with EXPRESSION as TARGET:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' manager = (EXPRESSION)\\n'\n' aenter = type(manager).__aenter__\\n'\n' aexit = type(manager).__aexit__\\n'\n' value = await aenter(manager)\\n'\n' hit_except = False\\n'\n'\\n'\n' try:\\n'\n' TARGET = value\\n'\n' SUITE\\n'\n' except:\\n'\n' hit_except = True\\n'\n' if not await aexit(manager, *sys.exc_info()):\\n'\n' raise\\n'\n' finally:\\n'\n' if not hit_except:\\n'\n' await aexit(manager, None, None, None)\\n'\n'\\n'\n'See also \"__aenter__()\" and \"__aexit__()\" for details.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use an \"async with\" statement outside the\\n'\n'body of a coroutine function.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 492** - Coroutines with async and await syntax\\n'\n' The proposal that made coroutines a proper standalone concept '\n'in\\n'\n' Python, and added supporting syntax.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] The exception is propagated to the invocation stack unless '\n'there\\n'\n' is a \"finally\" clause which happens to raise another '\n'exception.\\n'\n' That new exception causes the old one to be lost.\\n'\n'\\n'\n'[2] In pattern matching, a sequence is defined as one of the\\n'\n' following:\\n'\n'\\n'\n' * a class that inherits from \"collections.abc.Sequence\"\\n'\n'\\n'\n' * a Python class that has been registered as\\n'\n' \"collections.abc.Sequence\"\\n'\n'\\n'\n' * a builtin class that has its (CPython) '\n'\"Py_TPFLAGS_SEQUENCE\"\\n'\n' bit set\\n'\n'\\n'\n' * a class that inherits from any of the above\\n'\n'\\n'\n' The following standard library classes are sequences:\\n'\n'\\n'\n' * \"array.array\"\\n'\n'\\n'\n' * \"collections.deque\"\\n'\n'\\n'\n' * \"list\"\\n'\n'\\n'\n' * \"memoryview\"\\n'\n'\\n'\n' * \"range\"\\n'\n'\\n'\n' * \"tuple\"\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' Subject values of type \"str\", \"bytes\", and \"bytearray\" do '\n'not\\n'\n' match sequence patterns.\\n'\n'\\n'\n'[3] In pattern matching, a mapping is defined as one of the '\n'following:\\n'\n'\\n'\n' * a class that inherits from \"collections.abc.Mapping\"\\n'\n'\\n'\n' * a Python class that has been registered as\\n'\n' \"collections.abc.Mapping\"\\n'\n'\\n'\n' * a builtin class that has its (CPython) '\n'\"Py_TPFLAGS_MAPPING\"\\n'\n' bit set\\n'\n'\\n'\n' * a class that inherits from any of the above\\n'\n'\\n'\n' The standard library classes \"dict\" and '\n'\"types.MappingProxyType\"\\n'\n' are mappings.\\n'\n'\\n'\n'[4] A string literal appearing as the first statement in the '\n'function\\n'\n' body is transformed into the function\u2019s \"__doc__\" attribute '\n'and\\n'\n' therefore the function\u2019s *docstring*.\\n'\n'\\n'\n'[5] A string literal appearing as the first statement in the class\\n'\n' body is transformed into the namespace\u2019s \"__doc__\" item and\\n'\n' therefore the class\u2019s *docstring*.\\n',\n'atom-identifiers':'Identifiers (Names)\\n'\n'*******************\\n'\n'\\n'\n'An identifier occurring as an atom is a name. See '\n'section Identifiers\\n'\n'and keywords for lexical definition and section Naming '\n'and binding for\\n'\n'documentation of naming and binding.\\n'\n'\\n'\n'When the name is bound to an object, evaluation of the '\n'atom yields\\n'\n'that object. When a name is not bound, an attempt to '\n'evaluate it\\n'\n'raises a \"NameError\" exception.\\n'\n'\\n'\n'**Private name mangling:** When an identifier that '\n'textually occurs in\\n'\n'a class definition begins with two or more underscore '\n'characters and\\n'\n'does not end in two or more underscores, it is '\n'considered a *private\\n'\n'name* of that class. Private names are transformed to a '\n'longer form\\n'\n'before code is generated for them. The transformation '\n'inserts the\\n'\n'class name, with leading underscores removed and a '\n'single underscore\\n'\n'inserted, in front of the name. For example, the '\n'identifier \"__spam\"\\n'\n'occurring in a class named \"Ham\" will be transformed to '\n'\"_Ham__spam\".\\n'\n'This transformation is independent of the syntactical '\n'context in which\\n'\n'the identifier is used. If the transformed name is '\n'extremely long\\n'\n'(longer than 255 characters), implementation defined '\n'truncation may\\n'\n'happen. If the class name consists only of underscores, '\n'no\\n'\n'transformation is done.\\n',\n'atom-literals':'Literals\\n'\n'********\\n'\n'\\n'\n'Python supports string and bytes literals and various '\n'numeric\\n'\n'literals:\\n'\n'\\n'\n' literal ::= stringliteral | bytesliteral\\n'\n' | integer | floatnumber | imagnumber\\n'\n'\\n'\n'Evaluation of a literal yields an object of the given type '\n'(string,\\n'\n'bytes, integer, floating point number, complex number) with '\n'the given\\n'\n'value. The value may be approximated in the case of '\n'floating point\\n'\n'and imaginary (complex) literals. See section Literals for '\n'details.\\n'\n'\\n'\n'All literals correspond to immutable data types, and hence '\n'the\\n'\n'object\u2019s identity is less important than its value. '\n'Multiple\\n'\n'evaluations of literals with the same value (either the '\n'same\\n'\n'occurrence in the program text or a different occurrence) '\n'may obtain\\n'\n'the same object or a different object with the same '\n'value.\\n',\n'attribute-access':'Customizing attribute access\\n'\n'****************************\\n'\n'\\n'\n'The following methods can be defined to customize the '\n'meaning of\\n'\n'attribute access (use of, assignment to, or deletion of '\n'\"x.name\") for\\n'\n'class instances.\\n'\n'\\n'\n'object.__getattr__(self, name)\\n'\n'\\n'\n' Called when the default attribute access fails with '\n'an\\n'\n' \"AttributeError\" (either \"__getattribute__()\" raises '\n'an\\n'\n' \"AttributeError\" because *name* is not an instance '\n'attribute or an\\n'\n' attribute in the class tree for \"self\"; or '\n'\"__get__()\" of a *name*\\n'\n' property raises \"AttributeError\"). This method '\n'should either\\n'\n' return the (computed) attribute value or raise an '\n'\"AttributeError\"\\n'\n' exception.\\n'\n'\\n'\n' Note that if the attribute is found through the '\n'normal mechanism,\\n'\n' \"__getattr__()\" is not called. (This is an '\n'intentional asymmetry\\n'\n' between \"__getattr__()\" and \"__setattr__()\".) This is '\n'done both for\\n'\n' efficiency reasons and because otherwise '\n'\"__getattr__()\" would have\\n'\n' no way to access other attributes of the instance. '\n'Note that at\\n'\n' least for instance variables, you can fake total '\n'control by not\\n'\n' inserting any values in the instance attribute '\n'dictionary (but\\n'\n' instead inserting them in another object). See the\\n'\n' \"__getattribute__()\" method below for a way to '\n'actually get total\\n'\n' control over attribute access.\\n'\n'\\n'\n'object.__getattribute__(self, name)\\n'\n'\\n'\n' Called unconditionally to implement attribute '\n'accesses for\\n'\n' instances of the class. If the class also defines '\n'\"__getattr__()\",\\n'\n' the latter will not be called unless '\n'\"__getattribute__()\" either\\n'\n' calls it explicitly or raises an \"AttributeError\". '\n'This method\\n'\n' should return the (computed) attribute value or raise '\n'an\\n'\n' \"AttributeError\" exception. In order to avoid '\n'infinite recursion in\\n'\n' this method, its implementation should always call '\n'the base class\\n'\n' method with the same name to access any attributes it '\n'needs, for\\n'\n' example, \"object.__getattribute__(self, name)\".\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' This method may still be bypassed when looking up '\n'special methods\\n'\n' as the result of implicit invocation via language '\n'syntax or\\n'\n' built-in functions. See Special method lookup.\\n'\n'\\n'\n' For certain sensitive attribute accesses, raises an '\n'auditing event\\n'\n' \"object.__getattr__\" with arguments \"obj\" and '\n'\"name\".\\n'\n'\\n'\n'object.__setattr__(self, name, value)\\n'\n'\\n'\n' Called when an attribute assignment is attempted. '\n'This is called\\n'\n' instead of the normal mechanism (i.e. store the value '\n'in the\\n'\n' instance dictionary). *name* is the attribute name, '\n'*value* is the\\n'\n' value to be assigned to it.\\n'\n'\\n'\n' If \"__setattr__()\" wants to assign to an instance '\n'attribute, it\\n'\n' should call the base class method with the same name, '\n'for example,\\n'\n' \"object.__setattr__(self, name, value)\".\\n'\n'\\n'\n' For certain sensitive attribute assignments, raises '\n'an auditing\\n'\n' event \"object.__setattr__\" with arguments \"obj\", '\n'\"name\", \"value\".\\n'\n'\\n'\n'object.__delattr__(self, name)\\n'\n'\\n'\n' Like \"__setattr__()\" but for attribute deletion '\n'instead of\\n'\n' assignment. This should only be implemented if \"del '\n'obj.name\" is\\n'\n' meaningful for the object.\\n'\n'\\n'\n' For certain sensitive attribute deletions, raises an '\n'auditing event\\n'\n' \"object.__delattr__\" with arguments \"obj\" and '\n'\"name\".\\n'\n'\\n'\n'object.__dir__(self)\\n'\n'\\n'\n' Called when \"dir()\" is called on the object. A '\n'sequence must be\\n'\n' returned. \"dir()\" converts the returned sequence to a '\n'list and\\n'\n' sorts it.\\n'\n'\\n'\n'\\n'\n'Customizing module attribute access\\n'\n'===================================\\n'\n'\\n'\n'Special names \"__getattr__\" and \"__dir__\" can be also '\n'used to\\n'\n'customize access to module attributes. The \"__getattr__\" '\n'function at\\n'\n'the module level should accept one argument which is the '\n'name of an\\n'\n'attribute and return the computed value or raise an '\n'\"AttributeError\".\\n'\n'If an attribute is not found on a module object through '\n'the normal\\n'\n'lookup, i.e. \"object.__getattribute__()\", then '\n'\"__getattr__\" is\\n'\n'searched in the module \"__dict__\" before raising an '\n'\"AttributeError\".\\n'\n'If found, it is called with the attribute name and the '\n'result is\\n'\n'returned.\\n'\n'\\n'\n'The \"__dir__\" function should accept no arguments, and '\n'return a\\n'\n'sequence of strings that represents the names accessible '\n'on module. If\\n'\n'present, this function overrides the standard \"dir()\" '\n'search on a\\n'\n'module.\\n'\n'\\n'\n'For a more fine grained customization of the module '\n'behavior (setting\\n'\n'attributes, properties, etc.), one can set the '\n'\"__class__\" attribute\\n'\n'of a module object to a subclass of \"types.ModuleType\". '\n'For example:\\n'\n'\\n'\n' import sys\\n'\n' from types import ModuleType\\n'\n'\\n'\n' class VerboseModule(ModuleType):\\n'\n' def __repr__(self):\\n'\n\" return f'Verbose {self.__name__}'\\n\"\n'\\n'\n' def __setattr__(self, attr, value):\\n'\n\" print(f'Setting {attr}...')\\n\"\n' super().__setattr__(attr, value)\\n'\n'\\n'\n' sys.modules[__name__].__class__ = VerboseModule\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Defining module \"__getattr__\" and setting module '\n'\"__class__\" only\\n'\n' affect lookups made using the attribute access syntax '\n'\u2013 directly\\n'\n' accessing the module globals (whether by code within '\n'the module, or\\n'\n' via a reference to the module\u2019s globals dictionary) is '\n'unaffected.\\n'\n'\\n'\n'Changed in version 3.5: \"__class__\" module attribute is '\n'now writable.\\n'\n'\\n'\n'New in version 3.7: \"__getattr__\" and \"__dir__\" module '\n'attributes.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 562** - Module __getattr__ and __dir__\\n'\n' Describes the \"__getattr__\" and \"__dir__\" functions '\n'on modules.\\n'\n'\\n'\n'\\n'\n'Implementing Descriptors\\n'\n'========================\\n'\n'\\n'\n'The following methods only apply when an instance of the '\n'class\\n'\n'containing the method (a so-called *descriptor* class) '\n'appears in an\\n'\n'*owner* class (the descriptor must be in either the '\n'owner\u2019s class\\n'\n'dictionary or in the class dictionary for one of its '\n'parents). In the\\n'\n'examples below, \u201cthe attribute\u201d refers to the attribute '\n'whose name is\\n'\n'the key of the property in the owner class\u2019 \"__dict__\".\\n'\n'\\n'\n'object.__get__(self, instance, owner=None)\\n'\n'\\n'\n' Called to get the attribute of the owner class (class '\n'attribute\\n'\n' access) or of an instance of that class (instance '\n'attribute\\n'\n' access). The optional *owner* argument is the owner '\n'class, while\\n'\n' *instance* is the instance that the attribute was '\n'accessed through,\\n'\n' or \"None\" when the attribute is accessed through the '\n'*owner*.\\n'\n'\\n'\n' This method should return the computed attribute '\n'value or raise an\\n'\n' \"AttributeError\" exception.\\n'\n'\\n'\n' **PEP 252** specifies that \"__get__()\" is callable '\n'with one or two\\n'\n' arguments. Python\u2019s own built-in descriptors support '\n'this\\n'\n' specification; however, it is likely that some '\n'third-party tools\\n'\n' have descriptors that require both arguments. '\n'Python\u2019s own\\n'\n' \"__getattribute__()\" implementation always passes in '\n'both arguments\\n'\n' whether they are required or not.\\n'\n'\\n'\n'object.__set__(self, instance, value)\\n'\n'\\n'\n' Called to set the attribute on an instance *instance* '\n'of the owner\\n'\n' class to a new value, *value*.\\n'\n'\\n'\n' Note, adding \"__set__()\" or \"__delete__()\" changes '\n'the kind of\\n'\n' descriptor to a \u201cdata descriptor\u201d. See Invoking '\n'Descriptors for\\n'\n' more details.\\n'\n'\\n'\n'object.__delete__(self, instance)\\n'\n'\\n'\n' Called to delete the attribute on an instance '\n'*instance* of the\\n'\n' owner class.\\n'\n'\\n'\n'object.__set_name__(self, owner, name)\\n'\n'\\n'\n' Called at the time the owning class *owner* is '\n'created. The\\n'\n' descriptor has been assigned to *name*.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"__set_name__()\" is only called implicitly as part '\n'of the \"type\"\\n'\n' constructor, so it will need to be called '\n'explicitly with the\\n'\n' appropriate parameters when a descriptor is added '\n'to a class\\n'\n' after initial creation:\\n'\n'\\n'\n' class A:\\n'\n' pass\\n'\n' descr = custom_descriptor()\\n'\n' A.attr = descr\\n'\n\" descr.__set_name__(A, 'attr')\\n\"\n'\\n'\n' See Creating the class object for more details.\\n'\n'\\n'\n' New in version 3.6.\\n'\n'\\n'\n'The attribute \"__objclass__\" is interpreted by the '\n'\"inspect\" module as\\n'\n'specifying the class where this object was defined '\n'(setting this\\n'\n'appropriately can assist in runtime introspection of '\n'dynamic class\\n'\n'attributes). For callables, it may indicate that an '\n'instance of the\\n'\n'given type (or a subclass) is expected or required as '\n'the first\\n'\n'positional argument (for example, CPython sets this '\n'attribute for\\n'\n'unbound methods that are implemented in C).\\n'\n'\\n'\n'\\n'\n'Invoking Descriptors\\n'\n'====================\\n'\n'\\n'\n'In general, a descriptor is an object attribute with '\n'\u201cbinding\\n'\n'behavior\u201d, one whose attribute access has been '\n'overridden by methods\\n'\n'in the descriptor protocol: \"__get__()\", \"__set__()\", '\n'and\\n'\n'\"__delete__()\". If any of those methods are defined for '\n'an object, it\\n'\n'is said to be a descriptor.\\n'\n'\\n'\n'The default behavior for attribute access is to get, '\n'set, or delete\\n'\n'the attribute from an object\u2019s dictionary. For instance, '\n'\"a.x\" has a\\n'\n'lookup chain starting with \"a.__dict__[\\'x\\']\", then\\n'\n'\"type(a).__dict__[\\'x\\']\", and continuing through the '\n'base classes of\\n'\n'\"type(a)\" excluding metaclasses.\\n'\n'\\n'\n'However, if the looked-up value is an object defining '\n'one of the\\n'\n'descriptor methods, then Python may override the default '\n'behavior and\\n'\n'invoke the descriptor method instead. Where this occurs '\n'in the\\n'\n'precedence chain depends on which descriptor methods '\n'were defined and\\n'\n'how they were called.\\n'\n'\\n'\n'The starting point for descriptor invocation is a '\n'binding, \"a.x\". How\\n'\n'the arguments are assembled depends on \"a\":\\n'\n'\\n'\n'Direct Call\\n'\n' The simplest and least common call is when user code '\n'directly\\n'\n' invokes a descriptor method: \"x.__get__(a)\".\\n'\n'\\n'\n'Instance Binding\\n'\n' If binding to an object instance, \"a.x\" is '\n'transformed into the\\n'\n' call: \"type(a).__dict__[\\'x\\'].__get__(a, type(a))\".\\n'\n'\\n'\n'Class Binding\\n'\n' If binding to a class, \"A.x\" is transformed into the '\n'call:\\n'\n' \"A.__dict__[\\'x\\'].__get__(None, A)\".\\n'\n'\\n'\n'Super Binding\\n'\n' If \"a\" is an instance of \"super\", then the binding '\n'\"super(B,\\n'\n' obj).m()\" searches \"obj.__class__.__mro__\" for the '\n'base class \"A\"\\n'\n' immediately preceding \"B\" and then invokes the '\n'descriptor with the\\n'\n' call: \"A.__dict__[\\'m\\'].__get__(obj, '\n'obj.__class__)\".\\n'\n'\\n'\n'For instance bindings, the precedence of descriptor '\n'invocation depends\\n'\n'on which descriptor methods are defined. A descriptor '\n'can define any\\n'\n'combination of \"__get__()\", \"__set__()\" and '\n'\"__delete__()\". If it\\n'\n'does not define \"__get__()\", then accessing the '\n'attribute will return\\n'\n'the descriptor object itself unless there is a value in '\n'the object\u2019s\\n'\n'instance dictionary. If the descriptor defines '\n'\"__set__()\" and/or\\n'\n'\"__delete__()\", it is a data descriptor; if it defines '\n'neither, it is\\n'\n'a non-data descriptor. Normally, data descriptors '\n'define both\\n'\n'\"__get__()\" and \"__set__()\", while non-data descriptors '\n'have just the\\n'\n'\"__get__()\" method. Data descriptors with \"__get__()\" '\n'and \"__set__()\"\\n'\n'(and/or \"__delete__()\") defined always override a '\n'redefinition in an\\n'\n'instance dictionary. In contrast, non-data descriptors '\n'can be\\n'\n'overridden by instances.\\n'\n'\\n'\n'Python methods (including \"staticmethod()\" and '\n'\"classmethod()\") are\\n'\n'implemented as non-data descriptors. Accordingly, '\n'instances can\\n'\n'redefine and override methods. This allows individual '\n'instances to\\n'\n'acquire behaviors that differ from other instances of '\n'the same class.\\n'\n'\\n'\n'The \"property()\" function is implemented as a data '\n'descriptor.\\n'\n'Accordingly, instances cannot override the behavior of a '\n'property.\\n'\n'\\n'\n'\\n'\n'__slots__\\n'\n'=========\\n'\n'\\n'\n'*__slots__* allow us to explicitly declare data members '\n'(like\\n'\n'properties) and deny the creation of *__dict__* and '\n'*__weakref__*\\n'\n'(unless explicitly declared in *__slots__* or available '\n'in a parent.)\\n'\n'\\n'\n'The space saved over using *__dict__* can be '\n'significant. Attribute\\n'\n'lookup speed can be significantly improved as well.\\n'\n'\\n'\n'object.__slots__\\n'\n'\\n'\n' This class variable can be assigned a string, '\n'iterable, or sequence\\n'\n' of strings with variable names used by instances. '\n'*__slots__*\\n'\n' reserves space for the declared variables and '\n'prevents the\\n'\n' automatic creation of *__dict__* and *__weakref__* '\n'for each\\n'\n' instance.\\n'\n'\\n'\n'\\n'\n'Notes on using *__slots__*\\n'\n'--------------------------\\n'\n'\\n'\n'* When inheriting from a class without *__slots__*, the '\n'*__dict__* and\\n'\n' *__weakref__* attribute of the instances will always '\n'be accessible.\\n'\n'\\n'\n'* Without a *__dict__* variable, instances cannot be '\n'assigned new\\n'\n' variables not listed in the *__slots__* definition. '\n'Attempts to\\n'\n' assign to an unlisted variable name raises '\n'\"AttributeError\". If\\n'\n' dynamic assignment of new variables is desired, then '\n'add\\n'\n' \"\\'__dict__\\'\" to the sequence of strings in the '\n'*__slots__*\\n'\n' declaration.\\n'\n'\\n'\n'* Without a *__weakref__* variable for each instance, '\n'classes defining\\n'\n' *__slots__* do not support weak references to its '\n'instances. If weak\\n'\n' reference support is needed, then add '\n'\"\\'__weakref__\\'\" to the\\n'\n' sequence of strings in the *__slots__* declaration.\\n'\n'\\n'\n'* *__slots__* are implemented at the class level by '\n'creating\\n'\n' descriptors (Implementing Descriptors) for each '\n'variable name. As a\\n'\n' result, class attributes cannot be used to set default '\n'values for\\n'\n' instance variables defined by *__slots__*; otherwise, '\n'the class\\n'\n' attribute would overwrite the descriptor assignment.\\n'\n'\\n'\n'* The action of a *__slots__* declaration is not limited '\n'to the class\\n'\n' where it is defined. *__slots__* declared in parents '\n'are available\\n'\n' in child classes. However, child subclasses will get a '\n'*__dict__*\\n'\n' and *__weakref__* unless they also define *__slots__* '\n'(which should\\n'\n' only contain names of any *additional* slots).\\n'\n'\\n'\n'* If a class defines a slot also defined in a base '\n'class, the instance\\n'\n' variable defined by the base class slot is '\n'inaccessible (except by\\n'\n' retrieving its descriptor directly from the base '\n'class). This\\n'\n' renders the meaning of the program undefined. In the '\n'future, a\\n'\n' check may be added to prevent this.\\n'\n'\\n'\n'* Nonempty *__slots__* does not work for classes derived '\n'from\\n'\n' \u201cvariable-length\u201d built-in types such as \"int\", '\n'\"bytes\" and \"tuple\".\\n'\n'\\n'\n'* Any non-string iterable may be assigned to '\n'*__slots__*. Mappings may\\n'\n' also be used; however, in the future, special meaning '\n'may be\\n'\n' assigned to the values corresponding to each key.\\n'\n'\\n'\n'* *__class__* assignment works only if both classes have '\n'the same\\n'\n' *__slots__*.\\n'\n'\\n'\n'* Multiple inheritance with multiple slotted parent '\n'classes can be\\n'\n' used, but only one parent is allowed to have '\n'attributes created by\\n'\n' slots (the other bases must have empty slot layouts) - '\n'violations\\n'\n' raise \"TypeError\".\\n'\n'\\n'\n'* If an iterator is used for *__slots__* then a '\n'descriptor is created\\n'\n' for each of the iterator\u2019s values. However, the '\n'*__slots__*\\n'\n' attribute will be an empty iterator.\\n',\n'attribute-references':'Attribute references\\n'\n'********************\\n'\n'\\n'\n'An attribute reference is a primary followed by a '\n'period and a name:\\n'\n'\\n'\n' attributeref ::= primary \".\" identifier\\n'\n'\\n'\n'The primary must evaluate to an object of a type '\n'that supports\\n'\n'attribute references, which most objects do. This '\n'object is then\\n'\n'asked to produce the attribute whose name is the '\n'identifier. This\\n'\n'production can be customized by overriding the '\n'\"__getattr__()\" method.\\n'\n'If this attribute is not available, the exception '\n'\"AttributeError\" is\\n'\n'raised. Otherwise, the type and value of the object '\n'produced is\\n'\n'determined by the object. Multiple evaluations of '\n'the same attribute\\n'\n'reference may yield different objects.\\n',\n'augassign':'Augmented assignment statements\\n'\n'*******************************\\n'\n'\\n'\n'Augmented assignment is the combination, in a single statement, '\n'of a\\n'\n'binary operation and an assignment statement:\\n'\n'\\n'\n' augmented_assignment_stmt ::= augtarget augop '\n'(expression_list | yield_expression)\\n'\n' augtarget ::= identifier | attributeref | '\n'subscription | slicing\\n'\n' augop ::= \"+=\" | \"-=\" | \"*=\" | \"@=\" | '\n'\"/=\" | \"//=\" | \"%=\" | \"**=\"\\n'\n' | \">>=\" | \"<<=\" | \"&=\" | \"^=\" | \"|=\"\\n'\n'\\n'\n'(See section Primaries for the syntax definitions of the last '\n'three\\n'\n'symbols.)\\n'\n'\\n'\n'An augmented assignment evaluates the target (which, unlike '\n'normal\\n'\n'assignment statements, cannot be an unpacking) and the '\n'expression\\n'\n'list, performs the binary operation specific to the type of '\n'assignment\\n'\n'on the two operands, and assigns the result to the original '\n'target.\\n'\n'The target is only evaluated once.\\n'\n'\\n'\n'An augmented assignment expression like \"x += 1\" can be '\n'rewritten as\\n'\n'\"x = x + 1\" to achieve a similar, but not exactly equal effect. '\n'In the\\n'\n'augmented version, \"x\" is only evaluated once. Also, when '\n'possible,\\n'\n'the actual operation is performed *in-place*, meaning that '\n'rather than\\n'\n'creating a new object and assigning that to the target, the old '\n'object\\n'\n'is modified instead.\\n'\n'\\n'\n'Unlike normal assignments, augmented assignments evaluate the '\n'left-\\n'\n'hand side *before* evaluating the right-hand side. For '\n'example, \"a[i]\\n'\n'+= f(x)\" first looks-up \"a[i]\", then it evaluates \"f(x)\" and '\n'performs\\n'\n'the addition, and lastly, it writes the result back to \"a[i]\".\\n'\n'\\n'\n'With the exception of assigning to tuples and multiple targets '\n'in a\\n'\n'single statement, the assignment done by augmented assignment\\n'\n'statements is handled the same way as normal assignments. '\n'Similarly,\\n'\n'with the exception of the possible *in-place* behavior, the '\n'binary\\n'\n'operation performed by augmented assignment is the same as the '\n'normal\\n'\n'binary operations.\\n'\n'\\n'\n'For targets which are attribute references, the same caveat '\n'about\\n'\n'class and instance attributes applies as for regular '\n'assignments.\\n',\n'await':'Await expression\\n'\n'****************\\n'\n'\\n'\n'Suspend the execution of *coroutine* on an *awaitable* object. Can\\n'\n'only be used inside a *coroutine function*.\\n'\n'\\n'\n' await_expr ::= \"await\" primary\\n'\n'\\n'\n'New in version 3.5.\\n',\n'binary':'Binary arithmetic operations\\n'\n'****************************\\n'\n'\\n'\n'The binary arithmetic operations have the conventional priority\\n'\n'levels. Note that some of these operations also apply to certain '\n'non-\\n'\n'numeric types. Apart from the power operator, there are only two\\n'\n'levels, one for multiplicative operators and one for additive\\n'\n'operators:\\n'\n'\\n'\n' m_expr ::= u_expr | m_expr \"*\" u_expr | m_expr \"@\" m_expr |\\n'\n' m_expr \"//\" u_expr | m_expr \"/\" u_expr |\\n'\n' m_expr \"%\" u_expr\\n'\n' a_expr ::= m_expr | a_expr \"+\" m_expr | a_expr \"-\" m_expr\\n'\n'\\n'\n'The \"*\" (multiplication) operator yields the product of its '\n'arguments.\\n'\n'The arguments must either both be numbers, or one argument must be '\n'an\\n'\n'integer and the other must be a sequence. In the former case, the\\n'\n'numbers are converted to a common type and then multiplied '\n'together.\\n'\n'In the latter case, sequence repetition is performed; a negative\\n'\n'repetition factor yields an empty sequence.\\n'\n'\\n'\n'This operation can be customized using the special \"__mul__()\" '\n'and\\n'\n'\"__rmul__()\" methods.\\n'\n'\\n'\n'The \"@\" (at) operator is intended to be used for matrix\\n'\n'multiplication. No builtin Python types implement this operator.\\n'\n'\\n'\n'New in version 3.5.\\n'\n'\\n'\n'The \"/\" (division) and \"//\" (floor division) operators yield the\\n'\n'quotient of their arguments. The numeric arguments are first\\n'\n'converted to a common type. Division of integers yields a float, '\n'while\\n'\n'floor division of integers results in an integer; the result is '\n'that\\n'\n'of mathematical division with the \u2018floor\u2019 function applied to the\\n'\n'result. Division by zero raises the \"ZeroDivisionError\" '\n'exception.\\n'\n'\\n'\n'This operation can be customized using the special \"__div__()\" '\n'and\\n'\n'\"__floordiv__()\" methods.\\n'\n'\\n'\n'The \"%\" (modulo) operator yields the remainder from the division '\n'of\\n'\n'the first argument by the second. The numeric arguments are '\n'first\\n'\n'converted to a common type. A zero right argument raises the\\n'\n'\"ZeroDivisionError\" exception. The arguments may be floating '\n'point\\n'\n'numbers, e.g., \"3.14%0.7\" equals \"0.34\" (since \"3.14\" equals '\n'\"4*0.7 +\\n'\n'0.34\".) The modulo operator always yields a result with the same '\n'sign\\n'\n'as its second operand (or zero); the absolute value of the result '\n'is\\n'\n'strictly smaller than the absolute value of the second operand '\n'[1].\\n'\n'\\n'\n'The floor division and modulo operators are connected by the '\n'following\\n'\n'identity: \"x == (x//y)*y + (x%y)\". Floor division and modulo are '\n'also\\n'\n'connected with the built-in function \"divmod()\": \"divmod(x, y) ==\\n'\n'(x//y, x%y)\". [2].\\n'\n'\\n'\n'In addition to performing the modulo operation on numbers, the '\n'\"%\"\\n'\n'operator is also overloaded by string objects to perform '\n'old-style\\n'\n'string formatting (also known as interpolation). The syntax for\\n'\n'string formatting is described in the Python Library Reference,\\n'\n'section printf-style String Formatting.\\n'\n'\\n'\n'The *modulo* operation can be customized using the special '\n'\"__mod__()\"\\n'\n'method.\\n'\n'\\n'\n'The floor division operator, the modulo operator, and the '\n'\"divmod()\"\\n'\n'function are not defined for complex numbers. Instead, convert to '\n'a\\n'\n'floating point number using the \"abs()\" function if appropriate.\\n'\n'\\n'\n'The \"+\" (addition) operator yields the sum of its arguments. The\\n'\n'arguments must either both be numbers or both be sequences of the '\n'same\\n'\n'type. In the former case, the numbers are converted to a common '\n'type\\n'\n'and then added together. In the latter case, the sequences are\\n'\n'concatenated.\\n'\n'\\n'\n'This operation can be customized using the special \"__add__()\" '\n'and\\n'\n'\"__radd__()\" methods.\\n'\n'\\n'\n'The \"-\" (subtraction) operator yields the difference of its '\n'arguments.\\n'\n'The numeric arguments are first converted to a common type.\\n'\n'\\n'\n'This operation can be customized using the special \"__sub__()\" '\n'method.\\n',\n'bitwise':'Binary bitwise operations\\n'\n'*************************\\n'\n'\\n'\n'Each of the three bitwise operations has a different priority '\n'level:\\n'\n'\\n'\n' and_expr ::= shift_expr | and_expr \"&\" shift_expr\\n'\n' xor_expr ::= and_expr | xor_expr \"^\" and_expr\\n'\n' or_expr ::= xor_expr | or_expr \"|\" xor_expr\\n'\n'\\n'\n'The \"&\" operator yields the bitwise AND of its arguments, which '\n'must\\n'\n'be integers or one of them must be a custom object overriding\\n'\n'\"__and__()\" or \"__rand__()\" special methods.\\n'\n'\\n'\n'The \"^\" operator yields the bitwise XOR (exclusive OR) of its\\n'\n'arguments, which must be integers or one of them must be a '\n'custom\\n'\n'object overriding \"__xor__()\" or \"__rxor__()\" special methods.\\n'\n'\\n'\n'The \"|\" operator yields the bitwise (inclusive) OR of its '\n'arguments,\\n'\n'which must be integers or one of them must be a custom object\\n'\n'overriding \"__or__()\" or \"__ror__()\" special methods.\\n',\n'bltin-code-objects':'Code Objects\\n'\n'************\\n'\n'\\n'\n'Code objects are used by the implementation to '\n'represent \u201cpseudo-\\n'\n'compiled\u201d executable Python code such as a function '\n'body. They differ\\n'\n'from function objects because they don\u2019t contain a '\n'reference to their\\n'\n'global execution environment. Code objects are '\n'returned by the built-\\n'\n'in \"compile()\" function and can be extracted from '\n'function objects\\n'\n'through their \"__code__\" attribute. See also the '\n'\"code\" module.\\n'\n'\\n'\n'Accessing \"__code__\" raises an auditing event '\n'\"object.__getattr__\"\\n'\n'with arguments \"obj\" and \"\"__code__\"\".\\n'\n'\\n'\n'A code object can be executed or evaluated by passing '\n'it (instead of a\\n'\n'source string) to the \"exec()\" or \"eval()\" built-in '\n'functions.\\n'\n'\\n'\n'See The standard type hierarchy for more '\n'information.\\n',\n'bltin-ellipsis-object':'The Ellipsis Object\\n'\n'*******************\\n'\n'\\n'\n'This object is commonly used by slicing (see '\n'Slicings). It supports\\n'\n'no special operations. There is exactly one '\n'ellipsis object, named\\n'\n'\"Ellipsis\" (a built-in name). \"type(Ellipsis)()\" '\n'produces the\\n'\n'\"Ellipsis\" singleton.\\n'\n'\\n'\n'It is written as \"Ellipsis\" or \"...\".\\n',\n'bltin-null-object':'The Null Object\\n'\n'***************\\n'\n'\\n'\n'This object is returned by functions that don\u2019t '\n'explicitly return a\\n'\n'value. It supports no special operations. There is '\n'exactly one null\\n'\n'object, named \"None\" (a built-in name). \"type(None)()\" '\n'produces the\\n'\n'same singleton.\\n'\n'\\n'\n'It is written as \"None\".\\n',\n'bltin-type-objects':'Type Objects\\n'\n'************\\n'\n'\\n'\n'Type objects represent the various object types. An '\n'object\u2019s type is\\n'\n'accessed by the built-in function \"type()\". There are '\n'no special\\n'\n'operations on types. The standard module \"types\" '\n'defines names for\\n'\n'all standard built-in types.\\n'\n'\\n'\n'Types are written like this: \"\".\\n',\n'booleans':'Boolean operations\\n'\n'******************\\n'\n'\\n'\n' or_test ::= and_test | or_test \"or\" and_test\\n'\n' and_test ::= not_test | and_test \"and\" not_test\\n'\n' not_test ::= comparison | \"not\" not_test\\n'\n'\\n'\n'In the context of Boolean operations, and also when expressions '\n'are\\n'\n'used by control flow statements, the following values are '\n'interpreted\\n'\n'as false: \"False\", \"None\", numeric zero of all types, and empty\\n'\n'strings and containers (including strings, tuples, lists,\\n'\n'dictionaries, sets and frozensets). All other values are '\n'interpreted\\n'\n'as true. User-defined objects can customize their truth value '\n'by\\n'\n'providing a \"__bool__()\" method.\\n'\n'\\n'\n'The operator \"not\" yields \"True\" if its argument is false, '\n'\"False\"\\n'\n'otherwise.\\n'\n'\\n'\n'The expression \"x and y\" first evaluates *x*; if *x* is false, '\n'its\\n'\n'value is returned; otherwise, *y* is evaluated and the resulting '\n'value\\n'\n'is returned.\\n'\n'\\n'\n'The expression \"x or y\" first evaluates *x*; if *x* is true, its '\n'value\\n'\n'is returned; otherwise, *y* is evaluated and the resulting value '\n'is\\n'\n'returned.\\n'\n'\\n'\n'Note that neither \"and\" nor \"or\" restrict the value and type '\n'they\\n'\n'return to \"False\" and \"True\", but rather return the last '\n'evaluated\\n'\n'argument. This is sometimes useful, e.g., if \"s\" is a string '\n'that\\n'\n'should be replaced by a default value if it is empty, the '\n'expression\\n'\n'\"s or \\'foo\\'\" yields the desired value. Because \"not\" has to '\n'create a\\n'\n'new value, it returns a boolean value regardless of the type of '\n'its\\n'\n'argument (for example, \"not \\'foo\\'\" produces \"False\" rather '\n'than \"\\'\\'\".)\\n',\n'break':'The \"break\" statement\\n'\n'*********************\\n'\n'\\n'\n' break_stmt ::= \"break\"\\n'\n'\\n'\n'\"break\" may only occur syntactically nested in a \"for\" or \"while\"\\n'\n'loop, but not nested in a function or class definition within that\\n'\n'loop.\\n'\n'\\n'\n'It terminates the nearest enclosing loop, skipping the optional '\n'\"else\"\\n'\n'clause if the loop has one.\\n'\n'\\n'\n'If a \"for\" loop is terminated by \"break\", the loop control target\\n'\n'keeps its current value.\\n'\n'\\n'\n'When \"break\" passes control out of a \"try\" statement with a '\n'\"finally\"\\n'\n'clause, that \"finally\" clause is executed before really leaving '\n'the\\n'\n'loop.\\n',\n'callable-types':'Emulating callable objects\\n'\n'**************************\\n'\n'\\n'\n'object.__call__(self[, args...])\\n'\n'\\n'\n' Called when the instance is \u201ccalled\u201d as a function; if '\n'this method\\n'\n' is defined, \"x(arg1, arg2, ...)\" roughly translates to\\n'\n' \"type(x).__call__(x, arg1, ...)\".\\n',\n'calls':'Calls\\n'\n'*****\\n'\n'\\n'\n'A call calls a callable object (e.g., a *function*) with a '\n'possibly\\n'\n'empty series of *arguments*:\\n'\n'\\n'\n' call ::= primary \"(\" [argument_list [\",\"] | '\n'comprehension] \")\"\\n'\n' argument_list ::= positional_arguments [\",\" '\n'starred_and_keywords]\\n'\n' [\",\" keywords_arguments]\\n'\n' | starred_and_keywords [\",\" '\n'keywords_arguments]\\n'\n' | keywords_arguments\\n'\n' positional_arguments ::= positional_item (\",\" positional_item)*\\n'\n' positional_item ::= assignment_expression | \"*\" expression\\n'\n' starred_and_keywords ::= (\"*\" expression | keyword_item)\\n'\n' (\",\" \"*\" expression | \",\" '\n'keyword_item)*\\n'\n' keywords_arguments ::= (keyword_item | \"**\" expression)\\n'\n' (\",\" keyword_item | \",\" \"**\" '\n'expression)*\\n'\n' keyword_item ::= identifier \"=\" expression\\n'\n'\\n'\n'An optional trailing comma may be present after the positional and\\n'\n'keyword arguments but does not affect the semantics.\\n'\n'\\n'\n'The primary must evaluate to a callable object (user-defined\\n'\n'functions, built-in functions, methods of built-in objects, class\\n'\n'objects, methods of class instances, and all objects having a\\n'\n'\"__call__()\" method are callable). All argument expressions are\\n'\n'evaluated before the call is attempted. Please refer to section\\n'\n'Function definitions for the syntax of formal *parameter* lists.\\n'\n'\\n'\n'If keyword arguments are present, they are first converted to\\n'\n'positional arguments, as follows. First, a list of unfilled slots '\n'is\\n'\n'created for the formal parameters. If there are N positional\\n'\n'arguments, they are placed in the first N slots. Next, for each\\n'\n'keyword argument, the identifier is used to determine the\\n'\n'corresponding slot (if the identifier is the same as the first '\n'formal\\n'\n'parameter name, the first slot is used, and so on). If the slot '\n'is\\n'\n'already filled, a \"TypeError\" exception is raised. Otherwise, the\\n'\n'value of the argument is placed in the slot, filling it (even if '\n'the\\n'\n'expression is \"None\", it fills the slot). When all arguments have\\n'\n'been processed, the slots that are still unfilled are filled with '\n'the\\n'\n'corresponding default value from the function definition. '\n'(Default\\n'\n'values are calculated, once, when the function is defined; thus, a\\n'\n'mutable object such as a list or dictionary used as default value '\n'will\\n'\n'be shared by all calls that don\u2019t specify an argument value for '\n'the\\n'\n'corresponding slot; this should usually be avoided.) If there are '\n'any\\n'\n'unfilled slots for which no default value is specified, a '\n'\"TypeError\"\\n'\n'exception is raised. Otherwise, the list of filled slots is used '\n'as\\n'\n'the argument list for the call.\\n'\n'\\n'\n'**CPython implementation detail:** An implementation may provide\\n'\n'built-in functions whose positional parameters do not have names, '\n'even\\n'\n'if they are \u2018named\u2019 for the purpose of documentation, and which\\n'\n'therefore cannot be supplied by keyword. In CPython, this is the '\n'case\\n'\n'for functions implemented in C that use \"PyArg_ParseTuple()\" to '\n'parse\\n'\n'their arguments.\\n'\n'\\n'\n'If there are more positional arguments than there are formal '\n'parameter\\n'\n'slots, a \"TypeError\" exception is raised, unless a formal '\n'parameter\\n'\n'using the syntax \"*identifier\" is present; in this case, that '\n'formal\\n'\n'parameter receives a tuple containing the excess positional '\n'arguments\\n'\n'(or an empty tuple if there were no excess positional arguments).\\n'\n'\\n'\n'If any keyword argument does not correspond to a formal parameter\\n'\n'name, a \"TypeError\" exception is raised, unless a formal parameter\\n'\n'using the syntax \"**identifier\" is present; in this case, that '\n'formal\\n'\n'parameter receives a dictionary containing the excess keyword\\n'\n'arguments (using the keywords as keys and the argument values as\\n'\n'corresponding values), or a (new) empty dictionary if there were '\n'no\\n'\n'excess keyword arguments.\\n'\n'\\n'\n'If the syntax \"*expression\" appears in the function call, '\n'\"expression\"\\n'\n'must evaluate to an *iterable*. Elements from these iterables are\\n'\n'treated as if they were additional positional arguments. For the '\n'call\\n'\n'\"f(x1, x2, *y, x3, x4)\", if *y* evaluates to a sequence *y1*, \u2026, '\n'*yM*,\\n'\n'this is equivalent to a call with M+4 positional arguments *x1*, '\n'*x2*,\\n'\n'*y1*, \u2026, *yM*, *x3*, *x4*.\\n'\n'\\n'\n'A consequence of this is that although the \"*expression\" syntax '\n'may\\n'\n'appear *after* explicit keyword arguments, it is processed '\n'*before*\\n'\n'the keyword arguments (and any \"**expression\" arguments \u2013 see '\n'below).\\n'\n'So:\\n'\n'\\n'\n' >>> def f(a, b):\\n'\n' ... print(a, b)\\n'\n' ...\\n'\n' >>> f(b=1, *(2,))\\n'\n' 2 1\\n'\n' >>> f(a=1, *(2,))\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n\" TypeError: f() got multiple values for keyword argument 'a'\\n\"\n' >>> f(1, *(2,))\\n'\n' 1 2\\n'\n'\\n'\n'It is unusual for both keyword arguments and the \"*expression\" '\n'syntax\\n'\n'to be used in the same call, so in practice this confusion does '\n'not\\n'\n'arise.\\n'\n'\\n'\n'If the syntax \"**expression\" appears in the function call,\\n'\n'\"expression\" must evaluate to a *mapping*, the contents of which '\n'are\\n'\n'treated as additional keyword arguments. If a keyword is already\\n'\n'present (as an explicit keyword argument, or from another '\n'unpacking),\\n'\n'a \"TypeError\" exception is raised.\\n'\n'\\n'\n'Formal parameters using the syntax \"*identifier\" or \"**identifier\"\\n'\n'cannot be used as positional argument slots or as keyword argument\\n'\n'names.\\n'\n'\\n'\n'Changed in version 3.5: Function calls accept any number of \"*\" '\n'and\\n'\n'\"**\" unpackings, positional arguments may follow iterable '\n'unpackings\\n'\n'(\"*\"), and keyword arguments may follow dictionary unpackings '\n'(\"**\").\\n'\n'Originally proposed by **PEP 448**.\\n'\n'\\n'\n'A call always returns some value, possibly \"None\", unless it raises '\n'an\\n'\n'exception. How this value is computed depends on the type of the\\n'\n'callable object.\\n'\n'\\n'\n'If it is\u2014\\n'\n'\\n'\n'a user-defined function:\\n'\n' The code block for the function is executed, passing it the\\n'\n' argument list. The first thing the code block will do is bind '\n'the\\n'\n' formal parameters to the arguments; this is described in '\n'section\\n'\n' Function definitions. When the code block executes a \"return\"\\n'\n' statement, this specifies the return value of the function '\n'call.\\n'\n'\\n'\n'a built-in function or method:\\n'\n' The result is up to the interpreter; see Built-in Functions for '\n'the\\n'\n' descriptions of built-in functions and methods.\\n'\n'\\n'\n'a class object:\\n'\n' A new instance of that class is returned.\\n'\n'\\n'\n'a class instance method:\\n'\n' The corresponding user-defined function is called, with an '\n'argument\\n'\n' list that is one longer than the argument list of the call: the\\n'\n' instance becomes the first argument.\\n'\n'\\n'\n'a class instance:\\n'\n' The class must define a \"__call__()\" method; the effect is then '\n'the\\n'\n' same as if that method was called.\\n',\n'class':'Class definitions\\n'\n'*****************\\n'\n'\\n'\n'A class definition defines a class object (see section The '\n'standard\\n'\n'type hierarchy):\\n'\n'\\n'\n' classdef ::= [decorators] \"class\" classname [inheritance] \":\" '\n'suite\\n'\n' inheritance ::= \"(\" [argument_list] \")\"\\n'\n' classname ::= identifier\\n'\n'\\n'\n'A class definition is an executable statement. The inheritance '\n'list\\n'\n'usually gives a list of base classes (see Metaclasses for more\\n'\n'advanced uses), so each item in the list should evaluate to a '\n'class\\n'\n'object which allows subclassing. Classes without an inheritance '\n'list\\n'\n'inherit, by default, from the base class \"object\"; hence,\\n'\n'\\n'\n' class Foo:\\n'\n' pass\\n'\n'\\n'\n'is equivalent to\\n'\n'\\n'\n' class Foo(object):\\n'\n' pass\\n'\n'\\n'\n'The class\u2019s suite is then executed in a new execution frame (see\\n'\n'Naming and binding), using a newly created local namespace and the\\n'\n'original global namespace. (Usually, the suite contains mostly\\n'\n'function definitions.) When the class\u2019s suite finishes execution, '\n'its\\n'\n'execution frame is discarded but its local namespace is saved. [5] '\n'A\\n'\n'class object is then created using the inheritance list for the '\n'base\\n'\n'classes and the saved local namespace for the attribute '\n'dictionary.\\n'\n'The class name is bound to this class object in the original local\\n'\n'namespace.\\n'\n'\\n'\n'The order in which attributes are defined in the class body is\\n'\n'preserved in the new class\u2019s \"__dict__\". Note that this is '\n'reliable\\n'\n'only right after the class is created and only for classes that '\n'were\\n'\n'defined using the definition syntax.\\n'\n'\\n'\n'Class creation can be customized heavily using metaclasses.\\n'\n'\\n'\n'Classes can also be decorated: just like when decorating '\n'functions,\\n'\n'\\n'\n' @f1(arg)\\n'\n' @f2\\n'\n' class Foo: pass\\n'\n'\\n'\n'is roughly equivalent to\\n'\n'\\n'\n' class Foo: pass\\n'\n' Foo = f1(arg)(f2(Foo))\\n'\n'\\n'\n'The evaluation rules for the decorator expressions are the same as '\n'for\\n'\n'function decorators. The result is then bound to the class name.\\n'\n'\\n'\n'Changed in version 3.9: Classes may be decorated with any valid\\n'\n'\"assignment_expression\". Previously, the grammar was much more\\n'\n'restrictive; see **PEP 614** for details.\\n'\n'\\n'\n'**Programmer\u2019s note:** Variables defined in the class definition '\n'are\\n'\n'class attributes; they are shared by instances. Instance '\n'attributes\\n'\n'can be set in a method with \"self.name = value\". Both class and\\n'\n'instance attributes are accessible through the notation '\n'\u201c\"self.name\"\u201d,\\n'\n'and an instance attribute hides a class attribute with the same '\n'name\\n'\n'when accessed in this way. Class attributes can be used as '\n'defaults\\n'\n'for instance attributes, but using mutable values there can lead '\n'to\\n'\n'unexpected results. Descriptors can be used to create instance\\n'\n'variables with different implementation details.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3115** - Metaclasses in Python 3000\\n'\n' The proposal that changed the declaration of metaclasses to '\n'the\\n'\n' current syntax, and the semantics for how classes with\\n'\n' metaclasses are constructed.\\n'\n'\\n'\n' **PEP 3129** - Class Decorators\\n'\n' The proposal that added class decorators. Function and '\n'method\\n'\n' decorators were introduced in **PEP 318**.\\n',\n'comparisons':'Comparisons\\n'\n'***********\\n'\n'\\n'\n'Unlike C, all comparison operations in Python have the same '\n'priority,\\n'\n'which is lower than that of any arithmetic, shifting or '\n'bitwise\\n'\n'operation. Also unlike C, expressions like \"a < b < c\" have '\n'the\\n'\n'interpretation that is conventional in mathematics:\\n'\n'\\n'\n' comparison ::= or_expr (comp_operator or_expr)*\\n'\n' comp_operator ::= \"<\" | \">\" | \"==\" | \">=\" | \"<=\" | \"!=\"\\n'\n' | \"is\" [\"not\"] | [\"not\"] \"in\"\\n'\n'\\n'\n'Comparisons yield boolean values: \"True\" or \"False\". Custom '\n'*rich\\n'\n'comparison methods* may return non-boolean values. In this '\n'case Python\\n'\n'will call \"bool()\" on such value in boolean contexts.\\n'\n'\\n'\n'Comparisons can be chained arbitrarily, e.g., \"x < y <= z\" '\n'is\\n'\n'equivalent to \"x < y and y <= z\", except that \"y\" is '\n'evaluated only\\n'\n'once (but in both cases \"z\" is not evaluated at all when \"x < '\n'y\" is\\n'\n'found to be false).\\n'\n'\\n'\n'Formally, if *a*, *b*, *c*, \u2026, *y*, *z* are expressions and '\n'*op1*,\\n'\n'*op2*, \u2026, *opN* are comparison operators, then \"a op1 b op2 c '\n'... y\\n'\n'opN z\" is equivalent to \"a op1 b and b op2 c and ... y opN '\n'z\", except\\n'\n'that each expression is evaluated at most once.\\n'\n'\\n'\n'Note that \"a op1 b op2 c\" doesn\u2019t imply any kind of '\n'comparison between\\n'\n'*a* and *c*, so that, e.g., \"x < y > z\" is perfectly legal '\n'(though\\n'\n'perhaps not pretty).\\n'\n'\\n'\n'\\n'\n'Value comparisons\\n'\n'=================\\n'\n'\\n'\n'The operators \"<\", \">\", \"==\", \">=\", \"<=\", and \"!=\" compare '\n'the values\\n'\n'of two objects. The objects do not need to have the same '\n'type.\\n'\n'\\n'\n'Chapter Objects, values and types states that objects have a '\n'value (in\\n'\n'addition to type and identity). The value of an object is a '\n'rather\\n'\n'abstract notion in Python: For example, there is no canonical '\n'access\\n'\n'method for an object\u2019s value. Also, there is no requirement '\n'that the\\n'\n'value of an object should be constructed in a particular way, '\n'e.g.\\n'\n'comprised of all its data attributes. Comparison operators '\n'implement a\\n'\n'particular notion of what the value of an object is. One can '\n'think of\\n'\n'them as defining the value of an object indirectly, by means '\n'of their\\n'\n'comparison implementation.\\n'\n'\\n'\n'Because all types are (direct or indirect) subtypes of '\n'\"object\", they\\n'\n'inherit the default comparison behavior from \"object\". Types '\n'can\\n'\n'customize their comparison behavior by implementing *rich '\n'comparison\\n'\n'methods* like \"__lt__()\", described in Basic customization.\\n'\n'\\n'\n'The default behavior for equality comparison (\"==\" and \"!=\") '\n'is based\\n'\n'on the identity of the objects. Hence, equality comparison '\n'of\\n'\n'instances with the same identity results in equality, and '\n'equality\\n'\n'comparison of instances with different identities results in\\n'\n'inequality. A motivation for this default behavior is the '\n'desire that\\n'\n'all objects should be reflexive (i.e. \"x is y\" implies \"x == '\n'y\").\\n'\n'\\n'\n'A default order comparison (\"<\", \">\", \"<=\", and \">=\") is not '\n'provided;\\n'\n'an attempt raises \"TypeError\". A motivation for this default '\n'behavior\\n'\n'is the lack of a similar invariant as for equality.\\n'\n'\\n'\n'The behavior of the default equality comparison, that '\n'instances with\\n'\n'different identities are always unequal, may be in contrast '\n'to what\\n'\n'types will need that have a sensible definition of object '\n'value and\\n'\n'value-based equality. Such types will need to customize '\n'their\\n'\n'comparison behavior, and in fact, a number of built-in types '\n'have done\\n'\n'that.\\n'\n'\\n'\n'The following list describes the comparison behavior of the '\n'most\\n'\n'important built-in types.\\n'\n'\\n'\n'* Numbers of built-in numeric types (Numeric Types \u2014 int, '\n'float,\\n'\n' complex) and of the standard library types '\n'\"fractions.Fraction\" and\\n'\n' \"decimal.Decimal\" can be compared within and across their '\n'types,\\n'\n' with the restriction that complex numbers do not support '\n'order\\n'\n' comparison. Within the limits of the types involved, they '\n'compare\\n'\n' mathematically (algorithmically) correct without loss of '\n'precision.\\n'\n'\\n'\n' The not-a-number values \"float(\\'NaN\\')\" and '\n'\"decimal.Decimal(\\'NaN\\')\"\\n'\n' are special. Any ordered comparison of a number to a '\n'not-a-number\\n'\n' value is false. A counter-intuitive implication is that '\n'not-a-number\\n'\n' values are not equal to themselves. For example, if \"x =\\n'\n' float(\\'NaN\\')\", \"3 < x\", \"x < 3\" and \"x == x\" are all '\n'false, while \"x\\n'\n' != x\" is true. This behavior is compliant with IEEE 754.\\n'\n'\\n'\n'* \"None\" and \"NotImplemented\" are singletons. **PEP 8** '\n'advises that\\n'\n' comparisons for singletons should always be done with \"is\" '\n'or \"is\\n'\n' not\", never the equality operators.\\n'\n'\\n'\n'* Binary sequences (instances of \"bytes\" or \"bytearray\") can '\n'be\\n'\n' compared within and across their types. They compare\\n'\n' lexicographically using the numeric values of their '\n'elements.\\n'\n'\\n'\n'* Strings (instances of \"str\") compare lexicographically '\n'using the\\n'\n' numerical Unicode code points (the result of the built-in '\n'function\\n'\n' \"ord()\") of their characters. [3]\\n'\n'\\n'\n' Strings and binary sequences cannot be directly compared.\\n'\n'\\n'\n'* Sequences (instances of \"tuple\", \"list\", or \"range\") can be '\n'compared\\n'\n' only within each of their types, with the restriction that '\n'ranges do\\n'\n' not support order comparison. Equality comparison across '\n'these\\n'\n' types results in inequality, and ordering comparison across '\n'these\\n'\n' types raises \"TypeError\".\\n'\n'\\n'\n' Sequences compare lexicographically using comparison of\\n'\n' corresponding elements. The built-in containers typically '\n'assume\\n'\n' identical objects are equal to themselves. That lets them '\n'bypass\\n'\n' equality tests for identical objects to improve performance '\n'and to\\n'\n' maintain their internal invariants.\\n'\n'\\n'\n' Lexicographical comparison between built-in collections '\n'works as\\n'\n' follows:\\n'\n'\\n'\n' * For two collections to compare equal, they must be of the '\n'same\\n'\n' type, have the same length, and each pair of '\n'corresponding\\n'\n' elements must compare equal (for example, \"[1,2] == '\n'(1,2)\" is\\n'\n' false because the type is not the same).\\n'\n'\\n'\n' * Collections that support order comparison are ordered the '\n'same as\\n'\n' their first unequal elements (for example, \"[1,2,x] <= '\n'[1,2,y]\"\\n'\n' has the same value as \"x <= y\"). If a corresponding '\n'element does\\n'\n' not exist, the shorter collection is ordered first (for '\n'example,\\n'\n' \"[1,2] < [1,2,3]\" is true).\\n'\n'\\n'\n'* Mappings (instances of \"dict\") compare equal if and only if '\n'they\\n'\n' have equal *(key, value)* pairs. Equality comparison of the '\n'keys and\\n'\n' values enforces reflexivity.\\n'\n'\\n'\n' Order comparisons (\"<\", \">\", \"<=\", and \">=\") raise '\n'\"TypeError\".\\n'\n'\\n'\n'* Sets (instances of \"set\" or \"frozenset\") can be compared '\n'within and\\n'\n' across their types.\\n'\n'\\n'\n' They define order comparison operators to mean subset and '\n'superset\\n'\n' tests. Those relations do not define total orderings (for '\n'example,\\n'\n' the two sets \"{1,2}\" and \"{2,3}\" are not equal, nor subsets '\n'of one\\n'\n' another, nor supersets of one another). Accordingly, sets '\n'are not\\n'\n' appropriate arguments for functions which depend on total '\n'ordering\\n'\n' (for example, \"min()\", \"max()\", and \"sorted()\" produce '\n'undefined\\n'\n' results given a list of sets as inputs).\\n'\n'\\n'\n' Comparison of sets enforces reflexivity of its elements.\\n'\n'\\n'\n'* Most other built-in types have no comparison methods '\n'implemented, so\\n'\n' they inherit the default comparison behavior.\\n'\n'\\n'\n'User-defined classes that customize their comparison behavior '\n'should\\n'\n'follow some consistency rules, if possible:\\n'\n'\\n'\n'* Equality comparison should be reflexive. In other words, '\n'identical\\n'\n' objects should compare equal:\\n'\n'\\n'\n' \"x is y\" implies \"x == y\"\\n'\n'\\n'\n'* Comparison should be symmetric. In other words, the '\n'following\\n'\n' expressions should have the same result:\\n'\n'\\n'\n' \"x == y\" and \"y == x\"\\n'\n'\\n'\n' \"x != y\" and \"y != x\"\\n'\n'\\n'\n' \"x < y\" and \"y > x\"\\n'\n'\\n'\n' \"x <= y\" and \"y >= x\"\\n'\n'\\n'\n'* Comparison should be transitive. The following '\n'(non-exhaustive)\\n'\n' examples illustrate that:\\n'\n'\\n'\n' \"x > y and y > z\" implies \"x > z\"\\n'\n'\\n'\n' \"x < y and y <= z\" implies \"x < z\"\\n'\n'\\n'\n'* Inverse comparison should result in the boolean negation. '\n'In other\\n'\n' words, the following expressions should have the same '\n'result:\\n'\n'\\n'\n' \"x == y\" and \"not x != y\"\\n'\n'\\n'\n' \"x < y\" and \"not x >= y\" (for total ordering)\\n'\n'\\n'\n' \"x > y\" and \"not x <= y\" (for total ordering)\\n'\n'\\n'\n' The last two expressions apply to totally ordered '\n'collections (e.g.\\n'\n' to sequences, but not to sets or mappings). See also the\\n'\n' \"total_ordering()\" decorator.\\n'\n'\\n'\n'* The \"hash()\" result should be consistent with equality. '\n'Objects that\\n'\n' are equal should either have the same hash value, or be '\n'marked as\\n'\n' unhashable.\\n'\n'\\n'\n'Python does not enforce these consistency rules. In fact, '\n'the\\n'\n'not-a-number values are an example for not following these '\n'rules.\\n'\n'\\n'\n'\\n'\n'Membership test operations\\n'\n'==========================\\n'\n'\\n'\n'The operators \"in\" and \"not in\" test for membership. \"x in '\n's\"\\n'\n'evaluates to \"True\" if *x* is a member of *s*, and \"False\" '\n'otherwise.\\n'\n'\"x not in s\" returns the negation of \"x in s\". All built-in '\n'sequences\\n'\n'and set types support this as well as dictionary, for which '\n'\"in\" tests\\n'\n'whether the dictionary has a given key. For container types '\n'such as\\n'\n'list, tuple, set, frozenset, dict, or collections.deque, the\\n'\n'expression \"x in y\" is equivalent to \"any(x is e or x == e '\n'for e in\\n'\n'y)\".\\n'\n'\\n'\n'For the string and bytes types, \"x in y\" is \"True\" if and '\n'only if *x*\\n'\n'is a substring of *y*. An equivalent test is \"y.find(x) != '\n'-1\".\\n'\n'Empty strings are always considered to be a substring of any '\n'other\\n'\n'string, so \"\"\" in \"abc\"\" will return \"True\".\\n'\n'\\n'\n'For user-defined classes which define the \"__contains__()\" '\n'method, \"x\\n'\n'in y\" returns \"True\" if \"y.__contains__(x)\" returns a true '\n'value, and\\n'\n'\"False\" otherwise.\\n'\n'\\n'\n'For user-defined classes which do not define \"__contains__()\" '\n'but do\\n'\n'define \"__iter__()\", \"x in y\" is \"True\" if some value \"z\", '\n'for which\\n'\n'the expression \"x is z or x == z\" is true, is produced while '\n'iterating\\n'\n'over \"y\". If an exception is raised during the iteration, it '\n'is as if\\n'\n'\"in\" raised that exception.\\n'\n'\\n'\n'Lastly, the old-style iteration protocol is tried: if a class '\n'defines\\n'\n'\"__getitem__()\", \"x in y\" is \"True\" if and only if there is a '\n'non-\\n'\n'negative integer index *i* such that \"x is y[i] or x == '\n'y[i]\", and no\\n'\n'lower integer index raises the \"IndexError\" exception. (If '\n'any other\\n'\n'exception is raised, it is as if \"in\" raised that '\n'exception).\\n'\n'\\n'\n'The operator \"not in\" is defined to have the inverse truth '\n'value of\\n'\n'\"in\".\\n'\n'\\n'\n'\\n'\n'Identity comparisons\\n'\n'====================\\n'\n'\\n'\n'The operators \"is\" and \"is not\" test for an object\u2019s '\n'identity: \"x is\\n'\n'y\" is true if and only if *x* and *y* are the same object. '\n'An\\n'\n'Object\u2019s identity is determined using the \"id()\" function. '\n'\"x is not\\n'\n'y\" yields the inverse truth value. [4]\\n',\n'compound':'Compound statements\\n'\n'*******************\\n'\n'\\n'\n'Compound statements contain (groups of) other statements; they '\n'affect\\n'\n'or control the execution of those other statements in some way. '\n'In\\n'\n'general, compound statements span multiple lines, although in '\n'simple\\n'\n'incarnations a whole compound statement may be contained in one '\n'line.\\n'\n'\\n'\n'The \"if\", \"while\" and \"for\" statements implement traditional '\n'control\\n'\n'flow constructs. \"try\" specifies exception handlers and/or '\n'cleanup\\n'\n'code for a group of statements, while the \"with\" statement '\n'allows the\\n'\n'execution of initialization and finalization code around a block '\n'of\\n'\n'code. Function and class definitions are also syntactically '\n'compound\\n'\n'statements.\\n'\n'\\n'\n'A compound statement consists of one or more \u2018clauses.\u2019 A '\n'clause\\n'\n'consists of a header and a \u2018suite.\u2019 The clause headers of a\\n'\n'particular compound statement are all at the same indentation '\n'level.\\n'\n'Each clause header begins with a uniquely identifying keyword '\n'and ends\\n'\n'with a colon. A suite is a group of statements controlled by a\\n'\n'clause. A suite can be one or more semicolon-separated simple\\n'\n'statements on the same line as the header, following the '\n'header\u2019s\\n'\n'colon, or it can be one or more indented statements on '\n'subsequent\\n'\n'lines. Only the latter form of a suite can contain nested '\n'compound\\n'\n'statements; the following is illegal, mostly because it wouldn\u2019t '\n'be\\n'\n'clear to which \"if\" clause a following \"else\" clause would '\n'belong:\\n'\n'\\n'\n' if test1: if test2: print(x)\\n'\n'\\n'\n'Also note that the semicolon binds tighter than the colon in '\n'this\\n'\n'context, so that in the following example, either all or none of '\n'the\\n'\n'\"print()\" calls are executed:\\n'\n'\\n'\n' if x < y < z: print(x); print(y); print(z)\\n'\n'\\n'\n'Summarizing:\\n'\n'\\n'\n' compound_stmt ::= if_stmt\\n'\n' | while_stmt\\n'\n' | for_stmt\\n'\n' | try_stmt\\n'\n' | with_stmt\\n'\n' | match_stmt\\n'\n' | funcdef\\n'\n' | classdef\\n'\n' | async_with_stmt\\n'\n' | async_for_stmt\\n'\n' | async_funcdef\\n'\n' suite ::= stmt_list NEWLINE | NEWLINE INDENT '\n'statement+ DEDENT\\n'\n' statement ::= stmt_list NEWLINE | compound_stmt\\n'\n' stmt_list ::= simple_stmt (\";\" simple_stmt)* [\";\"]\\n'\n'\\n'\n'Note that statements always end in a \"NEWLINE\" possibly followed '\n'by a\\n'\n'\"DEDENT\". Also note that optional continuation clauses always '\n'begin\\n'\n'with a keyword that cannot start a statement, thus there are no\\n'\n'ambiguities (the \u2018dangling \"else\"\u2019 problem is solved in Python '\n'by\\n'\n'requiring nested \"if\" statements to be indented).\\n'\n'\\n'\n'The formatting of the grammar rules in the following sections '\n'places\\n'\n'each clause on a separate line for clarity.\\n'\n'\\n'\n'\\n'\n'The \"if\" statement\\n'\n'==================\\n'\n'\\n'\n'The \"if\" statement is used for conditional execution:\\n'\n'\\n'\n' if_stmt ::= \"if\" assignment_expression \":\" suite\\n'\n' (\"elif\" assignment_expression \":\" suite)*\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'It selects exactly one of the suites by evaluating the '\n'expressions one\\n'\n'by one until one is found to be true (see section Boolean '\n'operations\\n'\n'for the definition of true and false); then that suite is '\n'executed\\n'\n'(and no other part of the \"if\" statement is executed or '\n'evaluated).\\n'\n'If all expressions are false, the suite of the \"else\" clause, '\n'if\\n'\n'present, is executed.\\n'\n'\\n'\n'\\n'\n'The \"while\" statement\\n'\n'=====================\\n'\n'\\n'\n'The \"while\" statement is used for repeated execution as long as '\n'an\\n'\n'expression is true:\\n'\n'\\n'\n' while_stmt ::= \"while\" assignment_expression \":\" suite\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'This repeatedly tests the expression and, if it is true, '\n'executes the\\n'\n'first suite; if the expression is false (which may be the first '\n'time\\n'\n'it is tested) the suite of the \"else\" clause, if present, is '\n'executed\\n'\n'and the loop terminates.\\n'\n'\\n'\n'A \"break\" statement executed in the first suite terminates the '\n'loop\\n'\n'without executing the \"else\" clause\u2019s suite. A \"continue\" '\n'statement\\n'\n'executed in the first suite skips the rest of the suite and goes '\n'back\\n'\n'to testing the expression.\\n'\n'\\n'\n'\\n'\n'The \"for\" statement\\n'\n'===================\\n'\n'\\n'\n'The \"for\" statement is used to iterate over the elements of a '\n'sequence\\n'\n'(such as a string, tuple or list) or other iterable object:\\n'\n'\\n'\n' for_stmt ::= \"for\" target_list \"in\" expression_list \":\" '\n'suite\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'The expression list is evaluated once; it should yield an '\n'iterable\\n'\n'object. An iterator is created for the result of the\\n'\n'\"expression_list\". The suite is then executed once for each '\n'item\\n'\n'provided by the iterator, in the order returned by the '\n'iterator. Each\\n'\n'item in turn is assigned to the target list using the standard '\n'rules\\n'\n'for assignments (see Assignment statements), and then the suite '\n'is\\n'\n'executed. When the items are exhausted (which is immediately '\n'when the\\n'\n'sequence is empty or an iterator raises a \"StopIteration\" '\n'exception),\\n'\n'the suite in the \"else\" clause, if present, is executed, and the '\n'loop\\n'\n'terminates.\\n'\n'\\n'\n'A \"break\" statement executed in the first suite terminates the '\n'loop\\n'\n'without executing the \"else\" clause\u2019s suite. A \"continue\" '\n'statement\\n'\n'executed in the first suite skips the rest of the suite and '\n'continues\\n'\n'with the next item, or with the \"else\" clause if there is no '\n'next\\n'\n'item.\\n'\n'\\n'\n'The for-loop makes assignments to the variables in the target '\n'list.\\n'\n'This overwrites all previous assignments to those variables '\n'including\\n'\n'those made in the suite of the for-loop:\\n'\n'\\n'\n' for i in range(10):\\n'\n' print(i)\\n'\n' i = 5 # this will not affect the for-loop\\n'\n' # because i will be overwritten with '\n'the next\\n'\n' # index in the range\\n'\n'\\n'\n'Names in the target list are not deleted when the loop is '\n'finished,\\n'\n'but if the sequence is empty, they will not have been assigned '\n'to at\\n'\n'all by the loop. Hint: the built-in function \"range()\" returns '\n'an\\n'\n'iterator of integers suitable to emulate the effect of Pascal\u2019s '\n'\"for i\\n'\n':= a to b do\"; e.g., \"list(range(3))\" returns the list \"[0, 1, '\n'2]\".\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' There is a subtlety when the sequence is being modified by the '\n'loop\\n'\n' (this can only occur for mutable sequences, e.g. lists). An\\n'\n' internal counter is used to keep track of which item is used '\n'next,\\n'\n' and this is incremented on each iteration. When this counter '\n'has\\n'\n' reached the length of the sequence the loop terminates. This '\n'means\\n'\n' that if the suite deletes the current (or a previous) item '\n'from the\\n'\n' sequence, the next item will be skipped (since it gets the '\n'index of\\n'\n' the current item which has already been treated). Likewise, '\n'if the\\n'\n' suite inserts an item in the sequence before the current item, '\n'the\\n'\n' current item will be treated again the next time through the '\n'loop.\\n'\n' This can lead to nasty bugs that can be avoided by making a\\n'\n' temporary copy using a slice of the whole sequence, e.g.,\\n'\n'\\n'\n' for x in a[:]:\\n'\n' if x < 0: a.remove(x)\\n'\n'\\n'\n'\\n'\n'The \"try\" statement\\n'\n'===================\\n'\n'\\n'\n'The \"try\" statement specifies exception handlers and/or cleanup '\n'code\\n'\n'for a group of statements:\\n'\n'\\n'\n' try_stmt ::= try1_stmt | try2_stmt\\n'\n' try1_stmt ::= \"try\" \":\" suite\\n'\n' (\"except\" [expression [\"as\" identifier]] \":\" '\n'suite)+\\n'\n' [\"else\" \":\" suite]\\n'\n' [\"finally\" \":\" suite]\\n'\n' try2_stmt ::= \"try\" \":\" suite\\n'\n' \"finally\" \":\" suite\\n'\n'\\n'\n'The \"except\" clause(s) specify one or more exception handlers. '\n'When no\\n'\n'exception occurs in the \"try\" clause, no exception handler is\\n'\n'executed. When an exception occurs in the \"try\" suite, a search '\n'for an\\n'\n'exception handler is started. This search inspects the except '\n'clauses\\n'\n'in turn until one is found that matches the exception. An '\n'expression-\\n'\n'less except clause, if present, must be last; it matches any\\n'\n'exception. For an except clause with an expression, that '\n'expression\\n'\n'is evaluated, and the clause matches the exception if the '\n'resulting\\n'\n'object is \u201ccompatible\u201d with the exception. An object is '\n'compatible\\n'\n'with an exception if it is the class or a base class of the '\n'exception\\n'\n'object, or a tuple containing an item that is the class or a '\n'base\\n'\n'class of the exception object.\\n'\n'\\n'\n'If no except clause matches the exception, the search for an '\n'exception\\n'\n'handler continues in the surrounding code and on the invocation '\n'stack.\\n'\n'[1]\\n'\n'\\n'\n'If the evaluation of an expression in the header of an except '\n'clause\\n'\n'raises an exception, the original search for a handler is '\n'canceled and\\n'\n'a search starts for the new exception in the surrounding code '\n'and on\\n'\n'the call stack (it is treated as if the entire \"try\" statement '\n'raised\\n'\n'the exception).\\n'\n'\\n'\n'When a matching except clause is found, the exception is '\n'assigned to\\n'\n'the target specified after the \"as\" keyword in that except '\n'clause, if\\n'\n'present, and the except clause\u2019s suite is executed. All except\\n'\n'clauses must have an executable block. When the end of this '\n'block is\\n'\n'reached, execution continues normally after the entire try '\n'statement.\\n'\n'(This means that if two nested handlers exist for the same '\n'exception,\\n'\n'and the exception occurs in the try clause of the inner handler, '\n'the\\n'\n'outer handler will not handle the exception.)\\n'\n'\\n'\n'When an exception has been assigned using \"as target\", it is '\n'cleared\\n'\n'at the end of the except clause. This is as if\\n'\n'\\n'\n' except E as N:\\n'\n' foo\\n'\n'\\n'\n'was translated to\\n'\n'\\n'\n' except E as N:\\n'\n' try:\\n'\n' foo\\n'\n' finally:\\n'\n' del N\\n'\n'\\n'\n'This means the exception must be assigned to a different name to '\n'be\\n'\n'able to refer to it after the except clause. Exceptions are '\n'cleared\\n'\n'because with the traceback attached to them, they form a '\n'reference\\n'\n'cycle with the stack frame, keeping all locals in that frame '\n'alive\\n'\n'until the next garbage collection occurs.\\n'\n'\\n'\n'Before an except clause\u2019s suite is executed, details about the\\n'\n'exception are stored in the \"sys\" module and can be accessed '\n'via\\n'\n'\"sys.exc_info()\". \"sys.exc_info()\" returns a 3-tuple consisting '\n'of the\\n'\n'exception class, the exception instance and a traceback object '\n'(see\\n'\n'section The standard type hierarchy) identifying the point in '\n'the\\n'\n'program where the exception occurred. The details about the '\n'exception\\n'\n'accessed via \"sys.exc_info()\" are restored to their previous '\n'values\\n'\n'when leaving an exception handler:\\n'\n'\\n'\n' >>> print(sys.exc_info())\\n'\n' (None, None, None)\\n'\n' >>> try:\\n'\n' ... raise TypeError\\n'\n' ... except:\\n'\n' ... print(sys.exc_info())\\n'\n' ... try:\\n'\n' ... raise ValueError\\n'\n' ... except:\\n'\n' ... print(sys.exc_info())\\n'\n' ... print(sys.exc_info())\\n'\n' ...\\n'\n\" (, TypeError(), )\\n'\n\" (, ValueError(), )\\n'\n\" (, TypeError(), )\\n'\n' >>> print(sys.exc_info())\\n'\n' (None, None, None)\\n'\n'\\n'\n'The optional \"else\" clause is executed if the control flow '\n'leaves the\\n'\n'\"try\" suite, no exception was raised, and no \"return\", '\n'\"continue\", or\\n'\n'\"break\" statement was executed. Exceptions in the \"else\" clause '\n'are\\n'\n'not handled by the preceding \"except\" clauses.\\n'\n'\\n'\n'If \"finally\" is present, it specifies a \u2018cleanup\u2019 handler. The '\n'\"try\"\\n'\n'clause is executed, including any \"except\" and \"else\" clauses. '\n'If an\\n'\n'exception occurs in any of the clauses and is not handled, the\\n'\n'exception is temporarily saved. The \"finally\" clause is '\n'executed. If\\n'\n'there is a saved exception it is re-raised at the end of the '\n'\"finally\"\\n'\n'clause. If the \"finally\" clause raises another exception, the '\n'saved\\n'\n'exception is set as the context of the new exception. If the '\n'\"finally\"\\n'\n'clause executes a \"return\", \"break\" or \"continue\" statement, the '\n'saved\\n'\n'exception is discarded:\\n'\n'\\n'\n' >>> def f():\\n'\n' ... try:\\n'\n' ... 1/0\\n'\n' ... finally:\\n'\n' ... return 42\\n'\n' ...\\n'\n' >>> f()\\n'\n' 42\\n'\n'\\n'\n'The exception information is not available to the program '\n'during\\n'\n'execution of the \"finally\" clause.\\n'\n'\\n'\n'When a \"return\", \"break\" or \"continue\" statement is executed in '\n'the\\n'\n'\"try\" suite of a \"try\"\u2026\"finally\" statement, the \"finally\" clause '\n'is\\n'\n'also executed \u2018on the way out.\u2019\\n'\n'\\n'\n'The return value of a function is determined by the last '\n'\"return\"\\n'\n'statement executed. Since the \"finally\" clause always executes, '\n'a\\n'\n'\"return\" statement executed in the \"finally\" clause will always '\n'be the\\n'\n'last one executed:\\n'\n'\\n'\n' >>> def foo():\\n'\n' ... try:\\n'\n\" ... return 'try'\\n\"\n' ... finally:\\n'\n\" ... return 'finally'\\n\"\n' ...\\n'\n' >>> foo()\\n'\n\" 'finally'\\n\"\n'\\n'\n'Additional information on exceptions can be found in section\\n'\n'Exceptions, and information on using the \"raise\" statement to '\n'generate\\n'\n'exceptions may be found in section The raise statement.\\n'\n'\\n'\n'Changed in version 3.8: Prior to Python 3.8, a \"continue\" '\n'statement\\n'\n'was illegal in the \"finally\" clause due to a problem with the\\n'\n'implementation.\\n'\n'\\n'\n'\\n'\n'The \"with\" statement\\n'\n'====================\\n'\n'\\n'\n'The \"with\" statement is used to wrap the execution of a block '\n'with\\n'\n'methods defined by a context manager (see section With '\n'Statement\\n'\n'Context Managers). This allows common \"try\"\u2026\"except\"\u2026\"finally\" '\n'usage\\n'\n'patterns to be encapsulated for convenient reuse.\\n'\n'\\n'\n' with_stmt ::= \"with\" ( \"(\" with_stmt_contents \",\"? '\n'\")\" | with_stmt_contents ) \":\" suite\\n'\n' with_stmt_contents ::= with_item (\",\" with_item)*\\n'\n' with_item ::= expression [\"as\" target]\\n'\n'\\n'\n'The execution of the \"with\" statement with one \u201citem\u201d proceeds '\n'as\\n'\n'follows:\\n'\n'\\n'\n'1. The context expression (the expression given in the '\n'\"with_item\") is\\n'\n' evaluated to obtain a context manager.\\n'\n'\\n'\n'2. The context manager\u2019s \"__enter__()\" is loaded for later use.\\n'\n'\\n'\n'3. The context manager\u2019s \"__exit__()\" is loaded for later use.\\n'\n'\\n'\n'4. The context manager\u2019s \"__enter__()\" method is invoked.\\n'\n'\\n'\n'5. If a target was included in the \"with\" statement, the return '\n'value\\n'\n' from \"__enter__()\" is assigned to it.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The \"with\" statement guarantees that if the \"__enter__()\" '\n'method\\n'\n' returns without an error, then \"__exit__()\" will always be\\n'\n' called. Thus, if an error occurs during the assignment to '\n'the\\n'\n' target list, it will be treated the same as an error '\n'occurring\\n'\n' within the suite would be. See step 6 below.\\n'\n'\\n'\n'6. The suite is executed.\\n'\n'\\n'\n'7. The context manager\u2019s \"__exit__()\" method is invoked. If an\\n'\n' exception caused the suite to be exited, its type, value, '\n'and\\n'\n' traceback are passed as arguments to \"__exit__()\". Otherwise, '\n'three\\n'\n' \"None\" arguments are supplied.\\n'\n'\\n'\n' If the suite was exited due to an exception, and the return '\n'value\\n'\n' from the \"__exit__()\" method was false, the exception is '\n'reraised.\\n'\n' If the return value was true, the exception is suppressed, '\n'and\\n'\n' execution continues with the statement following the \"with\"\\n'\n' statement.\\n'\n'\\n'\n' If the suite was exited for any reason other than an '\n'exception, the\\n'\n' return value from \"__exit__()\" is ignored, and execution '\n'proceeds\\n'\n' at the normal location for the kind of exit that was taken.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' with EXPRESSION as TARGET:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' manager = (EXPRESSION)\\n'\n' enter = type(manager).__enter__\\n'\n' exit = type(manager).__exit__\\n'\n' value = enter(manager)\\n'\n' hit_except = False\\n'\n'\\n'\n' try:\\n'\n' TARGET = value\\n'\n' SUITE\\n'\n' except:\\n'\n' hit_except = True\\n'\n' if not exit(manager, *sys.exc_info()):\\n'\n' raise\\n'\n' finally:\\n'\n' if not hit_except:\\n'\n' exit(manager, None, None, None)\\n'\n'\\n'\n'With more than one item, the context managers are processed as '\n'if\\n'\n'multiple \"with\" statements were nested:\\n'\n'\\n'\n' with A() as a, B() as b:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' with A() as a:\\n'\n' with B() as b:\\n'\n' SUITE\\n'\n'\\n'\n'You can also write multi-item context managers in multiple lines '\n'if\\n'\n'the items are surrounded by parentheses. For example:\\n'\n'\\n'\n' with (\\n'\n' A() as a,\\n'\n' B() as b,\\n'\n' ):\\n'\n' SUITE\\n'\n'\\n'\n'Changed in version 3.1: Support for multiple context '\n'expressions.\\n'\n'\\n'\n'Changed in version 3.10: Support for using grouping parentheses '\n'to\\n'\n'break the statement in multiple lines.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 343** - The \u201cwith\u201d statement\\n'\n' The specification, background, and examples for the Python '\n'\"with\"\\n'\n' statement.\\n'\n'\\n'\n'\\n'\n'The \"match\" statement\\n'\n'=====================\\n'\n'\\n'\n'New in version 3.10.\\n'\n'\\n'\n'The match statement is used for pattern matching. Syntax:\\n'\n'\\n'\n' match_stmt ::= \\'match\\' subject_expr \":\" NEWLINE INDENT '\n'case_block+ DEDENT\\n'\n' subject_expr ::= star_named_expression \",\" '\n'star_named_expressions?\\n'\n' | named_expression\\n'\n' case_block ::= \\'case\\' patterns [guard] \":\" block\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' This section uses single quotes to denote soft keywords.\\n'\n'\\n'\n'Pattern matching takes a pattern as input (following \"case\") and '\n'a\\n'\n'subject value (following \"match\"). The pattern (which may '\n'contain\\n'\n'subpatterns) is matched against the subject value. The outcomes '\n'are:\\n'\n'\\n'\n'* A match success or failure (also termed a pattern success or\\n'\n' failure).\\n'\n'\\n'\n'* Possible binding of matched values to a name. The '\n'prerequisites for\\n'\n' this are further discussed below.\\n'\n'\\n'\n'The \"match\" and \"case\" keywords are soft keywords.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' * **PEP 634** \u2013 Structural Pattern Matching: Specification\\n'\n'\\n'\n' * **PEP 636** \u2013 Structural Pattern Matching: Tutorial\\n'\n'\\n'\n'\\n'\n'Overview\\n'\n'--------\\n'\n'\\n'\n'Here\u2019s an overview of the logical flow of a match statement:\\n'\n'\\n'\n'1. The subject expression \"subject_expr\" is evaluated and a '\n'resulting\\n'\n' subject value obtained. If the subject expression contains a '\n'comma,\\n'\n' a tuple is constructed using the standard rules.\\n'\n'\\n'\n'2. Each pattern in a \"case_block\" is attempted to match with '\n'the\\n'\n' subject value. The specific rules for success or failure are\\n'\n' described below. The match attempt can also bind some or all '\n'of the\\n'\n' standalone names within the pattern. The precise pattern '\n'binding\\n'\n' rules vary per pattern type and are specified below. **Name\\n'\n' bindings made during a successful pattern match outlive the\\n'\n' executed block and can be used after the match statement**.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' During failed pattern matches, some subpatterns may '\n'succeed.\\n'\n' Do not rely on bindings being made for a failed match.\\n'\n' Conversely, do not rely on variables remaining unchanged '\n'after\\n'\n' a failed match. The exact behavior is dependent on\\n'\n' implementation and may vary. This is an intentional '\n'decision\\n'\n' made to allow different implementations to add '\n'optimizations.\\n'\n'\\n'\n'3. If the pattern succeeds, the corresponding guard (if present) '\n'is\\n'\n' evaluated. In this case all name bindings are guaranteed to '\n'have\\n'\n' happened.\\n'\n'\\n'\n' * If the guard evaluates as truthy or missing, the \"block\" '\n'inside\\n'\n' \"case_block\" is executed.\\n'\n'\\n'\n' * Otherwise, the next \"case_block\" is attempted as described '\n'above.\\n'\n'\\n'\n' * If there are no further case blocks, the match statement '\n'is\\n'\n' completed.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Users should generally never rely on a pattern being '\n'evaluated.\\n'\n' Depending on implementation, the interpreter may cache values '\n'or use\\n'\n' other optimizations which skip repeated evaluations.\\n'\n'\\n'\n'A sample match statement:\\n'\n'\\n'\n' >>> flag = False\\n'\n' >>> match (100, 200):\\n'\n' ... case (100, 300): # Mismatch: 200 != 300\\n'\n\" ... print('Case 1')\\n\"\n' ... case (100, 200) if flag: # Successful match, but '\n'guard fails\\n'\n\" ... print('Case 2')\\n\"\n' ... case (100, y): # Matches and binds y to 200\\n'\n\" ... print(f'Case 3, y: {y}')\\n\"\n' ... case _: # Pattern not attempted\\n'\n\" ... print('Case 4, I match anything!')\\n\"\n' ...\\n'\n' Case 3, y: 200\\n'\n'\\n'\n'In this case, \"if flag\" is a guard. Read more about that in the '\n'next\\n'\n'section.\\n'\n'\\n'\n'\\n'\n'Guards\\n'\n'------\\n'\n'\\n'\n' guard ::= \"if\" named_expression\\n'\n'\\n'\n'A \"guard\" (which is part of the \"case\") must succeed for code '\n'inside\\n'\n'the \"case\" block to execute. It takes the form: \"if\" followed '\n'by an\\n'\n'expression.\\n'\n'\\n'\n'The logical flow of a \"case\" block with a \"guard\" follows:\\n'\n'\\n'\n'1. Check that the pattern in the \"case\" block succeeded. If '\n'the\\n'\n' pattern failed, the \"guard\" is not evaluated and the next '\n'\"case\"\\n'\n' block is checked.\\n'\n'\\n'\n'2. If the pattern succeeded, evaluate the \"guard\".\\n'\n'\\n'\n' * If the \"guard\" condition evaluates to \u201ctruthy\u201d, the case '\n'block is\\n'\n' selected.\\n'\n'\\n'\n' * If the \"guard\" condition evaluates to \u201cfalsy\u201d, the case '\n'block is\\n'\n' not selected.\\n'\n'\\n'\n' * If the \"guard\" raises an exception during evaluation, the\\n'\n' exception bubbles up.\\n'\n'\\n'\n'Guards are allowed to have side effects as they are '\n'expressions.\\n'\n'Guard evaluation must proceed from the first to the last case '\n'block,\\n'\n'one at a time, skipping case blocks whose pattern(s) don\u2019t all\\n'\n'succeed. (I.e., guard evaluation must happen in order.) Guard\\n'\n'evaluation must stop once a case block is selected.\\n'\n'\\n'\n'\\n'\n'Irrefutable Case Blocks\\n'\n'-----------------------\\n'\n'\\n'\n'An irrefutable case block is a match-all case block. A match\\n'\n'statement may have at most one irrefutable case block, and it '\n'must be\\n'\n'last.\\n'\n'\\n'\n'A case block is considered irrefutable if it has no guard and '\n'its\\n'\n'pattern is irrefutable. A pattern is considered irrefutable if '\n'we can\\n'\n'prove from its syntax alone that it will always succeed. Only '\n'the\\n'\n'following patterns are irrefutable:\\n'\n'\\n'\n'* AS Patterns whose left-hand side is irrefutable\\n'\n'\\n'\n'* OR Patterns containing at least one irrefutable pattern\\n'\n'\\n'\n'* Capture Patterns\\n'\n'\\n'\n'* Wildcard Patterns\\n'\n'\\n'\n'* parenthesized irrefutable patterns\\n'\n'\\n'\n'\\n'\n'Patterns\\n'\n'--------\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' This section uses grammar notations beyond standard EBNF:\\n'\n'\\n'\n' * the notation \"SEP.RULE+\" is shorthand for \"RULE (SEP '\n'RULE)*\"\\n'\n'\\n'\n' * the notation \"!RULE\" is shorthand for a negative lookahead\\n'\n' assertion\\n'\n'\\n'\n'The top-level syntax for \"patterns\" is:\\n'\n'\\n'\n' patterns ::= open_sequence_pattern | pattern\\n'\n' pattern ::= as_pattern | or_pattern\\n'\n' closed_pattern ::= | literal_pattern\\n'\n' | capture_pattern\\n'\n' | wildcard_pattern\\n'\n' | value_pattern\\n'\n' | group_pattern\\n'\n' | sequence_pattern\\n'\n' | mapping_pattern\\n'\n' | class_pattern\\n'\n'\\n'\n'The descriptions below will include a description \u201cin simple '\n'terms\u201d of\\n'\n'what a pattern does for illustration purposes (credits to '\n'Raymond\\n'\n'Hettinger for a document that inspired most of the '\n'descriptions). Note\\n'\n'that these descriptions are purely for illustration purposes and '\n'**may\\n'\n'not** reflect the underlying implementation. Furthermore, they '\n'do not\\n'\n'cover all valid forms.\\n'\n'\\n'\n'\\n'\n'OR Patterns\\n'\n'~~~~~~~~~~~\\n'\n'\\n'\n'An OR pattern is two or more patterns separated by vertical bars '\n'\"|\".\\n'\n'Syntax:\\n'\n'\\n'\n' or_pattern ::= \"|\".closed_pattern+\\n'\n'\\n'\n'Only the final subpattern may be irrefutable, and each '\n'subpattern must\\n'\n'bind the same set of names to avoid ambiguity.\\n'\n'\\n'\n'An OR pattern matches each of its subpatterns in turn to the '\n'subject\\n'\n'value, until one succeeds. The OR pattern is then considered\\n'\n'successful. Otherwise, if none of the subpatterns succeed, the '\n'OR\\n'\n'pattern fails.\\n'\n'\\n'\n'In simple terms, \"P1 | P2 | ...\" will try to match \"P1\", if it '\n'fails\\n'\n'it will try to match \"P2\", succeeding immediately if any '\n'succeeds,\\n'\n'failing otherwise.\\n'\n'\\n'\n'\\n'\n'AS Patterns\\n'\n'~~~~~~~~~~~\\n'\n'\\n'\n'An AS pattern matches an OR pattern on the left of the \"as\" '\n'keyword\\n'\n'against a subject. Syntax:\\n'\n'\\n'\n' as_pattern ::= or_pattern \"as\" capture_pattern\\n'\n'\\n'\n'If the OR pattern fails, the AS pattern fails. Otherwise, the '\n'AS\\n'\n'pattern binds the subject to the name on the right of the as '\n'keyword\\n'\n'and succeeds. \"capture_pattern\" cannot be a a \"_\".\\n'\n'\\n'\n'In simple terms \"P as NAME\" will match with \"P\", and on success '\n'it\\n'\n'will set \"NAME = \".\\n'\n'\\n'\n'\\n'\n'Literal Patterns\\n'\n'~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A literal pattern corresponds to most literals in Python. '\n'Syntax:\\n'\n'\\n'\n' literal_pattern ::= signed_number\\n'\n' | signed_number \"+\" NUMBER\\n'\n' | signed_number \"-\" NUMBER\\n'\n' | strings\\n'\n' | \"None\"\\n'\n' | \"True\"\\n'\n' | \"False\"\\n'\n' | signed_number: NUMBER | \"-\" NUMBER\\n'\n'\\n'\n'The rule \"strings\" and the token \"NUMBER\" are defined in the '\n'standard\\n'\n'Python grammar. Triple-quoted strings are supported. Raw '\n'strings and\\n'\n'byte strings are supported. Formatted string literals are not\\n'\n'supported.\\n'\n'\\n'\n'The forms \"signed_number \\'+\\' NUMBER\" and \"signed_number \\'-\\' '\n'NUMBER\"\\n'\n'are for expressing complex numbers; they require a real number '\n'on the\\n'\n'left and an imaginary number on the right. E.g. \"3 + 4j\".\\n'\n'\\n'\n'In simple terms, \"LITERAL\" will succeed only if \" ==\\n'\n'LITERAL\". For the singletons \"None\", \"True\" and \"False\", the '\n'\"is\"\\n'\n'operator is used.\\n'\n'\\n'\n'\\n'\n'Capture Patterns\\n'\n'~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A capture pattern binds the subject value to a name. Syntax:\\n'\n'\\n'\n\" capture_pattern ::= !'_' NAME\\n\"\n'\\n'\n'A single underscore \"_\" is not a capture pattern (this is what '\n'\"!\\'_\\'\"\\n'\n'expresses). It is instead treated as a \"wildcard_pattern\".\\n'\n'\\n'\n'In a given pattern, a given name can only be bound once. E.g. '\n'\"case\\n'\n'x, x: ...\" is invalid while \"case [x] | x: ...\" is allowed.\\n'\n'\\n'\n'Capture patterns always succeed. The binding follows scoping '\n'rules\\n'\n'established by the assignment expression operator in **PEP '\n'572**; the\\n'\n'name becomes a local variable in the closest containing function '\n'scope\\n'\n'unless there\u2019s an applicable \"global\" or \"nonlocal\" statement.\\n'\n'\\n'\n'In simple terms \"NAME\" will always succeed and it will set \"NAME '\n'=\\n'\n'\".\\n'\n'\\n'\n'\\n'\n'Wildcard Patterns\\n'\n'~~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A wildcard pattern always succeeds (matches anything) and binds '\n'no\\n'\n'name. Syntax:\\n'\n'\\n'\n\" wildcard_pattern ::= '_'\\n\"\n'\\n'\n'\"_\" is a soft keyword within any pattern, but only within '\n'patterns.\\n'\n'It is an identifier, as usual, even within \"match\" subject\\n'\n'expressions, \"guard\"s, and \"case\" blocks.\\n'\n'\\n'\n'In simple terms, \"_\" will always succeed.\\n'\n'\\n'\n'\\n'\n'Value Patterns\\n'\n'~~~~~~~~~~~~~~\\n'\n'\\n'\n'A value pattern represents a named value in Python. Syntax:\\n'\n'\\n'\n' value_pattern ::= attr\\n'\n' attr ::= name_or_attr \".\" NAME\\n'\n' name_or_attr ::= attr | NAME\\n'\n'\\n'\n'The dotted name in the pattern is looked up using standard '\n'Python name\\n'\n'resolution rules. The pattern succeeds if the value found '\n'compares\\n'\n'equal to the subject value (using the \"==\" equality operator).\\n'\n'\\n'\n'In simple terms \"NAME1.NAME2\" will succeed only if \" '\n'==\\n'\n'NAME1.NAME2\"\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' If the same value occurs multiple times in the same match '\n'statement,\\n'\n' the interpreter may cache the first value found and reuse it '\n'rather\\n'\n' than repeat the same lookup. This cache is strictly tied to a '\n'given\\n'\n' execution of a given match statement.\\n'\n'\\n'\n'\\n'\n'Group Patterns\\n'\n'~~~~~~~~~~~~~~\\n'\n'\\n'\n'A group pattern allows users to add parentheses around patterns '\n'to\\n'\n'emphasize the intended grouping. Otherwise, it has no '\n'additional\\n'\n'syntax. Syntax:\\n'\n'\\n'\n' group_pattern ::= \"(\" pattern \")\"\\n'\n'\\n'\n'In simple terms \"(P)\" has the same effect as \"P\".\\n'\n'\\n'\n'\\n'\n'Sequence Patterns\\n'\n'~~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A sequence pattern contains several subpatterns to be matched '\n'against\\n'\n'sequence elements. The syntax is similar to the unpacking of a '\n'list or\\n'\n'tuple.\\n'\n'\\n'\n' sequence_pattern ::= \"[\" [maybe_sequence_pattern] \"]\"\\n'\n' | \"(\" [open_sequence_pattern] \")\"\\n'\n' open_sequence_pattern ::= maybe_star_pattern \",\" '\n'[maybe_sequence_pattern]\\n'\n' maybe_sequence_pattern ::= \",\".maybe_star_pattern+ \",\"?\\n'\n' maybe_star_pattern ::= star_pattern | pattern\\n'\n' star_pattern ::= \"*\" (capture_pattern | '\n'wildcard_pattern)\\n'\n'\\n'\n'There is no difference if parentheses or square brackets are '\n'used for\\n'\n'sequence patterns (i.e. \"(...)\" vs \"[...]\" ).\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' A single pattern enclosed in parentheses without a trailing '\n'comma\\n'\n' (e.g. \"(3 | 4)\") is a group pattern. While a single pattern '\n'enclosed\\n'\n' in square brackets (e.g. \"[3 | 4]\") is still a sequence '\n'pattern.\\n'\n'\\n'\n'At most one star subpattern may be in a sequence pattern. The '\n'star\\n'\n'subpattern may occur in any position. If no star subpattern is\\n'\n'present, the sequence pattern is a fixed-length sequence '\n'pattern;\\n'\n'otherwise it is a variable-length sequence pattern.\\n'\n'\\n'\n'The following is the logical flow for matching a sequence '\n'pattern\\n'\n'against a subject value:\\n'\n'\\n'\n'1. If the subject value is not a sequence [2], the sequence '\n'pattern\\n'\n' fails.\\n'\n'\\n'\n'2. If the subject value is an instance of \"str\", \"bytes\" or\\n'\n' \"bytearray\" the sequence pattern fails.\\n'\n'\\n'\n'3. The subsequent steps depend on whether the sequence pattern '\n'is\\n'\n' fixed or variable-length.\\n'\n'\\n'\n' If the sequence pattern is fixed-length:\\n'\n'\\n'\n' 1. If the length of the subject sequence is not equal to the '\n'number\\n'\n' of subpatterns, the sequence pattern fails\\n'\n'\\n'\n' 2. Subpatterns in the sequence pattern are matched to their\\n'\n' corresponding items in the subject sequence from left to '\n'right.\\n'\n' Matching stops as soon as a subpattern fails. If all\\n'\n' subpatterns succeed in matching their corresponding item, '\n'the\\n'\n' sequence pattern succeeds.\\n'\n'\\n'\n' Otherwise, if the sequence pattern is variable-length:\\n'\n'\\n'\n' 1. If the length of the subject sequence is less than the '\n'number of\\n'\n' non-star subpatterns, the sequence pattern fails.\\n'\n'\\n'\n' 2. The leading non-star subpatterns are matched to their\\n'\n' corresponding items as for fixed-length sequences.\\n'\n'\\n'\n' 3. If the previous step succeeds, the star subpattern matches '\n'a\\n'\n' list formed of the remaining subject items, excluding the\\n'\n' remaining items corresponding to non-star subpatterns '\n'following\\n'\n' the star subpattern.\\n'\n'\\n'\n' 4. Remaining non-star subpatterns are matched to their\\n'\n' corresponding subject items, as for a fixed-length '\n'sequence.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The length of the subject sequence is obtained via \"len()\" '\n'(i.e.\\n'\n' via the \"__len__()\" protocol). This length may be cached '\n'by the\\n'\n' interpreter in a similar manner as value patterns.\\n'\n'\\n'\n'In simple terms \"[P1, P2, P3,\" \u2026 \", P]\" matches only if all '\n'the\\n'\n'following happens:\\n'\n'\\n'\n'* check \"\" is a sequence\\n'\n'\\n'\n'* \"len(subject) == \"\\n'\n'\\n'\n'* \"P1\" matches \"[0]\" (note that this match can also '\n'bind\\n'\n' names)\\n'\n'\\n'\n'* \"P2\" matches \"[1]\" (note that this match can also '\n'bind\\n'\n' names)\\n'\n'\\n'\n'* \u2026 and so on for the corresponding pattern/element.\\n'\n'\\n'\n'\\n'\n'Mapping Patterns\\n'\n'~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'A mapping pattern contains one or more key-value patterns. The '\n'syntax\\n'\n'is similar to the construction of a dictionary. Syntax:\\n'\n'\\n'\n' mapping_pattern ::= \"{\" [items_pattern] \"}\"\\n'\n' items_pattern ::= \",\".key_value_pattern+ \",\"?\\n'\n' key_value_pattern ::= (literal_pattern | value_pattern) \":\" '\n'pattern\\n'\n' | double_star_pattern\\n'\n' double_star_pattern ::= \"**\" capture_pattern\\n'\n'\\n'\n'At most one double star pattern may be in a mapping pattern. '\n'The\\n'\n'double star pattern must be the last subpattern in the mapping\\n'\n'pattern.\\n'\n'\\n'\n'Duplicate keys in mapping patterns are disallowed. Duplicate '\n'literal\\n'\n'keys will raise a \"SyntaxError\". Two keys that otherwise have '\n'the same\\n'\n'value will raise a \"ValueError\" at runtime.\\n'\n'\\n'\n'The following is the logical flow for matching a mapping '\n'pattern\\n'\n'against a subject value:\\n'\n'\\n'\n'1. If the subject value is not a mapping [3],the mapping '\n'pattern\\n'\n' fails.\\n'\n'\\n'\n'2. If every key given in the mapping pattern is present in the '\n'subject\\n'\n' mapping, and the pattern for each key matches the '\n'corresponding\\n'\n' item of the subject mapping, the mapping pattern succeeds.\\n'\n'\\n'\n'3. If duplicate keys are detected in the mapping pattern, the '\n'pattern\\n'\n' is considered invalid. A \"SyntaxError\" is raised for '\n'duplicate\\n'\n' literal values; or a \"ValueError\" for named keys of the same '\n'value.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Key-value pairs are matched using the two-argument form of '\n'the\\n'\n' mapping subject\u2019s \"get()\" method. Matched key-value pairs '\n'must\\n'\n' already be present in the mapping, and not created on-the-fly '\n'via\\n'\n' \"__missing__()\" or \"__getitem__()\".\\n'\n'\\n'\n'In simple terms \"{KEY1: P1, KEY2: P2, ... }\" matches only if all '\n'the\\n'\n'following happens:\\n'\n'\\n'\n'* check \"\" is a mapping\\n'\n'\\n'\n'* \"KEY1 in \"\\n'\n'\\n'\n'* \"P1\" matches \"[KEY1]\"\\n'\n'\\n'\n'* \u2026 and so on for the corresponding KEY/pattern pair.\\n'\n'\\n'\n'\\n'\n'Class Patterns\\n'\n'~~~~~~~~~~~~~~\\n'\n'\\n'\n'A class pattern represents a class and its positional and '\n'keyword\\n'\n'arguments (if any). Syntax:\\n'\n'\\n'\n' class_pattern ::= name_or_attr \"(\" [pattern_arguments '\n'\",\"?] \")\"\\n'\n' pattern_arguments ::= positional_patterns [\",\" '\n'keyword_patterns]\\n'\n' | keyword_patterns\\n'\n' positional_patterns ::= \",\".pattern+\\n'\n' keyword_patterns ::= \",\".keyword_pattern+\\n'\n' keyword_pattern ::= NAME \"=\" pattern\\n'\n'\\n'\n'The same keyword should not be repeated in class patterns.\\n'\n'\\n'\n'The following is the logical flow for matching a mapping '\n'pattern\\n'\n'against a subject value:\\n'\n'\\n'\n'1. If \"name_or_attr\" is not an instance of the builtin \"type\" , '\n'raise\\n'\n' \"TypeError\".\\n'\n'\\n'\n'2. If the subject value is not an instance of \"name_or_attr\" '\n'(tested\\n'\n' via \"isinstance()\"), the class pattern fails.\\n'\n'\\n'\n'3. If no pattern arguments are present, the pattern succeeds.\\n'\n' Otherwise, the subsequent steps depend on whether keyword or\\n'\n' positional argument patterns are present.\\n'\n'\\n'\n' For a number of built-in types (specified below), a single\\n'\n' positional subpattern is accepted which will match the '\n'entire\\n'\n' subject; for these types keyword patterns also work as for '\n'other\\n'\n' types.\\n'\n'\\n'\n' If only keyword patterns are present, they are processed as\\n'\n' follows, one by one:\\n'\n'\\n'\n' I. The keyword is looked up as an attribute on the subject.\\n'\n'\\n'\n' * If this raises an exception other than \"AttributeError\", '\n'the\\n'\n' exception bubbles up.\\n'\n'\\n'\n' * If this raises \"AttributeError\", the class pattern has '\n'failed.\\n'\n'\\n'\n' * Else, the subpattern associated with the keyword pattern '\n'is\\n'\n' matched against the subject\u2019s attribute value. If this '\n'fails,\\n'\n' the class pattern fails; if this succeeds, the match '\n'proceeds\\n'\n' to the next keyword.\\n'\n'\\n'\n' II. If all keyword patterns succeed, the class pattern '\n'succeeds.\\n'\n'\\n'\n' If any positional patterns are present, they are converted '\n'to\\n'\n' keyword patterns using the \"__match_args__\" attribute on the '\n'class\\n'\n' \"name_or_attr\" before matching:\\n'\n'\\n'\n' I. The equivalent of \"getattr(cls, \"__match_args__\", ()))\" '\n'is\\n'\n' called.\\n'\n'\\n'\n' * If this raises an exception, the exception bubbles up.\\n'\n'\\n'\n' * If the returned value is not a tuple, the conversion '\n'fails and\\n'\n' \"TypeError\" is raised.\\n'\n'\\n'\n' * If there are more positional patterns than\\n'\n' \"len(cls.__match_args__)\", \"TypeError\" is raised.\\n'\n'\\n'\n' * Otherwise, positional pattern \"i\" is converted to a '\n'keyword\\n'\n' pattern using \"__match_args__[i]\" as the keyword.\\n'\n' \"__match_args__[i]\" must be a string; if not \"TypeError\" '\n'is\\n'\n' raised.\\n'\n'\\n'\n' * If there are duplicate keywords, \"TypeError\" is raised.\\n'\n'\\n'\n' See also:\\n'\n'\\n'\n' Customizing positional arguments in class pattern '\n'matching\\n'\n'\\n'\n' II. Once all positional patterns have been converted to '\n'keyword\\n'\n' patterns,\\n'\n' the match proceeds as if there were only keyword '\n'patterns.\\n'\n'\\n'\n' For the following built-in types the handling of positional\\n'\n' subpatterns is different:\\n'\n'\\n'\n' * \"bool\"\\n'\n'\\n'\n' * \"bytearray\"\\n'\n'\\n'\n' * \"bytes\"\\n'\n'\\n'\n' * \"dict\"\\n'\n'\\n'\n' * \"float\"\\n'\n'\\n'\n' * \"frozenset\"\\n'\n'\\n'\n' * \"int\"\\n'\n'\\n'\n' * \"list\"\\n'\n'\\n'\n' * \"set\"\\n'\n'\\n'\n' * \"str\"\\n'\n'\\n'\n' * \"tuple\"\\n'\n'\\n'\n' These classes accept a single positional argument, and the '\n'pattern\\n'\n' there is matched against the whole object rather than an '\n'attribute.\\n'\n' For example \"int(0|1)\" matches the value \"0\", but not the '\n'values\\n'\n' \"0.0\" or \"False\".\\n'\n'\\n'\n'In simple terms \"CLS(P1, attr=P2)\" matches only if the '\n'following\\n'\n'happens:\\n'\n'\\n'\n'* \"isinstance(, CLS)\"\\n'\n'\\n'\n'* convert \"P1\" to a keyword pattern using \"CLS.__match_args__\"\\n'\n'\\n'\n'* For each keyword argument \"attr=P2\":\\n'\n' * \"hasattr(, \"attr\")\"\\n'\n'\\n'\n' * \"P2\" matches \".attr\"\\n'\n'\\n'\n'* \u2026 and so on for the corresponding keyword argument/pattern '\n'pair.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' * **PEP 634** \u2013 Structural Pattern Matching: Specification\\n'\n'\\n'\n' * **PEP 636** \u2013 Structural Pattern Matching: Tutorial\\n'\n'\\n'\n'\\n'\n'Function definitions\\n'\n'====================\\n'\n'\\n'\n'A function definition defines a user-defined function object '\n'(see\\n'\n'section The standard type hierarchy):\\n'\n'\\n'\n' funcdef ::= [decorators] \"def\" funcname \"(\" '\n'[parameter_list] \")\"\\n'\n' [\"->\" expression] \":\" suite\\n'\n' decorators ::= decorator+\\n'\n' decorator ::= \"@\" assignment_expression '\n'NEWLINE\\n'\n' parameter_list ::= defparameter (\",\" '\n'defparameter)* \",\" \"/\" [\",\" [parameter_list_no_posonly]]\\n'\n' | parameter_list_no_posonly\\n'\n' parameter_list_no_posonly ::= defparameter (\",\" '\n'defparameter)* [\",\" [parameter_list_starargs]]\\n'\n' | parameter_list_starargs\\n'\n' parameter_list_starargs ::= \"*\" [parameter] (\",\" '\n'defparameter)* [\",\" [\"**\" parameter [\",\"]]]\\n'\n' | \"**\" parameter [\",\"]\\n'\n' parameter ::= identifier [\":\" expression]\\n'\n' defparameter ::= parameter [\"=\" expression]\\n'\n' funcname ::= identifier\\n'\n'\\n'\n'A function definition is an executable statement. Its execution '\n'binds\\n'\n'the function name in the current local namespace to a function '\n'object\\n'\n'(a wrapper around the executable code for the function). This\\n'\n'function object contains a reference to the current global '\n'namespace\\n'\n'as the global namespace to be used when the function is called.\\n'\n'\\n'\n'The function definition does not execute the function body; this '\n'gets\\n'\n'executed only when the function is called. [4]\\n'\n'\\n'\n'A function definition may be wrapped by one or more *decorator*\\n'\n'expressions. Decorator expressions are evaluated when the '\n'function is\\n'\n'defined, in the scope that contains the function definition. '\n'The\\n'\n'result must be a callable, which is invoked with the function '\n'object\\n'\n'as the only argument. The returned value is bound to the '\n'function name\\n'\n'instead of the function object. Multiple decorators are applied '\n'in\\n'\n'nested fashion. For example, the following code\\n'\n'\\n'\n' @f1(arg)\\n'\n' @f2\\n'\n' def func(): pass\\n'\n'\\n'\n'is roughly equivalent to\\n'\n'\\n'\n' def func(): pass\\n'\n' func = f1(arg)(f2(func))\\n'\n'\\n'\n'except that the original function is not temporarily bound to '\n'the name\\n'\n'\"func\".\\n'\n'\\n'\n'Changed in version 3.9: Functions may be decorated with any '\n'valid\\n'\n'\"assignment_expression\". Previously, the grammar was much more\\n'\n'restrictive; see **PEP 614** for details.\\n'\n'\\n'\n'When one or more *parameters* have the form *parameter* \"=\"\\n'\n'*expression*, the function is said to have \u201cdefault parameter '\n'values.\u201d\\n'\n'For a parameter with a default value, the corresponding '\n'*argument* may\\n'\n'be omitted from a call, in which case the parameter\u2019s default '\n'value is\\n'\n'substituted. If a parameter has a default value, all following\\n'\n'parameters up until the \u201c\"*\"\u201d must also have a default value \u2014 '\n'this is\\n'\n'a syntactic restriction that is not expressed by the grammar.\\n'\n'\\n'\n'**Default parameter values are evaluated from left to right when '\n'the\\n'\n'function definition is executed.** This means that the '\n'expression is\\n'\n'evaluated once, when the function is defined, and that the same '\n'\u201cpre-\\n'\n'computed\u201d value is used for each call. This is especially '\n'important\\n'\n'to understand when a default parameter value is a mutable '\n'object, such\\n'\n'as a list or a dictionary: if the function modifies the object '\n'(e.g.\\n'\n'by appending an item to a list), the default parameter value is '\n'in\\n'\n'effect modified. This is generally not what was intended. A '\n'way\\n'\n'around this is to use \"None\" as the default, and explicitly test '\n'for\\n'\n'it in the body of the function, e.g.:\\n'\n'\\n'\n' def whats_on_the_telly(penguin=None):\\n'\n' if penguin is None:\\n'\n' penguin = []\\n'\n' penguin.append(\"property of the zoo\")\\n'\n' return penguin\\n'\n'\\n'\n'Function call semantics are described in more detail in section '\n'Calls.\\n'\n'A function call always assigns values to all parameters '\n'mentioned in\\n'\n'the parameter list, either from positional arguments, from '\n'keyword\\n'\n'arguments, or from default values. If the form \u201c\"*identifier\"\u201d '\n'is\\n'\n'present, it is initialized to a tuple receiving any excess '\n'positional\\n'\n'parameters, defaulting to the empty tuple. If the form\\n'\n'\u201c\"**identifier\"\u201d is present, it is initialized to a new ordered\\n'\n'mapping receiving any excess keyword arguments, defaulting to a '\n'new\\n'\n'empty mapping of the same type. Parameters after \u201c\"*\"\u201d or\\n'\n'\u201c\"*identifier\"\u201d are keyword-only parameters and may only be '\n'passed by\\n'\n'keyword arguments. Parameters before \u201c\"/\"\u201d are positional-only\\n'\n'parameters and may only be passed by positional arguments.\\n'\n'\\n'\n'Changed in version 3.8: The \"/\" function parameter syntax may be '\n'used\\n'\n'to indicate positional-only parameters. See **PEP 570** for '\n'details.\\n'\n'\\n'\n'Parameters may have an *annotation* of the form \u201c\": '\n'expression\"\u201d\\n'\n'following the parameter name. Any parameter may have an '\n'annotation,\\n'\n'even those of the form \"*identifier\" or \"**identifier\". '\n'Functions may\\n'\n'have \u201creturn\u201d annotation of the form \u201c\"-> expression\"\u201d after '\n'the\\n'\n'parameter list. These annotations can be any valid Python '\n'expression.\\n'\n'The presence of annotations does not change the semantics of a\\n'\n'function. The annotation values are available as values of a\\n'\n'dictionary keyed by the parameters\u2019 names in the '\n'\"__annotations__\"\\n'\n'attribute of the function object. If the \"annotations\" import '\n'from\\n'\n'\"__future__\" is used, annotations are preserved as strings at '\n'runtime\\n'\n'which enables postponed evaluation. Otherwise, they are '\n'evaluated\\n'\n'when the function definition is executed. In this case '\n'annotations\\n'\n'may be evaluated in a different order than they appear in the '\n'source\\n'\n'code.\\n'\n'\\n'\n'It is also possible to create anonymous functions (functions not '\n'bound\\n'\n'to a name), for immediate use in expressions. This uses lambda\\n'\n'expressions, described in section Lambdas. Note that the '\n'lambda\\n'\n'expression is merely a shorthand for a simplified function '\n'definition;\\n'\n'a function defined in a \u201c\"def\"\u201d statement can be passed around '\n'or\\n'\n'assigned to another name just like a function defined by a '\n'lambda\\n'\n'expression. The \u201c\"def\"\u201d form is actually more powerful since '\n'it\\n'\n'allows the execution of multiple statements and annotations.\\n'\n'\\n'\n'**Programmer\u2019s note:** Functions are first-class objects. A '\n'\u201c\"def\"\u201d\\n'\n'statement executed inside a function definition defines a local\\n'\n'function that can be returned or passed around. Free variables '\n'used\\n'\n'in the nested function can access the local variables of the '\n'function\\n'\n'containing the def. See section Naming and binding for '\n'details.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3107** - Function Annotations\\n'\n' The original specification for function annotations.\\n'\n'\\n'\n' **PEP 484** - Type Hints\\n'\n' Definition of a standard meaning for annotations: type '\n'hints.\\n'\n'\\n'\n' **PEP 526** - Syntax for Variable Annotations\\n'\n' Ability to type hint variable declarations, including '\n'class\\n'\n' variables and instance variables\\n'\n'\\n'\n' **PEP 563** - Postponed Evaluation of Annotations\\n'\n' Support for forward references within annotations by '\n'preserving\\n'\n' annotations in a string form at runtime instead of eager\\n'\n' evaluation.\\n'\n'\\n'\n'\\n'\n'Class definitions\\n'\n'=================\\n'\n'\\n'\n'A class definition defines a class object (see section The '\n'standard\\n'\n'type hierarchy):\\n'\n'\\n'\n' classdef ::= [decorators] \"class\" classname [inheritance] '\n'\":\" suite\\n'\n' inheritance ::= \"(\" [argument_list] \")\"\\n'\n' classname ::= identifier\\n'\n'\\n'\n'A class definition is an executable statement. The inheritance '\n'list\\n'\n'usually gives a list of base classes (see Metaclasses for more\\n'\n'advanced uses), so each item in the list should evaluate to a '\n'class\\n'\n'object which allows subclassing. Classes without an inheritance '\n'list\\n'\n'inherit, by default, from the base class \"object\"; hence,\\n'\n'\\n'\n' class Foo:\\n'\n' pass\\n'\n'\\n'\n'is equivalent to\\n'\n'\\n'\n' class Foo(object):\\n'\n' pass\\n'\n'\\n'\n'The class\u2019s suite is then executed in a new execution frame '\n'(see\\n'\n'Naming and binding), using a newly created local namespace and '\n'the\\n'\n'original global namespace. (Usually, the suite contains mostly\\n'\n'function definitions.) When the class\u2019s suite finishes '\n'execution, its\\n'\n'execution frame is discarded but its local namespace is saved. '\n'[5] A\\n'\n'class object is then created using the inheritance list for the '\n'base\\n'\n'classes and the saved local namespace for the attribute '\n'dictionary.\\n'\n'The class name is bound to this class object in the original '\n'local\\n'\n'namespace.\\n'\n'\\n'\n'The order in which attributes are defined in the class body is\\n'\n'preserved in the new class\u2019s \"__dict__\". Note that this is '\n'reliable\\n'\n'only right after the class is created and only for classes that '\n'were\\n'\n'defined using the definition syntax.\\n'\n'\\n'\n'Class creation can be customized heavily using metaclasses.\\n'\n'\\n'\n'Classes can also be decorated: just like when decorating '\n'functions,\\n'\n'\\n'\n' @f1(arg)\\n'\n' @f2\\n'\n' class Foo: pass\\n'\n'\\n'\n'is roughly equivalent to\\n'\n'\\n'\n' class Foo: pass\\n'\n' Foo = f1(arg)(f2(Foo))\\n'\n'\\n'\n'The evaluation rules for the decorator expressions are the same '\n'as for\\n'\n'function decorators. The result is then bound to the class '\n'name.\\n'\n'\\n'\n'Changed in version 3.9: Classes may be decorated with any valid\\n'\n'\"assignment_expression\". Previously, the grammar was much more\\n'\n'restrictive; see **PEP 614** for details.\\n'\n'\\n'\n'**Programmer\u2019s note:** Variables defined in the class definition '\n'are\\n'\n'class attributes; they are shared by instances. Instance '\n'attributes\\n'\n'can be set in a method with \"self.name = value\". Both class '\n'and\\n'\n'instance attributes are accessible through the notation '\n'\u201c\"self.name\"\u201d,\\n'\n'and an instance attribute hides a class attribute with the same '\n'name\\n'\n'when accessed in this way. Class attributes can be used as '\n'defaults\\n'\n'for instance attributes, but using mutable values there can lead '\n'to\\n'\n'unexpected results. Descriptors can be used to create instance\\n'\n'variables with different implementation details.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3115** - Metaclasses in Python 3000\\n'\n' The proposal that changed the declaration of metaclasses to '\n'the\\n'\n' current syntax, and the semantics for how classes with\\n'\n' metaclasses are constructed.\\n'\n'\\n'\n' **PEP 3129** - Class Decorators\\n'\n' The proposal that added class decorators. Function and '\n'method\\n'\n' decorators were introduced in **PEP 318**.\\n'\n'\\n'\n'\\n'\n'Coroutines\\n'\n'==========\\n'\n'\\n'\n'New in version 3.5.\\n'\n'\\n'\n'\\n'\n'Coroutine function definition\\n'\n'-----------------------------\\n'\n'\\n'\n' async_funcdef ::= [decorators] \"async\" \"def\" funcname \"(\" '\n'[parameter_list] \")\"\\n'\n' [\"->\" expression] \":\" suite\\n'\n'\\n'\n'Execution of Python coroutines can be suspended and resumed at '\n'many\\n'\n'points (see *coroutine*). \"await\" expressions, \"async for\" and '\n'\"async\\n'\n'with\" can only be used in the body of a coroutine function.\\n'\n'\\n'\n'Functions defined with \"async def\" syntax are always coroutine\\n'\n'functions, even if they do not contain \"await\" or \"async\" '\n'keywords.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use a \"yield from\" expression inside '\n'the body\\n'\n'of a coroutine function.\\n'\n'\\n'\n'An example of a coroutine function:\\n'\n'\\n'\n' async def func(param1, param2):\\n'\n' do_stuff()\\n'\n' await some_coroutine()\\n'\n'\\n'\n'Changed in version 3.7: \"await\" and \"async\" are now keywords;\\n'\n'previously they were only treated as such inside the body of a\\n'\n'coroutine function.\\n'\n'\\n'\n'\\n'\n'The \"async for\" statement\\n'\n'-------------------------\\n'\n'\\n'\n' async_for_stmt ::= \"async\" for_stmt\\n'\n'\\n'\n'An *asynchronous iterable* provides an \"__aiter__\" method that\\n'\n'directly returns an *asynchronous iterator*, which can call\\n'\n'asynchronous code in its \"__anext__\" method.\\n'\n'\\n'\n'The \"async for\" statement allows convenient iteration over\\n'\n'asynchronous iterables.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' async for TARGET in ITER:\\n'\n' SUITE\\n'\n' else:\\n'\n' SUITE2\\n'\n'\\n'\n'Is semantically equivalent to:\\n'\n'\\n'\n' iter = (ITER)\\n'\n' iter = type(iter).__aiter__(iter)\\n'\n' running = True\\n'\n'\\n'\n' while running:\\n'\n' try:\\n'\n' TARGET = await type(iter).__anext__(iter)\\n'\n' except StopAsyncIteration:\\n'\n' running = False\\n'\n' else:\\n'\n' SUITE\\n'\n' else:\\n'\n' SUITE2\\n'\n'\\n'\n'See also \"__aiter__()\" and \"__anext__()\" for details.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use an \"async for\" statement outside '\n'the body\\n'\n'of a coroutine function.\\n'\n'\\n'\n'\\n'\n'The \"async with\" statement\\n'\n'--------------------------\\n'\n'\\n'\n' async_with_stmt ::= \"async\" with_stmt\\n'\n'\\n'\n'An *asynchronous context manager* is a *context manager* that is '\n'able\\n'\n'to suspend execution in its *enter* and *exit* methods.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' async with EXPRESSION as TARGET:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' manager = (EXPRESSION)\\n'\n' aenter = type(manager).__aenter__\\n'\n' aexit = type(manager).__aexit__\\n'\n' value = await aenter(manager)\\n'\n' hit_except = False\\n'\n'\\n'\n' try:\\n'\n' TARGET = value\\n'\n' SUITE\\n'\n' except:\\n'\n' hit_except = True\\n'\n' if not await aexit(manager, *sys.exc_info()):\\n'\n' raise\\n'\n' finally:\\n'\n' if not hit_except:\\n'\n' await aexit(manager, None, None, None)\\n'\n'\\n'\n'See also \"__aenter__()\" and \"__aexit__()\" for details.\\n'\n'\\n'\n'It is a \"SyntaxError\" to use an \"async with\" statement outside '\n'the\\n'\n'body of a coroutine function.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 492** - Coroutines with async and await syntax\\n'\n' The proposal that made coroutines a proper standalone '\n'concept in\\n'\n' Python, and added supporting syntax.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] The exception is propagated to the invocation stack unless '\n'there\\n'\n' is a \"finally\" clause which happens to raise another '\n'exception.\\n'\n' That new exception causes the old one to be lost.\\n'\n'\\n'\n'[2] In pattern matching, a sequence is defined as one of the\\n'\n' following:\\n'\n'\\n'\n' * a class that inherits from \"collections.abc.Sequence\"\\n'\n'\\n'\n' * a Python class that has been registered as\\n'\n' \"collections.abc.Sequence\"\\n'\n'\\n'\n' * a builtin class that has its (CPython) '\n'\"Py_TPFLAGS_SEQUENCE\"\\n'\n' bit set\\n'\n'\\n'\n' * a class that inherits from any of the above\\n'\n'\\n'\n' The following standard library classes are sequences:\\n'\n'\\n'\n' * \"array.array\"\\n'\n'\\n'\n' * \"collections.deque\"\\n'\n'\\n'\n' * \"list\"\\n'\n'\\n'\n' * \"memoryview\"\\n'\n'\\n'\n' * \"range\"\\n'\n'\\n'\n' * \"tuple\"\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' Subject values of type \"str\", \"bytes\", and \"bytearray\" do '\n'not\\n'\n' match sequence patterns.\\n'\n'\\n'\n'[3] In pattern matching, a mapping is defined as one of the '\n'following:\\n'\n'\\n'\n' * a class that inherits from \"collections.abc.Mapping\"\\n'\n'\\n'\n' * a Python class that has been registered as\\n'\n' \"collections.abc.Mapping\"\\n'\n'\\n'\n' * a builtin class that has its (CPython) '\n'\"Py_TPFLAGS_MAPPING\"\\n'\n' bit set\\n'\n'\\n'\n' * a class that inherits from any of the above\\n'\n'\\n'\n' The standard library classes \"dict\" and '\n'\"types.MappingProxyType\"\\n'\n' are mappings.\\n'\n'\\n'\n'[4] A string literal appearing as the first statement in the '\n'function\\n'\n' body is transformed into the function\u2019s \"__doc__\" attribute '\n'and\\n'\n' therefore the function\u2019s *docstring*.\\n'\n'\\n'\n'[5] A string literal appearing as the first statement in the '\n'class\\n'\n' body is transformed into the namespace\u2019s \"__doc__\" item and\\n'\n' therefore the class\u2019s *docstring*.\\n',\n'context-managers':'With Statement Context Managers\\n'\n'*******************************\\n'\n'\\n'\n'A *context manager* is an object that defines the '\n'runtime context to\\n'\n'be established when executing a \"with\" statement. The '\n'context manager\\n'\n'handles the entry into, and the exit from, the desired '\n'runtime context\\n'\n'for the execution of the block of code. Context '\n'managers are normally\\n'\n'invoked using the \"with\" statement (described in section '\n'The with\\n'\n'statement), but can also be used by directly invoking '\n'their methods.\\n'\n'\\n'\n'Typical uses of context managers include saving and '\n'restoring various\\n'\n'kinds of global state, locking and unlocking resources, '\n'closing opened\\n'\n'files, etc.\\n'\n'\\n'\n'For more information on context managers, see Context '\n'Manager Types.\\n'\n'\\n'\n'object.__enter__(self)\\n'\n'\\n'\n' Enter the runtime context related to this object. The '\n'\"with\"\\n'\n' statement will bind this method\u2019s return value to the '\n'target(s)\\n'\n' specified in the \"as\" clause of the statement, if '\n'any.\\n'\n'\\n'\n'object.__exit__(self, exc_type, exc_value, traceback)\\n'\n'\\n'\n' Exit the runtime context related to this object. The '\n'parameters\\n'\n' describe the exception that caused the context to be '\n'exited. If the\\n'\n' context was exited without an exception, all three '\n'arguments will\\n'\n' be \"None\".\\n'\n'\\n'\n' If an exception is supplied, and the method wishes to '\n'suppress the\\n'\n' exception (i.e., prevent it from being propagated), '\n'it should\\n'\n' return a true value. Otherwise, the exception will be '\n'processed\\n'\n' normally upon exit from this method.\\n'\n'\\n'\n' Note that \"__exit__()\" methods should not reraise the '\n'passed-in\\n'\n' exception; this is the caller\u2019s responsibility.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 343** - The \u201cwith\u201d statement\\n'\n' The specification, background, and examples for the '\n'Python \"with\"\\n'\n' statement.\\n',\n'continue':'The \"continue\" statement\\n'\n'************************\\n'\n'\\n'\n' continue_stmt ::= \"continue\"\\n'\n'\\n'\n'\"continue\" may only occur syntactically nested in a \"for\" or '\n'\"while\"\\n'\n'loop, but not nested in a function or class definition within '\n'that\\n'\n'loop. It continues with the next cycle of the nearest enclosing '\n'loop.\\n'\n'\\n'\n'When \"continue\" passes control out of a \"try\" statement with a\\n'\n'\"finally\" clause, that \"finally\" clause is executed before '\n'really\\n'\n'starting the next loop cycle.\\n',\n'conversions':'Arithmetic conversions\\n'\n'**********************\\n'\n'\\n'\n'When a description of an arithmetic operator below uses the '\n'phrase\\n'\n'\u201cthe numeric arguments are converted to a common type\u201d, this '\n'means\\n'\n'that the operator implementation for built-in types works as '\n'follows:\\n'\n'\\n'\n'* If either argument is a complex number, the other is '\n'converted to\\n'\n' complex;\\n'\n'\\n'\n'* otherwise, if either argument is a floating point number, '\n'the other\\n'\n' is converted to floating point;\\n'\n'\\n'\n'* otherwise, both must be integers and no conversion is '\n'necessary.\\n'\n'\\n'\n'Some additional rules apply for certain operators (e.g., a '\n'string as a\\n'\n'left argument to the \u2018%\u2019 operator). Extensions must define '\n'their own\\n'\n'conversion behavior.\\n',\n'customization':'Basic customization\\n'\n'*******************\\n'\n'\\n'\n'object.__new__(cls[, ...])\\n'\n'\\n'\n' Called to create a new instance of class *cls*. '\n'\"__new__()\" is a\\n'\n' static method (special-cased so you need not declare it '\n'as such)\\n'\n' that takes the class of which an instance was requested '\n'as its\\n'\n' first argument. The remaining arguments are those '\n'passed to the\\n'\n' object constructor expression (the call to the class). '\n'The return\\n'\n' value of \"__new__()\" should be the new object instance '\n'(usually an\\n'\n' instance of *cls*).\\n'\n'\\n'\n' Typical implementations create a new instance of the '\n'class by\\n'\n' invoking the superclass\u2019s \"__new__()\" method using\\n'\n' \"super().__new__(cls[, ...])\" with appropriate arguments '\n'and then\\n'\n' modifying the newly-created instance as necessary before '\n'returning\\n'\n' it.\\n'\n'\\n'\n' If \"__new__()\" is invoked during object construction and '\n'it returns\\n'\n' an instance or subclass of *cls*, then the new '\n'instance\u2019s\\n'\n' \"__init__()\" method will be invoked like '\n'\"__init__(self[, ...])\",\\n'\n' where *self* is the new instance and the remaining '\n'arguments are\\n'\n' the same as were passed to the object constructor.\\n'\n'\\n'\n' If \"__new__()\" does not return an instance of *cls*, '\n'then the new\\n'\n' instance\u2019s \"__init__()\" method will not be invoked.\\n'\n'\\n'\n' \"__new__()\" is intended mainly to allow subclasses of '\n'immutable\\n'\n' types (like int, str, or tuple) to customize instance '\n'creation. It\\n'\n' is also commonly overridden in custom metaclasses in '\n'order to\\n'\n' customize class creation.\\n'\n'\\n'\n'object.__init__(self[, ...])\\n'\n'\\n'\n' Called after the instance has been created (by '\n'\"__new__()\"), but\\n'\n' before it is returned to the caller. The arguments are '\n'those\\n'\n' passed to the class constructor expression. If a base '\n'class has an\\n'\n' \"__init__()\" method, the derived class\u2019s \"__init__()\" '\n'method, if\\n'\n' any, must explicitly call it to ensure proper '\n'initialization of the\\n'\n' base class part of the instance; for example:\\n'\n' \"super().__init__([args...])\".\\n'\n'\\n'\n' Because \"__new__()\" and \"__init__()\" work together in '\n'constructing\\n'\n' objects (\"__new__()\" to create it, and \"__init__()\" to '\n'customize\\n'\n' it), no non-\"None\" value may be returned by '\n'\"__init__()\"; doing so\\n'\n' will cause a \"TypeError\" to be raised at runtime.\\n'\n'\\n'\n'object.__del__(self)\\n'\n'\\n'\n' Called when the instance is about to be destroyed. This '\n'is also\\n'\n' called a finalizer or (improperly) a destructor. If a '\n'base class\\n'\n' has a \"__del__()\" method, the derived class\u2019s '\n'\"__del__()\" method,\\n'\n' if any, must explicitly call it to ensure proper '\n'deletion of the\\n'\n' base class part of the instance.\\n'\n'\\n'\n' It is possible (though not recommended!) for the '\n'\"__del__()\" method\\n'\n' to postpone destruction of the instance by creating a '\n'new reference\\n'\n' to it. This is called object *resurrection*. It is\\n'\n' implementation-dependent whether \"__del__()\" is called a '\n'second\\n'\n' time when a resurrected object is about to be destroyed; '\n'the\\n'\n' current *CPython* implementation only calls it once.\\n'\n'\\n'\n' It is not guaranteed that \"__del__()\" methods are called '\n'for\\n'\n' objects that still exist when the interpreter exits.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"del x\" doesn\u2019t directly call \"x.__del__()\" \u2014 the '\n'former\\n'\n' decrements the reference count for \"x\" by one, and the '\n'latter is\\n'\n' only called when \"x\"\u2019s reference count reaches zero.\\n'\n'\\n'\n' **CPython implementation detail:** It is possible for a '\n'reference\\n'\n' cycle to prevent the reference count of an object from '\n'going to\\n'\n' zero. In this case, the cycle will be later detected '\n'and deleted\\n'\n' by the *cyclic garbage collector*. A common cause of '\n'reference\\n'\n' cycles is when an exception has been caught in a local '\n'variable.\\n'\n' The frame\u2019s locals then reference the exception, which '\n'references\\n'\n' its own traceback, which references the locals of all '\n'frames caught\\n'\n' in the traceback.\\n'\n'\\n'\n' See also: Documentation for the \"gc\" module.\\n'\n'\\n'\n' Warning:\\n'\n'\\n'\n' Due to the precarious circumstances under which '\n'\"__del__()\"\\n'\n' methods are invoked, exceptions that occur during '\n'their execution\\n'\n' are ignored, and a warning is printed to \"sys.stderr\" '\n'instead.\\n'\n' In particular:\\n'\n'\\n'\n' * \"__del__()\" can be invoked when arbitrary code is '\n'being\\n'\n' executed, including from any arbitrary thread. If '\n'\"__del__()\"\\n'\n' needs to take a lock or invoke any other blocking '\n'resource, it\\n'\n' may deadlock as the resource may already be taken by '\n'the code\\n'\n' that gets interrupted to execute \"__del__()\".\\n'\n'\\n'\n' * \"__del__()\" can be executed during interpreter '\n'shutdown. As a\\n'\n' consequence, the global variables it needs to access '\n'(including\\n'\n' other modules) may already have been deleted or set '\n'to \"None\".\\n'\n' Python guarantees that globals whose name begins '\n'with a single\\n'\n' underscore are deleted from their module before '\n'other globals\\n'\n' are deleted; if no other references to such globals '\n'exist, this\\n'\n' may help in assuring that imported modules are still '\n'available\\n'\n' at the time when the \"__del__()\" method is called.\\n'\n'\\n'\n'object.__repr__(self)\\n'\n'\\n'\n' Called by the \"repr()\" built-in function to compute the '\n'\u201cofficial\u201d\\n'\n' string representation of an object. If at all possible, '\n'this\\n'\n' should look like a valid Python expression that could be '\n'used to\\n'\n' recreate an object with the same value (given an '\n'appropriate\\n'\n' environment). If this is not possible, a string of the '\n'form\\n'\n' \"<...some useful description...>\" should be returned. '\n'The return\\n'\n' value must be a string object. If a class defines '\n'\"__repr__()\" but\\n'\n' not \"__str__()\", then \"__repr__()\" is also used when an '\n'\u201cinformal\u201d\\n'\n' string representation of instances of that class is '\n'required.\\n'\n'\\n'\n' This is typically used for debugging, so it is important '\n'that the\\n'\n' representation is information-rich and unambiguous.\\n'\n'\\n'\n'object.__str__(self)\\n'\n'\\n'\n' Called by \"str(object)\" and the built-in functions '\n'\"format()\" and\\n'\n' \"print()\" to compute the \u201cinformal\u201d or nicely printable '\n'string\\n'\n' representation of an object. The return value must be a '\n'string\\n'\n' object.\\n'\n'\\n'\n' This method differs from \"object.__repr__()\" in that '\n'there is no\\n'\n' expectation that \"__str__()\" return a valid Python '\n'expression: a\\n'\n' more convenient or concise representation can be used.\\n'\n'\\n'\n' The default implementation defined by the built-in type '\n'\"object\"\\n'\n' calls \"object.__repr__()\".\\n'\n'\\n'\n'object.__bytes__(self)\\n'\n'\\n'\n' Called by bytes to compute a byte-string representation '\n'of an\\n'\n' object. This should return a \"bytes\" object.\\n'\n'\\n'\n'object.__format__(self, format_spec)\\n'\n'\\n'\n' Called by the \"format()\" built-in function, and by '\n'extension,\\n'\n' evaluation of formatted string literals and the '\n'\"str.format()\"\\n'\n' method, to produce a \u201cformatted\u201d string representation '\n'of an\\n'\n' object. The *format_spec* argument is a string that '\n'contains a\\n'\n' description of the formatting options desired. The '\n'interpretation\\n'\n' of the *format_spec* argument is up to the type '\n'implementing\\n'\n' \"__format__()\", however most classes will either '\n'delegate\\n'\n' formatting to one of the built-in types, or use a '\n'similar\\n'\n' formatting option syntax.\\n'\n'\\n'\n' See Format Specification Mini-Language for a description '\n'of the\\n'\n' standard formatting syntax.\\n'\n'\\n'\n' The return value must be a string object.\\n'\n'\\n'\n' Changed in version 3.4: The __format__ method of '\n'\"object\" itself\\n'\n' raises a \"TypeError\" if passed any non-empty string.\\n'\n'\\n'\n' Changed in version 3.7: \"object.__format__(x, \\'\\')\" is '\n'now\\n'\n' equivalent to \"str(x)\" rather than \"format(str(x), '\n'\\'\\')\".\\n'\n'\\n'\n'object.__lt__(self, other)\\n'\n'object.__le__(self, other)\\n'\n'object.__eq__(self, other)\\n'\n'object.__ne__(self, other)\\n'\n'object.__gt__(self, other)\\n'\n'object.__ge__(self, other)\\n'\n'\\n'\n' These are the so-called \u201crich comparison\u201d methods. The\\n'\n' correspondence between operator symbols and method names '\n'is as\\n'\n' follows: \"xy\" calls\\n'\n' \"x.__gt__(y)\", and \"x>=y\" calls \"x.__ge__(y)\".\\n'\n'\\n'\n' A rich comparison method may return the singleton '\n'\"NotImplemented\"\\n'\n' if it does not implement the operation for a given pair '\n'of\\n'\n' arguments. By convention, \"False\" and \"True\" are '\n'returned for a\\n'\n' successful comparison. However, these methods can return '\n'any value,\\n'\n' so if the comparison operator is used in a Boolean '\n'context (e.g.,\\n'\n' in the condition of an \"if\" statement), Python will call '\n'\"bool()\"\\n'\n' on the value to determine if the result is true or '\n'false.\\n'\n'\\n'\n' By default, \"object\" implements \"__eq__()\" by using '\n'\"is\", returning\\n'\n' \"NotImplemented\" in the case of a false comparison: '\n'\"True if x is y\\n'\n' else NotImplemented\". For \"__ne__()\", by default it '\n'delegates to\\n'\n' \"__eq__()\" and inverts the result unless it is '\n'\"NotImplemented\".\\n'\n' There are no other implied relationships among the '\n'comparison\\n'\n' operators or default implementations; for example, the '\n'truth of\\n'\n' \"(x.__hash__\".\\n'\n'\\n'\n' If a class that does not override \"__eq__()\" wishes to '\n'suppress\\n'\n' hash support, it should include \"__hash__ = None\" in the '\n'class\\n'\n' definition. A class which defines its own \"__hash__()\" '\n'that\\n'\n' explicitly raises a \"TypeError\" would be incorrectly '\n'identified as\\n'\n' hashable by an \"isinstance(obj, '\n'collections.abc.Hashable)\" call.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' By default, the \"__hash__()\" values of str and bytes '\n'objects are\\n'\n' \u201csalted\u201d with an unpredictable random value. Although '\n'they\\n'\n' remain constant within an individual Python process, '\n'they are not\\n'\n' predictable between repeated invocations of '\n'Python.This is\\n'\n' intended to provide protection against a '\n'denial-of-service caused\\n'\n' by carefully-chosen inputs that exploit the worst '\n'case\\n'\n' performance of a dict insertion, O(n^2) complexity. '\n'See\\n'\n' http://www.ocert.org/advisories/ocert-2011-003.html '\n'for\\n'\n' details.Changing hash values affects the iteration '\n'order of sets.\\n'\n' Python has never made guarantees about this ordering '\n'(and it\\n'\n' typically varies between 32-bit and 64-bit builds).See '\n'also\\n'\n' \"PYTHONHASHSEED\".\\n'\n'\\n'\n' Changed in version 3.3: Hash randomization is enabled by '\n'default.\\n'\n'\\n'\n'object.__bool__(self)\\n'\n'\\n'\n' Called to implement truth value testing and the built-in '\n'operation\\n'\n' \"bool()\"; should return \"False\" or \"True\". When this '\n'method is not\\n'\n' defined, \"__len__()\" is called, if it is defined, and '\n'the object is\\n'\n' considered true if its result is nonzero. If a class '\n'defines\\n'\n' neither \"__len__()\" nor \"__bool__()\", all its instances '\n'are\\n'\n' considered true.\\n',\n'debugger':'\"pdb\" \u2014 The Python Debugger\\n'\n'***************************\\n'\n'\\n'\n'**Source code:** Lib/pdb.py\\n'\n'\\n'\n'======================================================================\\n'\n'\\n'\n'The module \"pdb\" defines an interactive source code debugger '\n'for\\n'\n'Python programs. It supports setting (conditional) breakpoints '\n'and\\n'\n'single stepping at the source line level, inspection of stack '\n'frames,\\n'\n'source code listing, and evaluation of arbitrary Python code in '\n'the\\n'\n'context of any stack frame. It also supports post-mortem '\n'debugging\\n'\n'and can be called under program control.\\n'\n'\\n'\n'The debugger is extensible \u2013 it is actually defined as the '\n'class\\n'\n'\"Pdb\". This is currently undocumented but easily understood by '\n'reading\\n'\n'the source. The extension interface uses the modules \"bdb\" and '\n'\"cmd\".\\n'\n'\\n'\n'The debugger\u2019s prompt is \"(Pdb)\". Typical usage to run a program '\n'under\\n'\n'control of the debugger is:\\n'\n'\\n'\n' >>> import pdb\\n'\n' >>> import mymodule\\n'\n\" >>> pdb.run('mymodule.test()')\\n\"\n' > (0)?()\\n'\n' (Pdb) continue\\n'\n' > (1)?()\\n'\n' (Pdb) continue\\n'\n\" NameError: 'spam'\\n\"\n' > (1)?()\\n'\n' (Pdb)\\n'\n'\\n'\n'Changed in version 3.3: Tab-completion via the \"readline\" module '\n'is\\n'\n'available for commands and command arguments, e.g. the current '\n'global\\n'\n'and local names are offered as arguments of the \"p\" command.\\n'\n'\\n'\n'\"pdb.py\" can also be invoked as a script to debug other '\n'scripts. For\\n'\n'example:\\n'\n'\\n'\n' python3 -m pdb myscript.py\\n'\n'\\n'\n'When invoked as a script, pdb will automatically enter '\n'post-mortem\\n'\n'debugging if the program being debugged exits abnormally. After '\n'post-\\n'\n'mortem debugging (or after normal exit of the program), pdb '\n'will\\n'\n'restart the program. Automatic restarting preserves pdb\u2019s state '\n'(such\\n'\n'as breakpoints) and in most cases is more useful than quitting '\n'the\\n'\n'debugger upon program\u2019s exit.\\n'\n'\\n'\n'New in version 3.2: \"pdb.py\" now accepts a \"-c\" option that '\n'executes\\n'\n'commands as if given in a \".pdbrc\" file, see Debugger Commands.\\n'\n'\\n'\n'New in version 3.7: \"pdb.py\" now accepts a \"-m\" option that '\n'execute\\n'\n'modules similar to the way \"python3 -m\" does. As with a script, '\n'the\\n'\n'debugger will pause execution just before the first line of the\\n'\n'module.\\n'\n'\\n'\n'The typical usage to break into the debugger from a running '\n'program is\\n'\n'to insert\\n'\n'\\n'\n' import pdb; pdb.set_trace()\\n'\n'\\n'\n'at the location you want to break into the debugger. You can '\n'then\\n'\n'step through the code following this statement, and continue '\n'running\\n'\n'without the debugger using the \"continue\" command.\\n'\n'\\n'\n'New in version 3.7: The built-in \"breakpoint()\", when called '\n'with\\n'\n'defaults, can be used instead of \"import pdb; pdb.set_trace()\".\\n'\n'\\n'\n'The typical usage to inspect a crashed program is:\\n'\n'\\n'\n' >>> import pdb\\n'\n' >>> import mymodule\\n'\n' >>> mymodule.test()\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n' File \"./mymodule.py\", line 4, in test\\n'\n' test2()\\n'\n' File \"./mymodule.py\", line 3, in test2\\n'\n' print(spam)\\n'\n' NameError: spam\\n'\n' >>> pdb.pm()\\n'\n' > ./mymodule.py(3)test2()\\n'\n' -> print(spam)\\n'\n' (Pdb)\\n'\n'\\n'\n'The module defines the following functions; each enters the '\n'debugger\\n'\n'in a slightly different way:\\n'\n'\\n'\n'pdb.run(statement, globals=None, locals=None)\\n'\n'\\n'\n' Execute the *statement* (given as a string or a code object) '\n'under\\n'\n' debugger control. The debugger prompt appears before any '\n'code is\\n'\n' executed; you can set breakpoints and type \"continue\", or you '\n'can\\n'\n' step through the statement using \"step\" or \"next\" (all these\\n'\n' commands are explained below). The optional *globals* and '\n'*locals*\\n'\n' arguments specify the environment in which the code is '\n'executed; by\\n'\n' default the dictionary of the module \"__main__\" is used. '\n'(See the\\n'\n' explanation of the built-in \"exec()\" or \"eval()\" functions.)\\n'\n'\\n'\n'pdb.runeval(expression, globals=None, locals=None)\\n'\n'\\n'\n' Evaluate the *expression* (given as a string or a code '\n'object)\\n'\n' under debugger control. When \"runeval()\" returns, it returns '\n'the\\n'\n' value of the expression. Otherwise this function is similar '\n'to\\n'\n' \"run()\".\\n'\n'\\n'\n'pdb.runcall(function, *args, **kwds)\\n'\n'\\n'\n' Call the *function* (a function or method object, not a '\n'string)\\n'\n' with the given arguments. When \"runcall()\" returns, it '\n'returns\\n'\n' whatever the function call returned. The debugger prompt '\n'appears\\n'\n' as soon as the function is entered.\\n'\n'\\n'\n'pdb.set_trace(*, header=None)\\n'\n'\\n'\n' Enter the debugger at the calling stack frame. This is '\n'useful to\\n'\n' hard-code a breakpoint at a given point in a program, even if '\n'the\\n'\n' code is not otherwise being debugged (e.g. when an assertion\\n'\n' fails). If given, *header* is printed to the console just '\n'before\\n'\n' debugging begins.\\n'\n'\\n'\n' Changed in version 3.7: The keyword-only argument *header*.\\n'\n'\\n'\n'pdb.post_mortem(traceback=None)\\n'\n'\\n'\n' Enter post-mortem debugging of the given *traceback* object. '\n'If no\\n'\n' *traceback* is given, it uses the one of the exception that '\n'is\\n'\n' currently being handled (an exception must be being handled '\n'if the\\n'\n' default is to be used).\\n'\n'\\n'\n'pdb.pm()\\n'\n'\\n'\n' Enter post-mortem debugging of the traceback found in\\n'\n' \"sys.last_traceback\".\\n'\n'\\n'\n'The \"run*\" functions and \"set_trace()\" are aliases for '\n'instantiating\\n'\n'the \"Pdb\" class and calling the method of the same name. If you '\n'want\\n'\n'to access further features, you have to do this yourself:\\n'\n'\\n'\n\"class pdb.Pdb(completekey='tab', stdin=None, stdout=None, \"\n'skip=None, nosigint=False, readrc=True)\\n'\n'\\n'\n' \"Pdb\" is the debugger class.\\n'\n'\\n'\n' The *completekey*, *stdin* and *stdout* arguments are passed '\n'to the\\n'\n' underlying \"cmd.Cmd\" class; see the description there.\\n'\n'\\n'\n' The *skip* argument, if given, must be an iterable of '\n'glob-style\\n'\n' module name patterns. The debugger will not step into frames '\n'that\\n'\n' originate in a module that matches one of these patterns. '\n'[1]\\n'\n'\\n'\n' By default, Pdb sets a handler for the SIGINT signal (which '\n'is sent\\n'\n' when the user presses \"Ctrl-C\" on the console) when you give '\n'a\\n'\n' \"continue\" command. This allows you to break into the '\n'debugger\\n'\n' again by pressing \"Ctrl-C\". If you want Pdb not to touch '\n'the\\n'\n' SIGINT handler, set *nosigint* to true.\\n'\n'\\n'\n' The *readrc* argument defaults to true and controls whether '\n'Pdb\\n'\n' will load .pdbrc files from the filesystem.\\n'\n'\\n'\n' Example call to enable tracing with *skip*:\\n'\n'\\n'\n\" import pdb; pdb.Pdb(skip=['django.*']).set_trace()\\n\"\n'\\n'\n' Raises an auditing event \"pdb.Pdb\" with no arguments.\\n'\n'\\n'\n' New in version 3.1: The *skip* argument.\\n'\n'\\n'\n' New in version 3.2: The *nosigint* argument. Previously, a '\n'SIGINT\\n'\n' handler was never set by Pdb.\\n'\n'\\n'\n' Changed in version 3.6: The *readrc* argument.\\n'\n'\\n'\n' run(statement, globals=None, locals=None)\\n'\n' runeval(expression, globals=None, locals=None)\\n'\n' runcall(function, *args, **kwds)\\n'\n' set_trace()\\n'\n'\\n'\n' See the documentation for the functions explained above.\\n'\n'\\n'\n'\\n'\n'Debugger Commands\\n'\n'=================\\n'\n'\\n'\n'The commands recognized by the debugger are listed below. Most\\n'\n'commands can be abbreviated to one or two letters as indicated; '\n'e.g.\\n'\n'\"h(elp)\" means that either \"h\" or \"help\" can be used to enter '\n'the help\\n'\n'command (but not \"he\" or \"hel\", nor \"H\" or \"Help\" or \"HELP\").\\n'\n'Arguments to commands must be separated by whitespace (spaces '\n'or\\n'\n'tabs). Optional arguments are enclosed in square brackets '\n'(\"[]\") in\\n'\n'the command syntax; the square brackets must not be typed.\\n'\n'Alternatives in the command syntax are separated by a vertical '\n'bar\\n'\n'(\"|\").\\n'\n'\\n'\n'Entering a blank line repeats the last command entered. '\n'Exception: if\\n'\n'the last command was a \"list\" command, the next 11 lines are '\n'listed.\\n'\n'\\n'\n'Commands that the debugger doesn\u2019t recognize are assumed to be '\n'Python\\n'\n'statements and are executed in the context of the program being\\n'\n'debugged. Python statements can also be prefixed with an '\n'exclamation\\n'\n'point (\"!\"). This is a powerful way to inspect the program '\n'being\\n'\n'debugged; it is even possible to change a variable or call a '\n'function.\\n'\n'When an exception occurs in such a statement, the exception name '\n'is\\n'\n'printed but the debugger\u2019s state is not changed.\\n'\n'\\n'\n'The debugger supports aliases. Aliases can have parameters '\n'which\\n'\n'allows one a certain level of adaptability to the context under\\n'\n'examination.\\n'\n'\\n'\n'Multiple commands may be entered on a single line, separated by '\n'\";;\".\\n'\n'(A single \";\" is not used as it is the separator for multiple '\n'commands\\n'\n'in a line that is passed to the Python parser.) No intelligence '\n'is\\n'\n'applied to separating the commands; the input is split at the '\n'first\\n'\n'\";;\" pair, even if it is in the middle of a quoted string.\\n'\n'\\n'\n'If a file \".pdbrc\" exists in the user\u2019s home directory or in '\n'the\\n'\n'current directory, it is read in and executed as if it had been '\n'typed\\n'\n'at the debugger prompt. This is particularly useful for '\n'aliases. If\\n'\n'both files exist, the one in the home directory is read first '\n'and\\n'\n'aliases defined there can be overridden by the local file.\\n'\n'\\n'\n'Changed in version 3.2: \".pdbrc\" can now contain commands that\\n'\n'continue debugging, such as \"continue\" or \"next\". Previously, '\n'these\\n'\n'commands had no effect.\\n'\n'\\n'\n'h(elp) [command]\\n'\n'\\n'\n' Without argument, print the list of available commands. With '\n'a\\n'\n' *command* as argument, print help about that command. \"help '\n'pdb\"\\n'\n' displays the full documentation (the docstring of the \"pdb\"\\n'\n' module). Since the *command* argument must be an identifier, '\n'\"help\\n'\n' exec\" must be entered to get help on the \"!\" command.\\n'\n'\\n'\n'w(here)\\n'\n'\\n'\n' Print a stack trace, with the most recent frame at the '\n'bottom. An\\n'\n' arrow indicates the current frame, which determines the '\n'context of\\n'\n' most commands.\\n'\n'\\n'\n'd(own) [count]\\n'\n'\\n'\n' Move the current frame *count* (default one) levels down in '\n'the\\n'\n' stack trace (to a newer frame).\\n'\n'\\n'\n'u(p) [count]\\n'\n'\\n'\n' Move the current frame *count* (default one) levels up in the '\n'stack\\n'\n' trace (to an older frame).\\n'\n'\\n'\n'b(reak) [([filename:]lineno | function) [, condition]]\\n'\n'\\n'\n' With a *lineno* argument, set a break there in the current '\n'file.\\n'\n' With a *function* argument, set a break at the first '\n'executable\\n'\n' statement within that function. The line number may be '\n'prefixed\\n'\n' with a filename and a colon, to specify a breakpoint in '\n'another\\n'\n' file (probably one that hasn\u2019t been loaded yet). The file '\n'is\\n'\n' searched on \"sys.path\". Note that each breakpoint is '\n'assigned a\\n'\n' number to which all the other breakpoint commands refer.\\n'\n'\\n'\n' If a second argument is present, it is an expression which '\n'must\\n'\n' evaluate to true before the breakpoint is honored.\\n'\n'\\n'\n' Without argument, list all breaks, including for each '\n'breakpoint,\\n'\n' the number of times that breakpoint has been hit, the '\n'current\\n'\n' ignore count, and the associated condition if any.\\n'\n'\\n'\n'tbreak [([filename:]lineno | function) [, condition]]\\n'\n'\\n'\n' Temporary breakpoint, which is removed automatically when it '\n'is\\n'\n' first hit. The arguments are the same as for \"break\".\\n'\n'\\n'\n'cl(ear) [filename:lineno | bpnumber ...]\\n'\n'\\n'\n' With a *filename:lineno* argument, clear all the breakpoints '\n'at\\n'\n' this line. With a space separated list of breakpoint numbers, '\n'clear\\n'\n' those breakpoints. Without argument, clear all breaks (but '\n'first\\n'\n' ask confirmation).\\n'\n'\\n'\n'disable [bpnumber ...]\\n'\n'\\n'\n' Disable the breakpoints given as a space separated list of\\n'\n' breakpoint numbers. Disabling a breakpoint means it cannot '\n'cause\\n'\n' the program to stop execution, but unlike clearing a '\n'breakpoint, it\\n'\n' remains in the list of breakpoints and can be (re-)enabled.\\n'\n'\\n'\n'enable [bpnumber ...]\\n'\n'\\n'\n' Enable the breakpoints specified.\\n'\n'\\n'\n'ignore bpnumber [count]\\n'\n'\\n'\n' Set the ignore count for the given breakpoint number. If '\n'count is\\n'\n' omitted, the ignore count is set to 0. A breakpoint becomes '\n'active\\n'\n' when the ignore count is zero. When non-zero, the count is\\n'\n' decremented each time the breakpoint is reached and the '\n'breakpoint\\n'\n' is not disabled and any associated condition evaluates to '\n'true.\\n'\n'\\n'\n'condition bpnumber [condition]\\n'\n'\\n'\n' Set a new *condition* for the breakpoint, an expression which '\n'must\\n'\n' evaluate to true before the breakpoint is honored. If '\n'*condition*\\n'\n' is absent, any existing condition is removed; i.e., the '\n'breakpoint\\n'\n' is made unconditional.\\n'\n'\\n'\n'commands [bpnumber]\\n'\n'\\n'\n' Specify a list of commands for breakpoint number *bpnumber*. '\n'The\\n'\n' commands themselves appear on the following lines. Type a '\n'line\\n'\n' containing just \"end\" to terminate the commands. An example:\\n'\n'\\n'\n' (Pdb) commands 1\\n'\n' (com) p some_variable\\n'\n' (com) end\\n'\n' (Pdb)\\n'\n'\\n'\n' To remove all commands from a breakpoint, type \"commands\" '\n'and\\n'\n' follow it immediately with \"end\"; that is, give no commands.\\n'\n'\\n'\n' With no *bpnumber* argument, \"commands\" refers to the last\\n'\n' breakpoint set.\\n'\n'\\n'\n' You can use breakpoint commands to start your program up '\n'again.\\n'\n' Simply use the \"continue\" command, or \"step\", or any other '\n'command\\n'\n' that resumes execution.\\n'\n'\\n'\n' Specifying any command resuming execution (currently '\n'\"continue\",\\n'\n' \"step\", \"next\", \"return\", \"jump\", \"quit\" and their '\n'abbreviations)\\n'\n' terminates the command list (as if that command was '\n'immediately\\n'\n' followed by end). This is because any time you resume '\n'execution\\n'\n' (even with a simple next or step), you may encounter another\\n'\n' breakpoint\u2014which could have its own command list, leading to\\n'\n' ambiguities about which list to execute.\\n'\n'\\n'\n' If you use the \u2018silent\u2019 command in the command list, the '\n'usual\\n'\n' message about stopping at a breakpoint is not printed. This '\n'may be\\n'\n' desirable for breakpoints that are to print a specific '\n'message and\\n'\n' then continue. If none of the other commands print anything, '\n'you\\n'\n' see no sign that the breakpoint was reached.\\n'\n'\\n'\n's(tep)\\n'\n'\\n'\n' Execute the current line, stop at the first possible '\n'occasion\\n'\n' (either in a function that is called or on the next line in '\n'the\\n'\n' current function).\\n'\n'\\n'\n'n(ext)\\n'\n'\\n'\n' Continue execution until the next line in the current '\n'function is\\n'\n' reached or it returns. (The difference between \"next\" and '\n'\"step\"\\n'\n' is that \"step\" stops inside a called function, while \"next\"\\n'\n' executes called functions at (nearly) full speed, only '\n'stopping at\\n'\n' the next line in the current function.)\\n'\n'\\n'\n'unt(il) [lineno]\\n'\n'\\n'\n' Without argument, continue execution until the line with a '\n'number\\n'\n' greater than the current one is reached.\\n'\n'\\n'\n' With a line number, continue execution until a line with a '\n'number\\n'\n' greater or equal to that is reached. In both cases, also '\n'stop when\\n'\n' the current frame returns.\\n'\n'\\n'\n' Changed in version 3.2: Allow giving an explicit line '\n'number.\\n'\n'\\n'\n'r(eturn)\\n'\n'\\n'\n' Continue execution until the current function returns.\\n'\n'\\n'\n'c(ont(inue))\\n'\n'\\n'\n' Continue execution, only stop when a breakpoint is '\n'encountered.\\n'\n'\\n'\n'j(ump) lineno\\n'\n'\\n'\n' Set the next line that will be executed. Only available in '\n'the\\n'\n' bottom-most frame. This lets you jump back and execute code '\n'again,\\n'\n' or jump forward to skip code that you don\u2019t want to run.\\n'\n'\\n'\n' It should be noted that not all jumps are allowed \u2013 for '\n'instance it\\n'\n' is not possible to jump into the middle of a \"for\" loop or '\n'out of a\\n'\n' \"finally\" clause.\\n'\n'\\n'\n'l(ist) [first[, last]]\\n'\n'\\n'\n' List source code for the current file. Without arguments, '\n'list 11\\n'\n' lines around the current line or continue the previous '\n'listing.\\n'\n' With \".\" as argument, list 11 lines around the current line. '\n'With\\n'\n' one argument, list 11 lines around at that line. With two\\n'\n' arguments, list the given range; if the second argument is '\n'less\\n'\n' than the first, it is interpreted as a count.\\n'\n'\\n'\n' The current line in the current frame is indicated by \"->\". '\n'If an\\n'\n' exception is being debugged, the line where the exception '\n'was\\n'\n' originally raised or propagated is indicated by \">>\", if it '\n'differs\\n'\n' from the current line.\\n'\n'\\n'\n' New in version 3.2: The \">>\" marker.\\n'\n'\\n'\n'll | longlist\\n'\n'\\n'\n' List all source code for the current function or frame.\\n'\n' Interesting lines are marked as for \"list\".\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'a(rgs)\\n'\n'\\n'\n' Print the argument list of the current function.\\n'\n'\\n'\n'p expression\\n'\n'\\n'\n' Evaluate the *expression* in the current context and print '\n'its\\n'\n' value.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"print()\" can also be used, but is not a debugger command \u2014 '\n'this\\n'\n' executes the Python \"print()\" function.\\n'\n'\\n'\n'pp expression\\n'\n'\\n'\n' Like the \"p\" command, except the value of the expression is '\n'pretty-\\n'\n' printed using the \"pprint\" module.\\n'\n'\\n'\n'whatis expression\\n'\n'\\n'\n' Print the type of the *expression*.\\n'\n'\\n'\n'source expression\\n'\n'\\n'\n' Try to get source code for the given object and display it.\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'display [expression]\\n'\n'\\n'\n' Display the value of the expression if it changed, each time\\n'\n' execution stops in the current frame.\\n'\n'\\n'\n' Without expression, list all display expressions for the '\n'current\\n'\n' frame.\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'undisplay [expression]\\n'\n'\\n'\n' Do not display the expression any more in the current frame.\\n'\n' Without expression, clear all display expressions for the '\n'current\\n'\n' frame.\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'interact\\n'\n'\\n'\n' Start an interactive interpreter (using the \"code\" module) '\n'whose\\n'\n' global namespace contains all the (global and local) names '\n'found in\\n'\n' the current scope.\\n'\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'alias [name [command]]\\n'\n'\\n'\n' Create an alias called *name* that executes *command*. The '\n'command\\n'\n' must *not* be enclosed in quotes. Replaceable parameters can '\n'be\\n'\n' indicated by \"%1\", \"%2\", and so on, while \"%*\" is replaced by '\n'all\\n'\n' the parameters. If no command is given, the current alias '\n'for\\n'\n' *name* is shown. If no arguments are given, all aliases are '\n'listed.\\n'\n'\\n'\n' Aliases may be nested and can contain anything that can be '\n'legally\\n'\n' typed at the pdb prompt. Note that internal pdb commands '\n'*can* be\\n'\n' overridden by aliases. Such a command is then hidden until '\n'the\\n'\n' alias is removed. Aliasing is recursively applied to the '\n'first\\n'\n' word of the command line; all other words in the line are '\n'left\\n'\n' alone.\\n'\n'\\n'\n' As an example, here are two useful aliases (especially when '\n'placed\\n'\n' in the \".pdbrc\" file):\\n'\n'\\n'\n' # Print instance variables (usage \"pi classInst\")\\n'\n' alias pi for k in %1.__dict__.keys(): '\n'print(\"%1.\",k,\"=\",%1.__dict__[k])\\n'\n' # Print instance variables in self\\n'\n' alias ps pi self\\n'\n'\\n'\n'unalias name\\n'\n'\\n'\n' Delete the specified alias.\\n'\n'\\n'\n'! statement\\n'\n'\\n'\n' Execute the (one-line) *statement* in the context of the '\n'current\\n'\n' stack frame. The exclamation point can be omitted unless the '\n'first\\n'\n' word of the statement resembles a debugger command. To set '\n'a\\n'\n' global variable, you can prefix the assignment command with '\n'a\\n'\n' \"global\" statement on the same line, e.g.:\\n'\n'\\n'\n\" (Pdb) global list_options; list_options = ['-l']\\n\"\n' (Pdb)\\n'\n'\\n'\n'run [args ...]\\n'\n'restart [args ...]\\n'\n'\\n'\n' Restart the debugged Python program. If an argument is '\n'supplied,\\n'\n' it is split with \"shlex\" and the result is used as the new\\n'\n' \"sys.argv\". History, breakpoints, actions and debugger '\n'options are\\n'\n' preserved. \"restart\" is an alias for \"run\".\\n'\n'\\n'\n'q(uit)\\n'\n'\\n'\n' Quit from the debugger. The program being executed is '\n'aborted.\\n'\n'\\n'\n'debug code\\n'\n'\\n'\n' Enter a recursive debugger that steps through the code '\n'argument\\n'\n' (which is an arbitrary expression or statement to be executed '\n'in\\n'\n' the current environment).\\n'\n'\\n'\n'retval\\n'\n'\\n'\n' Print the return value for the last return of a function.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] Whether a frame is considered to originate in a certain '\n'module is\\n'\n' determined by the \"__name__\" in the frame globals.\\n',\n'del':'The \"del\" statement\\n'\n'*******************\\n'\n'\\n'\n' del_stmt ::= \"del\" target_list\\n'\n'\\n'\n'Deletion is recursively defined very similar to the way assignment '\n'is\\n'\n'defined. Rather than spelling it out in full details, here are some\\n'\n'hints.\\n'\n'\\n'\n'Deletion of a target list recursively deletes each target, from left\\n'\n'to right.\\n'\n'\\n'\n'Deletion of a name removes the binding of that name from the local '\n'or\\n'\n'global namespace, depending on whether the name occurs in a \"global\"\\n'\n'statement in the same code block. If the name is unbound, a\\n'\n'\"NameError\" exception will be raised.\\n'\n'\\n'\n'Deletion of attribute references, subscriptions and slicings is '\n'passed\\n'\n'to the primary object involved; deletion of a slicing is in general\\n'\n'equivalent to assignment of an empty slice of the right type (but '\n'even\\n'\n'this is determined by the sliced object).\\n'\n'\\n'\n'Changed in version 3.2: Previously it was illegal to delete a name\\n'\n'from the local namespace if it occurs as a free variable in a nested\\n'\n'block.\\n',\n'dict':'Dictionary displays\\n'\n'*******************\\n'\n'\\n'\n'A dictionary display is a possibly empty series of key/datum pairs\\n'\n'enclosed in curly braces:\\n'\n'\\n'\n' dict_display ::= \"{\" [key_datum_list | dict_comprehension] '\n'\"}\"\\n'\n' key_datum_list ::= key_datum (\",\" key_datum)* [\",\"]\\n'\n' key_datum ::= expression \":\" expression | \"**\" or_expr\\n'\n' dict_comprehension ::= expression \":\" expression comp_for\\n'\n'\\n'\n'A dictionary display yields a new dictionary object.\\n'\n'\\n'\n'If a comma-separated sequence of key/datum pairs is given, they are\\n'\n'evaluated from left to right to define the entries of the '\n'dictionary:\\n'\n'each key object is used as a key into the dictionary to store the\\n'\n'corresponding datum. This means that you can specify the same key\\n'\n'multiple times in the key/datum list, and the final dictionary\u2019s '\n'value\\n'\n'for that key will be the last one given.\\n'\n'\\n'\n'A double asterisk \"**\" denotes *dictionary unpacking*. Its operand\\n'\n'must be a *mapping*. Each mapping item is added to the new\\n'\n'dictionary. Later values replace values already set by earlier\\n'\n'key/datum pairs and earlier dictionary unpackings.\\n'\n'\\n'\n'New in version 3.5: Unpacking into dictionary displays, originally\\n'\n'proposed by **PEP 448**.\\n'\n'\\n'\n'A dict comprehension, in contrast to list and set comprehensions,\\n'\n'needs two expressions separated with a colon followed by the usual\\n'\n'\u201cfor\u201d and \u201cif\u201d clauses. When the comprehension is run, the '\n'resulting\\n'\n'key and value elements are inserted in the new dictionary in the '\n'order\\n'\n'they are produced.\\n'\n'\\n'\n'Restrictions on the types of the key values are listed earlier in\\n'\n'section The standard type hierarchy. (To summarize, the key type\\n'\n'should be *hashable*, which excludes all mutable objects.) Clashes\\n'\n'between duplicate keys are not detected; the last datum (textually\\n'\n'rightmost in the display) stored for a given key value prevails.\\n'\n'\\n'\n'Changed in version 3.8: Prior to Python 3.8, in dict '\n'comprehensions,\\n'\n'the evaluation order of key and value was not well-defined. In\\n'\n'CPython, the value was evaluated before the key. Starting with '\n'3.8,\\n'\n'the key is evaluated before the value, as proposed by **PEP 572**.\\n',\n'dynamic-features':'Interaction with dynamic features\\n'\n'*********************************\\n'\n'\\n'\n'Name resolution of free variables occurs at runtime, not '\n'at compile\\n'\n'time. This means that the following code will print 42:\\n'\n'\\n'\n' i = 10\\n'\n' def f():\\n'\n' print(i)\\n'\n' i = 42\\n'\n' f()\\n'\n'\\n'\n'The \"eval()\" and \"exec()\" functions do not have access '\n'to the full\\n'\n'environment for resolving names. Names may be resolved '\n'in the local\\n'\n'and global namespaces of the caller. Free variables are '\n'not resolved\\n'\n'in the nearest enclosing namespace, but in the global '\n'namespace. [1]\\n'\n'The \"exec()\" and \"eval()\" functions have optional '\n'arguments to\\n'\n'override the global and local namespace. If only one '\n'namespace is\\n'\n'specified, it is used for both.\\n',\n'else':'The \"if\" statement\\n'\n'******************\\n'\n'\\n'\n'The \"if\" statement is used for conditional execution:\\n'\n'\\n'\n' if_stmt ::= \"if\" assignment_expression \":\" suite\\n'\n' (\"elif\" assignment_expression \":\" suite)*\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'It selects exactly one of the suites by evaluating the expressions '\n'one\\n'\n'by one until one is found to be true (see section Boolean '\n'operations\\n'\n'for the definition of true and false); then that suite is executed\\n'\n'(and no other part of the \"if\" statement is executed or evaluated).\\n'\n'If all expressions are false, the suite of the \"else\" clause, if\\n'\n'present, is executed.\\n',\n'exceptions':'Exceptions\\n'\n'**********\\n'\n'\\n'\n'Exceptions are a means of breaking out of the normal flow of '\n'control\\n'\n'of a code block in order to handle errors or other '\n'exceptional\\n'\n'conditions. An exception is *raised* at the point where the '\n'error is\\n'\n'detected; it may be *handled* by the surrounding code block or '\n'by any\\n'\n'code block that directly or indirectly invoked the code block '\n'where\\n'\n'the error occurred.\\n'\n'\\n'\n'The Python interpreter raises an exception when it detects a '\n'run-time\\n'\n'error (such as division by zero). A Python program can also\\n'\n'explicitly raise an exception with the \"raise\" statement. '\n'Exception\\n'\n'handlers are specified with the \"try\" \u2026 \"except\" statement. '\n'The\\n'\n'\"finally\" clause of such a statement can be used to specify '\n'cleanup\\n'\n'code which does not handle the exception, but is executed '\n'whether an\\n'\n'exception occurred or not in the preceding code.\\n'\n'\\n'\n'Python uses the \u201ctermination\u201d model of error handling: an '\n'exception\\n'\n'handler can find out what happened and continue execution at '\n'an outer\\n'\n'level, but it cannot repair the cause of the error and retry '\n'the\\n'\n'failing operation (except by re-entering the offending piece '\n'of code\\n'\n'from the top).\\n'\n'\\n'\n'When an exception is not handled at all, the interpreter '\n'terminates\\n'\n'execution of the program, or returns to its interactive main '\n'loop. In\\n'\n'either case, it prints a stack traceback, except when the '\n'exception is\\n'\n'\"SystemExit\".\\n'\n'\\n'\n'Exceptions are identified by class instances. The \"except\" '\n'clause is\\n'\n'selected depending on the class of the instance: it must '\n'reference the\\n'\n'class of the instance or a base class thereof. The instance '\n'can be\\n'\n'received by the handler and can carry additional information '\n'about the\\n'\n'exceptional condition.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Exception messages are not part of the Python API. Their '\n'contents\\n'\n' may change from one version of Python to the next without '\n'warning\\n'\n' and should not be relied on by code which will run under '\n'multiple\\n'\n' versions of the interpreter.\\n'\n'\\n'\n'See also the description of the \"try\" statement in section The '\n'try\\n'\n'statement and \"raise\" statement in section The raise '\n'statement.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] This limitation occurs because the code that is executed '\n'by these\\n'\n' operations is not available at the time the module is '\n'compiled.\\n',\n'execmodel':'Execution model\\n'\n'***************\\n'\n'\\n'\n'\\n'\n'Structure of a program\\n'\n'======================\\n'\n'\\n'\n'A Python program is constructed from code blocks. A *block* is '\n'a piece\\n'\n'of Python program text that is executed as a unit. The '\n'following are\\n'\n'blocks: a module, a function body, and a class definition. '\n'Each\\n'\n'command typed interactively is a block. A script file (a file '\n'given\\n'\n'as standard input to the interpreter or specified as a command '\n'line\\n'\n'argument to the interpreter) is a code block. A script command '\n'(a\\n'\n'command specified on the interpreter command line with the '\n'\"-c\"\\n'\n'option) is a code block. A module run as a top level script (as '\n'module\\n'\n'\"__main__\") from the command line using a \"-m\" argument is also '\n'a code\\n'\n'block. The string argument passed to the built-in functions '\n'\"eval()\"\\n'\n'and \"exec()\" is a code block.\\n'\n'\\n'\n'A code block is executed in an *execution frame*. A frame '\n'contains\\n'\n'some administrative information (used for debugging) and '\n'determines\\n'\n'where and how execution continues after the code block\u2019s '\n'execution has\\n'\n'completed.\\n'\n'\\n'\n'\\n'\n'Naming and binding\\n'\n'==================\\n'\n'\\n'\n'\\n'\n'Binding of names\\n'\n'----------------\\n'\n'\\n'\n'*Names* refer to objects. Names are introduced by name '\n'binding\\n'\n'operations.\\n'\n'\\n'\n'The following constructs bind names: formal parameters to '\n'functions,\\n'\n'\"import\" statements, class and function definitions (these bind '\n'the\\n'\n'class or function name in the defining block), and targets that '\n'are\\n'\n'identifiers if occurring in an assignment, \"for\" loop header, '\n'or after\\n'\n'\"as\" in a \"with\" statement or \"except\" clause. The \"import\" '\n'statement\\n'\n'of the form \"from ... import *\" binds all names defined in the\\n'\n'imported module, except those beginning with an underscore. '\n'This form\\n'\n'may only be used at the module level.\\n'\n'\\n'\n'A target occurring in a \"del\" statement is also considered '\n'bound for\\n'\n'this purpose (though the actual semantics are to unbind the '\n'name).\\n'\n'\\n'\n'Each assignment or import statement occurs within a block '\n'defined by a\\n'\n'class or function definition or at the module level (the '\n'top-level\\n'\n'code block).\\n'\n'\\n'\n'If a name is bound in a block, it is a local variable of that '\n'block,\\n'\n'unless declared as \"nonlocal\" or \"global\". If a name is bound '\n'at the\\n'\n'module level, it is a global variable. (The variables of the '\n'module\\n'\n'code block are local and global.) If a variable is used in a '\n'code\\n'\n'block but not defined there, it is a *free variable*.\\n'\n'\\n'\n'Each occurrence of a name in the program text refers to the '\n'*binding*\\n'\n'of that name established by the following name resolution '\n'rules.\\n'\n'\\n'\n'\\n'\n'Resolution of names\\n'\n'-------------------\\n'\n'\\n'\n'A *scope* defines the visibility of a name within a block. If '\n'a local\\n'\n'variable is defined in a block, its scope includes that block. '\n'If the\\n'\n'definition occurs in a function block, the scope extends to any '\n'blocks\\n'\n'contained within the defining one, unless a contained block '\n'introduces\\n'\n'a different binding for the name.\\n'\n'\\n'\n'When a name is used in a code block, it is resolved using the '\n'nearest\\n'\n'enclosing scope. The set of all such scopes visible to a code '\n'block\\n'\n'is called the block\u2019s *environment*.\\n'\n'\\n'\n'When a name is not found at all, a \"NameError\" exception is '\n'raised. If\\n'\n'the current scope is a function scope, and the name refers to a '\n'local\\n'\n'variable that has not yet been bound to a value at the point '\n'where the\\n'\n'name is used, an \"UnboundLocalError\" exception is raised.\\n'\n'\"UnboundLocalError\" is a subclass of \"NameError\".\\n'\n'\\n'\n'If a name binding operation occurs anywhere within a code '\n'block, all\\n'\n'uses of the name within the block are treated as references to '\n'the\\n'\n'current block. This can lead to errors when a name is used '\n'within a\\n'\n'block before it is bound. This rule is subtle. Python lacks\\n'\n'declarations and allows name binding operations to occur '\n'anywhere\\n'\n'within a code block. The local variables of a code block can '\n'be\\n'\n'determined by scanning the entire text of the block for name '\n'binding\\n'\n'operations.\\n'\n'\\n'\n'If the \"global\" statement occurs within a block, all uses of '\n'the name\\n'\n'specified in the statement refer to the binding of that name in '\n'the\\n'\n'top-level namespace. Names are resolved in the top-level '\n'namespace by\\n'\n'searching the global namespace, i.e. the namespace of the '\n'module\\n'\n'containing the code block, and the builtins namespace, the '\n'namespace\\n'\n'of the module \"builtins\". The global namespace is searched '\n'first. If\\n'\n'the name is not found there, the builtins namespace is '\n'searched. The\\n'\n'\"global\" statement must precede all uses of the name.\\n'\n'\\n'\n'The \"global\" statement has the same scope as a name binding '\n'operation\\n'\n'in the same block. If the nearest enclosing scope for a free '\n'variable\\n'\n'contains a global statement, the free variable is treated as a '\n'global.\\n'\n'\\n'\n'The \"nonlocal\" statement causes corresponding names to refer '\n'to\\n'\n'previously bound variables in the nearest enclosing function '\n'scope.\\n'\n'\"SyntaxError\" is raised at compile time if the given name does '\n'not\\n'\n'exist in any enclosing function scope.\\n'\n'\\n'\n'The namespace for a module is automatically created the first '\n'time a\\n'\n'module is imported. The main module for a script is always '\n'called\\n'\n'\"__main__\".\\n'\n'\\n'\n'Class definition blocks and arguments to \"exec()\" and \"eval()\" '\n'are\\n'\n'special in the context of name resolution. A class definition '\n'is an\\n'\n'executable statement that may use and define names. These '\n'references\\n'\n'follow the normal rules for name resolution with an exception '\n'that\\n'\n'unbound local variables are looked up in the global namespace. '\n'The\\n'\n'namespace of the class definition becomes the attribute '\n'dictionary of\\n'\n'the class. The scope of names defined in a class block is '\n'limited to\\n'\n'the class block; it does not extend to the code blocks of '\n'methods \u2013\\n'\n'this includes comprehensions and generator expressions since '\n'they are\\n'\n'implemented using a function scope. This means that the '\n'following\\n'\n'will fail:\\n'\n'\\n'\n' class A:\\n'\n' a = 42\\n'\n' b = list(a + i for i in range(10))\\n'\n'\\n'\n'\\n'\n'Builtins and restricted execution\\n'\n'---------------------------------\\n'\n'\\n'\n'**CPython implementation detail:** Users should not touch\\n'\n'\"__builtins__\"; it is strictly an implementation detail. '\n'Users\\n'\n'wanting to override values in the builtins namespace should '\n'\"import\"\\n'\n'the \"builtins\" module and modify its attributes appropriately.\\n'\n'\\n'\n'The builtins namespace associated with the execution of a code '\n'block\\n'\n'is actually found by looking up the name \"__builtins__\" in its '\n'global\\n'\n'namespace; this should be a dictionary or a module (in the '\n'latter case\\n'\n'the module\u2019s dictionary is used). By default, when in the '\n'\"__main__\"\\n'\n'module, \"__builtins__\" is the built-in module \"builtins\"; when '\n'in any\\n'\n'other module, \"__builtins__\" is an alias for the dictionary of '\n'the\\n'\n'\"builtins\" module itself.\\n'\n'\\n'\n'\\n'\n'Interaction with dynamic features\\n'\n'---------------------------------\\n'\n'\\n'\n'Name resolution of free variables occurs at runtime, not at '\n'compile\\n'\n'time. This means that the following code will print 42:\\n'\n'\\n'\n' i = 10\\n'\n' def f():\\n'\n' print(i)\\n'\n' i = 42\\n'\n' f()\\n'\n'\\n'\n'The \"eval()\" and \"exec()\" functions do not have access to the '\n'full\\n'\n'environment for resolving names. Names may be resolved in the '\n'local\\n'\n'and global namespaces of the caller. Free variables are not '\n'resolved\\n'\n'in the nearest enclosing namespace, but in the global '\n'namespace. [1]\\n'\n'The \"exec()\" and \"eval()\" functions have optional arguments to\\n'\n'override the global and local namespace. If only one namespace '\n'is\\n'\n'specified, it is used for both.\\n'\n'\\n'\n'\\n'\n'Exceptions\\n'\n'==========\\n'\n'\\n'\n'Exceptions are a means of breaking out of the normal flow of '\n'control\\n'\n'of a code block in order to handle errors or other exceptional\\n'\n'conditions. An exception is *raised* at the point where the '\n'error is\\n'\n'detected; it may be *handled* by the surrounding code block or '\n'by any\\n'\n'code block that directly or indirectly invoked the code block '\n'where\\n'\n'the error occurred.\\n'\n'\\n'\n'The Python interpreter raises an exception when it detects a '\n'run-time\\n'\n'error (such as division by zero). A Python program can also\\n'\n'explicitly raise an exception with the \"raise\" statement. '\n'Exception\\n'\n'handlers are specified with the \"try\" \u2026 \"except\" statement. '\n'The\\n'\n'\"finally\" clause of such a statement can be used to specify '\n'cleanup\\n'\n'code which does not handle the exception, but is executed '\n'whether an\\n'\n'exception occurred or not in the preceding code.\\n'\n'\\n'\n'Python uses the \u201ctermination\u201d model of error handling: an '\n'exception\\n'\n'handler can find out what happened and continue execution at an '\n'outer\\n'\n'level, but it cannot repair the cause of the error and retry '\n'the\\n'\n'failing operation (except by re-entering the offending piece of '\n'code\\n'\n'from the top).\\n'\n'\\n'\n'When an exception is not handled at all, the interpreter '\n'terminates\\n'\n'execution of the program, or returns to its interactive main '\n'loop. In\\n'\n'either case, it prints a stack traceback, except when the '\n'exception is\\n'\n'\"SystemExit\".\\n'\n'\\n'\n'Exceptions are identified by class instances. The \"except\" '\n'clause is\\n'\n'selected depending on the class of the instance: it must '\n'reference the\\n'\n'class of the instance or a base class thereof. The instance '\n'can be\\n'\n'received by the handler and can carry additional information '\n'about the\\n'\n'exceptional condition.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Exception messages are not part of the Python API. Their '\n'contents\\n'\n' may change from one version of Python to the next without '\n'warning\\n'\n' and should not be relied on by code which will run under '\n'multiple\\n'\n' versions of the interpreter.\\n'\n'\\n'\n'See also the description of the \"try\" statement in section The '\n'try\\n'\n'statement and \"raise\" statement in section The raise '\n'statement.\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] This limitation occurs because the code that is executed by '\n'these\\n'\n' operations is not available at the time the module is '\n'compiled.\\n',\n'exprlists':'Expression lists\\n'\n'****************\\n'\n'\\n'\n' expression_list ::= expression (\",\" expression)* [\",\"]\\n'\n' starred_list ::= starred_item (\",\" starred_item)* '\n'[\",\"]\\n'\n' starred_expression ::= expression | (starred_item \",\")* '\n'[starred_item]\\n'\n' starred_item ::= assignment_expression | \"*\" or_expr\\n'\n'\\n'\n'Except when part of a list or set display, an expression list\\n'\n'containing at least one comma yields a tuple. The length of '\n'the tuple\\n'\n'is the number of expressions in the list. The expressions are\\n'\n'evaluated from left to right.\\n'\n'\\n'\n'An asterisk \"*\" denotes *iterable unpacking*. Its operand must '\n'be an\\n'\n'*iterable*. The iterable is expanded into a sequence of items, '\n'which\\n'\n'are included in the new tuple, list, or set, at the site of '\n'the\\n'\n'unpacking.\\n'\n'\\n'\n'New in version 3.5: Iterable unpacking in expression lists, '\n'originally\\n'\n'proposed by **PEP 448**.\\n'\n'\\n'\n'The trailing comma is required only to create a single tuple '\n'(a.k.a. a\\n'\n'*singleton*); it is optional in all other cases. A single '\n'expression\\n'\n'without a trailing comma doesn\u2019t create a tuple, but rather '\n'yields the\\n'\n'value of that expression. (To create an empty tuple, use an '\n'empty pair\\n'\n'of parentheses: \"()\".)\\n',\n'floating':'Floating point literals\\n'\n'***********************\\n'\n'\\n'\n'Floating point literals are described by the following lexical\\n'\n'definitions:\\n'\n'\\n'\n' floatnumber ::= pointfloat | exponentfloat\\n'\n' pointfloat ::= [digitpart] fraction | digitpart \".\"\\n'\n' exponentfloat ::= (digitpart | pointfloat) exponent\\n'\n' digitpart ::= digit ([\"_\"] digit)*\\n'\n' fraction ::= \".\" digitpart\\n'\n' exponent ::= (\"e\" | \"E\") [\"+\" | \"-\"] digitpart\\n'\n'\\n'\n'Note that the integer and exponent parts are always interpreted '\n'using\\n'\n'radix 10. For example, \"077e010\" is legal, and denotes the same '\n'number\\n'\n'as \"77e10\". The allowed range of floating point literals is\\n'\n'implementation-dependent. As in integer literals, underscores '\n'are\\n'\n'supported for digit grouping.\\n'\n'\\n'\n'Some examples of floating point literals:\\n'\n'\\n'\n' 3.14 10. .001 1e100 3.14e-10 0e0 '\n'3.14_15_93\\n'\n'\\n'\n'Changed in version 3.6: Underscores are now allowed for '\n'grouping\\n'\n'purposes in literals.\\n',\n'for':'The \"for\" statement\\n'\n'*******************\\n'\n'\\n'\n'The \"for\" statement is used to iterate over the elements of a '\n'sequence\\n'\n'(such as a string, tuple or list) or other iterable object:\\n'\n'\\n'\n' for_stmt ::= \"for\" target_list \"in\" expression_list \":\" suite\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'The expression list is evaluated once; it should yield an iterable\\n'\n'object. An iterator is created for the result of the\\n'\n'\"expression_list\". The suite is then executed once for each item\\n'\n'provided by the iterator, in the order returned by the iterator. '\n'Each\\n'\n'item in turn is assigned to the target list using the standard rules\\n'\n'for assignments (see Assignment statements), and then the suite is\\n'\n'executed. When the items are exhausted (which is immediately when '\n'the\\n'\n'sequence is empty or an iterator raises a \"StopIteration\" '\n'exception),\\n'\n'the suite in the \"else\" clause, if present, is executed, and the '\n'loop\\n'\n'terminates.\\n'\n'\\n'\n'A \"break\" statement executed in the first suite terminates the loop\\n'\n'without executing the \"else\" clause\u2019s suite. A \"continue\" statement\\n'\n'executed in the first suite skips the rest of the suite and '\n'continues\\n'\n'with the next item, or with the \"else\" clause if there is no next\\n'\n'item.\\n'\n'\\n'\n'The for-loop makes assignments to the variables in the target list.\\n'\n'This overwrites all previous assignments to those variables '\n'including\\n'\n'those made in the suite of the for-loop:\\n'\n'\\n'\n' for i in range(10):\\n'\n' print(i)\\n'\n' i = 5 # this will not affect the for-loop\\n'\n' # because i will be overwritten with the '\n'next\\n'\n' # index in the range\\n'\n'\\n'\n'Names in the target list are not deleted when the loop is finished,\\n'\n'but if the sequence is empty, they will not have been assigned to at\\n'\n'all by the loop. Hint: the built-in function \"range()\" returns an\\n'\n'iterator of integers suitable to emulate the effect of Pascal\u2019s \"for '\n'i\\n'\n':= a to b do\"; e.g., \"list(range(3))\" returns the list \"[0, 1, 2]\".\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' There is a subtlety when the sequence is being modified by the '\n'loop\\n'\n' (this can only occur for mutable sequences, e.g. lists). An\\n'\n' internal counter is used to keep track of which item is used next,\\n'\n' and this is incremented on each iteration. When this counter has\\n'\n' reached the length of the sequence the loop terminates. This '\n'means\\n'\n' that if the suite deletes the current (or a previous) item from '\n'the\\n'\n' sequence, the next item will be skipped (since it gets the index '\n'of\\n'\n' the current item which has already been treated). Likewise, if '\n'the\\n'\n' suite inserts an item in the sequence before the current item, the\\n'\n' current item will be treated again the next time through the loop.\\n'\n' This can lead to nasty bugs that can be avoided by making a\\n'\n' temporary copy using a slice of the whole sequence, e.g.,\\n'\n'\\n'\n' for x in a[:]:\\n'\n' if x < 0: a.remove(x)\\n',\n'formatstrings':'Format String Syntax\\n'\n'********************\\n'\n'\\n'\n'The \"str.format()\" method and the \"Formatter\" class share '\n'the same\\n'\n'syntax for format strings (although in the case of '\n'\"Formatter\",\\n'\n'subclasses can define their own format string syntax). The '\n'syntax is\\n'\n'related to that of formatted string literals, but it is '\n'less\\n'\n'sophisticated and, in particular, does not support '\n'arbitrary\\n'\n'expressions.\\n'\n'\\n'\n'Format strings contain \u201creplacement fields\u201d surrounded by '\n'curly braces\\n'\n'\"{}\". Anything that is not contained in braces is '\n'considered literal\\n'\n'text, which is copied unchanged to the output. If you need '\n'to include\\n'\n'a brace character in the literal text, it can be escaped by '\n'doubling:\\n'\n'\"{{\" and \"}}\".\\n'\n'\\n'\n'The grammar for a replacement field is as follows:\\n'\n'\\n'\n' replacement_field ::= \"{\" [field_name] [\"!\" '\n'conversion] [\":\" format_spec] \"}\"\\n'\n' field_name ::= arg_name (\".\" attribute_name | '\n'\"[\" element_index \"]\")*\\n'\n' arg_name ::= [identifier | digit+]\\n'\n' attribute_name ::= identifier\\n'\n' element_index ::= digit+ | index_string\\n'\n' index_string ::= +\\n'\n' conversion ::= \"r\" | \"s\" | \"a\"\\n'\n' format_spec ::= \\n'\n'\\n'\n'In less formal terms, the replacement field can start with '\n'a\\n'\n'*field_name* that specifies the object whose value is to be '\n'formatted\\n'\n'and inserted into the output instead of the replacement '\n'field. The\\n'\n'*field_name* is optionally followed by a *conversion* '\n'field, which is\\n'\n'preceded by an exclamation point \"\\'!\\'\", and a '\n'*format_spec*, which is\\n'\n'preceded by a colon \"\\':\\'\". These specify a non-default '\n'format for the\\n'\n'replacement value.\\n'\n'\\n'\n'See also the Format Specification Mini-Language section.\\n'\n'\\n'\n'The *field_name* itself begins with an *arg_name* that is '\n'either a\\n'\n'number or a keyword. If it\u2019s a number, it refers to a '\n'positional\\n'\n'argument, and if it\u2019s a keyword, it refers to a named '\n'keyword\\n'\n'argument. If the numerical arg_names in a format string '\n'are 0, 1, 2,\\n'\n'\u2026 in sequence, they can all be omitted (not just some) and '\n'the numbers\\n'\n'0, 1, 2, \u2026 will be automatically inserted in that order. '\n'Because\\n'\n'*arg_name* is not quote-delimited, it is not possible to '\n'specify\\n'\n'arbitrary dictionary keys (e.g., the strings \"\\'10\\'\" or '\n'\"\\':-]\\'\") within\\n'\n'a format string. The *arg_name* can be followed by any '\n'number of index\\n'\n'or attribute expressions. An expression of the form '\n'\"\\'.name\\'\" selects\\n'\n'the named attribute using \"getattr()\", while an expression '\n'of the form\\n'\n'\"\\'[index]\\'\" does an index lookup using \"__getitem__()\".\\n'\n'\\n'\n'Changed in version 3.1: The positional argument specifiers '\n'can be\\n'\n'omitted for \"str.format()\", so \"\\'{} {}\\'.format(a, b)\" is '\n'equivalent to\\n'\n'\"\\'{0} {1}\\'.format(a, b)\".\\n'\n'\\n'\n'Changed in version 3.4: The positional argument specifiers '\n'can be\\n'\n'omitted for \"Formatter\".\\n'\n'\\n'\n'Some simple format string examples:\\n'\n'\\n'\n' \"First, thou shalt count to {0}\" # References first '\n'positional argument\\n'\n' \"Bring me a {}\" # Implicitly '\n'references the first positional argument\\n'\n' \"From {} to {}\" # Same as \"From {0} to '\n'{1}\"\\n'\n' \"My quest is {name}\" # References keyword '\n\"argument 'name'\\n\"\n' \"Weight in tons {0.weight}\" # \\'weight\\' attribute '\n'of first positional arg\\n'\n' \"Units destroyed: {players[0]}\" # First element of '\n\"keyword argument 'players'.\\n\"\n'\\n'\n'The *conversion* field causes a type coercion before '\n'formatting.\\n'\n'Normally, the job of formatting a value is done by the '\n'\"__format__()\"\\n'\n'method of the value itself. However, in some cases it is '\n'desirable to\\n'\n'force a type to be formatted as a string, overriding its '\n'own\\n'\n'definition of formatting. By converting the value to a '\n'string before\\n'\n'calling \"__format__()\", the normal formatting logic is '\n'bypassed.\\n'\n'\\n'\n'Three conversion flags are currently supported: \"\\'!s\\'\" '\n'which calls\\n'\n'\"str()\" on the value, \"\\'!r\\'\" which calls \"repr()\" and '\n'\"\\'!a\\'\" which\\n'\n'calls \"ascii()\".\\n'\n'\\n'\n'Some examples:\\n'\n'\\n'\n' \"Harold\\'s a clever {0!s}\" # Calls str() on the '\n'argument first\\n'\n' \"Bring out the holy {name!r}\" # Calls repr() on the '\n'argument first\\n'\n' \"More {!a}\" # Calls ascii() on the '\n'argument first\\n'\n'\\n'\n'The *format_spec* field contains a specification of how the '\n'value\\n'\n'should be presented, including such details as field width, '\n'alignment,\\n'\n'padding, decimal precision and so on. Each value type can '\n'define its\\n'\n'own \u201cformatting mini-language\u201d or interpretation of the '\n'*format_spec*.\\n'\n'\\n'\n'Most built-in types support a common formatting '\n'mini-language, which\\n'\n'is described in the next section.\\n'\n'\\n'\n'A *format_spec* field can also include nested replacement '\n'fields\\n'\n'within it. These nested replacement fields may contain a '\n'field name,\\n'\n'conversion flag and format specification, but deeper '\n'nesting is not\\n'\n'allowed. The replacement fields within the format_spec '\n'are\\n'\n'substituted before the *format_spec* string is interpreted. '\n'This\\n'\n'allows the formatting of a value to be dynamically '\n'specified.\\n'\n'\\n'\n'See the Format examples section for some examples.\\n'\n'\\n'\n'\\n'\n'Format Specification Mini-Language\\n'\n'==================================\\n'\n'\\n'\n'\u201cFormat specifications\u201d are used within replacement fields '\n'contained\\n'\n'within a format string to define how individual values are '\n'presented\\n'\n'(see Format String Syntax and Formatted string literals). '\n'They can\\n'\n'also be passed directly to the built-in \"format()\" '\n'function. Each\\n'\n'formattable type may define how the format specification is '\n'to be\\n'\n'interpreted.\\n'\n'\\n'\n'Most built-in types implement the following options for '\n'format\\n'\n'specifications, although some of the formatting options are '\n'only\\n'\n'supported by the numeric types.\\n'\n'\\n'\n'A general convention is that an empty format specification '\n'produces\\n'\n'the same result as if you had called \"str()\" on the value. '\n'A non-empty\\n'\n'format specification typically modifies the result.\\n'\n'\\n'\n'The general form of a *standard format specifier* is:\\n'\n'\\n'\n' format_spec ::= '\n'[[fill]align][sign][#][0][width][grouping_option][.precision][type]\\n'\n' fill ::= \\n'\n' align ::= \"<\" | \">\" | \"=\" | \"^\"\\n'\n' sign ::= \"+\" | \"-\" | \" \"\\n'\n' width ::= digit+\\n'\n' grouping_option ::= \"_\" | \",\"\\n'\n' precision ::= digit+\\n'\n' type ::= \"b\" | \"c\" | \"d\" | \"e\" | \"E\" | \"f\" | '\n'\"F\" | \"g\" | \"G\" | \"n\" | \"o\" | \"s\" | \"x\" | \"X\" | \"%\"\\n'\n'\\n'\n'If a valid *align* value is specified, it can be preceded '\n'by a *fill*\\n'\n'character that can be any character and defaults to a space '\n'if\\n'\n'omitted. It is not possible to use a literal curly brace '\n'(\u201d\"{\"\u201d or\\n'\n'\u201c\"}\"\u201d) as the *fill* character in a formatted string '\n'literal or when\\n'\n'using the \"str.format()\" method. However, it is possible '\n'to insert a\\n'\n'curly brace with a nested replacement field. This '\n'limitation doesn\u2019t\\n'\n'affect the \"format()\" function.\\n'\n'\\n'\n'The meaning of the various alignment options is as '\n'follows:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Option | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'<\\'\" | Forces the field to be left-aligned '\n'within the available |\\n'\n' | | space (this is the default for most '\n'objects). |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'>\\'\" | Forces the field to be right-aligned '\n'within the available |\\n'\n' | | space (this is the default for '\n'numbers). |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'=\\'\" | Forces the padding to be placed after '\n'the sign (if any) |\\n'\n' | | but before the digits. This is used for '\n'printing fields |\\n'\n' | | in the form \u2018+000000120\u2019. This alignment '\n'option is only |\\n'\n' | | valid for numeric types. It becomes the '\n'default for |\\n'\n' | | numbers when \u20180\u2019 immediately precedes the '\n'field width. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'^\\'\" | Forces the field to be centered within '\n'the available |\\n'\n' | | '\n'space. '\n'|\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'Note that unless a minimum field width is defined, the '\n'field width\\n'\n'will always be the same size as the data to fill it, so '\n'that the\\n'\n'alignment option has no meaning in this case.\\n'\n'\\n'\n'The *sign* option is only valid for number types, and can '\n'be one of\\n'\n'the following:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Option | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'+\\'\" | indicates that a sign should be used for '\n'both positive as |\\n'\n' | | well as negative '\n'numbers. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'-\\'\" | indicates that a sign should be used '\n'only for negative |\\n'\n' | | numbers (this is the default '\n'behavior). |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | space | indicates that a leading space should be '\n'used on positive |\\n'\n' | | numbers, and a minus sign on negative '\n'numbers. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'The \"\\'#\\'\" option causes the \u201calternate form\u201d to be used '\n'for the\\n'\n'conversion. The alternate form is defined differently for '\n'different\\n'\n'types. This option is only valid for integer, float and '\n'complex\\n'\n'types. For integers, when binary, octal, or hexadecimal '\n'output is\\n'\n'used, this option adds the respective prefix \"\\'0b\\'\", '\n'\"\\'0o\\'\", \"\\'0x\\'\",\\n'\n'or \"\\'0X\\'\" to the output value. For float and complex the '\n'alternate\\n'\n'form causes the result of the conversion to always contain '\n'a decimal-\\n'\n'point character, even if no digits follow it. Normally, a '\n'decimal-\\n'\n'point character appears in the result of these conversions '\n'only if a\\n'\n'digit follows it. In addition, for \"\\'g\\'\" and \"\\'G\\'\" '\n'conversions,\\n'\n'trailing zeros are not removed from the result.\\n'\n'\\n'\n'The \"\\',\\'\" option signals the use of a comma for a '\n'thousands separator.\\n'\n'For a locale aware separator, use the \"\\'n\\'\" integer '\n'presentation type\\n'\n'instead.\\n'\n'\\n'\n'Changed in version 3.1: Added the \"\\',\\'\" option (see also '\n'**PEP 378**).\\n'\n'\\n'\n'The \"\\'_\\'\" option signals the use of an underscore for a '\n'thousands\\n'\n'separator for floating point presentation types and for '\n'integer\\n'\n'presentation type \"\\'d\\'\". For integer presentation types '\n'\"\\'b\\'\", \"\\'o\\'\",\\n'\n'\"\\'x\\'\", and \"\\'X\\'\", underscores will be inserted every 4 '\n'digits. For\\n'\n'other presentation types, specifying this option is an '\n'error.\\n'\n'\\n'\n'Changed in version 3.6: Added the \"\\'_\\'\" option (see also '\n'**PEP 515**).\\n'\n'\\n'\n'*width* is a decimal integer defining the minimum total '\n'field width,\\n'\n'including any prefixes, separators, and other formatting '\n'characters.\\n'\n'If not specified, then the field width will be determined '\n'by the\\n'\n'content.\\n'\n'\\n'\n'When no explicit alignment is given, preceding the *width* '\n'field by a\\n'\n'zero (\"\\'0\\'\") character enables sign-aware zero-padding '\n'for numeric\\n'\n'types. This is equivalent to a *fill* character of \"\\'0\\'\" '\n'with an\\n'\n'*alignment* type of \"\\'=\\'\".\\n'\n'\\n'\n'Changed in version 3.10: Preceding the *width* field by '\n'\"\\'0\\'\" no\\n'\n'longer affects the default alignment for strings.\\n'\n'\\n'\n'The *precision* is a decimal number indicating how many '\n'digits should\\n'\n'be displayed after the decimal point for a floating point '\n'value\\n'\n'formatted with \"\\'f\\'\" and \"\\'F\\'\", or before and after the '\n'decimal point\\n'\n'for a floating point value formatted with \"\\'g\\'\" or '\n'\"\\'G\\'\". For non-\\n'\n'number types the field indicates the maximum field size - '\n'in other\\n'\n'words, how many characters will be used from the field '\n'content. The\\n'\n'*precision* is not allowed for integer values.\\n'\n'\\n'\n'Finally, the *type* determines how the data should be '\n'presented.\\n'\n'\\n'\n'The available string presentation types are:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Type | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'s\\'\" | String format. This is the default type '\n'for strings and |\\n'\n' | | may be '\n'omitted. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | None | The same as '\n'\"\\'s\\'\". |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'The available integer presentation types are:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Type | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'b\\'\" | Binary format. Outputs the number in '\n'base 2. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'c\\'\" | Character. Converts the integer to the '\n'corresponding |\\n'\n' | | unicode character before '\n'printing. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'d\\'\" | Decimal Integer. Outputs the number in '\n'base 10. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'o\\'\" | Octal format. Outputs the number in base '\n'8. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'x\\'\" | Hex format. Outputs the number in base '\n'16, using lower- |\\n'\n' | | case letters for the digits above '\n'9. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'X\\'\" | Hex format. Outputs the number in base '\n'16, using upper- |\\n'\n' | | case letters for the digits above 9. In '\n'case \"\\'#\\'\" is |\\n'\n' | | specified, the prefix \"\\'0x\\'\" will be '\n'upper-cased to \"\\'0X\\'\" |\\n'\n' | | as '\n'well. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'n\\'\" | Number. This is the same as \"\\'d\\'\", '\n'except that it uses the |\\n'\n' | | current locale setting to insert the '\n'appropriate number |\\n'\n' | | separator '\n'characters. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | None | The same as '\n'\"\\'d\\'\". |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'In addition to the above presentation types, integers can '\n'be formatted\\n'\n'with the floating point presentation types listed below '\n'(except \"\\'n\\'\"\\n'\n'and \"None\"). When doing so, \"float()\" is used to convert '\n'the integer\\n'\n'to a floating point number before formatting.\\n'\n'\\n'\n'The available presentation types for \"float\" and \"Decimal\" '\n'values are:\\n'\n'\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | Type | '\n'Meaning '\n'|\\n'\n' '\n'|===========|============================================================|\\n'\n' | \"\\'e\\'\" | Scientific notation. For a given '\n'precision \"p\", formats |\\n'\n' | | the number in scientific notation with the '\n'letter \u2018e\u2019 |\\n'\n' | | separating the coefficient from the '\n'exponent. The |\\n'\n' | | coefficient has one digit before and \"p\" '\n'digits after the |\\n'\n' | | decimal point, for a total of \"p + 1\" '\n'significant digits. |\\n'\n' | | With no precision given, uses a precision '\n'of \"6\" digits |\\n'\n' | | after the decimal point for \"float\", and '\n'shows all |\\n'\n' | | coefficient digits for \"Decimal\". If no '\n'digits follow the |\\n'\n' | | decimal point, the decimal point is also '\n'removed unless |\\n'\n' | | the \"#\" option is '\n'used. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'E\\'\" | Scientific notation. Same as \"\\'e\\'\" '\n'except it uses an upper |\\n'\n' | | case \u2018E\u2019 as the separator '\n'character. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'f\\'\" | Fixed-point notation. For a given '\n'precision \"p\", formats |\\n'\n' | | the number as a decimal number with '\n'exactly \"p\" digits |\\n'\n' | | following the decimal point. With no '\n'precision given, uses |\\n'\n' | | a precision of \"6\" digits after the '\n'decimal point for |\\n'\n' | | \"float\", and uses a precision large enough '\n'to show all |\\n'\n' | | coefficient digits for \"Decimal\". If no '\n'digits follow the |\\n'\n' | | decimal point, the decimal point is also '\n'removed unless |\\n'\n' | | the \"#\" option is '\n'used. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'F\\'\" | Fixed-point notation. Same as \"\\'f\\'\", '\n'but converts \"nan\" to |\\n'\n' | | \"NAN\" and \"inf\" to '\n'\"INF\". |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'g\\'\" | General format. For a given precision '\n'\"p >= 1\", this |\\n'\n' | | rounds the number to \"p\" significant '\n'digits and then |\\n'\n' | | formats the result in either fixed-point '\n'format or in |\\n'\n' | | scientific notation, depending on its '\n'magnitude. A |\\n'\n' | | precision of \"0\" is treated as equivalent '\n'to a precision |\\n'\n' | | of \"1\". The precise rules are as follows: '\n'suppose that |\\n'\n' | | the result formatted with presentation '\n'type \"\\'e\\'\" and |\\n'\n' | | precision \"p-1\" would have exponent '\n'\"exp\". Then, if \"m <= |\\n'\n' | | exp < p\", where \"m\" is -4 for floats and '\n'-6 for |\\n'\n' | | \"Decimals\", the number is formatted with '\n'presentation type |\\n'\n' | | \"\\'f\\'\" and precision \"p-1-exp\". '\n'Otherwise, the number is |\\n'\n' | | formatted with presentation type \"\\'e\\'\" '\n'and precision |\\n'\n' | | \"p-1\". In both cases insignificant '\n'trailing zeros are |\\n'\n' | | removed from the significand, and the '\n'decimal point is |\\n'\n' | | also removed if there are no remaining '\n'digits following |\\n'\n' | | it, unless the \"\\'#\\'\" option is used. '\n'With no precision |\\n'\n' | | given, uses a precision of \"6\" significant '\n'digits for |\\n'\n' | | \"float\". For \"Decimal\", the coefficient of '\n'the result is |\\n'\n' | | formed from the coefficient digits of the '\n'value; |\\n'\n' | | scientific notation is used for values '\n'smaller than \"1e-6\" |\\n'\n' | | in absolute value and values where the '\n'place value of the |\\n'\n' | | least significant digit is larger than 1, '\n'and fixed-point |\\n'\n' | | notation is used otherwise. Positive and '\n'negative |\\n'\n' | | infinity, positive and negative zero, and '\n'nans, are |\\n'\n' | | formatted as \"inf\", \"-inf\", \"0\", \"-0\" and '\n'\"nan\" |\\n'\n' | | respectively, regardless of the '\n'precision. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'G\\'\" | General format. Same as \"\\'g\\'\" except '\n'switches to \"\\'E\\'\" if |\\n'\n' | | the number gets too large. The '\n'representations of infinity |\\n'\n' | | and NaN are uppercased, '\n'too. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'n\\'\" | Number. This is the same as \"\\'g\\'\", '\n'except that it uses the |\\n'\n' | | current locale setting to insert the '\n'appropriate number |\\n'\n' | | separator '\n'characters. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | \"\\'%\\'\" | Percentage. Multiplies the number by 100 '\n'and displays in |\\n'\n' | | fixed (\"\\'f\\'\") format, followed by a '\n'percent sign. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n' | None | For \"float\" this is the same as \"\\'g\\'\", '\n'except that when |\\n'\n' | | fixed-point notation is used to format the '\n'result, it |\\n'\n' | | always includes at least one digit past '\n'the decimal point. |\\n'\n' | | The precision used is as large as needed '\n'to represent the |\\n'\n' | | given value faithfully. For \"Decimal\", '\n'this is the same |\\n'\n' | | as either \"\\'g\\'\" or \"\\'G\\'\" depending on '\n'the value of |\\n'\n' | | \"context.capitals\" for the current decimal '\n'context. The |\\n'\n' | | overall effect is to match the output of '\n'\"str()\" as |\\n'\n' | | altered by the other format '\n'modifiers. |\\n'\n' '\n'+-----------+------------------------------------------------------------+\\n'\n'\\n'\n'\\n'\n'Format examples\\n'\n'===============\\n'\n'\\n'\n'This section contains examples of the \"str.format()\" syntax '\n'and\\n'\n'comparison with the old \"%\"-formatting.\\n'\n'\\n'\n'In most of the cases the syntax is similar to the old '\n'\"%\"-formatting,\\n'\n'with the addition of the \"{}\" and with \":\" used instead of '\n'\"%\". For\\n'\n'example, \"\\'%03.2f\\'\" can be translated to \"\\'{:03.2f}\\'\".\\n'\n'\\n'\n'The new format syntax also supports new and different '\n'options, shown\\n'\n'in the following examples.\\n'\n'\\n'\n'Accessing arguments by position:\\n'\n'\\n'\n\" >>> '{0}, {1}, {2}'.format('a', 'b', 'c')\\n\"\n\" 'a, b, c'\\n\"\n\" >>> '{}, {}, {}'.format('a', 'b', 'c') # 3.1+ only\\n\"\n\" 'a, b, c'\\n\"\n\" >>> '{2}, {1}, {0}'.format('a', 'b', 'c')\\n\"\n\" 'c, b, a'\\n\"\n\" >>> '{2}, {1}, {0}'.format(*'abc') # unpacking \"\n'argument sequence\\n'\n\" 'c, b, a'\\n\"\n\" >>> '{0}{1}{0}'.format('abra', 'cad') # arguments' \"\n'indices can be repeated\\n'\n\" 'abracadabra'\\n\"\n'\\n'\n'Accessing arguments by name:\\n'\n'\\n'\n\" >>> 'Coordinates: {latitude}, \"\n\"{longitude}'.format(latitude='37.24N', \"\n\"longitude='-115.81W')\\n\"\n\" 'Coordinates: 37.24N, -115.81W'\\n\"\n\" >>> coord = {'latitude': '37.24N', 'longitude': \"\n\"'-115.81W'}\\n\"\n\" >>> 'Coordinates: {latitude}, \"\n\"{longitude}'.format(**coord)\\n\"\n\" 'Coordinates: 37.24N, -115.81W'\\n\"\n'\\n'\n'Accessing arguments\u2019 attributes:\\n'\n'\\n'\n' >>> c = 3-5j\\n'\n\" >>> ('The complex number {0} is formed from the real \"\n\"part {0.real} '\\n\"\n\" ... 'and the imaginary part {0.imag}.').format(c)\\n\"\n\" 'The complex number (3-5j) is formed from the real part \"\n\"3.0 and the imaginary part -5.0.'\\n\"\n' >>> class Point:\\n'\n' ... def __init__(self, x, y):\\n'\n' ... self.x, self.y = x, y\\n'\n' ... def __str__(self):\\n'\n\" ... return 'Point({self.x}, \"\n\"{self.y})'.format(self=self)\\n\"\n' ...\\n'\n' >>> str(Point(4, 2))\\n'\n\" 'Point(4, 2)'\\n\"\n'\\n'\n'Accessing arguments\u2019 items:\\n'\n'\\n'\n' >>> coord = (3, 5)\\n'\n\" >>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\\n\"\n\" 'X: 3; Y: 5'\\n\"\n'\\n'\n'Replacing \"%s\" and \"%r\":\\n'\n'\\n'\n' >>> \"repr() shows quotes: {!r}; str() doesn\\'t: '\n'{!s}\".format(\\'test1\\', \\'test2\\')\\n'\n' \"repr() shows quotes: \\'test1\\'; str() doesn\\'t: test2\"\\n'\n'\\n'\n'Aligning the text and specifying a width:\\n'\n'\\n'\n\" >>> '{:<30}'.format('left aligned')\\n\"\n\" 'left aligned '\\n\"\n\" >>> '{:>30}'.format('right aligned')\\n\"\n\" ' right aligned'\\n\"\n\" >>> '{:^30}'.format('centered')\\n\"\n\" ' centered '\\n\"\n\" >>> '{:*^30}'.format('centered') # use '*' as a fill \"\n'char\\n'\n\" '***********centered***********'\\n\"\n'\\n'\n'Replacing \"%+f\", \"%-f\", and \"% f\" and specifying a sign:\\n'\n'\\n'\n\" >>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it \"\n'always\\n'\n\" '+3.140000; -3.140000'\\n\"\n\" >>> '{: f}; {: f}'.format(3.14, -3.14) # show a space \"\n'for positive numbers\\n'\n\" ' 3.140000; -3.140000'\\n\"\n\" >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the \"\n\"minus -- same as '{:f}; {:f}'\\n\"\n\" '3.140000; -3.140000'\\n\"\n'\\n'\n'Replacing \"%x\" and \"%o\" and converting the value to '\n'different bases:\\n'\n'\\n'\n' >>> # format also supports binary numbers\\n'\n' >>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: '\n'{0:b}\".format(42)\\n'\n\" 'int: 42; hex: 2a; oct: 52; bin: 101010'\\n\"\n' >>> # with 0x, 0o, or 0b as prefix:\\n'\n' >>> \"int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: '\n'{0:#b}\".format(42)\\n'\n\" 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'\\n\"\n'\\n'\n'Using the comma as a thousands separator:\\n'\n'\\n'\n\" >>> '{:,}'.format(1234567890)\\n\"\n\" '1,234,567,890'\\n\"\n'\\n'\n'Expressing a percentage:\\n'\n'\\n'\n' >>> points = 19\\n'\n' >>> total = 22\\n'\n\" >>> 'Correct answers: {:.2%}'.format(points/total)\\n\"\n\" 'Correct answers: 86.36%'\\n\"\n'\\n'\n'Using type-specific formatting:\\n'\n'\\n'\n' >>> import datetime\\n'\n' >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\\n'\n\" >>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\\n\"\n\" '2010-07-04 12:15:58'\\n\"\n'\\n'\n'Nesting arguments and more complex examples:\\n'\n'\\n'\n\" >>> for align, text in zip('<^>', ['left', 'center', \"\n\"'right']):\\n\"\n\" ... '{0:{fill}{align}16}'.format(text, fill=align, \"\n'align=align)\\n'\n' ...\\n'\n\" 'left<<<<<<<<<<<<'\\n\"\n\" '^^^^^center^^^^^'\\n\"\n\" '>>>>>>>>>>>right'\\n\"\n' >>>\\n'\n' >>> octets = [192, 168, 0, 1]\\n'\n\" >>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\\n\"\n\" 'C0A80001'\\n\"\n' >>> int(_, 16)\\n'\n' 3232235521\\n'\n' >>>\\n'\n' >>> width = 5\\n'\n' >>> for num in range(5,12): \\n'\n\" ... for base in 'dXob':\\n\"\n\" ... print('{0:{width}{base}}'.format(num, \"\n\"base=base, width=width), end=' ')\\n\"\n' ... print()\\n'\n' ...\\n'\n' 5 5 5 101\\n'\n' 6 6 6 110\\n'\n' 7 7 7 111\\n'\n' 8 8 10 1000\\n'\n' 9 9 11 1001\\n'\n' 10 A 12 1010\\n'\n' 11 B 13 1011\\n',\n'function':'Function definitions\\n'\n'********************\\n'\n'\\n'\n'A function definition defines a user-defined function object '\n'(see\\n'\n'section The standard type hierarchy):\\n'\n'\\n'\n' funcdef ::= [decorators] \"def\" funcname \"(\" '\n'[parameter_list] \")\"\\n'\n' [\"->\" expression] \":\" suite\\n'\n' decorators ::= decorator+\\n'\n' decorator ::= \"@\" assignment_expression '\n'NEWLINE\\n'\n' parameter_list ::= defparameter (\",\" '\n'defparameter)* \",\" \"/\" [\",\" [parameter_list_no_posonly]]\\n'\n' | parameter_list_no_posonly\\n'\n' parameter_list_no_posonly ::= defparameter (\",\" '\n'defparameter)* [\",\" [parameter_list_starargs]]\\n'\n' | parameter_list_starargs\\n'\n' parameter_list_starargs ::= \"*\" [parameter] (\",\" '\n'defparameter)* [\",\" [\"**\" parameter [\",\"]]]\\n'\n' | \"**\" parameter [\",\"]\\n'\n' parameter ::= identifier [\":\" expression]\\n'\n' defparameter ::= parameter [\"=\" expression]\\n'\n' funcname ::= identifier\\n'\n'\\n'\n'A function definition is an executable statement. Its execution '\n'binds\\n'\n'the function name in the current local namespace to a function '\n'object\\n'\n'(a wrapper around the executable code for the function). This\\n'\n'function object contains a reference to the current global '\n'namespace\\n'\n'as the global namespace to be used when the function is called.\\n'\n'\\n'\n'The function definition does not execute the function body; this '\n'gets\\n'\n'executed only when the function is called. [4]\\n'\n'\\n'\n'A function definition may be wrapped by one or more *decorator*\\n'\n'expressions. Decorator expressions are evaluated when the '\n'function is\\n'\n'defined, in the scope that contains the function definition. '\n'The\\n'\n'result must be a callable, which is invoked with the function '\n'object\\n'\n'as the only argument. The returned value is bound to the '\n'function name\\n'\n'instead of the function object. Multiple decorators are applied '\n'in\\n'\n'nested fashion. For example, the following code\\n'\n'\\n'\n' @f1(arg)\\n'\n' @f2\\n'\n' def func(): pass\\n'\n'\\n'\n'is roughly equivalent to\\n'\n'\\n'\n' def func(): pass\\n'\n' func = f1(arg)(f2(func))\\n'\n'\\n'\n'except that the original function is not temporarily bound to '\n'the name\\n'\n'\"func\".\\n'\n'\\n'\n'Changed in version 3.9: Functions may be decorated with any '\n'valid\\n'\n'\"assignment_expression\". Previously, the grammar was much more\\n'\n'restrictive; see **PEP 614** for details.\\n'\n'\\n'\n'When one or more *parameters* have the form *parameter* \"=\"\\n'\n'*expression*, the function is said to have \u201cdefault parameter '\n'values.\u201d\\n'\n'For a parameter with a default value, the corresponding '\n'*argument* may\\n'\n'be omitted from a call, in which case the parameter\u2019s default '\n'value is\\n'\n'substituted. If a parameter has a default value, all following\\n'\n'parameters up until the \u201c\"*\"\u201d must also have a default value \u2014 '\n'this is\\n'\n'a syntactic restriction that is not expressed by the grammar.\\n'\n'\\n'\n'**Default parameter values are evaluated from left to right when '\n'the\\n'\n'function definition is executed.** This means that the '\n'expression is\\n'\n'evaluated once, when the function is defined, and that the same '\n'\u201cpre-\\n'\n'computed\u201d value is used for each call. This is especially '\n'important\\n'\n'to understand when a default parameter value is a mutable '\n'object, such\\n'\n'as a list or a dictionary: if the function modifies the object '\n'(e.g.\\n'\n'by appending an item to a list), the default parameter value is '\n'in\\n'\n'effect modified. This is generally not what was intended. A '\n'way\\n'\n'around this is to use \"None\" as the default, and explicitly test '\n'for\\n'\n'it in the body of the function, e.g.:\\n'\n'\\n'\n' def whats_on_the_telly(penguin=None):\\n'\n' if penguin is None:\\n'\n' penguin = []\\n'\n' penguin.append(\"property of the zoo\")\\n'\n' return penguin\\n'\n'\\n'\n'Function call semantics are described in more detail in section '\n'Calls.\\n'\n'A function call always assigns values to all parameters '\n'mentioned in\\n'\n'the parameter list, either from positional arguments, from '\n'keyword\\n'\n'arguments, or from default values. If the form \u201c\"*identifier\"\u201d '\n'is\\n'\n'present, it is initialized to a tuple receiving any excess '\n'positional\\n'\n'parameters, defaulting to the empty tuple. If the form\\n'\n'\u201c\"**identifier\"\u201d is present, it is initialized to a new ordered\\n'\n'mapping receiving any excess keyword arguments, defaulting to a '\n'new\\n'\n'empty mapping of the same type. Parameters after \u201c\"*\"\u201d or\\n'\n'\u201c\"*identifier\"\u201d are keyword-only parameters and may only be '\n'passed by\\n'\n'keyword arguments. Parameters before \u201c\"/\"\u201d are positional-only\\n'\n'parameters and may only be passed by positional arguments.\\n'\n'\\n'\n'Changed in version 3.8: The \"/\" function parameter syntax may be '\n'used\\n'\n'to indicate positional-only parameters. See **PEP 570** for '\n'details.\\n'\n'\\n'\n'Parameters may have an *annotation* of the form \u201c\": '\n'expression\"\u201d\\n'\n'following the parameter name. Any parameter may have an '\n'annotation,\\n'\n'even those of the form \"*identifier\" or \"**identifier\". '\n'Functions may\\n'\n'have \u201creturn\u201d annotation of the form \u201c\"-> expression\"\u201d after '\n'the\\n'\n'parameter list. These annotations can be any valid Python '\n'expression.\\n'\n'The presence of annotations does not change the semantics of a\\n'\n'function. The annotation values are available as values of a\\n'\n'dictionary keyed by the parameters\u2019 names in the '\n'\"__annotations__\"\\n'\n'attribute of the function object. If the \"annotations\" import '\n'from\\n'\n'\"__future__\" is used, annotations are preserved as strings at '\n'runtime\\n'\n'which enables postponed evaluation. Otherwise, they are '\n'evaluated\\n'\n'when the function definition is executed. In this case '\n'annotations\\n'\n'may be evaluated in a different order than they appear in the '\n'source\\n'\n'code.\\n'\n'\\n'\n'It is also possible to create anonymous functions (functions not '\n'bound\\n'\n'to a name), for immediate use in expressions. This uses lambda\\n'\n'expressions, described in section Lambdas. Note that the '\n'lambda\\n'\n'expression is merely a shorthand for a simplified function '\n'definition;\\n'\n'a function defined in a \u201c\"def\"\u201d statement can be passed around '\n'or\\n'\n'assigned to another name just like a function defined by a '\n'lambda\\n'\n'expression. The \u201c\"def\"\u201d form is actually more powerful since '\n'it\\n'\n'allows the execution of multiple statements and annotations.\\n'\n'\\n'\n'**Programmer\u2019s note:** Functions are first-class objects. A '\n'\u201c\"def\"\u201d\\n'\n'statement executed inside a function definition defines a local\\n'\n'function that can be returned or passed around. Free variables '\n'used\\n'\n'in the nested function can access the local variables of the '\n'function\\n'\n'containing the def. See section Naming and binding for '\n'details.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3107** - Function Annotations\\n'\n' The original specification for function annotations.\\n'\n'\\n'\n' **PEP 484** - Type Hints\\n'\n' Definition of a standard meaning for annotations: type '\n'hints.\\n'\n'\\n'\n' **PEP 526** - Syntax for Variable Annotations\\n'\n' Ability to type hint variable declarations, including '\n'class\\n'\n' variables and instance variables\\n'\n'\\n'\n' **PEP 563** - Postponed Evaluation of Annotations\\n'\n' Support for forward references within annotations by '\n'preserving\\n'\n' annotations in a string form at runtime instead of eager\\n'\n' evaluation.\\n',\n'global':'The \"global\" statement\\n'\n'**********************\\n'\n'\\n'\n' global_stmt ::= \"global\" identifier (\",\" identifier)*\\n'\n'\\n'\n'The \"global\" statement is a declaration which holds for the '\n'entire\\n'\n'current code block. It means that the listed identifiers are to '\n'be\\n'\n'interpreted as globals. It would be impossible to assign to a '\n'global\\n'\n'variable without \"global\", although free variables may refer to\\n'\n'globals without being declared global.\\n'\n'\\n'\n'Names listed in a \"global\" statement must not be used in the same '\n'code\\n'\n'block textually preceding that \"global\" statement.\\n'\n'\\n'\n'Names listed in a \"global\" statement must not be defined as '\n'formal\\n'\n'parameters, or as targets in \"with\" statements or \"except\" '\n'clauses, or\\n'\n'in a \"for\" target list, \"class\" definition, function definition,\\n'\n'\"import\" statement, or variable annotation.\\n'\n'\\n'\n'**CPython implementation detail:** The current implementation does '\n'not\\n'\n'enforce some of these restrictions, but programs should not abuse '\n'this\\n'\n'freedom, as future implementations may enforce them or silently '\n'change\\n'\n'the meaning of the program.\\n'\n'\\n'\n'**Programmer\u2019s note:** \"global\" is a directive to the parser. It\\n'\n'applies only to code parsed at the same time as the \"global\"\\n'\n'statement. In particular, a \"global\" statement contained in a '\n'string\\n'\n'or code object supplied to the built-in \"exec()\" function does '\n'not\\n'\n'affect the code block *containing* the function call, and code\\n'\n'contained in such a string is unaffected by \"global\" statements in '\n'the\\n'\n'code containing the function call. The same applies to the '\n'\"eval()\"\\n'\n'and \"compile()\" functions.\\n',\n'id-classes':'Reserved classes of identifiers\\n'\n'*******************************\\n'\n'\\n'\n'Certain classes of identifiers (besides keywords) have '\n'special\\n'\n'meanings. These classes are identified by the patterns of '\n'leading and\\n'\n'trailing underscore characters:\\n'\n'\\n'\n'\"_*\"\\n'\n' Not imported by \"from module import *\". The special '\n'identifier \"_\"\\n'\n' is used in the interactive interpreter to store the result '\n'of the\\n'\n' last evaluation; it is stored in the \"builtins\" module. '\n'When not\\n'\n' in interactive mode, \"_\" has no special meaning and is not '\n'defined.\\n'\n' See section The import statement.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The name \"_\" is often used in conjunction with\\n'\n' internationalization; refer to the documentation for the\\n'\n' \"gettext\" module for more information on this '\n'convention.\\n'\n'\\n'\n'\"__*__\"\\n'\n' System-defined names, informally known as \u201cdunder\u201d names. '\n'These\\n'\n' names are defined by the interpreter and its '\n'implementation\\n'\n' (including the standard library). Current system names are\\n'\n' discussed in the Special method names section and '\n'elsewhere. More\\n'\n' will likely be defined in future versions of Python. *Any* '\n'use of\\n'\n' \"__*__\" names, in any context, that does not follow '\n'explicitly\\n'\n' documented use, is subject to breakage without warning.\\n'\n'\\n'\n'\"__*\"\\n'\n' Class-private names. Names in this category, when used '\n'within the\\n'\n' context of a class definition, are re-written to use a '\n'mangled form\\n'\n' to help avoid name clashes between \u201cprivate\u201d attributes of '\n'base and\\n'\n' derived classes. See section Identifiers (Names).\\n',\n'identifiers':'Identifiers and keywords\\n'\n'************************\\n'\n'\\n'\n'Identifiers (also referred to as *names*) are described by '\n'the\\n'\n'following lexical definitions.\\n'\n'\\n'\n'The syntax of identifiers in Python is based on the Unicode '\n'standard\\n'\n'annex UAX-31, with elaboration and changes as defined below; '\n'see also\\n'\n'**PEP 3131** for further details.\\n'\n'\\n'\n'Within the ASCII range (U+0001..U+007F), the valid characters '\n'for\\n'\n'identifiers are the same as in Python 2.x: the uppercase and '\n'lowercase\\n'\n'letters \"A\" through \"Z\", the underscore \"_\" and, except for '\n'the first\\n'\n'character, the digits \"0\" through \"9\".\\n'\n'\\n'\n'Python 3.0 introduces additional characters from outside the '\n'ASCII\\n'\n'range (see **PEP 3131**). For these characters, the '\n'classification\\n'\n'uses the version of the Unicode Character Database as '\n'included in the\\n'\n'\"unicodedata\" module.\\n'\n'\\n'\n'Identifiers are unlimited in length. Case is significant.\\n'\n'\\n'\n' identifier ::= xid_start xid_continue*\\n'\n' id_start ::= \\n'\n' id_continue ::= \\n'\n' xid_start ::= \\n'\n' xid_continue ::= \\n'\n'\\n'\n'The Unicode category codes mentioned above stand for:\\n'\n'\\n'\n'* *Lu* - uppercase letters\\n'\n'\\n'\n'* *Ll* - lowercase letters\\n'\n'\\n'\n'* *Lt* - titlecase letters\\n'\n'\\n'\n'* *Lm* - modifier letters\\n'\n'\\n'\n'* *Lo* - other letters\\n'\n'\\n'\n'* *Nl* - letter numbers\\n'\n'\\n'\n'* *Mn* - nonspacing marks\\n'\n'\\n'\n'* *Mc* - spacing combining marks\\n'\n'\\n'\n'* *Nd* - decimal numbers\\n'\n'\\n'\n'* *Pc* - connector punctuations\\n'\n'\\n'\n'* *Other_ID_Start* - explicit list of characters in '\n'PropList.txt to\\n'\n' support backwards compatibility\\n'\n'\\n'\n'* *Other_ID_Continue* - likewise\\n'\n'\\n'\n'All identifiers are converted into the normal form NFKC while '\n'parsing;\\n'\n'comparison of identifiers is based on NFKC.\\n'\n'\\n'\n'A non-normative HTML file listing all valid identifier '\n'characters for\\n'\n'Unicode 4.1 can be found at\\n'\n'https://www.unicode.org/Public/13.0.0/ucd/DerivedCoreProperties.txt\\n'\n'\\n'\n'\\n'\n'Keywords\\n'\n'========\\n'\n'\\n'\n'The following identifiers are used as reserved words, or '\n'*keywords* of\\n'\n'the language, and cannot be used as ordinary identifiers. '\n'They must\\n'\n'be spelled exactly as written here:\\n'\n'\\n'\n' False await else import pass\\n'\n' None break except in raise\\n'\n' True class finally is return\\n'\n' and continue for lambda try\\n'\n' as def from nonlocal while\\n'\n' assert del global not with\\n'\n' async elif if or yield\\n'\n'\\n'\n'\\n'\n'Soft Keywords\\n'\n'=============\\n'\n'\\n'\n'New in version 3.10.\\n'\n'\\n'\n'Some identifiers are only reserved under specific contexts. '\n'These are\\n'\n'known as *soft keywords*. The identifiers \"match\", \"case\" '\n'and \"_\" can\\n'\n'syntactically act as keywords in contexts related to the '\n'pattern\\n'\n'matching statement, but this distinction is done at the '\n'parser level,\\n'\n'not when tokenizing.\\n'\n'\\n'\n'As soft keywords, their use with pattern matching is possible '\n'while\\n'\n'still preserving compatibility with existing code that uses '\n'\"match\",\\n'\n'\"case\" and \"_\" as identifier names.\\n'\n'\\n'\n'\\n'\n'Reserved classes of identifiers\\n'\n'===============================\\n'\n'\\n'\n'Certain classes of identifiers (besides keywords) have '\n'special\\n'\n'meanings. These classes are identified by the patterns of '\n'leading and\\n'\n'trailing underscore characters:\\n'\n'\\n'\n'\"_*\"\\n'\n' Not imported by \"from module import *\". The special '\n'identifier \"_\"\\n'\n' is used in the interactive interpreter to store the result '\n'of the\\n'\n' last evaluation; it is stored in the \"builtins\" module. '\n'When not\\n'\n' in interactive mode, \"_\" has no special meaning and is not '\n'defined.\\n'\n' See section The import statement.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The name \"_\" is often used in conjunction with\\n'\n' internationalization; refer to the documentation for '\n'the\\n'\n' \"gettext\" module for more information on this '\n'convention.\\n'\n'\\n'\n'\"__*__\"\\n'\n' System-defined names, informally known as \u201cdunder\u201d names. '\n'These\\n'\n' names are defined by the interpreter and its '\n'implementation\\n'\n' (including the standard library). Current system names '\n'are\\n'\n' discussed in the Special method names section and '\n'elsewhere. More\\n'\n' will likely be defined in future versions of Python. '\n'*Any* use of\\n'\n' \"__*__\" names, in any context, that does not follow '\n'explicitly\\n'\n' documented use, is subject to breakage without warning.\\n'\n'\\n'\n'\"__*\"\\n'\n' Class-private names. Names in this category, when used '\n'within the\\n'\n' context of a class definition, are re-written to use a '\n'mangled form\\n'\n' to help avoid name clashes between \u201cprivate\u201d attributes of '\n'base and\\n'\n' derived classes. See section Identifiers (Names).\\n',\n'if':'The \"if\" statement\\n'\n'******************\\n'\n'\\n'\n'The \"if\" statement is used for conditional execution:\\n'\n'\\n'\n' if_stmt ::= \"if\" assignment_expression \":\" suite\\n'\n' (\"elif\" assignment_expression \":\" suite)*\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'It selects exactly one of the suites by evaluating the expressions '\n'one\\n'\n'by one until one is found to be true (see section Boolean operations\\n'\n'for the definition of true and false); then that suite is executed\\n'\n'(and no other part of the \"if\" statement is executed or evaluated).\\n'\n'If all expressions are false, the suite of the \"else\" clause, if\\n'\n'present, is executed.\\n',\n'imaginary':'Imaginary literals\\n'\n'******************\\n'\n'\\n'\n'Imaginary literals are described by the following lexical '\n'definitions:\\n'\n'\\n'\n' imagnumber ::= (floatnumber | digitpart) (\"j\" | \"J\")\\n'\n'\\n'\n'An imaginary literal yields a complex number with a real part '\n'of 0.0.\\n'\n'Complex numbers are represented as a pair of floating point '\n'numbers\\n'\n'and have the same restrictions on their range. To create a '\n'complex\\n'\n'number with a nonzero real part, add a floating point number to '\n'it,\\n'\n'e.g., \"(3+4j)\". Some examples of imaginary literals:\\n'\n'\\n'\n' 3.14j 10.j 10j .001j 1e100j 3.14e-10j '\n'3.14_15_93j\\n',\n'import':'The \"import\" statement\\n'\n'**********************\\n'\n'\\n'\n' import_stmt ::= \"import\" module [\"as\" identifier] (\",\" '\n'module [\"as\" identifier])*\\n'\n' | \"from\" relative_module \"import\" identifier '\n'[\"as\" identifier]\\n'\n' (\",\" identifier [\"as\" identifier])*\\n'\n' | \"from\" relative_module \"import\" \"(\" '\n'identifier [\"as\" identifier]\\n'\n' (\",\" identifier [\"as\" identifier])* [\",\"] \")\"\\n'\n' | \"from\" relative_module \"import\" \"*\"\\n'\n' module ::= (identifier \".\")* identifier\\n'\n' relative_module ::= \".\"* module | \".\"+\\n'\n'\\n'\n'The basic import statement (no \"from\" clause) is executed in two\\n'\n'steps:\\n'\n'\\n'\n'1. find a module, loading and initializing it if necessary\\n'\n'\\n'\n'2. define a name or names in the local namespace for the scope '\n'where\\n'\n' the \"import\" statement occurs.\\n'\n'\\n'\n'When the statement contains multiple clauses (separated by commas) '\n'the\\n'\n'two steps are carried out separately for each clause, just as '\n'though\\n'\n'the clauses had been separated out into individual import '\n'statements.\\n'\n'\\n'\n'The details of the first step, finding and loading modules are\\n'\n'described in greater detail in the section on the import system, '\n'which\\n'\n'also describes the various types of packages and modules that can '\n'be\\n'\n'imported, as well as all the hooks that can be used to customize '\n'the\\n'\n'import system. Note that failures in this step may indicate '\n'either\\n'\n'that the module could not be located, *or* that an error occurred\\n'\n'while initializing the module, which includes execution of the\\n'\n'module\u2019s code.\\n'\n'\\n'\n'If the requested module is retrieved successfully, it will be '\n'made\\n'\n'available in the local namespace in one of three ways:\\n'\n'\\n'\n'* If the module name is followed by \"as\", then the name following '\n'\"as\"\\n'\n' is bound directly to the imported module.\\n'\n'\\n'\n'* If no other name is specified, and the module being imported is '\n'a\\n'\n' top level module, the module\u2019s name is bound in the local '\n'namespace\\n'\n' as a reference to the imported module\\n'\n'\\n'\n'* If the module being imported is *not* a top level module, then '\n'the\\n'\n' name of the top level package that contains the module is bound '\n'in\\n'\n' the local namespace as a reference to the top level package. '\n'The\\n'\n' imported module must be accessed using its full qualified name\\n'\n' rather than directly\\n'\n'\\n'\n'The \"from\" form uses a slightly more complex process:\\n'\n'\\n'\n'1. find the module specified in the \"from\" clause, loading and\\n'\n' initializing it if necessary;\\n'\n'\\n'\n'2. for each of the identifiers specified in the \"import\" clauses:\\n'\n'\\n'\n' 1. check if the imported module has an attribute by that name\\n'\n'\\n'\n' 2. if not, attempt to import a submodule with that name and '\n'then\\n'\n' check the imported module again for that attribute\\n'\n'\\n'\n' 3. if the attribute is not found, \"ImportError\" is raised.\\n'\n'\\n'\n' 4. otherwise, a reference to that value is stored in the local\\n'\n' namespace, using the name in the \"as\" clause if it is '\n'present,\\n'\n' otherwise using the attribute name\\n'\n'\\n'\n'Examples:\\n'\n'\\n'\n' import foo # foo imported and bound locally\\n'\n' import foo.bar.baz # foo.bar.baz imported, foo bound '\n'locally\\n'\n' import foo.bar.baz as fbb # foo.bar.baz imported and bound as '\n'fbb\\n'\n' from foo.bar import baz # foo.bar.baz imported and bound as '\n'baz\\n'\n' from foo import attr # foo imported and foo.attr bound as '\n'attr\\n'\n'\\n'\n'If the list of identifiers is replaced by a star (\"\\'*\\'\"), all '\n'public\\n'\n'names defined in the module are bound in the local namespace for '\n'the\\n'\n'scope where the \"import\" statement occurs.\\n'\n'\\n'\n'The *public names* defined by a module are determined by checking '\n'the\\n'\n'module\u2019s namespace for a variable named \"__all__\"; if defined, it '\n'must\\n'\n'be a sequence of strings which are names defined or imported by '\n'that\\n'\n'module. The names given in \"__all__\" are all considered public '\n'and\\n'\n'are required to exist. If \"__all__\" is not defined, the set of '\n'public\\n'\n'names includes all names found in the module\u2019s namespace which do '\n'not\\n'\n'begin with an underscore character (\"\\'_\\'\"). \"__all__\" should '\n'contain\\n'\n'the entire public API. It is intended to avoid accidentally '\n'exporting\\n'\n'items that are not part of the API (such as library modules which '\n'were\\n'\n'imported and used within the module).\\n'\n'\\n'\n'The wild card form of import \u2014 \"from module import *\" \u2014 is only\\n'\n'allowed at the module level. Attempting to use it in class or\\n'\n'function definitions will raise a \"SyntaxError\".\\n'\n'\\n'\n'When specifying what module to import you do not have to specify '\n'the\\n'\n'absolute name of the module. When a module or package is '\n'contained\\n'\n'within another package it is possible to make a relative import '\n'within\\n'\n'the same top package without having to mention the package name. '\n'By\\n'\n'using leading dots in the specified module or package after \"from\" '\n'you\\n'\n'can specify how high to traverse up the current package hierarchy\\n'\n'without specifying exact names. One leading dot means the current\\n'\n'package where the module making the import exists. Two dots means '\n'up\\n'\n'one package level. Three dots is up two levels, etc. So if you '\n'execute\\n'\n'\"from . import mod\" from a module in the \"pkg\" package then you '\n'will\\n'\n'end up importing \"pkg.mod\". If you execute \"from ..subpkg2 import '\n'mod\"\\n'\n'from within \"pkg.subpkg1\" you will import \"pkg.subpkg2.mod\". The\\n'\n'specification for relative imports is contained in the Package\\n'\n'Relative Imports section.\\n'\n'\\n'\n'\"importlib.import_module()\" is provided to support applications '\n'that\\n'\n'determine dynamically the modules to be loaded.\\n'\n'\\n'\n'Raises an auditing event \"import\" with arguments \"module\", '\n'\"filename\",\\n'\n'\"sys.path\", \"sys.meta_path\", \"sys.path_hooks\".\\n'\n'\\n'\n'\\n'\n'Future statements\\n'\n'=================\\n'\n'\\n'\n'A *future statement* is a directive to the compiler that a '\n'particular\\n'\n'module should be compiled using syntax or semantics that will be\\n'\n'available in a specified future release of Python where the '\n'feature\\n'\n'becomes standard.\\n'\n'\\n'\n'The future statement is intended to ease migration to future '\n'versions\\n'\n'of Python that introduce incompatible changes to the language. '\n'It\\n'\n'allows use of the new features on a per-module basis before the\\n'\n'release in which the feature becomes standard.\\n'\n'\\n'\n' future_stmt ::= \"from\" \"__future__\" \"import\" feature [\"as\" '\n'identifier]\\n'\n' (\",\" feature [\"as\" identifier])*\\n'\n' | \"from\" \"__future__\" \"import\" \"(\" feature '\n'[\"as\" identifier]\\n'\n' (\",\" feature [\"as\" identifier])* [\",\"] \")\"\\n'\n' feature ::= identifier\\n'\n'\\n'\n'A future statement must appear near the top of the module. The '\n'only\\n'\n'lines that can appear before a future statement are:\\n'\n'\\n'\n'* the module docstring (if any),\\n'\n'\\n'\n'* comments,\\n'\n'\\n'\n'* blank lines, and\\n'\n'\\n'\n'* other future statements.\\n'\n'\\n'\n'The only feature that requires using the future statement is\\n'\n'\"annotations\" (see **PEP 563**).\\n'\n'\\n'\n'All historical features enabled by the future statement are still\\n'\n'recognized by Python 3. The list includes \"absolute_import\",\\n'\n'\"division\", \"generators\", \"generator_stop\", \"unicode_literals\",\\n'\n'\"print_function\", \"nested_scopes\" and \"with_statement\". They are '\n'all\\n'\n'redundant because they are always enabled, and only kept for '\n'backwards\\n'\n'compatibility.\\n'\n'\\n'\n'A future statement is recognized and treated specially at compile\\n'\n'time: Changes to the semantics of core constructs are often\\n'\n'implemented by generating different code. It may even be the '\n'case\\n'\n'that a new feature introduces new incompatible syntax (such as a '\n'new\\n'\n'reserved word), in which case the compiler may need to parse the\\n'\n'module differently. Such decisions cannot be pushed off until\\n'\n'runtime.\\n'\n'\\n'\n'For any given release, the compiler knows which feature names '\n'have\\n'\n'been defined, and raises a compile-time error if a future '\n'statement\\n'\n'contains a feature not known to it.\\n'\n'\\n'\n'The direct runtime semantics are the same as for any import '\n'statement:\\n'\n'there is a standard module \"__future__\", described later, and it '\n'will\\n'\n'be imported in the usual way at the time the future statement is\\n'\n'executed.\\n'\n'\\n'\n'The interesting runtime semantics depend on the specific feature\\n'\n'enabled by the future statement.\\n'\n'\\n'\n'Note that there is nothing special about the statement:\\n'\n'\\n'\n' import __future__ [as name]\\n'\n'\\n'\n'That is not a future statement; it\u2019s an ordinary import statement '\n'with\\n'\n'no special semantics or syntax restrictions.\\n'\n'\\n'\n'Code compiled by calls to the built-in functions \"exec()\" and\\n'\n'\"compile()\" that occur in a module \"M\" containing a future '\n'statement\\n'\n'will, by default, use the new syntax or semantics associated with '\n'the\\n'\n'future statement. This can be controlled by optional arguments '\n'to\\n'\n'\"compile()\" \u2014 see the documentation of that function for details.\\n'\n'\\n'\n'A future statement typed at an interactive interpreter prompt '\n'will\\n'\n'take effect for the rest of the interpreter session. If an\\n'\n'interpreter is started with the \"-i\" option, is passed a script '\n'name\\n'\n'to execute, and the script includes a future statement, it will be '\n'in\\n'\n'effect in the interactive session started after the script is\\n'\n'executed.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 236** - Back to the __future__\\n'\n' The original proposal for the __future__ mechanism.\\n',\n'in':'Membership test operations\\n'\n'**************************\\n'\n'\\n'\n'The operators \"in\" and \"not in\" test for membership. \"x in s\"\\n'\n'evaluates to \"True\" if *x* is a member of *s*, and \"False\" otherwise.\\n'\n'\"x not in s\" returns the negation of \"x in s\". All built-in '\n'sequences\\n'\n'and set types support this as well as dictionary, for which \"in\" '\n'tests\\n'\n'whether the dictionary has a given key. For container types such as\\n'\n'list, tuple, set, frozenset, dict, or collections.deque, the\\n'\n'expression \"x in y\" is equivalent to \"any(x is e or x == e for e in\\n'\n'y)\".\\n'\n'\\n'\n'For the string and bytes types, \"x in y\" is \"True\" if and only if *x*\\n'\n'is a substring of *y*. An equivalent test is \"y.find(x) != -1\".\\n'\n'Empty strings are always considered to be a substring of any other\\n'\n'string, so \"\"\" in \"abc\"\" will return \"True\".\\n'\n'\\n'\n'For user-defined classes which define the \"__contains__()\" method, \"x\\n'\n'in y\" returns \"True\" if \"y.__contains__(x)\" returns a true value, and\\n'\n'\"False\" otherwise.\\n'\n'\\n'\n'For user-defined classes which do not define \"__contains__()\" but do\\n'\n'define \"__iter__()\", \"x in y\" is \"True\" if some value \"z\", for which\\n'\n'the expression \"x is z or x == z\" is true, is produced while '\n'iterating\\n'\n'over \"y\". If an exception is raised during the iteration, it is as if\\n'\n'\"in\" raised that exception.\\n'\n'\\n'\n'Lastly, the old-style iteration protocol is tried: if a class defines\\n'\n'\"__getitem__()\", \"x in y\" is \"True\" if and only if there is a non-\\n'\n'negative integer index *i* such that \"x is y[i] or x == y[i]\", and no\\n'\n'lower integer index raises the \"IndexError\" exception. (If any other\\n'\n'exception is raised, it is as if \"in\" raised that exception).\\n'\n'\\n'\n'The operator \"not in\" is defined to have the inverse truth value of\\n'\n'\"in\".\\n',\n'integers':'Integer literals\\n'\n'****************\\n'\n'\\n'\n'Integer literals are described by the following lexical '\n'definitions:\\n'\n'\\n'\n' integer ::= decinteger | bininteger | octinteger | '\n'hexinteger\\n'\n' decinteger ::= nonzerodigit ([\"_\"] digit)* | \"0\"+ ([\"_\"] '\n'\"0\")*\\n'\n' bininteger ::= \"0\" (\"b\" | \"B\") ([\"_\"] bindigit)+\\n'\n' octinteger ::= \"0\" (\"o\" | \"O\") ([\"_\"] octdigit)+\\n'\n' hexinteger ::= \"0\" (\"x\" | \"X\") ([\"_\"] hexdigit)+\\n'\n' nonzerodigit ::= \"1\"...\"9\"\\n'\n' digit ::= \"0\"...\"9\"\\n'\n' bindigit ::= \"0\" | \"1\"\\n'\n' octdigit ::= \"0\"...\"7\"\\n'\n' hexdigit ::= digit | \"a\"...\"f\" | \"A\"...\"F\"\\n'\n'\\n'\n'There is no limit for the length of integer literals apart from '\n'what\\n'\n'can be stored in available memory.\\n'\n'\\n'\n'Underscores are ignored for determining the numeric value of '\n'the\\n'\n'literal. They can be used to group digits for enhanced '\n'readability.\\n'\n'One underscore can occur between digits, and after base '\n'specifiers\\n'\n'like \"0x\".\\n'\n'\\n'\n'Note that leading zeros in a non-zero decimal number are not '\n'allowed.\\n'\n'This is for disambiguation with C-style octal literals, which '\n'Python\\n'\n'used before version 3.0.\\n'\n'\\n'\n'Some examples of integer literals:\\n'\n'\\n'\n' 7 2147483647 0o177 0b100110111\\n'\n' 3 79228162514264337593543950336 0o377 0xdeadbeef\\n'\n' 100_000_000_000 0b_1110_0101\\n'\n'\\n'\n'Changed in version 3.6: Underscores are now allowed for '\n'grouping\\n'\n'purposes in literals.\\n',\n'lambda':'Lambdas\\n'\n'*******\\n'\n'\\n'\n' lambda_expr ::= \"lambda\" [parameter_list] \":\" expression\\n'\n'\\n'\n'Lambda expressions (sometimes called lambda forms) are used to '\n'create\\n'\n'anonymous functions. The expression \"lambda parameters: '\n'expression\"\\n'\n'yields a function object. The unnamed object behaves like a '\n'function\\n'\n'object defined with:\\n'\n'\\n'\n' def (parameters):\\n'\n' return expression\\n'\n'\\n'\n'See section Function definitions for the syntax of parameter '\n'lists.\\n'\n'Note that functions created with lambda expressions cannot '\n'contain\\n'\n'statements or annotations.\\n',\n'lists':'List displays\\n'\n'*************\\n'\n'\\n'\n'A list display is a possibly empty series of expressions enclosed '\n'in\\n'\n'square brackets:\\n'\n'\\n'\n' list_display ::= \"[\" [starred_list | comprehension] \"]\"\\n'\n'\\n'\n'A list display yields a new list object, the contents being '\n'specified\\n'\n'by either a list of expressions or a comprehension. When a comma-\\n'\n'separated list of expressions is supplied, its elements are '\n'evaluated\\n'\n'from left to right and placed into the list object in that order.\\n'\n'When a comprehension is supplied, the list is constructed from the\\n'\n'elements resulting from the comprehension.\\n',\n'naming':'Naming and binding\\n'\n'******************\\n'\n'\\n'\n'\\n'\n'Binding of names\\n'\n'================\\n'\n'\\n'\n'*Names* refer to objects. Names are introduced by name binding\\n'\n'operations.\\n'\n'\\n'\n'The following constructs bind names: formal parameters to '\n'functions,\\n'\n'\"import\" statements, class and function definitions (these bind '\n'the\\n'\n'class or function name in the defining block), and targets that '\n'are\\n'\n'identifiers if occurring in an assignment, \"for\" loop header, or '\n'after\\n'\n'\"as\" in a \"with\" statement or \"except\" clause. The \"import\" '\n'statement\\n'\n'of the form \"from ... import *\" binds all names defined in the\\n'\n'imported module, except those beginning with an underscore. This '\n'form\\n'\n'may only be used at the module level.\\n'\n'\\n'\n'A target occurring in a \"del\" statement is also considered bound '\n'for\\n'\n'this purpose (though the actual semantics are to unbind the '\n'name).\\n'\n'\\n'\n'Each assignment or import statement occurs within a block defined '\n'by a\\n'\n'class or function definition or at the module level (the '\n'top-level\\n'\n'code block).\\n'\n'\\n'\n'If a name is bound in a block, it is a local variable of that '\n'block,\\n'\n'unless declared as \"nonlocal\" or \"global\". If a name is bound at '\n'the\\n'\n'module level, it is a global variable. (The variables of the '\n'module\\n'\n'code block are local and global.) If a variable is used in a '\n'code\\n'\n'block but not defined there, it is a *free variable*.\\n'\n'\\n'\n'Each occurrence of a name in the program text refers to the '\n'*binding*\\n'\n'of that name established by the following name resolution rules.\\n'\n'\\n'\n'\\n'\n'Resolution of names\\n'\n'===================\\n'\n'\\n'\n'A *scope* defines the visibility of a name within a block. If a '\n'local\\n'\n'variable is defined in a block, its scope includes that block. If '\n'the\\n'\n'definition occurs in a function block, the scope extends to any '\n'blocks\\n'\n'contained within the defining one, unless a contained block '\n'introduces\\n'\n'a different binding for the name.\\n'\n'\\n'\n'When a name is used in a code block, it is resolved using the '\n'nearest\\n'\n'enclosing scope. The set of all such scopes visible to a code '\n'block\\n'\n'is called the block\u2019s *environment*.\\n'\n'\\n'\n'When a name is not found at all, a \"NameError\" exception is '\n'raised. If\\n'\n'the current scope is a function scope, and the name refers to a '\n'local\\n'\n'variable that has not yet been bound to a value at the point where '\n'the\\n'\n'name is used, an \"UnboundLocalError\" exception is raised.\\n'\n'\"UnboundLocalError\" is a subclass of \"NameError\".\\n'\n'\\n'\n'If a name binding operation occurs anywhere within a code block, '\n'all\\n'\n'uses of the name within the block are treated as references to '\n'the\\n'\n'current block. This can lead to errors when a name is used within '\n'a\\n'\n'block before it is bound. This rule is subtle. Python lacks\\n'\n'declarations and allows name binding operations to occur anywhere\\n'\n'within a code block. The local variables of a code block can be\\n'\n'determined by scanning the entire text of the block for name '\n'binding\\n'\n'operations.\\n'\n'\\n'\n'If the \"global\" statement occurs within a block, all uses of the '\n'name\\n'\n'specified in the statement refer to the binding of that name in '\n'the\\n'\n'top-level namespace. Names are resolved in the top-level '\n'namespace by\\n'\n'searching the global namespace, i.e. the namespace of the module\\n'\n'containing the code block, and the builtins namespace, the '\n'namespace\\n'\n'of the module \"builtins\". The global namespace is searched '\n'first. If\\n'\n'the name is not found there, the builtins namespace is searched. '\n'The\\n'\n'\"global\" statement must precede all uses of the name.\\n'\n'\\n'\n'The \"global\" statement has the same scope as a name binding '\n'operation\\n'\n'in the same block. If the nearest enclosing scope for a free '\n'variable\\n'\n'contains a global statement, the free variable is treated as a '\n'global.\\n'\n'\\n'\n'The \"nonlocal\" statement causes corresponding names to refer to\\n'\n'previously bound variables in the nearest enclosing function '\n'scope.\\n'\n'\"SyntaxError\" is raised at compile time if the given name does '\n'not\\n'\n'exist in any enclosing function scope.\\n'\n'\\n'\n'The namespace for a module is automatically created the first time '\n'a\\n'\n'module is imported. The main module for a script is always '\n'called\\n'\n'\"__main__\".\\n'\n'\\n'\n'Class definition blocks and arguments to \"exec()\" and \"eval()\" '\n'are\\n'\n'special in the context of name resolution. A class definition is '\n'an\\n'\n'executable statement that may use and define names. These '\n'references\\n'\n'follow the normal rules for name resolution with an exception '\n'that\\n'\n'unbound local variables are looked up in the global namespace. '\n'The\\n'\n'namespace of the class definition becomes the attribute dictionary '\n'of\\n'\n'the class. The scope of names defined in a class block is limited '\n'to\\n'\n'the class block; it does not extend to the code blocks of methods '\n'\u2013\\n'\n'this includes comprehensions and generator expressions since they '\n'are\\n'\n'implemented using a function scope. This means that the '\n'following\\n'\n'will fail:\\n'\n'\\n'\n' class A:\\n'\n' a = 42\\n'\n' b = list(a + i for i in range(10))\\n'\n'\\n'\n'\\n'\n'Builtins and restricted execution\\n'\n'=================================\\n'\n'\\n'\n'**CPython implementation detail:** Users should not touch\\n'\n'\"__builtins__\"; it is strictly an implementation detail. Users\\n'\n'wanting to override values in the builtins namespace should '\n'\"import\"\\n'\n'the \"builtins\" module and modify its attributes appropriately.\\n'\n'\\n'\n'The builtins namespace associated with the execution of a code '\n'block\\n'\n'is actually found by looking up the name \"__builtins__\" in its '\n'global\\n'\n'namespace; this should be a dictionary or a module (in the latter '\n'case\\n'\n'the module\u2019s dictionary is used). By default, when in the '\n'\"__main__\"\\n'\n'module, \"__builtins__\" is the built-in module \"builtins\"; when in '\n'any\\n'\n'other module, \"__builtins__\" is an alias for the dictionary of '\n'the\\n'\n'\"builtins\" module itself.\\n'\n'\\n'\n'\\n'\n'Interaction with dynamic features\\n'\n'=================================\\n'\n'\\n'\n'Name resolution of free variables occurs at runtime, not at '\n'compile\\n'\n'time. This means that the following code will print 42:\\n'\n'\\n'\n' i = 10\\n'\n' def f():\\n'\n' print(i)\\n'\n' i = 42\\n'\n' f()\\n'\n'\\n'\n'The \"eval()\" and \"exec()\" functions do not have access to the '\n'full\\n'\n'environment for resolving names. Names may be resolved in the '\n'local\\n'\n'and global namespaces of the caller. Free variables are not '\n'resolved\\n'\n'in the nearest enclosing namespace, but in the global namespace. '\n'[1]\\n'\n'The \"exec()\" and \"eval()\" functions have optional arguments to\\n'\n'override the global and local namespace. If only one namespace '\n'is\\n'\n'specified, it is used for both.\\n',\n'nonlocal':'The \"nonlocal\" statement\\n'\n'************************\\n'\n'\\n'\n' nonlocal_stmt ::= \"nonlocal\" identifier (\",\" identifier)*\\n'\n'\\n'\n'The \"nonlocal\" statement causes the listed identifiers to refer '\n'to\\n'\n'previously bound variables in the nearest enclosing scope '\n'excluding\\n'\n'globals. This is important because the default behavior for '\n'binding is\\n'\n'to search the local namespace first. The statement allows\\n'\n'encapsulated code to rebind variables outside of the local '\n'scope\\n'\n'besides the global (module) scope.\\n'\n'\\n'\n'Names listed in a \"nonlocal\" statement, unlike those listed in '\n'a\\n'\n'\"global\" statement, must refer to pre-existing bindings in an\\n'\n'enclosing scope (the scope in which a new binding should be '\n'created\\n'\n'cannot be determined unambiguously).\\n'\n'\\n'\n'Names listed in a \"nonlocal\" statement must not collide with '\n'pre-\\n'\n'existing bindings in the local scope.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3104** - Access to Names in Outer Scopes\\n'\n' The specification for the \"nonlocal\" statement.\\n',\n'numbers':'Numeric literals\\n'\n'****************\\n'\n'\\n'\n'There are three types of numeric literals: integers, floating '\n'point\\n'\n'numbers, and imaginary numbers. There are no complex literals\\n'\n'(complex numbers can be formed by adding a real number and an\\n'\n'imaginary number).\\n'\n'\\n'\n'Note that numeric literals do not include a sign; a phrase like '\n'\"-1\"\\n'\n'is actually an expression composed of the unary operator \u2018\"-\"\u2019 '\n'and the\\n'\n'literal \"1\".\\n',\n'numeric-types':'Emulating numeric types\\n'\n'***********************\\n'\n'\\n'\n'The following methods can be defined to emulate numeric '\n'objects.\\n'\n'Methods corresponding to operations that are not supported '\n'by the\\n'\n'particular kind of number implemented (e.g., bitwise '\n'operations for\\n'\n'non-integral numbers) should be left undefined.\\n'\n'\\n'\n'object.__add__(self, other)\\n'\n'object.__sub__(self, other)\\n'\n'object.__mul__(self, other)\\n'\n'object.__matmul__(self, other)\\n'\n'object.__truediv__(self, other)\\n'\n'object.__floordiv__(self, other)\\n'\n'object.__mod__(self, other)\\n'\n'object.__divmod__(self, other)\\n'\n'object.__pow__(self, other[, modulo])\\n'\n'object.__lshift__(self, other)\\n'\n'object.__rshift__(self, other)\\n'\n'object.__and__(self, other)\\n'\n'object.__xor__(self, other)\\n'\n'object.__or__(self, other)\\n'\n'\\n'\n' These methods are called to implement the binary '\n'arithmetic\\n'\n' operations (\"+\", \"-\", \"*\", \"@\", \"/\", \"//\", \"%\", '\n'\"divmod()\",\\n'\n' \"pow()\", \"**\", \"<<\", \">>\", \"&\", \"^\", \"|\"). For '\n'instance, to\\n'\n' evaluate the expression \"x + y\", where *x* is an '\n'instance of a\\n'\n' class that has an \"__add__()\" method, \"x.__add__(y)\" is '\n'called.\\n'\n' The \"__divmod__()\" method should be the equivalent to '\n'using\\n'\n' \"__floordiv__()\" and \"__mod__()\"; it should not be '\n'related to\\n'\n' \"__truediv__()\". Note that \"__pow__()\" should be '\n'defined to accept\\n'\n' an optional third argument if the ternary version of the '\n'built-in\\n'\n' \"pow()\" function is to be supported.\\n'\n'\\n'\n' If one of those methods does not support the operation '\n'with the\\n'\n' supplied arguments, it should return \"NotImplemented\".\\n'\n'\\n'\n'object.__radd__(self, other)\\n'\n'object.__rsub__(self, other)\\n'\n'object.__rmul__(self, other)\\n'\n'object.__rmatmul__(self, other)\\n'\n'object.__rtruediv__(self, other)\\n'\n'object.__rfloordiv__(self, other)\\n'\n'object.__rmod__(self, other)\\n'\n'object.__rdivmod__(self, other)\\n'\n'object.__rpow__(self, other[, modulo])\\n'\n'object.__rlshift__(self, other)\\n'\n'object.__rrshift__(self, other)\\n'\n'object.__rand__(self, other)\\n'\n'object.__rxor__(self, other)\\n'\n'object.__ror__(self, other)\\n'\n'\\n'\n' These methods are called to implement the binary '\n'arithmetic\\n'\n' operations (\"+\", \"-\", \"*\", \"@\", \"/\", \"//\", \"%\", '\n'\"divmod()\",\\n'\n' \"pow()\", \"**\", \"<<\", \">>\", \"&\", \"^\", \"|\") with reflected '\n'(swapped)\\n'\n' operands. These functions are only called if the left '\n'operand does\\n'\n' not support the corresponding operation [3] and the '\n'operands are of\\n'\n' different types. [4] For instance, to evaluate the '\n'expression \"x -\\n'\n' y\", where *y* is an instance of a class that has an '\n'\"__rsub__()\"\\n'\n' method, \"y.__rsub__(x)\" is called if \"x.__sub__(y)\" '\n'returns\\n'\n' *NotImplemented*.\\n'\n'\\n'\n' Note that ternary \"pow()\" will not try calling '\n'\"__rpow__()\" (the\\n'\n' coercion rules would become too complicated).\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' If the right operand\u2019s type is a subclass of the left '\n'operand\u2019s\\n'\n' type and that subclass provides a different '\n'implementation of the\\n'\n' reflected method for the operation, this method will '\n'be called\\n'\n' before the left operand\u2019s non-reflected method. This '\n'behavior\\n'\n' allows subclasses to override their ancestors\u2019 '\n'operations.\\n'\n'\\n'\n'object.__iadd__(self, other)\\n'\n'object.__isub__(self, other)\\n'\n'object.__imul__(self, other)\\n'\n'object.__imatmul__(self, other)\\n'\n'object.__itruediv__(self, other)\\n'\n'object.__ifloordiv__(self, other)\\n'\n'object.__imod__(self, other)\\n'\n'object.__ipow__(self, other[, modulo])\\n'\n'object.__ilshift__(self, other)\\n'\n'object.__irshift__(self, other)\\n'\n'object.__iand__(self, other)\\n'\n'object.__ixor__(self, other)\\n'\n'object.__ior__(self, other)\\n'\n'\\n'\n' These methods are called to implement the augmented '\n'arithmetic\\n'\n' assignments (\"+=\", \"-=\", \"*=\", \"@=\", \"/=\", \"//=\", \"%=\", '\n'\"**=\",\\n'\n' \"<<=\", \">>=\", \"&=\", \"^=\", \"|=\"). These methods should '\n'attempt to\\n'\n' do the operation in-place (modifying *self*) and return '\n'the result\\n'\n' (which could be, but does not have to be, *self*). If a '\n'specific\\n'\n' method is not defined, the augmented assignment falls '\n'back to the\\n'\n' normal methods. For instance, if *x* is an instance of '\n'a class\\n'\n' with an \"__iadd__()\" method, \"x += y\" is equivalent to '\n'\"x =\\n'\n' x.__iadd__(y)\" . Otherwise, \"x.__add__(y)\" and '\n'\"y.__radd__(x)\" are\\n'\n' considered, as with the evaluation of \"x + y\". In '\n'certain\\n'\n' situations, augmented assignment can result in '\n'unexpected errors\\n'\n' (see Why does a_tuple[i] += [\u2018item\u2019] raise an exception '\n'when the\\n'\n' addition works?), but this behavior is in fact part of '\n'the data\\n'\n' model.\\n'\n'\\n'\n'object.__neg__(self)\\n'\n'object.__pos__(self)\\n'\n'object.__abs__(self)\\n'\n'object.__invert__(self)\\n'\n'\\n'\n' Called to implement the unary arithmetic operations '\n'(\"-\", \"+\",\\n'\n' \"abs()\" and \"~\").\\n'\n'\\n'\n'object.__complex__(self)\\n'\n'object.__int__(self)\\n'\n'object.__float__(self)\\n'\n'\\n'\n' Called to implement the built-in functions \"complex()\", '\n'\"int()\" and\\n'\n' \"float()\". Should return a value of the appropriate '\n'type.\\n'\n'\\n'\n'object.__index__(self)\\n'\n'\\n'\n' Called to implement \"operator.index()\", and whenever '\n'Python needs\\n'\n' to losslessly convert the numeric object to an integer '\n'object (such\\n'\n' as in slicing, or in the built-in \"bin()\", \"hex()\" and '\n'\"oct()\"\\n'\n' functions). Presence of this method indicates that the '\n'numeric\\n'\n' object is an integer type. Must return an integer.\\n'\n'\\n'\n' If \"__int__()\", \"__float__()\" and \"__complex__()\" are '\n'not defined\\n'\n' then corresponding built-in functions \"int()\", \"float()\" '\n'and\\n'\n' \"complex()\" fall back to \"__index__()\".\\n'\n'\\n'\n'object.__round__(self[, ndigits])\\n'\n'object.__trunc__(self)\\n'\n'object.__floor__(self)\\n'\n'object.__ceil__(self)\\n'\n'\\n'\n' Called to implement the built-in function \"round()\" and '\n'\"math\"\\n'\n' functions \"trunc()\", \"floor()\" and \"ceil()\". Unless '\n'*ndigits* is\\n'\n' passed to \"__round__()\" all these methods should return '\n'the value\\n'\n' of the object truncated to an \"Integral\" (typically an '\n'\"int\").\\n'\n'\\n'\n' If \"__int__()\" is not defined then the built-in function '\n'\"int()\"\\n'\n' falls back to \"__trunc__()\".\\n',\n'objects':'Objects, values and types\\n'\n'*************************\\n'\n'\\n'\n'*Objects* are Python\u2019s abstraction for data. All data in a '\n'Python\\n'\n'program is represented by objects or by relations between '\n'objects. (In\\n'\n'a sense, and in conformance to Von Neumann\u2019s model of a \u201cstored\\n'\n'program computer\u201d, code is also represented by objects.)\\n'\n'\\n'\n'Every object has an identity, a type and a value. An object\u2019s\\n'\n'*identity* never changes once it has been created; you may think '\n'of it\\n'\n'as the object\u2019s address in memory. The \u2018\"is\"\u2019 operator compares '\n'the\\n'\n'identity of two objects; the \"id()\" function returns an integer\\n'\n'representing its identity.\\n'\n'\\n'\n'**CPython implementation detail:** For CPython, \"id(x)\" is the '\n'memory\\n'\n'address where \"x\" is stored.\\n'\n'\\n'\n'An object\u2019s type determines the operations that the object '\n'supports\\n'\n'(e.g., \u201cdoes it have a length?\u201d) and also defines the possible '\n'values\\n'\n'for objects of that type. The \"type()\" function returns an '\n'object\u2019s\\n'\n'type (which is an object itself). Like its identity, an '\n'object\u2019s\\n'\n'*type* is also unchangeable. [1]\\n'\n'\\n'\n'The *value* of some objects can change. Objects whose value can\\n'\n'change are said to be *mutable*; objects whose value is '\n'unchangeable\\n'\n'once they are created are called *immutable*. (The value of an\\n'\n'immutable container object that contains a reference to a '\n'mutable\\n'\n'object can change when the latter\u2019s value is changed; however '\n'the\\n'\n'container is still considered immutable, because the collection '\n'of\\n'\n'objects it contains cannot be changed. So, immutability is not\\n'\n'strictly the same as having an unchangeable value, it is more '\n'subtle.)\\n'\n'An object\u2019s mutability is determined by its type; for instance,\\n'\n'numbers, strings and tuples are immutable, while dictionaries '\n'and\\n'\n'lists are mutable.\\n'\n'\\n'\n'Objects are never explicitly destroyed; however, when they '\n'become\\n'\n'unreachable they may be garbage-collected. An implementation is\\n'\n'allowed to postpone garbage collection or omit it altogether \u2014 it '\n'is a\\n'\n'matter of implementation quality how garbage collection is\\n'\n'implemented, as long as no objects are collected that are still\\n'\n'reachable.\\n'\n'\\n'\n'**CPython implementation detail:** CPython currently uses a '\n'reference-\\n'\n'counting scheme with (optional) delayed detection of cyclically '\n'linked\\n'\n'garbage, which collects most objects as soon as they become\\n'\n'unreachable, but is not guaranteed to collect garbage containing\\n'\n'circular references. See the documentation of the \"gc\" module '\n'for\\n'\n'information on controlling the collection of cyclic garbage. '\n'Other\\n'\n'implementations act differently and CPython may change. Do not '\n'depend\\n'\n'on immediate finalization of objects when they become unreachable '\n'(so\\n'\n'you should always close files explicitly).\\n'\n'\\n'\n'Note that the use of the implementation\u2019s tracing or debugging\\n'\n'facilities may keep objects alive that would normally be '\n'collectable.\\n'\n'Also note that catching an exception with a \u2018\"try\"\u2026\"except\"\u2019 '\n'statement\\n'\n'may keep objects alive.\\n'\n'\\n'\n'Some objects contain references to \u201cexternal\u201d resources such as '\n'open\\n'\n'files or windows. It is understood that these resources are '\n'freed\\n'\n'when the object is garbage-collected, but since garbage '\n'collection is\\n'\n'not guaranteed to happen, such objects also provide an explicit '\n'way to\\n'\n'release the external resource, usually a \"close()\" method. '\n'Programs\\n'\n'are strongly recommended to explicitly close such objects. The\\n'\n'\u2018\"try\"\u2026\"finally\"\u2019 statement and the \u2018\"with\"\u2019 statement provide\\n'\n'convenient ways to do this.\\n'\n'\\n'\n'Some objects contain references to other objects; these are '\n'called\\n'\n'*containers*. Examples of containers are tuples, lists and\\n'\n'dictionaries. The references are part of a container\u2019s value. '\n'In\\n'\n'most cases, when we talk about the value of a container, we imply '\n'the\\n'\n'values, not the identities of the contained objects; however, '\n'when we\\n'\n'talk about the mutability of a container, only the identities of '\n'the\\n'\n'immediately contained objects are implied. So, if an immutable\\n'\n'container (like a tuple) contains a reference to a mutable '\n'object, its\\n'\n'value changes if that mutable object is changed.\\n'\n'\\n'\n'Types affect almost all aspects of object behavior. Even the\\n'\n'importance of object identity is affected in some sense: for '\n'immutable\\n'\n'types, operations that compute new values may actually return a\\n'\n'reference to any existing object with the same type and value, '\n'while\\n'\n'for mutable objects this is not allowed. E.g., after \"a = 1; b = '\n'1\",\\n'\n'\"a\" and \"b\" may or may not refer to the same object with the '\n'value\\n'\n'one, depending on the implementation, but after \"c = []; d = []\", '\n'\"c\"\\n'\n'and \"d\" are guaranteed to refer to two different, unique, newly\\n'\n'created empty lists. (Note that \"c = d = []\" assigns the same '\n'object\\n'\n'to both \"c\" and \"d\".)\\n',\n'operator-summary':'Operator precedence\\n'\n'*******************\\n'\n'\\n'\n'The following table summarizes the operator precedence '\n'in Python, from\\n'\n'highest precedence (most binding) to lowest precedence '\n'(least\\n'\n'binding). Operators in the same box have the same '\n'precedence. Unless\\n'\n'the syntax is explicitly given, operators are binary. '\n'Operators in\\n'\n'the same box group left to right (except for '\n'exponentiation, which\\n'\n'groups from right to left).\\n'\n'\\n'\n'Note that comparisons, membership tests, and identity '\n'tests, all have\\n'\n'the same precedence and have a left-to-right chaining '\n'feature as\\n'\n'described in the Comparisons section.\\n'\n'\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| Operator | '\n'Description |\\n'\n'|=================================================|=======================================|\\n'\n'| \"(expressions...)\", \"[expressions...]\", \"{key: | '\n'Binding or parenthesized expression, |\\n'\n'| value...}\", \"{expressions...}\" | list '\n'display, dictionary display, set |\\n'\n'| | '\n'display |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"x[index]\", \"x[index:index]\", | '\n'Subscription, slicing, call, |\\n'\n'| \"x(arguments...)\", \"x.attribute\" | '\n'attribute reference |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"await\" \"x\" | '\n'Await expression |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"**\" | '\n'Exponentiation [5] |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"+x\", \"-x\", \"~x\" | '\n'Positive, negative, bitwise NOT |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"*\", \"@\", \"/\", \"//\", \"%\" | '\n'Multiplication, matrix |\\n'\n'| | '\n'multiplication, division, floor |\\n'\n'| | '\n'division, remainder [6] |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"+\", \"-\" | '\n'Addition and subtraction |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"<<\", \">>\" | '\n'Shifts |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"&\" | '\n'Bitwise AND |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"^\" | '\n'Bitwise XOR |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"|\" | '\n'Bitwise OR |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"in\", \"not in\", \"is\", \"is not\", \"<\", \"<=\", \">\", | '\n'Comparisons, including membership |\\n'\n'| \">=\", \"!=\", \"==\" | '\n'tests and identity tests |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"not\" \"x\" | '\n'Boolean NOT |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"and\" | '\n'Boolean AND |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"or\" | '\n'Boolean OR |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"if\" \u2013 \"else\" | '\n'Conditional expression |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \"lambda\" | '\n'Lambda expression |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'| \":=\" | '\n'Assignment expression |\\n'\n'+-------------------------------------------------+---------------------------------------+\\n'\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] While \"abs(x%y) < abs(y)\" is true mathematically, '\n'for floats it\\n'\n' may not be true numerically due to roundoff. For '\n'example, and\\n'\n' assuming a platform on which a Python float is an '\n'IEEE 754 double-\\n'\n' precision number, in order that \"-1e-100 % 1e100\" '\n'have the same\\n'\n' sign as \"1e100\", the computed result is \"-1e-100 + '\n'1e100\", which\\n'\n' is numerically exactly equal to \"1e100\". The '\n'function\\n'\n' \"math.fmod()\" returns a result whose sign matches '\n'the sign of the\\n'\n' first argument instead, and so returns \"-1e-100\" in '\n'this case.\\n'\n' Which approach is more appropriate depends on the '\n'application.\\n'\n'\\n'\n'[2] If x is very close to an exact integer multiple of '\n'y, it\u2019s\\n'\n' possible for \"x//y\" to be one larger than '\n'\"(x-x%y)//y\" due to\\n'\n' rounding. In such cases, Python returns the latter '\n'result, in\\n'\n' order to preserve that \"divmod(x,y)[0] * y + x % y\" '\n'be very close\\n'\n' to \"x\".\\n'\n'\\n'\n'[3] The Unicode standard distinguishes between *code '\n'points* (e.g.\\n'\n' U+0041) and *abstract characters* (e.g. \u201cLATIN '\n'CAPITAL LETTER A\u201d).\\n'\n' While most abstract characters in Unicode are only '\n'represented\\n'\n' using one code point, there is a number of abstract '\n'characters\\n'\n' that can in addition be represented using a sequence '\n'of more than\\n'\n' one code point. For example, the abstract character '\n'\u201cLATIN\\n'\n' CAPITAL LETTER C WITH CEDILLA\u201d can be represented as '\n'a single\\n'\n' *precomposed character* at code position U+00C7, or '\n'as a sequence\\n'\n' of a *base character* at code position U+0043 (LATIN '\n'CAPITAL\\n'\n' LETTER C), followed by a *combining character* at '\n'code position\\n'\n' U+0327 (COMBINING CEDILLA).\\n'\n'\\n'\n' The comparison operators on strings compare at the '\n'level of\\n'\n' Unicode code points. This may be counter-intuitive '\n'to humans. For\\n'\n' example, \"\"\\\\u00C7\" == \"\\\\u0043\\\\u0327\"\" is \"False\", '\n'even though both\\n'\n' strings represent the same abstract character \u201cLATIN '\n'CAPITAL\\n'\n' LETTER C WITH CEDILLA\u201d.\\n'\n'\\n'\n' To compare strings at the level of abstract '\n'characters (that is,\\n'\n' in a way intuitive to humans), use '\n'\"unicodedata.normalize()\".\\n'\n'\\n'\n'[4] Due to automatic garbage-collection, free lists, and '\n'the dynamic\\n'\n' nature of descriptors, you may notice seemingly '\n'unusual behaviour\\n'\n' in certain uses of the \"is\" operator, like those '\n'involving\\n'\n' comparisons between instance methods, or constants. '\n'Check their\\n'\n' documentation for more info.\\n'\n'\\n'\n'[5] The power operator \"**\" binds less tightly than an '\n'arithmetic or\\n'\n' bitwise unary operator on its right, that is, '\n'\"2**-1\" is \"0.5\".\\n'\n'\\n'\n'[6] The \"%\" operator is also used for string formatting; '\n'the same\\n'\n' precedence applies.\\n',\n'pass':'The \"pass\" statement\\n'\n'********************\\n'\n'\\n'\n' pass_stmt ::= \"pass\"\\n'\n'\\n'\n'\"pass\" is a null operation \u2014 when it is executed, nothing happens. '\n'It\\n'\n'is useful as a placeholder when a statement is required '\n'syntactically,\\n'\n'but no code needs to be executed, for example:\\n'\n'\\n'\n' def f(arg): pass # a function that does nothing (yet)\\n'\n'\\n'\n' class C: pass # a class with no methods (yet)\\n',\n'power':'The power operator\\n'\n'******************\\n'\n'\\n'\n'The power operator binds more tightly than unary operators on its\\n'\n'left; it binds less tightly than unary operators on its right. '\n'The\\n'\n'syntax is:\\n'\n'\\n'\n' power ::= (await_expr | primary) [\"**\" u_expr]\\n'\n'\\n'\n'Thus, in an unparenthesized sequence of power and unary operators, '\n'the\\n'\n'operators are evaluated from right to left (this does not '\n'constrain\\n'\n'the evaluation order for the operands): \"-1**2\" results in \"-1\".\\n'\n'\\n'\n'The power operator has the same semantics as the built-in \"pow()\"\\n'\n'function, when called with two arguments: it yields its left '\n'argument\\n'\n'raised to the power of its right argument. The numeric arguments '\n'are\\n'\n'first converted to a common type, and the result is of that type.\\n'\n'\\n'\n'For int operands, the result has the same type as the operands '\n'unless\\n'\n'the second argument is negative; in that case, all arguments are\\n'\n'converted to float and a float result is delivered. For example,\\n'\n'\"10**2\" returns \"100\", but \"10**-2\" returns \"0.01\".\\n'\n'\\n'\n'Raising \"0.0\" to a negative power results in a '\n'\"ZeroDivisionError\".\\n'\n'Raising a negative number to a fractional power results in a '\n'\"complex\"\\n'\n'number. (In earlier versions it raised a \"ValueError\".)\\n'\n'\\n'\n'This operation can be customized using the special \"__pow__()\" '\n'method.\\n',\n'raise':'The \"raise\" statement\\n'\n'*********************\\n'\n'\\n'\n' raise_stmt ::= \"raise\" [expression [\"from\" expression]]\\n'\n'\\n'\n'If no expressions are present, \"raise\" re-raises the last '\n'exception\\n'\n'that was active in the current scope. If no exception is active '\n'in\\n'\n'the current scope, a \"RuntimeError\" exception is raised indicating\\n'\n'that this is an error.\\n'\n'\\n'\n'Otherwise, \"raise\" evaluates the first expression as the exception\\n'\n'object. It must be either a subclass or an instance of\\n'\n'\"BaseException\". If it is a class, the exception instance will be\\n'\n'obtained when needed by instantiating the class with no arguments.\\n'\n'\\n'\n'The *type* of the exception is the exception instance\u2019s class, the\\n'\n'*value* is the instance itself.\\n'\n'\\n'\n'A traceback object is normally created automatically when an '\n'exception\\n'\n'is raised and attached to it as the \"__traceback__\" attribute, '\n'which\\n'\n'is writable. You can create an exception and set your own traceback '\n'in\\n'\n'one step using the \"with_traceback()\" exception method (which '\n'returns\\n'\n'the same exception instance, with its traceback set to its '\n'argument),\\n'\n'like so:\\n'\n'\\n'\n' raise Exception(\"foo occurred\").with_traceback(tracebackobj)\\n'\n'\\n'\n'The \"from\" clause is used for exception chaining: if given, the '\n'second\\n'\n'*expression* must be another exception class or instance. If the\\n'\n'second expression is an exception instance, it will be attached to '\n'the\\n'\n'raised exception as the \"__cause__\" attribute (which is writable). '\n'If\\n'\n'the expression is an exception class, the class will be '\n'instantiated\\n'\n'and the resulting exception instance will be attached to the '\n'raised\\n'\n'exception as the \"__cause__\" attribute. If the raised exception is '\n'not\\n'\n'handled, both exceptions will be printed:\\n'\n'\\n'\n' >>> try:\\n'\n' ... print(1 / 0)\\n'\n' ... except Exception as exc:\\n'\n' ... raise RuntimeError(\"Something bad happened\") from exc\\n'\n' ...\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 2, in \\n'\n' ZeroDivisionError: division by zero\\n'\n'\\n'\n' The above exception was the direct cause of the following '\n'exception:\\n'\n'\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 4, in \\n'\n' RuntimeError: Something bad happened\\n'\n'\\n'\n'A similar mechanism works implicitly if an exception is raised '\n'inside\\n'\n'an exception handler or a \"finally\" clause: the previous exception '\n'is\\n'\n'then attached as the new exception\u2019s \"__context__\" attribute:\\n'\n'\\n'\n' >>> try:\\n'\n' ... print(1 / 0)\\n'\n' ... except:\\n'\n' ... raise RuntimeError(\"Something bad happened\")\\n'\n' ...\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 2, in \\n'\n' ZeroDivisionError: division by zero\\n'\n'\\n'\n' During handling of the above exception, another exception '\n'occurred:\\n'\n'\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 4, in \\n'\n' RuntimeError: Something bad happened\\n'\n'\\n'\n'Exception chaining can be explicitly suppressed by specifying '\n'\"None\"\\n'\n'in the \"from\" clause:\\n'\n'\\n'\n' >>> try:\\n'\n' ... print(1 / 0)\\n'\n' ... except:\\n'\n' ... raise RuntimeError(\"Something bad happened\") from None\\n'\n' ...\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 4, in \\n'\n' RuntimeError: Something bad happened\\n'\n'\\n'\n'Additional information on exceptions can be found in section\\n'\n'Exceptions, and information about handling exceptions is in '\n'section\\n'\n'The try statement.\\n'\n'\\n'\n'Changed in version 3.3: \"None\" is now permitted as \"Y\" in \"raise X\\n'\n'from Y\".\\n'\n'\\n'\n'New in version 3.3: The \"__suppress_context__\" attribute to '\n'suppress\\n'\n'automatic display of the exception context.\\n',\n'return':'The \"return\" statement\\n'\n'**********************\\n'\n'\\n'\n' return_stmt ::= \"return\" [expression_list]\\n'\n'\\n'\n'\"return\" may only occur syntactically nested in a function '\n'definition,\\n'\n'not within a nested class definition.\\n'\n'\\n'\n'If an expression list is present, it is evaluated, else \"None\" is\\n'\n'substituted.\\n'\n'\\n'\n'\"return\" leaves the current function call with the expression list '\n'(or\\n'\n'\"None\") as return value.\\n'\n'\\n'\n'When \"return\" passes control out of a \"try\" statement with a '\n'\"finally\"\\n'\n'clause, that \"finally\" clause is executed before really leaving '\n'the\\n'\n'function.\\n'\n'\\n'\n'In a generator function, the \"return\" statement indicates that '\n'the\\n'\n'generator is done and will cause \"StopIteration\" to be raised. '\n'The\\n'\n'returned value (if any) is used as an argument to construct\\n'\n'\"StopIteration\" and becomes the \"StopIteration.value\" attribute.\\n'\n'\\n'\n'In an asynchronous generator function, an empty \"return\" '\n'statement\\n'\n'indicates that the asynchronous generator is done and will cause\\n'\n'\"StopAsyncIteration\" to be raised. A non-empty \"return\" statement '\n'is\\n'\n'a syntax error in an asynchronous generator function.\\n',\n'sequence-types':'Emulating container types\\n'\n'*************************\\n'\n'\\n'\n'The following methods can be defined to implement '\n'container objects.\\n'\n'Containers usually are sequences (such as lists or tuples) '\n'or mappings\\n'\n'(like dictionaries), but can represent other containers as '\n'well. The\\n'\n'first set of methods is used either to emulate a sequence '\n'or to\\n'\n'emulate a mapping; the difference is that for a sequence, '\n'the\\n'\n'allowable keys should be the integers *k* for which \"0 <= '\n'k < N\" where\\n'\n'*N* is the length of the sequence, or slice objects, which '\n'define a\\n'\n'range of items. It is also recommended that mappings '\n'provide the\\n'\n'methods \"keys()\", \"values()\", \"items()\", \"get()\", '\n'\"clear()\",\\n'\n'\"setdefault()\", \"pop()\", \"popitem()\", \"copy()\", and '\n'\"update()\"\\n'\n'behaving similar to those for Python\u2019s standard dictionary '\n'objects.\\n'\n'The \"collections.abc\" module provides a \"MutableMapping\" '\n'abstract base\\n'\n'class to help create those methods from a base set of '\n'\"__getitem__()\",\\n'\n'\"__setitem__()\", \"__delitem__()\", and \"keys()\". Mutable '\n'sequences\\n'\n'should provide methods \"append()\", \"count()\", \"index()\", '\n'\"extend()\",\\n'\n'\"insert()\", \"pop()\", \"remove()\", \"reverse()\" and \"sort()\", '\n'like Python\\n'\n'standard list objects. Finally, sequence types should '\n'implement\\n'\n'addition (meaning concatenation) and multiplication '\n'(meaning\\n'\n'repetition) by defining the methods \"__add__()\", '\n'\"__radd__()\",\\n'\n'\"__iadd__()\", \"__mul__()\", \"__rmul__()\" and \"__imul__()\" '\n'described\\n'\n'below; they should not define other numerical operators. '\n'It is\\n'\n'recommended that both mappings and sequences implement '\n'the\\n'\n'\"__contains__()\" method to allow efficient use of the \"in\" '\n'operator;\\n'\n'for mappings, \"in\" should search the mapping\u2019s keys; for '\n'sequences, it\\n'\n'should search through the values. It is further '\n'recommended that both\\n'\n'mappings and sequences implement the \"__iter__()\" method '\n'to allow\\n'\n'efficient iteration through the container; for mappings, '\n'\"__iter__()\"\\n'\n'should iterate through the object\u2019s keys; for sequences, '\n'it should\\n'\n'iterate through the values.\\n'\n'\\n'\n'object.__len__(self)\\n'\n'\\n'\n' Called to implement the built-in function \"len()\". '\n'Should return\\n'\n' the length of the object, an integer \">=\" 0. Also, an '\n'object that\\n'\n' doesn\u2019t define a \"__bool__()\" method and whose '\n'\"__len__()\" method\\n'\n' returns zero is considered to be false in a Boolean '\n'context.\\n'\n'\\n'\n' **CPython implementation detail:** In CPython, the '\n'length is\\n'\n' required to be at most \"sys.maxsize\". If the length is '\n'larger than\\n'\n' \"sys.maxsize\" some features (such as \"len()\") may '\n'raise\\n'\n' \"OverflowError\". To prevent raising \"OverflowError\" by '\n'truth value\\n'\n' testing, an object must define a \"__bool__()\" method.\\n'\n'\\n'\n'object.__length_hint__(self)\\n'\n'\\n'\n' Called to implement \"operator.length_hint()\". Should '\n'return an\\n'\n' estimated length for the object (which may be greater '\n'or less than\\n'\n' the actual length). The length must be an integer \">=\" '\n'0. The\\n'\n' return value may also be \"NotImplemented\", which is '\n'treated the\\n'\n' same as if the \"__length_hint__\" method didn\u2019t exist at '\n'all. This\\n'\n' method is purely an optimization and is never required '\n'for\\n'\n' correctness.\\n'\n'\\n'\n' New in version 3.4.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Slicing is done exclusively with the following three '\n'methods. A\\n'\n' call like\\n'\n'\\n'\n' a[1:2] = b\\n'\n'\\n'\n' is translated to\\n'\n'\\n'\n' a[slice(1, 2, None)] = b\\n'\n'\\n'\n' and so forth. Missing slice items are always filled in '\n'with \"None\".\\n'\n'\\n'\n'object.__getitem__(self, key)\\n'\n'\\n'\n' Called to implement evaluation of \"self[key]\". For '\n'sequence types,\\n'\n' the accepted keys should be integers and slice '\n'objects. Note that\\n'\n' the special interpretation of negative indexes (if the '\n'class wishes\\n'\n' to emulate a sequence type) is up to the '\n'\"__getitem__()\" method. If\\n'\n' *key* is of an inappropriate type, \"TypeError\" may be '\n'raised; if of\\n'\n' a value outside the set of indexes for the sequence '\n'(after any\\n'\n' special interpretation of negative values), '\n'\"IndexError\" should be\\n'\n' raised. For mapping types, if *key* is missing (not in '\n'the\\n'\n' container), \"KeyError\" should be raised.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"for\" loops expect that an \"IndexError\" will be '\n'raised for\\n'\n' illegal indexes to allow proper detection of the end '\n'of the\\n'\n' sequence.\\n'\n'\\n'\n'object.__setitem__(self, key, value)\\n'\n'\\n'\n' Called to implement assignment to \"self[key]\". Same '\n'note as for\\n'\n' \"__getitem__()\". This should only be implemented for '\n'mappings if\\n'\n' the objects support changes to the values for keys, or '\n'if new keys\\n'\n' can be added, or for sequences if elements can be '\n'replaced. The\\n'\n' same exceptions should be raised for improper *key* '\n'values as for\\n'\n' the \"__getitem__()\" method.\\n'\n'\\n'\n'object.__delitem__(self, key)\\n'\n'\\n'\n' Called to implement deletion of \"self[key]\". Same note '\n'as for\\n'\n' \"__getitem__()\". This should only be implemented for '\n'mappings if\\n'\n' the objects support removal of keys, or for sequences '\n'if elements\\n'\n' can be removed from the sequence. The same exceptions '\n'should be\\n'\n' raised for improper *key* values as for the '\n'\"__getitem__()\" method.\\n'\n'\\n'\n'object.__missing__(self, key)\\n'\n'\\n'\n' Called by \"dict\".\"__getitem__()\" to implement '\n'\"self[key]\" for dict\\n'\n' subclasses when key is not in the dictionary.\\n'\n'\\n'\n'object.__iter__(self)\\n'\n'\\n'\n' This method is called when an iterator is required for '\n'a container.\\n'\n' This method should return a new iterator object that '\n'can iterate\\n'\n' over all the objects in the container. For mappings, '\n'it should\\n'\n' iterate over the keys of the container.\\n'\n'\\n'\n' Iterator objects also need to implement this method; '\n'they are\\n'\n' required to return themselves. For more information on '\n'iterator\\n'\n' objects, see Iterator Types.\\n'\n'\\n'\n'object.__reversed__(self)\\n'\n'\\n'\n' Called (if present) by the \"reversed()\" built-in to '\n'implement\\n'\n' reverse iteration. It should return a new iterator '\n'object that\\n'\n' iterates over all the objects in the container in '\n'reverse order.\\n'\n'\\n'\n' If the \"__reversed__()\" method is not provided, the '\n'\"reversed()\"\\n'\n' built-in will fall back to using the sequence protocol '\n'(\"__len__()\"\\n'\n' and \"__getitem__()\"). Objects that support the '\n'sequence protocol\\n'\n' should only provide \"__reversed__()\" if they can '\n'provide an\\n'\n' implementation that is more efficient than the one '\n'provided by\\n'\n' \"reversed()\".\\n'\n'\\n'\n'The membership test operators (\"in\" and \"not in\") are '\n'normally\\n'\n'implemented as an iteration through a container. However, '\n'container\\n'\n'objects can supply the following special method with a '\n'more efficient\\n'\n'implementation, which also does not require the object be '\n'iterable.\\n'\n'\\n'\n'object.__contains__(self, item)\\n'\n'\\n'\n' Called to implement membership test operators. Should '\n'return true\\n'\n' if *item* is in *self*, false otherwise. For mapping '\n'objects, this\\n'\n' should consider the keys of the mapping rather than the '\n'values or\\n'\n' the key-item pairs.\\n'\n'\\n'\n' For objects that don\u2019t define \"__contains__()\", the '\n'membership test\\n'\n' first tries iteration via \"__iter__()\", then the old '\n'sequence\\n'\n' iteration protocol via \"__getitem__()\", see this '\n'section in the\\n'\n' language reference.\\n',\n'shifting':'Shifting operations\\n'\n'*******************\\n'\n'\\n'\n'The shifting operations have lower priority than the arithmetic\\n'\n'operations:\\n'\n'\\n'\n' shift_expr ::= a_expr | shift_expr (\"<<\" | \">>\") a_expr\\n'\n'\\n'\n'These operators accept integers as arguments. They shift the '\n'first\\n'\n'argument to the left or right by the number of bits given by '\n'the\\n'\n'second argument.\\n'\n'\\n'\n'This operation can be customized using the special '\n'\"__lshift__()\" and\\n'\n'\"__rshift__()\" methods.\\n'\n'\\n'\n'A right shift by *n* bits is defined as floor division by '\n'\"pow(2,n)\".\\n'\n'A left shift by *n* bits is defined as multiplication with '\n'\"pow(2,n)\".\\n',\n'slicings':'Slicings\\n'\n'********\\n'\n'\\n'\n'A slicing selects a range of items in a sequence object (e.g., '\n'a\\n'\n'string, tuple or list). Slicings may be used as expressions or '\n'as\\n'\n'targets in assignment or \"del\" statements. The syntax for a '\n'slicing:\\n'\n'\\n'\n' slicing ::= primary \"[\" slice_list \"]\"\\n'\n' slice_list ::= slice_item (\",\" slice_item)* [\",\"]\\n'\n' slice_item ::= expression | proper_slice\\n'\n' proper_slice ::= [lower_bound] \":\" [upper_bound] [ \":\" '\n'[stride] ]\\n'\n' lower_bound ::= expression\\n'\n' upper_bound ::= expression\\n'\n' stride ::= expression\\n'\n'\\n'\n'There is ambiguity in the formal syntax here: anything that '\n'looks like\\n'\n'an expression list also looks like a slice list, so any '\n'subscription\\n'\n'can be interpreted as a slicing. Rather than further '\n'complicating the\\n'\n'syntax, this is disambiguated by defining that in this case the\\n'\n'interpretation as a subscription takes priority over the\\n'\n'interpretation as a slicing (this is the case if the slice list\\n'\n'contains no proper slice).\\n'\n'\\n'\n'The semantics for a slicing are as follows. The primary is '\n'indexed\\n'\n'(using the same \"__getitem__()\" method as normal subscription) '\n'with a\\n'\n'key that is constructed from the slice list, as follows. If the '\n'slice\\n'\n'list contains at least one comma, the key is a tuple containing '\n'the\\n'\n'conversion of the slice items; otherwise, the conversion of the '\n'lone\\n'\n'slice item is the key. The conversion of a slice item that is '\n'an\\n'\n'expression is that expression. The conversion of a proper slice '\n'is a\\n'\n'slice object (see section The standard type hierarchy) whose '\n'\"start\",\\n'\n'\"stop\" and \"step\" attributes are the values of the expressions '\n'given\\n'\n'as lower bound, upper bound and stride, respectively, '\n'substituting\\n'\n'\"None\" for missing expressions.\\n',\n'specialattrs':'Special Attributes\\n'\n'******************\\n'\n'\\n'\n'The implementation adds a few special read-only attributes '\n'to several\\n'\n'object types, where they are relevant. Some of these are '\n'not reported\\n'\n'by the \"dir()\" built-in function.\\n'\n'\\n'\n'object.__dict__\\n'\n'\\n'\n' A dictionary or other mapping object used to store an '\n'object\u2019s\\n'\n' (writable) attributes.\\n'\n'\\n'\n'instance.__class__\\n'\n'\\n'\n' The class to which a class instance belongs.\\n'\n'\\n'\n'class.__bases__\\n'\n'\\n'\n' The tuple of base classes of a class object.\\n'\n'\\n'\n'definition.__name__\\n'\n'\\n'\n' The name of the class, function, method, descriptor, or '\n'generator\\n'\n' instance.\\n'\n'\\n'\n'definition.__qualname__\\n'\n'\\n'\n' The *qualified name* of the class, function, method, '\n'descriptor, or\\n'\n' generator instance.\\n'\n'\\n'\n' New in version 3.3.\\n'\n'\\n'\n'class.__mro__\\n'\n'\\n'\n' This attribute is a tuple of classes that are considered '\n'when\\n'\n' looking for base classes during method resolution.\\n'\n'\\n'\n'class.mro()\\n'\n'\\n'\n' This method can be overridden by a metaclass to customize '\n'the\\n'\n' method resolution order for its instances. It is called '\n'at class\\n'\n' instantiation, and its result is stored in \"__mro__\".\\n'\n'\\n'\n'class.__subclasses__()\\n'\n'\\n'\n' Each class keeps a list of weak references to its '\n'immediate\\n'\n' subclasses. This method returns a list of all those '\n'references\\n'\n' still alive. The list is in definition order. Example:\\n'\n'\\n'\n' >>> int.__subclasses__()\\n'\n\" []\\n\"\n'\\n'\n'-[ Footnotes ]-\\n'\n'\\n'\n'[1] Additional information on these special methods may be '\n'found in\\n'\n' the Python Reference Manual (Basic customization).\\n'\n'\\n'\n'[2] As a consequence, the list \"[1, 2]\" is considered equal '\n'to \"[1.0,\\n'\n' 2.0]\", and similarly for tuples.\\n'\n'\\n'\n'[3] They must have since the parser can\u2019t tell the type of '\n'the\\n'\n' operands.\\n'\n'\\n'\n'[4] Cased characters are those with general category '\n'property being\\n'\n' one of \u201cLu\u201d (Letter, uppercase), \u201cLl\u201d (Letter, '\n'lowercase), or \u201cLt\u201d\\n'\n' (Letter, titlecase).\\n'\n'\\n'\n'[5] To format only a tuple you should therefore provide a '\n'singleton\\n'\n' tuple whose only element is the tuple to be formatted.\\n',\n'specialnames':'Special method names\\n'\n'********************\\n'\n'\\n'\n'A class can implement certain operations that are invoked by '\n'special\\n'\n'syntax (such as arithmetic operations or subscripting and '\n'slicing) by\\n'\n'defining methods with special names. This is Python\u2019s '\n'approach to\\n'\n'*operator overloading*, allowing classes to define their own '\n'behavior\\n'\n'with respect to language operators. For instance, if a '\n'class defines\\n'\n'a method named \"__getitem__()\", and \"x\" is an instance of '\n'this class,\\n'\n'then \"x[i]\" is roughly equivalent to \"type(x).__getitem__(x, '\n'i)\".\\n'\n'Except where mentioned, attempts to execute an operation '\n'raise an\\n'\n'exception when no appropriate method is defined (typically\\n'\n'\"AttributeError\" or \"TypeError\").\\n'\n'\\n'\n'Setting a special method to \"None\" indicates that the '\n'corresponding\\n'\n'operation is not available. For example, if a class sets '\n'\"__iter__()\"\\n'\n'to \"None\", the class is not iterable, so calling \"iter()\" on '\n'its\\n'\n'instances will raise a \"TypeError\" (without falling back to\\n'\n'\"__getitem__()\"). [2]\\n'\n'\\n'\n'When implementing a class that emulates any built-in type, '\n'it is\\n'\n'important that the emulation only be implemented to the '\n'degree that it\\n'\n'makes sense for the object being modelled. For example, '\n'some\\n'\n'sequences may work well with retrieval of individual '\n'elements, but\\n'\n'extracting a slice may not make sense. (One example of this '\n'is the\\n'\n'\"NodeList\" interface in the W3C\u2019s Document Object Model.)\\n'\n'\\n'\n'\\n'\n'Basic customization\\n'\n'===================\\n'\n'\\n'\n'object.__new__(cls[, ...])\\n'\n'\\n'\n' Called to create a new instance of class *cls*. '\n'\"__new__()\" is a\\n'\n' static method (special-cased so you need not declare it '\n'as such)\\n'\n' that takes the class of which an instance was requested '\n'as its\\n'\n' first argument. The remaining arguments are those passed '\n'to the\\n'\n' object constructor expression (the call to the class). '\n'The return\\n'\n' value of \"__new__()\" should be the new object instance '\n'(usually an\\n'\n' instance of *cls*).\\n'\n'\\n'\n' Typical implementations create a new instance of the '\n'class by\\n'\n' invoking the superclass\u2019s \"__new__()\" method using\\n'\n' \"super().__new__(cls[, ...])\" with appropriate arguments '\n'and then\\n'\n' modifying the newly-created instance as necessary before '\n'returning\\n'\n' it.\\n'\n'\\n'\n' If \"__new__()\" is invoked during object construction and '\n'it returns\\n'\n' an instance or subclass of *cls*, then the new '\n'instance\u2019s\\n'\n' \"__init__()\" method will be invoked like \"__init__(self[, '\n'...])\",\\n'\n' where *self* is the new instance and the remaining '\n'arguments are\\n'\n' the same as were passed to the object constructor.\\n'\n'\\n'\n' If \"__new__()\" does not return an instance of *cls*, then '\n'the new\\n'\n' instance\u2019s \"__init__()\" method will not be invoked.\\n'\n'\\n'\n' \"__new__()\" is intended mainly to allow subclasses of '\n'immutable\\n'\n' types (like int, str, or tuple) to customize instance '\n'creation. It\\n'\n' is also commonly overridden in custom metaclasses in '\n'order to\\n'\n' customize class creation.\\n'\n'\\n'\n'object.__init__(self[, ...])\\n'\n'\\n'\n' Called after the instance has been created (by '\n'\"__new__()\"), but\\n'\n' before it is returned to the caller. The arguments are '\n'those\\n'\n' passed to the class constructor expression. If a base '\n'class has an\\n'\n' \"__init__()\" method, the derived class\u2019s \"__init__()\" '\n'method, if\\n'\n' any, must explicitly call it to ensure proper '\n'initialization of the\\n'\n' base class part of the instance; for example:\\n'\n' \"super().__init__([args...])\".\\n'\n'\\n'\n' Because \"__new__()\" and \"__init__()\" work together in '\n'constructing\\n'\n' objects (\"__new__()\" to create it, and \"__init__()\" to '\n'customize\\n'\n' it), no non-\"None\" value may be returned by \"__init__()\"; '\n'doing so\\n'\n' will cause a \"TypeError\" to be raised at runtime.\\n'\n'\\n'\n'object.__del__(self)\\n'\n'\\n'\n' Called when the instance is about to be destroyed. This '\n'is also\\n'\n' called a finalizer or (improperly) a destructor. If a '\n'base class\\n'\n' has a \"__del__()\" method, the derived class\u2019s \"__del__()\" '\n'method,\\n'\n' if any, must explicitly call it to ensure proper deletion '\n'of the\\n'\n' base class part of the instance.\\n'\n'\\n'\n' It is possible (though not recommended!) for the '\n'\"__del__()\" method\\n'\n' to postpone destruction of the instance by creating a new '\n'reference\\n'\n' to it. This is called object *resurrection*. It is\\n'\n' implementation-dependent whether \"__del__()\" is called a '\n'second\\n'\n' time when a resurrected object is about to be destroyed; '\n'the\\n'\n' current *CPython* implementation only calls it once.\\n'\n'\\n'\n' It is not guaranteed that \"__del__()\" methods are called '\n'for\\n'\n' objects that still exist when the interpreter exits.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"del x\" doesn\u2019t directly call \"x.__del__()\" \u2014 the '\n'former\\n'\n' decrements the reference count for \"x\" by one, and the '\n'latter is\\n'\n' only called when \"x\"\u2019s reference count reaches zero.\\n'\n'\\n'\n' **CPython implementation detail:** It is possible for a '\n'reference\\n'\n' cycle to prevent the reference count of an object from '\n'going to\\n'\n' zero. In this case, the cycle will be later detected and '\n'deleted\\n'\n' by the *cyclic garbage collector*. A common cause of '\n'reference\\n'\n' cycles is when an exception has been caught in a local '\n'variable.\\n'\n' The frame\u2019s locals then reference the exception, which '\n'references\\n'\n' its own traceback, which references the locals of all '\n'frames caught\\n'\n' in the traceback.\\n'\n'\\n'\n' See also: Documentation for the \"gc\" module.\\n'\n'\\n'\n' Warning:\\n'\n'\\n'\n' Due to the precarious circumstances under which '\n'\"__del__()\"\\n'\n' methods are invoked, exceptions that occur during their '\n'execution\\n'\n' are ignored, and a warning is printed to \"sys.stderr\" '\n'instead.\\n'\n' In particular:\\n'\n'\\n'\n' * \"__del__()\" can be invoked when arbitrary code is '\n'being\\n'\n' executed, including from any arbitrary thread. If '\n'\"__del__()\"\\n'\n' needs to take a lock or invoke any other blocking '\n'resource, it\\n'\n' may deadlock as the resource may already be taken by '\n'the code\\n'\n' that gets interrupted to execute \"__del__()\".\\n'\n'\\n'\n' * \"__del__()\" can be executed during interpreter '\n'shutdown. As a\\n'\n' consequence, the global variables it needs to access '\n'(including\\n'\n' other modules) may already have been deleted or set '\n'to \"None\".\\n'\n' Python guarantees that globals whose name begins with '\n'a single\\n'\n' underscore are deleted from their module before other '\n'globals\\n'\n' are deleted; if no other references to such globals '\n'exist, this\\n'\n' may help in assuring that imported modules are still '\n'available\\n'\n' at the time when the \"__del__()\" method is called.\\n'\n'\\n'\n'object.__repr__(self)\\n'\n'\\n'\n' Called by the \"repr()\" built-in function to compute the '\n'\u201cofficial\u201d\\n'\n' string representation of an object. If at all possible, '\n'this\\n'\n' should look like a valid Python expression that could be '\n'used to\\n'\n' recreate an object with the same value (given an '\n'appropriate\\n'\n' environment). If this is not possible, a string of the '\n'form\\n'\n' \"<...some useful description...>\" should be returned. The '\n'return\\n'\n' value must be a string object. If a class defines '\n'\"__repr__()\" but\\n'\n' not \"__str__()\", then \"__repr__()\" is also used when an '\n'\u201cinformal\u201d\\n'\n' string representation of instances of that class is '\n'required.\\n'\n'\\n'\n' This is typically used for debugging, so it is important '\n'that the\\n'\n' representation is information-rich and unambiguous.\\n'\n'\\n'\n'object.__str__(self)\\n'\n'\\n'\n' Called by \"str(object)\" and the built-in functions '\n'\"format()\" and\\n'\n' \"print()\" to compute the \u201cinformal\u201d or nicely printable '\n'string\\n'\n' representation of an object. The return value must be a '\n'string\\n'\n' object.\\n'\n'\\n'\n' This method differs from \"object.__repr__()\" in that '\n'there is no\\n'\n' expectation that \"__str__()\" return a valid Python '\n'expression: a\\n'\n' more convenient or concise representation can be used.\\n'\n'\\n'\n' The default implementation defined by the built-in type '\n'\"object\"\\n'\n' calls \"object.__repr__()\".\\n'\n'\\n'\n'object.__bytes__(self)\\n'\n'\\n'\n' Called by bytes to compute a byte-string representation '\n'of an\\n'\n' object. This should return a \"bytes\" object.\\n'\n'\\n'\n'object.__format__(self, format_spec)\\n'\n'\\n'\n' Called by the \"format()\" built-in function, and by '\n'extension,\\n'\n' evaluation of formatted string literals and the '\n'\"str.format()\"\\n'\n' method, to produce a \u201cformatted\u201d string representation of '\n'an\\n'\n' object. The *format_spec* argument is a string that '\n'contains a\\n'\n' description of the formatting options desired. The '\n'interpretation\\n'\n' of the *format_spec* argument is up to the type '\n'implementing\\n'\n' \"__format__()\", however most classes will either '\n'delegate\\n'\n' formatting to one of the built-in types, or use a '\n'similar\\n'\n' formatting option syntax.\\n'\n'\\n'\n' See Format Specification Mini-Language for a description '\n'of the\\n'\n' standard formatting syntax.\\n'\n'\\n'\n' The return value must be a string object.\\n'\n'\\n'\n' Changed in version 3.4: The __format__ method of \"object\" '\n'itself\\n'\n' raises a \"TypeError\" if passed any non-empty string.\\n'\n'\\n'\n' Changed in version 3.7: \"object.__format__(x, \\'\\')\" is '\n'now\\n'\n' equivalent to \"str(x)\" rather than \"format(str(x), '\n'\\'\\')\".\\n'\n'\\n'\n'object.__lt__(self, other)\\n'\n'object.__le__(self, other)\\n'\n'object.__eq__(self, other)\\n'\n'object.__ne__(self, other)\\n'\n'object.__gt__(self, other)\\n'\n'object.__ge__(self, other)\\n'\n'\\n'\n' These are the so-called \u201crich comparison\u201d methods. The\\n'\n' correspondence between operator symbols and method names '\n'is as\\n'\n' follows: \"xy\" calls\\n'\n' \"x.__gt__(y)\", and \"x>=y\" calls \"x.__ge__(y)\".\\n'\n'\\n'\n' A rich comparison method may return the singleton '\n'\"NotImplemented\"\\n'\n' if it does not implement the operation for a given pair '\n'of\\n'\n' arguments. By convention, \"False\" and \"True\" are returned '\n'for a\\n'\n' successful comparison. However, these methods can return '\n'any value,\\n'\n' so if the comparison operator is used in a Boolean '\n'context (e.g.,\\n'\n' in the condition of an \"if\" statement), Python will call '\n'\"bool()\"\\n'\n' on the value to determine if the result is true or '\n'false.\\n'\n'\\n'\n' By default, \"object\" implements \"__eq__()\" by using \"is\", '\n'returning\\n'\n' \"NotImplemented\" in the case of a false comparison: \"True '\n'if x is y\\n'\n' else NotImplemented\". For \"__ne__()\", by default it '\n'delegates to\\n'\n' \"__eq__()\" and inverts the result unless it is '\n'\"NotImplemented\".\\n'\n' There are no other implied relationships among the '\n'comparison\\n'\n' operators or default implementations; for example, the '\n'truth of\\n'\n' \"(x.__hash__\".\\n'\n'\\n'\n' If a class that does not override \"__eq__()\" wishes to '\n'suppress\\n'\n' hash support, it should include \"__hash__ = None\" in the '\n'class\\n'\n' definition. A class which defines its own \"__hash__()\" '\n'that\\n'\n' explicitly raises a \"TypeError\" would be incorrectly '\n'identified as\\n'\n' hashable by an \"isinstance(obj, '\n'collections.abc.Hashable)\" call.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' By default, the \"__hash__()\" values of str and bytes '\n'objects are\\n'\n' \u201csalted\u201d with an unpredictable random value. Although '\n'they\\n'\n' remain constant within an individual Python process, '\n'they are not\\n'\n' predictable between repeated invocations of Python.This '\n'is\\n'\n' intended to provide protection against a '\n'denial-of-service caused\\n'\n' by carefully-chosen inputs that exploit the worst case\\n'\n' performance of a dict insertion, O(n^2) complexity. '\n'See\\n'\n' http://www.ocert.org/advisories/ocert-2011-003.html '\n'for\\n'\n' details.Changing hash values affects the iteration '\n'order of sets.\\n'\n' Python has never made guarantees about this ordering '\n'(and it\\n'\n' typically varies between 32-bit and 64-bit builds).See '\n'also\\n'\n' \"PYTHONHASHSEED\".\\n'\n'\\n'\n' Changed in version 3.3: Hash randomization is enabled by '\n'default.\\n'\n'\\n'\n'object.__bool__(self)\\n'\n'\\n'\n' Called to implement truth value testing and the built-in '\n'operation\\n'\n' \"bool()\"; should return \"False\" or \"True\". When this '\n'method is not\\n'\n' defined, \"__len__()\" is called, if it is defined, and the '\n'object is\\n'\n' considered true if its result is nonzero. If a class '\n'defines\\n'\n' neither \"__len__()\" nor \"__bool__()\", all its instances '\n'are\\n'\n' considered true.\\n'\n'\\n'\n'\\n'\n'Customizing attribute access\\n'\n'============================\\n'\n'\\n'\n'The following methods can be defined to customize the '\n'meaning of\\n'\n'attribute access (use of, assignment to, or deletion of '\n'\"x.name\") for\\n'\n'class instances.\\n'\n'\\n'\n'object.__getattr__(self, name)\\n'\n'\\n'\n' Called when the default attribute access fails with an\\n'\n' \"AttributeError\" (either \"__getattribute__()\" raises an\\n'\n' \"AttributeError\" because *name* is not an instance '\n'attribute or an\\n'\n' attribute in the class tree for \"self\"; or \"__get__()\" of '\n'a *name*\\n'\n' property raises \"AttributeError\"). This method should '\n'either\\n'\n' return the (computed) attribute value or raise an '\n'\"AttributeError\"\\n'\n' exception.\\n'\n'\\n'\n' Note that if the attribute is found through the normal '\n'mechanism,\\n'\n' \"__getattr__()\" is not called. (This is an intentional '\n'asymmetry\\n'\n' between \"__getattr__()\" and \"__setattr__()\".) This is '\n'done both for\\n'\n' efficiency reasons and because otherwise \"__getattr__()\" '\n'would have\\n'\n' no way to access other attributes of the instance. Note '\n'that at\\n'\n' least for instance variables, you can fake total control '\n'by not\\n'\n' inserting any values in the instance attribute dictionary '\n'(but\\n'\n' instead inserting them in another object). See the\\n'\n' \"__getattribute__()\" method below for a way to actually '\n'get total\\n'\n' control over attribute access.\\n'\n'\\n'\n'object.__getattribute__(self, name)\\n'\n'\\n'\n' Called unconditionally to implement attribute accesses '\n'for\\n'\n' instances of the class. If the class also defines '\n'\"__getattr__()\",\\n'\n' the latter will not be called unless \"__getattribute__()\" '\n'either\\n'\n' calls it explicitly or raises an \"AttributeError\". This '\n'method\\n'\n' should return the (computed) attribute value or raise an\\n'\n' \"AttributeError\" exception. In order to avoid infinite '\n'recursion in\\n'\n' this method, its implementation should always call the '\n'base class\\n'\n' method with the same name to access any attributes it '\n'needs, for\\n'\n' example, \"object.__getattribute__(self, name)\".\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' This method may still be bypassed when looking up '\n'special methods\\n'\n' as the result of implicit invocation via language '\n'syntax or\\n'\n' built-in functions. See Special method lookup.\\n'\n'\\n'\n' For certain sensitive attribute accesses, raises an '\n'auditing event\\n'\n' \"object.__getattr__\" with arguments \"obj\" and \"name\".\\n'\n'\\n'\n'object.__setattr__(self, name, value)\\n'\n'\\n'\n' Called when an attribute assignment is attempted. This '\n'is called\\n'\n' instead of the normal mechanism (i.e. store the value in '\n'the\\n'\n' instance dictionary). *name* is the attribute name, '\n'*value* is the\\n'\n' value to be assigned to it.\\n'\n'\\n'\n' If \"__setattr__()\" wants to assign to an instance '\n'attribute, it\\n'\n' should call the base class method with the same name, for '\n'example,\\n'\n' \"object.__setattr__(self, name, value)\".\\n'\n'\\n'\n' For certain sensitive attribute assignments, raises an '\n'auditing\\n'\n' event \"object.__setattr__\" with arguments \"obj\", \"name\", '\n'\"value\".\\n'\n'\\n'\n'object.__delattr__(self, name)\\n'\n'\\n'\n' Like \"__setattr__()\" but for attribute deletion instead '\n'of\\n'\n' assignment. This should only be implemented if \"del '\n'obj.name\" is\\n'\n' meaningful for the object.\\n'\n'\\n'\n' For certain sensitive attribute deletions, raises an '\n'auditing event\\n'\n' \"object.__delattr__\" with arguments \"obj\" and \"name\".\\n'\n'\\n'\n'object.__dir__(self)\\n'\n'\\n'\n' Called when \"dir()\" is called on the object. A sequence '\n'must be\\n'\n' returned. \"dir()\" converts the returned sequence to a '\n'list and\\n'\n' sorts it.\\n'\n'\\n'\n'\\n'\n'Customizing module attribute access\\n'\n'-----------------------------------\\n'\n'\\n'\n'Special names \"__getattr__\" and \"__dir__\" can be also used '\n'to\\n'\n'customize access to module attributes. The \"__getattr__\" '\n'function at\\n'\n'the module level should accept one argument which is the '\n'name of an\\n'\n'attribute and return the computed value or raise an '\n'\"AttributeError\".\\n'\n'If an attribute is not found on a module object through the '\n'normal\\n'\n'lookup, i.e. \"object.__getattribute__()\", then \"__getattr__\" '\n'is\\n'\n'searched in the module \"__dict__\" before raising an '\n'\"AttributeError\".\\n'\n'If found, it is called with the attribute name and the '\n'result is\\n'\n'returned.\\n'\n'\\n'\n'The \"__dir__\" function should accept no arguments, and '\n'return a\\n'\n'sequence of strings that represents the names accessible on '\n'module. If\\n'\n'present, this function overrides the standard \"dir()\" search '\n'on a\\n'\n'module.\\n'\n'\\n'\n'For a more fine grained customization of the module behavior '\n'(setting\\n'\n'attributes, properties, etc.), one can set the \"__class__\" '\n'attribute\\n'\n'of a module object to a subclass of \"types.ModuleType\". For '\n'example:\\n'\n'\\n'\n' import sys\\n'\n' from types import ModuleType\\n'\n'\\n'\n' class VerboseModule(ModuleType):\\n'\n' def __repr__(self):\\n'\n\" return f'Verbose {self.__name__}'\\n\"\n'\\n'\n' def __setattr__(self, attr, value):\\n'\n\" print(f'Setting {attr}...')\\n\"\n' super().__setattr__(attr, value)\\n'\n'\\n'\n' sys.modules[__name__].__class__ = VerboseModule\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Defining module \"__getattr__\" and setting module '\n'\"__class__\" only\\n'\n' affect lookups made using the attribute access syntax \u2013 '\n'directly\\n'\n' accessing the module globals (whether by code within the '\n'module, or\\n'\n' via a reference to the module\u2019s globals dictionary) is '\n'unaffected.\\n'\n'\\n'\n'Changed in version 3.5: \"__class__\" module attribute is now '\n'writable.\\n'\n'\\n'\n'New in version 3.7: \"__getattr__\" and \"__dir__\" module '\n'attributes.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 562** - Module __getattr__ and __dir__\\n'\n' Describes the \"__getattr__\" and \"__dir__\" functions on '\n'modules.\\n'\n'\\n'\n'\\n'\n'Implementing Descriptors\\n'\n'------------------------\\n'\n'\\n'\n'The following methods only apply when an instance of the '\n'class\\n'\n'containing the method (a so-called *descriptor* class) '\n'appears in an\\n'\n'*owner* class (the descriptor must be in either the owner\u2019s '\n'class\\n'\n'dictionary or in the class dictionary for one of its '\n'parents). In the\\n'\n'examples below, \u201cthe attribute\u201d refers to the attribute '\n'whose name is\\n'\n'the key of the property in the owner class\u2019 \"__dict__\".\\n'\n'\\n'\n'object.__get__(self, instance, owner=None)\\n'\n'\\n'\n' Called to get the attribute of the owner class (class '\n'attribute\\n'\n' access) or of an instance of that class (instance '\n'attribute\\n'\n' access). The optional *owner* argument is the owner '\n'class, while\\n'\n' *instance* is the instance that the attribute was '\n'accessed through,\\n'\n' or \"None\" when the attribute is accessed through the '\n'*owner*.\\n'\n'\\n'\n' This method should return the computed attribute value or '\n'raise an\\n'\n' \"AttributeError\" exception.\\n'\n'\\n'\n' **PEP 252** specifies that \"__get__()\" is callable with '\n'one or two\\n'\n' arguments. Python\u2019s own built-in descriptors support '\n'this\\n'\n' specification; however, it is likely that some '\n'third-party tools\\n'\n' have descriptors that require both arguments. Python\u2019s '\n'own\\n'\n' \"__getattribute__()\" implementation always passes in both '\n'arguments\\n'\n' whether they are required or not.\\n'\n'\\n'\n'object.__set__(self, instance, value)\\n'\n'\\n'\n' Called to set the attribute on an instance *instance* of '\n'the owner\\n'\n' class to a new value, *value*.\\n'\n'\\n'\n' Note, adding \"__set__()\" or \"__delete__()\" changes the '\n'kind of\\n'\n' descriptor to a \u201cdata descriptor\u201d. See Invoking '\n'Descriptors for\\n'\n' more details.\\n'\n'\\n'\n'object.__delete__(self, instance)\\n'\n'\\n'\n' Called to delete the attribute on an instance *instance* '\n'of the\\n'\n' owner class.\\n'\n'\\n'\n'object.__set_name__(self, owner, name)\\n'\n'\\n'\n' Called at the time the owning class *owner* is created. '\n'The\\n'\n' descriptor has been assigned to *name*.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"__set_name__()\" is only called implicitly as part of '\n'the \"type\"\\n'\n' constructor, so it will need to be called explicitly '\n'with the\\n'\n' appropriate parameters when a descriptor is added to a '\n'class\\n'\n' after initial creation:\\n'\n'\\n'\n' class A:\\n'\n' pass\\n'\n' descr = custom_descriptor()\\n'\n' A.attr = descr\\n'\n\" descr.__set_name__(A, 'attr')\\n\"\n'\\n'\n' See Creating the class object for more details.\\n'\n'\\n'\n' New in version 3.6.\\n'\n'\\n'\n'The attribute \"__objclass__\" is interpreted by the \"inspect\" '\n'module as\\n'\n'specifying the class where this object was defined (setting '\n'this\\n'\n'appropriately can assist in runtime introspection of dynamic '\n'class\\n'\n'attributes). For callables, it may indicate that an instance '\n'of the\\n'\n'given type (or a subclass) is expected or required as the '\n'first\\n'\n'positional argument (for example, CPython sets this '\n'attribute for\\n'\n'unbound methods that are implemented in C).\\n'\n'\\n'\n'\\n'\n'Invoking Descriptors\\n'\n'--------------------\\n'\n'\\n'\n'In general, a descriptor is an object attribute with '\n'\u201cbinding\\n'\n'behavior\u201d, one whose attribute access has been overridden by '\n'methods\\n'\n'in the descriptor protocol: \"__get__()\", \"__set__()\", and\\n'\n'\"__delete__()\". If any of those methods are defined for an '\n'object, it\\n'\n'is said to be a descriptor.\\n'\n'\\n'\n'The default behavior for attribute access is to get, set, or '\n'delete\\n'\n'the attribute from an object\u2019s dictionary. For instance, '\n'\"a.x\" has a\\n'\n'lookup chain starting with \"a.__dict__[\\'x\\']\", then\\n'\n'\"type(a).__dict__[\\'x\\']\", and continuing through the base '\n'classes of\\n'\n'\"type(a)\" excluding metaclasses.\\n'\n'\\n'\n'However, if the looked-up value is an object defining one of '\n'the\\n'\n'descriptor methods, then Python may override the default '\n'behavior and\\n'\n'invoke the descriptor method instead. Where this occurs in '\n'the\\n'\n'precedence chain depends on which descriptor methods were '\n'defined and\\n'\n'how they were called.\\n'\n'\\n'\n'The starting point for descriptor invocation is a binding, '\n'\"a.x\". How\\n'\n'the arguments are assembled depends on \"a\":\\n'\n'\\n'\n'Direct Call\\n'\n' The simplest and least common call is when user code '\n'directly\\n'\n' invokes a descriptor method: \"x.__get__(a)\".\\n'\n'\\n'\n'Instance Binding\\n'\n' If binding to an object instance, \"a.x\" is transformed '\n'into the\\n'\n' call: \"type(a).__dict__[\\'x\\'].__get__(a, type(a))\".\\n'\n'\\n'\n'Class Binding\\n'\n' If binding to a class, \"A.x\" is transformed into the '\n'call:\\n'\n' \"A.__dict__[\\'x\\'].__get__(None, A)\".\\n'\n'\\n'\n'Super Binding\\n'\n' If \"a\" is an instance of \"super\", then the binding '\n'\"super(B,\\n'\n' obj).m()\" searches \"obj.__class__.__mro__\" for the base '\n'class \"A\"\\n'\n' immediately preceding \"B\" and then invokes the descriptor '\n'with the\\n'\n' call: \"A.__dict__[\\'m\\'].__get__(obj, obj.__class__)\".\\n'\n'\\n'\n'For instance bindings, the precedence of descriptor '\n'invocation depends\\n'\n'on which descriptor methods are defined. A descriptor can '\n'define any\\n'\n'combination of \"__get__()\", \"__set__()\" and \"__delete__()\". '\n'If it\\n'\n'does not define \"__get__()\", then accessing the attribute '\n'will return\\n'\n'the descriptor object itself unless there is a value in the '\n'object\u2019s\\n'\n'instance dictionary. If the descriptor defines \"__set__()\" '\n'and/or\\n'\n'\"__delete__()\", it is a data descriptor; if it defines '\n'neither, it is\\n'\n'a non-data descriptor. Normally, data descriptors define '\n'both\\n'\n'\"__get__()\" and \"__set__()\", while non-data descriptors have '\n'just the\\n'\n'\"__get__()\" method. Data descriptors with \"__get__()\" and '\n'\"__set__()\"\\n'\n'(and/or \"__delete__()\") defined always override a '\n'redefinition in an\\n'\n'instance dictionary. In contrast, non-data descriptors can '\n'be\\n'\n'overridden by instances.\\n'\n'\\n'\n'Python methods (including \"staticmethod()\" and '\n'\"classmethod()\") are\\n'\n'implemented as non-data descriptors. Accordingly, instances '\n'can\\n'\n'redefine and override methods. This allows individual '\n'instances to\\n'\n'acquire behaviors that differ from other instances of the '\n'same class.\\n'\n'\\n'\n'The \"property()\" function is implemented as a data '\n'descriptor.\\n'\n'Accordingly, instances cannot override the behavior of a '\n'property.\\n'\n'\\n'\n'\\n'\n'__slots__\\n'\n'---------\\n'\n'\\n'\n'*__slots__* allow us to explicitly declare data members '\n'(like\\n'\n'properties) and deny the creation of *__dict__* and '\n'*__weakref__*\\n'\n'(unless explicitly declared in *__slots__* or available in a '\n'parent.)\\n'\n'\\n'\n'The space saved over using *__dict__* can be significant. '\n'Attribute\\n'\n'lookup speed can be significantly improved as well.\\n'\n'\\n'\n'object.__slots__\\n'\n'\\n'\n' This class variable can be assigned a string, iterable, '\n'or sequence\\n'\n' of strings with variable names used by instances. '\n'*__slots__*\\n'\n' reserves space for the declared variables and prevents '\n'the\\n'\n' automatic creation of *__dict__* and *__weakref__* for '\n'each\\n'\n' instance.\\n'\n'\\n'\n'\\n'\n'Notes on using *__slots__*\\n'\n'~~~~~~~~~~~~~~~~~~~~~~~~~~\\n'\n'\\n'\n'* When inheriting from a class without *__slots__*, the '\n'*__dict__* and\\n'\n' *__weakref__* attribute of the instances will always be '\n'accessible.\\n'\n'\\n'\n'* Without a *__dict__* variable, instances cannot be '\n'assigned new\\n'\n' variables not listed in the *__slots__* definition. '\n'Attempts to\\n'\n' assign to an unlisted variable name raises '\n'\"AttributeError\". If\\n'\n' dynamic assignment of new variables is desired, then add\\n'\n' \"\\'__dict__\\'\" to the sequence of strings in the '\n'*__slots__*\\n'\n' declaration.\\n'\n'\\n'\n'* Without a *__weakref__* variable for each instance, '\n'classes defining\\n'\n' *__slots__* do not support weak references to its '\n'instances. If weak\\n'\n' reference support is needed, then add \"\\'__weakref__\\'\" to '\n'the\\n'\n' sequence of strings in the *__slots__* declaration.\\n'\n'\\n'\n'* *__slots__* are implemented at the class level by '\n'creating\\n'\n' descriptors (Implementing Descriptors) for each variable '\n'name. As a\\n'\n' result, class attributes cannot be used to set default '\n'values for\\n'\n' instance variables defined by *__slots__*; otherwise, the '\n'class\\n'\n' attribute would overwrite the descriptor assignment.\\n'\n'\\n'\n'* The action of a *__slots__* declaration is not limited to '\n'the class\\n'\n' where it is defined. *__slots__* declared in parents are '\n'available\\n'\n' in child classes. However, child subclasses will get a '\n'*__dict__*\\n'\n' and *__weakref__* unless they also define *__slots__* '\n'(which should\\n'\n' only contain names of any *additional* slots).\\n'\n'\\n'\n'* If a class defines a slot also defined in a base class, '\n'the instance\\n'\n' variable defined by the base class slot is inaccessible '\n'(except by\\n'\n' retrieving its descriptor directly from the base class). '\n'This\\n'\n' renders the meaning of the program undefined. In the '\n'future, a\\n'\n' check may be added to prevent this.\\n'\n'\\n'\n'* Nonempty *__slots__* does not work for classes derived '\n'from\\n'\n' \u201cvariable-length\u201d built-in types such as \"int\", \"bytes\" '\n'and \"tuple\".\\n'\n'\\n'\n'* Any non-string iterable may be assigned to *__slots__*. '\n'Mappings may\\n'\n' also be used; however, in the future, special meaning may '\n'be\\n'\n' assigned to the values corresponding to each key.\\n'\n'\\n'\n'* *__class__* assignment works only if both classes have the '\n'same\\n'\n' *__slots__*.\\n'\n'\\n'\n'* Multiple inheritance with multiple slotted parent classes '\n'can be\\n'\n' used, but only one parent is allowed to have attributes '\n'created by\\n'\n' slots (the other bases must have empty slot layouts) - '\n'violations\\n'\n' raise \"TypeError\".\\n'\n'\\n'\n'* If an iterator is used for *__slots__* then a descriptor '\n'is created\\n'\n' for each of the iterator\u2019s values. However, the '\n'*__slots__*\\n'\n' attribute will be an empty iterator.\\n'\n'\\n'\n'\\n'\n'Customizing class creation\\n'\n'==========================\\n'\n'\\n'\n'Whenever a class inherits from another class, '\n'*__init_subclass__* is\\n'\n'called on that class. This way, it is possible to write '\n'classes which\\n'\n'change the behavior of subclasses. This is closely related '\n'to class\\n'\n'decorators, but where class decorators only affect the '\n'specific class\\n'\n'they\u2019re applied to, \"__init_subclass__\" solely applies to '\n'future\\n'\n'subclasses of the class defining the method.\\n'\n'\\n'\n'classmethod object.__init_subclass__(cls)\\n'\n'\\n'\n' This method is called whenever the containing class is '\n'subclassed.\\n'\n' *cls* is then the new subclass. If defined as a normal '\n'instance\\n'\n' method, this method is implicitly converted to a class '\n'method.\\n'\n'\\n'\n' Keyword arguments which are given to a new class are '\n'passed to the\\n'\n' parent\u2019s class \"__init_subclass__\". For compatibility '\n'with other\\n'\n' classes using \"__init_subclass__\", one should take out '\n'the needed\\n'\n' keyword arguments and pass the others over to the base '\n'class, as\\n'\n' in:\\n'\n'\\n'\n' class Philosopher:\\n'\n' def __init_subclass__(cls, /, default_name, '\n'**kwargs):\\n'\n' super().__init_subclass__(**kwargs)\\n'\n' cls.default_name = default_name\\n'\n'\\n'\n' class AustralianPhilosopher(Philosopher, '\n'default_name=\"Bruce\"):\\n'\n' pass\\n'\n'\\n'\n' The default implementation \"object.__init_subclass__\" '\n'does nothing,\\n'\n' but raises an error if it is called with any arguments.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The metaclass hint \"metaclass\" is consumed by the rest '\n'of the\\n'\n' type machinery, and is never passed to '\n'\"__init_subclass__\"\\n'\n' implementations. The actual metaclass (rather than the '\n'explicit\\n'\n' hint) can be accessed as \"type(cls)\".\\n'\n'\\n'\n' New in version 3.6.\\n'\n'\\n'\n'\\n'\n'Metaclasses\\n'\n'-----------\\n'\n'\\n'\n'By default, classes are constructed using \"type()\". The '\n'class body is\\n'\n'executed in a new namespace and the class name is bound '\n'locally to the\\n'\n'result of \"type(name, bases, namespace)\".\\n'\n'\\n'\n'The class creation process can be customized by passing the\\n'\n'\"metaclass\" keyword argument in the class definition line, '\n'or by\\n'\n'inheriting from an existing class that included such an '\n'argument. In\\n'\n'the following example, both \"MyClass\" and \"MySubclass\" are '\n'instances\\n'\n'of \"Meta\":\\n'\n'\\n'\n' class Meta(type):\\n'\n' pass\\n'\n'\\n'\n' class MyClass(metaclass=Meta):\\n'\n' pass\\n'\n'\\n'\n' class MySubclass(MyClass):\\n'\n' pass\\n'\n'\\n'\n'Any other keyword arguments that are specified in the class '\n'definition\\n'\n'are passed through to all metaclass operations described '\n'below.\\n'\n'\\n'\n'When a class definition is executed, the following steps '\n'occur:\\n'\n'\\n'\n'* MRO entries are resolved;\\n'\n'\\n'\n'* the appropriate metaclass is determined;\\n'\n'\\n'\n'* the class namespace is prepared;\\n'\n'\\n'\n'* the class body is executed;\\n'\n'\\n'\n'* the class object is created.\\n'\n'\\n'\n'\\n'\n'Resolving MRO entries\\n'\n'---------------------\\n'\n'\\n'\n'If a base that appears in class definition is not an '\n'instance of\\n'\n'\"type\", then an \"__mro_entries__\" method is searched on it. '\n'If found,\\n'\n'it is called with the original bases tuple. This method must '\n'return a\\n'\n'tuple of classes that will be used instead of this base. The '\n'tuple may\\n'\n'be empty, in such case the original base is ignored.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 560** - Core support for typing module and generic '\n'types\\n'\n'\\n'\n'\\n'\n'Determining the appropriate metaclass\\n'\n'-------------------------------------\\n'\n'\\n'\n'The appropriate metaclass for a class definition is '\n'determined as\\n'\n'follows:\\n'\n'\\n'\n'* if no bases and no explicit metaclass are given, then '\n'\"type()\" is\\n'\n' used;\\n'\n'\\n'\n'* if an explicit metaclass is given and it is *not* an '\n'instance of\\n'\n' \"type()\", then it is used directly as the metaclass;\\n'\n'\\n'\n'* if an instance of \"type()\" is given as the explicit '\n'metaclass, or\\n'\n' bases are defined, then the most derived metaclass is '\n'used.\\n'\n'\\n'\n'The most derived metaclass is selected from the explicitly '\n'specified\\n'\n'metaclass (if any) and the metaclasses (i.e. \"type(cls)\") of '\n'all\\n'\n'specified base classes. The most derived metaclass is one '\n'which is a\\n'\n'subtype of *all* of these candidate metaclasses. If none of '\n'the\\n'\n'candidate metaclasses meets that criterion, then the class '\n'definition\\n'\n'will fail with \"TypeError\".\\n'\n'\\n'\n'\\n'\n'Preparing the class namespace\\n'\n'-----------------------------\\n'\n'\\n'\n'Once the appropriate metaclass has been identified, then the '\n'class\\n'\n'namespace is prepared. If the metaclass has a \"__prepare__\" '\n'attribute,\\n'\n'it is called as \"namespace = metaclass.__prepare__(name, '\n'bases,\\n'\n'**kwds)\" (where the additional keyword arguments, if any, '\n'come from\\n'\n'the class definition). The \"__prepare__\" method should be '\n'implemented\\n'\n'as a \"classmethod()\". The namespace returned by '\n'\"__prepare__\" is\\n'\n'passed in to \"__new__\", but when the final class object is '\n'created the\\n'\n'namespace is copied into a new \"dict\".\\n'\n'\\n'\n'If the metaclass has no \"__prepare__\" attribute, then the '\n'class\\n'\n'namespace is initialised as an empty ordered mapping.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3115** - Metaclasses in Python 3000\\n'\n' Introduced the \"__prepare__\" namespace hook\\n'\n'\\n'\n'\\n'\n'Executing the class body\\n'\n'------------------------\\n'\n'\\n'\n'The class body is executed (approximately) as \"exec(body, '\n'globals(),\\n'\n'namespace)\". The key difference from a normal call to '\n'\"exec()\" is that\\n'\n'lexical scoping allows the class body (including any '\n'methods) to\\n'\n'reference names from the current and outer scopes when the '\n'class\\n'\n'definition occurs inside a function.\\n'\n'\\n'\n'However, even when the class definition occurs inside the '\n'function,\\n'\n'methods defined inside the class still cannot see names '\n'defined at the\\n'\n'class scope. Class variables must be accessed through the '\n'first\\n'\n'parameter of instance or class methods, or through the '\n'implicit\\n'\n'lexically scoped \"__class__\" reference described in the next '\n'section.\\n'\n'\\n'\n'\\n'\n'Creating the class object\\n'\n'-------------------------\\n'\n'\\n'\n'Once the class namespace has been populated by executing the '\n'class\\n'\n'body, the class object is created by calling '\n'\"metaclass(name, bases,\\n'\n'namespace, **kwds)\" (the additional keywords passed here are '\n'the same\\n'\n'as those passed to \"__prepare__\").\\n'\n'\\n'\n'This class object is the one that will be referenced by the '\n'zero-\\n'\n'argument form of \"super()\". \"__class__\" is an implicit '\n'closure\\n'\n'reference created by the compiler if any methods in a class '\n'body refer\\n'\n'to either \"__class__\" or \"super\". This allows the zero '\n'argument form\\n'\n'of \"super()\" to correctly identify the class being defined '\n'based on\\n'\n'lexical scoping, while the class or instance that was used '\n'to make the\\n'\n'current call is identified based on the first argument '\n'passed to the\\n'\n'method.\\n'\n'\\n'\n'**CPython implementation detail:** In CPython 3.6 and later, '\n'the\\n'\n'\"__class__\" cell is passed to the metaclass as a '\n'\"__classcell__\" entry\\n'\n'in the class namespace. If present, this must be propagated '\n'up to the\\n'\n'\"type.__new__\" call in order for the class to be '\n'initialised\\n'\n'correctly. Failing to do so will result in a \"RuntimeError\" '\n'in Python\\n'\n'3.8.\\n'\n'\\n'\n'When using the default metaclass \"type\", or any metaclass '\n'that\\n'\n'ultimately calls \"type.__new__\", the following additional\\n'\n'customisation steps are invoked after creating the class '\n'object:\\n'\n'\\n'\n'* first, \"type.__new__\" collects all of the descriptors in '\n'the class\\n'\n' namespace that define a \"__set_name__()\" method;\\n'\n'\\n'\n'* second, all of these \"__set_name__\" methods are called '\n'with the\\n'\n' class being defined and the assigned name of that '\n'particular\\n'\n' descriptor;\\n'\n'\\n'\n'* finally, the \"__init_subclass__()\" hook is called on the '\n'immediate\\n'\n' parent of the new class in its method resolution order.\\n'\n'\\n'\n'After the class object is created, it is passed to the '\n'class\\n'\n'decorators included in the class definition (if any) and the '\n'resulting\\n'\n'object is bound in the local namespace as the defined '\n'class.\\n'\n'\\n'\n'When a new class is created by \"type.__new__\", the object '\n'provided as\\n'\n'the namespace parameter is copied to a new ordered mapping '\n'and the\\n'\n'original object is discarded. The new copy is wrapped in a '\n'read-only\\n'\n'proxy, which becomes the \"__dict__\" attribute of the class '\n'object.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3135** - New super\\n'\n' Describes the implicit \"__class__\" closure reference\\n'\n'\\n'\n'\\n'\n'Uses for metaclasses\\n'\n'--------------------\\n'\n'\\n'\n'The potential uses for metaclasses are boundless. Some ideas '\n'that have\\n'\n'been explored include enum, logging, interface checking, '\n'automatic\\n'\n'delegation, automatic property creation, proxies, '\n'frameworks, and\\n'\n'automatic resource locking/synchronization.\\n'\n'\\n'\n'\\n'\n'Customizing instance and subclass checks\\n'\n'========================================\\n'\n'\\n'\n'The following methods are used to override the default '\n'behavior of the\\n'\n'\"isinstance()\" and \"issubclass()\" built-in functions.\\n'\n'\\n'\n'In particular, the metaclass \"abc.ABCMeta\" implements these '\n'methods in\\n'\n'order to allow the addition of Abstract Base Classes (ABCs) '\n'as\\n'\n'\u201cvirtual base classes\u201d to any class or type (including '\n'built-in\\n'\n'types), including other ABCs.\\n'\n'\\n'\n'class.__instancecheck__(self, instance)\\n'\n'\\n'\n' Return true if *instance* should be considered a (direct '\n'or\\n'\n' indirect) instance of *class*. If defined, called to '\n'implement\\n'\n' \"isinstance(instance, class)\".\\n'\n'\\n'\n'class.__subclasscheck__(self, subclass)\\n'\n'\\n'\n' Return true if *subclass* should be considered a (direct '\n'or\\n'\n' indirect) subclass of *class*. If defined, called to '\n'implement\\n'\n' \"issubclass(subclass, class)\".\\n'\n'\\n'\n'Note that these methods are looked up on the type '\n'(metaclass) of a\\n'\n'class. They cannot be defined as class methods in the '\n'actual class.\\n'\n'This is consistent with the lookup of special methods that '\n'are called\\n'\n'on instances, only in this case the instance is itself a '\n'class.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 3119** - Introducing Abstract Base Classes\\n'\n' Includes the specification for customizing '\n'\"isinstance()\" and\\n'\n' \"issubclass()\" behavior through \"__instancecheck__()\" '\n'and\\n'\n' \"__subclasscheck__()\", with motivation for this '\n'functionality in\\n'\n' the context of adding Abstract Base Classes (see the '\n'\"abc\"\\n'\n' module) to the language.\\n'\n'\\n'\n'\\n'\n'Emulating generic types\\n'\n'=======================\\n'\n'\\n'\n'One can implement the generic class syntax as specified by '\n'**PEP 484**\\n'\n'(for example \"List[int]\") by defining a special method:\\n'\n'\\n'\n'classmethod object.__class_getitem__(cls, key)\\n'\n'\\n'\n' Return an object representing the specialization of a '\n'generic class\\n'\n' by type arguments found in *key*.\\n'\n'\\n'\n'This method is looked up on the class object itself, and '\n'when defined\\n'\n'in the class body, this method is implicitly a class '\n'method. Note,\\n'\n'this mechanism is primarily reserved for use with static '\n'type hints,\\n'\n'other usage is discouraged.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 560** - Core support for typing module and generic '\n'types\\n'\n'\\n'\n'\\n'\n'Emulating callable objects\\n'\n'==========================\\n'\n'\\n'\n'object.__call__(self[, args...])\\n'\n'\\n'\n' Called when the instance is \u201ccalled\u201d as a function; if '\n'this method\\n'\n' is defined, \"x(arg1, arg2, ...)\" roughly translates to\\n'\n' \"type(x).__call__(x, arg1, ...)\".\\n'\n'\\n'\n'\\n'\n'Emulating container types\\n'\n'=========================\\n'\n'\\n'\n'The following methods can be defined to implement container '\n'objects.\\n'\n'Containers usually are sequences (such as lists or tuples) '\n'or mappings\\n'\n'(like dictionaries), but can represent other containers as '\n'well. The\\n'\n'first set of methods is used either to emulate a sequence or '\n'to\\n'\n'emulate a mapping; the difference is that for a sequence, '\n'the\\n'\n'allowable keys should be the integers *k* for which \"0 <= k '\n'< N\" where\\n'\n'*N* is the length of the sequence, or slice objects, which '\n'define a\\n'\n'range of items. It is also recommended that mappings '\n'provide the\\n'\n'methods \"keys()\", \"values()\", \"items()\", \"get()\", '\n'\"clear()\",\\n'\n'\"setdefault()\", \"pop()\", \"popitem()\", \"copy()\", and '\n'\"update()\"\\n'\n'behaving similar to those for Python\u2019s standard dictionary '\n'objects.\\n'\n'The \"collections.abc\" module provides a \"MutableMapping\" '\n'abstract base\\n'\n'class to help create those methods from a base set of '\n'\"__getitem__()\",\\n'\n'\"__setitem__()\", \"__delitem__()\", and \"keys()\". Mutable '\n'sequences\\n'\n'should provide methods \"append()\", \"count()\", \"index()\", '\n'\"extend()\",\\n'\n'\"insert()\", \"pop()\", \"remove()\", \"reverse()\" and \"sort()\", '\n'like Python\\n'\n'standard list objects. Finally, sequence types should '\n'implement\\n'\n'addition (meaning concatenation) and multiplication '\n'(meaning\\n'\n'repetition) by defining the methods \"__add__()\", '\n'\"__radd__()\",\\n'\n'\"__iadd__()\", \"__mul__()\", \"__rmul__()\" and \"__imul__()\" '\n'described\\n'\n'below; they should not define other numerical operators. It '\n'is\\n'\n'recommended that both mappings and sequences implement the\\n'\n'\"__contains__()\" method to allow efficient use of the \"in\" '\n'operator;\\n'\n'for mappings, \"in\" should search the mapping\u2019s keys; for '\n'sequences, it\\n'\n'should search through the values. It is further recommended '\n'that both\\n'\n'mappings and sequences implement the \"__iter__()\" method to '\n'allow\\n'\n'efficient iteration through the container; for mappings, '\n'\"__iter__()\"\\n'\n'should iterate through the object\u2019s keys; for sequences, it '\n'should\\n'\n'iterate through the values.\\n'\n'\\n'\n'object.__len__(self)\\n'\n'\\n'\n' Called to implement the built-in function \"len()\". '\n'Should return\\n'\n' the length of the object, an integer \">=\" 0. Also, an '\n'object that\\n'\n' doesn\u2019t define a \"__bool__()\" method and whose '\n'\"__len__()\" method\\n'\n' returns zero is considered to be false in a Boolean '\n'context.\\n'\n'\\n'\n' **CPython implementation detail:** In CPython, the length '\n'is\\n'\n' required to be at most \"sys.maxsize\". If the length is '\n'larger than\\n'\n' \"sys.maxsize\" some features (such as \"len()\") may raise\\n'\n' \"OverflowError\". To prevent raising \"OverflowError\" by '\n'truth value\\n'\n' testing, an object must define a \"__bool__()\" method.\\n'\n'\\n'\n'object.__length_hint__(self)\\n'\n'\\n'\n' Called to implement \"operator.length_hint()\". Should '\n'return an\\n'\n' estimated length for the object (which may be greater or '\n'less than\\n'\n' the actual length). The length must be an integer \">=\" 0. '\n'The\\n'\n' return value may also be \"NotImplemented\", which is '\n'treated the\\n'\n' same as if the \"__length_hint__\" method didn\u2019t exist at '\n'all. This\\n'\n' method is purely an optimization and is never required '\n'for\\n'\n' correctness.\\n'\n'\\n'\n' New in version 3.4.\\n'\n'\\n'\n'Note:\\n'\n'\\n'\n' Slicing is done exclusively with the following three '\n'methods. A\\n'\n' call like\\n'\n'\\n'\n' a[1:2] = b\\n'\n'\\n'\n' is translated to\\n'\n'\\n'\n' a[slice(1, 2, None)] = b\\n'\n'\\n'\n' and so forth. Missing slice items are always filled in '\n'with \"None\".\\n'\n'\\n'\n'object.__getitem__(self, key)\\n'\n'\\n'\n' Called to implement evaluation of \"self[key]\". For '\n'sequence types,\\n'\n' the accepted keys should be integers and slice objects. '\n'Note that\\n'\n' the special interpretation of negative indexes (if the '\n'class wishes\\n'\n' to emulate a sequence type) is up to the \"__getitem__()\" '\n'method. If\\n'\n' *key* is of an inappropriate type, \"TypeError\" may be '\n'raised; if of\\n'\n' a value outside the set of indexes for the sequence '\n'(after any\\n'\n' special interpretation of negative values), \"IndexError\" '\n'should be\\n'\n' raised. For mapping types, if *key* is missing (not in '\n'the\\n'\n' container), \"KeyError\" should be raised.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' \"for\" loops expect that an \"IndexError\" will be raised '\n'for\\n'\n' illegal indexes to allow proper detection of the end of '\n'the\\n'\n' sequence.\\n'\n'\\n'\n'object.__setitem__(self, key, value)\\n'\n'\\n'\n' Called to implement assignment to \"self[key]\". Same note '\n'as for\\n'\n' \"__getitem__()\". This should only be implemented for '\n'mappings if\\n'\n' the objects support changes to the values for keys, or if '\n'new keys\\n'\n' can be added, or for sequences if elements can be '\n'replaced. The\\n'\n' same exceptions should be raised for improper *key* '\n'values as for\\n'\n' the \"__getitem__()\" method.\\n'\n'\\n'\n'object.__delitem__(self, key)\\n'\n'\\n'\n' Called to implement deletion of \"self[key]\". Same note '\n'as for\\n'\n' \"__getitem__()\". This should only be implemented for '\n'mappings if\\n'\n' the objects support removal of keys, or for sequences if '\n'elements\\n'\n' can be removed from the sequence. The same exceptions '\n'should be\\n'\n' raised for improper *key* values as for the '\n'\"__getitem__()\" method.\\n'\n'\\n'\n'object.__missing__(self, key)\\n'\n'\\n'\n' Called by \"dict\".\"__getitem__()\" to implement \"self[key]\" '\n'for dict\\n'\n' subclasses when key is not in the dictionary.\\n'\n'\\n'\n'object.__iter__(self)\\n'\n'\\n'\n' This method is called when an iterator is required for a '\n'container.\\n'\n' This method should return a new iterator object that can '\n'iterate\\n'\n' over all the objects in the container. For mappings, it '\n'should\\n'\n' iterate over the keys of the container.\\n'\n'\\n'\n' Iterator objects also need to implement this method; they '\n'are\\n'\n' required to return themselves. For more information on '\n'iterator\\n'\n' objects, see Iterator Types.\\n'\n'\\n'\n'object.__reversed__(self)\\n'\n'\\n'\n' Called (if present) by the \"reversed()\" built-in to '\n'implement\\n'\n' reverse iteration. It should return a new iterator '\n'object that\\n'\n' iterates over all the objects in the container in reverse '\n'order.\\n'\n'\\n'\n' If the \"__reversed__()\" method is not provided, the '\n'\"reversed()\"\\n'\n' built-in will fall back to using the sequence protocol '\n'(\"__len__()\"\\n'\n' and \"__getitem__()\"). Objects that support the sequence '\n'protocol\\n'\n' should only provide \"__reversed__()\" if they can provide '\n'an\\n'\n' implementation that is more efficient than the one '\n'provided by\\n'\n' \"reversed()\".\\n'\n'\\n'\n'The membership test operators (\"in\" and \"not in\") are '\n'normally\\n'\n'implemented as an iteration through a container. However, '\n'container\\n'\n'objects can supply the following special method with a more '\n'efficient\\n'\n'implementation, which also does not require the object be '\n'iterable.\\n'\n'\\n'\n'object.__contains__(self, item)\\n'\n'\\n'\n' Called to implement membership test operators. Should '\n'return true\\n'\n' if *item* is in *self*, false otherwise. For mapping '\n'objects, this\\n'\n' should consider the keys of the mapping rather than the '\n'values or\\n'\n' the key-item pairs.\\n'\n'\\n'\n' For objects that don\u2019t define \"__contains__()\", the '\n'membership test\\n'\n' first tries iteration via \"__iter__()\", then the old '\n'sequence\\n'\n' iteration protocol via \"__getitem__()\", see this section '\n'in the\\n'\n' language reference.\\n'\n'\\n'\n'\\n'\n'Emulating numeric types\\n'\n'=======================\\n'\n'\\n'\n'The following methods can be defined to emulate numeric '\n'objects.\\n'\n'Methods corresponding to operations that are not supported '\n'by the\\n'\n'particular kind of number implemented (e.g., bitwise '\n'operations for\\n'\n'non-integral numbers) should be left undefined.\\n'\n'\\n'\n'object.__add__(self, other)\\n'\n'object.__sub__(self, other)\\n'\n'object.__mul__(self, other)\\n'\n'object.__matmul__(self, other)\\n'\n'object.__truediv__(self, other)\\n'\n'object.__floordiv__(self, other)\\n'\n'object.__mod__(self, other)\\n'\n'object.__divmod__(self, other)\\n'\n'object.__pow__(self, other[, modulo])\\n'\n'object.__lshift__(self, other)\\n'\n'object.__rshift__(self, other)\\n'\n'object.__and__(self, other)\\n'\n'object.__xor__(self, other)\\n'\n'object.__or__(self, other)\\n'\n'\\n'\n' These methods are called to implement the binary '\n'arithmetic\\n'\n' operations (\"+\", \"-\", \"*\", \"@\", \"/\", \"//\", \"%\", '\n'\"divmod()\",\\n'\n' \"pow()\", \"**\", \"<<\", \">>\", \"&\", \"^\", \"|\"). For instance, '\n'to\\n'\n' evaluate the expression \"x + y\", where *x* is an instance '\n'of a\\n'\n' class that has an \"__add__()\" method, \"x.__add__(y)\" is '\n'called.\\n'\n' The \"__divmod__()\" method should be the equivalent to '\n'using\\n'\n' \"__floordiv__()\" and \"__mod__()\"; it should not be '\n'related to\\n'\n' \"__truediv__()\". Note that \"__pow__()\" should be defined '\n'to accept\\n'\n' an optional third argument if the ternary version of the '\n'built-in\\n'\n' \"pow()\" function is to be supported.\\n'\n'\\n'\n' If one of those methods does not support the operation '\n'with the\\n'\n' supplied arguments, it should return \"NotImplemented\".\\n'\n'\\n'\n'object.__radd__(self, other)\\n'\n'object.__rsub__(self, other)\\n'\n'object.__rmul__(self, other)\\n'\n'object.__rmatmul__(self, other)\\n'\n'object.__rtruediv__(self, other)\\n'\n'object.__rfloordiv__(self, other)\\n'\n'object.__rmod__(self, other)\\n'\n'object.__rdivmod__(self, other)\\n'\n'object.__rpow__(self, other[, modulo])\\n'\n'object.__rlshift__(self, other)\\n'\n'object.__rrshift__(self, other)\\n'\n'object.__rand__(self, other)\\n'\n'object.__rxor__(self, other)\\n'\n'object.__ror__(self, other)\\n'\n'\\n'\n' These methods are called to implement the binary '\n'arithmetic\\n'\n' operations (\"+\", \"-\", \"*\", \"@\", \"/\", \"//\", \"%\", '\n'\"divmod()\",\\n'\n' \"pow()\", \"**\", \"<<\", \">>\", \"&\", \"^\", \"|\") with reflected '\n'(swapped)\\n'\n' operands. These functions are only called if the left '\n'operand does\\n'\n' not support the corresponding operation [3] and the '\n'operands are of\\n'\n' different types. [4] For instance, to evaluate the '\n'expression \"x -\\n'\n' y\", where *y* is an instance of a class that has an '\n'\"__rsub__()\"\\n'\n' method, \"y.__rsub__(x)\" is called if \"x.__sub__(y)\" '\n'returns\\n'\n' *NotImplemented*.\\n'\n'\\n'\n' Note that ternary \"pow()\" will not try calling '\n'\"__rpow__()\" (the\\n'\n' coercion rules would become too complicated).\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' If the right operand\u2019s type is a subclass of the left '\n'operand\u2019s\\n'\n' type and that subclass provides a different '\n'implementation of the\\n'\n' reflected method for the operation, this method will be '\n'called\\n'\n' before the left operand\u2019s non-reflected method. This '\n'behavior\\n'\n' allows subclasses to override their ancestors\u2019 '\n'operations.\\n'\n'\\n'\n'object.__iadd__(self, other)\\n'\n'object.__isub__(self, other)\\n'\n'object.__imul__(self, other)\\n'\n'object.__imatmul__(self, other)\\n'\n'object.__itruediv__(self, other)\\n'\n'object.__ifloordiv__(self, other)\\n'\n'object.__imod__(self, other)\\n'\n'object.__ipow__(self, other[, modulo])\\n'\n'object.__ilshift__(self, other)\\n'\n'object.__irshift__(self, other)\\n'\n'object.__iand__(self, other)\\n'\n'object.__ixor__(self, other)\\n'\n'object.__ior__(self, other)\\n'\n'\\n'\n' These methods are called to implement the augmented '\n'arithmetic\\n'\n' assignments (\"+=\", \"-=\", \"*=\", \"@=\", \"/=\", \"//=\", \"%=\", '\n'\"**=\",\\n'\n' \"<<=\", \">>=\", \"&=\", \"^=\", \"|=\"). These methods should '\n'attempt to\\n'\n' do the operation in-place (modifying *self*) and return '\n'the result\\n'\n' (which could be, but does not have to be, *self*). If a '\n'specific\\n'\n' method is not defined, the augmented assignment falls '\n'back to the\\n'\n' normal methods. For instance, if *x* is an instance of a '\n'class\\n'\n' with an \"__iadd__()\" method, \"x += y\" is equivalent to \"x '\n'=\\n'\n' x.__iadd__(y)\" . Otherwise, \"x.__add__(y)\" and '\n'\"y.__radd__(x)\" are\\n'\n' considered, as with the evaluation of \"x + y\". In '\n'certain\\n'\n' situations, augmented assignment can result in unexpected '\n'errors\\n'\n' (see Why does a_tuple[i] += [\u2018item\u2019] raise an exception '\n'when the\\n'\n' addition works?), but this behavior is in fact part of '\n'the data\\n'\n' model.\\n'\n'\\n'\n'object.__neg__(self)\\n'\n'object.__pos__(self)\\n'\n'object.__abs__(self)\\n'\n'object.__invert__(self)\\n'\n'\\n'\n' Called to implement the unary arithmetic operations (\"-\", '\n'\"+\",\\n'\n' \"abs()\" and \"~\").\\n'\n'\\n'\n'object.__complex__(self)\\n'\n'object.__int__(self)\\n'\n'object.__float__(self)\\n'\n'\\n'\n' Called to implement the built-in functions \"complex()\", '\n'\"int()\" and\\n'\n' \"float()\". Should return a value of the appropriate '\n'type.\\n'\n'\\n'\n'object.__index__(self)\\n'\n'\\n'\n' Called to implement \"operator.index()\", and whenever '\n'Python needs\\n'\n' to losslessly convert the numeric object to an integer '\n'object (such\\n'\n' as in slicing, or in the built-in \"bin()\", \"hex()\" and '\n'\"oct()\"\\n'\n' functions). Presence of this method indicates that the '\n'numeric\\n'\n' object is an integer type. Must return an integer.\\n'\n'\\n'\n' If \"__int__()\", \"__float__()\" and \"__complex__()\" are not '\n'defined\\n'\n' then corresponding built-in functions \"int()\", \"float()\" '\n'and\\n'\n' \"complex()\" fall back to \"__index__()\".\\n'\n'\\n'\n'object.__round__(self[, ndigits])\\n'\n'object.__trunc__(self)\\n'\n'object.__floor__(self)\\n'\n'object.__ceil__(self)\\n'\n'\\n'\n' Called to implement the built-in function \"round()\" and '\n'\"math\"\\n'\n' functions \"trunc()\", \"floor()\" and \"ceil()\". Unless '\n'*ndigits* is\\n'\n' passed to \"__round__()\" all these methods should return '\n'the value\\n'\n' of the object truncated to an \"Integral\" (typically an '\n'\"int\").\\n'\n'\\n'\n' If \"__int__()\" is not defined then the built-in function '\n'\"int()\"\\n'\n' falls back to \"__trunc__()\".\\n'\n'\\n'\n'\\n'\n'With Statement Context Managers\\n'\n'===============================\\n'\n'\\n'\n'A *context manager* is an object that defines the runtime '\n'context to\\n'\n'be established when executing a \"with\" statement. The '\n'context manager\\n'\n'handles the entry into, and the exit from, the desired '\n'runtime context\\n'\n'for the execution of the block of code. Context managers '\n'are normally\\n'\n'invoked using the \"with\" statement (described in section The '\n'with\\n'\n'statement), but can also be used by directly invoking their '\n'methods.\\n'\n'\\n'\n'Typical uses of context managers include saving and '\n'restoring various\\n'\n'kinds of global state, locking and unlocking resources, '\n'closing opened\\n'\n'files, etc.\\n'\n'\\n'\n'For more information on context managers, see Context '\n'Manager Types.\\n'\n'\\n'\n'object.__enter__(self)\\n'\n'\\n'\n' Enter the runtime context related to this object. The '\n'\"with\"\\n'\n' statement will bind this method\u2019s return value to the '\n'target(s)\\n'\n' specified in the \"as\" clause of the statement, if any.\\n'\n'\\n'\n'object.__exit__(self, exc_type, exc_value, traceback)\\n'\n'\\n'\n' Exit the runtime context related to this object. The '\n'parameters\\n'\n' describe the exception that caused the context to be '\n'exited. If the\\n'\n' context was exited without an exception, all three '\n'arguments will\\n'\n' be \"None\".\\n'\n'\\n'\n' If an exception is supplied, and the method wishes to '\n'suppress the\\n'\n' exception (i.e., prevent it from being propagated), it '\n'should\\n'\n' return a true value. Otherwise, the exception will be '\n'processed\\n'\n' normally upon exit from this method.\\n'\n'\\n'\n' Note that \"__exit__()\" methods should not reraise the '\n'passed-in\\n'\n' exception; this is the caller\u2019s responsibility.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 343** - The \u201cwith\u201d statement\\n'\n' The specification, background, and examples for the '\n'Python \"with\"\\n'\n' statement.\\n'\n'\\n'\n'\\n'\n'Customizing positional arguments in class pattern matching\\n'\n'==========================================================\\n'\n'\\n'\n'When using a class name in a pattern, positional arguments '\n'in the\\n'\n'pattern are not allowed by default, i.e. \"case MyClass(x, '\n'y)\" is\\n'\n'typically invalid without special support in \"MyClass\". To '\n'be able to\\n'\n'use that kind of patterns, the class needs to define a\\n'\n'*__match_args__* attribute.\\n'\n'\\n'\n'object.__match_args__\\n'\n'\\n'\n' This class variable can be assigned a tuple of strings. '\n'When this\\n'\n' class is used in a class pattern with positional '\n'arguments, each\\n'\n' positional argument will be converted into a keyword '\n'argument,\\n'\n' using the corresponding value in *__match_args__* as the '\n'keyword.\\n'\n' The absence of this attribute is equivalent to setting it '\n'to \"()\".\\n'\n'\\n'\n'For example, if \"MyClass.__match_args__\" is \"(\"left\", '\n'\"center\",\\n'\n'\"right\")\" that means that \"case MyClass(x, y)\" is equivalent '\n'to \"case\\n'\n'MyClass(left=x, center=y)\". Note that the number of '\n'arguments in the\\n'\n'pattern must be smaller than or equal to the number of '\n'elements in\\n'\n'*__match_args__*; if it is larger, the pattern match attempt '\n'will\\n'\n'raise a \"TypeError\".\\n'\n'\\n'\n'New in version 3.10.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 634** - Structural Pattern Matching\\n'\n' The specification for the Python \"match\" statement.\\n'\n'\\n'\n'\\n'\n'Special method lookup\\n'\n'=====================\\n'\n'\\n'\n'For custom classes, implicit invocations of special methods '\n'are only\\n'\n'guaranteed to work correctly if defined on an object\u2019s type, '\n'not in\\n'\n'the object\u2019s instance dictionary. That behaviour is the '\n'reason why\\n'\n'the following code raises an exception:\\n'\n'\\n'\n' >>> class C:\\n'\n' ... pass\\n'\n' ...\\n'\n' >>> c = C()\\n'\n' >>> c.__len__ = lambda: 5\\n'\n' >>> len(c)\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n\" TypeError: object of type 'C' has no len()\\n\"\n'\\n'\n'The rationale behind this behaviour lies with a number of '\n'special\\n'\n'methods such as \"__hash__()\" and \"__repr__()\" that are '\n'implemented by\\n'\n'all objects, including type objects. If the implicit lookup '\n'of these\\n'\n'methods used the conventional lookup process, they would '\n'fail when\\n'\n'invoked on the type object itself:\\n'\n'\\n'\n' >>> 1 .__hash__() == hash(1)\\n'\n' True\\n'\n' >>> int.__hash__() == hash(int)\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n\" TypeError: descriptor '__hash__' of 'int' object needs an \"\n'argument\\n'\n'\\n'\n'Incorrectly attempting to invoke an unbound method of a '\n'class in this\\n'\n'way is sometimes referred to as \u2018metaclass confusion\u2019, and '\n'is avoided\\n'\n'by bypassing the instance when looking up special methods:\\n'\n'\\n'\n' >>> type(1).__hash__(1) == hash(1)\\n'\n' True\\n'\n' >>> type(int).__hash__(int) == hash(int)\\n'\n' True\\n'\n'\\n'\n'In addition to bypassing any instance attributes in the '\n'interest of\\n'\n'correctness, implicit special method lookup generally also '\n'bypasses\\n'\n'the \"__getattribute__()\" method even of the object\u2019s '\n'metaclass:\\n'\n'\\n'\n' >>> class Meta(type):\\n'\n' ... def __getattribute__(*args):\\n'\n' ... print(\"Metaclass getattribute invoked\")\\n'\n' ... return type.__getattribute__(*args)\\n'\n' ...\\n'\n' >>> class C(object, metaclass=Meta):\\n'\n' ... def __len__(self):\\n'\n' ... return 10\\n'\n' ... def __getattribute__(*args):\\n'\n' ... print(\"Class getattribute invoked\")\\n'\n' ... return object.__getattribute__(*args)\\n'\n' ...\\n'\n' >>> c = C()\\n'\n' >>> c.__len__() # Explicit lookup via '\n'instance\\n'\n' Class getattribute invoked\\n'\n' 10\\n'\n' >>> type(c).__len__(c) # Explicit lookup via '\n'type\\n'\n' Metaclass getattribute invoked\\n'\n' 10\\n'\n' >>> len(c) # Implicit lookup\\n'\n' 10\\n'\n'\\n'\n'Bypassing the \"__getattribute__()\" machinery in this fashion '\n'provides\\n'\n'significant scope for speed optimisations within the '\n'interpreter, at\\n'\n'the cost of some flexibility in the handling of special '\n'methods (the\\n'\n'special method *must* be set on the class object itself in '\n'order to be\\n'\n'consistently invoked by the interpreter).\\n',\n'string-methods':'String Methods\\n'\n'**************\\n'\n'\\n'\n'Strings implement all of the common sequence operations, '\n'along with\\n'\n'the additional methods described below.\\n'\n'\\n'\n'Strings also support two styles of string formatting, one '\n'providing a\\n'\n'large degree of flexibility and customization (see '\n'\"str.format()\",\\n'\n'Format String Syntax and Custom String Formatting) and the '\n'other based\\n'\n'on C \"printf\" style formatting that handles a narrower '\n'range of types\\n'\n'and is slightly harder to use correctly, but is often '\n'faster for the\\n'\n'cases it can handle (printf-style String Formatting).\\n'\n'\\n'\n'The Text Processing Services section of the standard '\n'library covers a\\n'\n'number of other modules that provide various text related '\n'utilities\\n'\n'(including regular expression support in the \"re\" '\n'module).\\n'\n'\\n'\n'str.capitalize()\\n'\n'\\n'\n' Return a copy of the string with its first character '\n'capitalized\\n'\n' and the rest lowercased.\\n'\n'\\n'\n' Changed in version 3.8: The first character is now put '\n'into\\n'\n' titlecase rather than uppercase. This means that '\n'characters like\\n'\n' digraphs will only have their first letter capitalized, '\n'instead of\\n'\n' the full character.\\n'\n'\\n'\n'str.casefold()\\n'\n'\\n'\n' Return a casefolded copy of the string. Casefolded '\n'strings may be\\n'\n' used for caseless matching.\\n'\n'\\n'\n' Casefolding is similar to lowercasing but more '\n'aggressive because\\n'\n' it is intended to remove all case distinctions in a '\n'string. For\\n'\n' example, the German lowercase letter \"\\'\u00df\\'\" is '\n'equivalent to \"\"ss\"\".\\n'\n' Since it is already lowercase, \"lower()\" would do '\n'nothing to \"\\'\u00df\\'\";\\n'\n' \"casefold()\" converts it to \"\"ss\"\".\\n'\n'\\n'\n' The casefolding algorithm is described in section 3.13 '\n'of the\\n'\n' Unicode Standard.\\n'\n'\\n'\n' New in version 3.3.\\n'\n'\\n'\n'str.center(width[, fillchar])\\n'\n'\\n'\n' Return centered in a string of length *width*. Padding '\n'is done\\n'\n' using the specified *fillchar* (default is an ASCII '\n'space). The\\n'\n' original string is returned if *width* is less than or '\n'equal to\\n'\n' \"len(s)\".\\n'\n'\\n'\n'str.count(sub[, start[, end]])\\n'\n'\\n'\n' Return the number of non-overlapping occurrences of '\n'substring *sub*\\n'\n' in the range [*start*, *end*]. Optional arguments '\n'*start* and\\n'\n' *end* are interpreted as in slice notation.\\n'\n'\\n'\n\"str.encode(encoding='utf-8', errors='strict')\\n\"\n'\\n'\n' Return an encoded version of the string as a bytes '\n'object. Default\\n'\n' encoding is \"\\'utf-8\\'\". *errors* may be given to set a '\n'different\\n'\n' error handling scheme. The default for *errors* is '\n'\"\\'strict\\'\",\\n'\n' meaning that encoding errors raise a \"UnicodeError\". '\n'Other possible\\n'\n' values are \"\\'ignore\\'\", \"\\'replace\\'\", '\n'\"\\'xmlcharrefreplace\\'\",\\n'\n' \"\\'backslashreplace\\'\" and any other name registered '\n'via\\n'\n' \"codecs.register_error()\", see section Error Handlers. '\n'For a list\\n'\n' of possible encodings, see section Standard Encodings.\\n'\n'\\n'\n' By default, the *errors* argument is not checked for '\n'best\\n'\n' performances, but only used at the first encoding '\n'error. Enable the\\n'\n' Python Development Mode, or use a debug build to check '\n'*errors*.\\n'\n'\\n'\n' Changed in version 3.1: Support for keyword arguments '\n'added.\\n'\n'\\n'\n' Changed in version 3.9: The *errors* is now checked in '\n'development\\n'\n' mode and in debug mode.\\n'\n'\\n'\n'str.endswith(suffix[, start[, end]])\\n'\n'\\n'\n' Return \"True\" if the string ends with the specified '\n'*suffix*,\\n'\n' otherwise return \"False\". *suffix* can also be a tuple '\n'of suffixes\\n'\n' to look for. With optional *start*, test beginning at '\n'that\\n'\n' position. With optional *end*, stop comparing at that '\n'position.\\n'\n'\\n'\n'str.expandtabs(tabsize=8)\\n'\n'\\n'\n' Return a copy of the string where all tab characters '\n'are replaced\\n'\n' by one or more spaces, depending on the current column '\n'and the\\n'\n' given tab size. Tab positions occur every *tabsize* '\n'characters\\n'\n' (default is 8, giving tab positions at columns 0, 8, 16 '\n'and so on).\\n'\n' To expand the string, the current column is set to zero '\n'and the\\n'\n' string is examined character by character. If the '\n'character is a\\n'\n' tab (\"\\\\t\"), one or more space characters are inserted '\n'in the result\\n'\n' until the current column is equal to the next tab '\n'position. (The\\n'\n' tab character itself is not copied.) If the character '\n'is a newline\\n'\n' (\"\\\\n\") or return (\"\\\\r\"), it is copied and the current '\n'column is\\n'\n' reset to zero. Any other character is copied unchanged '\n'and the\\n'\n' current column is incremented by one regardless of how '\n'the\\n'\n' character is represented when printed.\\n'\n'\\n'\n\" >>> '01\\\\t012\\\\t0123\\\\t01234'.expandtabs()\\n\"\n\" '01 012 0123 01234'\\n\"\n\" >>> '01\\\\t012\\\\t0123\\\\t01234'.expandtabs(4)\\n\"\n\" '01 012 0123 01234'\\n\"\n'\\n'\n'str.find(sub[, start[, end]])\\n'\n'\\n'\n' Return the lowest index in the string where substring '\n'*sub* is\\n'\n' found within the slice \"s[start:end]\". Optional '\n'arguments *start*\\n'\n' and *end* are interpreted as in slice notation. Return '\n'\"-1\" if\\n'\n' *sub* is not found.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The \"find()\" method should be used only if you need '\n'to know the\\n'\n' position of *sub*. To check if *sub* is a substring '\n'or not, use\\n'\n' the \"in\" operator:\\n'\n'\\n'\n\" >>> 'Py' in 'Python'\\n\"\n' True\\n'\n'\\n'\n'str.format(*args, **kwargs)\\n'\n'\\n'\n' Perform a string formatting operation. The string on '\n'which this\\n'\n' method is called can contain literal text or '\n'replacement fields\\n'\n' delimited by braces \"{}\". Each replacement field '\n'contains either\\n'\n' the numeric index of a positional argument, or the name '\n'of a\\n'\n' keyword argument. Returns a copy of the string where '\n'each\\n'\n' replacement field is replaced with the string value of '\n'the\\n'\n' corresponding argument.\\n'\n'\\n'\n' >>> \"The sum of 1 + 2 is {0}\".format(1+2)\\n'\n\" 'The sum of 1 + 2 is 3'\\n\"\n'\\n'\n' See Format String Syntax for a description of the '\n'various\\n'\n' formatting options that can be specified in format '\n'strings.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' When formatting a number (\"int\", \"float\", \"complex\",\\n'\n' \"decimal.Decimal\" and subclasses) with the \"n\" type '\n'(ex:\\n'\n' \"\\'{:n}\\'.format(1234)\"), the function temporarily '\n'sets the\\n'\n' \"LC_CTYPE\" locale to the \"LC_NUMERIC\" locale to '\n'decode\\n'\n' \"decimal_point\" and \"thousands_sep\" fields of '\n'\"localeconv()\" if\\n'\n' they are non-ASCII or longer than 1 byte, and the '\n'\"LC_NUMERIC\"\\n'\n' locale is different than the \"LC_CTYPE\" locale. This '\n'temporary\\n'\n' change affects other threads.\\n'\n'\\n'\n' Changed in version 3.7: When formatting a number with '\n'the \"n\" type,\\n'\n' the function sets temporarily the \"LC_CTYPE\" locale to '\n'the\\n'\n' \"LC_NUMERIC\" locale in some cases.\\n'\n'\\n'\n'str.format_map(mapping)\\n'\n'\\n'\n' Similar to \"str.format(**mapping)\", except that '\n'\"mapping\" is used\\n'\n' directly and not copied to a \"dict\". This is useful if '\n'for example\\n'\n' \"mapping\" is a dict subclass:\\n'\n'\\n'\n' >>> class Default(dict):\\n'\n' ... def __missing__(self, key):\\n'\n' ... return key\\n'\n' ...\\n'\n\" >>> '{name} was born in \"\n\"{country}'.format_map(Default(name='Guido'))\\n\"\n\" 'Guido was born in country'\\n\"\n'\\n'\n' New in version 3.2.\\n'\n'\\n'\n'str.index(sub[, start[, end]])\\n'\n'\\n'\n' Like \"find()\", but raise \"ValueError\" when the '\n'substring is not\\n'\n' found.\\n'\n'\\n'\n'str.isalnum()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'alphanumeric and\\n'\n' there is at least one character, \"False\" otherwise. A '\n'character\\n'\n' \"c\" is alphanumeric if one of the following returns '\n'\"True\":\\n'\n' \"c.isalpha()\", \"c.isdecimal()\", \"c.isdigit()\", or '\n'\"c.isnumeric()\".\\n'\n'\\n'\n'str.isalpha()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'alphabetic and\\n'\n' there is at least one character, \"False\" otherwise. '\n'Alphabetic\\n'\n' characters are those characters defined in the Unicode '\n'character\\n'\n' database as \u201cLetter\u201d, i.e., those with general category '\n'property\\n'\n' being one of \u201cLm\u201d, \u201cLt\u201d, \u201cLu\u201d, \u201cLl\u201d, or \u201cLo\u201d. Note '\n'that this is\\n'\n' different from the \u201cAlphabetic\u201d property defined in the '\n'Unicode\\n'\n' Standard.\\n'\n'\\n'\n'str.isascii()\\n'\n'\\n'\n' Return \"True\" if the string is empty or all characters '\n'in the\\n'\n' string are ASCII, \"False\" otherwise. ASCII characters '\n'have code\\n'\n' points in the range U+0000-U+007F.\\n'\n'\\n'\n' New in version 3.7.\\n'\n'\\n'\n'str.isdecimal()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'decimal\\n'\n' characters and there is at least one character, \"False\" '\n'otherwise.\\n'\n' Decimal characters are those that can be used to form '\n'numbers in\\n'\n' base 10, e.g. U+0660, ARABIC-INDIC DIGIT ZERO. '\n'Formally a decimal\\n'\n' character is a character in the Unicode General '\n'Category \u201cNd\u201d.\\n'\n'\\n'\n'str.isdigit()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'digits and there\\n'\n' is at least one character, \"False\" otherwise. Digits '\n'include\\n'\n' decimal characters and digits that need special '\n'handling, such as\\n'\n' the compatibility superscript digits. This covers '\n'digits which\\n'\n' cannot be used to form numbers in base 10, like the '\n'Kharosthi\\n'\n' numbers. Formally, a digit is a character that has the '\n'property\\n'\n' value Numeric_Type=Digit or Numeric_Type=Decimal.\\n'\n'\\n'\n'str.isidentifier()\\n'\n'\\n'\n' Return \"True\" if the string is a valid identifier '\n'according to the\\n'\n' language definition, section Identifiers and keywords.\\n'\n'\\n'\n' Call \"keyword.iskeyword()\" to test whether string \"s\" '\n'is a reserved\\n'\n' identifier, such as \"def\" and \"class\".\\n'\n'\\n'\n' Example:\\n'\n'\\n'\n' >>> from keyword import iskeyword\\n'\n'\\n'\n\" >>> 'hello'.isidentifier(), iskeyword('hello')\\n\"\n' True, False\\n'\n\" >>> 'def'.isidentifier(), iskeyword('def')\\n\"\n' True, True\\n'\n'\\n'\n'str.islower()\\n'\n'\\n'\n' Return \"True\" if all cased characters [4] in the string '\n'are\\n'\n' lowercase and there is at least one cased character, '\n'\"False\"\\n'\n' otherwise.\\n'\n'\\n'\n'str.isnumeric()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'numeric\\n'\n' characters, and there is at least one character, '\n'\"False\" otherwise.\\n'\n' Numeric characters include digit characters, and all '\n'characters\\n'\n' that have the Unicode numeric value property, e.g. '\n'U+2155, VULGAR\\n'\n' FRACTION ONE FIFTH. Formally, numeric characters are '\n'those with\\n'\n' the property value Numeric_Type=Digit, '\n'Numeric_Type=Decimal or\\n'\n' Numeric_Type=Numeric.\\n'\n'\\n'\n'str.isprintable()\\n'\n'\\n'\n' Return \"True\" if all characters in the string are '\n'printable or the\\n'\n' string is empty, \"False\" otherwise. Nonprintable '\n'characters are\\n'\n' those characters defined in the Unicode character '\n'database as\\n'\n' \u201cOther\u201d or \u201cSeparator\u201d, excepting the ASCII space '\n'(0x20) which is\\n'\n' considered printable. (Note that printable characters '\n'in this\\n'\n' context are those which should not be escaped when '\n'\"repr()\" is\\n'\n' invoked on a string. It has no bearing on the handling '\n'of strings\\n'\n' written to \"sys.stdout\" or \"sys.stderr\".)\\n'\n'\\n'\n'str.isspace()\\n'\n'\\n'\n' Return \"True\" if there are only whitespace characters '\n'in the string\\n'\n' and there is at least one character, \"False\" '\n'otherwise.\\n'\n'\\n'\n' A character is *whitespace* if in the Unicode character '\n'database\\n'\n' (see \"unicodedata\"), either its general category is '\n'\"Zs\"\\n'\n' (\u201cSeparator, space\u201d), or its bidirectional class is one '\n'of \"WS\",\\n'\n' \"B\", or \"S\".\\n'\n'\\n'\n'str.istitle()\\n'\n'\\n'\n' Return \"True\" if the string is a titlecased string and '\n'there is at\\n'\n' least one character, for example uppercase characters '\n'may only\\n'\n' follow uncased characters and lowercase characters only '\n'cased ones.\\n'\n' Return \"False\" otherwise.\\n'\n'\\n'\n'str.isupper()\\n'\n'\\n'\n' Return \"True\" if all cased characters [4] in the string '\n'are\\n'\n' uppercase and there is at least one cased character, '\n'\"False\"\\n'\n' otherwise.\\n'\n'\\n'\n\" >>> 'BANANA'.isupper()\\n\"\n' True\\n'\n\" >>> 'banana'.isupper()\\n\"\n' False\\n'\n\" >>> 'baNana'.isupper()\\n\"\n' False\\n'\n\" >>> ' '.isupper()\\n\"\n' False\\n'\n'\\n'\n'str.join(iterable)\\n'\n'\\n'\n' Return a string which is the concatenation of the '\n'strings in\\n'\n' *iterable*. A \"TypeError\" will be raised if there are '\n'any non-\\n'\n' string values in *iterable*, including \"bytes\" '\n'objects. The\\n'\n' separator between elements is the string providing this '\n'method.\\n'\n'\\n'\n'str.ljust(width[, fillchar])\\n'\n'\\n'\n' Return the string left justified in a string of length '\n'*width*.\\n'\n' Padding is done using the specified *fillchar* (default '\n'is an ASCII\\n'\n' space). The original string is returned if *width* is '\n'less than or\\n'\n' equal to \"len(s)\".\\n'\n'\\n'\n'str.lower()\\n'\n'\\n'\n' Return a copy of the string with all the cased '\n'characters [4]\\n'\n' converted to lowercase.\\n'\n'\\n'\n' The lowercasing algorithm used is described in section '\n'3.13 of the\\n'\n' Unicode Standard.\\n'\n'\\n'\n'str.lstrip([chars])\\n'\n'\\n'\n' Return a copy of the string with leading characters '\n'removed. The\\n'\n' *chars* argument is a string specifying the set of '\n'characters to be\\n'\n' removed. If omitted or \"None\", the *chars* argument '\n'defaults to\\n'\n' removing whitespace. The *chars* argument is not a '\n'prefix; rather,\\n'\n' all combinations of its values are stripped:\\n'\n'\\n'\n\" >>> ' spacious '.lstrip()\\n\"\n\" 'spacious '\\n\"\n\" >>> 'www.example.com'.lstrip('cmowz.')\\n\"\n\" 'example.com'\\n\"\n'\\n'\n' See \"str.removeprefix()\" for a method that will remove '\n'a single\\n'\n' prefix string rather than all of a set of characters. '\n'For example:\\n'\n'\\n'\n\" >>> 'Arthur: three!'.lstrip('Arthur: ')\\n\"\n\" 'ee!'\\n\"\n\" >>> 'Arthur: three!'.removeprefix('Arthur: ')\\n\"\n\" 'three!'\\n\"\n'\\n'\n'static str.maketrans(x[, y[, z]])\\n'\n'\\n'\n' This static method returns a translation table usable '\n'for\\n'\n' \"str.translate()\".\\n'\n'\\n'\n' If there is only one argument, it must be a dictionary '\n'mapping\\n'\n' Unicode ordinals (integers) or characters (strings of '\n'length 1) to\\n'\n' Unicode ordinals, strings (of arbitrary lengths) or '\n'\"None\".\\n'\n' Character keys will then be converted to ordinals.\\n'\n'\\n'\n' If there are two arguments, they must be strings of '\n'equal length,\\n'\n' and in the resulting dictionary, each character in x '\n'will be mapped\\n'\n' to the character at the same position in y. If there '\n'is a third\\n'\n' argument, it must be a string, whose characters will be '\n'mapped to\\n'\n' \"None\" in the result.\\n'\n'\\n'\n'str.partition(sep)\\n'\n'\\n'\n' Split the string at the first occurrence of *sep*, and '\n'return a\\n'\n' 3-tuple containing the part before the separator, the '\n'separator\\n'\n' itself, and the part after the separator. If the '\n'separator is not\\n'\n' found, return a 3-tuple containing the string itself, '\n'followed by\\n'\n' two empty strings.\\n'\n'\\n'\n'str.removeprefix(prefix, /)\\n'\n'\\n'\n' If the string starts with the *prefix* string, return\\n'\n' \"string[len(prefix):]\". Otherwise, return a copy of the '\n'original\\n'\n' string:\\n'\n'\\n'\n\" >>> 'TestHook'.removeprefix('Test')\\n\"\n\" 'Hook'\\n\"\n\" >>> 'BaseTestCase'.removeprefix('Test')\\n\"\n\" 'BaseTestCase'\\n\"\n'\\n'\n' New in version 3.9.\\n'\n'\\n'\n'str.removesuffix(suffix, /)\\n'\n'\\n'\n' If the string ends with the *suffix* string and that '\n'*suffix* is\\n'\n' not empty, return \"string[:-len(suffix)]\". Otherwise, '\n'return a copy\\n'\n' of the original string:\\n'\n'\\n'\n\" >>> 'MiscTests'.removesuffix('Tests')\\n\"\n\" 'Misc'\\n\"\n\" >>> 'TmpDirMixin'.removesuffix('Tests')\\n\"\n\" 'TmpDirMixin'\\n\"\n'\\n'\n' New in version 3.9.\\n'\n'\\n'\n'str.replace(old, new[, count])\\n'\n'\\n'\n' Return a copy of the string with all occurrences of '\n'substring *old*\\n'\n' replaced by *new*. If the optional argument *count* is '\n'given, only\\n'\n' the first *count* occurrences are replaced.\\n'\n'\\n'\n'str.rfind(sub[, start[, end]])\\n'\n'\\n'\n' Return the highest index in the string where substring '\n'*sub* is\\n'\n' found, such that *sub* is contained within '\n'\"s[start:end]\".\\n'\n' Optional arguments *start* and *end* are interpreted as '\n'in slice\\n'\n' notation. Return \"-1\" on failure.\\n'\n'\\n'\n'str.rindex(sub[, start[, end]])\\n'\n'\\n'\n' Like \"rfind()\" but raises \"ValueError\" when the '\n'substring *sub* is\\n'\n' not found.\\n'\n'\\n'\n'str.rjust(width[, fillchar])\\n'\n'\\n'\n' Return the string right justified in a string of length '\n'*width*.\\n'\n' Padding is done using the specified *fillchar* (default '\n'is an ASCII\\n'\n' space). The original string is returned if *width* is '\n'less than or\\n'\n' equal to \"len(s)\".\\n'\n'\\n'\n'str.rpartition(sep)\\n'\n'\\n'\n' Split the string at the last occurrence of *sep*, and '\n'return a\\n'\n' 3-tuple containing the part before the separator, the '\n'separator\\n'\n' itself, and the part after the separator. If the '\n'separator is not\\n'\n' found, return a 3-tuple containing two empty strings, '\n'followed by\\n'\n' the string itself.\\n'\n'\\n'\n'str.rsplit(sep=None, maxsplit=- 1)\\n'\n'\\n'\n' Return a list of the words in the string, using *sep* '\n'as the\\n'\n' delimiter string. If *maxsplit* is given, at most '\n'*maxsplit* splits\\n'\n' are done, the *rightmost* ones. If *sep* is not '\n'specified or\\n'\n' \"None\", any whitespace string is a separator. Except '\n'for splitting\\n'\n' from the right, \"rsplit()\" behaves like \"split()\" which '\n'is\\n'\n' described in detail below.\\n'\n'\\n'\n'str.rstrip([chars])\\n'\n'\\n'\n' Return a copy of the string with trailing characters '\n'removed. The\\n'\n' *chars* argument is a string specifying the set of '\n'characters to be\\n'\n' removed. If omitted or \"None\", the *chars* argument '\n'defaults to\\n'\n' removing whitespace. The *chars* argument is not a '\n'suffix; rather,\\n'\n' all combinations of its values are stripped:\\n'\n'\\n'\n\" >>> ' spacious '.rstrip()\\n\"\n\" ' spacious'\\n\"\n\" >>> 'mississippi'.rstrip('ipz')\\n\"\n\" 'mississ'\\n\"\n'\\n'\n' See \"str.removesuffix()\" for a method that will remove '\n'a single\\n'\n' suffix string rather than all of a set of characters. '\n'For example:\\n'\n'\\n'\n\" >>> 'Monty Python'.rstrip(' Python')\\n\"\n\" 'M'\\n\"\n\" >>> 'Monty Python'.removesuffix(' Python')\\n\"\n\" 'Monty'\\n\"\n'\\n'\n'str.split(sep=None, maxsplit=- 1)\\n'\n'\\n'\n' Return a list of the words in the string, using *sep* '\n'as the\\n'\n' delimiter string. If *maxsplit* is given, at most '\n'*maxsplit*\\n'\n' splits are done (thus, the list will have at most '\n'\"maxsplit+1\"\\n'\n' elements). If *maxsplit* is not specified or \"-1\", '\n'then there is\\n'\n' no limit on the number of splits (all possible splits '\n'are made).\\n'\n'\\n'\n' If *sep* is given, consecutive delimiters are not '\n'grouped together\\n'\n' and are deemed to delimit empty strings (for example,\\n'\n' \"\\'1,,2\\'.split(\\',\\')\" returns \"[\\'1\\', \\'\\', '\n'\\'2\\']\"). The *sep* argument\\n'\n' may consist of multiple characters (for example,\\n'\n' \"\\'1<>2<>3\\'.split(\\'<>\\')\" returns \"[\\'1\\', \\'2\\', '\n'\\'3\\']\"). Splitting an\\n'\n' empty string with a specified separator returns '\n'\"[\\'\\']\".\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n\" >>> '1,2,3'.split(',')\\n\"\n\" ['1', '2', '3']\\n\"\n\" >>> '1,2,3'.split(',', maxsplit=1)\\n\"\n\" ['1', '2,3']\\n\"\n\" >>> '1,2,,3,'.split(',')\\n\"\n\" ['1', '2', '', '3', '']\\n\"\n'\\n'\n' If *sep* is not specified or is \"None\", a different '\n'splitting\\n'\n' algorithm is applied: runs of consecutive whitespace '\n'are regarded\\n'\n' as a single separator, and the result will contain no '\n'empty strings\\n'\n' at the start or end if the string has leading or '\n'trailing\\n'\n' whitespace. Consequently, splitting an empty string or '\n'a string\\n'\n' consisting of just whitespace with a \"None\" separator '\n'returns \"[]\".\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n\" >>> '1 2 3'.split()\\n\"\n\" ['1', '2', '3']\\n\"\n\" >>> '1 2 3'.split(maxsplit=1)\\n\"\n\" ['1', '2 3']\\n\"\n\" >>> ' 1 2 3 '.split()\\n\"\n\" ['1', '2', '3']\\n\"\n'\\n'\n'str.splitlines([keepends])\\n'\n'\\n'\n' Return a list of the lines in the string, breaking at '\n'line\\n'\n' boundaries. Line breaks are not included in the '\n'resulting list\\n'\n' unless *keepends* is given and true.\\n'\n'\\n'\n' This method splits on the following line boundaries. '\n'In\\n'\n' particular, the boundaries are a superset of *universal '\n'newlines*.\\n'\n'\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | Representation | '\n'Description |\\n'\n' '\n'|=========================|===============================|\\n'\n' | \"\\\\n\" | Line '\n'Feed |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\r\" | Carriage '\n'Return |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\r\\\\n\" | Carriage Return + Line '\n'Feed |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\v\" or \"\\\\x0b\" | Line '\n'Tabulation |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\f\" or \"\\\\x0c\" | Form '\n'Feed |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\x1c\" | File '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\x1d\" | Group '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\x1e\" | Record '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\x85\" | Next Line (C1 Control '\n'Code) |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\u2028\" | Line '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n' | \"\\\\u2029\" | Paragraph '\n'Separator |\\n'\n' '\n'+-------------------------+-------------------------------+\\n'\n'\\n'\n' Changed in version 3.2: \"\\\\v\" and \"\\\\f\" added to list '\n'of line\\n'\n' boundaries.\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n\" >>> 'ab c\\\\n\\\\nde fg\\\\rkl\\\\r\\\\n'.splitlines()\\n\"\n\" ['ab c', '', 'de fg', 'kl']\\n\"\n\" >>> 'ab c\\\\n\\\\nde \"\n\"fg\\\\rkl\\\\r\\\\n'.splitlines(keepends=True)\\n\"\n\" ['ab c\\\\n', '\\\\n', 'de fg\\\\r', 'kl\\\\r\\\\n']\\n\"\n'\\n'\n' Unlike \"split()\" when a delimiter string *sep* is '\n'given, this\\n'\n' method returns an empty list for the empty string, and '\n'a terminal\\n'\n' line break does not result in an extra line:\\n'\n'\\n'\n' >>> \"\".splitlines()\\n'\n' []\\n'\n' >>> \"One line\\\\n\".splitlines()\\n'\n\" ['One line']\\n\"\n'\\n'\n' For comparison, \"split(\\'\\\\n\\')\" gives:\\n'\n'\\n'\n\" >>> ''.split('\\\\n')\\n\"\n\" ['']\\n\"\n\" >>> 'Two lines\\\\n'.split('\\\\n')\\n\"\n\" ['Two lines', '']\\n\"\n'\\n'\n'str.startswith(prefix[, start[, end]])\\n'\n'\\n'\n' Return \"True\" if string starts with the *prefix*, '\n'otherwise return\\n'\n' \"False\". *prefix* can also be a tuple of prefixes to '\n'look for.\\n'\n' With optional *start*, test string beginning at that '\n'position.\\n'\n' With optional *end*, stop comparing string at that '\n'position.\\n'\n'\\n'\n'str.strip([chars])\\n'\n'\\n'\n' Return a copy of the string with the leading and '\n'trailing\\n'\n' characters removed. The *chars* argument is a string '\n'specifying the\\n'\n' set of characters to be removed. If omitted or \"None\", '\n'the *chars*\\n'\n' argument defaults to removing whitespace. The *chars* '\n'argument is\\n'\n' not a prefix or suffix; rather, all combinations of its '\n'values are\\n'\n' stripped:\\n'\n'\\n'\n\" >>> ' spacious '.strip()\\n\"\n\" 'spacious'\\n\"\n\" >>> 'www.example.com'.strip('cmowz.')\\n\"\n\" 'example'\\n\"\n'\\n'\n' The outermost leading and trailing *chars* argument '\n'values are\\n'\n' stripped from the string. Characters are removed from '\n'the leading\\n'\n' end until reaching a string character that is not '\n'contained in the\\n'\n' set of characters in *chars*. A similar action takes '\n'place on the\\n'\n' trailing end. For example:\\n'\n'\\n'\n\" >>> comment_string = '#....... Section 3.2.1 Issue \"\n\"#32 .......'\\n\"\n\" >>> comment_string.strip('.#! ')\\n\"\n\" 'Section 3.2.1 Issue #32'\\n\"\n'\\n'\n'str.swapcase()\\n'\n'\\n'\n' Return a copy of the string with uppercase characters '\n'converted to\\n'\n' lowercase and vice versa. Note that it is not '\n'necessarily true that\\n'\n' \"s.swapcase().swapcase() == s\".\\n'\n'\\n'\n'str.title()\\n'\n'\\n'\n' Return a titlecased version of the string where words '\n'start with an\\n'\n' uppercase character and the remaining characters are '\n'lowercase.\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n\" >>> 'Hello world'.title()\\n\"\n\" 'Hello World'\\n\"\n'\\n'\n' The algorithm uses a simple language-independent '\n'definition of a\\n'\n' word as groups of consecutive letters. The definition '\n'works in\\n'\n' many contexts but it means that apostrophes in '\n'contractions and\\n'\n' possessives form word boundaries, which may not be the '\n'desired\\n'\n' result:\\n'\n'\\n'\n' >>> \"they\\'re bill\\'s friends from the UK\".title()\\n'\n' \"They\\'Re Bill\\'S Friends From The Uk\"\\n'\n'\\n'\n' A workaround for apostrophes can be constructed using '\n'regular\\n'\n' expressions:\\n'\n'\\n'\n' >>> import re\\n'\n' >>> def titlecase(s):\\n'\n' ... return re.sub(r\"[A-Za-z]+(\\'[A-Za-z]+)?\",\\n'\n' ... lambda mo: '\n'mo.group(0).capitalize(),\\n'\n' ... s)\\n'\n' ...\\n'\n' >>> titlecase(\"they\\'re bill\\'s friends.\")\\n'\n' \"They\\'re Bill\\'s Friends.\"\\n'\n'\\n'\n'str.translate(table)\\n'\n'\\n'\n' Return a copy of the string in which each character has '\n'been mapped\\n'\n' through the given translation table. The table must be '\n'an object\\n'\n' that implements indexing via \"__getitem__()\", typically '\n'a *mapping*\\n'\n' or *sequence*. When indexed by a Unicode ordinal (an '\n'integer), the\\n'\n' table object can do any of the following: return a '\n'Unicode ordinal\\n'\n' or a string, to map the character to one or more other '\n'characters;\\n'\n' return \"None\", to delete the character from the return '\n'string; or\\n'\n' raise a \"LookupError\" exception, to map the character '\n'to itself.\\n'\n'\\n'\n' You can use \"str.maketrans()\" to create a translation '\n'map from\\n'\n' character-to-character mappings in different formats.\\n'\n'\\n'\n' See also the \"codecs\" module for a more flexible '\n'approach to custom\\n'\n' character mappings.\\n'\n'\\n'\n'str.upper()\\n'\n'\\n'\n' Return a copy of the string with all the cased '\n'characters [4]\\n'\n' converted to uppercase. Note that '\n'\"s.upper().isupper()\" might be\\n'\n' \"False\" if \"s\" contains uncased characters or if the '\n'Unicode\\n'\n' category of the resulting character(s) is not \u201cLu\u201d '\n'(Letter,\\n'\n' uppercase), but e.g. \u201cLt\u201d (Letter, titlecase).\\n'\n'\\n'\n' The uppercasing algorithm used is described in section '\n'3.13 of the\\n'\n' Unicode Standard.\\n'\n'\\n'\n'str.zfill(width)\\n'\n'\\n'\n' Return a copy of the string left filled with ASCII '\n'\"\\'0\\'\" digits to\\n'\n' make a string of length *width*. A leading sign prefix\\n'\n' (\"\\'+\\'\"/\"\\'-\\'\") is handled by inserting the padding '\n'*after* the sign\\n'\n' character rather than before. The original string is '\n'returned if\\n'\n' *width* is less than or equal to \"len(s)\".\\n'\n'\\n'\n' For example:\\n'\n'\\n'\n' >>> \"42\".zfill(5)\\n'\n\" '00042'\\n\"\n' >>> \"-42\".zfill(5)\\n'\n\" '-0042'\\n\",\n'strings':'String and Bytes literals\\n'\n'*************************\\n'\n'\\n'\n'String literals are described by the following lexical '\n'definitions:\\n'\n'\\n'\n' stringliteral ::= [stringprefix](shortstring | longstring)\\n'\n' stringprefix ::= \"r\" | \"u\" | \"R\" | \"U\" | \"f\" | \"F\"\\n'\n' | \"fr\" | \"Fr\" | \"fR\" | \"FR\" | \"rf\" | \"rF\" | '\n'\"Rf\" | \"RF\"\\n'\n' shortstring ::= \"\\'\" shortstringitem* \"\\'\" | \\'\"\\' '\n'shortstringitem* \\'\"\\'\\n'\n' longstring ::= \"\\'\\'\\'\" longstringitem* \"\\'\\'\\'\" | '\n'\\'\"\"\"\\' longstringitem* \\'\"\"\"\\'\\n'\n' shortstringitem ::= shortstringchar | stringescapeseq\\n'\n' longstringitem ::= longstringchar | stringescapeseq\\n'\n' shortstringchar ::= \\n'\n' longstringchar ::= \\n'\n' stringescapeseq ::= \"\\\\\" \\n'\n'\\n'\n' bytesliteral ::= bytesprefix(shortbytes | longbytes)\\n'\n' bytesprefix ::= \"b\" | \"B\" | \"br\" | \"Br\" | \"bR\" | \"BR\" | '\n'\"rb\" | \"rB\" | \"Rb\" | \"RB\"\\n'\n' shortbytes ::= \"\\'\" shortbytesitem* \"\\'\" | \\'\"\\' '\n'shortbytesitem* \\'\"\\'\\n'\n' longbytes ::= \"\\'\\'\\'\" longbytesitem* \"\\'\\'\\'\" | \\'\"\"\"\\' '\n'longbytesitem* \\'\"\"\"\\'\\n'\n' shortbytesitem ::= shortbyteschar | bytesescapeseq\\n'\n' longbytesitem ::= longbyteschar | bytesescapeseq\\n'\n' shortbyteschar ::= \\n'\n' longbyteschar ::= \\n'\n' bytesescapeseq ::= \"\\\\\" \\n'\n'\\n'\n'One syntactic restriction not indicated by these productions is '\n'that\\n'\n'whitespace is not allowed between the \"stringprefix\" or '\n'\"bytesprefix\"\\n'\n'and the rest of the literal. The source character set is defined '\n'by\\n'\n'the encoding declaration; it is UTF-8 if no encoding declaration '\n'is\\n'\n'given in the source file; see section Encoding declarations.\\n'\n'\\n'\n'In plain English: Both types of literals can be enclosed in '\n'matching\\n'\n'single quotes (\"\\'\") or double quotes (\"\"\"). They can also be '\n'enclosed\\n'\n'in matching groups of three single or double quotes (these are\\n'\n'generally referred to as *triple-quoted strings*). The '\n'backslash\\n'\n'(\"\\\\\") character is used to escape characters that otherwise have '\n'a\\n'\n'special meaning, such as newline, backslash itself, or the quote\\n'\n'character.\\n'\n'\\n'\n'Bytes literals are always prefixed with \"\\'b\\'\" or \"\\'B\\'\"; they '\n'produce\\n'\n'an instance of the \"bytes\" type instead of the \"str\" type. They '\n'may\\n'\n'only contain ASCII characters; bytes with a numeric value of 128 '\n'or\\n'\n'greater must be expressed with escapes.\\n'\n'\\n'\n'Both string and bytes literals may optionally be prefixed with a\\n'\n'letter \"\\'r\\'\" or \"\\'R\\'\"; such strings are called *raw strings* '\n'and treat\\n'\n'backslashes as literal characters. As a result, in string '\n'literals,\\n'\n'\"\\'\\\\U\\'\" and \"\\'\\\\u\\'\" escapes in raw strings are not treated '\n'specially.\\n'\n'Given that Python 2.x\u2019s raw unicode literals behave differently '\n'than\\n'\n'Python 3.x\u2019s the \"\\'ur\\'\" syntax is not supported.\\n'\n'\\n'\n'New in version 3.3: The \"\\'rb\\'\" prefix of raw bytes literals has '\n'been\\n'\n'added as a synonym of \"\\'br\\'\".\\n'\n'\\n'\n'New in version 3.3: Support for the unicode legacy literal\\n'\n'(\"u\\'value\\'\") was reintroduced to simplify the maintenance of '\n'dual\\n'\n'Python 2.x and 3.x codebases. See **PEP 414** for more '\n'information.\\n'\n'\\n'\n'A string literal with \"\\'f\\'\" or \"\\'F\\'\" in its prefix is a '\n'*formatted\\n'\n'string literal*; see Formatted string literals. The \"\\'f\\'\" may '\n'be\\n'\n'combined with \"\\'r\\'\", but not with \"\\'b\\'\" or \"\\'u\\'\", therefore '\n'raw\\n'\n'formatted strings are possible, but formatted bytes literals are '\n'not.\\n'\n'\\n'\n'In triple-quoted literals, unescaped newlines and quotes are '\n'allowed\\n'\n'(and are retained), except that three unescaped quotes in a row\\n'\n'terminate the literal. (A \u201cquote\u201d is the character used to open '\n'the\\n'\n'literal, i.e. either \"\\'\" or \"\"\".)\\n'\n'\\n'\n'Unless an \"\\'r\\'\" or \"\\'R\\'\" prefix is present, escape sequences '\n'in string\\n'\n'and bytes literals are interpreted according to rules similar to '\n'those\\n'\n'used by Standard C. The recognized escape sequences are:\\n'\n'\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| Escape Sequence | Meaning | Notes '\n'|\\n'\n'|===================|===================================|=========|\\n'\n'| \"\\\\newline\" | Backslash and newline ignored '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\\\\\\" | Backslash (\"\\\\\") '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\\\'\" | Single quote (\"\\'\") '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\\"\" | Double quote (\"\"\") '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\a\" | ASCII Bell (BEL) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\b\" | ASCII Backspace (BS) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\f\" | ASCII Formfeed (FF) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\n\" | ASCII Linefeed (LF) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\r\" | ASCII Carriage Return (CR) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\t\" | ASCII Horizontal Tab (TAB) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\v\" | ASCII Vertical Tab (VT) '\n'| |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\ooo\" | Character with octal value *ooo* | '\n'(1,3) |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\xhh\" | Character with hex value *hh* | '\n'(2,3) |\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'\\n'\n'Escape sequences only recognized in string literals are:\\n'\n'\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| Escape Sequence | Meaning | Notes '\n'|\\n'\n'|===================|===================================|=========|\\n'\n'| \"\\\\N{name}\" | Character named *name* in the | '\n'(4) |\\n'\n'| | Unicode database | '\n'|\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\uxxxx\" | Character with 16-bit hex value | '\n'(5) |\\n'\n'| | *xxxx* | '\n'|\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'| \"\\\\Uxxxxxxxx\" | Character with 32-bit hex value | '\n'(6) |\\n'\n'| | *xxxxxxxx* | '\n'|\\n'\n'+-------------------+-----------------------------------+---------+\\n'\n'\\n'\n'Notes:\\n'\n'\\n'\n'1. As in Standard C, up to three octal digits are accepted.\\n'\n'\\n'\n'2. Unlike in Standard C, exactly two hex digits are required.\\n'\n'\\n'\n'3. In a bytes literal, hexadecimal and octal escapes denote the '\n'byte\\n'\n' with the given value. In a string literal, these escapes '\n'denote a\\n'\n' Unicode character with the given value.\\n'\n'\\n'\n'4. Changed in version 3.3: Support for name aliases [1] has been\\n'\n' added.\\n'\n'\\n'\n'5. Exactly four hex digits are required.\\n'\n'\\n'\n'6. Any Unicode character can be encoded this way. Exactly eight '\n'hex\\n'\n' digits are required.\\n'\n'\\n'\n'Unlike Standard C, all unrecognized escape sequences are left in '\n'the\\n'\n'string unchanged, i.e., *the backslash is left in the result*. '\n'(This\\n'\n'behavior is useful when debugging: if an escape sequence is '\n'mistyped,\\n'\n'the resulting output is more easily recognized as broken.) It is '\n'also\\n'\n'important to note that the escape sequences only recognized in '\n'string\\n'\n'literals fall into the category of unrecognized escapes for '\n'bytes\\n'\n'literals.\\n'\n'\\n'\n' Changed in version 3.6: Unrecognized escape sequences produce '\n'a\\n'\n' \"DeprecationWarning\". In a future Python version they will be '\n'a\\n'\n' \"SyntaxWarning\" and eventually a \"SyntaxError\".\\n'\n'\\n'\n'Even in a raw literal, quotes can be escaped with a backslash, '\n'but the\\n'\n'backslash remains in the result; for example, \"r\"\\\\\"\"\" is a '\n'valid\\n'\n'string literal consisting of two characters: a backslash and a '\n'double\\n'\n'quote; \"r\"\\\\\"\" is not a valid string literal (even a raw string '\n'cannot\\n'\n'end in an odd number of backslashes). Specifically, *a raw '\n'literal\\n'\n'cannot end in a single backslash* (since the backslash would '\n'escape\\n'\n'the following quote character). Note also that a single '\n'backslash\\n'\n'followed by a newline is interpreted as those two characters as '\n'part\\n'\n'of the literal, *not* as a line continuation.\\n',\n'subscriptions':'Subscriptions\\n'\n'*************\\n'\n'\\n'\n'Subscription of a sequence (string, tuple or list) or '\n'mapping\\n'\n'(dictionary) object usually selects an item from the '\n'collection:\\n'\n'\\n'\n' subscription ::= primary \"[\" expression_list \"]\"\\n'\n'\\n'\n'The primary must evaluate to an object that supports '\n'subscription\\n'\n'(lists or dictionaries for example). User-defined objects '\n'can support\\n'\n'subscription by defining a \"__getitem__()\" method.\\n'\n'\\n'\n'For built-in objects, there are two types of objects that '\n'support\\n'\n'subscription:\\n'\n'\\n'\n'If the primary is a mapping, the expression list must '\n'evaluate to an\\n'\n'object whose value is one of the keys of the mapping, and '\n'the\\n'\n'subscription selects the value in the mapping that '\n'corresponds to that\\n'\n'key. (The expression list is a tuple except if it has '\n'exactly one\\n'\n'item.)\\n'\n'\\n'\n'If the primary is a sequence, the expression list must '\n'evaluate to an\\n'\n'integer or a slice (as discussed in the following '\n'section).\\n'\n'\\n'\n'The formal syntax makes no special provision for negative '\n'indices in\\n'\n'sequences; however, built-in sequences all provide a '\n'\"__getitem__()\"\\n'\n'method that interprets negative indices by adding the '\n'length of the\\n'\n'sequence to the index (so that \"x[-1]\" selects the last '\n'item of \"x\").\\n'\n'The resulting value must be a nonnegative integer less than '\n'the number\\n'\n'of items in the sequence, and the subscription selects the '\n'item whose\\n'\n'index is that value (counting from zero). Since the support '\n'for\\n'\n'negative indices and slicing occurs in the object\u2019s '\n'\"__getitem__()\"\\n'\n'method, subclasses overriding this method will need to '\n'explicitly add\\n'\n'that support.\\n'\n'\\n'\n'A string\u2019s items are characters. A character is not a '\n'separate data\\n'\n'type but a string of exactly one character.\\n'\n'\\n'\n'Subscription of certain *classes* or *types* creates a '\n'generic alias.\\n'\n'In this case, user-defined classes can support subscription '\n'by\\n'\n'providing a \"__class_getitem__()\" classmethod.\\n',\n'truth':'Truth Value Testing\\n'\n'*******************\\n'\n'\\n'\n'Any object can be tested for truth value, for use in an \"if\" or\\n'\n'\"while\" condition or as operand of the Boolean operations below.\\n'\n'\\n'\n'By default, an object is considered true unless its class defines\\n'\n'either a \"__bool__()\" method that returns \"False\" or a \"__len__()\"\\n'\n'method that returns zero, when called with the object. [1] Here '\n'are\\n'\n'most of the built-in objects considered false:\\n'\n'\\n'\n'* constants defined to be false: \"None\" and \"False\".\\n'\n'\\n'\n'* zero of any numeric type: \"0\", \"0.0\", \"0j\", \"Decimal(0)\",\\n'\n' \"Fraction(0, 1)\"\\n'\n'\\n'\n'* empty sequences and collections: \"\\'\\'\", \"()\", \"[]\", \"{}\", '\n'\"set()\",\\n'\n' \"range(0)\"\\n'\n'\\n'\n'Operations and built-in functions that have a Boolean result '\n'always\\n'\n'return \"0\" or \"False\" for false and \"1\" or \"True\" for true, unless\\n'\n'otherwise stated. (Important exception: the Boolean operations '\n'\"or\"\\n'\n'and \"and\" always return one of their operands.)\\n',\n'try':'The \"try\" statement\\n'\n'*******************\\n'\n'\\n'\n'The \"try\" statement specifies exception handlers and/or cleanup code\\n'\n'for a group of statements:\\n'\n'\\n'\n' try_stmt ::= try1_stmt | try2_stmt\\n'\n' try1_stmt ::= \"try\" \":\" suite\\n'\n' (\"except\" [expression [\"as\" identifier]] \":\" '\n'suite)+\\n'\n' [\"else\" \":\" suite]\\n'\n' [\"finally\" \":\" suite]\\n'\n' try2_stmt ::= \"try\" \":\" suite\\n'\n' \"finally\" \":\" suite\\n'\n'\\n'\n'The \"except\" clause(s) specify one or more exception handlers. When '\n'no\\n'\n'exception occurs in the \"try\" clause, no exception handler is\\n'\n'executed. When an exception occurs in the \"try\" suite, a search for '\n'an\\n'\n'exception handler is started. This search inspects the except '\n'clauses\\n'\n'in turn until one is found that matches the exception. An '\n'expression-\\n'\n'less except clause, if present, must be last; it matches any\\n'\n'exception. For an except clause with an expression, that expression\\n'\n'is evaluated, and the clause matches the exception if the resulting\\n'\n'object is \u201ccompatible\u201d with the exception. An object is compatible\\n'\n'with an exception if it is the class or a base class of the '\n'exception\\n'\n'object, or a tuple containing an item that is the class or a base\\n'\n'class of the exception object.\\n'\n'\\n'\n'If no except clause matches the exception, the search for an '\n'exception\\n'\n'handler continues in the surrounding code and on the invocation '\n'stack.\\n'\n'[1]\\n'\n'\\n'\n'If the evaluation of an expression in the header of an except clause\\n'\n'raises an exception, the original search for a handler is canceled '\n'and\\n'\n'a search starts for the new exception in the surrounding code and on\\n'\n'the call stack (it is treated as if the entire \"try\" statement '\n'raised\\n'\n'the exception).\\n'\n'\\n'\n'When a matching except clause is found, the exception is assigned to\\n'\n'the target specified after the \"as\" keyword in that except clause, '\n'if\\n'\n'present, and the except clause\u2019s suite is executed. All except\\n'\n'clauses must have an executable block. When the end of this block '\n'is\\n'\n'reached, execution continues normally after the entire try '\n'statement.\\n'\n'(This means that if two nested handlers exist for the same '\n'exception,\\n'\n'and the exception occurs in the try clause of the inner handler, the\\n'\n'outer handler will not handle the exception.)\\n'\n'\\n'\n'When an exception has been assigned using \"as target\", it is cleared\\n'\n'at the end of the except clause. This is as if\\n'\n'\\n'\n' except E as N:\\n'\n' foo\\n'\n'\\n'\n'was translated to\\n'\n'\\n'\n' except E as N:\\n'\n' try:\\n'\n' foo\\n'\n' finally:\\n'\n' del N\\n'\n'\\n'\n'This means the exception must be assigned to a different name to be\\n'\n'able to refer to it after the except clause. Exceptions are cleared\\n'\n'because with the traceback attached to them, they form a reference\\n'\n'cycle with the stack frame, keeping all locals in that frame alive\\n'\n'until the next garbage collection occurs.\\n'\n'\\n'\n'Before an except clause\u2019s suite is executed, details about the\\n'\n'exception are stored in the \"sys\" module and can be accessed via\\n'\n'\"sys.exc_info()\". \"sys.exc_info()\" returns a 3-tuple consisting of '\n'the\\n'\n'exception class, the exception instance and a traceback object (see\\n'\n'section The standard type hierarchy) identifying the point in the\\n'\n'program where the exception occurred. The details about the '\n'exception\\n'\n'accessed via \"sys.exc_info()\" are restored to their previous values\\n'\n'when leaving an exception handler:\\n'\n'\\n'\n' >>> print(sys.exc_info())\\n'\n' (None, None, None)\\n'\n' >>> try:\\n'\n' ... raise TypeError\\n'\n' ... except:\\n'\n' ... print(sys.exc_info())\\n'\n' ... try:\\n'\n' ... raise ValueError\\n'\n' ... except:\\n'\n' ... print(sys.exc_info())\\n'\n' ... print(sys.exc_info())\\n'\n' ...\\n'\n\" (, TypeError(), )\\n'\n\" (, ValueError(), )\\n'\n\" (, TypeError(), )\\n'\n' >>> print(sys.exc_info())\\n'\n' (None, None, None)\\n'\n'\\n'\n'The optional \"else\" clause is executed if the control flow leaves '\n'the\\n'\n'\"try\" suite, no exception was raised, and no \"return\", \"continue\", '\n'or\\n'\n'\"break\" statement was executed. Exceptions in the \"else\" clause are\\n'\n'not handled by the preceding \"except\" clauses.\\n'\n'\\n'\n'If \"finally\" is present, it specifies a \u2018cleanup\u2019 handler. The '\n'\"try\"\\n'\n'clause is executed, including any \"except\" and \"else\" clauses. If '\n'an\\n'\n'exception occurs in any of the clauses and is not handled, the\\n'\n'exception is temporarily saved. The \"finally\" clause is executed. '\n'If\\n'\n'there is a saved exception it is re-raised at the end of the '\n'\"finally\"\\n'\n'clause. If the \"finally\" clause raises another exception, the saved\\n'\n'exception is set as the context of the new exception. If the '\n'\"finally\"\\n'\n'clause executes a \"return\", \"break\" or \"continue\" statement, the '\n'saved\\n'\n'exception is discarded:\\n'\n'\\n'\n' >>> def f():\\n'\n' ... try:\\n'\n' ... 1/0\\n'\n' ... finally:\\n'\n' ... return 42\\n'\n' ...\\n'\n' >>> f()\\n'\n' 42\\n'\n'\\n'\n'The exception information is not available to the program during\\n'\n'execution of the \"finally\" clause.\\n'\n'\\n'\n'When a \"return\", \"break\" or \"continue\" statement is executed in the\\n'\n'\"try\" suite of a \"try\"\u2026\"finally\" statement, the \"finally\" clause is\\n'\n'also executed \u2018on the way out.\u2019\\n'\n'\\n'\n'The return value of a function is determined by the last \"return\"\\n'\n'statement executed. Since the \"finally\" clause always executes, a\\n'\n'\"return\" statement executed in the \"finally\" clause will always be '\n'the\\n'\n'last one executed:\\n'\n'\\n'\n' >>> def foo():\\n'\n' ... try:\\n'\n\" ... return 'try'\\n\"\n' ... finally:\\n'\n\" ... return 'finally'\\n\"\n' ...\\n'\n' >>> foo()\\n'\n\" 'finally'\\n\"\n'\\n'\n'Additional information on exceptions can be found in section\\n'\n'Exceptions, and information on using the \"raise\" statement to '\n'generate\\n'\n'exceptions may be found in section The raise statement.\\n'\n'\\n'\n'Changed in version 3.8: Prior to Python 3.8, a \"continue\" statement\\n'\n'was illegal in the \"finally\" clause due to a problem with the\\n'\n'implementation.\\n',\n'types':'The standard type hierarchy\\n'\n'***************************\\n'\n'\\n'\n'Below is a list of the types that are built into Python. '\n'Extension\\n'\n'modules (written in C, Java, or other languages, depending on the\\n'\n'implementation) can define additional types. Future versions of\\n'\n'Python may add types to the type hierarchy (e.g., rational '\n'numbers,\\n'\n'efficiently stored arrays of integers, etc.), although such '\n'additions\\n'\n'will often be provided via the standard library instead.\\n'\n'\\n'\n'Some of the type descriptions below contain a paragraph listing\\n'\n'\u2018special attributes.\u2019 These are attributes that provide access to '\n'the\\n'\n'implementation and are not intended for general use. Their '\n'definition\\n'\n'may change in the future.\\n'\n'\\n'\n'None\\n'\n' This type has a single value. There is a single object with '\n'this\\n'\n' value. This object is accessed through the built-in name \"None\". '\n'It\\n'\n' is used to signify the absence of a value in many situations, '\n'e.g.,\\n'\n' it is returned from functions that don\u2019t explicitly return\\n'\n' anything. Its truth value is false.\\n'\n'\\n'\n'NotImplemented\\n'\n' This type has a single value. There is a single object with '\n'this\\n'\n' value. This object is accessed through the built-in name\\n'\n' \"NotImplemented\". Numeric methods and rich comparison methods\\n'\n' should return this value if they do not implement the operation '\n'for\\n'\n' the operands provided. (The interpreter will then try the\\n'\n' reflected operation, or some other fallback, depending on the\\n'\n' operator.) It should not be evaluated in a boolean context.\\n'\n'\\n'\n' See Implementing the arithmetic operations for more details.\\n'\n'\\n'\n' Changed in version 3.9: Evaluating \"NotImplemented\" in a '\n'boolean\\n'\n' context is deprecated. While it currently evaluates as true, it\\n'\n' will emit a \"DeprecationWarning\". It will raise a \"TypeError\" in '\n'a\\n'\n' future version of Python.\\n'\n'\\n'\n'Ellipsis\\n'\n' This type has a single value. There is a single object with '\n'this\\n'\n' value. This object is accessed through the literal \"...\" or the\\n'\n' built-in name \"Ellipsis\". Its truth value is true.\\n'\n'\\n'\n'\"numbers.Number\"\\n'\n' These are created by numeric literals and returned as results '\n'by\\n'\n' arithmetic operators and arithmetic built-in functions. '\n'Numeric\\n'\n' objects are immutable; once created their value never changes.\\n'\n' Python numbers are of course strongly related to mathematical\\n'\n' numbers, but subject to the limitations of numerical '\n'representation\\n'\n' in computers.\\n'\n'\\n'\n' The string representations of the numeric classes, computed by\\n'\n' \"__repr__()\" and \"__str__()\", have the following properties:\\n'\n'\\n'\n' * They are valid numeric literals which, when passed to their '\n'class\\n'\n' constructor, produce an object having the value of the '\n'original\\n'\n' numeric.\\n'\n'\\n'\n' * The representation is in base 10, when possible.\\n'\n'\\n'\n' * Leading zeros, possibly excepting a single zero before a '\n'decimal\\n'\n' point, are not shown.\\n'\n'\\n'\n' * Trailing zeros, possibly excepting a single zero after a '\n'decimal\\n'\n' point, are not shown.\\n'\n'\\n'\n' * A sign is shown only when the number is negative.\\n'\n'\\n'\n' Python distinguishes between integers, floating point numbers, '\n'and\\n'\n' complex numbers:\\n'\n'\\n'\n' \"numbers.Integral\"\\n'\n' These represent elements from the mathematical set of '\n'integers\\n'\n' (positive and negative).\\n'\n'\\n'\n' There are two types of integers:\\n'\n'\\n'\n' Integers (\"int\")\\n'\n' These represent numbers in an unlimited range, subject to\\n'\n' available (virtual) memory only. For the purpose of '\n'shift\\n'\n' and mask operations, a binary representation is assumed, '\n'and\\n'\n' negative numbers are represented in a variant of 2\u2019s\\n'\n' complement which gives the illusion of an infinite string '\n'of\\n'\n' sign bits extending to the left.\\n'\n'\\n'\n' Booleans (\"bool\")\\n'\n' These represent the truth values False and True. The two\\n'\n' objects representing the values \"False\" and \"True\" are '\n'the\\n'\n' only Boolean objects. The Boolean type is a subtype of '\n'the\\n'\n' integer type, and Boolean values behave like the values 0 '\n'and\\n'\n' 1, respectively, in almost all contexts, the exception '\n'being\\n'\n' that when converted to a string, the strings \"\"False\"\" or\\n'\n' \"\"True\"\" are returned, respectively.\\n'\n'\\n'\n' The rules for integer representation are intended to give '\n'the\\n'\n' most meaningful interpretation of shift and mask operations\\n'\n' involving negative integers.\\n'\n'\\n'\n' \"numbers.Real\" (\"float\")\\n'\n' These represent machine-level double precision floating '\n'point\\n'\n' numbers. You are at the mercy of the underlying machine\\n'\n' architecture (and C or Java implementation) for the accepted\\n'\n' range and handling of overflow. Python does not support '\n'single-\\n'\n' precision floating point numbers; the savings in processor '\n'and\\n'\n' memory usage that are usually the reason for using these are\\n'\n' dwarfed by the overhead of using objects in Python, so there '\n'is\\n'\n' no reason to complicate the language with two kinds of '\n'floating\\n'\n' point numbers.\\n'\n'\\n'\n' \"numbers.Complex\" (\"complex\")\\n'\n' These represent complex numbers as a pair of machine-level\\n'\n' double precision floating point numbers. The same caveats '\n'apply\\n'\n' as for floating point numbers. The real and imaginary parts '\n'of a\\n'\n' complex number \"z\" can be retrieved through the read-only\\n'\n' attributes \"z.real\" and \"z.imag\".\\n'\n'\\n'\n'Sequences\\n'\n' These represent finite ordered sets indexed by non-negative\\n'\n' numbers. The built-in function \"len()\" returns the number of '\n'items\\n'\n' of a sequence. When the length of a sequence is *n*, the index '\n'set\\n'\n' contains the numbers 0, 1, \u2026, *n*-1. Item *i* of sequence *a* '\n'is\\n'\n' selected by \"a[i]\".\\n'\n'\\n'\n' Sequences also support slicing: \"a[i:j]\" selects all items with\\n'\n' index *k* such that *i* \"<=\" *k* \"<\" *j*. When used as an\\n'\n' expression, a slice is a sequence of the same type. This '\n'implies\\n'\n' that the index set is renumbered so that it starts at 0.\\n'\n'\\n'\n' Some sequences also support \u201cextended slicing\u201d with a third '\n'\u201cstep\u201d\\n'\n' parameter: \"a[i:j:k]\" selects all items of *a* with index *x* '\n'where\\n'\n' \"x = i + n*k\", *n* \">=\" \"0\" and *i* \"<=\" *x* \"<\" *j*.\\n'\n'\\n'\n' Sequences are distinguished according to their mutability:\\n'\n'\\n'\n' Immutable sequences\\n'\n' An object of an immutable sequence type cannot change once it '\n'is\\n'\n' created. (If the object contains references to other '\n'objects,\\n'\n' these other objects may be mutable and may be changed; '\n'however,\\n'\n' the collection of objects directly referenced by an '\n'immutable\\n'\n' object cannot change.)\\n'\n'\\n'\n' The following types are immutable sequences:\\n'\n'\\n'\n' Strings\\n'\n' A string is a sequence of values that represent Unicode '\n'code\\n'\n' points. All the code points in the range \"U+0000 - '\n'U+10FFFF\"\\n'\n' can be represented in a string. Python doesn\u2019t have a '\n'*char*\\n'\n' type; instead, every code point in the string is '\n'represented\\n'\n' as a string object with length \"1\". The built-in '\n'function\\n'\n' \"ord()\" converts a code point from its string form to an\\n'\n' integer in the range \"0 - 10FFFF\"; \"chr()\" converts an\\n'\n' integer in the range \"0 - 10FFFF\" to the corresponding '\n'length\\n'\n' \"1\" string object. \"str.encode()\" can be used to convert '\n'a\\n'\n' \"str\" to \"bytes\" using the given text encoding, and\\n'\n' \"bytes.decode()\" can be used to achieve the opposite.\\n'\n'\\n'\n' Tuples\\n'\n' The items of a tuple are arbitrary Python objects. Tuples '\n'of\\n'\n' two or more items are formed by comma-separated lists of\\n'\n' expressions. A tuple of one item (a \u2018singleton\u2019) can be\\n'\n' formed by affixing a comma to an expression (an expression '\n'by\\n'\n' itself does not create a tuple, since parentheses must be\\n'\n' usable for grouping of expressions). An empty tuple can '\n'be\\n'\n' formed by an empty pair of parentheses.\\n'\n'\\n'\n' Bytes\\n'\n' A bytes object is an immutable array. The items are '\n'8-bit\\n'\n' bytes, represented by integers in the range 0 <= x < 256.\\n'\n' Bytes literals (like \"b\\'abc\\'\") and the built-in '\n'\"bytes()\"\\n'\n' constructor can be used to create bytes objects. Also, '\n'bytes\\n'\n' objects can be decoded to strings via the \"decode()\" '\n'method.\\n'\n'\\n'\n' Mutable sequences\\n'\n' Mutable sequences can be changed after they are created. '\n'The\\n'\n' subscription and slicing notations can be used as the target '\n'of\\n'\n' assignment and \"del\" (delete) statements.\\n'\n'\\n'\n' There are currently two intrinsic mutable sequence types:\\n'\n'\\n'\n' Lists\\n'\n' The items of a list are arbitrary Python objects. Lists '\n'are\\n'\n' formed by placing a comma-separated list of expressions '\n'in\\n'\n' square brackets. (Note that there are no special cases '\n'needed\\n'\n' to form lists of length 0 or 1.)\\n'\n'\\n'\n' Byte Arrays\\n'\n' A bytearray object is a mutable array. They are created '\n'by\\n'\n' the built-in \"bytearray()\" constructor. Aside from being\\n'\n' mutable (and hence unhashable), byte arrays otherwise '\n'provide\\n'\n' the same interface and functionality as immutable \"bytes\"\\n'\n' objects.\\n'\n'\\n'\n' The extension module \"array\" provides an additional example '\n'of a\\n'\n' mutable sequence type, as does the \"collections\" module.\\n'\n'\\n'\n'Set types\\n'\n' These represent unordered, finite sets of unique, immutable\\n'\n' objects. As such, they cannot be indexed by any subscript. '\n'However,\\n'\n' they can be iterated over, and the built-in function \"len()\"\\n'\n' returns the number of items in a set. Common uses for sets are '\n'fast\\n'\n' membership testing, removing duplicates from a sequence, and\\n'\n' computing mathematical operations such as intersection, union,\\n'\n' difference, and symmetric difference.\\n'\n'\\n'\n' For set elements, the same immutability rules apply as for\\n'\n' dictionary keys. Note that numeric types obey the normal rules '\n'for\\n'\n' numeric comparison: if two numbers compare equal (e.g., \"1\" and\\n'\n' \"1.0\"), only one of them can be contained in a set.\\n'\n'\\n'\n' There are currently two intrinsic set types:\\n'\n'\\n'\n' Sets\\n'\n' These represent a mutable set. They are created by the '\n'built-in\\n'\n' \"set()\" constructor and can be modified afterwards by '\n'several\\n'\n' methods, such as \"add()\".\\n'\n'\\n'\n' Frozen sets\\n'\n' These represent an immutable set. They are created by the\\n'\n' built-in \"frozenset()\" constructor. As a frozenset is '\n'immutable\\n'\n' and *hashable*, it can be used again as an element of '\n'another\\n'\n' set, or as a dictionary key.\\n'\n'\\n'\n'Mappings\\n'\n' These represent finite sets of objects indexed by arbitrary '\n'index\\n'\n' sets. The subscript notation \"a[k]\" selects the item indexed by '\n'\"k\"\\n'\n' from the mapping \"a\"; this can be used in expressions and as '\n'the\\n'\n' target of assignments or \"del\" statements. The built-in '\n'function\\n'\n' \"len()\" returns the number of items in a mapping.\\n'\n'\\n'\n' There is currently a single intrinsic mapping type:\\n'\n'\\n'\n' Dictionaries\\n'\n' These represent finite sets of objects indexed by nearly\\n'\n' arbitrary values. The only types of values not acceptable '\n'as\\n'\n' keys are values containing lists or dictionaries or other\\n'\n' mutable types that are compared by value rather than by '\n'object\\n'\n' identity, the reason being that the efficient implementation '\n'of\\n'\n' dictionaries requires a key\u2019s hash value to remain constant.\\n'\n' Numeric types used for keys obey the normal rules for '\n'numeric\\n'\n' comparison: if two numbers compare equal (e.g., \"1\" and '\n'\"1.0\")\\n'\n' then they can be used interchangeably to index the same\\n'\n' dictionary entry.\\n'\n'\\n'\n' Dictionaries preserve insertion order, meaning that keys will '\n'be\\n'\n' produced in the same order they were added sequentially over '\n'the\\n'\n' dictionary. Replacing an existing key does not change the '\n'order,\\n'\n' however removing a key and re-inserting it will add it to '\n'the\\n'\n' end instead of keeping its old place.\\n'\n'\\n'\n' Dictionaries are mutable; they can be created by the \"{...}\"\\n'\n' notation (see section Dictionary displays).\\n'\n'\\n'\n' The extension modules \"dbm.ndbm\" and \"dbm.gnu\" provide\\n'\n' additional examples of mapping types, as does the '\n'\"collections\"\\n'\n' module.\\n'\n'\\n'\n' Changed in version 3.7: Dictionaries did not preserve '\n'insertion\\n'\n' order in versions of Python before 3.6. In CPython 3.6,\\n'\n' insertion order was preserved, but it was considered an\\n'\n' implementation detail at that time rather than a language\\n'\n' guarantee.\\n'\n'\\n'\n'Callable types\\n'\n' These are the types to which the function call operation (see\\n'\n' section Calls) can be applied:\\n'\n'\\n'\n' User-defined functions\\n'\n' A user-defined function object is created by a function\\n'\n' definition (see section Function definitions). It should be\\n'\n' called with an argument list containing the same number of '\n'items\\n'\n' as the function\u2019s formal parameter list.\\n'\n'\\n'\n' Special attributes:\\n'\n'\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | Attribute | Meaning '\n'| |\\n'\n' '\n'|===========================|=================================|=============|\\n'\n' | \"__doc__\" | The function\u2019s documentation '\n'| Writable |\\n'\n' | | string, or \"None\" if '\n'| |\\n'\n' | | unavailable; not inherited by '\n'| |\\n'\n' | | subclasses. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__name__\" | The function\u2019s name. '\n'| Writable |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__qualname__\" | The function\u2019s *qualified '\n'| Writable |\\n'\n' | | name*. New in version 3.3. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__module__\" | The name of the module the '\n'| Writable |\\n'\n' | | function was defined in, or '\n'| |\\n'\n' | | \"None\" if unavailable. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__defaults__\" | A tuple containing default '\n'| Writable |\\n'\n' | | argument values for those '\n'| |\\n'\n' | | arguments that have defaults, '\n'| |\\n'\n' | | or \"None\" if no arguments have '\n'| |\\n'\n' | | a default value. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__code__\" | The code object representing '\n'| Writable |\\n'\n' | | the compiled function body. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__globals__\" | A reference to the dictionary '\n'| Read-only |\\n'\n' | | that holds the function\u2019s '\n'| |\\n'\n' | | global variables \u2014 the global '\n'| |\\n'\n' | | namespace of the module in '\n'| |\\n'\n' | | which the function was defined. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__dict__\" | The namespace supporting '\n'| Writable |\\n'\n' | | arbitrary function attributes. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__closure__\" | \"None\" or a tuple of cells that '\n'| Read-only |\\n'\n' | | contain bindings for the '\n'| |\\n'\n' | | function\u2019s free variables. See '\n'| |\\n'\n' | | below for information on the '\n'| |\\n'\n' | | \"cell_contents\" attribute. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__annotations__\" | A dict containing annotations '\n'| Writable |\\n'\n' | | of parameters. The keys of the '\n'| |\\n'\n' | | dict are the parameter names, '\n'| |\\n'\n' | | and \"\\'return\\'\" for the '\n'return | |\\n'\n' | | annotation, if provided. For '\n'| |\\n'\n' | | more information on working '\n'| |\\n'\n' | | with this attribute, see '\n'| |\\n'\n' | | Annotations Best Practices. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n' | \"__kwdefaults__\" | A dict containing defaults for '\n'| Writable |\\n'\n' | | keyword-only parameters. '\n'| |\\n'\n' '\n'+---------------------------+---------------------------------+-------------+\\n'\n'\\n'\n' Most of the attributes labelled \u201cWritable\u201d check the type of '\n'the\\n'\n' assigned value.\\n'\n'\\n'\n' Function objects also support getting and setting arbitrary\\n'\n' attributes, which can be used, for example, to attach '\n'metadata\\n'\n' to functions. Regular attribute dot-notation is used to get '\n'and\\n'\n' set such attributes. *Note that the current implementation '\n'only\\n'\n' supports function attributes on user-defined functions. '\n'Function\\n'\n' attributes on built-in functions may be supported in the\\n'\n' future.*\\n'\n'\\n'\n' A cell object has the attribute \"cell_contents\". This can be\\n'\n' used to get the value of the cell, as well as set the value.\\n'\n'\\n'\n' Additional information about a function\u2019s definition can be\\n'\n' retrieved from its code object; see the description of '\n'internal\\n'\n' types below. The \"cell\" type can be accessed in the \"types\"\\n'\n' module.\\n'\n'\\n'\n' Instance methods\\n'\n' An instance method object combines a class, a class instance '\n'and\\n'\n' any callable object (normally a user-defined function).\\n'\n'\\n'\n' Special read-only attributes: \"__self__\" is the class '\n'instance\\n'\n' object, \"__func__\" is the function object; \"__doc__\" is the\\n'\n' method\u2019s documentation (same as \"__func__.__doc__\"); '\n'\"__name__\"\\n'\n' is the method name (same as \"__func__.__name__\"); '\n'\"__module__\"\\n'\n' is the name of the module the method was defined in, or '\n'\"None\"\\n'\n' if unavailable.\\n'\n'\\n'\n' Methods also support accessing (but not setting) the '\n'arbitrary\\n'\n' function attributes on the underlying function object.\\n'\n'\\n'\n' User-defined method objects may be created when getting an\\n'\n' attribute of a class (perhaps via an instance of that class), '\n'if\\n'\n' that attribute is a user-defined function object or a class\\n'\n' method object.\\n'\n'\\n'\n' When an instance method object is created by retrieving a '\n'user-\\n'\n' defined function object from a class via one of its '\n'instances,\\n'\n' its \"__self__\" attribute is the instance, and the method '\n'object\\n'\n' is said to be bound. The new method\u2019s \"__func__\" attribute '\n'is\\n'\n' the original function object.\\n'\n'\\n'\n' When an instance method object is created by retrieving a '\n'class\\n'\n' method object from a class or instance, its \"__self__\" '\n'attribute\\n'\n' is the class itself, and its \"__func__\" attribute is the\\n'\n' function object underlying the class method.\\n'\n'\\n'\n' When an instance method object is called, the underlying\\n'\n' function (\"__func__\") is called, inserting the class '\n'instance\\n'\n' (\"__self__\") in front of the argument list. For instance, '\n'when\\n'\n' \"C\" is a class which contains a definition for a function '\n'\"f()\",\\n'\n' and \"x\" is an instance of \"C\", calling \"x.f(1)\" is equivalent '\n'to\\n'\n' calling \"C.f(x, 1)\".\\n'\n'\\n'\n' When an instance method object is derived from a class '\n'method\\n'\n' object, the \u201cclass instance\u201d stored in \"__self__\" will '\n'actually\\n'\n' be the class itself, so that calling either \"x.f(1)\" or '\n'\"C.f(1)\"\\n'\n' is equivalent to calling \"f(C,1)\" where \"f\" is the '\n'underlying\\n'\n' function.\\n'\n'\\n'\n' Note that the transformation from function object to '\n'instance\\n'\n' method object happens each time the attribute is retrieved '\n'from\\n'\n' the instance. In some cases, a fruitful optimization is to\\n'\n' assign the attribute to a local variable and call that local\\n'\n' variable. Also notice that this transformation only happens '\n'for\\n'\n' user-defined functions; other callable objects (and all non-\\n'\n' callable objects) are retrieved without transformation. It '\n'is\\n'\n' also important to note that user-defined functions which are\\n'\n' attributes of a class instance are not converted to bound\\n'\n' methods; this *only* happens when the function is an '\n'attribute\\n'\n' of the class.\\n'\n'\\n'\n' Generator functions\\n'\n' A function or method which uses the \"yield\" statement (see\\n'\n' section The yield statement) is called a *generator '\n'function*.\\n'\n' Such a function, when called, always returns an iterator '\n'object\\n'\n' which can be used to execute the body of the function: '\n'calling\\n'\n' the iterator\u2019s \"iterator.__next__()\" method will cause the\\n'\n' function to execute until it provides a value using the '\n'\"yield\"\\n'\n' statement. When the function executes a \"return\" statement '\n'or\\n'\n' falls off the end, a \"StopIteration\" exception is raised and '\n'the\\n'\n' iterator will have reached the end of the set of values to '\n'be\\n'\n' returned.\\n'\n'\\n'\n' Coroutine functions\\n'\n' A function or method which is defined using \"async def\" is\\n'\n' called a *coroutine function*. Such a function, when '\n'called,\\n'\n' returns a *coroutine* object. It may contain \"await\"\\n'\n' expressions, as well as \"async with\" and \"async for\" '\n'statements.\\n'\n' See also the Coroutine Objects section.\\n'\n'\\n'\n' Asynchronous generator functions\\n'\n' A function or method which is defined using \"async def\" and\\n'\n' which uses the \"yield\" statement is called a *asynchronous\\n'\n' generator function*. Such a function, when called, returns '\n'an\\n'\n' asynchronous iterator object which can be used in an \"async '\n'for\"\\n'\n' statement to execute the body of the function.\\n'\n'\\n'\n' Calling the asynchronous iterator\u2019s \"aiterator.__anext__()\"\\n'\n' method will return an *awaitable* which when awaited will\\n'\n' execute until it provides a value using the \"yield\" '\n'expression.\\n'\n' When the function executes an empty \"return\" statement or '\n'falls\\n'\n' off the end, a \"StopAsyncIteration\" exception is raised and '\n'the\\n'\n' asynchronous iterator will have reached the end of the set '\n'of\\n'\n' values to be yielded.\\n'\n'\\n'\n' Built-in functions\\n'\n' A built-in function object is a wrapper around a C function.\\n'\n' Examples of built-in functions are \"len()\" and \"math.sin()\"\\n'\n' (\"math\" is a standard built-in module). The number and type '\n'of\\n'\n' the arguments are determined by the C function. Special '\n'read-\\n'\n' only attributes: \"__doc__\" is the function\u2019s documentation\\n'\n' string, or \"None\" if unavailable; \"__name__\" is the '\n'function\u2019s\\n'\n' name; \"__self__\" is set to \"None\" (but see the next item);\\n'\n' \"__module__\" is the name of the module the function was '\n'defined\\n'\n' in or \"None\" if unavailable.\\n'\n'\\n'\n' Built-in methods\\n'\n' This is really a different disguise of a built-in function, '\n'this\\n'\n' time containing an object passed to the C function as an\\n'\n' implicit extra argument. An example of a built-in method is\\n'\n' \"alist.append()\", assuming *alist* is a list object. In this\\n'\n' case, the special read-only attribute \"__self__\" is set to '\n'the\\n'\n' object denoted by *alist*.\\n'\n'\\n'\n' Classes\\n'\n' Classes are callable. These objects normally act as '\n'factories\\n'\n' for new instances of themselves, but variations are possible '\n'for\\n'\n' class types that override \"__new__()\". The arguments of the\\n'\n' call are passed to \"__new__()\" and, in the typical case, to\\n'\n' \"__init__()\" to initialize the new instance.\\n'\n'\\n'\n' Class Instances\\n'\n' Instances of arbitrary classes can be made callable by '\n'defining\\n'\n' a \"__call__()\" method in their class.\\n'\n'\\n'\n'Modules\\n'\n' Modules are a basic organizational unit of Python code, and are\\n'\n' created by the import system as invoked either by the \"import\"\\n'\n' statement, or by calling functions such as\\n'\n' \"importlib.import_module()\" and built-in \"__import__()\". A '\n'module\\n'\n' object has a namespace implemented by a dictionary object (this '\n'is\\n'\n' the dictionary referenced by the \"__globals__\" attribute of\\n'\n' functions defined in the module). Attribute references are\\n'\n' translated to lookups in this dictionary, e.g., \"m.x\" is '\n'equivalent\\n'\n' to \"m.__dict__[\"x\"]\". A module object does not contain the code\\n'\n' object used to initialize the module (since it isn\u2019t needed '\n'once\\n'\n' the initialization is done).\\n'\n'\\n'\n' Attribute assignment updates the module\u2019s namespace dictionary,\\n'\n' e.g., \"m.x = 1\" is equivalent to \"m.__dict__[\"x\"] = 1\".\\n'\n'\\n'\n' Predefined (writable) attributes:\\n'\n'\\n'\n' \"__name__\"\\n'\n' The module\u2019s name.\\n'\n'\\n'\n' \"__doc__\"\\n'\n' The module\u2019s documentation string, or \"None\" if '\n'unavailable.\\n'\n'\\n'\n' \"__file__\"\\n'\n' The pathname of the file from which the module was loaded, '\n'if\\n'\n' it was loaded from a file. The \"__file__\" attribute may '\n'be\\n'\n' missing for certain types of modules, such as C modules '\n'that\\n'\n' are statically linked into the interpreter. For '\n'extension\\n'\n' modules loaded dynamically from a shared library, it\u2019s '\n'the\\n'\n' pathname of the shared library file.\\n'\n'\\n'\n' \"__annotations__\"\\n'\n' A dictionary containing *variable annotations* collected\\n'\n' during module body execution. For best practices on '\n'working\\n'\n' with \"__annotations__\", please see Annotations Best\\n'\n' Practices.\\n'\n'\\n'\n' Special read-only attribute: \"__dict__\" is the module\u2019s '\n'namespace\\n'\n' as a dictionary object.\\n'\n'\\n'\n' **CPython implementation detail:** Because of the way CPython\\n'\n' clears module dictionaries, the module dictionary will be '\n'cleared\\n'\n' when the module falls out of scope even if the dictionary still '\n'has\\n'\n' live references. To avoid this, copy the dictionary or keep '\n'the\\n'\n' module around while using its dictionary directly.\\n'\n'\\n'\n'Custom classes\\n'\n' Custom class types are typically created by class definitions '\n'(see\\n'\n' section Class definitions). A class has a namespace implemented '\n'by\\n'\n' a dictionary object. Class attribute references are translated '\n'to\\n'\n' lookups in this dictionary, e.g., \"C.x\" is translated to\\n'\n' \"C.__dict__[\"x\"]\" (although there are a number of hooks which '\n'allow\\n'\n' for other means of locating attributes). When the attribute name '\n'is\\n'\n' not found there, the attribute search continues in the base\\n'\n' classes. This search of the base classes uses the C3 method\\n'\n' resolution order which behaves correctly even in the presence '\n'of\\n'\n' \u2018diamond\u2019 inheritance structures where there are multiple\\n'\n' inheritance paths leading back to a common ancestor. Additional\\n'\n' details on the C3 MRO used by Python can be found in the\\n'\n' documentation accompanying the 2.3 release at\\n'\n' https://www.python.org/download/releases/2.3/mro/.\\n'\n'\\n'\n' When a class attribute reference (for class \"C\", say) would '\n'yield a\\n'\n' class method object, it is transformed into an instance method\\n'\n' object whose \"__self__\" attribute is \"C\". When it would yield '\n'a\\n'\n' static method object, it is transformed into the object wrapped '\n'by\\n'\n' the static method object. See section Implementing Descriptors '\n'for\\n'\n' another way in which attributes retrieved from a class may '\n'differ\\n'\n' from those actually contained in its \"__dict__\".\\n'\n'\\n'\n' Class attribute assignments update the class\u2019s dictionary, '\n'never\\n'\n' the dictionary of a base class.\\n'\n'\\n'\n' A class object can be called (see above) to yield a class '\n'instance\\n'\n' (see below).\\n'\n'\\n'\n' Special attributes:\\n'\n'\\n'\n' \"__name__\"\\n'\n' The class name.\\n'\n'\\n'\n' \"__module__\"\\n'\n' The name of the module in which the class was defined.\\n'\n'\\n'\n' \"__dict__\"\\n'\n' The dictionary containing the class\u2019s namespace.\\n'\n'\\n'\n' \"__bases__\"\\n'\n' A tuple containing the base classes, in the order of '\n'their\\n'\n' occurrence in the base class list.\\n'\n'\\n'\n' \"__doc__\"\\n'\n' The class\u2019s documentation string, or \"None\" if undefined.\\n'\n'\\n'\n' \"__annotations__\"\\n'\n' A dictionary containing *variable annotations* collected\\n'\n' during class body execution. For best practices on '\n'working\\n'\n' with \"__annotations__\", please see Annotations Best\\n'\n' Practices.\\n'\n'\\n'\n'Class instances\\n'\n' A class instance is created by calling a class object (see '\n'above).\\n'\n' A class instance has a namespace implemented as a dictionary '\n'which\\n'\n' is the first place in which attribute references are searched.\\n'\n' When an attribute is not found there, and the instance\u2019s class '\n'has\\n'\n' an attribute by that name, the search continues with the class\\n'\n' attributes. If a class attribute is found that is a '\n'user-defined\\n'\n' function object, it is transformed into an instance method '\n'object\\n'\n' whose \"__self__\" attribute is the instance. Static method and\\n'\n' class method objects are also transformed; see above under\\n'\n' \u201cClasses\u201d. See section Implementing Descriptors for another way '\n'in\\n'\n' which attributes of a class retrieved via its instances may '\n'differ\\n'\n' from the objects actually stored in the class\u2019s \"__dict__\". If '\n'no\\n'\n' class attribute is found, and the object\u2019s class has a\\n'\n' \"__getattr__()\" method, that is called to satisfy the lookup.\\n'\n'\\n'\n' Attribute assignments and deletions update the instance\u2019s\\n'\n' dictionary, never a class\u2019s dictionary. If the class has a\\n'\n' \"__setattr__()\" or \"__delattr__()\" method, this is called '\n'instead\\n'\n' of updating the instance dictionary directly.\\n'\n'\\n'\n' Class instances can pretend to be numbers, sequences, or '\n'mappings\\n'\n' if they have methods with certain special names. See section\\n'\n' Special method names.\\n'\n'\\n'\n' Special attributes: \"__dict__\" is the attribute dictionary;\\n'\n' \"__class__\" is the instance\u2019s class.\\n'\n'\\n'\n'I/O objects (also known as file objects)\\n'\n' A *file object* represents an open file. Various shortcuts are\\n'\n' available to create file objects: the \"open()\" built-in '\n'function,\\n'\n' and also \"os.popen()\", \"os.fdopen()\", and the \"makefile()\" '\n'method\\n'\n' of socket objects (and perhaps by other functions or methods\\n'\n' provided by extension modules).\\n'\n'\\n'\n' The objects \"sys.stdin\", \"sys.stdout\" and \"sys.stderr\" are\\n'\n' initialized to file objects corresponding to the interpreter\u2019s\\n'\n' standard input, output and error streams; they are all open in '\n'text\\n'\n' mode and therefore follow the interface defined by the\\n'\n' \"io.TextIOBase\" abstract class.\\n'\n'\\n'\n'Internal types\\n'\n' A few types used internally by the interpreter are exposed to '\n'the\\n'\n' user. Their definitions may change with future versions of the\\n'\n' interpreter, but they are mentioned here for completeness.\\n'\n'\\n'\n' Code objects\\n'\n' Code objects represent *byte-compiled* executable Python '\n'code,\\n'\n' or *bytecode*. The difference between a code object and a\\n'\n' function object is that the function object contains an '\n'explicit\\n'\n' reference to the function\u2019s globals (the module in which it '\n'was\\n'\n' defined), while a code object contains no context; also the\\n'\n' default argument values are stored in the function object, '\n'not\\n'\n' in the code object (because they represent values calculated '\n'at\\n'\n' run-time). Unlike function objects, code objects are '\n'immutable\\n'\n' and contain no references (directly or indirectly) to '\n'mutable\\n'\n' objects.\\n'\n'\\n'\n' Special read-only attributes: \"co_name\" gives the function '\n'name;\\n'\n' \"co_argcount\" is the total number of positional arguments\\n'\n' (including positional-only arguments and arguments with '\n'default\\n'\n' values); \"co_posonlyargcount\" is the number of '\n'positional-only\\n'\n' arguments (including arguments with default values);\\n'\n' \"co_kwonlyargcount\" is the number of keyword-only arguments\\n'\n' (including arguments with default values); \"co_nlocals\" is '\n'the\\n'\n' number of local variables used by the function (including\\n'\n' arguments); \"co_varnames\" is a tuple containing the names of '\n'the\\n'\n' local variables (starting with the argument names);\\n'\n' \"co_cellvars\" is a tuple containing the names of local '\n'variables\\n'\n' that are referenced by nested functions; \"co_freevars\" is a\\n'\n' tuple containing the names of free variables; \"co_code\" is a\\n'\n' string representing the sequence of bytecode instructions;\\n'\n' \"co_consts\" is a tuple containing the literals used by the\\n'\n' bytecode; \"co_names\" is a tuple containing the names used by '\n'the\\n'\n' bytecode; \"co_filename\" is the filename from which the code '\n'was\\n'\n' compiled; \"co_firstlineno\" is the first line number of the\\n'\n' function; \"co_lnotab\" is a string encoding the mapping from\\n'\n' bytecode offsets to line numbers (for details see the source\\n'\n' code of the interpreter); \"co_stacksize\" is the required '\n'stack\\n'\n' size; \"co_flags\" is an integer encoding a number of flags '\n'for\\n'\n' the interpreter.\\n'\n'\\n'\n' The following flag bits are defined for \"co_flags\": bit '\n'\"0x04\"\\n'\n' is set if the function uses the \"*arguments\" syntax to accept '\n'an\\n'\n' arbitrary number of positional arguments; bit \"0x08\" is set '\n'if\\n'\n' the function uses the \"**keywords\" syntax to accept '\n'arbitrary\\n'\n' keyword arguments; bit \"0x20\" is set if the function is a\\n'\n' generator.\\n'\n'\\n'\n' Future feature declarations (\"from __future__ import '\n'division\")\\n'\n' also use bits in \"co_flags\" to indicate whether a code '\n'object\\n'\n' was compiled with a particular feature enabled: bit \"0x2000\" '\n'is\\n'\n' set if the function was compiled with future division '\n'enabled;\\n'\n' bits \"0x10\" and \"0x1000\" were used in earlier versions of\\n'\n' Python.\\n'\n'\\n'\n' Other bits in \"co_flags\" are reserved for internal use.\\n'\n'\\n'\n' If a code object represents a function, the first item in\\n'\n' \"co_consts\" is the documentation string of the function, or\\n'\n' \"None\" if undefined.\\n'\n'\\n'\n' Frame objects\\n'\n' Frame objects represent execution frames. They may occur in\\n'\n' traceback objects (see below), and are also passed to '\n'registered\\n'\n' trace functions.\\n'\n'\\n'\n' Special read-only attributes: \"f_back\" is to the previous '\n'stack\\n'\n' frame (towards the caller), or \"None\" if this is the bottom\\n'\n' stack frame; \"f_code\" is the code object being executed in '\n'this\\n'\n' frame; \"f_locals\" is the dictionary used to look up local\\n'\n' variables; \"f_globals\" is used for global variables;\\n'\n' \"f_builtins\" is used for built-in (intrinsic) names; '\n'\"f_lasti\"\\n'\n' gives the precise instruction (this is an index into the\\n'\n' bytecode string of the code object).\\n'\n'\\n'\n' Accessing \"f_code\" raises an auditing event '\n'\"object.__getattr__\"\\n'\n' with arguments \"obj\" and \"\"f_code\"\".\\n'\n'\\n'\n' Special writable attributes: \"f_trace\", if not \"None\", is a\\n'\n' function called for various events during code execution '\n'(this\\n'\n' is used by the debugger). Normally an event is triggered for\\n'\n' each new source line - this can be disabled by setting\\n'\n' \"f_trace_lines\" to \"False\".\\n'\n'\\n'\n' Implementations *may* allow per-opcode events to be requested '\n'by\\n'\n' setting \"f_trace_opcodes\" to \"True\". Note that this may lead '\n'to\\n'\n' undefined interpreter behaviour if exceptions raised by the\\n'\n' trace function escape to the function being traced.\\n'\n'\\n'\n' \"f_lineno\" is the current line number of the frame \u2014 writing '\n'to\\n'\n' this from within a trace function jumps to the given line '\n'(only\\n'\n' for the bottom-most frame). A debugger can implement a Jump\\n'\n' command (aka Set Next Statement) by writing to f_lineno.\\n'\n'\\n'\n' Frame objects support one method:\\n'\n'\\n'\n' frame.clear()\\n'\n'\\n'\n' This method clears all references to local variables held '\n'by\\n'\n' the frame. Also, if the frame belonged to a generator, '\n'the\\n'\n' generator is finalized. This helps break reference '\n'cycles\\n'\n' involving frame objects (for example when catching an\\n'\n' exception and storing its traceback for later use).\\n'\n'\\n'\n' \"RuntimeError\" is raised if the frame is currently '\n'executing.\\n'\n'\\n'\n' New in version 3.4.\\n'\n'\\n'\n' Traceback objects\\n'\n' Traceback objects represent a stack trace of an exception. '\n'A\\n'\n' traceback object is implicitly created when an exception '\n'occurs,\\n'\n' and may also be explicitly created by calling\\n'\n' \"types.TracebackType\".\\n'\n'\\n'\n' For implicitly created tracebacks, when the search for an\\n'\n' exception handler unwinds the execution stack, at each '\n'unwound\\n'\n' level a traceback object is inserted in front of the current\\n'\n' traceback. When an exception handler is entered, the stack\\n'\n' trace is made available to the program. (See section The try\\n'\n' statement.) It is accessible as the third item of the tuple\\n'\n' returned by \"sys.exc_info()\", and as the \"__traceback__\"\\n'\n' attribute of the caught exception.\\n'\n'\\n'\n' When the program contains no suitable handler, the stack '\n'trace\\n'\n' is written (nicely formatted) to the standard error stream; '\n'if\\n'\n' the interpreter is interactive, it is also made available to '\n'the\\n'\n' user as \"sys.last_traceback\".\\n'\n'\\n'\n' For explicitly created tracebacks, it is up to the creator '\n'of\\n'\n' the traceback to determine how the \"tb_next\" attributes '\n'should\\n'\n' be linked to form a full stack trace.\\n'\n'\\n'\n' Special read-only attributes: \"tb_frame\" points to the '\n'execution\\n'\n' frame of the current level; \"tb_lineno\" gives the line '\n'number\\n'\n' where the exception occurred; \"tb_lasti\" indicates the '\n'precise\\n'\n' instruction. The line number and last instruction in the\\n'\n' traceback may differ from the line number of its frame object '\n'if\\n'\n' the exception occurred in a \"try\" statement with no matching\\n'\n' except clause or with a finally clause.\\n'\n'\\n'\n' Accessing \"tb_frame\" raises an auditing event\\n'\n' \"object.__getattr__\" with arguments \"obj\" and \"\"tb_frame\"\".\\n'\n'\\n'\n' Special writable attribute: \"tb_next\" is the next level in '\n'the\\n'\n' stack trace (towards the frame where the exception occurred), '\n'or\\n'\n' \"None\" if there is no next level.\\n'\n'\\n'\n' Changed in version 3.7: Traceback objects can now be '\n'explicitly\\n'\n' instantiated from Python code, and the \"tb_next\" attribute '\n'of\\n'\n' existing instances can be updated.\\n'\n'\\n'\n' Slice objects\\n'\n' Slice objects are used to represent slices for '\n'\"__getitem__()\"\\n'\n' methods. They are also created by the built-in \"slice()\"\\n'\n' function.\\n'\n'\\n'\n' Special read-only attributes: \"start\" is the lower bound; '\n'\"stop\"\\n'\n' is the upper bound; \"step\" is the step value; each is \"None\" '\n'if\\n'\n' omitted. These attributes can have any type.\\n'\n'\\n'\n' Slice objects support one method:\\n'\n'\\n'\n' slice.indices(self, length)\\n'\n'\\n'\n' This method takes a single integer argument *length* and\\n'\n' computes information about the slice that the slice '\n'object\\n'\n' would describe if applied to a sequence of *length* '\n'items.\\n'\n' It returns a tuple of three integers; respectively these '\n'are\\n'\n' the *start* and *stop* indices and the *step* or stride\\n'\n' length of the slice. Missing or out-of-bounds indices are\\n'\n' handled in a manner consistent with regular slices.\\n'\n'\\n'\n' Static method objects\\n'\n' Static method objects provide a way of defeating the\\n'\n' transformation of function objects to method objects '\n'described\\n'\n' above. A static method object is a wrapper around any other\\n'\n' object, usually a user-defined method object. When a static\\n'\n' method object is retrieved from a class or a class instance, '\n'the\\n'\n' object actually returned is the wrapped object, which is not\\n'\n' subject to any further transformation. Static method objects '\n'are\\n'\n' also callable. Static method objects are created by the '\n'built-in\\n'\n' \"staticmethod()\" constructor.\\n'\n'\\n'\n' Class method objects\\n'\n' A class method object, like a static method object, is a '\n'wrapper\\n'\n' around another object that alters the way in which that '\n'object\\n'\n' is retrieved from classes and class instances. The behaviour '\n'of\\n'\n' class method objects upon such retrieval is described above,\\n'\n' under \u201cUser-defined methods\u201d. Class method objects are '\n'created\\n'\n' by the built-in \"classmethod()\" constructor.\\n',\n'typesfunctions':'Functions\\n'\n'*********\\n'\n'\\n'\n'Function objects are created by function definitions. The '\n'only\\n'\n'operation on a function object is to call it: '\n'\"func(argument-list)\".\\n'\n'\\n'\n'There are really two flavors of function objects: built-in '\n'functions\\n'\n'and user-defined functions. Both support the same '\n'operation (to call\\n'\n'the function), but the implementation is different, hence '\n'the\\n'\n'different object types.\\n'\n'\\n'\n'See Function definitions for more information.\\n',\n'typesmapping':'Mapping Types \u2014 \"dict\"\\n'\n'**********************\\n'\n'\\n'\n'A *mapping* object maps *hashable* values to arbitrary '\n'objects.\\n'\n'Mappings are mutable objects. There is currently only one '\n'standard\\n'\n'mapping type, the *dictionary*. (For other containers see '\n'the built-\\n'\n'in \"list\", \"set\", and \"tuple\" classes, and the \"collections\" '\n'module.)\\n'\n'\\n'\n'A dictionary\u2019s keys are *almost* arbitrary values. Values '\n'that are\\n'\n'not *hashable*, that is, values containing lists, '\n'dictionaries or\\n'\n'other mutable types (that are compared by value rather than '\n'by object\\n'\n'identity) may not be used as keys. Numeric types used for '\n'keys obey\\n'\n'the normal rules for numeric comparison: if two numbers '\n'compare equal\\n'\n'(such as \"1\" and \"1.0\") then they can be used '\n'interchangeably to index\\n'\n'the same dictionary entry. (Note however, that since '\n'computers store\\n'\n'floating-point numbers as approximations it is usually '\n'unwise to use\\n'\n'them as dictionary keys.)\\n'\n'\\n'\n'Dictionaries can be created by placing a comma-separated '\n'list of \"key:\\n'\n'value\" pairs within braces, for example: \"{\\'jack\\': 4098, '\n\"'sjoerd':\\n\"\n'4127}\" or \"{4098: \\'jack\\', 4127: \\'sjoerd\\'}\", or by the '\n'\"dict\"\\n'\n'constructor.\\n'\n'\\n'\n'class dict(**kwarg)\\n'\n'class dict(mapping, **kwarg)\\n'\n'class dict(iterable, **kwarg)\\n'\n'\\n'\n' Return a new dictionary initialized from an optional '\n'positional\\n'\n' argument and a possibly empty set of keyword arguments.\\n'\n'\\n'\n' Dictionaries can be created by several means:\\n'\n'\\n'\n' * Use a comma-separated list of \"key: value\" pairs within '\n'braces:\\n'\n' \"{\\'jack\\': 4098, \\'sjoerd\\': 4127}\" or \"{4098: '\n\"'jack', 4127:\\n\"\n' \\'sjoerd\\'}\"\\n'\n'\\n'\n' * Use a dict comprehension: \"{}\", \"{x: x ** 2 for x in '\n'range(10)}\"\\n'\n'\\n'\n' * Use the type constructor: \"dict()\", \"dict([(\\'foo\\', '\n\"100), ('bar',\\n\"\n' 200)])\", \"dict(foo=100, bar=200)\"\\n'\n'\\n'\n' If no positional argument is given, an empty dictionary '\n'is created.\\n'\n' If a positional argument is given and it is a mapping '\n'object, a\\n'\n' dictionary is created with the same key-value pairs as '\n'the mapping\\n'\n' object. Otherwise, the positional argument must be an '\n'*iterable*\\n'\n' object. Each item in the iterable must itself be an '\n'iterable with\\n'\n' exactly two objects. The first object of each item '\n'becomes a key\\n'\n' in the new dictionary, and the second object the '\n'corresponding\\n'\n' value. If a key occurs more than once, the last value '\n'for that key\\n'\n' becomes the corresponding value in the new dictionary.\\n'\n'\\n'\n' If keyword arguments are given, the keyword arguments and '\n'their\\n'\n' values are added to the dictionary created from the '\n'positional\\n'\n' argument. If a key being added is already present, the '\n'value from\\n'\n' the keyword argument replaces the value from the '\n'positional\\n'\n' argument.\\n'\n'\\n'\n' To illustrate, the following examples all return a '\n'dictionary equal\\n'\n' to \"{\"one\": 1, \"two\": 2, \"three\": 3}\":\\n'\n'\\n'\n' >>> a = dict(one=1, two=2, three=3)\\n'\n\" >>> b = {'one': 1, 'two': 2, 'three': 3}\\n\"\n\" >>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\\n\"\n\" >>> d = dict([('two', 2), ('one', 1), ('three', 3)])\\n\"\n\" >>> e = dict({'three': 3, 'one': 1, 'two': 2})\\n\"\n\" >>> f = dict({'one': 1, 'three': 3}, two=2)\\n\"\n' >>> a == b == c == d == e == f\\n'\n' True\\n'\n'\\n'\n' Providing keyword arguments as in the first example only '\n'works for\\n'\n' keys that are valid Python identifiers. Otherwise, any '\n'valid keys\\n'\n' can be used.\\n'\n'\\n'\n' These are the operations that dictionaries support (and '\n'therefore,\\n'\n' custom mapping types should support too):\\n'\n'\\n'\n' list(d)\\n'\n'\\n'\n' Return a list of all the keys used in the dictionary '\n'*d*.\\n'\n'\\n'\n' len(d)\\n'\n'\\n'\n' Return the number of items in the dictionary *d*.\\n'\n'\\n'\n' d[key]\\n'\n'\\n'\n' Return the item of *d* with key *key*. Raises a '\n'\"KeyError\" if\\n'\n' *key* is not in the map.\\n'\n'\\n'\n' If a subclass of dict defines a method \"__missing__()\" '\n'and *key*\\n'\n' is not present, the \"d[key]\" operation calls that '\n'method with\\n'\n' the key *key* as argument. The \"d[key]\" operation '\n'then returns\\n'\n' or raises whatever is returned or raised by the\\n'\n' \"__missing__(key)\" call. No other operations or '\n'methods invoke\\n'\n' \"__missing__()\". If \"__missing__()\" is not defined, '\n'\"KeyError\"\\n'\n' is raised. \"__missing__()\" must be a method; it cannot '\n'be an\\n'\n' instance variable:\\n'\n'\\n'\n' >>> class Counter(dict):\\n'\n' ... def __missing__(self, key):\\n'\n' ... return 0\\n'\n' >>> c = Counter()\\n'\n\" >>> c['red']\\n\"\n' 0\\n'\n\" >>> c['red'] += 1\\n\"\n\" >>> c['red']\\n\"\n' 1\\n'\n'\\n'\n' The example above shows part of the implementation of\\n'\n' \"collections.Counter\". A different \"__missing__\" '\n'method is used\\n'\n' by \"collections.defaultdict\".\\n'\n'\\n'\n' d[key] = value\\n'\n'\\n'\n' Set \"d[key]\" to *value*.\\n'\n'\\n'\n' del d[key]\\n'\n'\\n'\n' Remove \"d[key]\" from *d*. Raises a \"KeyError\" if '\n'*key* is not\\n'\n' in the map.\\n'\n'\\n'\n' key in d\\n'\n'\\n'\n' Return \"True\" if *d* has a key *key*, else \"False\".\\n'\n'\\n'\n' key not in d\\n'\n'\\n'\n' Equivalent to \"not key in d\".\\n'\n'\\n'\n' iter(d)\\n'\n'\\n'\n' Return an iterator over the keys of the dictionary. '\n'This is a\\n'\n' shortcut for \"iter(d.keys())\".\\n'\n'\\n'\n' clear()\\n'\n'\\n'\n' Remove all items from the dictionary.\\n'\n'\\n'\n' copy()\\n'\n'\\n'\n' Return a shallow copy of the dictionary.\\n'\n'\\n'\n' classmethod fromkeys(iterable[, value])\\n'\n'\\n'\n' Create a new dictionary with keys from *iterable* and '\n'values set\\n'\n' to *value*.\\n'\n'\\n'\n' \"fromkeys()\" is a class method that returns a new '\n'dictionary.\\n'\n' *value* defaults to \"None\". All of the values refer '\n'to just a\\n'\n' single instance, so it generally doesn\u2019t make sense '\n'for *value*\\n'\n' to be a mutable object such as an empty list. To get '\n'distinct\\n'\n' values, use a dict comprehension instead.\\n'\n'\\n'\n' get(key[, default])\\n'\n'\\n'\n' Return the value for *key* if *key* is in the '\n'dictionary, else\\n'\n' *default*. If *default* is not given, it defaults to '\n'\"None\", so\\n'\n' that this method never raises a \"KeyError\".\\n'\n'\\n'\n' items()\\n'\n'\\n'\n' Return a new view of the dictionary\u2019s items (\"(key, '\n'value)\"\\n'\n' pairs). See the documentation of view objects.\\n'\n'\\n'\n' keys()\\n'\n'\\n'\n' Return a new view of the dictionary\u2019s keys. See the\\n'\n' documentation of view objects.\\n'\n'\\n'\n' pop(key[, default])\\n'\n'\\n'\n' If *key* is in the dictionary, remove it and return '\n'its value,\\n'\n' else return *default*. If *default* is not given and '\n'*key* is\\n'\n' not in the dictionary, a \"KeyError\" is raised.\\n'\n'\\n'\n' popitem()\\n'\n'\\n'\n' Remove and return a \"(key, value)\" pair from the '\n'dictionary.\\n'\n' Pairs are returned in LIFO (last-in, first-out) '\n'order.\\n'\n'\\n'\n' \"popitem()\" is useful to destructively iterate over a\\n'\n' dictionary, as often used in set algorithms. If the '\n'dictionary\\n'\n' is empty, calling \"popitem()\" raises a \"KeyError\".\\n'\n'\\n'\n' Changed in version 3.7: LIFO order is now guaranteed. '\n'In prior\\n'\n' versions, \"popitem()\" would return an arbitrary '\n'key/value pair.\\n'\n'\\n'\n' reversed(d)\\n'\n'\\n'\n' Return a reverse iterator over the keys of the '\n'dictionary. This\\n'\n' is a shortcut for \"reversed(d.keys())\".\\n'\n'\\n'\n' New in version 3.8.\\n'\n'\\n'\n' setdefault(key[, default])\\n'\n'\\n'\n' If *key* is in the dictionary, return its value. If '\n'not, insert\\n'\n' *key* with a value of *default* and return *default*. '\n'*default*\\n'\n' defaults to \"None\".\\n'\n'\\n'\n' update([other])\\n'\n'\\n'\n' Update the dictionary with the key/value pairs from '\n'*other*,\\n'\n' overwriting existing keys. Return \"None\".\\n'\n'\\n'\n' \"update()\" accepts either another dictionary object or '\n'an\\n'\n' iterable of key/value pairs (as tuples or other '\n'iterables of\\n'\n' length two). If keyword arguments are specified, the '\n'dictionary\\n'\n' is then updated with those key/value pairs: '\n'\"d.update(red=1,\\n'\n' blue=2)\".\\n'\n'\\n'\n' values()\\n'\n'\\n'\n' Return a new view of the dictionary\u2019s values. See '\n'the\\n'\n' documentation of view objects.\\n'\n'\\n'\n' An equality comparison between one \"dict.values()\" '\n'view and\\n'\n' another will always return \"False\". This also applies '\n'when\\n'\n' comparing \"dict.values()\" to itself:\\n'\n'\\n'\n\" >>> d = {'a': 1}\\n\"\n' >>> d.values() == d.values()\\n'\n' False\\n'\n'\\n'\n' d | other\\n'\n'\\n'\n' Create a new dictionary with the merged keys and '\n'values of *d*\\n'\n' and *other*, which must both be dictionaries. The '\n'values of\\n'\n' *other* take priority when *d* and *other* share '\n'keys.\\n'\n'\\n'\n' New in version 3.9.\\n'\n'\\n'\n' d |= other\\n'\n'\\n'\n' Update the dictionary *d* with keys and values from '\n'*other*,\\n'\n' which may be either a *mapping* or an *iterable* of '\n'key/value\\n'\n' pairs. The values of *other* take priority when *d* '\n'and *other*\\n'\n' share keys.\\n'\n'\\n'\n' New in version 3.9.\\n'\n'\\n'\n' Dictionaries compare equal if and only if they have the '\n'same \"(key,\\n'\n' value)\" pairs (regardless of ordering). Order comparisons '\n'(\u2018<\u2019,\\n'\n' \u2018<=\u2019, \u2018>=\u2019, \u2018>\u2019) raise \"TypeError\".\\n'\n'\\n'\n' Dictionaries preserve insertion order. Note that '\n'updating a key\\n'\n' does not affect the order. Keys added after deletion are '\n'inserted\\n'\n' at the end.\\n'\n'\\n'\n' >>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\\n'\n' >>> d\\n'\n\" {'one': 1, 'two': 2, 'three': 3, 'four': 4}\\n\"\n' >>> list(d)\\n'\n\" ['one', 'two', 'three', 'four']\\n\"\n' >>> list(d.values())\\n'\n' [1, 2, 3, 4]\\n'\n' >>> d[\"one\"] = 42\\n'\n' >>> d\\n'\n\" {'one': 42, 'two': 2, 'three': 3, 'four': 4}\\n\"\n' >>> del d[\"two\"]\\n'\n' >>> d[\"two\"] = None\\n'\n' >>> d\\n'\n\" {'one': 42, 'three': 3, 'four': 4, 'two': None}\\n\"\n'\\n'\n' Changed in version 3.7: Dictionary order is guaranteed to '\n'be\\n'\n' insertion order. This behavior was an implementation '\n'detail of\\n'\n' CPython from 3.6.\\n'\n'\\n'\n' Dictionaries and dictionary views are reversible.\\n'\n'\\n'\n' >>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\\n'\n' >>> d\\n'\n\" {'one': 1, 'two': 2, 'three': 3, 'four': 4}\\n\"\n' >>> list(reversed(d))\\n'\n\" ['four', 'three', 'two', 'one']\\n\"\n' >>> list(reversed(d.values()))\\n'\n' [4, 3, 2, 1]\\n'\n' >>> list(reversed(d.items()))\\n'\n\" [('four', 4), ('three', 3), ('two', 2), ('one', 1)]\\n\"\n'\\n'\n' Changed in version 3.8: Dictionaries are now reversible.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' \"types.MappingProxyType\" can be used to create a read-only '\n'view of a\\n'\n' \"dict\".\\n'\n'\\n'\n'\\n'\n'Dictionary view objects\\n'\n'=======================\\n'\n'\\n'\n'The objects returned by \"dict.keys()\", \"dict.values()\" and\\n'\n'\"dict.items()\" are *view objects*. They provide a dynamic '\n'view on the\\n'\n'dictionary\u2019s entries, which means that when the dictionary '\n'changes,\\n'\n'the view reflects these changes.\\n'\n'\\n'\n'Dictionary views can be iterated over to yield their '\n'respective data,\\n'\n'and support membership tests:\\n'\n'\\n'\n'len(dictview)\\n'\n'\\n'\n' Return the number of entries in the dictionary.\\n'\n'\\n'\n'iter(dictview)\\n'\n'\\n'\n' Return an iterator over the keys, values or items '\n'(represented as\\n'\n' tuples of \"(key, value)\") in the dictionary.\\n'\n'\\n'\n' Keys and values are iterated over in insertion order. '\n'This allows\\n'\n' the creation of \"(value, key)\" pairs using \"zip()\": '\n'\"pairs =\\n'\n' zip(d.values(), d.keys())\". Another way to create the '\n'same list is\\n'\n' \"pairs = [(v, k) for (k, v) in d.items()]\".\\n'\n'\\n'\n' Iterating views while adding or deleting entries in the '\n'dictionary\\n'\n' may raise a \"RuntimeError\" or fail to iterate over all '\n'entries.\\n'\n'\\n'\n' Changed in version 3.7: Dictionary order is guaranteed to '\n'be\\n'\n' insertion order.\\n'\n'\\n'\n'x in dictview\\n'\n'\\n'\n' Return \"True\" if *x* is in the underlying dictionary\u2019s '\n'keys, values\\n'\n' or items (in the latter case, *x* should be a \"(key, '\n'value)\"\\n'\n' tuple).\\n'\n'\\n'\n'reversed(dictview)\\n'\n'\\n'\n' Return a reverse iterator over the keys, values or items '\n'of the\\n'\n' dictionary. The view will be iterated in reverse order of '\n'the\\n'\n' insertion.\\n'\n'\\n'\n' Changed in version 3.8: Dictionary views are now '\n'reversible.\\n'\n'\\n'\n'dictview.mapping\\n'\n'\\n'\n' Return a \"types.MappingProxyType\" that wraps the '\n'original\\n'\n' dictionary to which the view refers.\\n'\n'\\n'\n' New in version 3.10.\\n'\n'\\n'\n'Keys views are set-like since their entries are unique and '\n'hashable.\\n'\n'If all values are hashable, so that \"(key, value)\" pairs are '\n'unique\\n'\n'and hashable, then the items view is also set-like. (Values '\n'views are\\n'\n'not treated as set-like since the entries are generally not '\n'unique.)\\n'\n'For set-like views, all of the operations defined for the '\n'abstract\\n'\n'base class \"collections.abc.Set\" are available (for example, '\n'\"==\",\\n'\n'\"<\", or \"^\").\\n'\n'\\n'\n'An example of dictionary view usage:\\n'\n'\\n'\n\" >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, \"\n\"'spam': 500}\\n\"\n' >>> keys = dishes.keys()\\n'\n' >>> values = dishes.values()\\n'\n'\\n'\n' >>> # iteration\\n'\n' >>> n = 0\\n'\n' >>> for val in values:\\n'\n' ... n += val\\n'\n' >>> print(n)\\n'\n' 504\\n'\n'\\n'\n' >>> # keys and values are iterated over in the same order '\n'(insertion order)\\n'\n' >>> list(keys)\\n'\n\" ['eggs', 'sausage', 'bacon', 'spam']\\n\"\n' >>> list(values)\\n'\n' [2, 1, 1, 500]\\n'\n'\\n'\n' >>> # view objects are dynamic and reflect dict changes\\n'\n\" >>> del dishes['eggs']\\n\"\n\" >>> del dishes['sausage']\\n\"\n' >>> list(keys)\\n'\n\" ['bacon', 'spam']\\n\"\n'\\n'\n' >>> # set operations\\n'\n\" >>> keys & {'eggs', 'bacon', 'salad'}\\n\"\n\" {'bacon'}\\n\"\n\" >>> keys ^ {'sausage', 'juice'}\\n\"\n\" {'juice', 'sausage', 'bacon', 'spam'}\\n\"\n'\\n'\n' >>> # get back a read-only proxy for the original '\n'dictionary\\n'\n' >>> values.mapping\\n'\n\" mappingproxy({'eggs': 2, 'sausage': 1, 'bacon': 1, \"\n\"'spam': 500})\\n\"\n\" >>> values.mapping['spam']\\n\"\n' 500\\n',\n'typesmethods':'Methods\\n'\n'*******\\n'\n'\\n'\n'Methods are functions that are called using the attribute '\n'notation.\\n'\n'There are two flavors: built-in methods (such as \"append()\" '\n'on lists)\\n'\n'and class instance methods. Built-in methods are described '\n'with the\\n'\n'types that support them.\\n'\n'\\n'\n'If you access a method (a function defined in a class '\n'namespace)\\n'\n'through an instance, you get a special object: a *bound '\n'method* (also\\n'\n'called *instance method*) object. When called, it will add '\n'the \"self\"\\n'\n'argument to the argument list. Bound methods have two '\n'special read-\\n'\n'only attributes: \"m.__self__\" is the object on which the '\n'method\\n'\n'operates, and \"m.__func__\" is the function implementing the '\n'method.\\n'\n'Calling \"m(arg-1, arg-2, ..., arg-n)\" is completely '\n'equivalent to\\n'\n'calling \"m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)\".\\n'\n'\\n'\n'Like function objects, bound method objects support getting '\n'arbitrary\\n'\n'attributes. However, since method attributes are actually '\n'stored on\\n'\n'the underlying function object (\"meth.__func__\"), setting '\n'method\\n'\n'attributes on bound methods is disallowed. Attempting to '\n'set an\\n'\n'attribute on a method results in an \"AttributeError\" being '\n'raised. In\\n'\n'order to set a method attribute, you need to explicitly set '\n'it on the\\n'\n'underlying function object:\\n'\n'\\n'\n' >>> class C:\\n'\n' ... def method(self):\\n'\n' ... pass\\n'\n' ...\\n'\n' >>> c = C()\\n'\n\" >>> c.method.whoami = 'my name is method' # can't set on \"\n'the method\\n'\n' Traceback (most recent call last):\\n'\n' File \"\", line 1, in \\n'\n\" AttributeError: 'method' object has no attribute \"\n\"'whoami'\\n\"\n\" >>> c.method.__func__.whoami = 'my name is method'\\n\"\n' >>> c.method.whoami\\n'\n\" 'my name is method'\\n\"\n'\\n'\n'See The standard type hierarchy for more information.\\n',\n'typesmodules':'Modules\\n'\n'*******\\n'\n'\\n'\n'The only special operation on a module is attribute access: '\n'\"m.name\",\\n'\n'where *m* is a module and *name* accesses a name defined in '\n'*m*\u2019s\\n'\n'symbol table. Module attributes can be assigned to. (Note '\n'that the\\n'\n'\"import\" statement is not, strictly speaking, an operation '\n'on a module\\n'\n'object; \"import foo\" does not require a module object named '\n'*foo* to\\n'\n'exist, rather it requires an (external) *definition* for a '\n'module\\n'\n'named *foo* somewhere.)\\n'\n'\\n'\n'A special attribute of every module is \"__dict__\". This is '\n'the\\n'\n'dictionary containing the module\u2019s symbol table. Modifying '\n'this\\n'\n'dictionary will actually change the module\u2019s symbol table, '\n'but direct\\n'\n'assignment to the \"__dict__\" attribute is not possible (you '\n'can write\\n'\n'\"m.__dict__[\\'a\\'] = 1\", which defines \"m.a\" to be \"1\", but '\n'you can\u2019t\\n'\n'write \"m.__dict__ = {}\"). Modifying \"__dict__\" directly is '\n'not\\n'\n'recommended.\\n'\n'\\n'\n'Modules built into the interpreter are written like this: '\n'\"\". If loaded from a file, they are '\n'written as\\n'\n'\"\".\\n',\n'typesseq':'Sequence Types \u2014 \"list\", \"tuple\", \"range\"\\n'\n'*****************************************\\n'\n'\\n'\n'There are three basic sequence types: lists, tuples, and range\\n'\n'objects. Additional sequence types tailored for processing of '\n'binary\\n'\n'data and text strings are described in dedicated sections.\\n'\n'\\n'\n'\\n'\n'Common Sequence Operations\\n'\n'==========================\\n'\n'\\n'\n'The operations in the following table are supported by most '\n'sequence\\n'\n'types, both mutable and immutable. The '\n'\"collections.abc.Sequence\" ABC\\n'\n'is provided to make it easier to correctly implement these '\n'operations\\n'\n'on custom sequence types.\\n'\n'\\n'\n'This table lists the sequence operations sorted in ascending '\n'priority.\\n'\n'In the table, *s* and *t* are sequences of the same type, *n*, '\n'*i*,\\n'\n'*j* and *k* are integers and *x* is an arbitrary object that '\n'meets any\\n'\n'type and value restrictions imposed by *s*.\\n'\n'\\n'\n'The \"in\" and \"not in\" operations have the same priorities as '\n'the\\n'\n'comparison operations. The \"+\" (concatenation) and \"*\" '\n'(repetition)\\n'\n'operations have the same priority as the corresponding numeric\\n'\n'operations. [3]\\n'\n'\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| Operation | Result '\n'| Notes |\\n'\n'|============================|==================================|============|\\n'\n'| \"x in s\" | \"True\" if an item of *s* is '\n'| (1) |\\n'\n'| | equal to *x*, else \"False\" '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"x not in s\" | \"False\" if an item of *s* is '\n'| (1) |\\n'\n'| | equal to *x*, else \"True\" '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s + t\" | the concatenation of *s* and *t* '\n'| (6)(7) |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s * n\" or \"n * s\" | equivalent to adding *s* to '\n'| (2)(7) |\\n'\n'| | itself *n* times '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s[i]\" | *i*th item of *s*, origin 0 '\n'| (3) |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s[i:j]\" | slice of *s* from *i* to *j* '\n'| (3)(4) |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s[i:j:k]\" | slice of *s* from *i* to *j* '\n'| (3)(5) |\\n'\n'| | with step *k* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"len(s)\" | length of *s* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"min(s)\" | smallest item of *s* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"max(s)\" | largest item of *s* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s.index(x[, i[, j]])\" | index of the first occurrence of '\n'| (8) |\\n'\n'| | *x* in *s* (at or after index '\n'| |\\n'\n'| | *i* and before index *j*) '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'| \"s.count(x)\" | total number of occurrences of '\n'| |\\n'\n'| | *x* in *s* '\n'| |\\n'\n'+----------------------------+----------------------------------+------------+\\n'\n'\\n'\n'Sequences of the same type also support comparisons. In '\n'particular,\\n'\n'tuples and lists are compared lexicographically by comparing\\n'\n'corresponding elements. This means that to compare equal, every\\n'\n'element must compare equal and the two sequences must be of the '\n'same\\n'\n'type and have the same length. (For full details see '\n'Comparisons in\\n'\n'the language reference.)\\n'\n'\\n'\n'Notes:\\n'\n'\\n'\n'1. While the \"in\" and \"not in\" operations are used only for '\n'simple\\n'\n' containment testing in the general case, some specialised '\n'sequences\\n'\n' (such as \"str\", \"bytes\" and \"bytearray\") also use them for\\n'\n' subsequence testing:\\n'\n'\\n'\n' >>> \"gg\" in \"eggs\"\\n'\n' True\\n'\n'\\n'\n'2. Values of *n* less than \"0\" are treated as \"0\" (which yields '\n'an\\n'\n' empty sequence of the same type as *s*). Note that items in '\n'the\\n'\n' sequence *s* are not copied; they are referenced multiple '\n'times.\\n'\n' This often haunts new Python programmers; consider:\\n'\n'\\n'\n' >>> lists = [[]] * 3\\n'\n' >>> lists\\n'\n' [[], [], []]\\n'\n' >>> lists[0].append(3)\\n'\n' >>> lists\\n'\n' [[3], [3], [3]]\\n'\n'\\n'\n' What has happened is that \"[[]]\" is a one-element list '\n'containing\\n'\n' an empty list, so all three elements of \"[[]] * 3\" are '\n'references\\n'\n' to this single empty list. Modifying any of the elements of\\n'\n' \"lists\" modifies this single list. You can create a list of\\n'\n' different lists this way:\\n'\n'\\n'\n' >>> lists = [[] for i in range(3)]\\n'\n' >>> lists[0].append(3)\\n'\n' >>> lists[1].append(5)\\n'\n' >>> lists[2].append(7)\\n'\n' >>> lists\\n'\n' [[3], [5], [7]]\\n'\n'\\n'\n' Further explanation is available in the FAQ entry How do I '\n'create a\\n'\n' multidimensional list?.\\n'\n'\\n'\n'3. If *i* or *j* is negative, the index is relative to the end '\n'of\\n'\n' sequence *s*: \"len(s) + i\" or \"len(s) + j\" is substituted. '\n'But\\n'\n' note that \"-0\" is still \"0\".\\n'\n'\\n'\n'4. The slice of *s* from *i* to *j* is defined as the sequence '\n'of\\n'\n' items with index *k* such that \"i <= k < j\". If *i* or *j* '\n'is\\n'\n' greater than \"len(s)\", use \"len(s)\". If *i* is omitted or '\n'\"None\",\\n'\n' use \"0\". If *j* is omitted or \"None\", use \"len(s)\". If *i* '\n'is\\n'\n' greater than or equal to *j*, the slice is empty.\\n'\n'\\n'\n'5. The slice of *s* from *i* to *j* with step *k* is defined as '\n'the\\n'\n' sequence of items with index \"x = i + n*k\" such that \"0 <= n '\n'<\\n'\n' (j-i)/k\". In other words, the indices are \"i\", \"i+k\", '\n'\"i+2*k\",\\n'\n' \"i+3*k\" and so on, stopping when *j* is reached (but never\\n'\n' including *j*). When *k* is positive, *i* and *j* are '\n'reduced to\\n'\n' \"len(s)\" if they are greater. When *k* is negative, *i* and '\n'*j* are\\n'\n' reduced to \"len(s) - 1\" if they are greater. If *i* or *j* '\n'are\\n'\n' omitted or \"None\", they become \u201cend\u201d values (which end '\n'depends on\\n'\n' the sign of *k*). Note, *k* cannot be zero. If *k* is '\n'\"None\", it\\n'\n' is treated like \"1\".\\n'\n'\\n'\n'6. Concatenating immutable sequences always results in a new '\n'object.\\n'\n' This means that building up a sequence by repeated '\n'concatenation\\n'\n' will have a quadratic runtime cost in the total sequence '\n'length.\\n'\n' To get a linear runtime cost, you must switch to one of the\\n'\n' alternatives below:\\n'\n'\\n'\n' * if concatenating \"str\" objects, you can build a list and '\n'use\\n'\n' \"str.join()\" at the end or else write to an \"io.StringIO\"\\n'\n' instance and retrieve its value when complete\\n'\n'\\n'\n' * if concatenating \"bytes\" objects, you can similarly use\\n'\n' \"bytes.join()\" or \"io.BytesIO\", or you can do in-place\\n'\n' concatenation with a \"bytearray\" object. \"bytearray\" '\n'objects are\\n'\n' mutable and have an efficient overallocation mechanism\\n'\n'\\n'\n' * if concatenating \"tuple\" objects, extend a \"list\" instead\\n'\n'\\n'\n' * for other types, investigate the relevant class '\n'documentation\\n'\n'\\n'\n'7. Some sequence types (such as \"range\") only support item '\n'sequences\\n'\n' that follow specific patterns, and hence don\u2019t support '\n'sequence\\n'\n' concatenation or repetition.\\n'\n'\\n'\n'8. \"index\" raises \"ValueError\" when *x* is not found in *s*. Not '\n'all\\n'\n' implementations support passing the additional arguments *i* '\n'and\\n'\n' *j*. These arguments allow efficient searching of subsections '\n'of\\n'\n' the sequence. Passing the extra arguments is roughly '\n'equivalent to\\n'\n' using \"s[i:j].index(x)\", only without copying any data and '\n'with the\\n'\n' returned index being relative to the start of the sequence '\n'rather\\n'\n' than the start of the slice.\\n'\n'\\n'\n'\\n'\n'Immutable Sequence Types\\n'\n'========================\\n'\n'\\n'\n'The only operation that immutable sequence types generally '\n'implement\\n'\n'that is not also implemented by mutable sequence types is '\n'support for\\n'\n'the \"hash()\" built-in.\\n'\n'\\n'\n'This support allows immutable sequences, such as \"tuple\" '\n'instances, to\\n'\n'be used as \"dict\" keys and stored in \"set\" and \"frozenset\" '\n'instances.\\n'\n'\\n'\n'Attempting to hash an immutable sequence that contains '\n'unhashable\\n'\n'values will result in \"TypeError\".\\n'\n'\\n'\n'\\n'\n'Mutable Sequence Types\\n'\n'======================\\n'\n'\\n'\n'The operations in the following table are defined on mutable '\n'sequence\\n'\n'types. The \"collections.abc.MutableSequence\" ABC is provided to '\n'make\\n'\n'it easier to correctly implement these operations on custom '\n'sequence\\n'\n'types.\\n'\n'\\n'\n'In the table *s* is an instance of a mutable sequence type, *t* '\n'is any\\n'\n'iterable object and *x* is an arbitrary object that meets any '\n'type and\\n'\n'value restrictions imposed by *s* (for example, \"bytearray\" '\n'only\\n'\n'accepts integers that meet the value restriction \"0 <= x <= '\n'255\").\\n'\n'\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| Operation | '\n'Result | Notes |\\n'\n'|================================|==================================|=======================|\\n'\n'| \"s[i] = x\" | item *i* of *s* is replaced '\n'by | |\\n'\n'| | '\n'*x* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s[i:j] = t\" | slice of *s* from *i* to *j* '\n'is | |\\n'\n'| | replaced by the contents of '\n'the | |\\n'\n'| | iterable '\n'*t* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"del s[i:j]\" | same as \"s[i:j] = '\n'[]\" | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s[i:j:k] = t\" | the elements of \"s[i:j:k]\" '\n'are | (1) |\\n'\n'| | replaced by those of '\n'*t* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"del s[i:j:k]\" | removes the elements '\n'of | |\\n'\n'| | \"s[i:j:k]\" from the '\n'list | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.append(x)\" | appends *x* to the end of '\n'the | |\\n'\n'| | sequence (same '\n'as | |\\n'\n'| | \"s[len(s):len(s)] = '\n'[x]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.clear()\" | removes all items from *s* '\n'(same | (5) |\\n'\n'| | as \"del '\n's[:]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.copy()\" | creates a shallow copy of '\n'*s* | (5) |\\n'\n'| | (same as '\n'\"s[:]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.extend(t)\" or \"s += t\" | extends *s* with the contents '\n'of | |\\n'\n'| | *t* (for the most part the '\n'same | |\\n'\n'| | as \"s[len(s):len(s)] = '\n't\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s *= n\" | updates *s* with its '\n'contents | (6) |\\n'\n'| | repeated *n* '\n'times | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.insert(i, x)\" | inserts *x* into *s* at '\n'the | |\\n'\n'| | index given by *i* (same '\n'as | |\\n'\n'| | \"s[i:i] = '\n'[x]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.pop()\" or \"s.pop(i)\" | retrieves the item at *i* '\n'and | (2) |\\n'\n'| | also removes it from '\n'*s* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.remove(x)\" | remove the first item from '\n'*s* | (3) |\\n'\n'| | where \"s[i]\" is equal to '\n'*x* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.reverse()\" | reverses the items of *s* '\n'in | (4) |\\n'\n'| | '\n'place | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'\\n'\n'Notes:\\n'\n'\\n'\n'1. *t* must have the same length as the slice it is replacing.\\n'\n'\\n'\n'2. The optional argument *i* defaults to \"-1\", so that by '\n'default the\\n'\n' last item is removed and returned.\\n'\n'\\n'\n'3. \"remove()\" raises \"ValueError\" when *x* is not found in *s*.\\n'\n'\\n'\n'4. The \"reverse()\" method modifies the sequence in place for '\n'economy\\n'\n' of space when reversing a large sequence. To remind users '\n'that it\\n'\n' operates by side effect, it does not return the reversed '\n'sequence.\\n'\n'\\n'\n'5. \"clear()\" and \"copy()\" are included for consistency with the\\n'\n' interfaces of mutable containers that don\u2019t support slicing\\n'\n' operations (such as \"dict\" and \"set\"). \"copy()\" is not part '\n'of the\\n'\n' \"collections.abc.MutableSequence\" ABC, but most concrete '\n'mutable\\n'\n' sequence classes provide it.\\n'\n'\\n'\n' New in version 3.3: \"clear()\" and \"copy()\" methods.\\n'\n'\\n'\n'6. The value *n* is an integer, or an object implementing\\n'\n' \"__index__()\". Zero and negative values of *n* clear the '\n'sequence.\\n'\n' Items in the sequence are not copied; they are referenced '\n'multiple\\n'\n' times, as explained for \"s * n\" under Common Sequence '\n'Operations.\\n'\n'\\n'\n'\\n'\n'Lists\\n'\n'=====\\n'\n'\\n'\n'Lists are mutable sequences, typically used to store collections '\n'of\\n'\n'homogeneous items (where the precise degree of similarity will '\n'vary by\\n'\n'application).\\n'\n'\\n'\n'class list([iterable])\\n'\n'\\n'\n' Lists may be constructed in several ways:\\n'\n'\\n'\n' * Using a pair of square brackets to denote the empty list: '\n'\"[]\"\\n'\n'\\n'\n' * Using square brackets, separating items with commas: \"[a]\", '\n'\"[a,\\n'\n' b, c]\"\\n'\n'\\n'\n' * Using a list comprehension: \"[x for x in iterable]\"\\n'\n'\\n'\n' * Using the type constructor: \"list()\" or \"list(iterable)\"\\n'\n'\\n'\n' The constructor builds a list whose items are the same and in '\n'the\\n'\n' same order as *iterable*\u2019s items. *iterable* may be either '\n'a\\n'\n' sequence, a container that supports iteration, or an '\n'iterator\\n'\n' object. If *iterable* is already a list, a copy is made and\\n'\n' returned, similar to \"iterable[:]\". For example, '\n'\"list(\\'abc\\')\"\\n'\n' returns \"[\\'a\\', \\'b\\', \\'c\\']\" and \"list( (1, 2, 3) )\" '\n'returns \"[1, 2,\\n'\n' 3]\". If no argument is given, the constructor creates a new '\n'empty\\n'\n' list, \"[]\".\\n'\n'\\n'\n' Many other operations also produce lists, including the '\n'\"sorted()\"\\n'\n' built-in.\\n'\n'\\n'\n' Lists implement all of the common and mutable sequence '\n'operations.\\n'\n' Lists also provide the following additional method:\\n'\n'\\n'\n' sort(*, key=None, reverse=False)\\n'\n'\\n'\n' This method sorts the list in place, using only \"<\" '\n'comparisons\\n'\n' between items. Exceptions are not suppressed - if any '\n'comparison\\n'\n' operations fail, the entire sort operation will fail (and '\n'the\\n'\n' list will likely be left in a partially modified state).\\n'\n'\\n'\n' \"sort()\" accepts two arguments that can only be passed by\\n'\n' keyword (keyword-only arguments):\\n'\n'\\n'\n' *key* specifies a function of one argument that is used '\n'to\\n'\n' extract a comparison key from each list element (for '\n'example,\\n'\n' \"key=str.lower\"). The key corresponding to each item in '\n'the list\\n'\n' is calculated once and then used for the entire sorting '\n'process.\\n'\n' The default value of \"None\" means that list items are '\n'sorted\\n'\n' directly without calculating a separate key value.\\n'\n'\\n'\n' The \"functools.cmp_to_key()\" utility is available to '\n'convert a\\n'\n' 2.x style *cmp* function to a *key* function.\\n'\n'\\n'\n' *reverse* is a boolean value. If set to \"True\", then the '\n'list\\n'\n' elements are sorted as if each comparison were reversed.\\n'\n'\\n'\n' This method modifies the sequence in place for economy of '\n'space\\n'\n' when sorting a large sequence. To remind users that it '\n'operates\\n'\n' by side effect, it does not return the sorted sequence '\n'(use\\n'\n' \"sorted()\" to explicitly request a new sorted list '\n'instance).\\n'\n'\\n'\n' The \"sort()\" method is guaranteed to be stable. A sort '\n'is\\n'\n' stable if it guarantees not to change the relative order '\n'of\\n'\n' elements that compare equal \u2014 this is helpful for sorting '\n'in\\n'\n' multiple passes (for example, sort by department, then by '\n'salary\\n'\n' grade).\\n'\n'\\n'\n' For sorting examples and a brief sorting tutorial, see '\n'Sorting\\n'\n' HOW TO.\\n'\n'\\n'\n' **CPython implementation detail:** While a list is being '\n'sorted,\\n'\n' the effect of attempting to mutate, or even inspect, the '\n'list is\\n'\n' undefined. The C implementation of Python makes the list '\n'appear\\n'\n' empty for the duration, and raises \"ValueError\" if it can '\n'detect\\n'\n' that the list has been mutated during a sort.\\n'\n'\\n'\n'\\n'\n'Tuples\\n'\n'======\\n'\n'\\n'\n'Tuples are immutable sequences, typically used to store '\n'collections of\\n'\n'heterogeneous data (such as the 2-tuples produced by the '\n'\"enumerate()\"\\n'\n'built-in). Tuples are also used for cases where an immutable '\n'sequence\\n'\n'of homogeneous data is needed (such as allowing storage in a '\n'\"set\" or\\n'\n'\"dict\" instance).\\n'\n'\\n'\n'class tuple([iterable])\\n'\n'\\n'\n' Tuples may be constructed in a number of ways:\\n'\n'\\n'\n' * Using a pair of parentheses to denote the empty tuple: '\n'\"()\"\\n'\n'\\n'\n' * Using a trailing comma for a singleton tuple: \"a,\" or '\n'\"(a,)\"\\n'\n'\\n'\n' * Separating items with commas: \"a, b, c\" or \"(a, b, c)\"\\n'\n'\\n'\n' * Using the \"tuple()\" built-in: \"tuple()\" or '\n'\"tuple(iterable)\"\\n'\n'\\n'\n' The constructor builds a tuple whose items are the same and '\n'in the\\n'\n' same order as *iterable*\u2019s items. *iterable* may be either '\n'a\\n'\n' sequence, a container that supports iteration, or an '\n'iterator\\n'\n' object. If *iterable* is already a tuple, it is returned\\n'\n' unchanged. For example, \"tuple(\\'abc\\')\" returns \"(\\'a\\', '\n'\\'b\\', \\'c\\')\"\\n'\n' and \"tuple( [1, 2, 3] )\" returns \"(1, 2, 3)\". If no argument '\n'is\\n'\n' given, the constructor creates a new empty tuple, \"()\".\\n'\n'\\n'\n' Note that it is actually the comma which makes a tuple, not '\n'the\\n'\n' parentheses. The parentheses are optional, except in the '\n'empty\\n'\n' tuple case, or when they are needed to avoid syntactic '\n'ambiguity.\\n'\n' For example, \"f(a, b, c)\" is a function call with three '\n'arguments,\\n'\n' while \"f((a, b, c))\" is a function call with a 3-tuple as the '\n'sole\\n'\n' argument.\\n'\n'\\n'\n' Tuples implement all of the common sequence operations.\\n'\n'\\n'\n'For heterogeneous collections of data where access by name is '\n'clearer\\n'\n'than access by index, \"collections.namedtuple()\" may be a more\\n'\n'appropriate choice than a simple tuple object.\\n'\n'\\n'\n'\\n'\n'Ranges\\n'\n'======\\n'\n'\\n'\n'The \"range\" type represents an immutable sequence of numbers and '\n'is\\n'\n'commonly used for looping a specific number of times in \"for\" '\n'loops.\\n'\n'\\n'\n'class range(stop)\\n'\n'class range(start, stop[, step])\\n'\n'\\n'\n' The arguments to the range constructor must be integers '\n'(either\\n'\n' built-in \"int\" or any object that implements the \"__index__\"\\n'\n' special method). If the *step* argument is omitted, it '\n'defaults to\\n'\n' \"1\". If the *start* argument is omitted, it defaults to \"0\". '\n'If\\n'\n' *step* is zero, \"ValueError\" is raised.\\n'\n'\\n'\n' For a positive *step*, the contents of a range \"r\" are '\n'determined\\n'\n' by the formula \"r[i] = start + step*i\" where \"i >= 0\" and '\n'\"r[i] <\\n'\n' stop\".\\n'\n'\\n'\n' For a negative *step*, the contents of the range are still\\n'\n' determined by the formula \"r[i] = start + step*i\", but the\\n'\n' constraints are \"i >= 0\" and \"r[i] > stop\".\\n'\n'\\n'\n' A range object will be empty if \"r[0]\" does not meet the '\n'value\\n'\n' constraint. Ranges do support negative indices, but these '\n'are\\n'\n' interpreted as indexing from the end of the sequence '\n'determined by\\n'\n' the positive indices.\\n'\n'\\n'\n' Ranges containing absolute values larger than \"sys.maxsize\" '\n'are\\n'\n' permitted but some features (such as \"len()\") may raise\\n'\n' \"OverflowError\".\\n'\n'\\n'\n' Range examples:\\n'\n'\\n'\n' >>> list(range(10))\\n'\n' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\\n'\n' >>> list(range(1, 11))\\n'\n' [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\\n'\n' >>> list(range(0, 30, 5))\\n'\n' [0, 5, 10, 15, 20, 25]\\n'\n' >>> list(range(0, 10, 3))\\n'\n' [0, 3, 6, 9]\\n'\n' >>> list(range(0, -10, -1))\\n'\n' [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\\n'\n' >>> list(range(0))\\n'\n' []\\n'\n' >>> list(range(1, 0))\\n'\n' []\\n'\n'\\n'\n' Ranges implement all of the common sequence operations '\n'except\\n'\n' concatenation and repetition (due to the fact that range '\n'objects\\n'\n' can only represent sequences that follow a strict pattern '\n'and\\n'\n' repetition and concatenation will usually violate that '\n'pattern).\\n'\n'\\n'\n' start\\n'\n'\\n'\n' The value of the *start* parameter (or \"0\" if the '\n'parameter was\\n'\n' not supplied)\\n'\n'\\n'\n' stop\\n'\n'\\n'\n' The value of the *stop* parameter\\n'\n'\\n'\n' step\\n'\n'\\n'\n' The value of the *step* parameter (or \"1\" if the parameter '\n'was\\n'\n' not supplied)\\n'\n'\\n'\n'The advantage of the \"range\" type over a regular \"list\" or '\n'\"tuple\" is\\n'\n'that a \"range\" object will always take the same (small) amount '\n'of\\n'\n'memory, no matter the size of the range it represents (as it '\n'only\\n'\n'stores the \"start\", \"stop\" and \"step\" values, calculating '\n'individual\\n'\n'items and subranges as needed).\\n'\n'\\n'\n'Range objects implement the \"collections.abc.Sequence\" ABC, and\\n'\n'provide features such as containment tests, element index '\n'lookup,\\n'\n'slicing and support for negative indices (see Sequence Types \u2014 '\n'list,\\n'\n'tuple, range):\\n'\n'\\n'\n'>>> r = range(0, 20, 2)\\n'\n'>>> r\\n'\n'range(0, 20, 2)\\n'\n'>>> 11 in r\\n'\n'False\\n'\n'>>> 10 in r\\n'\n'True\\n'\n'>>> r.index(10)\\n'\n'5\\n'\n'>>> r[5]\\n'\n'10\\n'\n'>>> r[:5]\\n'\n'range(0, 10, 2)\\n'\n'>>> r[-1]\\n'\n'18\\n'\n'\\n'\n'Testing range objects for equality with \"==\" and \"!=\" compares '\n'them as\\n'\n'sequences. That is, two range objects are considered equal if '\n'they\\n'\n'represent the same sequence of values. (Note that two range '\n'objects\\n'\n'that compare equal might have different \"start\", \"stop\" and '\n'\"step\"\\n'\n'attributes, for example \"range(0) == range(2, 1, 3)\" or '\n'\"range(0, 3,\\n'\n'2) == range(0, 4, 2)\".)\\n'\n'\\n'\n'Changed in version 3.2: Implement the Sequence ABC. Support '\n'slicing\\n'\n'and negative indices. Test \"int\" objects for membership in '\n'constant\\n'\n'time instead of iterating through all items.\\n'\n'\\n'\n'Changed in version 3.3: Define \u2018==\u2019 and \u2018!=\u2019 to compare range '\n'objects\\n'\n'based on the sequence of values they define (instead of '\n'comparing\\n'\n'based on object identity).\\n'\n'\\n'\n'New in version 3.3: The \"start\", \"stop\" and \"step\" attributes.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' * The linspace recipe shows how to implement a lazy version of '\n'range\\n'\n' suitable for floating point applications.\\n',\n'typesseq-mutable':'Mutable Sequence Types\\n'\n'**********************\\n'\n'\\n'\n'The operations in the following table are defined on '\n'mutable sequence\\n'\n'types. The \"collections.abc.MutableSequence\" ABC is '\n'provided to make\\n'\n'it easier to correctly implement these operations on '\n'custom sequence\\n'\n'types.\\n'\n'\\n'\n'In the table *s* is an instance of a mutable sequence '\n'type, *t* is any\\n'\n'iterable object and *x* is an arbitrary object that '\n'meets any type and\\n'\n'value restrictions imposed by *s* (for example, '\n'\"bytearray\" only\\n'\n'accepts integers that meet the value restriction \"0 <= x '\n'<= 255\").\\n'\n'\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| Operation | '\n'Result | Notes '\n'|\\n'\n'|================================|==================================|=======================|\\n'\n'| \"s[i] = x\" | item *i* of *s* is '\n'replaced by | |\\n'\n'| | '\n'*x* | '\n'|\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s[i:j] = t\" | slice of *s* from *i* '\n'to *j* is | |\\n'\n'| | replaced by the '\n'contents of the | |\\n'\n'| | iterable '\n'*t* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"del s[i:j]\" | same as \"s[i:j] = '\n'[]\" | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s[i:j:k] = t\" | the elements of '\n'\"s[i:j:k]\" are | (1) |\\n'\n'| | replaced by those of '\n'*t* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"del s[i:j:k]\" | removes the elements '\n'of | |\\n'\n'| | \"s[i:j:k]\" from the '\n'list | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.append(x)\" | appends *x* to the '\n'end of the | |\\n'\n'| | sequence (same '\n'as | |\\n'\n'| | \"s[len(s):len(s)] = '\n'[x]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.clear()\" | removes all items '\n'from *s* (same | (5) |\\n'\n'| | as \"del '\n's[:]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.copy()\" | creates a shallow '\n'copy of *s* | (5) |\\n'\n'| | (same as '\n'\"s[:]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.extend(t)\" or \"s += t\" | extends *s* with the '\n'contents of | |\\n'\n'| | *t* (for the most '\n'part the same | |\\n'\n'| | as \"s[len(s):len(s)] '\n'= t\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s *= n\" | updates *s* with its '\n'contents | (6) |\\n'\n'| | repeated *n* '\n'times | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.insert(i, x)\" | inserts *x* into *s* '\n'at the | |\\n'\n'| | index given by *i* '\n'(same as | |\\n'\n'| | \"s[i:i] = '\n'[x]\") | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.pop()\" or \"s.pop(i)\" | retrieves the item at '\n'*i* and | (2) |\\n'\n'| | also removes it from '\n'*s* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.remove(x)\" | remove the first item '\n'from *s* | (3) |\\n'\n'| | where \"s[i]\" is equal '\n'to *x* | |\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'| \"s.reverse()\" | reverses the items of '\n'*s* in | (4) |\\n'\n'| | '\n'place | '\n'|\\n'\n'+--------------------------------+----------------------------------+-----------------------+\\n'\n'\\n'\n'Notes:\\n'\n'\\n'\n'1. *t* must have the same length as the slice it is '\n'replacing.\\n'\n'\\n'\n'2. The optional argument *i* defaults to \"-1\", so that '\n'by default the\\n'\n' last item is removed and returned.\\n'\n'\\n'\n'3. \"remove()\" raises \"ValueError\" when *x* is not found '\n'in *s*.\\n'\n'\\n'\n'4. The \"reverse()\" method modifies the sequence in place '\n'for economy\\n'\n' of space when reversing a large sequence. To remind '\n'users that it\\n'\n' operates by side effect, it does not return the '\n'reversed sequence.\\n'\n'\\n'\n'5. \"clear()\" and \"copy()\" are included for consistency '\n'with the\\n'\n' interfaces of mutable containers that don\u2019t support '\n'slicing\\n'\n' operations (such as \"dict\" and \"set\"). \"copy()\" is '\n'not part of the\\n'\n' \"collections.abc.MutableSequence\" ABC, but most '\n'concrete mutable\\n'\n' sequence classes provide it.\\n'\n'\\n'\n' New in version 3.3: \"clear()\" and \"copy()\" methods.\\n'\n'\\n'\n'6. The value *n* is an integer, or an object '\n'implementing\\n'\n' \"__index__()\". Zero and negative values of *n* clear '\n'the sequence.\\n'\n' Items in the sequence are not copied; they are '\n'referenced multiple\\n'\n' times, as explained for \"s * n\" under Common Sequence '\n'Operations.\\n',\n'unary':'Unary arithmetic and bitwise operations\\n'\n'***************************************\\n'\n'\\n'\n'All unary arithmetic and bitwise operations have the same '\n'priority:\\n'\n'\\n'\n' u_expr ::= power | \"-\" u_expr | \"+\" u_expr | \"~\" u_expr\\n'\n'\\n'\n'The unary \"-\" (minus) operator yields the negation of its numeric\\n'\n'argument; the operation can be overridden with the \"__neg__()\" '\n'special\\n'\n'method.\\n'\n'\\n'\n'The unary \"+\" (plus) operator yields its numeric argument '\n'unchanged;\\n'\n'the operation can be overridden with the \"__pos__()\" special '\n'method.\\n'\n'\\n'\n'The unary \"~\" (invert) operator yields the bitwise inversion of '\n'its\\n'\n'integer argument. The bitwise inversion of \"x\" is defined as\\n'\n'\"-(x+1)\". It only applies to integral numbers or to custom '\n'objects\\n'\n'that override the \"__invert__()\" special method.\\n'\n'\\n'\n'In all three cases, if the argument does not have the proper type, '\n'a\\n'\n'\"TypeError\" exception is raised.\\n',\n'while':'The \"while\" statement\\n'\n'*********************\\n'\n'\\n'\n'The \"while\" statement is used for repeated execution as long as an\\n'\n'expression is true:\\n'\n'\\n'\n' while_stmt ::= \"while\" assignment_expression \":\" suite\\n'\n' [\"else\" \":\" suite]\\n'\n'\\n'\n'This repeatedly tests the expression and, if it is true, executes '\n'the\\n'\n'first suite; if the expression is false (which may be the first '\n'time\\n'\n'it is tested) the suite of the \"else\" clause, if present, is '\n'executed\\n'\n'and the loop terminates.\\n'\n'\\n'\n'A \"break\" statement executed in the first suite terminates the '\n'loop\\n'\n'without executing the \"else\" clause\u2019s suite. A \"continue\" '\n'statement\\n'\n'executed in the first suite skips the rest of the suite and goes '\n'back\\n'\n'to testing the expression.\\n',\n'with':'The \"with\" statement\\n'\n'********************\\n'\n'\\n'\n'The \"with\" statement is used to wrap the execution of a block with\\n'\n'methods defined by a context manager (see section With Statement\\n'\n'Context Managers). This allows common \"try\"\u2026\"except\"\u2026\"finally\" '\n'usage\\n'\n'patterns to be encapsulated for convenient reuse.\\n'\n'\\n'\n' with_stmt ::= \"with\" ( \"(\" with_stmt_contents \",\"? \")\" | '\n'with_stmt_contents ) \":\" suite\\n'\n' with_stmt_contents ::= with_item (\",\" with_item)*\\n'\n' with_item ::= expression [\"as\" target]\\n'\n'\\n'\n'The execution of the \"with\" statement with one \u201citem\u201d proceeds as\\n'\n'follows:\\n'\n'\\n'\n'1. The context expression (the expression given in the \"with_item\") '\n'is\\n'\n' evaluated to obtain a context manager.\\n'\n'\\n'\n'2. The context manager\u2019s \"__enter__()\" is loaded for later use.\\n'\n'\\n'\n'3. The context manager\u2019s \"__exit__()\" is loaded for later use.\\n'\n'\\n'\n'4. The context manager\u2019s \"__enter__()\" method is invoked.\\n'\n'\\n'\n'5. If a target was included in the \"with\" statement, the return '\n'value\\n'\n' from \"__enter__()\" is assigned to it.\\n'\n'\\n'\n' Note:\\n'\n'\\n'\n' The \"with\" statement guarantees that if the \"__enter__()\" '\n'method\\n'\n' returns without an error, then \"__exit__()\" will always be\\n'\n' called. Thus, if an error occurs during the assignment to the\\n'\n' target list, it will be treated the same as an error occurring\\n'\n' within the suite would be. See step 6 below.\\n'\n'\\n'\n'6. The suite is executed.\\n'\n'\\n'\n'7. The context manager\u2019s \"__exit__()\" method is invoked. If an\\n'\n' exception caused the suite to be exited, its type, value, and\\n'\n' traceback are passed as arguments to \"__exit__()\". Otherwise, '\n'three\\n'\n' \"None\" arguments are supplied.\\n'\n'\\n'\n' If the suite was exited due to an exception, and the return '\n'value\\n'\n' from the \"__exit__()\" method was false, the exception is '\n'reraised.\\n'\n' If the return value was true, the exception is suppressed, and\\n'\n' execution continues with the statement following the \"with\"\\n'\n' statement.\\n'\n'\\n'\n' If the suite was exited for any reason other than an exception, '\n'the\\n'\n' return value from \"__exit__()\" is ignored, and execution '\n'proceeds\\n'\n' at the normal location for the kind of exit that was taken.\\n'\n'\\n'\n'The following code:\\n'\n'\\n'\n' with EXPRESSION as TARGET:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' manager = (EXPRESSION)\\n'\n' enter = type(manager).__enter__\\n'\n' exit = type(manager).__exit__\\n'\n' value = enter(manager)\\n'\n' hit_except = False\\n'\n'\\n'\n' try:\\n'\n' TARGET = value\\n'\n' SUITE\\n'\n' except:\\n'\n' hit_except = True\\n'\n' if not exit(manager, *sys.exc_info()):\\n'\n' raise\\n'\n' finally:\\n'\n' if not hit_except:\\n'\n' exit(manager, None, None, None)\\n'\n'\\n'\n'With more than one item, the context managers are processed as if\\n'\n'multiple \"with\" statements were nested:\\n'\n'\\n'\n' with A() as a, B() as b:\\n'\n' SUITE\\n'\n'\\n'\n'is semantically equivalent to:\\n'\n'\\n'\n' with A() as a:\\n'\n' with B() as b:\\n'\n' SUITE\\n'\n'\\n'\n'You can also write multi-item context managers in multiple lines if\\n'\n'the items are surrounded by parentheses. For example:\\n'\n'\\n'\n' with (\\n'\n' A() as a,\\n'\n' B() as b,\\n'\n' ):\\n'\n' SUITE\\n'\n'\\n'\n'Changed in version 3.1: Support for multiple context expressions.\\n'\n'\\n'\n'Changed in version 3.10: Support for using grouping parentheses to\\n'\n'break the statement in multiple lines.\\n'\n'\\n'\n'See also:\\n'\n'\\n'\n' **PEP 343** - The \u201cwith\u201d statement\\n'\n' The specification, background, and examples for the Python '\n'\"with\"\\n'\n' statement.\\n',\n'yield':'The \"yield\" statement\\n'\n'*********************\\n'\n'\\n'\n' yield_stmt ::= yield_expression\\n'\n'\\n'\n'A \"yield\" statement is semantically equivalent to a yield '\n'expression.\\n'\n'The yield statement can be used to omit the parentheses that would\\n'\n'otherwise be required in the equivalent yield expression '\n'statement.\\n'\n'For example, the yield statements\\n'\n'\\n'\n' yield \\n'\n' yield from \\n'\n'\\n'\n'are equivalent to the yield expression statements\\n'\n'\\n'\n' (yield )\\n'\n' (yield from )\\n'\n'\\n'\n'Yield expressions and statements are only used when defining a\\n'\n'*generator* function, and are only used in the body of the '\n'generator\\n'\n'function. Using yield in a function definition is sufficient to '\n'cause\\n'\n'that definition to create a generator function instead of a normal\\n'\n'function.\\n'\n'\\n'\n'For full details of \"yield\" semantics, refer to the Yield '\n'expressions\\n'\n'section.\\n'}\n", []], "pydoc_data": [".py", "", [], 1], "unittest.async_case": [".py", "import asyncio\nimport contextvars\nimport inspect\nimport warnings\n\nfrom .case import TestCase\n\n\nclass IsolatedAsyncioTestCase(TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n def __init__(self,methodName='runTest'):\n super().__init__(methodName)\n self._asyncioRunner=None\n self._asyncioTestContext=contextvars.copy_context()\n \n async def asyncSetUp(self):\n pass\n \n async def asyncTearDown(self):\n pass\n \n def addAsyncCleanup(self,func,/,*args,**kwargs):\n \n \n \n \n \n \n \n \n \n \n \n \n self.addCleanup(*(func,*args),**kwargs)\n \n async def enterAsyncContext(self,cm):\n ''\n\n\n\n \n \n \n cls=type(cm)\n try :\n enter=cls.__aenter__\n exit=cls.__aexit__\n except AttributeError:\n raise TypeError(f\"'{cls.__module__}.{cls.__qualname__}' object does \"\n f\"not support the asynchronous context manager protocol\"\n )from None\n result=await enter(cm)\n self.addAsyncCleanup(exit,cm,None ,None ,None )\n return result\n \n def _callSetUp(self):\n \n \n \n self._asyncioRunner.get_loop()\n self._asyncioTestContext.run(self.setUp)\n self._callAsync(self.asyncSetUp)\n \n def _callTestMethod(self,method):\n if self._callMaybeAsync(method)is not None :\n warnings.warn(f'It is deprecated to return a value!=None from a '\n f'test case ({method})',DeprecationWarning,stacklevel=4)\n \n def _callTearDown(self):\n self._callAsync(self.asyncTearDown)\n self._asyncioTestContext.run(self.tearDown)\n \n def _callCleanup(self,function,*args,**kwargs):\n self._callMaybeAsync(function,*args,**kwargs)\n \n def _callAsync(self,func,/,*args,**kwargs):\n assert self._asyncioRunner is not None ,'asyncio runner is not initialized'\n assert inspect.iscoroutinefunction(func),f'{func!r} is not an async function'\n return self._asyncioRunner.run(\n func(*args,**kwargs),\n context=self._asyncioTestContext\n )\n \n def _callMaybeAsync(self,func,/,*args,**kwargs):\n assert self._asyncioRunner is not None ,'asyncio runner is not initialized'\n if inspect.iscoroutinefunction(func):\n return self._asyncioRunner.run(\n func(*args,**kwargs),\n context=self._asyncioTestContext,\n )\n else :\n return self._asyncioTestContext.run(func,*args,**kwargs)\n \n def _setupAsyncioRunner(self):\n assert self._asyncioRunner is None ,'asyncio runner is already initialized'\n runner=asyncio.Runner(debug=True )\n self._asyncioRunner=runner\n \n def _tearDownAsyncioRunner(self):\n runner=self._asyncioRunner\n runner.close()\n \n def run(self,result=None ):\n self._setupAsyncioRunner()\n try :\n return super().run(result)\n finally :\n self._tearDownAsyncioRunner()\n \n def debug(self):\n self._setupAsyncioRunner()\n super().debug()\n self._tearDownAsyncioRunner()\n \n def __del__(self):\n if self._asyncioRunner is not None :\n self._tearDownAsyncioRunner()\n", ["asyncio", "contextvars", "inspect", "unittest.case", "warnings"]], "unittest.case": [".py", "''\n\nimport sys\nimport functools\nimport difflib\nimport pprint\nimport re\nimport warnings\nimport collections\nimport contextlib\nimport traceback\nimport types\n\nfrom . import result\nfrom .util import (strclass,safe_repr,_count_diff_all_purpose,\n_count_diff_hashable,_common_shorten_repr)\n\n__unittest=True\n\n_subtest_msg_sentinel=object()\n\nDIFF_OMITTED=('\\nDiff is %s characters long. '\n'Set self.maxDiff to None to see it.')\n\nclass SkipTest(Exception):\n ''\n\n\n\n\n \n \nclass _ShouldStop(Exception):\n ''\n\n \n \nclass _UnexpectedSuccess(Exception):\n ''\n\n \n \n \nclass _Outcome(object):\n def __init__(self,result=None ):\n self.expecting_failure=False\n self.result=result\n self.result_supports_subtests=hasattr(result,\"addSubTest\")\n self.success=True\n self.expectedFailure=None\n \n @contextlib.contextmanager\n def testPartExecutor(self,test_case,subTest=False ):\n old_success=self.success\n self.success=True\n try :\n yield\n except KeyboardInterrupt:\n raise\n except SkipTest as e:\n self.success=False\n _addSkip(self.result,test_case,str(e))\n except _ShouldStop:\n pass\n except :\n exc_info=sys.exc_info()\n if self.expecting_failure:\n self.expectedFailure=exc_info\n else :\n self.success=False\n if subTest:\n self.result.addSubTest(test_case.test_case,test_case,exc_info)\n else :\n _addError(self.result,test_case,exc_info)\n \n \n exc_info=None\n else :\n if subTest and self.success:\n self.result.addSubTest(test_case.test_case,test_case,None )\n finally :\n self.success=self.success and old_success\n \n \ndef _addSkip(result,test_case,reason):\n addSkip=getattr(result,'addSkip',None )\n if addSkip is not None :\n addSkip(test_case,reason)\n else :\n warnings.warn(\"TestResult has no addSkip method, skips not reported\",\n RuntimeWarning,2)\n result.addSuccess(test_case)\n \ndef _addError(result,test,exc_info):\n if result is not None and exc_info is not None :\n if issubclass(exc_info[0],test.failureException):\n result.addFailure(test,exc_info)\n else :\n result.addError(test,exc_info)\n \ndef _id(obj):\n return obj\n \n \ndef _enter_context(cm,addcleanup):\n\n\n cls=type(cm)\n try :\n enter=cls.__enter__\n exit=cls.__exit__\n except AttributeError:\n raise TypeError(f\"'{cls.__module__}.{cls.__qualname__}' object does \"\n f\"not support the context manager protocol\")from None\n result=enter(cm)\n addcleanup(exit,cm,None ,None ,None )\n return result\n \n \n_module_cleanups=[]\ndef addModuleCleanup(function,/,*args,**kwargs):\n ''\n \n _module_cleanups.append((function,args,kwargs))\n \ndef enterModuleContext(cm):\n ''\n return _enter_context(cm,addModuleCleanup)\n \n \ndef doModuleCleanups():\n ''\n \n exceptions=[]\n while _module_cleanups:\n function,args,kwargs=_module_cleanups.pop()\n try :\n function(*args,**kwargs)\n except Exception as exc:\n exceptions.append(exc)\n if exceptions:\n \n \n raise exceptions[0]\n \n \ndef skip(reason):\n ''\n\n \n def decorator(test_item):\n if not isinstance(test_item,type):\n @functools.wraps(test_item)\n def skip_wrapper(*args,**kwargs):\n raise SkipTest(reason)\n test_item=skip_wrapper\n \n test_item.__unittest_skip__=True\n test_item.__unittest_skip_why__=reason\n return test_item\n if isinstance(reason,types.FunctionType):\n test_item=reason\n reason=''\n return decorator(test_item)\n return decorator\n \ndef skipIf(condition,reason):\n ''\n\n \n if condition:\n return skip(reason)\n return _id\n \ndef skipUnless(condition,reason):\n ''\n\n \n if not condition:\n return skip(reason)\n return _id\n \ndef expectedFailure(test_item):\n test_item.__unittest_expecting_failure__=True\n return test_item\n \ndef _is_subtype(expected,basetype):\n if isinstance(expected,tuple):\n return all(_is_subtype(e,basetype)for e in expected)\n return isinstance(expected,type)and issubclass(expected,basetype)\n \nclass _BaseTestCaseContext:\n\n def __init__(self,test_case):\n self.test_case=test_case\n \n def _raiseFailure(self,standardMsg):\n msg=self.test_case._formatMessage(self.msg,standardMsg)\n raise self.test_case.failureException(msg)\n \nclass _AssertRaisesBaseContext(_BaseTestCaseContext):\n\n def __init__(self,expected,test_case,expected_regex=None ):\n _BaseTestCaseContext.__init__(self,test_case)\n self.expected=expected\n self.test_case=test_case\n if expected_regex is not None :\n expected_regex=re.compile(expected_regex)\n self.expected_regex=expected_regex\n self.obj_name=None\n self.msg=None\n \n def handle(self,name,args,kwargs):\n ''\n\n\n\n\n \n try :\n if not _is_subtype(self.expected,self._base_type):\n raise TypeError('%s() arg 1 must be %s'%\n (name,self._base_type_str))\n if not args:\n self.msg=kwargs.pop('msg',None )\n if kwargs:\n raise TypeError('%r is an invalid keyword argument for '\n 'this function'%(next(iter(kwargs)),))\n return self\n \n callable_obj,*args=args\n try :\n self.obj_name=callable_obj.__name__\n except AttributeError:\n self.obj_name=str(callable_obj)\n with self:\n callable_obj(*args,**kwargs)\n finally :\n \n self=None\n \n \nclass _AssertRaisesContext(_AssertRaisesBaseContext):\n ''\n \n _base_type=BaseException\n _base_type_str='an exception type or tuple of exception types'\n \n def __enter__(self):\n return self\n \n def __exit__(self,exc_type,exc_value,tb):\n if exc_type is None :\n try :\n exc_name=self.expected.__name__\n except AttributeError:\n exc_name=str(self.expected)\n if self.obj_name:\n self._raiseFailure(\"{} not raised by {}\".format(exc_name,\n self.obj_name))\n else :\n self._raiseFailure(\"{} not raised\".format(exc_name))\n else :\n traceback.clear_frames(tb)\n if not issubclass(exc_type,self.expected):\n \n return False\n \n self.exception=exc_value.with_traceback(None )\n if self.expected_regex is None :\n return True\n \n expected_regex=self.expected_regex\n if not expected_regex.search(str(exc_value)):\n self._raiseFailure('\"{}\" does not match \"{}\"'.format(\n expected_regex.pattern,str(exc_value)))\n return True\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \nclass _AssertWarnsContext(_AssertRaisesBaseContext):\n ''\n \n _base_type=Warning\n _base_type_str='a warning type or tuple of warning types'\n \n def __enter__(self):\n \n \n for v in list(sys.modules.values()):\n if getattr(v,'__warningregistry__',None ):\n v.__warningregistry__={}\n self.warnings_manager=warnings.catch_warnings(record=True )\n self.warnings=self.warnings_manager.__enter__()\n warnings.simplefilter(\"always\",self.expected)\n return self\n \n def __exit__(self,exc_type,exc_value,tb):\n self.warnings_manager.__exit__(exc_type,exc_value,tb)\n if exc_type is not None :\n \n return\n try :\n exc_name=self.expected.__name__\n except AttributeError:\n exc_name=str(self.expected)\n first_matching=None\n for m in self.warnings:\n w=m.message\n if not isinstance(w,self.expected):\n continue\n if first_matching is None :\n first_matching=w\n if (self.expected_regex is not None and\n not self.expected_regex.search(str(w))):\n continue\n \n self.warning=w\n self.filename=m.filename\n self.lineno=m.lineno\n return\n \n if first_matching is not None :\n self._raiseFailure('\"{}\" does not match \"{}\"'.format(\n self.expected_regex.pattern,str(first_matching)))\n if self.obj_name:\n self._raiseFailure(\"{} not triggered by {}\".format(exc_name,\n self.obj_name))\n else :\n self._raiseFailure(\"{} not triggered\".format(exc_name))\n \n \nclass _OrderedChainMap(collections.ChainMap):\n def __iter__(self):\n seen=set()\n for mapping in self.maps:\n for k in mapping:\n if k not in seen:\n seen.add(k)\n yield k\n \n \nclass TestCase(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n failureException=AssertionError\n \n longMessage=True\n \n maxDiff=80 *8\n \n \n \n _diffThreshold=2 **16\n \n \n \n _classSetupFailed=False\n \n _class_cleanups=[]\n \n def __init__(self,methodName='runTest'):\n ''\n\n\n \n self._testMethodName=methodName\n self._outcome=None\n self._testMethodDoc='No test'\n try :\n testMethod=getattr(self,methodName)\n except AttributeError:\n if methodName !='runTest':\n \n \n raise ValueError(\"no such test method in %s: %s\"%\n (self.__class__,methodName))\n else :\n self._testMethodDoc=testMethod.__doc__\n self._cleanups=[]\n self._subtest=None\n \n \n \n \n self._type_equality_funcs={}\n self.addTypeEqualityFunc(dict,'assertDictEqual')\n self.addTypeEqualityFunc(list,'assertListEqual')\n self.addTypeEqualityFunc(tuple,'assertTupleEqual')\n self.addTypeEqualityFunc(set,'assertSetEqual')\n self.addTypeEqualityFunc(frozenset,'assertSetEqual')\n self.addTypeEqualityFunc(str,'assertMultiLineEqual')\n \n def addTypeEqualityFunc(self,typeobj,function):\n ''\n\n\n\n\n\n\n\n\n\n\n \n self._type_equality_funcs[typeobj]=function\n \n def addCleanup(self,function,/,*args,**kwargs):\n ''\n\n\n\n \n self._cleanups.append((function,args,kwargs))\n \n def enterContext(self,cm):\n ''\n\n\n\n \n return _enter_context(cm,self.addCleanup)\n \n @classmethod\n def addClassCleanup(cls,function,/,*args,**kwargs):\n ''\n \n cls._class_cleanups.append((function,args,kwargs))\n \n @classmethod\n def enterClassContext(cls,cm):\n ''\n return _enter_context(cm,cls.addClassCleanup)\n \n def setUp(self):\n ''\n pass\n \n def tearDown(self):\n ''\n pass\n \n @classmethod\n def setUpClass(cls):\n ''\n \n @classmethod\n def tearDownClass(cls):\n ''\n \n def countTestCases(self):\n return 1\n \n def defaultTestResult(self):\n return result.TestResult()\n \n def shortDescription(self):\n ''\n\n\n\n\n \n doc=self._testMethodDoc\n return doc.strip().split(\"\\n\")[0].strip()if doc else None\n \n \n def id(self):\n return \"%s.%s\"%(strclass(self.__class__),self._testMethodName)\n \n def __eq__(self,other):\n if type(self)is not type(other):\n return NotImplemented\n \n return self._testMethodName ==other._testMethodName\n \n def __hash__(self):\n return hash((type(self),self._testMethodName))\n \n def __str__(self):\n return \"%s (%s.%s)\"%(self._testMethodName,strclass(self.__class__),self._testMethodName)\n \n def __repr__(self):\n return \"<%s testMethod=%s>\"%\\\n (strclass(self.__class__),self._testMethodName)\n \n @contextlib.contextmanager\n def subTest(self,msg=_subtest_msg_sentinel,**params):\n ''\n\n\n\n\n \n if self._outcome is None or not self._outcome.result_supports_subtests:\n yield\n return\n parent=self._subtest\n if parent is None :\n params_map=_OrderedChainMap(params)\n else :\n params_map=parent.params.new_child(params)\n self._subtest=_SubTest(self,msg,params_map)\n try :\n with self._outcome.testPartExecutor(self._subtest,subTest=True ):\n yield\n if not self._outcome.success:\n result=self._outcome.result\n if result is not None and result.failfast:\n raise _ShouldStop\n elif self._outcome.expectedFailure:\n \n \n raise _ShouldStop\n finally :\n self._subtest=parent\n \n def _addExpectedFailure(self,result,exc_info):\n try :\n addExpectedFailure=result.addExpectedFailure\n except AttributeError:\n warnings.warn(\"TestResult has no addExpectedFailure method, reporting as passes\",\n RuntimeWarning)\n result.addSuccess(self)\n else :\n addExpectedFailure(self,exc_info)\n \n def _addUnexpectedSuccess(self,result):\n try :\n addUnexpectedSuccess=result.addUnexpectedSuccess\n except AttributeError:\n warnings.warn(\"TestResult has no addUnexpectedSuccess method, reporting as failure\",\n RuntimeWarning)\n \n \n try :\n raise _UnexpectedSuccess from None\n except _UnexpectedSuccess:\n result.addFailure(self,sys.exc_info())\n else :\n addUnexpectedSuccess(self)\n \n def _callSetUp(self):\n self.setUp()\n \n def _callTestMethod(self,method):\n if method()is not None :\n warnings.warn(f'It is deprecated to return a value!=None from a '\n f'test case ({method})',DeprecationWarning,stacklevel=3)\n \n def _callTearDown(self):\n self.tearDown()\n \n def _callCleanup(self,function,/,*args,**kwargs):\n function(*args,**kwargs)\n \n def run(self,result=None ):\n if result is None :\n result=self.defaultTestResult()\n startTestRun=getattr(result,'startTestRun',None )\n stopTestRun=getattr(result,'stopTestRun',None )\n if startTestRun is not None :\n startTestRun()\n else :\n stopTestRun=None\n \n result.startTest(self)\n try :\n testMethod=getattr(self,self._testMethodName)\n if (getattr(self.__class__,\"__unittest_skip__\",False )or\n getattr(testMethod,\"__unittest_skip__\",False )):\n \n skip_why=(getattr(self.__class__,'__unittest_skip_why__','')\n or getattr(testMethod,'__unittest_skip_why__',''))\n _addSkip(result,self,skip_why)\n return result\n \n expecting_failure=(\n getattr(self,\"__unittest_expecting_failure__\",False )or\n getattr(testMethod,\"__unittest_expecting_failure__\",False )\n )\n outcome=_Outcome(result)\n try :\n self._outcome=outcome\n \n with outcome.testPartExecutor(self):\n self._callSetUp()\n if outcome.success:\n outcome.expecting_failure=expecting_failure\n with outcome.testPartExecutor(self):\n self._callTestMethod(testMethod)\n outcome.expecting_failure=False\n with outcome.testPartExecutor(self):\n self._callTearDown()\n self.doCleanups()\n \n if outcome.success:\n if expecting_failure:\n if outcome.expectedFailure:\n self._addExpectedFailure(result,outcome.expectedFailure)\n else :\n self._addUnexpectedSuccess(result)\n else :\n result.addSuccess(self)\n return result\n finally :\n \n \n outcome.expectedFailure=None\n outcome=None\n \n \n self._outcome=None\n \n finally :\n result.stopTest(self)\n if stopTestRun is not None :\n stopTestRun()\n \n def doCleanups(self):\n ''\n \n outcome=self._outcome or _Outcome()\n while self._cleanups:\n function,args,kwargs=self._cleanups.pop()\n with outcome.testPartExecutor(self):\n self._callCleanup(function,*args,**kwargs)\n \n \n \n return outcome.success\n \n @classmethod\n def doClassCleanups(cls):\n ''\n \n cls.tearDown_exceptions=[]\n while cls._class_cleanups:\n function,args,kwargs=cls._class_cleanups.pop()\n try :\n function(*args,**kwargs)\n except Exception:\n cls.tearDown_exceptions.append(sys.exc_info())\n \n def __call__(self,*args,**kwds):\n return self.run(*args,**kwds)\n \n def debug(self):\n ''\n testMethod=getattr(self,self._testMethodName)\n if (getattr(self.__class__,\"__unittest_skip__\",False )or\n getattr(testMethod,\"__unittest_skip__\",False )):\n \n skip_why=(getattr(self.__class__,'__unittest_skip_why__','')\n or getattr(testMethod,'__unittest_skip_why__',''))\n raise SkipTest(skip_why)\n \n self._callSetUp()\n self._callTestMethod(testMethod)\n self._callTearDown()\n while self._cleanups:\n function,args,kwargs=self._cleanups.pop()\n self._callCleanup(function,*args,**kwargs)\n \n def skipTest(self,reason):\n ''\n raise SkipTest(reason)\n \n def fail(self,msg=None ):\n ''\n raise self.failureException(msg)\n \n def assertFalse(self,expr,msg=None ):\n ''\n if expr:\n msg=self._formatMessage(msg,\"%s is not false\"%safe_repr(expr))\n raise self.failureException(msg)\n \n def assertTrue(self,expr,msg=None ):\n ''\n if not expr:\n msg=self._formatMessage(msg,\"%s is not true\"%safe_repr(expr))\n raise self.failureException(msg)\n \n def _formatMessage(self,msg,standardMsg):\n ''\n\n\n\n\n\n\n\n \n if not self.longMessage:\n return msg or standardMsg\n if msg is None :\n return standardMsg\n try :\n \n \n return '%s : %s'%(standardMsg,msg)\n except UnicodeDecodeError:\n return '%s : %s'%(safe_repr(standardMsg),safe_repr(msg))\n \n def assertRaises(self,expected_exception,*args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n context=_AssertRaisesContext(expected_exception,self)\n try :\n return context.handle('assertRaises',args,kwargs)\n finally :\n \n context=None\n \n def assertWarns(self,expected_warning,*args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n context=_AssertWarnsContext(expected_warning,self)\n return context.handle('assertWarns',args,kwargs)\n \n def assertLogs(self,logger=None ,level=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n from ._log import _AssertLogsContext\n return _AssertLogsContext(self,logger,level,no_logs=False )\n \n def assertNoLogs(self,logger=None ,level=None ):\n ''\n\n\n\n \n from ._log import _AssertLogsContext\n return _AssertLogsContext(self,logger,level,no_logs=True )\n \n def _getAssertEqualityFunc(self,first,second):\n ''\n\n\n\n\n \n \n \n \n \n \n \n \n \n \n \n if type(first)is type(second):\n asserter=self._type_equality_funcs.get(type(first))\n if asserter is not None :\n if isinstance(asserter,str):\n asserter=getattr(self,asserter)\n return asserter\n \n return self._baseAssertEqual\n \n def _baseAssertEqual(self,first,second,msg=None ):\n ''\n if not first ==second:\n standardMsg='%s != %s'%_common_shorten_repr(first,second)\n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n def assertEqual(self,first,second,msg=None ):\n ''\n\n \n assertion_func=self._getAssertEqualityFunc(first,second)\n assertion_func(first,second,msg=msg)\n \n def assertNotEqual(self,first,second,msg=None ):\n ''\n\n \n if not first !=second:\n msg=self._formatMessage(msg,'%s == %s'%(safe_repr(first),\n safe_repr(second)))\n raise self.failureException(msg)\n \n def assertAlmostEqual(self,first,second,places=None ,msg=None ,\n delta=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n \n if first ==second:\n \n return\n if delta is not None and places is not None :\n raise TypeError(\"specify delta or places not both\")\n \n diff=abs(first -second)\n if delta is not None :\n if diff <=delta:\n return\n \n standardMsg='%s != %s within %s delta (%s difference)'%(\n safe_repr(first),\n safe_repr(second),\n safe_repr(delta),\n safe_repr(diff))\n else :\n if places is None :\n places=7\n \n if round(diff,places)==0:\n return\n \n standardMsg='%s != %s within %r places (%s difference)'%(\n safe_repr(first),\n safe_repr(second),\n places,\n safe_repr(diff))\n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n def assertNotAlmostEqual(self,first,second,places=None ,msg=None ,\n delta=None ):\n ''\n\n\n\n\n\n\n\n\n \n if delta is not None and places is not None :\n raise TypeError(\"specify delta or places not both\")\n diff=abs(first -second)\n if delta is not None :\n if not (first ==second)and diff >delta:\n return\n standardMsg='%s == %s within %s delta (%s difference)'%(\n safe_repr(first),\n safe_repr(second),\n safe_repr(delta),\n safe_repr(diff))\n else :\n if places is None :\n places=7\n if not (first ==second)and round(diff,places)!=0:\n return\n standardMsg='%s == %s within %r places'%(safe_repr(first),\n safe_repr(second),\n places)\n \n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n def assertSequenceEqual(self,seq1,seq2,msg=None ,seq_type=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if seq_type is not None :\n seq_type_name=seq_type.__name__\n if not isinstance(seq1,seq_type):\n raise self.failureException('First sequence is not a %s: %s'\n %(seq_type_name,safe_repr(seq1)))\n if not isinstance(seq2,seq_type):\n raise self.failureException('Second sequence is not a %s: %s'\n %(seq_type_name,safe_repr(seq2)))\n else :\n seq_type_name=\"sequence\"\n \n differing=None\n try :\n len1=len(seq1)\n except (TypeError,NotImplementedError):\n differing='First %s has no length. Non-sequence?'%(\n seq_type_name)\n \n if differing is None :\n try :\n len2=len(seq2)\n except (TypeError,NotImplementedError):\n differing='Second %s has no length. Non-sequence?'%(\n seq_type_name)\n \n if differing is None :\n if seq1 ==seq2:\n return\n \n differing='%ss differ: %s != %s\\n'%(\n (seq_type_name.capitalize(),)+\n _common_shorten_repr(seq1,seq2))\n \n for i in range(min(len1,len2)):\n try :\n item1=seq1[i]\n except (TypeError,IndexError,NotImplementedError):\n differing +=('\\nUnable to index element %d of first %s\\n'%\n (i,seq_type_name))\n break\n \n try :\n item2=seq2[i]\n except (TypeError,IndexError,NotImplementedError):\n differing +=('\\nUnable to index element %d of second %s\\n'%\n (i,seq_type_name))\n break\n \n if item1 !=item2:\n differing +=('\\nFirst differing element %d:\\n%s\\n%s\\n'%\n ((i,)+_common_shorten_repr(item1,item2)))\n break\n else :\n if (len1 ==len2 and seq_type is None and\n type(seq1)!=type(seq2)):\n \n return\n \n if len1 >len2:\n differing +=('\\nFirst %s contains %d additional '\n 'elements.\\n'%(seq_type_name,len1 -len2))\n try :\n differing +=('First extra element %d:\\n%s\\n'%\n (len2,safe_repr(seq1[len2])))\n except (TypeError,IndexError,NotImplementedError):\n differing +=('Unable to index element %d '\n 'of first %s\\n'%(len2,seq_type_name))\n elif len1 self._diffThreshold or\n len(second)>self._diffThreshold):\n self._baseAssertEqual(first,second,msg)\n firstlines=first.splitlines(keepends=True )\n secondlines=second.splitlines(keepends=True )\n if len(firstlines)==1 and first.strip('\\r\\n')==first:\n firstlines=[first+'\\n']\n secondlines=[second+'\\n']\n standardMsg='%s != %s'%_common_shorten_repr(first,second)\n diff='\\n'+''.join(difflib.ndiff(firstlines,secondlines))\n standardMsg=self._truncateMessage(standardMsg,diff)\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertLess(self,a,b,msg=None ):\n ''\n if not a b:\n standardMsg='%s not greater than %s'%(safe_repr(a),safe_repr(b))\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertGreaterEqual(self,a,b,msg=None ):\n ''\n if not a >=b:\n standardMsg='%s not greater than or equal to %s'%(safe_repr(a),safe_repr(b))\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertIsNone(self,obj,msg=None ):\n ''\n if obj is not None :\n standardMsg='%s is not None'%(safe_repr(obj),)\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertIsNotNone(self,obj,msg=None ):\n ''\n if obj is None :\n standardMsg='unexpectedly None'\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertIsInstance(self,obj,cls,msg=None ):\n ''\n \n if not isinstance(obj,cls):\n standardMsg='%s is not an instance of %r'%(safe_repr(obj),cls)\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertNotIsInstance(self,obj,cls,msg=None ):\n ''\n if isinstance(obj,cls):\n standardMsg='%s is an instance of %r'%(safe_repr(obj),cls)\n self.fail(self._formatMessage(msg,standardMsg))\n \n def assertRaisesRegex(self,expected_exception,expected_regex,\n *args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n \n context=_AssertRaisesContext(expected_exception,self,expected_regex)\n return context.handle('assertRaisesRegex',args,kwargs)\n \n def assertWarnsRegex(self,expected_warning,expected_regex,\n *args,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n context=_AssertWarnsContext(expected_warning,self,expected_regex)\n return context.handle('assertWarnsRegex',args,kwargs)\n \n def assertRegex(self,text,expected_regex,msg=None ):\n ''\n if isinstance(expected_regex,(str,bytes)):\n assert expected_regex,\"expected_regex must not be empty.\"\n expected_regex=re.compile(expected_regex)\n if not expected_regex.search(text):\n standardMsg=\"Regex didn't match: %r not found in %r\"%(\n expected_regex.pattern,text)\n \n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n def assertNotRegex(self,text,unexpected_regex,msg=None ):\n ''\n if isinstance(unexpected_regex,(str,bytes)):\n unexpected_regex=re.compile(unexpected_regex)\n match=unexpected_regex.search(text)\n if match:\n standardMsg='Regex matched: %r matches %r in %r'%(\n text[match.start():match.end()],\n unexpected_regex.pattern,\n text)\n \n msg=self._formatMessage(msg,standardMsg)\n raise self.failureException(msg)\n \n \n def _deprecate(original_func):\n def deprecated_func(*args,**kwargs):\n warnings.warn(\n 'Please use {0} instead.'.format(original_func.__name__),\n DeprecationWarning,2)\n return original_func(*args,**kwargs)\n return deprecated_func\n \n \n failUnlessEqual=assertEquals=_deprecate(assertEqual)\n failIfEqual=assertNotEquals=_deprecate(assertNotEqual)\n failUnlessAlmostEqual=assertAlmostEquals=_deprecate(assertAlmostEqual)\n failIfAlmostEqual=assertNotAlmostEquals=_deprecate(assertNotAlmostEqual)\n failUnless=assert_=_deprecate(assertTrue)\n failUnlessRaises=_deprecate(assertRaises)\n failIf=_deprecate(assertFalse)\n assertRaisesRegexp=_deprecate(assertRaisesRegex)\n assertRegexpMatches=_deprecate(assertRegex)\n assertNotRegexpMatches=_deprecate(assertNotRegex)\n \n \n \nclass FunctionTestCase(TestCase):\n ''\n\n\n\n\n\n \n \n def __init__(self,testFunc,setUp=None ,tearDown=None ,description=None ):\n super(FunctionTestCase,self).__init__()\n self._setUpFunc=setUp\n self._tearDownFunc=tearDown\n self._testFunc=testFunc\n self._description=description\n \n def setUp(self):\n if self._setUpFunc is not None :\n self._setUpFunc()\n \n def tearDown(self):\n if self._tearDownFunc is not None :\n self._tearDownFunc()\n \n def runTest(self):\n self._testFunc()\n \n def id(self):\n return self._testFunc.__name__\n \n def __eq__(self,other):\n if not isinstance(other,self.__class__):\n return NotImplemented\n \n return self._setUpFunc ==other._setUpFunc and\\\n self._tearDownFunc ==other._tearDownFunc and\\\n self._testFunc ==other._testFunc and\\\n self._description ==other._description\n \n def __hash__(self):\n return hash((type(self),self._setUpFunc,self._tearDownFunc,\n self._testFunc,self._description))\n \n def __str__(self):\n return \"%s (%s)\"%(strclass(self.__class__),\n self._testFunc.__name__)\n \n def __repr__(self):\n return \"<%s tec=%s>\"%(strclass(self.__class__),\n self._testFunc)\n \n def shortDescription(self):\n if self._description is not None :\n return self._description\n doc=self._testFunc.__doc__\n return doc and doc.split(\"\\n\")[0].strip()or None\n \n \nclass _SubTest(TestCase):\n\n def __init__(self,test_case,message,params):\n super().__init__()\n self._message=message\n self.test_case=test_case\n self.params=params\n self.failureException=test_case.failureException\n \n def runTest(self):\n raise NotImplementedError(\"subtests cannot be run directly\")\n \n def _subDescription(self):\n parts=[]\n if self._message is not _subtest_msg_sentinel:\n parts.append(\"[{}]\".format(self._message))\n if self.params:\n params_desc=', '.join(\n \"{}={!r}\".format(k,v)\n for (k,v)in self.params.items())\n parts.append(\"({})\".format(params_desc))\n return \" \".join(parts)or '()'\n \n def id(self):\n return \"{} {}\".format(self.test_case.id(),self._subDescription())\n \n def shortDescription(self):\n ''\n\n \n return self.test_case.shortDescription()\n \n def __str__(self):\n return \"{} {}\".format(self.test_case,self._subDescription())\n", ["collections", "contextlib", "difflib", "functools", "pprint", "re", "sys", "traceback", "types", "unittest", "unittest._log", "unittest.result", "unittest.util", "warnings"]], "unittest.loader": [".py", "''\n\nimport os\nimport re\nimport sys\nimport traceback\nimport types\nimport functools\n\nfrom fnmatch import fnmatch,fnmatchcase\n\nfrom. import case,suite,util\n\n__unittest=True\n\n\n\n\nVALID_MODULE_NAME=re.compile(r'[_a-z]\\w*\\.py$',re.IGNORECASE)\n\n\nclass _FailedTest(case.TestCase):\n _testMethodName=None\n \n def __init__(self,method_name,exception):\n self._exception=exception\n super(_FailedTest,self).__init__(method_name)\n \n def __getattr__(self,name):\n if name !=self._testMethodName:\n return super(_FailedTest,self).__getattr__(name)\n def testFailure():\n raise self._exception\n return testFailure\n \n \ndef _make_failed_import_test(name,suiteClass):\n message='Failed to import test module: %s\\n%s'%(\n name,traceback.format_exc())\n return _make_failed_test(name,ImportError(message),suiteClass,message)\n \ndef _make_failed_load_tests(name,exception,suiteClass):\n message='Failed to call load_tests:\\n%s'%(traceback.format_exc(),)\n return _make_failed_test(\n name,exception,suiteClass,message)\n \ndef _make_failed_test(methodname,exception,suiteClass,message):\n test=_FailedTest(methodname,exception)\n return suiteClass((test,)),message\n \ndef _make_skipped_test(methodname,exception,suiteClass):\n @case.skip(str(exception))\n def testSkipped(self):\n pass\n attrs={methodname:testSkipped}\n TestClass=type(\"ModuleSkipped\",(case.TestCase,),attrs)\n return suiteClass((TestClass(methodname),))\n \ndef _splitext(path):\n return os.path.splitext(path)[0]\n \n \nclass TestLoader(object):\n ''\n\n\n \n testMethodPrefix='test'\n sortTestMethodsUsing=staticmethod(util.three_way_cmp)\n testNamePatterns=None\n suiteClass=suite.TestSuite\n _top_level_dir=None\n \n def __init__(self):\n super(TestLoader,self).__init__()\n self.errors=[]\n \n \n self._loading_packages=set()\n \n def loadTestsFromTestCase(self,testCaseClass):\n ''\n if issubclass(testCaseClass,suite.TestSuite):\n raise TypeError(\"Test cases should not be derived from \"\n \"TestSuite. Maybe you meant to derive from \"\n \"TestCase?\")\n testCaseNames=self.getTestCaseNames(testCaseClass)\n if not testCaseNames and hasattr(testCaseClass,'runTest'):\n testCaseNames=['runTest']\n loaded_suite=self.suiteClass(map(testCaseClass,testCaseNames))\n return loaded_suite\n \n def loadTestsFromModule(self,module,*,pattern=None):\n ''\n tests=[]\n for name in dir(module):\n obj=getattr(module,name)\n if isinstance(obj,type)and issubclass(obj,case.TestCase):\n tests.append(self.loadTestsFromTestCase(obj))\n \n load_tests=getattr(module,'load_tests',None)\n tests=self.suiteClass(tests)\n if load_tests is not None:\n try:\n return load_tests(self,tests,pattern)\n except Exception as e:\n error_case,error_message=_make_failed_load_tests(\n module.__name__,e,self.suiteClass)\n self.errors.append(error_message)\n return error_case\n return tests\n \n def loadTestsFromName(self,name,module=None):\n ''\n\n\n\n\n\n\n \n parts=name.split('.')\n error_case,error_message=None,None\n if module is None:\n parts_copy=parts[:]\n while parts_copy:\n try:\n module_name='.'.join(parts_copy)\n module=__import__(module_name)\n break\n except ImportError:\n next_attribute=parts_copy.pop()\n \n error_case,error_message=_make_failed_import_test(\n next_attribute,self.suiteClass)\n if not parts_copy:\n \n self.errors.append(error_message)\n return error_case\n parts=parts[1:]\n obj=module\n for part in parts:\n try:\n parent,obj=obj,getattr(obj,part)\n except AttributeError as e:\n \n if(getattr(obj,'__path__',None)is not None\n and error_case is not None):\n \n \n \n \n \n self.errors.append(error_message)\n return error_case\n else:\n \n error_case,error_message=_make_failed_test(\n part,e,self.suiteClass,\n 'Failed to access attribute:\\n%s'%(\n traceback.format_exc(),))\n self.errors.append(error_message)\n return error_case\n \n if isinstance(obj,types.ModuleType):\n return self.loadTestsFromModule(obj)\n elif isinstance(obj,type)and issubclass(obj,case.TestCase):\n return self.loadTestsFromTestCase(obj)\n elif(isinstance(obj,types.FunctionType)and\n isinstance(parent,type)and\n issubclass(parent,case.TestCase)):\n name=parts[-1]\n inst=parent(name)\n \n if not isinstance(getattr(inst,name),types.FunctionType):\n return self.suiteClass([inst])\n elif isinstance(obj,suite.TestSuite):\n return obj\n if callable(obj):\n test=obj()\n if isinstance(test,suite.TestSuite):\n return test\n elif isinstance(test,case.TestCase):\n return self.suiteClass([test])\n else:\n raise TypeError(\"calling %s returned %s, not a test\"%\n (obj,test))\n else:\n raise TypeError(\"don't know how to make test from: %s\"%obj)\n \n def loadTestsFromNames(self,names,module=None):\n ''\n\n \n suites=[self.loadTestsFromName(name,module)for name in names]\n return self.suiteClass(suites)\n \n def getTestCaseNames(self,testCaseClass):\n ''\n \n def shouldIncludeMethod(attrname):\n if not attrname.startswith(self.testMethodPrefix):\n return False\n testFunc=getattr(testCaseClass,attrname)\n if not callable(testFunc):\n return False\n fullName=f'%s.%s.%s'%(\n testCaseClass.__module__,testCaseClass.__qualname__,attrname\n )\n return self.testNamePatterns is None or\\\n any(fnmatchcase(fullName,pattern)for pattern in self.testNamePatterns)\n testFnNames=list(filter(shouldIncludeMethod,dir(testCaseClass)))\n if self.sortTestMethodsUsing:\n testFnNames.sort(key=functools.cmp_to_key(self.sortTestMethodsUsing))\n return testFnNames\n \n def discover(self,start_dir,pattern='test*.py',top_level_dir=None):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n set_implicit_top=False\n if top_level_dir is None and self._top_level_dir is not None:\n \n top_level_dir=self._top_level_dir\n elif top_level_dir is None:\n set_implicit_top=True\n top_level_dir=start_dir\n \n top_level_dir=os.path.abspath(top_level_dir)\n \n if not top_level_dir in sys.path:\n \n \n \n \n sys.path.insert(0,top_level_dir)\n self._top_level_dir=top_level_dir\n \n is_not_importable=False\n if os.path.isdir(os.path.abspath(start_dir)):\n start_dir=os.path.abspath(start_dir)\n if start_dir !=top_level_dir:\n is_not_importable=not os.path.isfile(os.path.join(start_dir,'__init__.py'))\n else:\n \n try:\n __import__(start_dir)\n except ImportError:\n is_not_importable=True\n else:\n the_module=sys.modules[start_dir]\n top_part=start_dir.split('.')[0]\n try:\n start_dir=os.path.abspath(\n os.path.dirname((the_module.__file__)))\n except AttributeError:\n if the_module.__name__ in sys.builtin_module_names:\n \n raise TypeError('Can not use builtin modules '\n 'as dotted module names')from None\n else:\n raise TypeError(\n f\"don't know how to discover from {the_module !r}\"\n )from None\n \n if set_implicit_top:\n self._top_level_dir=self._get_directory_containing_module(top_part)\n sys.path.remove(top_level_dir)\n \n if is_not_importable:\n raise ImportError('Start directory is not importable: %r'%start_dir)\n \n tests=list(self._find_tests(start_dir,pattern))\n return self.suiteClass(tests)\n \n def _get_directory_containing_module(self,module_name):\n module=sys.modules[module_name]\n full_path=os.path.abspath(module.__file__)\n \n if os.path.basename(full_path).lower().startswith('__init__.py'):\n return os.path.dirname(os.path.dirname(full_path))\n else:\n \n \n \n return os.path.dirname(full_path)\n \n def _get_name_from_path(self,path):\n if path ==self._top_level_dir:\n return '.'\n path=_splitext(os.path.normpath(path))\n \n _relpath=os.path.relpath(path,self._top_level_dir)\n assert not os.path.isabs(_relpath),\"Path must be within the project\"\n assert not _relpath.startswith('..'),\"Path must be within the project\"\n \n name=_relpath.replace(os.path.sep,'.')\n return name\n \n def _get_module_from_name(self,name):\n __import__(name)\n return sys.modules[name]\n \n def _match_path(self,path,full_path,pattern):\n \n return fnmatch(path,pattern)\n \n def _find_tests(self,start_dir,pattern):\n ''\n \n name=self._get_name_from_path(start_dir)\n \n \n if name !='.'and name not in self._loading_packages:\n \n \n tests,should_recurse=self._find_test_path(start_dir,pattern)\n if tests is not None:\n yield tests\n if not should_recurse:\n \n \n return\n \n paths=sorted(os.listdir(start_dir))\n for path in paths:\n full_path=os.path.join(start_dir,path)\n tests,should_recurse=self._find_test_path(full_path,pattern)\n if tests is not None:\n yield tests\n if should_recurse:\n \n name=self._get_name_from_path(full_path)\n self._loading_packages.add(name)\n try:\n yield from self._find_tests(full_path,pattern)\n finally:\n self._loading_packages.discard(name)\n \n def _find_test_path(self,full_path,pattern):\n ''\n\n\n\n\n\n \n basename=os.path.basename(full_path)\n if os.path.isfile(full_path):\n if not VALID_MODULE_NAME.match(basename):\n \n return None,False\n if not self._match_path(basename,full_path,pattern):\n return None,False\n \n name=self._get_name_from_path(full_path)\n try:\n module=self._get_module_from_name(name)\n except case.SkipTest as e:\n return _make_skipped_test(name,e,self.suiteClass),False\n except:\n error_case,error_message=\\\n _make_failed_import_test(name,self.suiteClass)\n self.errors.append(error_message)\n return error_case,False\n else:\n mod_file=os.path.abspath(\n getattr(module,'__file__',full_path))\n realpath=_splitext(\n os.path.realpath(mod_file))\n fullpath_noext=_splitext(\n os.path.realpath(full_path))\n if realpath.lower()!=fullpath_noext.lower():\n module_dir=os.path.dirname(realpath)\n mod_name=_splitext(\n os.path.basename(full_path))\n expected_dir=os.path.dirname(full_path)\n msg=(\"%r module incorrectly imported from %r. Expected \"\n \"%r. Is this module globally installed?\")\n raise ImportError(\n msg %(mod_name,module_dir,expected_dir))\n return self.loadTestsFromModule(module,pattern=pattern),False\n elif os.path.isdir(full_path):\n if not os.path.isfile(os.path.join(full_path,'__init__.py')):\n return None,False\n \n load_tests=None\n tests=None\n name=self._get_name_from_path(full_path)\n try:\n package=self._get_module_from_name(name)\n except case.SkipTest as e:\n return _make_skipped_test(name,e,self.suiteClass),False\n except:\n error_case,error_message=\\\n _make_failed_import_test(name,self.suiteClass)\n self.errors.append(error_message)\n return error_case,False\n else:\n load_tests=getattr(package,'load_tests',None)\n \n self._loading_packages.add(name)\n try:\n tests=self.loadTestsFromModule(package,pattern=pattern)\n if load_tests is not None:\n \n return tests,False\n return tests,True\n finally:\n self._loading_packages.discard(name)\n else:\n return None,False\n \n \ndefaultTestLoader=TestLoader()\n\n\n\n\n\ndef _makeLoader(prefix,sortUsing,suiteClass=None,testNamePatterns=None):\n loader=TestLoader()\n loader.sortTestMethodsUsing=sortUsing\n loader.testMethodPrefix=prefix\n loader.testNamePatterns=testNamePatterns\n if suiteClass:\n loader.suiteClass=suiteClass\n return loader\n \ndef getTestCaseNames(testCaseClass,prefix,sortUsing=util.three_way_cmp,testNamePatterns=None):\n import warnings\n warnings.warn(\n \"unittest.getTestCaseNames() is deprecated and will be removed in Python 3.13. \"\n \"Please use unittest.TestLoader.getTestCaseNames() instead.\",\n DeprecationWarning,stacklevel=2\n )\n return _makeLoader(prefix,sortUsing,testNamePatterns=testNamePatterns).getTestCaseNames(testCaseClass)\n \ndef makeSuite(testCaseClass,prefix='test',sortUsing=util.three_way_cmp,\nsuiteClass=suite.TestSuite):\n import warnings\n warnings.warn(\n \"unittest.makeSuite() is deprecated and will be removed in Python 3.13. \"\n \"Please use unittest.TestLoader.loadTestsFromTestCase() instead.\",\n DeprecationWarning,stacklevel=2\n )\n return _makeLoader(prefix,sortUsing,suiteClass).loadTestsFromTestCase(\n testCaseClass)\n \ndef findTestCases(module,prefix='test',sortUsing=util.three_way_cmp,\nsuiteClass=suite.TestSuite):\n import warnings\n warnings.warn(\n \"unittest.findTestCases() is deprecated and will be removed in Python 3.13. \"\n \"Please use unittest.TestLoader.loadTestsFromModule() instead.\",\n DeprecationWarning,stacklevel=2\n )\n return _makeLoader(prefix,sortUsing,suiteClass).loadTestsFromModule(\\\n module)\n", ["fnmatch", "functools", "os", "re", "sys", "traceback", "types", "unittest", "unittest.case", "unittest.suite", "unittest.util", "warnings"]], "unittest.main": [".py", "''\n\nimport sys\nimport argparse\nimport os\nimport warnings\n\nfrom. import loader,runner\nfrom.signals import installHandler\n\n__unittest=True\n_NO_TESTS_EXITCODE=5\n\nMAIN_EXAMPLES=\"\"\"\\\nExamples:\n %(prog)s test_module - run tests from test_module\n %(prog)s module.TestClass - run tests from module.TestClass\n %(prog)s module.Class.test_method - run specified test method\n %(prog)s path/to/test_file.py - run tests from test_file.py\n\"\"\"\n\nMODULE_EXAMPLES=\"\"\"\\\nExamples:\n %(prog)s - run default set of tests\n %(prog)s MyTestSuite - run suite 'MyTestSuite'\n %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething\n %(prog)s MyTestCase - run all 'test*' test methods\n in MyTestCase\n\"\"\"\n\ndef _convert_name(name):\n\n\n\n\n if os.path.isfile(name)and name.lower().endswith('.py'):\n if os.path.isabs(name):\n rel_path=os.path.relpath(name,os.getcwd())\n if os.path.isabs(rel_path)or rel_path.startswith(os.pardir):\n return name\n name=rel_path\n \n \n return os.path.normpath(name)[:-3].replace('\\\\','.').replace('/','.')\n return name\n \ndef _convert_names(names):\n return[_convert_name(name)for name in names]\n \n \ndef _convert_select_pattern(pattern):\n if not '*'in pattern:\n pattern='*%s*'%pattern\n return pattern\n \n \nclass TestProgram(object):\n ''\n\n \n \n module=None\n verbosity=1\n failfast=catchbreak=buffer=progName=warnings=testNamePatterns=None\n _discovery_parser=None\n \n def __init__(self,module='__main__',defaultTest=None,argv=None,\n testRunner=None,testLoader=loader.defaultTestLoader,\n exit=True,verbosity=1,failfast=None,catchbreak=None,\n buffer=None,warnings=None,*,tb_locals=False,\n durations=None):\n if isinstance(module,str):\n self.module=__import__(module)\n for part in module.split('.')[1:]:\n self.module=getattr(self.module,part)\n else:\n self.module=module\n if argv is None:\n argv=sys.argv\n \n self.exit=exit\n self.failfast=failfast\n self.catchbreak=catchbreak\n self.verbosity=verbosity\n self.buffer=buffer\n self.tb_locals=tb_locals\n self.durations=durations\n if warnings is None and not sys.warnoptions:\n \n \n \n self.warnings='default'\n else:\n \n \n \n \n \n self.warnings=warnings\n self.defaultTest=defaultTest\n self.testRunner=testRunner\n self.testLoader=testLoader\n self.progName=os.path.basename(argv[0])\n self.parseArgs(argv)\n self.runTests()\n \n def usageExit(self,msg=None):\n warnings.warn(\"TestProgram.usageExit() is deprecated and will be\"\n \" removed in Python 3.13\",DeprecationWarning)\n if msg:\n print(msg)\n if self._discovery_parser is None:\n self._initArgParsers()\n self._print_help()\n sys.exit(2)\n \n def _print_help(self,*args,**kwargs):\n if self.module is None:\n print(self._main_parser.format_help())\n print(MAIN_EXAMPLES %{'prog':self.progName})\n self._discovery_parser.print_help()\n else:\n print(self._main_parser.format_help())\n print(MODULE_EXAMPLES %{'prog':self.progName})\n \n def parseArgs(self,argv):\n self._initArgParsers()\n if self.module is None:\n if len(argv)>1 and argv[1].lower()=='discover':\n self._do_discovery(argv[2:])\n return\n self._main_parser.parse_args(argv[1:],self)\n if not self.tests:\n \n \n self._do_discovery([])\n return\n else:\n self._main_parser.parse_args(argv[1:],self)\n \n if self.tests:\n self.testNames=_convert_names(self.tests)\n if __name__ =='__main__':\n \n self.module=None\n elif self.defaultTest is None:\n \n self.testNames=None\n elif isinstance(self.defaultTest,str):\n self.testNames=(self.defaultTest,)\n else:\n self.testNames=list(self.defaultTest)\n self.createTests()\n \n def createTests(self,from_discovery=False,Loader=None):\n if self.testNamePatterns:\n self.testLoader.testNamePatterns=self.testNamePatterns\n if from_discovery:\n loader=self.testLoader if Loader is None else Loader()\n self.test=loader.discover(self.start,self.pattern,self.top)\n elif self.testNames is None:\n self.test=self.testLoader.loadTestsFromModule(self.module)\n else:\n self.test=self.testLoader.loadTestsFromNames(self.testNames,\n self.module)\n \n def _initArgParsers(self):\n parent_parser=self._getParentArgParser()\n self._main_parser=self._getMainArgParser(parent_parser)\n self._discovery_parser=self._getDiscoveryArgParser(parent_parser)\n \n def _getParentArgParser(self):\n parser=argparse.ArgumentParser(add_help=False)\n \n parser.add_argument('-v','--verbose',dest='verbosity',\n action='store_const',const=2,\n help='Verbose output')\n parser.add_argument('-q','--quiet',dest='verbosity',\n action='store_const',const=0,\n help='Quiet output')\n parser.add_argument('--locals',dest='tb_locals',\n action='store_true',\n help='Show local variables in tracebacks')\n parser.add_argument('--durations',dest='durations',type=int,\n default=None,metavar=\"N\",\n help='Show the N slowest test cases (N=0 for all)')\n if self.failfast is None:\n parser.add_argument('-f','--failfast',dest='failfast',\n action='store_true',\n help='Stop on first fail or error')\n self.failfast=False\n if self.catchbreak is None:\n parser.add_argument('-c','--catch',dest='catchbreak',\n action='store_true',\n help='Catch Ctrl-C and display results so far')\n self.catchbreak=False\n if self.buffer is None:\n parser.add_argument('-b','--buffer',dest='buffer',\n action='store_true',\n help='Buffer stdout and stderr during tests')\n self.buffer=False\n if self.testNamePatterns is None:\n parser.add_argument('-k',dest='testNamePatterns',\n action='append',type=_convert_select_pattern,\n help='Only run tests which match the given substring')\n self.testNamePatterns=[]\n \n return parser\n \n def _getMainArgParser(self,parent):\n parser=argparse.ArgumentParser(parents=[parent])\n parser.prog=self.progName\n parser.print_help=self._print_help\n \n parser.add_argument('tests',nargs='*',\n help='a list of any number of test modules, '\n 'classes and test methods.')\n \n return parser\n \n def _getDiscoveryArgParser(self,parent):\n parser=argparse.ArgumentParser(parents=[parent])\n parser.prog='%s discover'%self.progName\n parser.epilog=('For test discovery all test modules must be '\n 'importable from the top level directory of the '\n 'project.')\n \n parser.add_argument('-s','--start-directory',dest='start',\n help=\"Directory to start discovery ('.' default)\")\n parser.add_argument('-p','--pattern',dest='pattern',\n help=\"Pattern to match tests ('test*.py' default)\")\n parser.add_argument('-t','--top-level-directory',dest='top',\n help='Top level directory of project (defaults to '\n 'start directory)')\n for arg in('start','pattern','top'):\n parser.add_argument(arg,nargs='?',\n default=argparse.SUPPRESS,\n help=argparse.SUPPRESS)\n \n return parser\n \n def _do_discovery(self,argv,Loader=None):\n self.start='.'\n self.pattern='test*.py'\n self.top=None\n if argv is not None:\n \n if self._discovery_parser is None:\n \n self._initArgParsers()\n self._discovery_parser.parse_args(argv,self)\n \n self.createTests(from_discovery=True,Loader=Loader)\n \n def runTests(self):\n if self.catchbreak:\n installHandler()\n if self.testRunner is None:\n self.testRunner=runner.TextTestRunner\n if isinstance(self.testRunner,type):\n try:\n try:\n testRunner=self.testRunner(verbosity=self.verbosity,\n failfast=self.failfast,\n buffer=self.buffer,\n warnings=self.warnings,\n tb_locals=self.tb_locals,\n durations=self.durations)\n except TypeError:\n \n testRunner=self.testRunner(verbosity=self.verbosity,\n failfast=self.failfast,\n buffer=self.buffer,\n warnings=self.warnings)\n except TypeError:\n \n testRunner=self.testRunner()\n else:\n \n testRunner=self.testRunner\n self.result=testRunner.run(self.test)\n if self.exit:\n if self.result.testsRun ==0:\n sys.exit(_NO_TESTS_EXITCODE)\n elif self.result.wasSuccessful():\n sys.exit(0)\n else:\n sys.exit(1)\n \n \nmain=TestProgram\n", ["argparse", "os", "sys", "unittest", "unittest.loader", "unittest.runner", "unittest.signals", "warnings"]], "unittest.mock": [".py", "\n\n\n\n\n\n__all__=(\n'Mock',\n'MagicMock',\n'patch',\n'sentinel',\n'DEFAULT',\n'ANY',\n'call',\n'create_autospec',\n'AsyncMock',\n'FILTER_DIR',\n'NonCallableMock',\n'NonCallableMagicMock',\n'mock_open',\n'PropertyMock',\n'seal',\n)\n\n\nimport asyncio\nimport contextlib\nimport io\nimport inspect\nimport pprint\nimport sys\nimport builtins\nimport pkgutil\nfrom asyncio import iscoroutinefunction\nfrom types import CodeType,ModuleType,MethodType\nfrom unittest.util import safe_repr\nfrom functools import wraps,partial\n\n\nclass InvalidSpecError(Exception):\n ''\n \n \n_builtins={name for name in dir(builtins)if not name.startswith('_')}\n\nFILTER_DIR=True\n\n\n\n_safe_super=super\n\ndef _is_async_obj(obj):\n if _is_instance_mock(obj)and not isinstance(obj,AsyncMock):\n return False\n if hasattr(obj,'__func__'):\n obj=getattr(obj,'__func__')\n return iscoroutinefunction(obj)or inspect.isawaitable(obj)\n \n \ndef _is_async_func(func):\n if getattr(func,'__code__',None ):\n return iscoroutinefunction(func)\n else :\n return False\n \n \ndef _is_instance_mock(obj):\n\n\n return issubclass(type(obj),NonCallableMock)\n \n \ndef _is_exception(obj):\n return (\n isinstance(obj,BaseException)or\n isinstance(obj,type)and issubclass(obj,BaseException)\n )\n \n \ndef _extract_mock(obj):\n\n\n if isinstance(obj,FunctionTypes)and hasattr(obj,'mock'):\n return obj.mock\n else :\n return obj\n \n \ndef _get_signature_object(func,as_instance,eat_self):\n ''\n\n\n\n \n if isinstance(func,type)and not as_instance:\n \n func=func.__init__\n \n eat_self=True\n elif not isinstance(func,FunctionTypes):\n \n \n try :\n func=func.__call__\n except AttributeError:\n return None\n if eat_self:\n sig_func=partial(func,None )\n else :\n sig_func=func\n try :\n return func,inspect.signature(sig_func)\n except ValueError:\n \n return None\n \n \ndef _check_signature(func,mock,skipfirst,instance=False ):\n sig=_get_signature_object(func,instance,skipfirst)\n if sig is None :\n return\n func,sig=sig\n def checksig(self,/,*args,**kwargs):\n sig.bind(*args,**kwargs)\n _copy_func_details(func,checksig)\n type(mock)._mock_check_sig=checksig\n type(mock).__signature__=sig\n \n \ndef _copy_func_details(func,funcopy):\n\n\n for attribute in (\n '__name__','__doc__','__text_signature__',\n '__module__','__defaults__','__kwdefaults__',\n ):\n try :\n setattr(funcopy,attribute,getattr(func,attribute))\n except AttributeError:\n pass\n \n \ndef _callable(obj):\n if isinstance(obj,type):\n return True\n if isinstance(obj,(staticmethod,classmethod,MethodType)):\n return _callable(obj.__func__)\n if getattr(obj,'__call__',None )is not None :\n return True\n return False\n \n \ndef _is_list(obj):\n\n\n return type(obj)in (list,tuple)\n \n \ndef _instance_callable(obj):\n ''\n \n if not isinstance(obj,type):\n \n return getattr(obj,'__call__',None )is not None\n \n \n \n for base in (obj,)+obj.__mro__:\n if base.__dict__.get('__call__')is not None :\n return True\n return False\n \n \ndef _set_signature(mock,original,instance=False ):\n\n\n\n\n skipfirst=isinstance(original,type)\n result=_get_signature_object(original,instance,skipfirst)\n if result is None :\n return mock\n func,sig=result\n def checksig(*args,**kwargs):\n sig.bind(*args,**kwargs)\n _copy_func_details(func,checksig)\n \n name=original.__name__\n if not name.isidentifier():\n name='funcopy'\n context={'_checksig_':checksig,'mock':mock}\n src=\"\"\"def %s(*args, **kwargs):\n _checksig_(*args, **kwargs)\n return mock(*args, **kwargs)\"\"\"%name\n exec(src,context)\n funcopy=context[name]\n _setup_func(funcopy,mock,sig)\n return funcopy\n \n \ndef _setup_func(funcopy,mock,sig):\n funcopy.mock=mock\n \n def assert_called_with(*args,**kwargs):\n return mock.assert_called_with(*args,**kwargs)\n def assert_called(*args,**kwargs):\n return mock.assert_called(*args,**kwargs)\n def assert_not_called(*args,**kwargs):\n return mock.assert_not_called(*args,**kwargs)\n def assert_called_once(*args,**kwargs):\n return mock.assert_called_once(*args,**kwargs)\n def assert_called_once_with(*args,**kwargs):\n return mock.assert_called_once_with(*args,**kwargs)\n def assert_has_calls(*args,**kwargs):\n return mock.assert_has_calls(*args,**kwargs)\n def assert_any_call(*args,**kwargs):\n return mock.assert_any_call(*args,**kwargs)\n def reset_mock():\n funcopy.method_calls=_CallList()\n funcopy.mock_calls=_CallList()\n mock.reset_mock()\n ret=funcopy.return_value\n if _is_instance_mock(ret)and not ret is mock:\n ret.reset_mock()\n \n funcopy.called=False\n funcopy.call_count=0\n funcopy.call_args=None\n funcopy.call_args_list=_CallList()\n funcopy.method_calls=_CallList()\n funcopy.mock_calls=_CallList()\n \n funcopy.return_value=mock.return_value\n funcopy.side_effect=mock.side_effect\n funcopy._mock_children=mock._mock_children\n \n funcopy.assert_called_with=assert_called_with\n funcopy.assert_called_once_with=assert_called_once_with\n funcopy.assert_has_calls=assert_has_calls\n funcopy.assert_any_call=assert_any_call\n funcopy.reset_mock=reset_mock\n funcopy.assert_called=assert_called\n funcopy.assert_not_called=assert_not_called\n funcopy.assert_called_once=assert_called_once\n funcopy.__signature__=sig\n \n mock._mock_delegate=funcopy\n \n \ndef _setup_async_mock(mock):\n mock._is_coroutine=asyncio.coroutines._is_coroutine\n mock.await_count=0\n mock.await_args=None\n mock.await_args_list=_CallList()\n \n \n \n \n def wrapper(attr,/,*args,**kwargs):\n return getattr(mock.mock,attr)(*args,**kwargs)\n \n for attribute in ('assert_awaited',\n 'assert_awaited_once',\n 'assert_awaited_with',\n 'assert_awaited_once_with',\n 'assert_any_await',\n 'assert_has_awaits',\n 'assert_not_awaited'):\n \n \n \n \n \n setattr(mock,attribute,partial(wrapper,attribute))\n \n \ndef _is_magic(name):\n return '__%s__'%name[2:-2]==name\n \n \nclass _SentinelObject(object):\n ''\n def __init__(self,name):\n self.name=name\n \n def __repr__(self):\n return 'sentinel.%s'%self.name\n \n def __reduce__(self):\n return 'sentinel.%s'%self.name\n \n \nclass _Sentinel(object):\n ''\n def __init__(self):\n self._sentinels={}\n \n def __getattr__(self,name):\n if name =='__bases__':\n \n raise AttributeError\n return self._sentinels.setdefault(name,_SentinelObject(name))\n \n def __reduce__(self):\n return 'sentinel'\n \n \nsentinel=_Sentinel()\n\nDEFAULT=sentinel.DEFAULT\n_missing=sentinel.MISSING\n_deleted=sentinel.DELETED\n\n\n_allowed_names={\n'return_value','_mock_return_value','side_effect',\n'_mock_side_effect','_mock_parent','_mock_new_parent',\n'_mock_name','_mock_new_name'\n}\n\n\ndef _delegating_property(name):\n _allowed_names.add(name)\n _the_name='_mock_'+name\n def _get(self,name=name,_the_name=_the_name):\n sig=self._mock_delegate\n if sig is None :\n return getattr(self,_the_name)\n return getattr(sig,name)\n def _set(self,value,name=name,_the_name=_the_name):\n sig=self._mock_delegate\n if sig is None :\n self.__dict__[_the_name]=value\n else :\n setattr(sig,name,value)\n \n return property(_get,_set)\n \n \n \nclass _CallList(list):\n\n def __contains__(self,value):\n if not isinstance(value,list):\n return list.__contains__(self,value)\n len_value=len(value)\n len_self=len(self)\n if len_value >len_self:\n return False\n \n for i in range(0,len_self -len_value+1):\n sub_list=self[i:i+len_value]\n if sub_list ==value:\n return True\n return False\n \n def __repr__(self):\n return pprint.pformat(list(self))\n \n \ndef _check_and_set_parent(parent,value,name,new_name):\n value=_extract_mock(value)\n \n if not _is_instance_mock(value):\n return False\n if ((value._mock_name or value._mock_new_name)or\n (value._mock_parent is not None )or\n (value._mock_new_parent is not None )):\n return False\n \n _parent=parent\n while _parent is not None :\n \n \n if _parent is value:\n return False\n _parent=_parent._mock_new_parent\n \n if new_name:\n value._mock_new_parent=parent\n value._mock_new_name=new_name\n if name:\n value._mock_parent=parent\n value._mock_name=name\n return True\n \n \nclass _MockIter(object):\n def __init__(self,obj):\n self.obj=iter(obj)\n def __next__(self):\n return next(self.obj)\n \nclass Base(object):\n _mock_return_value=DEFAULT\n _mock_side_effect=None\n def __init__(self,/,*args,**kwargs):\n pass\n \n \n \nclass NonCallableMock(Base):\n ''\n \n def __new__(cls,/,*args,**kw):\n \n \n \n bases=(cls,)\n if not issubclass(cls,AsyncMockMixin):\n \n bound_args=_MOCK_SIG.bind_partial(cls,*args,**kw).arguments\n spec_arg=bound_args.get('spec_set',bound_args.get('spec'))\n if spec_arg is not None and _is_async_obj(spec_arg):\n bases=(AsyncMockMixin,cls)\n new=type(cls.__name__,bases,{'__doc__':cls.__doc__})\n instance=_safe_super(NonCallableMock,cls).__new__(new)\n return instance\n \n \n def __init__(\n self,spec=None ,wraps=None ,name=None ,spec_set=None ,\n parent=None ,_spec_state=None ,_new_name='',_new_parent=None ,\n _spec_as_instance=False ,_eat_self=None ,unsafe=False ,**kwargs\n ):\n if _new_parent is None :\n _new_parent=parent\n \n __dict__=self.__dict__\n __dict__['_mock_parent']=parent\n __dict__['_mock_name']=name\n __dict__['_mock_new_name']=_new_name\n __dict__['_mock_new_parent']=_new_parent\n __dict__['_mock_sealed']=False\n \n if spec_set is not None :\n spec=spec_set\n spec_set=True\n if _eat_self is None :\n _eat_self=parent is not None\n \n self._mock_add_spec(spec,spec_set,_spec_as_instance,_eat_self)\n \n __dict__['_mock_children']={}\n __dict__['_mock_wraps']=wraps\n __dict__['_mock_delegate']=None\n \n __dict__['_mock_called']=False\n __dict__['_mock_call_args']=None\n __dict__['_mock_call_count']=0\n __dict__['_mock_call_args_list']=_CallList()\n __dict__['_mock_mock_calls']=_CallList()\n \n __dict__['method_calls']=_CallList()\n __dict__['_mock_unsafe']=unsafe\n \n if kwargs:\n self.configure_mock(**kwargs)\n \n _safe_super(NonCallableMock,self).__init__(\n spec,wraps,name,spec_set,parent,\n _spec_state\n )\n \n \n def attach_mock(self,mock,attribute):\n ''\n\n\n \n inner_mock=_extract_mock(mock)\n \n inner_mock._mock_parent=None\n inner_mock._mock_new_parent=None\n inner_mock._mock_name=''\n inner_mock._mock_new_name=None\n \n setattr(self,attribute,mock)\n \n \n def mock_add_spec(self,spec,spec_set=False ):\n ''\n\n\n\n \n self._mock_add_spec(spec,spec_set)\n \n \n def _mock_add_spec(self,spec,spec_set,_spec_as_instance=False ,\n _eat_self=False ):\n if _is_instance_mock(spec):\n raise InvalidSpecError(f'Cannot spec a Mock object. [object={spec!r}]')\n \n _spec_class=None\n _spec_signature=None\n _spec_asyncs=[]\n \n for attr in dir(spec):\n if iscoroutinefunction(getattr(spec,attr,None )):\n _spec_asyncs.append(attr)\n \n if spec is not None and not _is_list(spec):\n if isinstance(spec,type):\n _spec_class=spec\n else :\n _spec_class=type(spec)\n res=_get_signature_object(spec,\n _spec_as_instance,_eat_self)\n _spec_signature=res and res[1]\n \n spec=dir(spec)\n \n __dict__=self.__dict__\n __dict__['_spec_class']=_spec_class\n __dict__['_spec_set']=spec_set\n __dict__['_spec_signature']=_spec_signature\n __dict__['_mock_methods']=spec\n __dict__['_spec_asyncs']=_spec_asyncs\n \n def __get_return_value(self):\n ret=self._mock_return_value\n if self._mock_delegate is not None :\n ret=self._mock_delegate.return_value\n \n if ret is DEFAULT:\n ret=self._get_child_mock(\n _new_parent=self,_new_name='()'\n )\n self.return_value=ret\n return ret\n \n \n def __set_return_value(self,value):\n if self._mock_delegate is not None :\n self._mock_delegate.return_value=value\n else :\n self._mock_return_value=value\n _check_and_set_parent(self,value,None ,'()')\n \n __return_value_doc=\"The value to be returned when the mock is called.\"\n return_value=property(__get_return_value,__set_return_value,\n __return_value_doc)\n \n \n @property\n def __class__(self):\n if self._spec_class is None :\n return type(self)\n return self._spec_class\n \n called=_delegating_property('called')\n call_count=_delegating_property('call_count')\n call_args=_delegating_property('call_args')\n call_args_list=_delegating_property('call_args_list')\n mock_calls=_delegating_property('mock_calls')\n \n \n def __get_side_effect(self):\n delegated=self._mock_delegate\n if delegated is None :\n return self._mock_side_effect\n sf=delegated.side_effect\n if (sf is not None and not callable(sf)\n and not isinstance(sf,_MockIter)and not _is_exception(sf)):\n sf=_MockIter(sf)\n delegated.side_effect=sf\n return sf\n \n def __set_side_effect(self,value):\n value=_try_iter(value)\n delegated=self._mock_delegate\n if delegated is None :\n self._mock_side_effect=value\n else :\n delegated.side_effect=value\n \n side_effect=property(__get_side_effect,__set_side_effect)\n \n \n def reset_mock(self,visited=None ,*,return_value=False ,side_effect=False ):\n ''\n if visited is None :\n visited=[]\n if id(self)in visited:\n return\n visited.append(id(self))\n \n self.called=False\n self.call_args=None\n self.call_count=0\n self.mock_calls=_CallList()\n self.call_args_list=_CallList()\n self.method_calls=_CallList()\n \n if return_value:\n self._mock_return_value=DEFAULT\n if side_effect:\n self._mock_side_effect=None\n \n for child in self._mock_children.values():\n if isinstance(child,_SpecState)or child is _deleted:\n continue\n child.reset_mock(visited,return_value=return_value,side_effect=side_effect)\n \n ret=self._mock_return_value\n if _is_instance_mock(ret)and ret is not self:\n ret.reset_mock(visited)\n \n \n def configure_mock(self,/,**kwargs):\n ''\n\n\n\n\n\n\n \n for arg,val in sorted(kwargs.items(),\n \n \n \n key=lambda entry:entry[0].count('.')):\n args=arg.split('.')\n final=args.pop()\n obj=self\n for entry in args:\n obj=getattr(obj,entry)\n setattr(obj,final,val)\n \n \n def __getattr__(self,name):\n if name in {'_mock_methods','_mock_unsafe'}:\n raise AttributeError(name)\n elif self._mock_methods is not None :\n if name not in self._mock_methods or name in _all_magics:\n raise AttributeError(\"Mock object has no attribute %r\"%name)\n elif _is_magic(name):\n raise AttributeError(name)\n if not self._mock_unsafe:\n if name.startswith(('assert','assret','asert','aseert','assrt')):\n raise AttributeError(\n f\"{name!r} is not a valid assertion. Use a spec \"\n f\"for the mock if {name!r} is meant to be an attribute.\")\n \n result=self._mock_children.get(name)\n if result is _deleted:\n raise AttributeError(name)\n elif result is None :\n wraps=None\n if self._mock_wraps is not None :\n \n \n wraps=getattr(self._mock_wraps,name)\n \n result=self._get_child_mock(\n parent=self,name=name,wraps=wraps,_new_name=name,\n _new_parent=self\n )\n self._mock_children[name]=result\n \n elif isinstance(result,_SpecState):\n try :\n result=create_autospec(\n result.spec,result.spec_set,result.instance,\n result.parent,result.name\n )\n except InvalidSpecError:\n target_name=self.__dict__['_mock_name']or self\n raise InvalidSpecError(\n f'Cannot autospec attr {name!r} from target '\n f'{target_name!r} as it has already been mocked out. '\n f'[target={self!r}, attr={result.spec!r}]')\n self._mock_children[name]=result\n \n return result\n \n \n def _extract_mock_name(self):\n _name_list=[self._mock_new_name]\n _parent=self._mock_new_parent\n last=self\n \n dot='.'\n if _name_list ==['()']:\n dot=''\n \n while _parent is not None :\n last=_parent\n \n _name_list.append(_parent._mock_new_name+dot)\n dot='.'\n if _parent._mock_new_name =='()':\n dot=''\n \n _parent=_parent._mock_new_parent\n \n _name_list=list(reversed(_name_list))\n _first=last._mock_name or 'mock'\n if len(_name_list)>1:\n if _name_list[1]not in ('()','().'):\n _first +='.'\n _name_list[0]=_first\n return ''.join(_name_list)\n \n def __repr__(self):\n name=self._extract_mock_name()\n \n name_string=''\n if name not in ('mock','mock.'):\n name_string=' name=%r'%name\n \n spec_string=''\n if self._spec_class is not None :\n spec_string=' spec=%r'\n if self._spec_set:\n spec_string=' spec_set=%r'\n spec_string=spec_string %self._spec_class.__name__\n return \"<%s%s%s id='%s'>\"%(\n type(self).__name__,\n name_string,\n spec_string,\n id(self)\n )\n \n \n def __dir__(self):\n ''\n if not FILTER_DIR:\n return object.__dir__(self)\n \n extras=self._mock_methods or []\n from_type=dir(type(self))\n from_dict=list(self.__dict__)\n from_child_mocks=[\n m_name for m_name,m_value in self._mock_children.items()\n if m_value is not _deleted]\n \n from_type=[e for e in from_type if not e.startswith('_')]\n from_dict=[e for e in from_dict if not e.startswith('_')or\n _is_magic(e)]\n return sorted(set(extras+from_type+from_dict+from_child_mocks))\n \n \n def __setattr__(self,name,value):\n if name in _allowed_names:\n \n return object.__setattr__(self,name,value)\n elif (self._spec_set and self._mock_methods is not None and\n name not in self._mock_methods and\n name not in self.__dict__):\n raise AttributeError(\"Mock object has no attribute '%s'\"%name)\n elif name in _unsupported_magics:\n msg='Attempting to set unsupported magic method %r.'%name\n raise AttributeError(msg)\n elif name in _all_magics:\n if self._mock_methods is not None and name not in self._mock_methods:\n raise AttributeError(\"Mock object has no attribute '%s'\"%name)\n \n if not _is_instance_mock(value):\n setattr(type(self),name,_get_method(name,value))\n original=value\n value=lambda *args,**kw:original(self,*args,**kw)\n else :\n \n \n _check_and_set_parent(self,value,None ,name)\n setattr(type(self),name,value)\n self._mock_children[name]=value\n elif name =='__class__':\n self._spec_class=value\n return\n else :\n if _check_and_set_parent(self,value,name,name):\n self._mock_children[name]=value\n \n if self._mock_sealed and not hasattr(self,name):\n mock_name=f'{self._extract_mock_name()}.{name}'\n raise AttributeError(f'Cannot set {mock_name}')\n \n return object.__setattr__(self,name,value)\n \n \n def __delattr__(self,name):\n if name in _all_magics and name in type(self).__dict__:\n delattr(type(self),name)\n if name not in self.__dict__:\n \n \n return\n \n obj=self._mock_children.get(name,_missing)\n if name in self.__dict__:\n _safe_super(NonCallableMock,self).__delattr__(name)\n elif obj is _deleted:\n raise AttributeError(name)\n if obj is not _missing:\n del self._mock_children[name]\n self._mock_children[name]=_deleted\n \n \n def _format_mock_call_signature(self,args,kwargs):\n name=self._mock_name or 'mock'\n return _format_call_signature(name,args,kwargs)\n \n \n def _format_mock_failure_message(self,args,kwargs,action='call'):\n message='expected %s not found.\\nExpected: %s\\nActual: %s'\n expected_string=self._format_mock_call_signature(args,kwargs)\n call_args=self.call_args\n actual_string=self._format_mock_call_signature(*call_args)\n return message %(action,expected_string,actual_string)\n \n \n def _get_call_signature_from_name(self,name):\n ''\n\n\n\n\n\n\n\n\n \n if not name:\n return self._spec_signature\n \n sig=None\n names=name.replace('()','').split('.')\n children=self._mock_children\n \n for name in names:\n child=children.get(name)\n if child is None or isinstance(child,_SpecState):\n break\n else :\n \n \n \n child=_extract_mock(child)\n children=child._mock_children\n sig=child._spec_signature\n \n return sig\n \n \n def _call_matcher(self,_call):\n ''\n\n\n\n\n \n \n if isinstance(_call,tuple)and len(_call)>2:\n sig=self._get_call_signature_from_name(_call[0])\n else :\n sig=self._spec_signature\n \n if sig is not None :\n if len(_call)==2:\n name=''\n args,kwargs=_call\n else :\n name,args,kwargs=_call\n try :\n bound_call=sig.bind(*args,**kwargs)\n return call(name,bound_call.args,bound_call.kwargs)\n except TypeError as e:\n return e.with_traceback(None )\n else :\n return _call\n \n def assert_not_called(self):\n ''\n \n if self.call_count !=0:\n msg=(\"Expected '%s' to not have been called. Called %s times.%s\"\n %(self._mock_name or 'mock',\n self.call_count,\n self._calls_repr()))\n raise AssertionError(msg)\n \n def assert_called(self):\n ''\n \n if self.call_count ==0:\n msg=(\"Expected '%s' to have been called.\"%\n (self._mock_name or 'mock'))\n raise AssertionError(msg)\n \n def assert_called_once(self):\n ''\n \n if not self.call_count ==1:\n msg=(\"Expected '%s' to have been called once. Called %s times.%s\"\n %(self._mock_name or 'mock',\n self.call_count,\n self._calls_repr()))\n raise AssertionError(msg)\n \n def assert_called_with(self,/,*args,**kwargs):\n ''\n\n\n \n if self.call_args is None :\n expected=self._format_mock_call_signature(args,kwargs)\n actual='not called.'\n error_message=('expected call not found.\\nExpected: %s\\nActual: %s'\n %(expected,actual))\n raise AssertionError(error_message)\n \n def _error_message():\n msg=self._format_mock_failure_message(args,kwargs)\n return msg\n expected=self._call_matcher(_Call((args,kwargs),two=True ))\n actual=self._call_matcher(self.call_args)\n if actual !=expected:\n cause=expected if isinstance(expected,Exception)else None\n raise AssertionError(_error_message())from cause\n \n \n def assert_called_once_with(self,/,*args,**kwargs):\n ''\n \n if not self.call_count ==1:\n msg=(\"Expected '%s' to be called once. Called %s times.%s\"\n %(self._mock_name or 'mock',\n self.call_count,\n self._calls_repr()))\n raise AssertionError(msg)\n return self.assert_called_with(*args,**kwargs)\n \n \n def assert_has_calls(self,calls,any_order=False ):\n ''\n\n\n\n\n\n\n\n \n expected=[self._call_matcher(c)for c in calls]\n cause=next((e for e in expected if isinstance(e,Exception)),None )\n all_calls=_CallList(self._call_matcher(c)for c in self.mock_calls)\n if not any_order:\n if expected not in all_calls:\n if cause is None :\n problem='Calls not found.'\n else :\n problem=('Error processing expected calls.\\n'\n 'Errors: {}').format(\n [e if isinstance(e,Exception)else None\n for e in expected])\n raise AssertionError(\n f'{problem}\\n'\n f'Expected: {_CallList(calls)}'\n f'{self._calls_repr(prefix=\"Actual\").rstrip(\".\")}'\n )from cause\n return\n \n all_calls=list(all_calls)\n \n not_found=[]\n for kall in expected:\n try :\n all_calls.remove(kall)\n except ValueError:\n not_found.append(kall)\n if not_found:\n raise AssertionError(\n '%r does not contain all of %r in its call list, '\n 'found %r instead'%(self._mock_name or 'mock',\n tuple(not_found),all_calls)\n )from cause\n \n \n def assert_any_call(self,/,*args,**kwargs):\n ''\n\n\n\n \n expected=self._call_matcher(_Call((args,kwargs),two=True ))\n cause=expected if isinstance(expected,Exception)else None\n actual=[self._call_matcher(c)for c in self.call_args_list]\n if cause or expected not in _AnyComparer(actual):\n expected_string=self._format_mock_call_signature(args,kwargs)\n raise AssertionError(\n '%s call not found'%expected_string\n )from cause\n \n \n def _get_child_mock(self,/,**kw):\n ''\n\n\n\n\n\n \n _new_name=kw.get(\"_new_name\")\n if _new_name in self.__dict__['_spec_asyncs']:\n return AsyncMock(**kw)\n \n if self._mock_sealed:\n attribute=f\".{kw['name']}\"if \"name\"in kw else \"()\"\n mock_name=self._extract_mock_name()+attribute\n raise AttributeError(mock_name)\n \n _type=type(self)\n if issubclass(_type,MagicMock)and _new_name in _async_method_magics:\n \n klass=AsyncMock\n elif issubclass(_type,AsyncMockMixin):\n if (_new_name in _all_sync_magics or\n self._mock_methods and _new_name in self._mock_methods):\n \n klass=MagicMock\n else :\n klass=AsyncMock\n elif not issubclass(_type,CallableMixin):\n if issubclass(_type,NonCallableMagicMock):\n klass=MagicMock\n elif issubclass(_type,NonCallableMock):\n klass=Mock\n else :\n klass=_type.__mro__[1]\n return klass(**kw)\n \n \n def _calls_repr(self,prefix=\"Calls\"):\n ''\n\n\n\n\n\n \n if not self.mock_calls:\n return \"\"\n return f\"\\n{prefix}: {safe_repr(self.mock_calls)}.\"\n \n \n_MOCK_SIG=inspect.signature(NonCallableMock.__init__)\n\n\nclass _AnyComparer(list):\n ''\n\n\n \n def __contains__(self,item):\n for _call in self:\n assert len(item)==len(_call)\n if all([\n expected ==actual\n for expected,actual in zip(item,_call)\n ]):\n return True\n return False\n \n \ndef _try_iter(obj):\n if obj is None :\n return obj\n if _is_exception(obj):\n return obj\n if _callable(obj):\n return obj\n try :\n return iter(obj)\n except TypeError:\n \n \n return obj\n \n \nclass CallableMixin(Base):\n\n def __init__(self,spec=None ,side_effect=None ,return_value=DEFAULT,\n wraps=None ,name=None ,spec_set=None ,parent=None ,\n _spec_state=None ,_new_name='',_new_parent=None ,**kwargs):\n self.__dict__['_mock_return_value']=return_value\n _safe_super(CallableMixin,self).__init__(\n spec,wraps,name,spec_set,parent,\n _spec_state,_new_name,_new_parent,**kwargs\n )\n \n self.side_effect=side_effect\n \n \n def _mock_check_sig(self,/,*args,**kwargs):\n \n pass\n \n \n def __call__(self,/,*args,**kwargs):\n \n \n self._mock_check_sig(*args,**kwargs)\n self._increment_mock_call(*args,**kwargs)\n return self._mock_call(*args,**kwargs)\n \n \n def _mock_call(self,/,*args,**kwargs):\n return self._execute_mock_call(*args,**kwargs)\n \n def _increment_mock_call(self,/,*args,**kwargs):\n self.called=True\n self.call_count +=1\n \n \n \n \n _call=_Call((args,kwargs),two=True )\n self.call_args=_call\n self.call_args_list.append(_call)\n \n \n do_method_calls=self._mock_parent is not None\n method_call_name=self._mock_name\n \n \n mock_call_name=self._mock_new_name\n is_a_call=mock_call_name =='()'\n self.mock_calls.append(_Call(('',args,kwargs)))\n \n \n _new_parent=self._mock_new_parent\n while _new_parent is not None :\n \n \n if do_method_calls:\n _new_parent.method_calls.append(_Call((method_call_name,args,kwargs)))\n do_method_calls=_new_parent._mock_parent is not None\n if do_method_calls:\n method_call_name=_new_parent._mock_name+'.'+method_call_name\n \n \n this_mock_call=_Call((mock_call_name,args,kwargs))\n _new_parent.mock_calls.append(this_mock_call)\n \n if _new_parent._mock_new_name:\n if is_a_call:\n dot=''\n else :\n dot='.'\n is_a_call=_new_parent._mock_new_name =='()'\n mock_call_name=_new_parent._mock_new_name+dot+mock_call_name\n \n \n _new_parent=_new_parent._mock_new_parent\n \n def _execute_mock_call(self,/,*args,**kwargs):\n \n \n \n effect=self.side_effect\n if effect is not None :\n if _is_exception(effect):\n raise effect\n elif not _callable(effect):\n result=next(effect)\n if _is_exception(result):\n raise result\n else :\n result=effect(*args,**kwargs)\n \n if result is not DEFAULT:\n return result\n \n if self._mock_return_value is not DEFAULT:\n return self.return_value\n \n if self._mock_wraps is not None :\n return self._mock_wraps(*args,**kwargs)\n \n return self.return_value\n \n \n \nclass Mock(CallableMixin,NonCallableMock):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \n \n \ndef _check_spec_arg_typos(kwargs_to_check):\n typos=(\"autospect\",\"auto_spec\",\"set_spec\")\n for typo in typos:\n if typo in kwargs_to_check:\n raise RuntimeError(\n f\"{typo!r} might be a typo; use unsafe=True if this is intended\"\n )\n \n \nclass _patch(object):\n\n attribute_name=None\n _active_patches=[]\n \n def __init__(\n self,getter,attribute,new,spec,create,\n spec_set,autospec,new_callable,kwargs,*,unsafe=False\n ):\n if new_callable is not None :\n if new is not DEFAULT:\n raise ValueError(\n \"Cannot use 'new' and 'new_callable' together\"\n )\n if autospec is not None :\n raise ValueError(\n \"Cannot use 'autospec' and 'new_callable' together\"\n )\n if not unsafe:\n _check_spec_arg_typos(kwargs)\n if _is_instance_mock(spec):\n raise InvalidSpecError(\n f'Cannot spec attr {attribute!r} as the spec '\n f'has already been mocked out. [spec={spec!r}]')\n if _is_instance_mock(spec_set):\n raise InvalidSpecError(\n f'Cannot spec attr {attribute!r} as the spec_set '\n f'target has already been mocked out. [spec_set={spec_set!r}]')\n \n self.getter=getter\n self.attribute=attribute\n self.new=new\n self.new_callable=new_callable\n self.spec=spec\n self.create=create\n self.has_local=False\n self.spec_set=spec_set\n self.autospec=autospec\n self.kwargs=kwargs\n self.additional_patchers=[]\n \n \n def copy(self):\n patcher=_patch(\n self.getter,self.attribute,self.new,self.spec,\n self.create,self.spec_set,\n self.autospec,self.new_callable,self.kwargs\n )\n patcher.attribute_name=self.attribute_name\n patcher.additional_patchers=[\n p.copy()for p in self.additional_patchers\n ]\n return patcher\n \n \n def __call__(self,func):\n if isinstance(func,type):\n return self.decorate_class(func)\n if inspect.iscoroutinefunction(func):\n return self.decorate_async_callable(func)\n return self.decorate_callable(func)\n \n \n def decorate_class(self,klass):\n for attr in dir(klass):\n if not attr.startswith(patch.TEST_PREFIX):\n continue\n \n attr_value=getattr(klass,attr)\n if not hasattr(attr_value,\"__call__\"):\n continue\n \n patcher=self.copy()\n setattr(klass,attr,patcher(attr_value))\n return klass\n \n \n @contextlib.contextmanager\n def decoration_helper(self,patched,args,keywargs):\n extra_args=[]\n with contextlib.ExitStack()as exit_stack:\n for patching in patched.patchings:\n arg=exit_stack.enter_context(patching)\n if patching.attribute_name is not None :\n keywargs.update(arg)\n elif patching.new is DEFAULT:\n extra_args.append(arg)\n \n args +=tuple(extra_args)\n yield (args,keywargs)\n \n \n def decorate_callable(self,func):\n \n if hasattr(func,'patchings'):\n func.patchings.append(self)\n return func\n \n @wraps(func)\n def patched(*args,**keywargs):\n with self.decoration_helper(patched,\n args,\n keywargs)as (newargs,newkeywargs):\n return func(*newargs,**newkeywargs)\n \n patched.patchings=[self]\n return patched\n \n \n def decorate_async_callable(self,func):\n \n if hasattr(func,'patchings'):\n func.patchings.append(self)\n return func\n \n @wraps(func)\n async def patched(*args,**keywargs):\n with self.decoration_helper(patched,\n args,\n keywargs)as (newargs,newkeywargs):\n return await func(*newargs,**newkeywargs)\n \n patched.patchings=[self]\n return patched\n \n \n def get_original(self):\n target=self.getter()\n name=self.attribute\n \n original=DEFAULT\n local=False\n \n try :\n original=target.__dict__[name]\n except (AttributeError,KeyError):\n original=getattr(target,name,DEFAULT)\n else :\n local=True\n \n if name in _builtins and isinstance(target,ModuleType):\n self.create=True\n \n if not self.create and original is DEFAULT:\n raise AttributeError(\n \"%s does not have the attribute %r\"%(target,name)\n )\n return original,local\n \n \n def __enter__(self):\n ''\n new,spec,spec_set=self.new,self.spec,self.spec_set\n autospec,kwargs=self.autospec,self.kwargs\n new_callable=self.new_callable\n self.target=self.getter()\n \n \n if spec is False :\n spec=None\n if spec_set is False :\n spec_set=None\n if autospec is False :\n autospec=None\n \n if spec is not None and autospec is not None :\n raise TypeError(\"Can't specify spec and autospec\")\n if ((spec is not None or autospec is not None )and\n spec_set not in (True ,None )):\n raise TypeError(\"Can't provide explicit spec_set *and* spec or autospec\")\n \n original,local=self.get_original()\n \n if new is DEFAULT and autospec is None :\n inherit=False\n if spec is True :\n \n spec=original\n if spec_set is True :\n spec_set=original\n spec=None\n elif spec is not None :\n if spec_set is True :\n spec_set=spec\n spec=None\n elif spec_set is True :\n spec_set=original\n \n if spec is not None or spec_set is not None :\n if original is DEFAULT:\n raise TypeError(\"Can't use 'spec' with create=True\")\n if isinstance(original,type):\n \n inherit=True\n if spec is None and _is_async_obj(original):\n Klass=AsyncMock\n else :\n Klass=MagicMock\n _kwargs={}\n if new_callable is not None :\n Klass=new_callable\n elif spec is not None or spec_set is not None :\n this_spec=spec\n if spec_set is not None :\n this_spec=spec_set\n if _is_list(this_spec):\n not_callable='__call__'not in this_spec\n else :\n not_callable=not callable(this_spec)\n if _is_async_obj(this_spec):\n Klass=AsyncMock\n elif not_callable:\n Klass=NonCallableMagicMock\n \n if spec is not None :\n _kwargs['spec']=spec\n if spec_set is not None :\n _kwargs['spec_set']=spec_set\n \n \n if (isinstance(Klass,type)and\n issubclass(Klass,NonCallableMock)and self.attribute):\n _kwargs['name']=self.attribute\n \n _kwargs.update(kwargs)\n new=Klass(**_kwargs)\n \n if inherit and _is_instance_mock(new):\n \n \n this_spec=spec\n if spec_set is not None :\n this_spec=spec_set\n if (not _is_list(this_spec)and not\n _instance_callable(this_spec)):\n Klass=NonCallableMagicMock\n \n _kwargs.pop('name')\n new.return_value=Klass(_new_parent=new,_new_name='()',\n **_kwargs)\n elif autospec is not None :\n \n \n \n if new is not DEFAULT:\n raise TypeError(\n \"autospec creates the mock for you. Can't specify \"\n \"autospec and new.\"\n )\n if original is DEFAULT:\n raise TypeError(\"Can't use 'autospec' with create=True\")\n spec_set=bool(spec_set)\n if autospec is True :\n autospec=original\n \n if _is_instance_mock(self.target):\n raise InvalidSpecError(\n f'Cannot autospec attr {self.attribute!r} as the patch '\n f'target has already been mocked out. '\n f'[target={self.target!r}, attr={autospec!r}]')\n if _is_instance_mock(autospec):\n target_name=getattr(self.target,'__name__',self.target)\n raise InvalidSpecError(\n f'Cannot autospec attr {self.attribute!r} from target '\n f'{target_name!r} as it has already been mocked out. '\n f'[target={self.target!r}, attr={autospec!r}]')\n \n new=create_autospec(autospec,spec_set=spec_set,\n _name=self.attribute,**kwargs)\n elif kwargs:\n \n \n raise TypeError(\"Can't pass kwargs to a mock we aren't creating\")\n \n new_attr=new\n \n self.temp_original=original\n self.is_local=local\n self._exit_stack=contextlib.ExitStack()\n try :\n setattr(self.target,self.attribute,new_attr)\n if self.attribute_name is not None :\n extra_args={}\n if self.new is DEFAULT:\n extra_args[self.attribute_name]=new\n for patching in self.additional_patchers:\n arg=self._exit_stack.enter_context(patching)\n if patching.new is DEFAULT:\n extra_args.update(arg)\n return extra_args\n \n return new\n except :\n if not self.__exit__(*sys.exc_info()):\n raise\n \n def __exit__(self,*exc_info):\n ''\n if self.is_local and self.temp_original is not DEFAULT:\n setattr(self.target,self.attribute,self.temp_original)\n else :\n delattr(self.target,self.attribute)\n if not self.create and (not hasattr(self.target,self.attribute)or\n self.attribute in ('__doc__','__module__',\n '__defaults__','__annotations__',\n '__kwdefaults__')):\n \n setattr(self.target,self.attribute,self.temp_original)\n \n del self.temp_original\n del self.is_local\n del self.target\n exit_stack=self._exit_stack\n del self._exit_stack\n return exit_stack.__exit__(*exc_info)\n \n \n def start(self):\n ''\n result=self.__enter__()\n self._active_patches.append(self)\n return result\n \n \n def stop(self):\n ''\n try :\n self._active_patches.remove(self)\n except ValueError:\n \n return None\n \n return self.__exit__(None ,None ,None )\n \n \n \ndef _get_target(target):\n try :\n target,attribute=target.rsplit('.',1)\n except (TypeError,ValueError,AttributeError):\n raise TypeError(\n f\"Need a valid target to patch. You supplied: {target!r}\")\n return partial(pkgutil.resolve_name,target),attribute\n \n \ndef _patch_object(\ntarget,attribute,new=DEFAULT,spec=None ,\ncreate=False ,spec_set=None ,autospec=None ,\nnew_callable=None ,*,unsafe=False ,**kwargs\n):\n ''\n\n\n\n\n\n\n\n\n\n\n\n \n if type(target)is str:\n raise TypeError(\n f\"{target!r} must be the actual object to be patched, not a str\"\n )\n getter=lambda :target\n return _patch(\n getter,attribute,new,spec,create,\n spec_set,autospec,new_callable,kwargs,unsafe=unsafe\n )\n \n \ndef _patch_multiple(target,spec=None ,create=False ,spec_set=None ,\nautospec=None ,new_callable=None ,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if type(target)is str:\n getter=partial(pkgutil.resolve_name,target)\n else :\n getter=lambda :target\n \n if not kwargs:\n raise ValueError(\n 'Must supply at least one keyword argument with patch.multiple'\n )\n \n items=list(kwargs.items())\n attribute,new=items[0]\n patcher=_patch(\n getter,attribute,new,spec,create,spec_set,\n autospec,new_callable,{}\n )\n patcher.attribute_name=attribute\n for attribute,new in items[1:]:\n this_patcher=_patch(\n getter,attribute,new,spec,create,spec_set,\n autospec,new_callable,{}\n )\n this_patcher.attribute_name=attribute\n patcher.additional_patchers.append(this_patcher)\n return patcher\n \n \ndef patch(\ntarget,new=DEFAULT,spec=None ,create=False ,\nspec_set=None ,autospec=None ,new_callable=None ,*,unsafe=False ,**kwargs\n):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n getter,attribute=_get_target(target)\n return _patch(\n getter,attribute,new,spec,create,\n spec_set,autospec,new_callable,kwargs,unsafe=unsafe\n )\n \n \nclass _patch_dict(object):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n def __init__(self,in_dict,values=(),clear=False ,**kwargs):\n self.in_dict=in_dict\n \n self.values=dict(values)\n self.values.update(kwargs)\n self.clear=clear\n self._original=None\n \n \n def __call__(self,f):\n if isinstance(f,type):\n return self.decorate_class(f)\n @wraps(f)\n def _inner(*args,**kw):\n self._patch_dict()\n try :\n return f(*args,**kw)\n finally :\n self._unpatch_dict()\n \n return _inner\n \n \n def decorate_class(self,klass):\n for attr in dir(klass):\n attr_value=getattr(klass,attr)\n if (attr.startswith(patch.TEST_PREFIX)and\n hasattr(attr_value,\"__call__\")):\n decorator=_patch_dict(self.in_dict,self.values,self.clear)\n decorated=decorator(attr_value)\n setattr(klass,attr,decorated)\n return klass\n \n \n def __enter__(self):\n ''\n self._patch_dict()\n return self.in_dict\n \n \n def _patch_dict(self):\n values=self.values\n if isinstance(self.in_dict,str):\n self.in_dict=pkgutil.resolve_name(self.in_dict)\n in_dict=self.in_dict\n clear=self.clear\n \n try :\n original=in_dict.copy()\n except AttributeError:\n \n \n original={}\n for key in in_dict:\n original[key]=in_dict[key]\n self._original=original\n \n if clear:\n _clear_dict(in_dict)\n \n try :\n in_dict.update(values)\n except AttributeError:\n \n for key in values:\n in_dict[key]=values[key]\n \n \n def _unpatch_dict(self):\n in_dict=self.in_dict\n original=self._original\n \n _clear_dict(in_dict)\n \n try :\n in_dict.update(original)\n except AttributeError:\n for key in original:\n in_dict[key]=original[key]\n \n \n def __exit__(self,*args):\n ''\n if self._original is not None :\n self._unpatch_dict()\n return False\n \n \n def start(self):\n ''\n result=self.__enter__()\n _patch._active_patches.append(self)\n return result\n \n \n def stop(self):\n ''\n try :\n _patch._active_patches.remove(self)\n except ValueError:\n \n return None\n \n return self.__exit__(None ,None ,None )\n \n \ndef _clear_dict(in_dict):\n try :\n in_dict.clear()\n except AttributeError:\n keys=list(in_dict)\n for key in keys:\n del in_dict[key]\n \n \ndef _patch_stopall():\n ''\n for patch in reversed(_patch._active_patches):\n patch.stop()\n \n \npatch.object=_patch_object\npatch.dict=_patch_dict\npatch.multiple=_patch_multiple\npatch.stopall=_patch_stopall\npatch.TEST_PREFIX='test'\n\nmagic_methods=(\n\"lt le gt ge eq ne \"\n\"getitem setitem delitem \"\n\"len contains iter \"\n\"hash str sizeof \"\n\"enter exit \"\n\n\n\"divmod rdivmod neg pos abs invert \"\n\"complex int float index \"\n\"round trunc floor ceil \"\n\"bool next \"\n\"fspath \"\n\"aiter \"\n)\n\nnumerics=(\n\"add sub mul matmul truediv floordiv mod lshift rshift and xor or pow\"\n)\ninplace=' '.join('i%s'%n for n in numerics.split())\nright=' '.join('r%s'%n for n in numerics.split())\n\n\n\n\n\n_non_defaults={\n'__get__','__set__','__delete__','__reversed__','__missing__',\n'__reduce__','__reduce_ex__','__getinitargs__','__getnewargs__',\n'__getstate__','__setstate__','__getformat__',\n'__repr__','__dir__','__subclasses__','__format__',\n'__getnewargs_ex__',\n}\n\n\ndef _get_method(name,func):\n ''\n def method(self,/,*args,**kw):\n return func(self,*args,**kw)\n method.__name__=name\n return method\n \n \n_magics={\n'__%s__'%method for method in\n' '.join([magic_methods,numerics,inplace,right]).split()\n}\n\n\n_async_method_magics={\"__aenter__\",\"__aexit__\",\"__anext__\"}\n\n_sync_async_magics={\"__aiter__\"}\n_async_magics=_async_method_magics |_sync_async_magics\n\n_all_sync_magics=_magics |_non_defaults\n_all_magics=_all_sync_magics |_async_magics\n\n_unsupported_magics={\n'__getattr__','__setattr__',\n'__init__','__new__','__prepare__',\n'__instancecheck__','__subclasscheck__',\n'__del__'\n}\n\n_calculate_return_value={\n'__hash__':lambda self:object.__hash__(self),\n'__str__':lambda self:object.__str__(self),\n'__sizeof__':lambda self:object.__sizeof__(self),\n'__fspath__':lambda self:f\"{type(self).__name__}/{self._extract_mock_name()}/{id(self)}\",\n}\n\n_return_values={\n'__lt__':NotImplemented,\n'__gt__':NotImplemented,\n'__le__':NotImplemented,\n'__ge__':NotImplemented,\n'__int__':1,\n'__contains__':False ,\n'__len__':0,\n'__exit__':False ,\n'__complex__':1j,\n'__float__':1.0,\n'__bool__':True ,\n'__index__':1,\n'__aexit__':False ,\n}\n\n\ndef _get_eq(self):\n def __eq__(other):\n ret_val=self.__eq__._mock_return_value\n if ret_val is not DEFAULT:\n return ret_val\n if self is other:\n return True\n return NotImplemented\n return __eq__\n \ndef _get_ne(self):\n def __ne__(other):\n if self.__ne__._mock_return_value is not DEFAULT:\n return DEFAULT\n if self is other:\n return False\n return NotImplemented\n return __ne__\n \ndef _get_iter(self):\n def __iter__():\n ret_val=self.__iter__._mock_return_value\n if ret_val is DEFAULT:\n return iter([])\n \n \n return iter(ret_val)\n return __iter__\n \ndef _get_async_iter(self):\n def __aiter__():\n ret_val=self.__aiter__._mock_return_value\n if ret_val is DEFAULT:\n return _AsyncIterator(iter([]))\n return _AsyncIterator(iter(ret_val))\n return __aiter__\n \n_side_effect_methods={\n'__eq__':_get_eq,\n'__ne__':_get_ne,\n'__iter__':_get_iter,\n'__aiter__':_get_async_iter\n}\n\n\n\ndef _set_return_value(mock,method,name):\n fixed=_return_values.get(name,DEFAULT)\n if fixed is not DEFAULT:\n method.return_value=fixed\n return\n \n return_calculator=_calculate_return_value.get(name)\n if return_calculator is not None :\n return_value=return_calculator(mock)\n method.return_value=return_value\n return\n \n side_effector=_side_effect_methods.get(name)\n if side_effector is not None :\n method.side_effect=side_effector(mock)\n \n \n \nclass MagicMixin(Base):\n def __init__(self,/,*args,**kw):\n self._mock_set_magics()\n _safe_super(MagicMixin,self).__init__(*args,**kw)\n self._mock_set_magics()\n \n \n def _mock_set_magics(self):\n orig_magics=_magics |_async_method_magics\n these_magics=orig_magics\n \n if getattr(self,\"_mock_methods\",None )is not None :\n these_magics=orig_magics.intersection(self._mock_methods)\n \n remove_magics=set()\n remove_magics=orig_magics -these_magics\n \n for entry in remove_magics:\n if entry in type(self).__dict__:\n \n delattr(self,entry)\n \n \n these_magics=these_magics -set(type(self).__dict__)\n \n _type=type(self)\n for entry in these_magics:\n setattr(_type,entry,MagicProxy(entry,self))\n \n \n \nclass NonCallableMagicMock(MagicMixin,NonCallableMock):\n ''\n def mock_add_spec(self,spec,spec_set=False ):\n ''\n\n\n\n \n self._mock_add_spec(spec,spec_set)\n self._mock_set_magics()\n \n \nclass AsyncMagicMixin(MagicMixin):\n def __init__(self,/,*args,**kw):\n self._mock_set_magics()\n _safe_super(AsyncMagicMixin,self).__init__(*args,**kw)\n self._mock_set_magics()\n \nclass MagicMock(MagicMixin,Mock):\n ''\n\n\n\n\n\n\n\n\n \n def mock_add_spec(self,spec,spec_set=False ):\n ''\n\n\n\n \n self._mock_add_spec(spec,spec_set)\n self._mock_set_magics()\n \n \n \nclass MagicProxy(Base):\n def __init__(self,name,parent):\n self.name=name\n self.parent=parent\n \n def create_mock(self):\n entry=self.name\n parent=self.parent\n m=parent._get_child_mock(name=entry,_new_name=entry,\n _new_parent=parent)\n setattr(parent,entry,m)\n _set_return_value(parent,m,entry)\n return m\n \n def __get__(self,obj,_type=None ):\n return self.create_mock()\n \n \nclass AsyncMockMixin(Base):\n await_count=_delegating_property('await_count')\n await_args=_delegating_property('await_args')\n await_args_list=_delegating_property('await_args_list')\n \n def __init__(self,/,*args,**kwargs):\n super().__init__(*args,**kwargs)\n \n \n \n \n \n \n self.__dict__['_is_coroutine']=asyncio.coroutines._is_coroutine\n self.__dict__['_mock_await_count']=0\n self.__dict__['_mock_await_args']=None\n self.__dict__['_mock_await_args_list']=_CallList()\n code_mock=NonCallableMock(spec_set=CodeType)\n code_mock.co_flags=inspect.CO_COROUTINE\n self.__dict__['__code__']=code_mock\n self.__dict__['__name__']='AsyncMock'\n self.__dict__['__defaults__']=tuple()\n self.__dict__['__kwdefaults__']={}\n self.__dict__['__annotations__']=None\n \n async def _execute_mock_call(self,/,*args,**kwargs):\n \n \n \n _call=_Call((args,kwargs),two=True )\n self.await_count +=1\n self.await_args=_call\n self.await_args_list.append(_call)\n \n effect=self.side_effect\n if effect is not None :\n if _is_exception(effect):\n raise effect\n elif not _callable(effect):\n try :\n result=next(effect)\n except StopIteration:\n \n \n raise StopAsyncIteration\n if _is_exception(result):\n raise result\n elif iscoroutinefunction(effect):\n result=await effect(*args,**kwargs)\n else :\n result=effect(*args,**kwargs)\n \n if result is not DEFAULT:\n return result\n \n if self._mock_return_value is not DEFAULT:\n return self.return_value\n \n if self._mock_wraps is not None :\n if iscoroutinefunction(self._mock_wraps):\n return await self._mock_wraps(*args,**kwargs)\n return self._mock_wraps(*args,**kwargs)\n \n return self.return_value\n \n def assert_awaited(self):\n ''\n\n \n if self.await_count ==0:\n msg=f\"Expected {self._mock_name or 'mock'} to have been awaited.\"\n raise AssertionError(msg)\n \n def assert_awaited_once(self):\n ''\n\n \n if not self.await_count ==1:\n msg=(f\"Expected {self._mock_name or 'mock'} to have been awaited once.\"\n f\" Awaited {self.await_count} times.\")\n raise AssertionError(msg)\n \n def assert_awaited_with(self,/,*args,**kwargs):\n ''\n\n \n if self.await_args is None :\n expected=self._format_mock_call_signature(args,kwargs)\n raise AssertionError(f'Expected await: {expected}\\nNot awaited')\n \n def _error_message():\n msg=self._format_mock_failure_message(args,kwargs,action='await')\n return msg\n \n expected=self._call_matcher(_Call((args,kwargs),two=True ))\n actual=self._call_matcher(self.await_args)\n if actual !=expected:\n cause=expected if isinstance(expected,Exception)else None\n raise AssertionError(_error_message())from cause\n \n def assert_awaited_once_with(self,/,*args,**kwargs):\n ''\n\n\n \n if not self.await_count ==1:\n msg=(f\"Expected {self._mock_name or 'mock'} to have been awaited once.\"\n f\" Awaited {self.await_count} times.\")\n raise AssertionError(msg)\n return self.assert_awaited_with(*args,**kwargs)\n \n def assert_any_await(self,/,*args,**kwargs):\n ''\n\n \n expected=self._call_matcher(_Call((args,kwargs),two=True ))\n cause=expected if isinstance(expected,Exception)else None\n actual=[self._call_matcher(c)for c in self.await_args_list]\n if cause or expected not in _AnyComparer(actual):\n expected_string=self._format_mock_call_signature(args,kwargs)\n raise AssertionError(\n '%s await not found'%expected_string\n )from cause\n \n def assert_has_awaits(self,calls,any_order=False ):\n ''\n\n\n\n\n\n\n\n\n\n \n expected=[self._call_matcher(c)for c in calls]\n cause=next((e for e in expected if isinstance(e,Exception)),None )\n all_awaits=_CallList(self._call_matcher(c)for c in self.await_args_list)\n if not any_order:\n if expected not in all_awaits:\n if cause is None :\n problem='Awaits not found.'\n else :\n problem=('Error processing expected awaits.\\n'\n 'Errors: {}').format(\n [e if isinstance(e,Exception)else None\n for e in expected])\n raise AssertionError(\n f'{problem}\\n'\n f'Expected: {_CallList(calls)}\\n'\n f'Actual: {self.await_args_list}'\n )from cause\n return\n \n all_awaits=list(all_awaits)\n \n not_found=[]\n for kall in expected:\n try :\n all_awaits.remove(kall)\n except ValueError:\n not_found.append(kall)\n if not_found:\n raise AssertionError(\n '%r not all found in await list'%(tuple(not_found),)\n )from cause\n \n def assert_not_awaited(self):\n ''\n\n \n if self.await_count !=0:\n msg=(f\"Expected {self._mock_name or 'mock'} to not have been awaited.\"\n f\" Awaited {self.await_count} times.\")\n raise AssertionError(msg)\n \n def reset_mock(self,/,*args,**kwargs):\n ''\n\n \n super().reset_mock(*args,**kwargs)\n self.await_count=0\n self.await_args=None\n self.await_args_list=_CallList()\n \n \nclass AsyncMock(AsyncMockMixin,AsyncMagicMixin,Mock):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n \nclass _ANY(object):\n ''\n \n def __eq__(self,other):\n return True\n \n def __ne__(self,other):\n return False\n \n def __repr__(self):\n return ''\n \nANY=_ANY()\n\n\n\ndef _format_call_signature(name,args,kwargs):\n message='%s(%%s)'%name\n formatted_args=''\n args_string=', '.join([repr(arg)for arg in args])\n kwargs_string=', '.join([\n '%s=%r'%(key,value)for key,value in kwargs.items()\n ])\n if args_string:\n formatted_args=args_string\n if kwargs_string:\n if formatted_args:\n formatted_args +=', '\n formatted_args +=kwargs_string\n \n return message %formatted_args\n \n \n \nclass _Call(tuple):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n def __new__(cls,value=(),name='',parent=None ,two=False ,\n from_kall=True ):\n args=()\n kwargs={}\n _len=len(value)\n if _len ==3:\n name,args,kwargs=value\n elif _len ==2:\n first,second=value\n if isinstance(first,str):\n name=first\n if isinstance(second,tuple):\n args=second\n else :\n kwargs=second\n else :\n args,kwargs=first,second\n elif _len ==1:\n value,=value\n if isinstance(value,str):\n name=value\n elif isinstance(value,tuple):\n args=value\n else :\n kwargs=value\n \n if two:\n return tuple.__new__(cls,(args,kwargs))\n \n return tuple.__new__(cls,(name,args,kwargs))\n \n \n def __init__(self,value=(),name=None ,parent=None ,two=False ,\n from_kall=True ):\n self._mock_name=name\n self._mock_parent=parent\n self._mock_from_kall=from_kall\n \n \n def __eq__(self,other):\n try :\n len_other=len(other)\n except TypeError:\n return NotImplemented\n \n self_name=''\n if len(self)==2:\n self_args,self_kwargs=self\n else :\n self_name,self_args,self_kwargs=self\n \n if (getattr(self,'_mock_parent',None )and getattr(other,'_mock_parent',None )\n and self._mock_parent !=other._mock_parent):\n return False\n \n other_name=''\n if len_other ==0:\n other_args,other_kwargs=(),{}\n elif len_other ==3:\n other_name,other_args,other_kwargs=other\n elif len_other ==1:\n value,=other\n if isinstance(value,tuple):\n other_args=value\n other_kwargs={}\n elif isinstance(value,str):\n other_name=value\n other_args,other_kwargs=(),{}\n else :\n other_args=()\n other_kwargs=value\n elif len_other ==2:\n \n first,second=other\n if isinstance(first,str):\n other_name=first\n if isinstance(second,tuple):\n other_args,other_kwargs=second,{}\n else :\n other_args,other_kwargs=(),second\n else :\n other_args,other_kwargs=first,second\n else :\n return False\n \n if self_name and other_name !=self_name:\n return False\n \n \n return (other_args,other_kwargs)==(self_args,self_kwargs)\n \n \n __ne__=object.__ne__\n \n \n def __call__(self,/,*args,**kwargs):\n if self._mock_name is None :\n return _Call(('',args,kwargs),name='()')\n \n name=self._mock_name+'()'\n return _Call((self._mock_name,args,kwargs),name=name,parent=self)\n \n \n def __getattr__(self,attr):\n if self._mock_name is None :\n return _Call(name=attr,from_kall=False )\n name='%s.%s'%(self._mock_name,attr)\n return _Call(name=name,parent=self,from_kall=False )\n \n \n def __getattribute__(self,attr):\n if attr in tuple.__dict__:\n raise AttributeError\n return tuple.__getattribute__(self,attr)\n \n \n def _get_call_arguments(self):\n if len(self)==2:\n args,kwargs=self\n else :\n name,args,kwargs=self\n \n return args,kwargs\n \n @property\n def args(self):\n return self._get_call_arguments()[0]\n \n @property\n def kwargs(self):\n return self._get_call_arguments()[1]\n \n def __repr__(self):\n if not self._mock_from_kall:\n name=self._mock_name or 'call'\n if name.startswith('()'):\n name='call%s'%name\n return name\n \n if len(self)==2:\n name='call'\n args,kwargs=self\n else :\n name,args,kwargs=self\n if not name:\n name='call'\n elif not name.startswith('()'):\n name='call.%s'%name\n else :\n name='call%s'%name\n return _format_call_signature(name,args,kwargs)\n \n \n def call_list(self):\n ''\n\n \n vals=[]\n thing=self\n while thing is not None :\n if thing._mock_from_kall:\n vals.append(thing)\n thing=thing._mock_parent\n return _CallList(reversed(vals))\n \n \ncall=_Call(from_kall=False )\n\n\ndef create_autospec(spec,spec_set=False ,instance=False ,_parent=None ,\n_name=None ,*,unsafe=False ,**kwargs):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if _is_list(spec):\n \n \n spec=type(spec)\n \n is_type=isinstance(spec,type)\n if _is_instance_mock(spec):\n raise InvalidSpecError(f'Cannot autospec a Mock object. '\n f'[object={spec!r}]')\n is_async_func=_is_async_func(spec)\n _kwargs={'spec':spec}\n if spec_set:\n _kwargs={'spec_set':spec}\n elif spec is None :\n \n _kwargs={}\n if _kwargs and instance:\n _kwargs['_spec_as_instance']=True\n if not unsafe:\n _check_spec_arg_typos(kwargs)\n \n _kwargs.update(kwargs)\n \n Klass=MagicMock\n if inspect.isdatadescriptor(spec):\n \n \n _kwargs={}\n elif is_async_func:\n if instance:\n raise RuntimeError(\"Instance can not be True when create_autospec \"\n \"is mocking an async function\")\n Klass=AsyncMock\n elif not _callable(spec):\n Klass=NonCallableMagicMock\n elif is_type and instance and not _instance_callable(spec):\n Klass=NonCallableMagicMock\n \n _name=_kwargs.pop('name',_name)\n \n _new_name=_name\n if _parent is None :\n \n _new_name=''\n \n mock=Klass(parent=_parent,_new_parent=_parent,_new_name=_new_name,\n name=_name,**_kwargs)\n \n if isinstance(spec,FunctionTypes):\n \n \n mock=_set_signature(mock,spec)\n if is_async_func:\n _setup_async_mock(mock)\n else :\n _check_signature(spec,mock,is_type,instance)\n \n if _parent is not None and not instance:\n _parent._mock_children[_name]=mock\n \n if is_type and not instance and 'return_value'not in kwargs:\n mock.return_value=create_autospec(spec,spec_set,instance=True ,\n _name='()',_parent=mock)\n \n for entry in dir(spec):\n if _is_magic(entry):\n \n continue\n \n \n \n \n \n \n \n \n \n \n try :\n original=getattr(spec,entry)\n except AttributeError:\n continue\n \n kwargs={'spec':original}\n if spec_set:\n kwargs={'spec_set':original}\n \n if not isinstance(original,FunctionTypes):\n new=_SpecState(original,spec_set,mock,entry,instance)\n mock._mock_children[entry]=new\n else :\n parent=mock\n if isinstance(spec,FunctionTypes):\n parent=mock.mock\n \n skipfirst=_must_skip(spec,entry,is_type)\n kwargs['_eat_self']=skipfirst\n if iscoroutinefunction(original):\n child_klass=AsyncMock\n else :\n child_klass=MagicMock\n new=child_klass(parent=parent,name=entry,_new_name=entry,\n _new_parent=parent,\n **kwargs)\n mock._mock_children[entry]=new\n _check_signature(original,new,skipfirst=skipfirst)\n \n \n \n \n \n if isinstance(new,FunctionTypes):\n setattr(mock,entry,new)\n \n return mock\n \n \ndef _must_skip(spec,entry,is_type):\n ''\n\n\n \n if not isinstance(spec,type):\n if entry in getattr(spec,'__dict__',{}):\n \n return False\n spec=spec.__class__\n \n for klass in spec.__mro__:\n result=klass.__dict__.get(entry,DEFAULT)\n if result is DEFAULT:\n continue\n if isinstance(result,(staticmethod,classmethod)):\n return False\n elif isinstance(result,FunctionTypes):\n \n \n return is_type\n else :\n return False\n \n \n return is_type\n \n \nclass _SpecState(object):\n\n def __init__(self,spec,spec_set=False ,parent=None ,\n name=None ,ids=None ,instance=False ):\n self.spec=spec\n self.ids=ids\n self.spec_set=spec_set\n self.parent=parent\n self.instance=instance\n self.name=name\n \n \nFunctionTypes=(\n\ntype(create_autospec),\n\ntype(ANY.__eq__),\n)\n\n\nfile_spec=None\nopen_spec=None\n\n\ndef _to_stream(read_data):\n if isinstance(read_data,bytes):\n return io.BytesIO(read_data)\n else :\n return io.StringIO(read_data)\n \n \ndef mock_open(mock=None ,read_data=''):\n ''\n\n\n\n\n\n\n\n\n\n \n _read_data=_to_stream(read_data)\n _state=[_read_data,None ]\n \n def _readlines_side_effect(*args,**kwargs):\n if handle.readlines.return_value is not None :\n return handle.readlines.return_value\n return _state[0].readlines(*args,**kwargs)\n \n def _read_side_effect(*args,**kwargs):\n if handle.read.return_value is not None :\n return handle.read.return_value\n return _state[0].read(*args,**kwargs)\n \n def _readline_side_effect(*args,**kwargs):\n yield from _iter_side_effect()\n while True :\n yield _state[0].readline(*args,**kwargs)\n \n def _iter_side_effect():\n if handle.readline.return_value is not None :\n while True :\n yield handle.readline.return_value\n for line in _state[0]:\n yield line\n \n def _next_side_effect():\n if handle.readline.return_value is not None :\n return handle.readline.return_value\n return next(_state[0])\n \n global file_spec\n if file_spec is None :\n import _io\n file_spec=list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))))\n \n global open_spec\n if open_spec is None :\n import _io\n open_spec=list(set(dir(_io.open)))\n if mock is None :\n mock=MagicMock(name='open',spec=open_spec)\n \n handle=MagicMock(spec=file_spec)\n handle.__enter__.return_value=handle\n \n handle.write.return_value=None\n handle.read.return_value=None\n handle.readline.return_value=None\n handle.readlines.return_value=None\n \n handle.read.side_effect=_read_side_effect\n _state[1]=_readline_side_effect()\n handle.readline.side_effect=_state[1]\n handle.readlines.side_effect=_readlines_side_effect\n handle.__iter__.side_effect=_iter_side_effect\n handle.__next__.side_effect=_next_side_effect\n \n def reset_data(*args,**kwargs):\n _state[0]=_to_stream(read_data)\n if handle.readline.side_effect ==_state[1]:\n \n _state[1]=_readline_side_effect()\n handle.readline.side_effect=_state[1]\n return DEFAULT\n \n mock.side_effect=reset_data\n mock.return_value=handle\n return mock\n \n \nclass PropertyMock(Mock):\n ''\n\n\n\n\n\n\n \n def _get_child_mock(self,/,**kwargs):\n return MagicMock(**kwargs)\n \n def __get__(self,obj,obj_type=None ):\n return self()\n def __set__(self,obj,val):\n self(val)\n \n \ndef seal(mock):\n ''\n\n\n\n\n\n\n\n \n mock._mock_sealed=True\n for attr in dir(mock):\n try :\n m=getattr(mock,attr)\n except AttributeError:\n continue\n if not isinstance(m,NonCallableMock):\n continue\n if isinstance(m._mock_children.get(attr),_SpecState):\n continue\n if m._mock_new_parent is mock:\n seal(m)\n \n \nclass _AsyncIterator:\n ''\n\n \n def __init__(self,iterator):\n self.iterator=iterator\n code_mock=NonCallableMock(spec_set=CodeType)\n code_mock.co_flags=inspect.CO_ITERABLE_COROUTINE\n self.__dict__['__code__']=code_mock\n \n async def __anext__(self):\n try :\n return next(self.iterator)\n except StopIteration:\n pass\n raise StopAsyncIteration\n", ["_io", "asyncio", "builtins", "contextlib", "functools", "inspect", "io", "pkgutil", "pprint", "sys", "types", "unittest.util"]], "unittest.result": [".py", "''\n\nimport io\nimport sys\nimport traceback\n\nfrom . import util\nfrom functools import wraps\n\n__unittest=True\n\ndef failfast(method):\n @wraps(method)\n def inner(self,*args,**kw):\n if getattr(self,'failfast',False ):\n self.stop()\n return method(self,*args,**kw)\n return inner\n \nSTDOUT_LINE='\\nStdout:\\n%s'\nSTDERR_LINE='\\nStderr:\\n%s'\n\n\nclass TestResult(object):\n ''\n\n\n\n\n\n\n\n\n \n _previousTestClass=None\n _testRunEntered=False\n _moduleSetUpFailed=False\n def __init__(self,stream=None ,descriptions=None ,verbosity=None ):\n self.failfast=False\n self.failures=[]\n self.errors=[]\n self.testsRun=0\n self.skipped=[]\n self.expectedFailures=[]\n self.unexpectedSuccesses=[]\n self.shouldStop=False\n self.buffer=False\n self.tb_locals=False\n self._stdout_buffer=None\n self._stderr_buffer=None\n self._original_stdout=sys.stdout\n self._original_stderr=sys.stderr\n self._mirrorOutput=False\n \n def printErrors(self):\n ''\n \n def startTest(self,test):\n ''\n self.testsRun +=1\n self._mirrorOutput=False\n self._setupStdout()\n \n def _setupStdout(self):\n if self.buffer:\n if self._stderr_buffer is None :\n self._stderr_buffer=io.StringIO()\n self._stdout_buffer=io.StringIO()\n sys.stdout=self._stdout_buffer\n sys.stderr=self._stderr_buffer\n \n def startTestRun(self):\n ''\n\n\n \n \n def stopTest(self,test):\n ''\n self._restoreStdout()\n self._mirrorOutput=False\n \n def _restoreStdout(self):\n if self.buffer:\n if self._mirrorOutput:\n output=sys.stdout.getvalue()\n error=sys.stderr.getvalue()\n if output:\n if not output.endswith('\\n'):\n output +='\\n'\n self._original_stdout.write(STDOUT_LINE %output)\n if error:\n if not error.endswith('\\n'):\n error +='\\n'\n self._original_stderr.write(STDERR_LINE %error)\n \n sys.stdout=self._original_stdout\n sys.stderr=self._original_stderr\n self._stdout_buffer.seek(0)\n self._stdout_buffer.truncate()\n self._stderr_buffer.seek(0)\n self._stderr_buffer.truncate()\n \n def stopTestRun(self):\n ''\n\n\n \n \n @failfast\n def addError(self,test,err):\n ''\n\n \n self.errors.append((test,self._exc_info_to_string(err,test)))\n self._mirrorOutput=True\n \n @failfast\n def addFailure(self,test,err):\n ''\n \n self.failures.append((test,self._exc_info_to_string(err,test)))\n self._mirrorOutput=True\n \n def addSubTest(self,test,subtest,err):\n ''\n\n\n \n \n \n if err is not None :\n if getattr(self,'failfast',False ):\n self.stop()\n if issubclass(err[0],test.failureException):\n errors=self.failures\n else :\n errors=self.errors\n errors.append((subtest,self._exc_info_to_string(err,test)))\n self._mirrorOutput=True\n \n def addSuccess(self,test):\n ''\n pass\n \n def addSkip(self,test,reason):\n ''\n self.skipped.append((test,reason))\n \n def addExpectedFailure(self,test,err):\n ''\n self.expectedFailures.append(\n (test,self._exc_info_to_string(err,test)))\n \n @failfast\n def addUnexpectedSuccess(self,test):\n ''\n self.unexpectedSuccesses.append(test)\n \n def wasSuccessful(self):\n ''\n \n \n \n return ((len(self.failures)==len(self.errors)==0)and\n (not hasattr(self,'unexpectedSuccesses')or\n len(self.unexpectedSuccesses)==0))\n \n def stop(self):\n ''\n self.shouldStop=True\n \n def _exc_info_to_string(self,err,test):\n ''\n exctype,value,tb=err\n tb=self._clean_tracebacks(exctype,value,tb,test)\n tb_e=traceback.TracebackException(\n exctype,value,tb,\n capture_locals=self.tb_locals,compact=True )\n msgLines=list(tb_e.format())\n \n if self.buffer:\n output=sys.stdout.getvalue()\n error=sys.stderr.getvalue()\n if output:\n if not output.endswith('\\n'):\n output +='\\n'\n msgLines.append(STDOUT_LINE %output)\n if error:\n if not error.endswith('\\n'):\n error +='\\n'\n msgLines.append(STDERR_LINE %error)\n return ''.join(msgLines)\n \n def _clean_tracebacks(self,exctype,value,tb,test):\n ret=None\n first=True\n excs=[(exctype,value,tb)]\n while excs:\n (exctype,value,tb)=excs.pop()\n \n while tb and self._is_relevant_tb_level(tb):\n tb=tb.tb_next\n \n \n if exctype is test.failureException:\n self._remove_unittest_tb_frames(tb)\n \n if first:\n ret=tb\n first=False\n else :\n value.__traceback__=tb\n \n if value is not None :\n for c in (value.__cause__,value.__context__):\n if c is not None :\n excs.append((type(c),c,c.__traceback__))\n return ret\n \n def _is_relevant_tb_level(self,tb):\n return '__unittest'in tb.tb_frame.f_globals\n \n def _remove_unittest_tb_frames(self,tb):\n ''\n\n\n\n\n\n \n prev=None\n while tb and not self._is_relevant_tb_level(tb):\n prev=tb\n tb=tb.tb_next\n if prev is not None :\n prev.tb_next=None\n \n def __repr__(self):\n return (\"<%s run=%i errors=%i failures=%i>\"%\n (util.strclass(self.__class__),self.testsRun,len(self.errors),\n len(self.failures)))\n", ["functools", "io", "sys", "traceback", "unittest", "unittest.util"]], "unittest.runner": [".py", "''\n\nimport sys\nimport time\nimport warnings\n\nfrom. import result\nfrom.case import _SubTest\nfrom.signals import registerResult\n\n__unittest=True\n\n\nclass _WritelnDecorator(object):\n ''\n def __init__(self,stream):\n self.stream=stream\n \n def __getattr__(self,attr):\n if attr in('stream','__getstate__'):\n raise AttributeError(attr)\n return getattr(self.stream,attr)\n \n def writeln(self,arg=None):\n if arg:\n self.write(arg)\n self.write('\\n')\n \n \nclass TextTestResult(result.TestResult):\n ''\n\n\n \n separator1='='*70\n separator2='-'*70\n \n def __init__(self,stream,descriptions,verbosity,*,durations=None):\n ''\n \n super(TextTestResult,self).__init__(stream,descriptions,verbosity)\n self.stream=stream\n self.showAll=verbosity >1\n self.dots=verbosity ==1\n self.descriptions=descriptions\n self._newline=True\n self.durations=durations\n \n def getDescription(self,test):\n doc_first_line=test.shortDescription()\n if self.descriptions and doc_first_line:\n return '\\n'.join((str(test),doc_first_line))\n else:\n return str(test)\n \n def startTest(self,test):\n super(TextTestResult,self).startTest(test)\n if self.showAll:\n self.stream.write(self.getDescription(test))\n self.stream.write(\" ... \")\n self.stream.flush()\n self._newline=False\n \n def _write_status(self,test,status):\n is_subtest=isinstance(test,_SubTest)\n if is_subtest or self._newline:\n if not self._newline:\n self.stream.writeln()\n if is_subtest:\n self.stream.write(\" \")\n self.stream.write(self.getDescription(test))\n self.stream.write(\" ... \")\n self.stream.writeln(status)\n self.stream.flush()\n self._newline=True\n \n def addSubTest(self,test,subtest,err):\n if err is not None:\n if self.showAll:\n if issubclass(err[0],subtest.failureException):\n self._write_status(subtest,\"FAIL\")\n else:\n self._write_status(subtest,\"ERROR\")\n elif self.dots:\n if issubclass(err[0],subtest.failureException):\n self.stream.write('F')\n else:\n self.stream.write('E')\n self.stream.flush()\n super(TextTestResult,self).addSubTest(test,subtest,err)\n \n def addSuccess(self,test):\n super(TextTestResult,self).addSuccess(test)\n if self.showAll:\n self._write_status(test,\"ok\")\n elif self.dots:\n self.stream.write('.')\n self.stream.flush()\n \n def addError(self,test,err):\n super(TextTestResult,self).addError(test,err)\n if self.showAll:\n self._write_status(test,\"ERROR\")\n elif self.dots:\n self.stream.write('E')\n self.stream.flush()\n \n def addFailure(self,test,err):\n super(TextTestResult,self).addFailure(test,err)\n if self.showAll:\n self._write_status(test,\"FAIL\")\n elif self.dots:\n self.stream.write('F')\n self.stream.flush()\n \n def addSkip(self,test,reason):\n super(TextTestResult,self).addSkip(test,reason)\n if self.showAll:\n self._write_status(test,\"skipped {0!r}\".format(reason))\n elif self.dots:\n self.stream.write(\"s\")\n self.stream.flush()\n \n def addExpectedFailure(self,test,err):\n super(TextTestResult,self).addExpectedFailure(test,err)\n if self.showAll:\n self.stream.writeln(\"expected failure\")\n self.stream.flush()\n elif self.dots:\n self.stream.write(\"x\")\n self.stream.flush()\n \n def addUnexpectedSuccess(self,test):\n super(TextTestResult,self).addUnexpectedSuccess(test)\n if self.showAll:\n self.stream.writeln(\"unexpected success\")\n self.stream.flush()\n elif self.dots:\n self.stream.write(\"u\")\n self.stream.flush()\n \n def printErrors(self):\n if self.dots or self.showAll:\n self.stream.writeln()\n self.stream.flush()\n self.printErrorList('ERROR',self.errors)\n self.printErrorList('FAIL',self.failures)\n unexpectedSuccesses=getattr(self,'unexpectedSuccesses',())\n if unexpectedSuccesses:\n self.stream.writeln(self.separator1)\n for test in unexpectedSuccesses:\n self.stream.writeln(f\"UNEXPECTED SUCCESS: {self.getDescription(test)}\")\n self.stream.flush()\n \n def printErrorList(self,flavour,errors):\n for test,err in errors:\n self.stream.writeln(self.separator1)\n self.stream.writeln(\"%s: %s\"%(flavour,self.getDescription(test)))\n self.stream.writeln(self.separator2)\n self.stream.writeln(\"%s\"%err)\n self.stream.flush()\n \n \nclass TextTestRunner(object):\n ''\n\n\n\n \n resultclass=TextTestResult\n \n def __init__(self,stream=None,descriptions=True,verbosity=1,\n failfast=False,buffer=False,resultclass=None,warnings=None,\n *,tb_locals=False,durations=None):\n ''\n\n\n\n \n if stream is None:\n stream=sys.stderr\n self.stream=_WritelnDecorator(stream)\n self.descriptions=descriptions\n self.verbosity=verbosity\n self.failfast=failfast\n self.buffer=buffer\n self.tb_locals=tb_locals\n self.durations=durations\n self.warnings=warnings\n if resultclass is not None:\n self.resultclass=resultclass\n \n def _makeResult(self):\n try:\n return self.resultclass(self.stream,self.descriptions,\n self.verbosity,durations=self.durations)\n except TypeError:\n \n return self.resultclass(self.stream,self.descriptions,\n self.verbosity)\n \n def _printDurations(self,result):\n if not result.collectedDurations:\n return\n ls=sorted(result.collectedDurations,key=lambda x:x[1],\n reverse=True)\n if self.durations >0:\n ls=ls[:self.durations]\n self.stream.writeln(\"Slowest test durations\")\n if hasattr(result,'separator2'):\n self.stream.writeln(result.separator2)\n hidden=False\n for test,elapsed in ls:\n if self.verbosity <2 and elapsed <0.001:\n hidden=True\n continue\n self.stream.writeln(\"%-10s %s\"%(\"%.3fs\"%elapsed,test))\n if hidden:\n self.stream.writeln(\"\\n(durations < 0.001s were hidden; \"\n \"use -v to show these durations)\")\n else:\n self.stream.writeln(\"\")\n \n def run(self,test):\n ''\n result=self._makeResult()\n registerResult(result)\n result.failfast=self.failfast\n result.buffer=self.buffer\n result.tb_locals=self.tb_locals\n with warnings.catch_warnings():\n if self.warnings:\n \n warnings.simplefilter(self.warnings)\n startTime=time.perf_counter()\n startTestRun=getattr(result,'startTestRun',None)\n if startTestRun is not None:\n startTestRun()\n try:\n test(result)\n finally:\n stopTestRun=getattr(result,'stopTestRun',None)\n if stopTestRun is not None:\n stopTestRun()\n stopTime=time.perf_counter()\n timeTaken=stopTime -startTime\n result.printErrors()\n if self.durations is not None:\n self._printDurations(result)\n \n if hasattr(result,'separator2'):\n self.stream.writeln(result.separator2)\n \n run=result.testsRun\n self.stream.writeln(\"Ran %d test%s in %.3fs\"%\n (run,run !=1 and \"s\"or \"\",timeTaken))\n self.stream.writeln()\n \n expectedFails=unexpectedSuccesses=skipped=0\n try:\n results=map(len,(result.expectedFailures,\n result.unexpectedSuccesses,\n result.skipped))\n except AttributeError:\n pass\n else:\n expectedFails,unexpectedSuccesses,skipped=results\n \n infos=[]\n if not result.wasSuccessful():\n self.stream.write(\"FAILED\")\n failed,errored=len(result.failures),len(result.errors)\n if failed:\n infos.append(\"failures=%d\"%failed)\n if errored:\n infos.append(\"errors=%d\"%errored)\n elif run ==0:\n self.stream.write(\"NO TESTS RAN\")\n else:\n self.stream.write(\"OK\")\n if skipped:\n infos.append(\"skipped=%d\"%skipped)\n if expectedFails:\n infos.append(\"expected failures=%d\"%expectedFails)\n if unexpectedSuccesses:\n infos.append(\"unexpected successes=%d\"%unexpectedSuccesses)\n if infos:\n self.stream.writeln(\" (%s)\"%(\", \".join(infos),))\n else:\n self.stream.write(\"\\n\")\n self.stream.flush()\n return result\n", ["sys", "time", "unittest", "unittest.case", "unittest.result", "unittest.signals", "warnings"]], "unittest.signals": [".py", "import signal\nimport weakref\n\nfrom functools import wraps\n\n__unittest=True\n\n\nclass _InterruptHandler(object):\n def __init__(self,default_handler):\n self.called=False\n self.original_handler=default_handler\n if isinstance(default_handler,int):\n if default_handler ==signal.SIG_DFL:\n \n default_handler=signal.default_int_handler\n elif default_handler ==signal.SIG_IGN:\n \n \n def default_handler(unused_signum,unused_frame):\n pass\n else :\n raise TypeError(\"expected SIGINT signal handler to be \"\n \"signal.SIG_IGN, signal.SIG_DFL, or a \"\n \"callable object\")\n self.default_handler=default_handler\n \n def __call__(self,signum,frame):\n installed_handler=signal.getsignal(signal.SIGINT)\n if installed_handler is not self:\n \n \n self.default_handler(signum,frame)\n \n if self.called:\n self.default_handler(signum,frame)\n self.called=True\n for result in _results.keys():\n result.stop()\n \n_results=weakref.WeakKeyDictionary()\ndef registerResult(result):\n _results[result]=1\n \ndef removeResult(result):\n return bool(_results.pop(result,None ))\n \n_interrupt_handler=None\ndef installHandler():\n global _interrupt_handler\n if _interrupt_handler is None :\n default_handler=signal.getsignal(signal.SIGINT)\n _interrupt_handler=_InterruptHandler(default_handler)\n signal.signal(signal.SIGINT,_interrupt_handler)\n \n \ndef removeHandler(method=None ):\n if method is not None :\n @wraps(method)\n def inner(*args,**kwargs):\n initial=signal.getsignal(signal.SIGINT)\n removeHandler()\n try :\n return method(*args,**kwargs)\n finally :\n signal.signal(signal.SIGINT,initial)\n return inner\n \n global _interrupt_handler\n if _interrupt_handler is not None :\n signal.signal(signal.SIGINT,_interrupt_handler.original_handler)\n", ["functools", "signal", "weakref"]], "unittest.suite": [".py", "''\n\nimport sys\n\nfrom . import case\nfrom . import util\n\n__unittest=True\n\n\ndef _call_if_exists(parent,attr):\n func=getattr(parent,attr,lambda :None )\n func()\n \n \nclass BaseTestSuite(object):\n ''\n \n _cleanup=True\n \n def __init__(self,tests=()):\n self._tests=[]\n self._removed_tests=0\n self.addTests(tests)\n \n def __repr__(self):\n return \"<%s tests=%s>\"%(util.strclass(self.__class__),list(self))\n \n def __eq__(self,other):\n if not isinstance(other,self.__class__):\n return NotImplemented\n return list(self)==list(other)\n \n def __iter__(self):\n return iter(self._tests)\n \n def countTestCases(self):\n cases=self._removed_tests\n for test in self:\n if test:\n cases +=test.countTestCases()\n return cases\n \n def addTest(self,test):\n \n if not callable(test):\n raise TypeError(\"{} is not callable\".format(repr(test)))\n if isinstance(test,type)and issubclass(test,\n (case.TestCase,TestSuite)):\n raise TypeError(\"TestCases and TestSuites must be instantiated \"\n \"before passing them to addTest()\")\n self._tests.append(test)\n \n def addTests(self,tests):\n if isinstance(tests,str):\n raise TypeError(\"tests must be an iterable of tests, not a string\")\n for test in tests:\n self.addTest(test)\n \n def run(self,result):\n for index,test in enumerate(self):\n if result.shouldStop:\n break\n test(result)\n if self._cleanup:\n self._removeTestAtIndex(index)\n return result\n \n def _removeTestAtIndex(self,index):\n ''\n try :\n test=self._tests[index]\n except TypeError:\n \n pass\n else :\n \n \n if hasattr(test,'countTestCases'):\n self._removed_tests +=test.countTestCases()\n self._tests[index]=None\n \n def __call__(self,*args,**kwds):\n return self.run(*args,**kwds)\n \n def debug(self):\n ''\n for test in self:\n test.debug()\n \n \nclass TestSuite(BaseTestSuite):\n ''\n\n\n\n\n\n\n \n \n def run(self,result,debug=False ):\n topLevel=False\n if getattr(result,'_testRunEntered',False )is False :\n result._testRunEntered=topLevel=True\n \n for index,test in enumerate(self):\n if result.shouldStop:\n break\n \n if _isnotsuite(test):\n self._tearDownPreviousClass(test,result)\n self._handleModuleFixture(test,result)\n self._handleClassSetUp(test,result)\n result._previousTestClass=test.__class__\n \n if (getattr(test.__class__,'_classSetupFailed',False )or\n getattr(result,'_moduleSetUpFailed',False )):\n continue\n \n if not debug:\n test(result)\n else :\n test.debug()\n \n if self._cleanup:\n self._removeTestAtIndex(index)\n \n if topLevel:\n self._tearDownPreviousClass(None ,result)\n self._handleModuleTearDown(result)\n result._testRunEntered=False\n return result\n \n def debug(self):\n ''\n debug=_DebugResult()\n self.run(debug,True )\n \n \n \n def _handleClassSetUp(self,test,result):\n previousClass=getattr(result,'_previousTestClass',None )\n currentClass=test.__class__\n if currentClass ==previousClass:\n return\n if result._moduleSetUpFailed:\n return\n if getattr(currentClass,\"__unittest_skip__\",False ):\n return\n \n failed=False\n try :\n currentClass._classSetupFailed=False\n except TypeError:\n \n \n pass\n \n setUpClass=getattr(currentClass,'setUpClass',None )\n doClassCleanups=getattr(currentClass,'doClassCleanups',None )\n if setUpClass is not None :\n _call_if_exists(result,'_setupStdout')\n try :\n try :\n setUpClass()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n failed=True\n try :\n currentClass._classSetupFailed=True\n except TypeError:\n pass\n className=util.strclass(currentClass)\n self._createClassOrModuleLevelException(result,e,\n 'setUpClass',\n className)\n if failed and doClassCleanups is not None :\n doClassCleanups()\n for exc_info in currentClass.tearDown_exceptions:\n self._createClassOrModuleLevelException(\n result,exc_info[1],'setUpClass',className,\n info=exc_info)\n finally :\n _call_if_exists(result,'_restoreStdout')\n \n def _get_previous_module(self,result):\n previousModule=None\n previousClass=getattr(result,'_previousTestClass',None )\n if previousClass is not None :\n previousModule=previousClass.__module__\n return previousModule\n \n \n def _handleModuleFixture(self,test,result):\n previousModule=self._get_previous_module(result)\n currentModule=test.__class__.__module__\n if currentModule ==previousModule:\n return\n \n self._handleModuleTearDown(result)\n \n \n result._moduleSetUpFailed=False\n try :\n module=sys.modules[currentModule]\n except KeyError:\n return\n setUpModule=getattr(module,'setUpModule',None )\n if setUpModule is not None :\n _call_if_exists(result,'_setupStdout')\n try :\n try :\n setUpModule()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n result._moduleSetUpFailed=True\n self._createClassOrModuleLevelException(result,e,\n 'setUpModule',\n currentModule)\n if result._moduleSetUpFailed:\n try :\n case.doModuleCleanups()\n except Exception as e:\n self._createClassOrModuleLevelException(result,e,\n 'setUpModule',\n currentModule)\n finally :\n _call_if_exists(result,'_restoreStdout')\n \n def _createClassOrModuleLevelException(self,result,exc,method_name,\n parent,info=None ):\n errorName=f'{method_name} ({parent})'\n self._addClassOrModuleLevelException(result,exc,errorName,info)\n \n def _addClassOrModuleLevelException(self,result,exception,errorName,\n info=None ):\n error=_ErrorHolder(errorName)\n addSkip=getattr(result,'addSkip',None )\n if addSkip is not None and isinstance(exception,case.SkipTest):\n addSkip(error,str(exception))\n else :\n if not info:\n result.addError(error,sys.exc_info())\n else :\n result.addError(error,info)\n \n def _handleModuleTearDown(self,result):\n previousModule=self._get_previous_module(result)\n if previousModule is None :\n return\n if result._moduleSetUpFailed:\n return\n \n try :\n module=sys.modules[previousModule]\n except KeyError:\n return\n \n _call_if_exists(result,'_setupStdout')\n try :\n tearDownModule=getattr(module,'tearDownModule',None )\n if tearDownModule is not None :\n try :\n tearDownModule()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n self._createClassOrModuleLevelException(result,e,\n 'tearDownModule',\n previousModule)\n try :\n case.doModuleCleanups()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n self._createClassOrModuleLevelException(result,e,\n 'tearDownModule',\n previousModule)\n finally :\n _call_if_exists(result,'_restoreStdout')\n \n def _tearDownPreviousClass(self,test,result):\n previousClass=getattr(result,'_previousTestClass',None )\n currentClass=test.__class__\n if currentClass ==previousClass or previousClass is None :\n return\n if getattr(previousClass,'_classSetupFailed',False ):\n return\n if getattr(result,'_moduleSetUpFailed',False ):\n return\n if getattr(previousClass,\"__unittest_skip__\",False ):\n return\n \n tearDownClass=getattr(previousClass,'tearDownClass',None )\n doClassCleanups=getattr(previousClass,'doClassCleanups',None )\n if tearDownClass is None and doClassCleanups is None :\n return\n \n _call_if_exists(result,'_setupStdout')\n try :\n if tearDownClass is not None :\n try :\n tearDownClass()\n except Exception as e:\n if isinstance(result,_DebugResult):\n raise\n className=util.strclass(previousClass)\n self._createClassOrModuleLevelException(result,e,\n 'tearDownClass',\n className)\n if doClassCleanups is not None :\n doClassCleanups()\n for exc_info in previousClass.tearDown_exceptions:\n if isinstance(result,_DebugResult):\n raise exc_info[1]\n className=util.strclass(previousClass)\n self._createClassOrModuleLevelException(result,exc_info[1],\n 'tearDownClass',\n className,\n info=exc_info)\n finally :\n _call_if_exists(result,'_restoreStdout')\n \n \nclass _ErrorHolder(object):\n ''\n\n\n\n \n \n \n \n \n failureException=None\n \n def __init__(self,description):\n self.description=description\n \n def id(self):\n return self.description\n \n def shortDescription(self):\n return None\n \n def __repr__(self):\n return \"\"%(self.description,)\n \n def __str__(self):\n return self.id()\n \n def run(self,result):\n \n \n pass\n \n def __call__(self,result):\n return self.run(result)\n \n def countTestCases(self):\n return 0\n \ndef _isnotsuite(test):\n ''\n try :\n iter(test)\n except TypeError:\n return True\n return False\n \n \nclass _DebugResult(object):\n ''\n _previousTestClass=None\n _moduleSetUpFailed=False\n shouldStop=False\n", ["sys", "unittest", "unittest.case", "unittest.util"]], "unittest.util": [".py", "''\n\nfrom collections import namedtuple,Counter\nfrom os.path import commonprefix\n\n__unittest=True\n\n_MAX_LENGTH=80\n_PLACEHOLDER_LEN=12\n_MIN_BEGIN_LEN=5\n_MIN_END_LEN=5\n_MIN_COMMON_LEN=5\n_MIN_DIFF_LEN=_MAX_LENGTH -\\\n(_MIN_BEGIN_LEN+_PLACEHOLDER_LEN+_MIN_COMMON_LEN+\n_PLACEHOLDER_LEN+_MIN_END_LEN)\nassert _MIN_DIFF_LEN >=0\n\ndef _shorten(s,prefixlen,suffixlen):\n skip=len(s)-prefixlen -suffixlen\n if skip >_PLACEHOLDER_LEN:\n s='%s[%d chars]%s'%(s[:prefixlen],skip,s[len(s)-suffixlen:])\n return s\n \ndef _common_shorten_repr(*args):\n args=tuple(map(safe_repr,args))\n maxlen=max(map(len,args))\n if maxlen <=_MAX_LENGTH:\n return args\n \n prefix=commonprefix(args)\n prefixlen=len(prefix)\n \n common_len=_MAX_LENGTH -\\\n (maxlen -prefixlen+_MIN_BEGIN_LEN+_PLACEHOLDER_LEN)\n if common_len >_MIN_COMMON_LEN:\n assert _MIN_BEGIN_LEN+_PLACEHOLDER_LEN+_MIN_COMMON_LEN+\\\n (maxlen -prefixlen)<_MAX_LENGTH\n prefix=_shorten(prefix,_MIN_BEGIN_LEN,common_len)\n return tuple(prefix+s[prefixlen:]for s in args)\n \n prefix=_shorten(prefix,_MIN_BEGIN_LEN,_MIN_COMMON_LEN)\n return tuple(prefix+_shorten(s[prefixlen:],_MIN_DIFF_LEN,_MIN_END_LEN)\n for s in args)\n \ndef safe_repr(obj,short=False ):\n try :\n result=repr(obj)\n except Exception:\n result=object.__repr__(obj)\n if not short or len(result)<_MAX_LENGTH:\n return result\n return result[:_MAX_LENGTH]+' [truncated]...'\n \ndef strclass(cls):\n return \"%s.%s\"%(cls.__module__,cls.__qualname__)\n \ndef sorted_list_difference(expected,actual):\n ''\n\n\n\n\n\n \n i=j=0\n missing=[]\n unexpected=[]\n while True :\n try :\n e=expected[i]\n a=actual[j]\n if e a:\n unexpected.append(a)\n j +=1\n while actual[j]==a:\n j +=1\n else :\n i +=1\n try :\n while expected[i]==e:\n i +=1\n finally :\n j +=1\n while actual[j]==a:\n j +=1\n except IndexError:\n missing.extend(expected[i:])\n unexpected.extend(actual[j:])\n break\n return missing,unexpected\n \n \ndef unorderable_list_difference(expected,actual):\n ''\n\n\n\n \n missing=[]\n while expected:\n item=expected.pop()\n try :\n actual.remove(item)\n except ValueError:\n missing.append(item)\n \n \n return missing,actual\n \ndef three_way_cmp(x,y):\n ''\n return (x >y)-(x 0:\n self._raiseFailure(\n \"Unexpected logs found: {!r}\".format(\n self.watcher.output\n )\n )\n \n else :\n \n if len(self.watcher.records)==0:\n self._raiseFailure(\n \"no logs of level {} or higher triggered on {}\"\n .format(logging.getLevelName(self.level),self.logger.name))\n", ["collections", "logging", "unittest.case"]], "unittest": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n__all__=['TestResult','TestCase','IsolatedAsyncioTestCase','TestSuite',\n'TextTestRunner','TestLoader','FunctionTestCase','main',\n'defaultTestLoader','SkipTest','skip','skipIf','skipUnless',\n'expectedFailure','TextTestResult','installHandler',\n'registerResult','removeResult','removeHandler',\n'addModuleCleanup','doModuleCleanups','enterModuleContext']\n\n\n\n__all__.extend(['getTestCaseNames','makeSuite','findTestCases'])\n\n__unittest=True\n\nfrom.result import TestResult\nfrom.case import(addModuleCleanup,TestCase,FunctionTestCase,SkipTest,skip,\nskipIf,skipUnless,expectedFailure,doModuleCleanups,\nenterModuleContext)\nfrom.suite import BaseTestSuite,TestSuite\nfrom.loader import TestLoader,defaultTestLoader\nfrom.main import TestProgram,main\nfrom.runner import TextTestRunner,TextTestResult\nfrom.signals import installHandler,registerResult,removeResult,removeHandler\n\nfrom.loader import makeSuite,getTestCaseNames,findTestCases\n\n\n\n\n\n\ndef __dir__():\n return globals().keys()|{'IsolatedAsyncioTestCase'}\n \ndef __getattr__(name):\n if name =='IsolatedAsyncioTestCase':\n global IsolatedAsyncioTestCase\n from.async_case import IsolatedAsyncioTestCase\n return IsolatedAsyncioTestCase\n raise AttributeError(f\"module {__name__ !r} has no attribute {name !r}\")\n", ["unittest.async_case", "unittest.case", "unittest.loader", "unittest.main", "unittest.result", "unittest.runner", "unittest.signals", "unittest.suite"], 1], "unittest.__main__": [".py", "''\n\nimport sys\nif sys.argv[0].endswith(\"__main__.py\"):\n import os.path\n \n \n \n \n executable=os.path.basename(sys.executable)\n sys.argv[0]=executable+\" -m unittest\"\n del os\n \n__unittest=True\n\nfrom .main import main\n\nmain(module=None )\n", ["os.path", "sys", "unittest.main"]], "urllib.error": [".py", "class HTTPError(Exception):pass\n", []], "urllib.parse": [".py", "''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfrom collections import namedtuple\nimport functools\nimport re\nimport sys\nimport types\nimport warnings\n\n__all__=[\"urlparse\",\"urlunparse\",\"urljoin\",\"urldefrag\",\n\"urlsplit\",\"urlunsplit\",\"urlencode\",\"parse_qs\",\n\"parse_qsl\",\"quote\",\"quote_plus\",\"quote_from_bytes\",\n\"unquote\",\"unquote_plus\",\"unquote_to_bytes\",\n\"DefragResult\",\"ParseResult\",\"SplitResult\",\n\"DefragResultBytes\",\"ParseResultBytes\",\"SplitResultBytes\"]\n\n\n\n\n\nuses_relative=['','ftp','http','gopher','nntp','imap',\n'wais','file','https','shttp','mms',\n'prospero','rtsp','rtspu','sftp',\n'svn','svn+ssh','ws','wss']\n\nuses_netloc=['','ftp','http','gopher','nntp','telnet',\n'imap','wais','file','mms','https','shttp',\n'snews','prospero','rtsp','rtspu','rsync',\n'svn','svn+ssh','sftp','nfs','git','git+ssh',\n'ws','wss']\n\nuses_params=['','ftp','hdl','prospero','http','imap',\n'https','shttp','rtsp','rtspu','sip','sips',\n'mms','sftp','tel']\n\n\n\n\nnon_hierarchical=['gopher','hdl','mailto','news',\n'telnet','wais','imap','snews','sip','sips']\n\nuses_query=['','http','wais','imap','https','shttp','mms',\n'gopher','rtsp','rtspu','sip','sips']\n\nuses_fragment=['','ftp','hdl','http','gopher','news',\n'nntp','wais','https','shttp','snews',\n'file','prospero']\n\n\nscheme_chars=('abcdefghijklmnopqrstuvwxyz'\n'ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n'0123456789'\n'+-.')\n\n\n_UNSAFE_URL_BYTES_TO_REMOVE=['\\t','\\r','\\n']\n\ndef clear_cache():\n ''\n urlsplit.cache_clear()\n _byte_quoter_factory.cache_clear()\n \n \n \n \n \n \n \n_implicit_encoding='ascii'\n_implicit_errors='strict'\n\ndef _noop(obj):\n return obj\n \ndef _encode_result(obj,encoding=_implicit_encoding,\nerrors=_implicit_errors):\n return obj.encode(encoding,errors)\n \ndef _decode_args(args,encoding=_implicit_encoding,\nerrors=_implicit_errors):\n return tuple(x.decode(encoding,errors)if x else ''for x in args)\n \ndef _coerce_args(*args):\n\n\n\n\n\n str_input=isinstance(args[0],str)\n for arg in args[1:]:\n \n \n if arg and isinstance(arg,str)!=str_input:\n raise TypeError(\"Cannot mix str and non-str arguments\")\n if str_input:\n return args+(_noop,)\n return _decode_args(args)+(_encode_result,)\n \n \nclass _ResultMixinStr(object):\n ''\n __slots__=()\n \n def encode(self,encoding='ascii',errors='strict'):\n return self._encoded_counterpart(*(x.encode(encoding,errors)for x in self))\n \n \nclass _ResultMixinBytes(object):\n ''\n __slots__=()\n \n def decode(self,encoding='ascii',errors='strict'):\n return self._decoded_counterpart(*(x.decode(encoding,errors)for x in self))\n \n \nclass _NetlocResultMixinBase(object):\n ''\n __slots__=()\n \n @property\n def username(self):\n return self._userinfo[0]\n \n @property\n def password(self):\n return self._userinfo[1]\n \n @property\n def hostname(self):\n hostname=self._hostinfo[0]\n if not hostname:\n return None\n \n \n separator='%'if isinstance(hostname,str)else b'%'\n hostname,percent,zone=hostname.partition(separator)\n return hostname.lower()+percent+zone\n \n @property\n def port(self):\n port=self._hostinfo[1]\n if port is not None :\n try :\n port=int(port,10)\n except ValueError:\n message=f'Port could not be cast to integer value as {port!r}'\n raise ValueError(message)from None\n if not (0 <=port <=65535):\n raise ValueError(\"Port out of range 0-65535\")\n return port\n \n __class_getitem__=classmethod(types.GenericAlias)\n \n \nclass _NetlocResultMixinStr(_NetlocResultMixinBase,_ResultMixinStr):\n __slots__=()\n \n @property\n def _userinfo(self):\n netloc=self.netloc\n userinfo,have_info,hostinfo=netloc.rpartition('@')\n if have_info:\n username,have_password,password=userinfo.partition(':')\n if not have_password:\n password=None\n else :\n username=password=None\n return username,password\n \n @property\n def _hostinfo(self):\n netloc=self.netloc\n _,_,hostinfo=netloc.rpartition('@')\n _,have_open_br,bracketed=hostinfo.partition('[')\n if have_open_br:\n hostname,_,port=bracketed.partition(']')\n _,_,port=port.partition(':')\n else :\n hostname,_,port=hostinfo.partition(':')\n if not port:\n port=None\n return hostname,port\n \n \nclass _NetlocResultMixinBytes(_NetlocResultMixinBase,_ResultMixinBytes):\n __slots__=()\n \n @property\n def _userinfo(self):\n netloc=self.netloc\n userinfo,have_info,hostinfo=netloc.rpartition(b'@')\n if have_info:\n username,have_password,password=userinfo.partition(b':')\n if not have_password:\n password=None\n else :\n username=password=None\n return username,password\n \n @property\n def _hostinfo(self):\n netloc=self.netloc\n _,_,hostinfo=netloc.rpartition(b'@')\n _,have_open_br,bracketed=hostinfo.partition(b'[')\n if have_open_br:\n hostname,_,port=bracketed.partition(b']')\n _,_,port=port.partition(b':')\n else :\n hostname,_,port=hostinfo.partition(b':')\n if not port:\n port=None\n return hostname,port\n \n \n_DefragResultBase=namedtuple('DefragResult','url fragment')\n_SplitResultBase=namedtuple(\n'SplitResult','scheme netloc path query fragment')\n_ParseResultBase=namedtuple(\n'ParseResult','scheme netloc path params query fragment')\n\n_DefragResultBase.__doc__=\"\"\"\nDefragResult(url, fragment)\n\nA 2-tuple that contains the url without fragment identifier and the fragment\nidentifier as a separate argument.\n\"\"\"\n\n_DefragResultBase.url.__doc__=\"\"\"The URL with no fragment identifier.\"\"\"\n\n_DefragResultBase.fragment.__doc__=\"\"\"\nFragment identifier separated from URL, that allows indirect identification of a\nsecondary resource by reference to a primary resource and additional identifying\ninformation.\n\"\"\"\n\n_SplitResultBase.__doc__=\"\"\"\nSplitResult(scheme, netloc, path, query, fragment)\n\nA 5-tuple that contains the different components of a URL. Similar to\nParseResult, but does not split params.\n\"\"\"\n\n_SplitResultBase.scheme.__doc__=\"\"\"Specifies URL scheme for the request.\"\"\"\n\n_SplitResultBase.netloc.__doc__=\"\"\"\nNetwork location where the request is made to.\n\"\"\"\n\n_SplitResultBase.path.__doc__=\"\"\"\nThe hierarchical path, such as the path to a file to download.\n\"\"\"\n\n_SplitResultBase.query.__doc__=\"\"\"\nThe query component, that contains non-hierarchical data, that along with data\nin path component, identifies a resource in the scope of URI's scheme and\nnetwork location.\n\"\"\"\n\n_SplitResultBase.fragment.__doc__=\"\"\"\nFragment identifier, that allows indirect identification of a secondary resource\nby reference to a primary resource and additional identifying information.\n\"\"\"\n\n_ParseResultBase.__doc__=\"\"\"\nParseResult(scheme, netloc, path, params, query, fragment)\n\nA 6-tuple that contains components of a parsed URL.\n\"\"\"\n\n_ParseResultBase.scheme.__doc__=_SplitResultBase.scheme.__doc__\n_ParseResultBase.netloc.__doc__=_SplitResultBase.netloc.__doc__\n_ParseResultBase.path.__doc__=_SplitResultBase.path.__doc__\n_ParseResultBase.params.__doc__=\"\"\"\nParameters for last path element used to dereference the URI in order to provide\naccess to perform some operation on the resource.\n\"\"\"\n\n_ParseResultBase.query.__doc__=_SplitResultBase.query.__doc__\n_ParseResultBase.fragment.__doc__=_SplitResultBase.fragment.__doc__\n\n\n\n\n\nResultBase=_NetlocResultMixinStr\n\n\nclass DefragResult(_DefragResultBase,_ResultMixinStr):\n __slots__=()\n def geturl(self):\n if self.fragment:\n return self.url+'#'+self.fragment\n else :\n return self.url\n \nclass SplitResult(_SplitResultBase,_NetlocResultMixinStr):\n __slots__=()\n def geturl(self):\n return urlunsplit(self)\n \nclass ParseResult(_ParseResultBase,_NetlocResultMixinStr):\n __slots__=()\n def geturl(self):\n return urlunparse(self)\n \n \nclass DefragResultBytes(_DefragResultBase,_ResultMixinBytes):\n __slots__=()\n def geturl(self):\n if self.fragment:\n return self.url+b'#'+self.fragment\n else :\n return self.url\n \nclass SplitResultBytes(_SplitResultBase,_NetlocResultMixinBytes):\n __slots__=()\n def geturl(self):\n return urlunsplit(self)\n \nclass ParseResultBytes(_ParseResultBase,_NetlocResultMixinBytes):\n __slots__=()\n def geturl(self):\n return urlunparse(self)\n \n \ndef _fix_result_transcoding():\n _result_pairs=(\n (DefragResult,DefragResultBytes),\n (SplitResult,SplitResultBytes),\n (ParseResult,ParseResultBytes),\n )\n for _decoded,_encoded in _result_pairs:\n _decoded._encoded_counterpart=_encoded\n _encoded._decoded_counterpart=_decoded\n \n_fix_result_transcoding()\ndel _fix_result_transcoding\n\ndef urlparse(url,scheme='',allow_fragments=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n url,scheme,_coerce_result=_coerce_args(url,scheme)\n splitresult=urlsplit(url,scheme,allow_fragments)\n scheme,netloc,url,query,fragment=splitresult\n if scheme in uses_params and ';'in url:\n url,params=_splitparams(url)\n else :\n params=''\n result=ParseResult(scheme,netloc,url,params,query,fragment)\n return _coerce_result(result)\n \ndef _splitparams(url):\n if '/'in url:\n i=url.find(';',url.rfind('/'))\n if i <0:\n return url,''\n else :\n i=url.find(';')\n return url[:i],url[i+1:]\n \ndef _splitnetloc(url,start=0):\n delim=len(url)\n for c in '/?#':\n wdelim=url.find(c,start)\n if wdelim >=0:\n delim=min(delim,wdelim)\n return url[start:delim],url[delim:]\n \ndef _checknetloc(netloc):\n if not netloc or netloc.isascii():\n return\n \n \n import unicodedata\n n=netloc.replace('@','')\n n=n.replace(':','')\n n=n.replace('#','')\n n=n.replace('?','')\n netloc2=unicodedata.normalize('NFKC',n)\n if n ==netloc2:\n return\n for c in '/?#@:':\n if c in netloc2:\n raise ValueError(\"netloc '\"+netloc+\"' contains invalid \"+\n \"characters under NFKC normalization\")\n \n \n \n@functools.lru_cache(typed=True )\ndef urlsplit(url,scheme='',allow_fragments=True ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n url,scheme,_coerce_result=_coerce_args(url,scheme)\n \n for b in _UNSAFE_URL_BYTES_TO_REMOVE:\n url=url.replace(b,\"\")\n scheme=scheme.replace(b,\"\")\n \n allow_fragments=bool(allow_fragments)\n netloc=query=fragment=''\n i=url.find(':')\n if i >0:\n for c in url[:i]:\n if c not in scheme_chars:\n break\n else :\n scheme,url=url[:i].lower(),url[i+1:]\n \n if url[:2]=='//':\n netloc,url=_splitnetloc(url,2)\n if (('['in netloc and ']'not in netloc)or\n (']'in netloc and '['not in netloc)):\n raise ValueError(\"Invalid IPv6 URL\")\n if allow_fragments and '#'in url:\n url,fragment=url.split('#',1)\n if '?'in url:\n url,query=url.split('?',1)\n _checknetloc(netloc)\n v=SplitResult(scheme,netloc,url,query,fragment)\n return _coerce_result(v)\n \ndef urlunparse(components):\n ''\n\n\n \n scheme,netloc,url,params,query,fragment,_coerce_result=(\n _coerce_args(*components))\n if params:\n url=\"%s;%s\"%(url,params)\n return _coerce_result(urlunsplit((scheme,netloc,url,query,fragment)))\n \ndef urlunsplit(components):\n ''\n\n\n\n \n scheme,netloc,url,query,fragment,_coerce_result=(\n _coerce_args(*components))\n if netloc or (scheme and scheme in uses_netloc and url[:2]!='//'):\n if url and url[:1]!='/':url='/'+url\n url='//'+(netloc or '')+url\n if scheme:\n url=scheme+':'+url\n if query:\n url=url+'?'+query\n if fragment:\n url=url+'#'+fragment\n return _coerce_result(url)\n \ndef urljoin(base,url,allow_fragments=True ):\n ''\n \n if not base:\n return url\n if not url:\n return base\n \n base,url,_coerce_result=_coerce_args(base,url)\n bscheme,bnetloc,bpath,bparams,bquery,bfragment=\\\n urlparse(base,'',allow_fragments)\n scheme,netloc,path,params,query,fragment=\\\n urlparse(url,bscheme,allow_fragments)\n \n if scheme !=bscheme or scheme not in uses_relative:\n return _coerce_result(url)\n if scheme in uses_netloc:\n if netloc:\n return _coerce_result(urlunparse((scheme,netloc,path,\n params,query,fragment)))\n netloc=bnetloc\n \n if not path and not params:\n path=bpath\n params=bparams\n if not query:\n query=bquery\n return _coerce_result(urlunparse((scheme,netloc,path,\n params,query,fragment)))\n \n base_parts=bpath.split('/')\n if base_parts[-1]!='':\n \n \n del base_parts[-1]\n \n \n if path[:1]=='/':\n segments=path.split('/')\n else :\n segments=base_parts+path.split('/')\n \n \n segments[1:-1]=filter(None ,segments[1:-1])\n \n resolved_path=[]\n \n for seg in segments:\n if seg =='..':\n try :\n resolved_path.pop()\n except IndexError:\n \n \n pass\n elif seg =='.':\n continue\n else :\n resolved_path.append(seg)\n \n if segments[-1]in ('.','..'):\n \n \n resolved_path.append('')\n \n return _coerce_result(urlunparse((scheme,netloc,'/'.join(\n resolved_path)or '/',params,query,fragment)))\n \n \ndef urldefrag(url):\n ''\n\n\n\n\n \n url,_coerce_result=_coerce_args(url)\n if '#'in url:\n s,n,p,a,q,frag=urlparse(url)\n defrag=urlunparse((s,n,p,a,q,''))\n else :\n frag=''\n defrag=url\n return _coerce_result(DefragResult(defrag,frag))\n \n_hexdig='0123456789ABCDEFabcdef'\n_hextobyte=None\n\ndef unquote_to_bytes(string):\n ''\n \n \n if not string:\n \n string.split\n return b''\n if isinstance(string,str):\n string=string.encode('utf-8')\n bits=string.split(b'%')\n if len(bits)==1:\n return string\n res=[bits[0]]\n append=res.append\n \n \n global _hextobyte\n if _hextobyte is None :\n _hextobyte={(a+b).encode():bytes.fromhex(a+b)\n for a in _hexdig for b in _hexdig}\n for item in bits[1:]:\n try :\n append(_hextobyte[item[:2]])\n append(item[2:])\n except KeyError:\n append(b'%')\n append(item)\n return b''.join(res)\n \n_asciire=re.compile('([\\x00-\\x7f]+)')\n\ndef unquote(string,encoding='utf-8',errors='replace'):\n ''\n\n\n\n\n\n\n\n \n if isinstance(string,bytes):\n return unquote_to_bytes(string).decode(encoding,errors)\n if '%'not in string:\n string.split\n return string\n if encoding is None :\n encoding='utf-8'\n if errors is None :\n errors='replace'\n bits=_asciire.split(string)\n res=[bits[0]]\n append=res.append\n for i in range(1,len(bits),2):\n append(unquote_to_bytes(bits[i]).decode(encoding,errors))\n append(bits[i+1])\n return ''.join(res)\n \n \ndef parse_qs(qs,keep_blank_values=False ,strict_parsing=False ,\nencoding='utf-8',errors='replace',max_num_fields=None ,separator='&'):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n parsed_result={}\n pairs=parse_qsl(qs,keep_blank_values,strict_parsing,\n encoding=encoding,errors=errors,\n max_num_fields=max_num_fields,separator=separator)\n for name,value in pairs:\n if name in parsed_result:\n parsed_result[name].append(value)\n else :\n parsed_result[name]=[value]\n return parsed_result\n \n \ndef parse_qsl(qs,keep_blank_values=False ,strict_parsing=False ,\nencoding='utf-8',errors='replace',max_num_fields=None ,separator='&'):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n qs,_coerce_result=_coerce_args(qs)\n separator,_=_coerce_args(separator)\n \n if not separator or (not isinstance(separator,(str,bytes))):\n raise ValueError(\"Separator must be of type string or bytes.\")\n \n \n \n \n if max_num_fields is not None :\n num_fields=1+qs.count(separator)if qs else 0\n if max_num_fields \"\n \n def __missing__(self,b):\n \n res=chr(b)if b in self.safe else '%{:02X}'.format(b)\n self[b]=res\n return res\n \ndef quote(string,safe='/',encoding=None ,errors=None ):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n if isinstance(string,str):\n if not string:\n return string\n if encoding is None :\n encoding='utf-8'\n if errors is None :\n errors='strict'\n string=string.encode(encoding,errors)\n else :\n if encoding is not None :\n raise TypeError(\"quote() doesn't support 'encoding' for bytes\")\n if errors is not None :\n raise TypeError(\"quote() doesn't support 'errors' for bytes\")\n return quote_from_bytes(string,safe)\n \ndef quote_plus(string,safe='',encoding=None ,errors=None ):\n ''\n\n\n \n \n \n if ((isinstance(string,str)and ' 'not in string)or\n (isinstance(string,bytes)and b' 'not in string)):\n return quote(string,safe,encoding,errors)\n if isinstance(safe,str):\n space=' '\n else :\n space=b' '\n string=quote(string,safe+space,encoding,errors)\n return string.replace(' ','+')\n \n \n@functools.lru_cache\ndef _byte_quoter_factory(safe):\n return _Quoter(safe).__getitem__\n \ndef quote_from_bytes(bs,safe='/'):\n ''\n\n\n \n if not isinstance(bs,(bytes,bytearray)):\n raise TypeError(\"quote_from_bytes() expected bytes\")\n if not bs:\n return ''\n if isinstance(safe,str):\n \n safe=safe.encode('ascii','ignore')\n else :\n \n safe=bytes([c for c in safe if c <128])\n if not bs.rstrip(_ALWAYS_SAFE_BYTES+safe):\n return bs.decode()\n quoter=_byte_quoter_factory(safe)\n return ''.join([quoter(char)for char in bs])\n \ndef urlencode(query,doseq=False ,safe='',encoding=None ,errors=None ,\nquote_via=quote_plus):\n ''\n\n\n\n\n\n\n\n\n\n\n\n\n \n \n if hasattr(query,\"items\"):\n query=query.items()\n else :\n \n \n try :\n \n \n if len(query)and not isinstance(query[0],tuple):\n raise TypeError\n \n \n \n \n except TypeError as err:\n raise TypeError(\"not a valid non-string sequence \"\n \"or mapping object\")from err\n \n l=[]\n if not doseq:\n for k,v in query:\n if isinstance(k,bytes):\n k=quote_via(k,safe)\n else :\n k=quote_via(str(k),safe,encoding,errors)\n \n if isinstance(v,bytes):\n v=quote_via(v,safe)\n else :\n v=quote_via(str(v),safe,encoding,errors)\n l.append(k+'='+v)\n else :\n for k,v in query:\n if isinstance(k,bytes):\n k=quote_via(k,safe)\n else :\n k=quote_via(str(k),safe,encoding,errors)\n \n if isinstance(v,bytes):\n v=quote_via(v,safe)\n l.append(k+'='+v)\n elif isinstance(v,str):\n v=quote_via(v,safe,encoding,errors)\n l.append(k+'='+v)\n else :\n try :\n \n x=len(v)\n except TypeError:\n \n v=quote_via(str(v),safe,encoding,errors)\n l.append(k+'='+v)\n else :\n \n for elt in v:\n if isinstance(elt,bytes):\n elt=quote_via(elt,safe)\n else :\n elt=quote_via(str(elt),safe,encoding,errors)\n l.append(k+'='+elt)\n return '&'.join(l)\n \n \ndef to_bytes(url):\n warnings.warn(\"urllib.parse.to_bytes() is deprecated as of 3.8\",\n DeprecationWarning,stacklevel=2)\n return _to_bytes(url)\n \n \ndef _to_bytes(url):\n ''\n \n \n \n if isinstance(url,str):\n try :\n url=url.encode(\"ASCII\").decode()\n except UnicodeError:\n raise UnicodeError(\"URL \"+repr(url)+\n \" contains non-ASCII characters\")\n return url\n \n \ndef unwrap(url):\n ''\n\n\n \n url=str(url).strip()\n if url[:1]=='<'and url[-1:]=='>':\n url=url[1:-1].strip()\n if url[:4]=='URL:':\n url=url[4:].strip()\n return url\n \n \ndef splittype(url):\n warnings.warn(\"urllib.parse.splittype() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splittype(url)\n \n \n_typeprog=None\ndef _splittype(url):\n ''\n global _typeprog\n if _typeprog is None :\n _typeprog=re.compile('([^/:]+):(.*)',re.DOTALL)\n \n match=_typeprog.match(url)\n if match:\n scheme,data=match.groups()\n return scheme.lower(),data\n return None ,url\n \n \ndef splithost(url):\n warnings.warn(\"urllib.parse.splithost() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splithost(url)\n \n \n_hostprog=None\ndef _splithost(url):\n ''\n global _hostprog\n if _hostprog is None :\n _hostprog=re.compile('//([^/#?]*)(.*)',re.DOTALL)\n \n match=_hostprog.match(url)\n if match:\n host_port,path=match.groups()\n if path and path[0]!='/':\n path='/'+path\n return host_port,path\n return None ,url\n \n \ndef splituser(host):\n warnings.warn(\"urllib.parse.splituser() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splituser(host)\n \n \ndef _splituser(host):\n ''\n user,delim,host=host.rpartition('@')\n return (user if delim else None ),host\n \n \ndef splitpasswd(user):\n warnings.warn(\"urllib.parse.splitpasswd() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitpasswd(user)\n \n \ndef _splitpasswd(user):\n ''\n user,delim,passwd=user.partition(':')\n return user,(passwd if delim else None )\n \n \ndef splitport(host):\n warnings.warn(\"urllib.parse.splitport() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitport(host)\n \n \n \n_portprog=None\ndef _splitport(host):\n ''\n global _portprog\n if _portprog is None :\n _portprog=re.compile('(.*):([0-9]*)',re.DOTALL)\n \n match=_portprog.fullmatch(host)\n if match:\n host,port=match.groups()\n if port:\n return host,port\n return host,None\n \n \ndef splitnport(host,defport=-1):\n warnings.warn(\"urllib.parse.splitnport() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitnport(host,defport)\n \n \ndef _splitnport(host,defport=-1):\n ''\n\n\n \n host,delim,port=host.rpartition(':')\n if not delim:\n host=port\n elif port:\n try :\n nport=int(port)\n except ValueError:\n nport=None\n return host,nport\n return host,defport\n \n \ndef splitquery(url):\n warnings.warn(\"urllib.parse.splitquery() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitquery(url)\n \n \ndef _splitquery(url):\n ''\n path,delim,query=url.rpartition('?')\n if delim:\n return path,query\n return url,None\n \n \ndef splittag(url):\n warnings.warn(\"urllib.parse.splittag() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splittag(url)\n \n \ndef _splittag(url):\n ''\n path,delim,tag=url.rpartition('#')\n if delim:\n return path,tag\n return url,None\n \n \ndef splitattr(url):\n warnings.warn(\"urllib.parse.splitattr() is deprecated as of 3.8, \"\n \"use urllib.parse.urlparse() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitattr(url)\n \n \ndef _splitattr(url):\n ''\n \n words=url.split(';')\n return words[0],words[1:]\n \n \ndef splitvalue(attr):\n warnings.warn(\"urllib.parse.splitvalue() is deprecated as of 3.8, \"\n \"use urllib.parse.parse_qsl() instead\",\n DeprecationWarning,stacklevel=2)\n return _splitvalue(attr)\n \n \ndef _splitvalue(attr):\n ''\n attr,delim,value=attr.partition('=')\n return attr,(value if delim else None )\n", ["collections", "functools", "re", "sys", "types", "unicodedata", "warnings"]], "urllib.request": [".py", "from browser import ajax\nfrom . import error\n\nclass FileIO:\n\n def __init__(self,data):\n self._data=data\n \n def __enter__(self):\n return self\n \n def __exit__(self,*args):\n pass\n \n def read(self):\n return self._data\n \ndef urlopen(url,data=None ,timeout=None ):\n global result\n result=None\n \n def on_complete(req):\n global result\n if req.status ==200:\n result=req\n \n _ajax=ajax.ajax()\n _ajax.bind('complete',on_complete)\n if timeout is not None :\n _ajax.set_timeout(timeout)\n \n if data is None :\n _ajax.open('GET',url,False )\n _ajax.send()\n else :\n _ajax.open('POST',url,False )\n _ajax.send(data)\n \n if result is not None :\n if isinstance(result.text,str):\n return FileIO(result.text)\n \n return FileIO(result.text())\n raise error.HTTPError('file not found')\n", ["browser", "browser.ajax", "urllib", "urllib.error"]], "urllib": [".py", "", [], 1]} __BRYTHON__.update_VFS(scripts)