scanner.py000064400000004602152462727100006557 0ustar00"""JSON token scanner """ import re try: from _json import make_scanner as c_make_scanner except ImportError: c_make_scanner = None __all__ = ['make_scanner'] NUMBER_RE = re.compile( r'(-?(?:0|[1-9][0-9]*))(\.[0-9]+)?([eE][-+]?[0-9]+)?', (re.VERBOSE | re.MULTILINE | re.DOTALL)) def py_make_scanner(context): parse_object = context.parse_object parse_array = context.parse_array parse_string = context.parse_string match_number = NUMBER_RE.match strict = context.strict parse_float = context.parse_float parse_int = context.parse_int parse_constant = context.parse_constant object_hook = context.object_hook object_pairs_hook = context.object_pairs_hook memo = context.memo def _scan_once(string, idx): try: nextchar = string[idx] except IndexError: raise StopIteration(idx) from None if nextchar == '"': return parse_string(string, idx + 1, strict) elif nextchar == '{': return parse_object((string, idx + 1), strict, _scan_once, object_hook, object_pairs_hook, memo) elif nextchar == '[': return parse_array((string, idx + 1), _scan_once) elif nextchar == 'n' and string[idx:idx + 4] == 'null': return None, idx + 4 elif nextchar == 't' and string[idx:idx + 4] == 'true': return True, idx + 4 elif nextchar == 'f' and string[idx:idx + 5] == 'false': return False, idx + 5 m = match_number(string, idx) if m is not None: integer, frac, exp = m.groups() if frac or exp: res = parse_float(integer + (frac or '') + (exp or '')) else: res = parse_int(integer) return res, m.end() elif nextchar == 'N' and string[idx:idx + 3] == 'NaN': return parse_constant('NaN'), idx + 3 elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity': return parse_constant('Infinity'), idx + 8 elif nextchar == '-' and string[idx:idx + 9] == '-Infinity': return parse_constant('-Infinity'), idx + 9 else: raise StopIteration(idx) def scan_once(string, idx): try: return _scan_once(string, idx) finally: memo.clear() return scan_once make_scanner = c_make_scanner or py_make_scanner decoder.py000064400000030355152462727100006537 0ustar00"""Implementation of JSONDecoder """ import re from json import scanner try: from _json import scanstring as c_scanstring except ImportError: c_scanstring = None __all__ = ['JSONDecoder', 'JSONDecodeError'] FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL NaN = float('nan') PosInf = float('inf') NegInf = float('-inf') class JSONDecodeError(ValueError): """Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos """ # Note that this exception is used from _json def __init__(self, msg, doc, pos): lineno = doc.count('\n', 0, pos) + 1 colno = pos - doc.rfind('\n', 0, pos) errmsg = '%s: line %d column %d (char %d)' % (msg, lineno, colno, pos) ValueError.__init__(self, errmsg) self.msg = msg self.doc = doc self.pos = pos self.lineno = lineno self.colno = colno def __reduce__(self): return self.__class__, (self.msg, self.doc, self.pos) _CONSTANTS = { '-Infinity': NegInf, 'Infinity': PosInf, 'NaN': NaN, } HEXDIGITS = re.compile(r'[0-9A-Fa-f]{4}', FLAGS) STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS) BACKSLASH = { '"': '"', '\\': '\\', '/': '/', 'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t', } def _decode_uXXXX(s, pos, _m=HEXDIGITS.match): esc = _m(s, pos + 1) if esc is not None: try: return int(esc.group(), 16) except ValueError: pass msg = "Invalid \\uXXXX escape" raise JSONDecodeError(msg, s, pos) def py_scanstring(s, end, strict=True, _b=BACKSLASH, _m=STRINGCHUNK.match): """Scan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.""" chunks = [] _append = chunks.append begin = end - 1 while 1: chunk = _m(s, end) if chunk is None: raise JSONDecodeError("Unterminated string starting at", s, begin) end = chunk.end() content, terminator = chunk.groups() # Content is contains zero or more unescaped string characters if content: _append(content) # Terminator is the end of string, a literal control character, # or a backslash denoting that an escape sequence follows if terminator == '"': break elif terminator != '\\': if strict: #msg = "Invalid control character %r at" % (terminator,) msg = "Invalid control character {0!r} at".format(terminator) raise JSONDecodeError(msg, s, end) else: _append(terminator) continue try: esc = s[end] except IndexError: raise JSONDecodeError("Unterminated string starting at", s, begin) from None # If not a unicode escape sequence, must be in the lookup table if esc != 'u': try: char = _b[esc] except KeyError: msg = "Invalid \\escape: {0!r}".format(esc) raise JSONDecodeError(msg, s, end) end += 1 else: uni = _decode_uXXXX(s, end) end += 5 if 0xd800 <= uni <= 0xdbff and s[end:end + 2] == '\\u': uni2 = _decode_uXXXX(s, end + 1) if 0xdc00 <= uni2 <= 0xdfff: uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00)) end += 6 char = chr(uni) _append(char) return ''.join(chunks), end # Use speedup if available scanstring = c_scanstring or py_scanstring WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS) WHITESPACE_STR = ' \t\n\r' def JSONObject(s_and_end, strict, scan_once, object_hook, object_pairs_hook, memo=None, _w=WHITESPACE.match, _ws=WHITESPACE_STR): s, end = s_and_end pairs = [] pairs_append = pairs.append # Backwards compatibility if memo is None: memo = {} memo_get = memo.setdefault # Use a slice to prevent IndexError from being raised, the following # check will raise a more specific ValueError if the string is empty nextchar = s[end:end + 1] # Normally we expect nextchar == '"' if nextchar != '"': if nextchar in _ws: end = _w(s, end).end() nextchar = s[end:end + 1] # Trivial empty object if nextchar == '}': if object_pairs_hook is not None: result = object_pairs_hook(pairs) return result, end + 1 pairs = {} if object_hook is not None: pairs = object_hook(pairs) return pairs, end + 1 elif nextchar != '"': raise JSONDecodeError( "Expecting property name enclosed in double quotes", s, end) end += 1 while True: key, end = scanstring(s, end, strict) key = memo_get(key, key) # To skip some function call overhead we optimize the fast paths where # the JSON key separator is ": " or just ":". if s[end:end + 1] != ':': end = _w(s, end).end() if s[end:end + 1] != ':': raise JSONDecodeError("Expecting ':' delimiter", s, end) end += 1 try: if s[end] in _ws: end += 1 if s[end] in _ws: end = _w(s, end + 1).end() except IndexError: pass try: value, end = scan_once(s, end) except StopIteration as err: raise JSONDecodeError("Expecting value", s, err.value) from None pairs_append((key, value)) try: nextchar = s[end] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end] except IndexError: nextchar = '' end += 1 if nextchar == '}': break elif nextchar != ',': raise JSONDecodeError("Expecting ',' delimiter", s, end - 1) end = _w(s, end).end() nextchar = s[end:end + 1] end += 1 if nextchar != '"': raise JSONDecodeError( "Expecting property name enclosed in double quotes", s, end - 1) if object_pairs_hook is not None: result = object_pairs_hook(pairs) return result, end pairs = dict(pairs) if object_hook is not None: pairs = object_hook(pairs) return pairs, end def JSONArray(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR): s, end = s_and_end values = [] nextchar = s[end:end + 1] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end:end + 1] # Look-ahead for trivial empty array if nextchar == ']': return values, end + 1 _append = values.append while True: try: value, end = scan_once(s, end) except StopIteration as err: raise JSONDecodeError("Expecting value", s, err.value) from None _append(value) nextchar = s[end:end + 1] if nextchar in _ws: end = _w(s, end + 1).end() nextchar = s[end:end + 1] end += 1 if nextchar == ']': break elif nextchar != ',': raise JSONDecodeError("Expecting ',' delimiter", s, end - 1) try: if s[end] in _ws: end += 1 if s[end] in _ws: end = _w(s, end + 1).end() except IndexError: pass return values, end class JSONDecoder(object): """Simple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. """ def __init__(self, *, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None): """``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\\t'`` (tab), ``'\\n'``, ``'\\r'`` and ``'\\0'``. """ self.object_hook = object_hook self.parse_float = parse_float or float self.parse_int = parse_int or int self.parse_constant = parse_constant or _CONSTANTS.__getitem__ self.strict = strict self.object_pairs_hook = object_pairs_hook self.parse_object = JSONObject self.parse_array = JSONArray self.parse_string = scanstring self.memo = {} self.scan_once = scanner.make_scanner(self) def decode(self, s, _w=WHITESPACE.match): """Return the Python representation of ``s`` (a ``str`` instance containing a JSON document). """ obj, end = self.raw_decode(s, idx=_w(s, 0).end()) end = _w(s, end).end() if end != len(s): raise JSONDecodeError("Extra data", s, end) return obj def raw_decode(self, s, idx=0): """Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. """ try: obj, end = self.scan_once(s, idx) except StopIteration as err: raise JSONDecodeError("Expecting value", s, err.value) from None return obj, end tool.py000064400000006413152462727100006105 0ustar00r"""Command-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) """ import argparse import json import sys from pathlib import Path def main(): prog = 'python -m json.tool' description = ('A simple command line interface for json module ' 'to validate and pretty-print JSON objects.') parser = argparse.ArgumentParser(prog=prog, description=description) parser.add_argument('infile', nargs='?', type=argparse.FileType(encoding="utf-8"), help='a JSON file to be validated or pretty-printed', default=sys.stdin) parser.add_argument('outfile', nargs='?', type=Path, help='write the output of infile to outfile', default=None) parser.add_argument('--sort-keys', action='store_true', default=False, help='sort the output of dictionaries alphabetically by key') parser.add_argument('--no-ensure-ascii', dest='ensure_ascii', action='store_false', help='disable escaping of non-ASCII characters') parser.add_argument('--json-lines', action='store_true', default=False, help='parse input using the JSON Lines format. ' 'Use with --no-indent or --compact to produce valid JSON Lines output.') group = parser.add_mutually_exclusive_group() group.add_argument('--indent', default=4, type=int, help='separate items with newlines and use this number ' 'of spaces for indentation') group.add_argument('--tab', action='store_const', dest='indent', const='\t', help='separate items with newlines and use ' 'tabs for indentation') group.add_argument('--no-indent', action='store_const', dest='indent', const=None, help='separate items with spaces rather than newlines') group.add_argument('--compact', action='store_true', help='suppress all whitespace separation (most compact)') options = parser.parse_args() dump_args = { 'sort_keys': options.sort_keys, 'indent': options.indent, 'ensure_ascii': options.ensure_ascii, } if options.compact: dump_args['indent'] = None dump_args['separators'] = ',', ':' with options.infile as infile: try: if options.json_lines: objs = (json.loads(line) for line in infile) else: objs = (json.load(infile),) if options.outfile is None: out = sys.stdout else: out = options.outfile.open('w', encoding='utf-8') with out as outfile: for obj in objs: json.dump(obj, outfile, **dump_args) outfile.write('\n') except ValueError as e: raise SystemExit(e) if __name__ == '__main__': try: main() except BrokenPipeError as exc: sys.exit(exc.errno) __init__.py000064400000033304152462727100006666 0ustar00r"""JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> mydict = {'4': 5, '6': 7} >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(f'Object of type {obj.__class__.__name__} ' ... f'is not JSON serializable') ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) """ __version__ = '2.0.9' __all__ = [ 'dump', 'dumps', 'load', 'loads', 'JSONDecoder', 'JSONDecodeError', 'JSONEncoder', ] __author__ = 'Bob Ippolito ' from .decoder import JSONDecoder, JSONDecodeError from .encoder import JSONEncoder import codecs _default_encoder = JSONEncoder( skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, indent=None, separators=None, default=None, ) def dump(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw): """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. """ # cached encoder if (not skipkeys and ensure_ascii and check_circular and allow_nan and cls is None and indent is None and separators is None and default is None and not sort_keys and not kw): iterable = _default_encoder.iterencode(obj) else: if cls is None: cls = JSONEncoder iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, default=default, sort_keys=sort_keys, **kw).iterencode(obj) # could accelerate with writelines in some versions of Python, at # a debuggability cost for chunk in iterable: fp.write(chunk) def dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw): """Serialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. """ # cached encoder if (not skipkeys and ensure_ascii and check_circular and allow_nan and cls is None and indent is None and separators is None and default is None and not sort_keys and not kw): return _default_encoder.encode(obj) if cls is None: cls = JSONEncoder return cls( skipkeys=skipkeys, ensure_ascii=ensure_ascii, check_circular=check_circular, allow_nan=allow_nan, indent=indent, separators=separators, default=default, sort_keys=sort_keys, **kw).encode(obj) _default_decoder = JSONDecoder(object_hook=None, object_pairs_hook=None) def detect_encoding(b): bstartswith = b.startswith if bstartswith((codecs.BOM_UTF32_BE, codecs.BOM_UTF32_LE)): return 'utf-32' if bstartswith((codecs.BOM_UTF16_BE, codecs.BOM_UTF16_LE)): return 'utf-16' if bstartswith(codecs.BOM_UTF8): return 'utf-8-sig' if len(b) >= 4: if not b[0]: # 00 00 -- -- - utf-32-be # 00 XX -- -- - utf-16-be return 'utf-16-be' if b[1] else 'utf-32-be' if not b[1]: # XX 00 00 00 - utf-32-le # XX 00 00 XX - utf-16-le # XX 00 XX -- - utf-16-le return 'utf-16-le' if b[2] or b[3] else 'utf-32-le' elif len(b) == 2: if not b[0]: # 00 XX - utf-16-be return 'utf-16-be' if not b[1]: # XX 00 - utf-16-le return 'utf-16-le' # default return 'utf-8' def load(fp, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. """ return loads(fp.read(), cls=cls, object_hook=object_hook, parse_float=parse_float, parse_int=parse_int, parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) def loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): """Deserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. """ if isinstance(s, str): if s.startswith('\ufeff'): raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)", s, 0) else: if not isinstance(s, (bytes, bytearray)): raise TypeError(f'the JSON object must be str, bytes or bytearray, ' f'not {s.__class__.__name__}') s = s.decode(detect_encoding(s), 'surrogatepass') if (cls is None and object_hook is None and parse_int is None and parse_float is None and parse_constant is None and object_pairs_hook is None and not kw): return _default_decoder.decode(s) if cls is None: cls = JSONDecoder if object_hook is not None: kw['object_hook'] = object_hook if object_pairs_hook is not None: kw['object_pairs_hook'] = object_pairs_hook if parse_float is not None: kw['parse_float'] = parse_float if parse_int is not None: kw['parse_int'] = parse_int if parse_constant is not None: kw['parse_constant'] = parse_constant return cls(**kw).decode(s) encoder.py000064400000037313152462727100006552 0ustar00"""Implementation of JSONEncoder """ import re try: from _json import encode_basestring_ascii as c_encode_basestring_ascii except ImportError: c_encode_basestring_ascii = None try: from _json import encode_basestring as c_encode_basestring except ImportError: c_encode_basestring = None try: from _json import make_encoder as c_make_encoder except ImportError: c_make_encoder = None ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]') ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') HAS_UTF8 = re.compile(b'[\x80-\xff]') ESCAPE_DCT = { '\\': '\\\\', '"': '\\"', '\b': '\\b', '\f': '\\f', '\n': '\\n', '\r': '\\r', '\t': '\\t', } for i in range(0x20): ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i)) #ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) del i INFINITY = float('inf') def py_encode_basestring(s): """Return a JSON representation of a Python string """ def replace(match): return ESCAPE_DCT[match.group(0)] return '"' + ESCAPE.sub(replace, s) + '"' encode_basestring = (c_encode_basestring or py_encode_basestring) def py_encode_basestring_ascii(s): """Return an ASCII-only JSON representation of a Python string """ def replace(match): s = match.group(0) try: return ESCAPE_DCT[s] except KeyError: n = ord(s) if n < 0x10000: return '\\u{0:04x}'.format(n) #return '\\u%04x' % (n,) else: # surrogate pair n -= 0x10000 s1 = 0xd800 | ((n >> 10) & 0x3ff) s2 = 0xdc00 | (n & 0x3ff) return '\\u{0:04x}\\u{1:04x}'.format(s1, s2) return '"' + ESCAPE_ASCII.sub(replace, s) + '"' encode_basestring_ascii = ( c_encode_basestring_ascii or py_encode_basestring_ascii) class JSONEncoder(object): """Extensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). """ item_separator = ', ' key_separator = ': ' def __init__(self, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None): """Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float, bool or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an RecursionError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. """ self.skipkeys = skipkeys self.ensure_ascii = ensure_ascii self.check_circular = check_circular self.allow_nan = allow_nan self.sort_keys = sort_keys self.indent = indent if separators is not None: self.item_separator, self.key_separator = separators elif indent is not None: self.item_separator = ',' if default is not None: self.default = default def default(self, o): """Implement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o) """ raise TypeError(f'Object of type {o.__class__.__name__} ' f'is not JSON serializable') def encode(self, o): """Return a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' """ # This is for extremely simple cases and benchmarks. if isinstance(o, str): if self.ensure_ascii: return encode_basestring_ascii(o) else: return encode_basestring(o) # This doesn't pass the iterator directly to ''.join() because the # exceptions aren't as detailed. The list call should be roughly # equivalent to the PySequence_Fast that ''.join() would do. chunks = self.iterencode(o, _one_shot=True) if not isinstance(chunks, (list, tuple)): chunks = list(chunks) return ''.join(chunks) def iterencode(self, o, _one_shot=False): """Encode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) """ if self.check_circular: markers = {} else: markers = None if self.ensure_ascii: _encoder = encode_basestring_ascii else: _encoder = encode_basestring def floatstr(o, allow_nan=self.allow_nan, _repr=float.__repr__, _inf=INFINITY, _neginf=-INFINITY): # Check for specials. Note that this type of test is processor # and/or platform-specific, so do tests which don't depend on the # internals. if o != o: text = 'NaN' elif o == _inf: text = 'Infinity' elif o == _neginf: text = '-Infinity' else: return _repr(o) if not allow_nan: raise ValueError( "Out of range float values are not JSON compliant: " + repr(o)) return text if (_one_shot and c_make_encoder is not None and self.indent is None): _iterencode = c_make_encoder( markers, self.default, _encoder, self.indent, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, self.allow_nan) else: _iterencode = _make_iterencode( markers, self.default, _encoder, self.indent, floatstr, self.key_separator, self.item_separator, self.sort_keys, self.skipkeys, _one_shot) return _iterencode(o, 0) def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, ## HACK: hand-optimized bytecode; turn globals into locals ValueError=ValueError, dict=dict, float=float, id=id, int=int, isinstance=isinstance, list=list, str=str, tuple=tuple, _intstr=int.__repr__, ): if _indent is not None and not isinstance(_indent, str): _indent = ' ' * _indent def _iterencode_list(lst, _current_indent_level): if not lst: yield '[]' return if markers is not None: markerid = id(lst) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = lst buf = '[' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + _indent * _current_indent_level separator = _item_separator + newline_indent buf += newline_indent else: newline_indent = None separator = _item_separator first = True for value in lst: if first: first = False else: buf = separator if isinstance(value, str): yield buf + _encoder(value) elif value is None: yield buf + 'null' elif value is True: yield buf + 'true' elif value is False: yield buf + 'false' elif isinstance(value, int): # Subclasses of int/float may override __repr__, but we still # want to encode them as integers/floats in JSON. One example # within the standard library is IntEnum. yield buf + _intstr(value) elif isinstance(value, float): # see comment above for int yield buf + _floatstr(value) else: yield buf if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) yield from chunks if newline_indent is not None: _current_indent_level -= 1 yield '\n' + _indent * _current_indent_level yield ']' if markers is not None: del markers[markerid] def _iterencode_dict(dct, _current_indent_level): if not dct: yield '{}' return if markers is not None: markerid = id(dct) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = dct yield '{' if _indent is not None: _current_indent_level += 1 newline_indent = '\n' + _indent * _current_indent_level item_separator = _item_separator + newline_indent yield newline_indent else: newline_indent = None item_separator = _item_separator first = True if _sort_keys: items = sorted(dct.items()) else: items = dct.items() for key, value in items: if isinstance(key, str): pass # JavaScript is weakly typed for these, so it makes sense to # also allow them. Many encoders seem to do something like this. elif isinstance(key, float): # see comment for int/float in _make_iterencode key = _floatstr(key) elif key is True: key = 'true' elif key is False: key = 'false' elif key is None: key = 'null' elif isinstance(key, int): # see comment for int/float in _make_iterencode key = _intstr(key) elif _skipkeys: continue else: raise TypeError(f'keys must be str, int, float, bool or None, ' f'not {key.__class__.__name__}') if first: first = False else: yield item_separator yield _encoder(key) yield _key_separator if isinstance(value, str): yield _encoder(value) elif value is None: yield 'null' elif value is True: yield 'true' elif value is False: yield 'false' elif isinstance(value, int): # see comment for int/float in _make_iterencode yield _intstr(value) elif isinstance(value, float): # see comment for int/float in _make_iterencode yield _floatstr(value) else: if isinstance(value, (list, tuple)): chunks = _iterencode_list(value, _current_indent_level) elif isinstance(value, dict): chunks = _iterencode_dict(value, _current_indent_level) else: chunks = _iterencode(value, _current_indent_level) yield from chunks if newline_indent is not None: _current_indent_level -= 1 yield '\n' + _indent * _current_indent_level yield '}' if markers is not None: del markers[markerid] def _iterencode(o, _current_indent_level): if isinstance(o, str): yield _encoder(o) elif o is None: yield 'null' elif o is True: yield 'true' elif o is False: yield 'false' elif isinstance(o, int): # see comment for int/float in _make_iterencode yield _intstr(o) elif isinstance(o, float): # see comment for int/float in _make_iterencode yield _floatstr(o) elif isinstance(o, (list, tuple)): yield from _iterencode_list(o, _current_indent_level) elif isinstance(o, dict): yield from _iterencode_dict(o, _current_indent_level) else: if markers is not None: markerid = id(o) if markerid in markers: raise ValueError("Circular reference detected") markers[markerid] = o o = _default(o) yield from _iterencode(o, _current_indent_level) if markers is not None: del markers[markerid] return _iterencode __pycache__/scanner.cpython-36.pyc000064400000003664152462727100013052 0ustar003 \o @sjdZddlZyddlmZWnek r4dZYnXdgZejdejej Bej BZ ddZ epde ZdS)zJSON token scanner N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsy ||}Wntk r(t|YnX|dkrB ||d S|dkrd ||df S|dkr~||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d ko|||d d krd|d fS||}|dk rX|j\}}}|s&|rD||p2d|p            z#py_make_scanner.._scan_oncec sz ||SjXdS)N)clear)rr)rrr(r) scan_onceAs z"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r() rrrrr r!r"r#r$r%r&r'r)py_make_scanners"%r/) __doc__reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :__pycache__/encoder.cpython-36.opt-2.pyc000064400000015374152462727100014001 0ustar003 \>"@s>ddlZyddlmZWnek r0dZYnXyddlmZWnek rZdZYnXyddlmZWnek rdZYnXej dZ ej dZ ej dZ dd d d d d ddZ x&edD]Ze jeedjeqWedZddZepeZddZepeZGdddeZeeeeeeeee ej!f ddZ"dS)N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    z \u{0:04x}infcCsdd}dtj||dS)NcSst|jdS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.6/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsub)srrrrpy_encode_basestring$srcCsdd}dtj||dS)Nc Ssv|jd}yt|Stk rpt|}|dkr.replacer) ESCAPE_ASCIIr)rrrrrpy_encode_basestring_ascii0sr c @sJeZdZdZdZdddddddddddZd d Zd d Zdd dZdS) JSONEncoderz, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)N,) r"r#r$r%r&r'item_separator key_separatorr)) selfr"r#r$r%r&r'r(r)rrr__init__hs+zJSONEncoder.__init__cCstd|jjdS)Nz,Object of type '%s' is not JSON serializable) TypeError __class____name__)r-orrrr)szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}dj|S)NT) _one_shot) isinstancestrr#rr iterencodelisttuplejoin)r-r2chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r2r%Z_reprZ_infZ_neginftextrrrfloatstrs z(JSONEncoder.iterencode..floatstrr)r$r#rrr%float__repr__INFINITYc_make_encoderr'r)r,r+r&r"_make_iterencode)r-r2r3markers_encoderr@ _iterencoderrrr7s&       zJSONEncoder.iterencode)F) r1 __module__ __qualname__r+r,r.r)r<r7rrrrr!Is6r!csdk r rd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}x|D]}|rd}n|} |r||Vqz|dkr|dVqz|dkr|d Vqz|dkr|d Vqz | r||Vqz | r||Vqz|V |fr:||}n" | rR||}n ||}|EdHqzW|dk r|d8}d|Vd Vdk r|=dS) Nz[]zCircular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer;)r=rG _floatstr_indent_intstr_item_separatorrH_iterencode_dict_iterencode_listdictrAidintr5r8rFr6r9rrr\s\               z*_make_iterencode.._iterencode_listc 3sL|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|jddd }n|j}xx|D]n\}}|rnr| rȈ|}n^|dkrd }nP|d krd }nB|dkrd }n4|r|}n rqntdt|d|r2d }n|V|V V|r`|Vq|dkrrd Vq|dkrd Vq|d krd Vq|r|Vq| rƈ|Vq|fr||} n"| r||} n ||} | EdHqW|dk r2|d8}d|VdVdk rH|=dS)Nz{}zCircular reference detected{rMr TcSs|dS)Nrr)Zkvrrrasz<_make_iterencode.._iterencode_dict..)keyrOFrPrNzkey z is not a string})sorteditemsr/r>) ZdctrRrSrTr+rUrerbrVr;)r=rGrWrXrYrZrHr[r\_key_separator _skipkeys _sort_keysr]rAr^r_r5r8rFr6r9rrr[Ms                      z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrNTrOFrPzCircular reference detectedr)r2rRrS)r=_defaultrGrWrYrHr[r\r]rAr^r_r5r8rFr6r9rrrHs2       z%_make_iterencode.._iterencoder)rFrirGrXrWrfrZrhrgr3r=r]rAr^r_r5r8r6r9rYr)r=rirGrWrXrYrZrHr[r\rfrgrhr]rAr^r_r5r8rFr6r9rrEs .84O,rE)#reZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrDcompilerrZHAS_UTF8rrangei setdefaultchrrrArCrr objectr!r=r]r^r_r5r8r6r9__str__rErrrrsR        >__pycache__/decoder.cpython-36.pyc000064400000023345152462727100013024 0ustar003 \)1@sdZddlZddlmZyddlmZWnek r@dZYnXddgZej ej Bej BZ e dZe dZe d ZGd ddeZeeed Zejd e Zd ddddddddZddZdeejfddZepeZejde ZdZdejefddZejefdd ZGd!ddeZdS)"zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@s eZdZdZddZddZdS)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos cCsb|jdd|d}||jdd|}d||||f}tj||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.6/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffS)N) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname____doc__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrr bfnrtc Cs`||d|d}t|dkrL|ddkrLy t|dStk rJYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r1TcCsg}|j}|d}x|||}|dkr4td|||j}|j\} } | rT|| | dkr`Pn.| dkr|rdj| } t| ||n || qy ||} Wn tk rtd||YnX| dkry || } Wn*tk rdj| } t| ||YnX|d7}nt||}|d 7}d |ko.d knr|||d d krt||d}d|kondknrd|d d>|dB}|d7}t|} || qWdj ||fS)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r*iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr1chrjoin)r/r8strictZ_bZ_mZchunks_appendZbeginchunkZcontent terminatorrr0charZuniZuni2rrr py_scanstringEsP           2 rDz [ \t\n\r]*z c#Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| j} || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} xt|| |\}} | ||}|| | ddkr&||| j} || | ddkr&td|| | d7} y:|| |krf| d7} || |krf||| dj} Wntk r~YnXy||| \}} Wn4tk r}ztd||jdWYdd}~XnX| ||fy0|| } | |kr||| dj} || } Wntk rd} YnX| d7} | dkr6Pn| d krPtd || d||| j} || | d} | d7} | dkrtd|| dqW|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterzExpecting valuer6,zExpecting ',' delimiter) r7 setdefaultr8rrr; StopIterationvaluedict) s_and_endr? scan_once object_hookobject_pairs_hookmemo_w_wsr/r8ZpairsZ pairs_appendZmemo_getnextcharresultkeyrJerrrrr JSONObjects     "        rWc Csz|\}}g}|||d}||krF|||dj}|||d}|dkrZ||dfS|j}xy|||\} }Wn2tk r} ztd|| jdWYdd} ~ XnX|| |||d}||kr|||dj}|||d}|d7}|dkrPn|dkrtd||dy:|||krT|d7}|||krT|||dj}Wqdtk rlYqdXqdW||fS)Nr ]zExpecting valuerGzExpecting ',' delimiter)r8r7rIrrJr;) rLrMrQrRr/r8valuesrSr@rJrVrrr JSONArrays@ "   rZc@s@eZdZdZdddddddddZejfddZd d d ZdS) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)rN parse_float parse_intparse_constantr?rOcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_tj||_dS)aD``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)rNfloatr[r.r\ _CONSTANTS __getitem__r]r?rOrWZ parse_objectrZZ parse_arrayrZ parse_stringrPrZ make_scannerrM)rrNr[r\r]r?rOrrrr s&   zJSONDecoder.__init__cCsF|j|||djd\}}|||j}|t|krBtd|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder8r-r)rr/rQobjr8rrrdecodeNs   zJSONDecoder.decodercCsPy|j||\}}Wn2tk rF}ztd||jdWYdd}~XnX||fS)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. zExpecting valueN)rMrIrrJ)rr/rarcr8rVrrrrbYs "zJSONDecoder.raw_decode)r) rrrrr WHITESPACEmatchrdrbrrrrrs 1 ) rreZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSr^rZPosInfZNegInfr rr_compileZ STRINGCHUNKZ BACKSLASHr1rfrDreZWHITESPACE_STRrWrZobjectrrrrrs6    ; P%__pycache__/__init__.cpython-36.pyc000064400000030543152462727100013154 0ustar003 \<8 @sdZdZdddddddgZd Zd d lmZmZd d lmZd dl Z eddddddddZ dddddddddd ddZ dddddddddd ddZ edddZ ddZdddddddddZddddddddddZdS)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> from collections import OrderedDict >>> mydict = OrderedDict([('4', 5), ('6', 7)]) >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks| rJ|rJ|rJ|rJ|dkrJ|dkrJ|dkrJ| dkrJ| rJ| rJtj|} n2|dkrVt}|f||||||| | d| j|} x| D]} |j| qWdS)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. N)r r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.6/json/__init__.pyrxs-   c Ksz| rH|rH|rH|rH|dkrH|dkrH|dkrH|dkrH| rH| rHtj|S|dkrTt}|f|||||||| d| j|S)auSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. N)r r r r rrrr)rencoder) rr r r r rrrrrrrrrrs,   ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjras6  =8 __pycache__/__init__.cpython-36.opt-1.pyc000064400000030543152462727100014113 0ustar003 \<8 @sdZdZdddddddgZd Zd d lmZmZd d lmZd dl Z eddddddddZ dddddddddd ddZ dddddddddd ddZ edddZ ddZdddddddddZddddddddddZdS)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> from collections import OrderedDict >>> mydict = OrderedDict([('4', 5), ('6', 7)]) >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks| rJ|rJ|rJ|rJ|dkrJ|dkrJ|dkrJ| dkrJ| rJ| rJtj|} n2|dkrVt}|f||||||| | d| j|} x| D]} |j| qWdS)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. N)r r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.6/json/__init__.pyrxs-   c Ksz| rH|rH|rH|rH|dkrH|dkrH|dkrH|dkrH| rH| rHtj|S|dkrTt}|f|||||||| d| j|S)auSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. N)r r r r rrrr)rencoder) rr r r r rrrrrrrrrrs,   ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjras6  =8 __pycache__/scanner.cpython-36.opt-2.pyc000064400000003620152462727100014002 0ustar003 \o @sfddlZyddlmZWnek r0dZYnXdgZejdejejBej BZ ddZ ep`e ZdS)N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsy ||}Wntk r(t|YnX|dkrB ||d S|dkrd ||df S|dkr~||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d ko|||d d krd|d fS||}|dk rX|j\}}}|s&|rD||p2d|p            z#py_make_scanner.._scan_oncec sz ||SjXdS)N)clear)rr)rrr(r) scan_onceAs z"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r() rrrrr r!r"r#r$r%r&r'r)py_make_scanners"%r/) reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :__pycache__/tool.cpython-36.opt-1.pyc000064400000003013152462727100013321 0ustar003 \m@s>dZddlZddlZddlZddlZddZedkr:edS)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) Nc "Cs d}d}tj||d}|jddtjdd|jddtjd d d|jd d d dd|j}|jphtj}|jpttj }|j }|Vy$|rt j |}nt j |t jd}Wn*tk r}zt|WYdd}~XnXWdQRX|"t j|||dd|jdWdQRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?z-a JSON file to be validated or pretty-printed)nargstypehelpoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actiondefaultr)Zobject_pairs_hook) sort_keysindent )argparseArgumentParser add_argumentZFileType parse_argsrsysstdinr stdoutrjsonload collections OrderedDict ValueError SystemExitdumpwrite) rrparserZoptionsrr robjer$!/usr/lib64/python3.6/json/tool.pymains0    $r&__main__)__doc__rrrrr&__name__r$r$r$r% s__pycache__/decoder.cpython-36.opt-2.pyc000064400000013261152462727100013760 0ustar003 \)1@sddlZddlmZyddlmZWnek r<dZYnXddgZejej Bej BZ e dZ e dZe dZGd ddeZeee d Zejd e Zd d dddddddZddZdeejfddZepeZejde ZdZdejefddZejefddZGd ddeZdS)!N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@seZdZddZddZdS)rcCsb|jdd|d}||jdd|}d||||f}tj||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.6/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffS)N) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrrbfnrtc Cs`||d|d}t|dkrL|ddkrLy t|dStk rJYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r0TcCsg}|j}|d}x|||}|dkr4td|||j}|j\} } | rT|| | dkr`Pn.| dkr|rdj| } t| ||n || qy ||} Wn tk rtd||YnX| dkry || } Wn*tk rdj| } t| ||YnX|d7}nt||}|d7}d |ko.d knr|||d d krt||d}d |kondknrd|d d>|d B}|d7}t|} || qWdj ||fS)Nr zUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r)iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr0chrjoin)r.r7strictZ_bZ_mZchunks_appendZbeginchunkZcontent terminatorrr/charZuniZuni2rrr py_scanstringEsP           2 rCz [ \t\n\r]*z c#Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| j} || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} xt|| |\}} | ||}|| | ddkr&||| j} || | ddkr&td|| | d7} y:|| |krf| d7} || |krf||| dj} Wntk r~YnXy||| \}} Wn4tk r}ztd||jdWYdd}~XnX| ||fy0|| } | |kr||| dj} || } Wntk rd} YnX| d7} | dkr6Pn| d krPtd || d||| j} || | d} | d7} | dkrtd|| dqW|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterzExpecting valuer5,zExpecting ',' delimiter) r6 setdefaultr7rrr: StopIterationvaluedict) s_and_endr> scan_once object_hookobject_pairs_hookmemo_w_wsr.r7ZpairsZ pairs_appendZmemo_getnextcharresultkeyrIerrrrr JSONObjects     "        rVc Csz|\}}g}|||d}||krF|||dj}|||d}|dkrZ||dfS|j}xy|||\} }Wn2tk r} ztd|| jdWYdd} ~ XnX|| |||d}||kr|||dj}|||d}|d7}|dkrPn|dkrtd||dy:|||krT|d7}|||krT|||dj}Wqdtk rlYqdXqdW||fS)Nr ]zExpecting valuerFzExpecting ',' delimiter)r7r6rHrrIr:) rKrLrPrQr.r7valuesrRr?rIrUrrr JSONArrays@ "   rYc@s<eZdZdddddddddZejfddZd d d ZdS) rNT)rM parse_float parse_intparse_constantr>rNcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_tj||_dS)N)rMfloatrZr-r[ _CONSTANTS __getitem__r\r>rNrVZ parse_objectrYZ parse_arrayrZ parse_stringrOrZ make_scannerrL)rrMrZr[r\r>rNrrrr s&   zJSONDecoder.__init__cCsF|j|||djd\}}|||j}|t|krBtd|||S)Nr)idxz Extra data) raw_decoder7r,r)rr.rPobjr7rrrdecodeNs   zJSONDecoder.decodercCsPy|j||\}}Wn2tk rF}ztd||jdWYdd}~XnX||fS)NzExpecting value)rLrHrrI)rr.r`rbr7rUrrrraYs "zJSONDecoder.raw_decode)r)rrrr WHITESPACEmatchrcrarrrrrs 1 )reZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSr]rZPosInfZNegInfr rr^compileZ STRINGCHUNKZ BACKSLASHr0rerCrdZWHITESPACE_STRrVrYobjectrrrrrs4    ; P%__pycache__/scanner.cpython-36.opt-1.pyc000064400000003664152462727100014011 0ustar003 \o @sjdZddlZyddlmZWnek r4dZYnXdgZejdejej Bej BZ ddZ epde ZdS)zJSON token scanner N) make_scannerrz)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c sv|j |j|j tj|j |j|j|j|j |j |j  f ddfdd}|S)Ncsy ||}Wntk r(t|YnX|dkrB ||d S|dkrd ||df S|dkr~||dfS|dkr|||ddkrd|dfS|dkr|||dd krd |dfS|d ko|||d d krd|d fS||}|dk rX|j\}}}|s&|rD||p2d|p            z#py_make_scanner.._scan_oncec sz ||SjXdS)N)clear)rr)rrr(r) scan_onceAs z"py_make_scanner..scan_once) r%r!r& NUMBER_REmatchr'r#r$r"rr r)contextr+r() rrrrr r!r"r#r$r%r&r'r)py_make_scanners"%r/) __doc__reZ_jsonrZc_make_scanner ImportError__all__compileVERBOSE MULTILINEDOTALLr,r/r(r(r(r)s :__pycache__/decoder.cpython-36.opt-1.pyc000064400000023345152462727100013763 0ustar003 \)1@sdZddlZddlmZyddlmZWnek r@dZYnXddgZej ej Bej BZ e dZe dZe d ZGd ddeZeeed Zejd e Zd ddddddddZddZdeejfddZepeZejde ZdZdejefddZejefdd ZGd!ddeZdS)"zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infc@s eZdZdZddZddZdS)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos cCsb|jdd|d}||jdd|}d||||f}tj||||_||_||_||_||_dS)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgr$/usr/lib64/python3.6/json/decoder.pyr s zJSONDecodeError.__init__cCs|j|j|j|jffS)N) __class__rrr)rrrr __reduce__*szJSONDecodeError.__reduce__N)__name__ __module__ __qualname____doc__r rrrrrrs  )z -InfinityZInfinityNaNz(.*?)(["\\\x00-\x1f])"\/ r  )rrr bfnrtc Cs`||d|d}t|dkrL|ddkrLy t|dStk rJYnXd}t|||dS)Nr ZxXzInvalid \uXXXX escape)lenintr r)srescrrrr _decode_uXXXX;s r1TcCsg}|j}|d}x|||}|dkr4td|||j}|j\} } | rT|| | dkr`Pn.| dkr|rdj| } t| ||n || qy ||} Wn tk rtd||YnX| dkry || } Wn*tk rdj| } t| ||YnX|d7}nt||}|d 7}d |ko.d knr|||d d krt||d}d|kondknrd|d d>|dB}|d7}t|} || qWdj ||fS)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atrrz"Invalid control character {0!r} atuzInvalid \escape: {0!r}r*iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr1chrjoin)r/r8strictZ_bZ_mZchunks_appendZbeginchunkZcontent terminatorrr0charZuniZuni2rrr py_scanstringEsP           2 rDz [ \t\n\r]*z c#Cs|\}} g} | j} |dkri}|j} || | d} | dkr| |krb||| j} || | d} | dkr|dk r|| }|| dfSi} |dk r|| } | | dfS| dkrtd|| | d7} xt|| |\}} | ||}|| | ddkr&||| j} || | ddkr&td|| | d7} y:|| |krf| d7} || |krf||| dj} Wntk r~YnXy||| \}} Wn4tk r}ztd||jdWYdd}~XnX| ||fy0|| } | |kr||| dj} || } Wntk rd} YnX| d7} | dkr6Pn| d krPtd || d||| j} || | d} | d7} | dkrtd|| dqW|dk r|| }|| fSt| } |dk r|| } | | fS) Nr r}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterzExpecting valuer6,zExpecting ',' delimiter) r7 setdefaultr8rrr; StopIterationvaluedict) s_and_endr? scan_once object_hookobject_pairs_hookmemo_w_wsr/r8ZpairsZ pairs_appendZmemo_getnextcharresultkeyrJerrrrr JSONObjects     "        rWc Csz|\}}g}|||d}||krF|||dj}|||d}|dkrZ||dfS|j}xy|||\} }Wn2tk r} ztd|| jdWYdd} ~ XnX|| |||d}||kr|||dj}|||d}|d7}|dkrPn|dkrtd||dy:|||krT|d7}|||krT|||dj}Wqdtk rlYqdXqdW||fS)Nr ]zExpecting valuerGzExpecting ',' delimiter)r8r7rIrrJr;) rLrMrQrRr/r8valuesrSr@rJrVrrr JSONArrays@ "   rZc@s@eZdZdZdddddddddZejfddZd d d ZdS) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)rN parse_float parse_intparse_constantr?rOcCsZ||_|p t|_|pt|_|p"tj|_||_||_ t |_ t |_ t|_i|_tj||_dS)aD``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)rNfloatr[r.r\ _CONSTANTS __getitem__r]r?rOrWZ parse_objectrZZ parse_arrayrZ parse_stringrPrZ make_scannerrM)rrNr[r\r]r?rOrrrr s&   zJSONDecoder.__init__cCsF|j|||djd\}}|||j}|t|krBtd|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder8r-r)rr/rQobjr8rrrdecodeNs   zJSONDecoder.decodercCsPy|j||\}}Wn2tk rF}ztd||jdWYdd}~XnX||fS)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. zExpecting valueN)rMrIrrJ)rr/rarcr8rVrrrrbYs "zJSONDecoder.raw_decode)r) rrrrr WHITESPACEmatchrdrbrrrrrs 1 ) rreZjsonrZ_jsonrZ c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSr^rZPosInfZNegInfr rr_compileZ STRINGCHUNKZ BACKSLASHr1rfrDreZWHITESPACE_STRrWrZobjectrrrrrs6    ; P%__pycache__/__init__.cpython-36.opt-2.pyc000064400000005655152462727100014122 0ustar003 \<8 @sdZdddddddgZdZd d lmZmZd d lmZd d lZeddddd d d dZ ddddd d d d dd ddZ ddddd d d d dd ddZ ed d dZ ddZ d d d d d d dddZd d d d d d d dddZd S)z2.0.9dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r r clsrrr sort_keysc  Ks| rJ|rJ|rJ|rJ|dkrJ|dkrJ|dkrJ| dkrJ| rJ| rJtj|} n2|dkrVt}|f||||||| | d| j|} x| D]} |j| qWdS)N)r r r r rrrr)_default_encoder iterencoderwrite)objfpr r r r rrrrrkwiterablechunkr%/usr/lib64/python3.6/json/__init__.pyrxs-   c Ksz| rH|rH|rH|rH|dkrH|dkrH|dkrH|dkrH| rH| rHtj|S|dkrTt}|f|||||||| d| j|S)N)r r r r rrrr)rencoder) rr r r r rrrrrrrrrrs,   ) object_hookobject_pairs_hookcCs|j}|tjtjfrdS|tjtjfr.dS|tjrbs4  =8 __pycache__/encoder.cpython-36.pyc000064400000025773152462727100013045 0ustar003 \>"@sBdZddlZyddlmZWnek r4dZYnXyddlmZWnek r^dZYnXyddlmZ Wnek rdZ YnXej dZ ej dZ ej dZ d d d d d dddZx&edD]ZejeedjeqWedZddZepeZddZep eZGdddeZeeeeeeee e!ej"f ddZ#dS)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    z \u{0:04x}infcCsdd}dtj||dS)z5Return a JSON representation of a Python string cSst|jdS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.6/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsub)srrrrpy_encode_basestring$srcCsdd}dtj||dS)zAReturn an ASCII-only JSON representation of a Python string c Ssv|jd}yt|Stk rpt|}|dkr.replacer) ESCAPE_ASCIIr)rrrrrpy_encode_basestring_ascii0sr c @sNeZdZdZdZdZddddddddddd Zd d Zd d ZdddZ dS) JSONEncoderaZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r"r#r$r%r&r'item_separator key_separatorr)) selfr"r#r$r%r&r'r(r)rrr__init__hs+zJSONEncoder.__init__cCstd|jjdS)alImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) z,Object of type '%s' is not JSON serializableN) TypeError __class____name__)r-orrrr)szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}dj|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr#rr iterencodelisttuplejoin)r-r2chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r2r%Z_reprZ_infZ_neginftextrrrfloatstrs z(JSONEncoder.iterencode..floatstrr)r$r#rrr%float__repr__INFINITYc_make_encoderr'r)r,r+r&r"_make_iterencode)r-r2r3markers_encoderr@ _iterencoderrrr7s&       zJSONEncoder.iterencode)F) r1 __module__ __qualname____doc__r+r,r.r)r<r7rrrrr!Is6r!csdk r rd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}x|D]}|rd}n|} |r||Vqz|dkr|dVqz|dkr|d Vqz|dkr|d Vqz | r||Vqz | r||Vqz|V |fr:||}n" | rR||}n ||}|EdHqzW|dk r|d8}d|Vd Vdk r|=dS) Nz[]zCircular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer;)r=rG _floatstr_indent_intstr_item_separatorrH_iterencode_dict_iterencode_listdictrAidintr5r8rFr6r9rrr]s\               z*_make_iterencode.._iterencode_listc 3sL|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|jddd }n|j}xx|D]n\}}|rnr| rȈ|}n^|dkrd }nP|d krd }nB|dkrd }n4|r|}n rqntdt|d|r2d }n|V|V V|r`|Vq|dkrrd Vq|dkrd Vq|d krd Vq|r|Vq| rƈ|Vq|fr||} n"| r||} n ||} | EdHqW|dk r2|d8}d|VdVdk rH|=dS)Nz{}zCircular reference detected{rNr TcSs|dS)Nrr)Zkvrrrasz<_make_iterencode.._iterencode_dict..)keyrPFrQrOzkey z is not a string})sorteditemsr/r>) ZdctrSrTrUr+rVrfrcrWr;)r=rGrXrYrZr[rHr\r]_key_separator _skipkeys _sort_keysr^rAr_r`r5r8rFr6r9rrr\Ms                      z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrOTrPFrQzCircular reference detectedr)r2rSrT)r=_defaultrGrXrZrHr\r]r^rAr_r`r5r8rFr6r9rrrHs2       z%_make_iterencode.._iterencoder)rFrjrGrYrXrgr[rirhr3r=r^rAr_r`r5r8r6r9rZr)r=rjrGrXrYrZr[rHr\r]rgrhrir^rAr_r`r5r8rFr6r9rrEs .84O,rE)$rKreZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrDcompilerrZHAS_UTF8rrangei setdefaultchrrrArCrr objectr!r=r^r_r`r5r8r6r9__str__rErrrrsT        >__pycache__/encoder.cpython-36.opt-1.pyc000064400000025773152462727100014004 0ustar003 \>"@sBdZddlZyddlmZWnek r4dZYnXyddlmZWnek r^dZYnXyddlmZ Wnek rdZ YnXej dZ ej dZ ej dZ d d d d d dddZx&edD]ZejeedjeqWedZddZepeZddZep eZGdddeZeeeeeeee e!ej"f ddZ#dS)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    z \u{0:04x}infcCsdd}dtj||dS)z5Return a JSON representation of a Python string cSst|jdS)Nr) ESCAPE_DCTgroup)matchr$/usr/lib64/python3.6/json/encoder.pyreplace(sz%py_encode_basestring..replacer)ESCAPEsub)srrrrpy_encode_basestring$srcCsdd}dtj||dS)zAReturn an ASCII-only JSON representation of a Python string c Ssv|jd}yt|Stk rpt|}|dkr.replacer) ESCAPE_ASCIIr)rrrrrpy_encode_basestring_ascii0sr c @sNeZdZdZdZdZddddddddddd Zd d Zd d ZdddZ dS) JSONEncoderaZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc CsZ||_||_||_||_||_||_|dk r:|\|_|_n|dk rHd|_|dk rV||_dS)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r"r#r$r%r&r'item_separator key_separatorr)) selfr"r#r$r%r&r'r(r)rrr__init__hs+zJSONEncoder.__init__cCstd|jjdS)alImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) z,Object of type '%s' is not JSON serializableN) TypeError __class____name__)r-orrrr)szJSONEncoder.defaultcCsNt|tr |jrt|St|S|j|dd}t|ttfsDt|}dj|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr#rr iterencodelisttuplejoin)r-r2chunksrrrencodes zJSONEncoder.encodec Cs|jr i}nd}|jrt}nt}|jtjtt fdd}|rvtdk rv|j dkrvt||j ||j |j |j |j |j|j }n&t||j ||j ||j |j |j |j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) NcSsJ||krd}n$||krd}n||kr*d}n||S|sFtdt||S)NZNaNZInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r2r%Z_reprZ_infZ_neginftextrrrfloatstrs z(JSONEncoder.iterencode..floatstrr)r$r#rrr%float__repr__INFINITYc_make_encoderr'r)r,r+r&r"_make_iterencode)r-r2r3markers_encoderr@ _iterencoderrrr7s&       zJSONEncoder.iterencode)F) r1 __module__ __qualname____doc__r+r,r.r)r<r7rrrrr!Is6r!csdk r rd fdd  fdd fddS)N c 3s|sdVdSdk r6 |}|kr.d||<d}dk rh|d7}d|}|}||7}nd}}d}x|D]}|rd}n|} |r||Vqz|dkr|dVqz|dkr|d Vqz|dkr|d Vqz | r||Vqz | r||Vqz|V |fr:||}n" | rR||}n ||}|EdHqzW|dk r|d8}d|Vd Vdk r|=dS) Nz[]zCircular reference detected[r TFnulltruefalse]r) Zlst_current_indent_levelmarkeridZbufnewline_indentZ separatorfirstvaluer;)r=rG _floatstr_indent_intstr_item_separatorrH_iterencode_dict_iterencode_listdictrAidintr5r8rFr6r9rrr]s\               z*_make_iterencode.._iterencode_listc 3sL|sdVdSdk r6|}|kr.d||<dVdk rh|d7}d|}|}|Vnd}}d} rt|jddd }n|j}xx|D]n\}}|rnr| rȈ|}n^|dkrd }nP|d krd }nB|dkrd }n4|r|}n rqntdt|d|r2d }n|V|V V|r`|Vq|dkrrd Vq|dkrd Vq|d krd Vq|r|Vq| rƈ|Vq|fr||} n"| r||} n ||} | EdHqW|dk r2|d8}d|VdVdk rH|=dS)Nz{}zCircular reference detected{rNr TcSs|dS)Nrr)Zkvrrrasz<_make_iterencode.._iterencode_dict..)keyrPFrQrOzkey z is not a string})sorteditemsr/r>) ZdctrSrTrUr+rVrfrcrWr;)r=rGrXrYrZr[rHr\r]_key_separator _skipkeys _sort_keysr^rAr_r`r5r8rFr6r9rrr\Ms                      z*_make_iterencode.._iterencode_dictc3s |r|Vn|dkr&dVn|dkr6dVn|dkrFdVn | r\|Vn | rr|Vn | fr||EdHnj |r||EdHnNdk rֈ |}|krΈd||<|}||EdHdk r|=dS)NrOTrPFrQzCircular reference detectedr)r2rSrT)r=_defaultrGrXrZrHr\r]r^rAr_r`r5r8rFr6r9rrrHs2       z%_make_iterencode.._iterencoder)rFrjrGrYrXrgr[rirhr3r=r^rAr_r`r5r8r6r9rZr)r=rjrGrXrYrZr[rHr\r]rgrhrir^rAr_r`r5r8rFr6r9rrEs .84O,rE)$rKreZ_jsonrZc_encode_basestring_ascii ImportErrorrZc_encode_basestringrrDcompilerrZHAS_UTF8rrangei setdefaultchrrrArCrr objectr!r=r^r_r`r5r8r6r9__str__rErrrrsT        >__pycache__/tool.cpython-36.pyc000064400000003013152462727100012362 0ustar003 \m@s>dZddlZddlZddlZddlZddZedkr:edS)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) Nc "Cs d}d}tj||d}|jddtjdd|jddtjd d d|jd d d dd|j}|jphtj}|jpttj }|j }|Vy$|rt j |}nt j |t jd}Wn*tk r}zt|WYdd}~XnXWdQRX|"t j|||dd|jdWdQRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?z-a JSON file to be validated or pretty-printed)nargstypehelpoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actiondefaultr)Zobject_pairs_hook) sort_keysindent )argparseArgumentParser add_argumentZFileType parse_argsrsysstdinr stdoutrjsonload collections OrderedDict ValueError SystemExitdumpwrite) rrparserZoptionsrr robjer$!/usr/lib64/python3.6/json/tool.pymains0    $r&__main__)__doc__rrrrr&__name__r$r$r$r% s__pycache__/tool.cpython-36.opt-2.pyc000064400000002346152462727100013332 0ustar003 \m@s:ddlZddlZddlZddlZddZedkr6edS)Nc "Cs d}d}tj||d}|jddtjdd|jddtjd d d|jd d d dd|j}|jphtj}|jpttj }|j }|Vy$|rt j |}nt j |t jd}Wn*tk r}zt|WYdd}~XnXWdQRX|"t j|||dd|jdWdQRXdS)Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?z-a JSON file to be validated or pretty-printed)nargstypehelpoutfilewz%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actiondefaultr)Zobject_pairs_hook) sort_keysindent )argparseArgumentParser add_argumentZFileType parse_argsrsysstdinr stdoutrjsonload collections OrderedDict ValueError SystemExitdumpwrite) rrparserZoptionsrr robjer$!/usr/lib64/python3.6/json/tool.pymains0    $r&__main__)rrrrr&__name__r$r$r$r% s scanner.pyo000064400000004265152462727600006750 0ustar00 {fc@sdZddlZyddlmZWnek r?dZnXdgZejdej ej Bej BZ dZ ep~e ZdS(sJSON token scanner iN(t make_scannerRs)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c s|j |j|j tj|j|j |j|j|j |j |j  f dS(NcsZy||}Wntk r'tnX|dkrK ||d S|dkrz ||df S|dkr||dfS|dkr|||d!dkrd|dfS|dkr|||d!d krt|dfS|d kr0|||d !d kr0t|d fS||}|dk r|j\}}}|sl|r||p{d |pd }n |}||jfS|dkr|||d!dkrd|dfS|dkr|||d!dkrd|dfS|dkrP|||d!dkrPd|dfStdS(Nt"it{t[tnitnullttttruetfitfalsettNitNaNtIitInfinityt-i s -Infinity(t IndexErrort StopIterationtNonetTruetFalsetgroupstend(tstringtidxtnextchartmtintegertfractexptres( t _scan_oncetencodingt match_numbert object_hooktobject_pairs_hookt parse_arraytparse_constantt parse_floatt parse_intt parse_objectt parse_stringtstrict(s$/usr/lib64/python2.7/json/scanner.pyRs>      ###  # ###( R(R$R)t NUMBER_REtmatchR R*R&R'R%R"R#(tcontext(( RR R!R"R#R$R%R&R'R(R)R*s$/usr/lib64/python2.7/json/scanner.pytpy_make_scanners           0%(t__doc__tret_jsonRtc_make_scannert ImportErrorRt__all__tcompiletVERBOSEt MULTILINEtDOTALLR+R.(((s$/usr/lib64/python2.7/json/scanner.pyts     4tool.pyc000064400000002416152462727600006254 0ustar00 {fc@sAdZddlZddlZdZedkr=endS(sCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) iNcCs>ttjdkr*tj}tj}nttjdkrattjdd}tj}n[ttjdkrttjdd}ttjdd}nttjdd|:ytj|}Wnt k r}t|nXWdQX|4tj ||dt d d d d|j dWdQXdS(Niitrbitwbis [infile [outfile]]t sort_keystindentit separatorst,s: s (Rs: ( tlentsystargvtstdintstdouttopent SystemExittjsontloadt ValueErrortdumptTruetwrite(tinfiletoutfiletobjte((s!/usr/lib64/python2.7/json/tool.pytmains&    t__main__(t__doc__RR Rt__name__(((s!/usr/lib64/python2.7/json/tool.pyt s     __init__.pyo000064400000033146152462727600007056 0ustar00 {fc@s,dZdZddddddgZdZd d lmZd d lmZed ed e de de ddddddddZ ee e e ddddded Z ee e e ddddded Z eddddddZddddddddZddddddddZdS(s JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, ... indent=4, separators=(',', ': ')) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) s2.0.9tdumptdumpstloadtloadst JSONDecodert JSONEncodersBob Ippolito i(R(Rtskipkeyst ensure_asciitcheck_circulart allow_nantindentt separatorstencodingsutf-8tdefaultc Ks| ru|ru|ru|ru|d kru|d kru|d kru| dkru| d kru| ru| rutj|} n`|d krt}n|d|d|d|d|d|d|d| d | d | | j|} x| D]}|j|qWd S( s Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is true (the default), all non-ASCII characters in the output are escaped with ``\uXXXX`` sequences, and the result is a ``str`` instance consisting of ASCII characters only. If ``ensure_ascii`` is false, some chunks written to ``fp`` may be ``unicode`` instances. This usually happens because the input contains unicode strings or the ``encoding`` parameter is used. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter``) this is likely to cause an error. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. sutf-8RRRR R R R R t sort_keysN(tNonet_default_encodert iterencodeRtwrite(tobjtfpRRRR tclsR R R R Rtkwtiterabletchunk((s%/usr/lib64/python2.7/json/__init__.pyRzs5  $&    c Ks| rp|rp|rp|rp|d krp|d krp|d krp|dkrp| d krp| rp| rptj|S|d krt}n|d|d|d|d|d|d|d|d | d | | j|S( sSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and the return value may be a ``unicode`` instance. See ``dump`` for details. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. sutf-8RRRR R R R R RN(RRtencodeR( RRRRR RR R R R RR((s%/usr/lib64/python2.7/json/__init__.pyRs/  $&    t object_hooktobject_pairs_hookc Ks=t|jd|d|d|d|d|d|d||S(sDeserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. R RRt parse_floatt parse_inttparse_constantR(Rtread( RR RRRRRRR((s%/usr/lib64/python2.7/json/__init__.pyRs   c Ks|dkrh|dkrh|dkrh|dkrh|dkrh|dkrh|dkrh| rhtj|S|dkr}t}n|dk r||dcs6     E  ;  # scanner.pyc000064400000004265152462727600006734 0ustar00 {fc@sdZddlZyddlmZWnek r?dZnXdgZejdej ej Bej BZ dZ ep~e ZdS(sJSON token scanner iN(t make_scannerRs)(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?c s|j |j|j tj|j|j |j|j|j |j |j  f dS(NcsZy||}Wntk r'tnX|dkrK ||d S|dkrz ||df S|dkr||dfS|dkr|||d!dkrd|dfS|dkr|||d!d krt|dfS|d kr0|||d !d kr0t|d fS||}|dk r|j\}}}|sl|r||p{d |pd }n |}||jfS|dkr|||d!dkrd|dfS|dkr|||d!dkrd|dfS|dkrP|||d!dkrPd|dfStdS(Nt"it{t[tnitnullttttruetfitfalsettNitNaNtIitInfinityt-i s -Infinity(t IndexErrort StopIterationtNonetTruetFalsetgroupstend(tstringtidxtnextchartmtintegertfractexptres( t _scan_oncetencodingt match_numbert object_hooktobject_pairs_hookt parse_arraytparse_constantt parse_floatt parse_intt parse_objectt parse_stringtstrict(s$/usr/lib64/python2.7/json/scanner.pyRs>      ###  # ###( R(R$R)t NUMBER_REtmatchR R*R&R'R%R"R#(tcontext(( RR R!R"R#R$R%R&R'R(R)R*s$/usr/lib64/python2.7/json/scanner.pytpy_make_scanners           0%(t__doc__tret_jsonRtc_make_scannert ImportErrorRt__all__tcompiletVERBOSEt MULTILINEtDOTALLR+R.(((s$/usr/lib64/python2.7/json/scanner.pyts     4decoder.pyc000064400000027270152462727600006711 0ustar00 {fc@sdZddlZddlZddlZddlmZyddlmZWne k rgdZnXdgZ ej ej BejBZdZe\ZZZdZddZied 6ed 6ed 6Zejd eZid d6dd6dd6dd6dd6dd6dd6dd6ZdZdZdeeejdZepSeZejd eZd!Z eje d"Z!eje d#Z"de#fd$YZ$dS(%sImplementation of JSONDecoder iN(tscanner(t scanstringt JSONDecodercCs8tjdd\}tjdd\}||| fS(Ns>dss(tstructtunpack(tnantinf((s$/usr/lib64/python2.7/json/decoder.pyt_floatconstantsscCsU|jdd|d}|dkr2|d}n||jdd|}||fS(Ns ii(tcounttrindex(tdoctpostlinenotcolno((s$/usr/lib64/python2.7/json/decoder.pytlinecols   c Cswt||\}}|dkr=d}|j||||St||\}}d}|j|||||||S(Ns#{0}: line {1} column {2} (char {3})s?{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})(RtNonetformat( tmsgR R tendR R tfmtt endlinenotendcolno((s$/usr/lib64/python2.7/json/decoder.pyterrmsg"s s -InfinitytInfinitytNaNs(.*?)(["\\\x00-\x1f])u"t"u\s\u/t/utbu tfu tnu tru ttsutf-8cCs||d|d!}t|dkr_|ddkr_yt|dSWq_tk r[q_Xnd}tt|||dS(NiiitxXisInvalid \uXXXX escape(tlentintt ValueErrorR(tsR tescR((s$/usr/lib64/python2.7/json/decoder.pyt _decode_uXXXX?s" cCs|dkrt}ng}|j}|d}xO|||} | dkrgttd||n| j}| j\} } | rt| tst| |} n|| n| dkrPnL| dkr|rdj | } tt| ||q|| q1ny||} Wn)t k rNttd||nX| dkry|| }Wn9t k rdt | } tt| ||nX|d7}nt ||}|d7}tjd krfd |kod knrf|||d !d krft ||d}d|ko7dknrfd|d d>|dB}|d7}qfnt|}||q1Wdj||fS(sScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.isUnterminated string starting atRs\s"Invalid control character {0!r} attusInvalid \escape: iiiiis\uiiii iuN(RtDEFAULT_ENCODINGtappendR#RRtgroupst isinstancetunicodeRt IndexErrortKeyErrortreprR&tsyst maxunicodetunichrtjoin(R$Rtencodingtstrictt_bt_mtchunkst_appendtbegintchunktcontentt terminatorRR%tchartunituni2((s$/usr/lib64/python2.7/json/decoder.pyt py_scanstringIs^               3 s [ \t\n\r]*s cCs|\}} g} | j} || | d!} | dkr| |krm||| j} || | d!} n| dkr|dk r|| } | | dfSi} |dk r|| } n| | dfS| dkrttd|| qn| d7} xtrt|| ||\}} || | d!dkr||| j} || | d!dkrttd|| qn| d7} yM|| |kr| d7} || |kr||| dj} qnWntk rnXy||| \}} Wn)tk r6ttd|| nX| ||fy@|| } | |kr||| dj} || } nWntk rd} nX| d7} | dkrPn+| d krttd || dnyc|| } | |krH| d7} || } | |krH||| dj} || } qHnWntk rbd} nX| d7} | dkrttd|| dqqW|dk r|| } | | fSt | } |dk r|| } n| | fS( NiRt}s1Expecting property name enclosed in double quotest:sExpecting ':' delimitersExpecting objecttt,sExpecting ',' delimiter( R)RRR#RtTrueRR-t StopIterationtdict(t s_and_endR4R5t scan_oncet object_hooktobject_pairs_hookt_wt_wsR$Rtpairst pairs_appendtnextchartresulttkeytvalue((s$/usr/lib64/python2.7/json/decoder.pyt JSONObjects             #                       c Cs|\}}g}|||d!}||kr\|||dj}|||d!}n|dkrv||dfS|j}xEtry|||\} }Wn)tk rttd||nX|| |||d!}||kr!|||dj}|||d!}n|d7}|dkr;Pn'|dkrbttd||nyM|||kr|d7}|||kr|||dj}qnWqtk rqXqW||fS(Nit]sExpecting objectREsExpecting ',' delimiter(RR)RFRGR#RR-( RIRJRMRNR$RtvaluesRQR9RT((s$/usr/lib64/python2.7/json/decoder.pyt JSONArrays@            # cBsGeZdZdddddeddZejdZddZ RS(sSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. cCs||_||_||_|p$t|_|p3t|_|pEtj|_ ||_ t |_ t |_t|_tj||_dS(s``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N(R4RKRLtfloatt parse_floatR"t parse_intt _CONSTANTSt __getitem__tparse_constantR5RUt parse_objectRXt parse_arrayRt parse_stringRt make_scannerRJ(tselfR4RKRZR[R^R5RL((s$/usr/lib64/python2.7/json/decoder.pyt__init__.s-       cCsy|j|d||dj\}}|||j}|t|kruttd||t|n|S(szReturn the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) tidxis Extra data(t raw_decodeRR!R#R(RcR$RMtobjR((s$/usr/lib64/python2.7/json/decoder.pytdecodegs *$icCsFy|j||\}}Wntk r;tdnX||fS(sLDecode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. sNo JSON object could be decoded(RJRGR#(RcR$ReRgR((s$/usr/lib64/python2.7/json/decoder.pyRfrs  N( t__name__t __module__t__doc__RRFRdt WHITESPACEtmatchRhRf(((s$/usr/lib64/python2.7/json/decoder.pyRs    7 (%RktreR0RtjsonRt_jsonRt c_scanstringt ImportErrorRt__all__tVERBOSEt MULTILINEtDOTALLtFLAGSRRtPosInftNegInfRRR\tcompilet STRINGCHUNKt BACKSLASHR(R&RFRmRARltWHITESPACE_STRRURXtobjectR(((s$/usr/lib64/python2.7/json/decoder.pyts@         & E W$tool.pyo000064400000002416152462727600006270 0ustar00 {fc@sAdZddlZddlZdZedkr=endS(sCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) iNcCs>ttjdkr*tj}tj}nttjdkrattjdd}tj}n[ttjdkrttjdd}ttjdd}nttjdd|:ytj|}Wnt k r}t|nXWdQX|4tj ||dt d d d d|j dWdQXdS(Niitrbitwbis [infile [outfile]]t sort_keystindentit separatorst,s: s (Rs: ( tlentsystargvtstdintstdouttopent SystemExittjsontloadt ValueErrortdumptTruetwrite(tinfiletoutfiletobjte((s!/usr/lib64/python2.7/json/tool.pytmains&    t__main__(t__doc__RR Rt__name__(((s!/usr/lib64/python2.7/json/tool.pyt s     encoder.pyc000064400000032631152462727600006720 0ustar00 {fc @sdZddlZyddlmZWnek r?dZnXyddlmZWnek rmdZnXej dZ ej dZ ej dZ idd 6d d 6d d 6dd6dd6dd6dd6Z x3edD]%Ze jeedjeqWedZejZdZdZep8eZdefdYZeeeeeee e!e"e#e$d Z%dS(sImplementation of JSONEncoder iN(tencode_basestring_ascii(t make_encoders[\x00-\x1f\\"\b\f\n\r\t]s([\\"]|[^\ -~])s [\x80-\xff]s\\s\s\"t"s\bss\fs s\ns s\rs s\ts i s \u{0:04x}tinfcCs!d}dtj||dS(s5Return a JSON representation of a Python string cSst|jdS(Ni(t ESCAPE_DCTtgroup(tmatch((s$/usr/lib64/python2.7/json/encoder.pytreplace%sR(tESCAPEtsub(tsR((s$/usr/lib64/python2.7/json/encoder.pytencode_basestring!s cCs]t|tr6tj|dk r6|jd}nd}dttj||dS(sAReturn an ASCII-only JSON representation of a Python string sutf-8cSs|jd}y t|SWnptk rt|}|dkrPdj|S|d8}d|d?d@B}d|d@B}dj||SnXdS( Niis \u{0:04x}ii iis\u{0:04x}\u{1:04x}(RRtKeyErrortordtformat(RR tnts1ts2((s$/usr/lib64/python2.7/json/encoder.pyR0s      RN(t isinstancetstrtHAS_UTF8tsearchtNonetdecodet ESCAPE_ASCIIR (R R((s$/usr/lib64/python2.7/json/encoder.pytpy_encode_basestring_ascii*s$ t JSONEncoderc Bs\eZdZdZdZeeeeeddddd ZdZ dZ edZ RS( sZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). s, s: sutf-8c Cs|||_||_||_||_||_||_|dk rW|\|_|_n| dk ro| |_ n||_ dS(s Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If *ensure_ascii* is true (the default), all non-ASCII characters in the output are escaped with \uXXXX sequences, and the results are str instances consisting of ASCII characters only. If ensure_ascii is False, a result may be a unicode instance. This usually happens if the input contains unicode strings or the *encoding* parameter is used. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. Since the default item separator is ', ', the output might include trailing whitespace when indent is specified. You can use separators=(',', ': ') to avoid this. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. N( tskipkeyst ensure_asciitcheck_circulart allow_nant sort_keystindentRtitem_separatort key_separatortdefaulttencoding( tselfRRRRRR t separatorsR$R#((s$/usr/lib64/python2.7/json/encoder.pyt__init__es4         cCstt|ddS(slImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) s is not JSON serializableN(t TypeErrortrepr(R%to((s$/usr/lib64/python2.7/json/encoder.pyR#scCst|trut|trU|j}|dk rU|dk rU|j|}qUn|jrht|St|Sn|j |dt }t|t t fst |}ndj |S(sReturn a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' sutf-8t _one_shottN(Rt basestringRR$RRRRR t iterencodetTruetlistttupletjoin(R%R*t _encodingtchunks((s$/usr/lib64/python2.7/json/encoder.pytencodes      c Cs|jri}nd}|jr*t}nt}|jdkrT||jd}n|jttt d}|rt dk r|j dkr|j rt ||j ||j |j |j|j |j|j }n9t||j ||j ||j |j|j |j| }||dS(sEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) sutf-8cSs+t|tr!|j|}n||S(N(RRR(R*t _orig_encoderR3((s$/usr/lib64/python2.7/json/encoder.pyt_encoderscSsl||krd}n4||kr*d}n||kr?d}n ||S|shtdt|n|S(NtNaNtInfinitys -Infinitys2Out of range float values are not JSON compliant: (t ValueErrorR)(R*Rt_reprt_inft_neginfttext((s$/usr/lib64/python2.7/json/encoder.pytfloatstrs       iN(RRRRR R$Rt FLOAT_REPRtINFINITYtc_make_encoderR RR#R"R!Rt_make_iterencode(R%R*R+tmarkersR7R?t _iterencode((s$/usr/lib64/python2.7/json/encoder.pyR.s*    N( t__name__t __module__t__doc__R!R"tFalseR/RR'R#R5R.(((s$/usr/lib64/python2.7/json/encoder.pyRFs >  cs fd fd fdS(Nc 3s8|sdVdSdk rO |}|krBdn||}|rt}n|} |r||Vq|dkr|dVq|tkr|dVq|tkr1|d Vq | frX||Vq | ry||Vq|V |fr||}n0 | r||}n||}x|D] } | VqWqW|dk r|d8}dd|Vnd Vdk r4|=ndS( Ns[]sCircular reference detectedt[is t tnullttruetfalset](RR/RI( tlstt_current_indent_leveltmarkeridtbuftnewline_indentt separatortfirsttvalueR4tchunk(R:R7t _floatstrt_indentt_item_separatorREt_iterencode_dictt_iterencode_listR-tdicttfloattidtintRR0tlongRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR] s^                     c 3s|sdVdSdk rO|}|krBdn||iR,RMRNRLskey s is not a stringt}(RR/tsortedtitemst iteritemsRIR(R)( tdctRQRRRTR!RVRiRdRWR4RX(R:R7RYRZR[RER\R]t_key_separatort _skipkeyst _sort_keysR-R^R_R`RaRR0RbRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR\Us                        c3s |r|Vne|dkr1dVnQ|tkrEdVn=|tkrYdVn) | fr||Vn | r|Vn | frx||D] }|VqWn |rx||D] }|VqWndk rA |}|kr4dn||sN      #    decoder.pyo000064400000027270152462727600006725 0ustar00 {fc@sdZddlZddlZddlZddlmZyddlmZWne k rgdZnXdgZ ej ej BejBZdZe\ZZZdZddZied 6ed 6ed 6Zejd eZid d6dd6dd6dd6dd6dd6dd6dd6ZdZdZdeeejdZepSeZejd eZd!Z eje d"Z!eje d#Z"de#fd$YZ$dS(%sImplementation of JSONDecoder iN(tscanner(t scanstringt JSONDecodercCs8tjdd\}tjdd\}||| fS(Ns>dss(tstructtunpack(tnantinf((s$/usr/lib64/python2.7/json/decoder.pyt_floatconstantsscCsU|jdd|d}|dkr2|d}n||jdd|}||fS(Ns ii(tcounttrindex(tdoctpostlinenotcolno((s$/usr/lib64/python2.7/json/decoder.pytlinecols   c Cswt||\}}|dkr=d}|j||||St||\}}d}|j|||||||S(Ns#{0}: line {1} column {2} (char {3})s?{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})(RtNonetformat( tmsgR R tendR R tfmtt endlinenotendcolno((s$/usr/lib64/python2.7/json/decoder.pyterrmsg"s s -InfinitytInfinitytNaNs(.*?)(["\\\x00-\x1f])u"t"u\s\u/t/utbu tfu tnu tru ttsutf-8cCs||d|d!}t|dkr_|ddkr_yt|dSWq_tk r[q_Xnd}tt|||dS(NiiitxXisInvalid \uXXXX escape(tlentintt ValueErrorR(tsR tescR((s$/usr/lib64/python2.7/json/decoder.pyt _decode_uXXXX?s" cCs|dkrt}ng}|j}|d}xO|||} | dkrgttd||n| j}| j\} } | rt| tst| |} n|| n| dkrPnL| dkr|rdj | } tt| ||q|| q1ny||} Wn)t k rNttd||nX| dkry|| }Wn9t k rdt | } tt| ||nX|d7}nt ||}|d7}tjd krfd |kod knrf|||d !d krft ||d}d|ko7dknrfd|d d>|dB}|d7}qfnt|}||q1Wdj||fS(sScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.isUnterminated string starting atRs\s"Invalid control character {0!r} attusInvalid \escape: iiiiis\uiiii iuN(RtDEFAULT_ENCODINGtappendR#RRtgroupst isinstancetunicodeRt IndexErrortKeyErrortreprR&tsyst maxunicodetunichrtjoin(R$Rtencodingtstrictt_bt_mtchunkst_appendtbegintchunktcontentt terminatorRR%tchartunituni2((s$/usr/lib64/python2.7/json/decoder.pyt py_scanstringIs^               3 s [ \t\n\r]*s cCs|\}} g} | j} || | d!} | dkr| |krm||| j} || | d!} n| dkr|dk r|| } | | dfSi} |dk r|| } n| | dfS| dkrttd|| qn| d7} xtrt|| ||\}} || | d!dkr||| j} || | d!dkrttd|| qn| d7} yM|| |kr| d7} || |kr||| dj} qnWntk rnXy||| \}} Wn)tk r6ttd|| nX| ||fy@|| } | |kr||| dj} || } nWntk rd} nX| d7} | dkrPn+| d krttd || dnyc|| } | |krH| d7} || } | |krH||| dj} || } qHnWntk rbd} nX| d7} | dkrttd|| dqqW|dk r|| } | | fSt | } |dk r|| } n| | fS( NiRt}s1Expecting property name enclosed in double quotest:sExpecting ':' delimitersExpecting objecttt,sExpecting ',' delimiter( R)RRR#RtTrueRR-t StopIterationtdict(t s_and_endR4R5t scan_oncet object_hooktobject_pairs_hookt_wt_wsR$Rtpairst pairs_appendtnextchartresulttkeytvalue((s$/usr/lib64/python2.7/json/decoder.pyt JSONObjects             #                       c Cs|\}}g}|||d!}||kr\|||dj}|||d!}n|dkrv||dfS|j}xEtry|||\} }Wn)tk rttd||nX|| |||d!}||kr!|||dj}|||d!}n|d7}|dkr;Pn'|dkrbttd||nyM|||kr|d7}|||kr|||dj}qnWqtk rqXqW||fS(Nit]sExpecting objectREsExpecting ',' delimiter(RR)RFRGR#RR-( RIRJRMRNR$RtvaluesRQR9RT((s$/usr/lib64/python2.7/json/decoder.pyt JSONArrays@            # cBsGeZdZdddddeddZejdZddZ RS(sSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | unicode | +---------------+-------------------+ | number (int) | int, long | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. cCs||_||_||_|p$t|_|p3t|_|pEtj|_ ||_ t |_ t |_t|_tj||_dS(s``encoding`` determines the encoding used to interpret any ``str`` objects decoded by this instance (utf-8 by default). It has no effect when decoding ``unicode`` objects. Note that currently only encodings that are a superset of ASCII work, strings of other encodings should be passed in as ``unicode``. ``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N(R4RKRLtfloatt parse_floatR"t parse_intt _CONSTANTSt __getitem__tparse_constantR5RUt parse_objectRXt parse_arrayRt parse_stringRt make_scannerRJ(tselfR4RKRZR[R^R5RL((s$/usr/lib64/python2.7/json/decoder.pyt__init__.s-       cCsy|j|d||dj\}}|||j}|t|kruttd||t|n|S(szReturn the Python representation of ``s`` (a ``str`` or ``unicode`` instance containing a JSON document) tidxis Extra data(t raw_decodeRR!R#R(RcR$RMtobjR((s$/usr/lib64/python2.7/json/decoder.pytdecodegs *$icCsFy|j||\}}Wntk r;tdnX||fS(sLDecode a JSON document from ``s`` (a ``str`` or ``unicode`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. sNo JSON object could be decoded(RJRGR#(RcR$ReRgR((s$/usr/lib64/python2.7/json/decoder.pyRfrs  N( t__name__t __module__t__doc__RRFRdt WHITESPACEtmatchRhRf(((s$/usr/lib64/python2.7/json/decoder.pyRs    7 (%RktreR0RtjsonRt_jsonRt c_scanstringt ImportErrorRt__all__tVERBOSEt MULTILINEtDOTALLtFLAGSRRtPosInftNegInfRRR\tcompilet STRINGCHUNKt BACKSLASHR(R&RFRmRARltWHITESPACE_STRRURXtobjectR(((s$/usr/lib64/python2.7/json/decoder.pyts@         & E W$encoder.pyo000064400000032631152462727600006734 0ustar00 {fc @sdZddlZyddlmZWnek r?dZnXyddlmZWnek rmdZnXej dZ ej dZ ej dZ idd 6d d 6d d 6dd6dd6dd6dd6Z x3edD]%Ze jeedjeqWedZejZdZdZep8eZdefdYZeeeeeee e!e"e#e$d Z%dS(sImplementation of JSONEncoder iN(tencode_basestring_ascii(t make_encoders[\x00-\x1f\\"\b\f\n\r\t]s([\\"]|[^\ -~])s [\x80-\xff]s\\s\s\"t"s\bss\fs s\ns s\rs s\ts i s \u{0:04x}tinfcCs!d}dtj||dS(s5Return a JSON representation of a Python string cSst|jdS(Ni(t ESCAPE_DCTtgroup(tmatch((s$/usr/lib64/python2.7/json/encoder.pytreplace%sR(tESCAPEtsub(tsR((s$/usr/lib64/python2.7/json/encoder.pytencode_basestring!s cCs]t|tr6tj|dk r6|jd}nd}dttj||dS(sAReturn an ASCII-only JSON representation of a Python string sutf-8cSs|jd}y t|SWnptk rt|}|dkrPdj|S|d8}d|d?d@B}d|d@B}dj||SnXdS( Niis \u{0:04x}ii iis\u{0:04x}\u{1:04x}(RRtKeyErrortordtformat(RR tnts1ts2((s$/usr/lib64/python2.7/json/encoder.pyR0s      RN(t isinstancetstrtHAS_UTF8tsearchtNonetdecodet ESCAPE_ASCIIR (R R((s$/usr/lib64/python2.7/json/encoder.pytpy_encode_basestring_ascii*s$ t JSONEncoderc Bs\eZdZdZdZeeeeeddddd ZdZ dZ edZ RS( sZExtensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str, unicode | string | +-------------------+---------------+ | int, long, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). s, s: sutf-8c Cs|||_||_||_||_||_||_|dk rW|\|_|_n| dk ro| |_ n||_ dS(s Constructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, long, float or None. If skipkeys is True, such items are simply skipped. If *ensure_ascii* is true (the default), all non-ASCII characters in the output are escaped with \uXXXX sequences, and the results are str instances consisting of ASCII characters only. If ensure_ascii is False, a result may be a unicode instance. This usually happens if the input contains unicode strings or the *encoding* parameter is used. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an OverflowError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. Since the default item separator is ', ', the output might include trailing whitespace when indent is specified. You can use separators=(',', ': ') to avoid this. If specified, separators should be a (item_separator, key_separator) tuple. The default is (', ', ': '). To get the most compact JSON representation you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. If encoding is not None, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is UTF-8. N( tskipkeyst ensure_asciitcheck_circulart allow_nant sort_keystindentRtitem_separatort key_separatortdefaulttencoding( tselfRRRRRR t separatorsR$R#((s$/usr/lib64/python2.7/json/encoder.pyt__init__es4         cCstt|ddS(slImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o) s is not JSON serializableN(t TypeErrortrepr(R%to((s$/usr/lib64/python2.7/json/encoder.pyR#scCst|trut|trU|j}|dk rU|dk rU|j|}qUn|jrht|St|Sn|j |dt }t|t t fst |}ndj |S(sReturn a JSON string representation of a Python data structure. >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' sutf-8t _one_shottN(Rt basestringRR$RRRRR t iterencodetTruetlistttupletjoin(R%R*t _encodingtchunks((s$/usr/lib64/python2.7/json/encoder.pytencodes      c Cs|jri}nd}|jr*t}nt}|jdkrT||jd}n|jttt d}|rt dk r|j dkr|j rt ||j ||j |j |j|j |j|j }n9t||j ||j ||j |j|j |j| }||dS(sEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) sutf-8cSs+t|tr!|j|}n||S(N(RRR(R*t _orig_encoderR3((s$/usr/lib64/python2.7/json/encoder.pyt_encoderscSsl||krd}n4||kr*d}n||kr?d}n ||S|shtdt|n|S(NtNaNtInfinitys -Infinitys2Out of range float values are not JSON compliant: (t ValueErrorR)(R*Rt_reprt_inft_neginfttext((s$/usr/lib64/python2.7/json/encoder.pytfloatstrs       iN(RRRRR R$Rt FLOAT_REPRtINFINITYtc_make_encoderR RR#R"R!Rt_make_iterencode(R%R*R+tmarkersR7R?t _iterencode((s$/usr/lib64/python2.7/json/encoder.pyR.s*    N( t__name__t __module__t__doc__R!R"tFalseR/RR'R#R5R.(((s$/usr/lib64/python2.7/json/encoder.pyRFs >  cs fd fd fdS(Nc 3s8|sdVdSdk rO |}|krBdn||}|rt}n|} |r||Vq|dkr|dVq|tkr|dVq|tkr1|d Vq | frX||Vq | ry||Vq|V |fr||}n0 | r||}n||}x|D] } | VqWqW|dk r|d8}dd|Vnd Vdk r4|=ndS( Ns[]sCircular reference detectedt[is t tnullttruetfalset](RR/RI( tlstt_current_indent_leveltmarkeridtbuftnewline_indentt separatortfirsttvalueR4tchunk(R:R7t _floatstrt_indentt_item_separatorREt_iterencode_dictt_iterencode_listR-tdicttfloattidtintRR0tlongRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR] s^                     c 3s|sdVdSdk rO|}|krBdn||iR,RMRNRLskey s is not a stringt}(RR/tsortedtitemst iteritemsRIR(R)( tdctRQRRRTR!RVRiRdRWR4RX(R:R7RYRZR[RER\R]t_key_separatort _skipkeyst _sort_keysR-R^R_R`RaRR0RbRDRR1(s$/usr/lib64/python2.7/json/encoder.pyR\Us                        c3s |r|Vne|dkr1dVnQ|tkrEdVn=|tkrYdVn) | fr||Vn | r|Vn | frx||D] }|VqWn |rx||D] }|VqWndk rA |}|kr4dn||sN      #    __init__.pyc000064400000033146152462727600007042 0ustar00 {fc@s,dZdZddddddgZdZd d lmZd d lmZed ed e de de ddddddddZ ee e e ddddded Z ee e e ddddded Z eddddddZddddddddZddddddddZdS(s JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is the externally maintained version of the :mod:`json` library contained in Python 2.6, but maintains compatibility with Python 2.4 and Python 2.5 and (currently) has significant performance advantages, even without using the optional C extension for speedups. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print json.dumps("\"foo\bar") "\"foo\bar" >>> print json.dumps(u'\u1234') "\u1234" >>> print json.dumps('\\') "\\" >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) {"a": 0, "b": 0, "c": 0} >>> from StringIO import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, ... indent=4, separators=(',', ': ')) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' True >>> from StringIO import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(repr(obj) + " is not JSON serializable") ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) s2.0.9tdumptdumpstloadtloadst JSONDecodert JSONEncodersBob Ippolito i(R(Rtskipkeyst ensure_asciitcheck_circulart allow_nantindentt separatorstencodingsutf-8tdefaultc Ks| ru|ru|ru|ru|d kru|d kru|d kru| dkru| d kru| ru| rutj|} n`|d krt}n|d|d|d|d|d|d|d| d | d | | j|} x| D]}|j|qWd S( s Serialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is true (the default), all non-ASCII characters in the output are escaped with ``\uXXXX`` sequences, and the result is a ``str`` instance consisting of ASCII characters only. If ``ensure_ascii`` is false, some chunks written to ``fp`` may be ``unicode`` instances. This usually happens because the input contains unicode strings or the ``encoding`` parameter is used. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter``) this is likely to cause an error. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. sutf-8RRRR R R R R t sort_keysN(tNonet_default_encodert iterencodeRtwrite(tobjtfpRRRR tclsR R R R Rtkwtiterabletchunk((s%/usr/lib64/python2.7/json/__init__.pyRzs5  $&    c Ks| rp|rp|rp|rp|d krp|d krp|d krp|dkrp| d krp| rp| rptj|S|d krt}n|d|d|d|d|d|d|d|d | d | | j|S( sSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and the return value may be a ``unicode`` instance. See ``dump`` for details. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``OverflowError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. Since the default item separator is ``', '``, the output might include trailing whitespace when ``indent`` is specified. You can use ``separators=(',', ': ')`` to avoid this. If ``separators`` is an ``(item_separator, dict_separator)`` tuple then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. ``encoding`` is the character encoding for str instances, default is UTF-8. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. sutf-8RRRR R R R R RN(RRtencodeR( RRRRR RR R R R RR((s%/usr/lib64/python2.7/json/__init__.pyRs/  $&    t object_hooktobject_pairs_hookc Ks=t|jd|d|d|d|d|d|d||S(sDeserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. If the contents of ``fp`` is encoded with an ASCII based encoding other than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must be specified. Encodings that are not ASCII based (such as UCS-2) are not allowed, and should be wrapped with ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` object and passed to ``loads()`` ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders that rely on the order that the key and value pairs are decoded (for example, collections.OrderedDict will remember the order of insertion). If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. R RRt parse_floatt parse_inttparse_constantR(Rtread( RR RRRRRRR((s%/usr/lib64/python2.7/json/__init__.pyRs   c Ks|dkrh|dkrh|dkrh|dkrh|dkrh|dkrh|dkrh| rhtj|S|dkr}t}n|dk r||dcs6     E  ;  # __pycache__/__init__.cpython-312.pyc000064400000032461152463413030013225 0ustar00 Th6 dZdZgdZdZddlmZmZddlmZddl Z ed d d d ddd Z d d d d ddddd d d Z d d d d ddddd d dZ eddZ dZddddddddZddddddddZy)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> mydict = {'4': 5, '6': 7} >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(f'Object of type {obj.__class__.__name__} ' ... f'is not JSON serializable') ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9)dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r rclsrrr sort_keysc |s(|r&|r$|r"| ||| | s| stj|} n(|t}|d||||||| | d| j|} | D]} |j| y)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. Nr r r rrrrr)_default_encoder iterencoderwrite)objfpr r r rrrrrrkwiterablechunks &/usr/lib64/python3.12/json/__init__.pyrrxsZ 9 :+= "#..s3 ;C8|)Yv!y85789C 3   c |s'|r%|r#|r!||||| s| stj|S|t}|d|||||||| d| j|S)avSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. rr)rencoder) rr r r rrrrrrrs rrrs{X 9 :+= "&&s++ {   %6w)   fSk r ) object_hookobject_pairs_hookcz|j}|tjtjfry|tjtj fry|tj ryt|dk\r"|ds |drdSdS|ds|d s|d rd Sd Sy t|d k(r |dsy|dsy y )Nzutf-32zutf-16z utf-8-sigr r z utf-16-bez utf-32-bez utf-16-lez utf-32-lezutf-8) startswithcodecs BOM_UTF32_BE BOM_UTF32_LE BOM_UTF16_BE BOM_UTF16_LEBOM_UTF8len)b bstartswiths rdetect_encodingr3s,,KF'')<)<=>F'')<)<=>6??# 1v{t#$A$; 7K 7t#$A$!A$; ?K ?  Q1tt r rr# parse_float parse_intparse_constantr$c Dt|jf||||||d|S)aDeserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. r4)rread)rrr#r5r6r7r$rs rrrs>&  R [9%9J ROQ RRr c t|tr|jdr`td|dt|tt fs"t d|jj|jt|d}|!||||||stj|S|t}|||d<|||d<|||d<|||d <|||d <|d i|j|S) aRDeserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. uz-Unexpected UTF-8 BOM (decode using utf-8-sig)r z5the JSON object must be str, bytes or bytearray, not surrogatepassr#r$r5r6r7r) isinstancestrr)rbytes bytearray TypeError __class____name__decoder3_default_decoderr)srr#r5r6r7r$rs rrr+s#D!S << !!"Q"#Q( (!eY/0##$;;#7#7"8:; ; HH_Q' 9 +  +"5  "'8'@&&q)) {'=$"3 '=#;!-  99  A r )__doc__ __version____all__ __author__decoderrrencoderrr*rrrrDr3rrrr rrLs`B   - 1    $$tD$<~!tDD$7t44H<dttR2dtt<r __pycache__/decoder.cpython-312.opt-2.pyc000064400000023355152463413030014035 0ustar00 Th0  ddlZddlmZ ddlmZddgZejejzejzZ e dZ e dZe dZGd deZeee d Zej&d e Zej&d e Zd ddddddddZej.fdZdeej.fdZexseZej&de ZdZdej.efdZej.efdZGddeZy#e$rdZYwxYw)N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infceZdZ dZdZy)rc|jdd|dz}||jdd|z }d||||fz}tj||||_||_||_||_||_y)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgs %/usr/lib64/python3.12/json/decoder.pyrzJSONDecodeError.__init__sv4C(1,ciia--2c65#5NND&)  c`|j|j|j|jffSN) __class__rrr)rs r __reduce__zJSONDecodeError.__reduce__*s$~~$((DHH===rN)__name__ __module__ __qualname__rrrrrrs >r)z -InfinityInfinityNaNz[0-9A-Fa-f]{4}z(.*?)(["\\\x00-\x1f])"\/ r   )r$r%r&bfnrtc|||dz}| t|jdSd}t|||#t$rYwxYw)Nr zInvalid \uXXXX escape)intgrouprr)sr_mescrs r _decode_uXXXXr7<sX Qa.C  syy{B' ' #C #q# &&   s9 AATc g}|j}|dz } |||}| td|||j}|j\} } | r|| | dk(rn| dk7r)|rdj | } t| |||| z ||} | dk7r || } |dz }nht||}|dz }d |cxkrd krAnn>|||d zd k(r3t||dz}d |cxkrdkrnnd|d z dz|d z zz}|dz }t|} || dj||fS#t $rtd||dwxYw#t $rdj | } t| ||wxYw)Nr zUnterminated string starting atr$r%z"Invalid control character {0!r} atuzInvalid \escape: {0!r}iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr7chrjoin)r4r@strict_br5chunks_appendbeginchunkcontent terminatorrr6charuniuni2s r py_scanstringrRFsFmmG !GE 1c  =!"CQN Niik#lln  G     4 :AA*M%c1c22 # 6C&C #: 3#w 1HC3'C 1HC&&1Sq>U+B$Qa0T+V+!sV|&:tf}%MNC1HCs8D W X 776?C + 6!"C"#U,15 6 6 3/66s;%c1c22 3sD+E+E(E.z [ \t\n\r]*z cL|\}} g} | j} |i}|j} || | dz} | dk7r^| |vr||| j} || | dz} | dk(r$||| }|| dzfSi} ||| } | | dzfS| dk7r td|| | dz } t || |\}} | ||}|| | dzdk7r/||| j} || | dzdk7r td|| | dz } || |vr&| dz } || |vr||| dzj} ||| \}} | ||f || } | |vr||| dzj} || } | dz } | dk(rnP| d k7rtd || dz ||| j} || | dz} | dz } | dk7rtd|| dz !| || }|| fSt| } ||| } | | fS#t $rYwxYw#t $r}td||jdd}~wwxYw#t $rd} YwxYw) Nr r$}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer>,Expecting ',' delimiter) r? setdefaultr@rrrC StopIterationvaluedict) s_and_endrG scan_once object_hookobject_pairs_hookmemo_w_wsr4r@pairs pairs_appendmemo_getnextcharresultkeyr[errs r JSONObjectrks FAs E< ! _!CQM M1HC af-SsC  Sq>S Q*.."CS1W~$%&?CHH q v}qS6S=Qa.,,.C M"1c*JE3 c5\" vH3C!Gn((*S6 q s?  _!";QaH HCjnnSq> q s?!CQaQ QS V$"5)s{ KEE" #:C     M!"3Q B L M H s<.-G G,3(H G)(G), H5H  H H#"H#c:|\}}g}|||dz}||vr"|||dzj}|||dz}|dk(r||dzfS|j} |||\} }|| |||dz}||vr"|||dzj}|||dz}|dz }|dk(r ||fS|dk7rtd||dz  |||vr&|dz }|||vr|||dzj}#t$r} td|| jdd} ~ wwxYw#t $rY5wxYw)Nr ]rVrWrX)r@r?rZrr[rC) r]r^rbrcr4r@valuesrgrJr[rjs r JSONArrayros FAs FS1W~H3C!Gn  "Sq>3sQwmmG  M"1c*JE3 Sq> s?Qa.$$&CS1W~H q s?  3;_!";QaH H v}qS6S=Qa.,,.C'  M!"3Q B L M"   s* C%7-D% D .DD  DDcJeZdZ ddddddddZej fdZddZy)rNT)r_ parse_float parse_intparse_constantrGr`c" ||_|xst|_|xst|_|xst j |_||_||_ t|_ t|_ t|_i|_t#j$||_yr)r_floatrqr2rr _CONSTANTS __getitem__rsrGr`rk parse_objectro parse_arrayr parse_stringrar make_scannerr^)rr_rqrrrsrGr`s rrzJSONDecoder.__init__s~ @'&/%")c,F 0F0F !2&$&  --d3rc |j|||dj\}}|||j}|t|k7r td|||S)Nr)idxz Extra data) raw_decoder@lenr)rr4rbobjr@s rdecodezJSONDecoder.decodeMs\ ??1"Q(,,.?9SCjnn #a&=!,37 7 rc |j||\}}||fS#t$r}td||jdd}~wwxYw)NrV)r^rZrr[)rr4r}rr@rjs rr~zJSONDecoder.raw_decodeXsV  M~~a-HCCx M!"3Q B L Ms A=A)r)rrr r WHITESPACEmatchrr~r!rrrrs3:'+4"-4`&++  r) rejsonr_jsonr c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrur#PosInfNegInfrrrvcompile HEXDIGITS STRINGCHUNK BACKSLASHrr7rRrWHITESPACE_STRrkroobjectrr!rrrsO 0 + , R\\!BII- El u v>j>6   BJJ(% 0 bjj159 Ds Dt$T  '__'"& **9 z *] RZZ u - Z-->Ob(2'7'7^"Jf&foLsC??D D __pycache__/tool.cpython-312.opt-2.pyc000064400000007630152463413030013403 0ustar00 Th  ddlZddlZddlZddlmZdZedk(r eyy#e$r&ZejejYdZ[ydZ[wwxYw)N)Pathcd}d}tj||}|jddtjddtj |jd dt d d |jd d dd|jdddd|jdd dd|j}|jddtd|jddddd !|jd"dddd#!|jd$d d%&|j}|j|j|jd'}|jr d|d<d(|d)<|j5} |jr d*|D}nt!j"|f}|j$tj&}n|j$j)d+d}|5} |D]*} t!j*| | fi|| j-d,, ddddddy#1swYxYw#t.$r} t1| d} ~ wwxYw#1swYyxYw)-Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilez%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z--no-ensure-ascii ensure_ascii store_falsez(disable escaping of non-ASCII characters)destrr z --json-linesznparse input using the JSON Lines format. Use with --no-indent or --compact to produce valid JSON Lines output.z--indentzJseparate items with newlines and use this number of spaces for indentation)r r r z--tab store_constindent z9separate items with newlines and use tabs for indentation)rrconstr z --no-indentz/separate items with spaces rather than newlinesz --compactz1suppress all whitespace separation (most compact))rr ) sort_keysrr),: separatorsc3FK|]}tj|yw)N)jsonloads).0lines "/usr/lib64/python3.12/json/tool.py zmain..AsrJs^  ; | z  s&AA  A__pycache__/encoder.cpython-312.opt-2.pyc000064400000025051152463413030014042 0ustar00 Th>  ddlZ ddlmZ ddlmZ ddlmZejdZ ejdZ ejdZ dd d d d d ddZ edD])Ze j!eedj%e+[edZdZexseZdZexseZGddeZeeeeeeeee ejBf dZ"y#e$rdZYwxYw#e$rdZYwxYw#e$rdZYwxYw)N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infcB d}dtj||zdzS)Nc2t|jdS)Nr) ESCAPE_DCTgroup)matchs %/usr/lib64/python3.12/json/encoder.pyreplacez%py_encode_basestring..replace)s%++a.))r)ESCAPEsubsrs rpy_encode_basestringr%s'* GQ' '# --rcB d}dtj||zdzS)Nc|jd} t|S#t$rPt|}|dkrdj |cYS|dz}d|dz dzz}d|dzz}dj ||cYSwxYw) Nriri iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2s rrz+py_encode_basestring_ascii..replace5s KKN =a=  =AA7{#**1--W R501q5y)-44R<< =s*A5*A54A5r) ESCAPE_ASCIIrrs rpy_encode_basestring_asciir'1s+= !!'1- - 33rc DeZdZ dZdZddddddddddZdZd Zd d Zy) JSONEncoderz, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc ||_||_||_||_||_||_||\|_|_n |d|_|||_yy)N,) r*r+r,r-r.r/item_separator key_separatorr1) selfr*r+r,r-r.r/r0r1s r__init__zJSONEncoder.__init__isl& P! (,""  !6@ 3D !3  "%D   "DL rcJ td|jjd)NzObject of type z is not JSON serializable) TypeError __class____name__)r6os rr1zJSONEncoder.defaults2 $/!++*>*>)?@345 5rc t|tr"|jr t|St |S|j |d}t|t tfs t |}dj|S)NT) _one_shot) isinstancestrr+rr iterencodelisttuplejoin)r6r<chunkss rencodezJSONEncoder.encodesk  a   .q11(++d3&4-0&\Fwwvrc 8 |jri}nd}|jrt}nt}|jt j tt fd}|rltf|jZt||j||j|j|j|j|j|j }nPt||j||j||j|j|j|j| }||dS)Ncx||k7rd}n||k(rd}n||k(rd}n||S|stdt|z|S)NNaNInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r<r-_repr_inf_neginftexts rfloatstrz(JSONEncoder.iterencode..floatstrsW Avd!g"Qx HGKrr)r,r+rrr-float__repr__INFINITYc_make_encoderr/r1r5r4r.r*_make_iterencode)r6r<r>markers_encoderrR _iterencodes rrBzJSONEncoder.iterencodes    GG   .H(H"&..nn8hY . .4KK'(x""D$7$7 t~~/K +xh""D$7$7 y*K1a  r)F) r; __module__ __qualname__r4r5r7r1rGrBrrr)r)Js;8NM#(t45D$6#p5,,5!rr)c sdz  fd  fd  fdS)N c38K|sdy|}|vr d||<d} |dz }d |zz}|z}||z }nd}}d}|D]}|rd}n|}|r| |z!||dz+|dur|d z7|dur|d zC|r| |zZ|r| |zq||fr ||}n|r ||}n ||}|Ed{||dz}d |zzd =yy7"w) Nz[]Circular reference detected[r TFnulltruefalse]r])lst_current_indent_levelmarkeridbufnewline_indent separatorfirstvaluerFrLrY _floatstr_indent_intstr_item_separatorrZ_iterencode_dict_iterencode_listdictrSidintr@rCrXrArDs rruz*_make_iterencode.._iterencode_listsJ   #wH7" !>?? #GH    !Q & !!G.C$CCN'.8I > !C!N'IE%%HUO++Fl"$Fl"%Gm#E3'GEN**E5)Ie,,, edE]3-e5JKFt,-e5JKF(0EFF!!!;<  % !Q & !#888 8  !  "sC2D5D6#Dc3\K|sdy|}|vr d||<d |dz }d |zz}|z}|nd}}d}rt|j}n|j}|D]\}}|rn\|r  |}nJ|durd}nC|durd }n<|d }n7|r |}n%rKtd |jj|rd}n| ||r  ||d |durd|durd |r ||r  ||fr ||} n|r ||} n ||} | Ed{||dz}d |zzd =yy7#w) Nz{}ra{rcr TreFrfrdz0keys must be str, int, float, bool or None, not })sorteditemsr9r:r;)dctrirjrlr4rnr}keyrorFrLrYrprqrrrsrZrtru_key_separator _skipkeys _sort_keysrvrSrwrxr@rCrXrArDs rrtz*_make_iterencode.._iterencode_dictNs?J   #wH7" !>?? #GH    !Q & !!G.C$CCN,~=N !N,N 399;'EIIKEJC#s#C'nC%cl#''*}}'='=&>!@AA$$3-  %%uo% $ % E3'en$E5)&&edE]3-e5JKFt,-e5JKF(0EFF!!!c d  % !Q & !#888 8  !  "sFF,F*$F,c3K|r |y|dy|durdy|durdy|r |y| r |y|fr ||Ed{y| r ||Ed{y |}|vrd||<|}||Ed{=yy7[7B7w)NrdTreFrfrar])r<rirjrL_defaultrYrprrrZrtrurvrSrwrxr@rCrXrArDs rrZz%_make_iterencode.._iterencodes  a 1+  YL $YL %ZM 3 !*  5 !A,  D%= )'+@A A A 4 '+@A A A"a5w&$%BCC$%! A"1&;< < <"H%# B A =s6A-C0C 1C C 4CC CCCr])rXrrYrqrprrsrrr>rLrvrSrwrxr@rCrArDrrrZrtrus````````` ``````````@@@rrWrWs_:gs#;-6"6"6"pN"N"N"N"`&&&: r)#re_jsonrc_encode_basestring_ascii ImportErrorrc_encode_basestringrrVcompilerr&HAS_UTF8rrangei setdefaultchrr"rSrUrr'objectr)rLrvrwrxr@rCrArDrTrWr]rrrsV %J>4 / 0rzz,- 2::n %         tA#a&,"5"5a"89  <.)@,@4.;!;x!&x!z     w{% $%Ns3CCC(CCC%$C%(C21C2__pycache__/encoder.cpython-312.pyc000064400000035362152463413030013110 0ustar00 Th> dZddlZ ddlmZ ddlmZ ddlmZ ejdZ ejdZ ejdZ d d d d d dddZedD])Zej#eedj'e+[edZdZexseZdZexseZGddeZeeeeeeee e!ejDf dZ#y#e$rdZYwxYw#e$rdZYwxYw#e$rdZ YwxYw)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infc@d}dtj||zdzS)z5Return a JSON representation of a Python string c2t|jdS)Nr) ESCAPE_DCTgroup)matchs %/usr/lib64/python3.12/json/encoder.pyreplacez%py_encode_basestring..replace)s%++a.))r)ESCAPEsubsrs rpy_encode_basestringr%s"* GQ' '# --rc@d}dtj||zdzS)zAReturn an ASCII-only JSON representation of a Python string c|jd} t|S#t$rPt|}|dkrdj |cYS|dz}d|dz dzz}d|dzz}dj ||cYSwxYw) Nriri iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2s rrz+py_encode_basestring_ascii..replace5s KKN =a=  =AA7{#**1--W R501q5y)-44R<< =s*A5*A54A5r) ESCAPE_ASCIIrrs rpy_encode_basestring_asciir'1s&= !!'1- - 33rc FeZdZdZdZdZddddddddddZd Zd Zd d Z y) JSONEncodera[Extensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc||_||_||_||_||_||_||\|_|_n |d|_|||_yy)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float, bool or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an RecursionError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r*r+r,r-r.r/item_separator key_separatorr1) selfr*r+r,r-r.r/r0r1s r__init__zJSONEncoder.__init__isgV! (,""  !6@ 3D !3  "%D   "DL rcHtd|jjd)abImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o) zObject of type z is not JSON serializable) TypeError __class____name__)r6os rr1zJSONEncoder.defaults-&/!++*>*>)?@345 5rct|tr"|jr t|St |S|j |d}t|t tfs t |}dj|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr+rr iterencodelisttuplejoin)r6r<chunkss rencodezJSONEncoder.encodesf a   .q11(++d3&4-0&\Fwwvrc 6|jri}nd}|jrt}nt}|jt j tt fd}|rltf|jZt||j||j|j|j|j|j|j }nPt||j||j||j|j|j|j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) Ncx||k7rd}n||k(rd}n||k(rd}n||S|stdt|z|S)NNaNInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r<r-_repr_inf_neginftexts rfloatstrz(JSONEncoder.iterencode..floatstrsW Avd!g"Qx HGKrr)r,r+rrr-float__repr__INFINITYc_make_encoderr/r1r5r4r.r*_make_iterencode)r6r<r>markers_encoderrR _iterencodes rrBzJSONEncoder.iterencodes   GG   .H(H"&..nn8hY . .4KK'(x""D$7$7 t~~/K +xh""D$7$7 y*K1a  r)F) r; __module__ __qualname____doc__r4r5r7r1rGrBrrr)r)Js;8NM#(t45D$6#p5,,5!rr)c sdz  fd  fd  fdS)N c38K|sdy|}|vr d||<d} |dz }d |zz}|z}||z }nd}}d}|D]}|rd}n|}|r| |z!||dz+|dur|d z7|dur|d zC|r| |zZ|r| |zq||fr ||}n|r ||}n ||}|Ed{||dz}d |zzd =yy7"w) Nz[]Circular reference detected[r TFnulltruefalse]r^)lst_current_indent_levelmarkeridbufnewline_indent separatorfirstvaluerFrLrY _floatstr_indent_intstr_item_separatorrZ_iterencode_dict_iterencode_listdictrSidintr@rCrXrArDs rrvz*_make_iterencode.._iterencode_listsJ   #wH7" !>?? #GH    !Q & !!G.C$CCN'.8I > !C!N'IE%%HUO++Fl"$Fl"%Gm#E3'GEN**E5)Ie,,, edE]3-e5JKFt,-e5JKF(0EFF!!!;<  % !Q & !#888 8  !  "sC2D5D6#Dc3\K|sdy|}|vr d||<d |dz }d |zz}|z}|nd}}d}rt|j}n|j}|D]\}}|rn\|r  |}nJ|durd}nC|durd }n<|d }n7|r |}n%rKtd |jj|rd}n| ||r  ||d |durd|durd |r ||r  ||fr ||} n|r ||} n ||} | Ed{||dz}d |zzd =yy7#w) Nz{}rb{rdr TrfFrgrez0keys must be str, int, float, bool or None, not })sorteditemsr9r:r;)dctrjrkrmr4ror~keyrprFrLrYrqrrrsrtrZrurv_key_separator _skipkeys _sort_keysrwrSrxryr@rCrXrArDs rruz*_make_iterencode.._iterencode_dictNs?J   #wH7" !>?? #GH    !Q & !!G.C$CCN,~=N !N,N 399;'EIIKEJC#s#C'nC%cl#''*}}'='=&>!@AA$$3-  %%uo% $ % E3'en$E5)&&edE]3-e5JKFt,-e5JKF(0EFF!!!c d  % !Q & !#888 8  !  "sFF,F*$F,c3K|r |y|dy|durdy|durdy|r |y| r |y|fr ||Ed{y| r ||Ed{y |}|vrd||<|}||Ed{=yy7[7B7w)NreTrfFrgrbr^)r<rjrkrL_defaultrYrqrsrZrurvrwrSrxryr@rCrXrArDs rrZz%_make_iterencode.._iterencodes  a 1+  YL $YL %ZM 3 !*  5 !A,  D%= )'+@A A A 4 '+@A A A"a5w&$%BCC$%! A"1&;< < <"H%# B A =s6A-C0C 1C C 4CC CCCr^)rXrrYrrrqrrtrrr>rLrwrSrxryr@rCrArDrsrZrurvs````````` ``````````@@@rrWrWs_:gs#;-6"6"6"pN"N"N"N"`&&&: r)$r]re_jsonrc_encode_basestring_ascii ImportErrorrc_encode_basestringrrVcompilerr&HAS_UTF8rrangei setdefaultchrr"rSrUrr'objectr)rLrwrxryr@rCrArDrTrWr^rrrsV %J>4 / 0rzz,- 2::n %         tA#a&,"5"5a"89  <.)@,@4.;!;x!&x!z     w{% $%Ns3CCC)CCC&%C&)C32C3__pycache__/encoder.cpython-312.opt-1.pyc000064400000035362152463413030014047 0ustar00 Th> dZddlZ ddlmZ ddlmZ ddlmZ ejdZ ejdZ ejdZ d d d d d dddZedD])Zej#eedj'e+[edZdZexseZdZexseZGddeZeeeeeeee e!ejDf dZ#y#e$rdZYwxYw#e$rdZYwxYw#e$rdZ YwxYw)zImplementation of JSONEncoder N)encode_basestring_ascii)encode_basestring) make_encoderz[\x00-\x1f\\"\b\f\n\r\t]z([\\"]|[^\ -~])s[-]z\\z\"z\bz\fz\nz\rz\t)\"    \u{0:04x}infc@d}dtj||zdzS)z5Return a JSON representation of a Python string c2t|jdS)Nr) ESCAPE_DCTgroup)matchs %/usr/lib64/python3.12/json/encoder.pyreplacez%py_encode_basestring..replace)s%++a.))r)ESCAPEsubsrs rpy_encode_basestringr%s"* GQ' '# --rc@d}dtj||zdzS)zAReturn an ASCII-only JSON representation of a Python string c|jd} t|S#t$rPt|}|dkrdj |cYS|dz}d|dz dzz}d|dzz}dj ||cYSwxYw) Nriri iiz\u{0:04x}\u{1:04x})rrKeyErrorordformat)rrns1s2s rrz+py_encode_basestring_ascii..replace5s KKN =a=  =AA7{#**1--W R501q5y)-44R<< =s*A5*A54A5r) ESCAPE_ASCIIrrs rpy_encode_basestring_asciir'1s&= !!'1- - 33rc FeZdZdZdZdZddddddddddZd Zd Zd d Z y) JSONEncodera[Extensible JSON encoder for Python data structures. Supports the following objects and types by default: +-------------------+---------------+ | Python | JSON | +===================+===============+ | dict | object | +-------------------+---------------+ | list, tuple | array | +-------------------+---------------+ | str | string | +-------------------+---------------+ | int, float | number | +-------------------+---------------+ | True | true | +-------------------+---------------+ | False | false | +-------------------+---------------+ | None | null | +-------------------+---------------+ To extend this to recognize other objects, subclass and implement a ``.default()`` method with another method that returns a serializable object for ``o`` if possible, otherwise it should call the superclass implementation (to raise ``TypeError``). z, z: FTN)skipkeys ensure_asciicheck_circular allow_nan sort_keysindent separatorsdefaultc||_||_||_||_||_||_||\|_|_n |d|_|||_yy)aConstructor for JSONEncoder, with sensible defaults. If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float, bool or None. If skipkeys is True, such items are simply skipped. If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters. If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an RecursionError). Otherwise, no such check takes place. If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats. If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. If specified, separators should be an (item_separator, key_separator) tuple. The default is (', ', ': ') if *indent* is ``None`` and (',', ': ') otherwise. To get the most compact JSON representation, you should specify (',', ':') to eliminate whitespace. If specified, default is a function that gets called for objects that can't otherwise be serialized. It should return a JSON encodable version of the object or raise a ``TypeError``. N,) r*r+r,r-r.r/item_separator key_separatorr1) selfr*r+r,r-r.r/r0r1s r__init__zJSONEncoder.__init__isgV! (,""  !6@ 3D !3  "%D   "DL rcHtd|jjd)abImplement this method in a subclass such that it returns a serializable object for ``o``, or calls the base implementation (to raise a ``TypeError``). For example, to support arbitrary iterators, you could implement default like this:: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return super().default(o) zObject of type z is not JSON serializable) TypeError __class____name__)r6os rr1zJSONEncoder.defaults-&/!++*>*>)?@345 5rct|tr"|jr t|St |S|j |d}t|t tfs t |}dj|S)zReturn a JSON string representation of a Python data structure. >>> from json.encoder import JSONEncoder >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}' T) _one_shot) isinstancestrr+rr iterencodelisttuplejoin)r6r<chunkss rencodezJSONEncoder.encodesf a   .q11(++d3&4-0&\Fwwvrc 6|jri}nd}|jrt}nt}|jt j tt fd}|rltf|jZt||j||j|j|j|j|j|j }nPt||j||j||j|j|j|j| }||dS)zEncode the given object and yield each string representation as available. For example:: for chunk in JSONEncoder().iterencode(bigobject): mysocket.write(chunk) Ncx||k7rd}n||k(rd}n||k(rd}n||S|stdt|z|S)NNaNInfinityz -Infinityz2Out of range float values are not JSON compliant: ) ValueErrorrepr)r<r-_repr_inf_neginftexts rfloatstrz(JSONEncoder.iterencode..floatstrsW Avd!g"Qx HGKrr)r,r+rrr-float__repr__INFINITYc_make_encoderr/r1r5r4r.r*_make_iterencode)r6r<r>markers_encoderrR _iterencodes rrBzJSONEncoder.iterencodes   GG   .H(H"&..nn8hY . .4KK'(x""D$7$7 t~~/K +xh""D$7$7 y*K1a  r)F) r; __module__ __qualname____doc__r4r5r7r1rGrBrrr)r)Js;8NM#(t45D$6#p5,,5!rr)c sdz  fd  fd  fdS)N c38K|sdy|}|vr d||<d} |dz }d |zz}|z}||z }nd}}d}|D]}|rd}n|}|r| |z!||dz+|dur|d z7|dur|d zC|r| |zZ|r| |zq||fr ||}n|r ||}n ||}|Ed{||dz}d |zzd =yy7"w) Nz[]Circular reference detected[r TFnulltruefalse]r^)lst_current_indent_levelmarkeridbufnewline_indent separatorfirstvaluerFrLrY _floatstr_indent_intstr_item_separatorrZ_iterencode_dict_iterencode_listdictrSidintr@rCrXrArDs rrvz*_make_iterencode.._iterencode_listsJ   #wH7" !>?? #GH    !Q & !!G.C$CCN'.8I > !C!N'IE%%HUO++Fl"$Fl"%Gm#E3'GEN**E5)Ie,,, edE]3-e5JKFt,-e5JKF(0EFF!!!;<  % !Q & !#888 8  !  "sC2D5D6#Dc3\K|sdy|}|vr d||<d |dz }d |zz}|z}|nd}}d}rt|j}n|j}|D]\}}|rn\|r  |}nJ|durd}nC|durd }n<|d }n7|r |}n%rKtd |jj|rd}n| ||r  ||d |durd|durd |r ||r  ||fr ||} n|r ||} n ||} | Ed{||dz}d |zzd =yy7#w) Nz{}rb{rdr TrfFrgrez0keys must be str, int, float, bool or None, not })sorteditemsr9r:r;)dctrjrkrmr4ror~keyrprFrLrYrqrrrsrtrZrurv_key_separator _skipkeys _sort_keysrwrSrxryr@rCrXrArDs rruz*_make_iterencode.._iterencode_dictNs?J   #wH7" !>?? #GH    !Q & !!G.C$CCN,~=N !N,N 399;'EIIKEJC#s#C'nC%cl#''*}}'='=&>!@AA$$3-  %%uo% $ % E3'en$E5)&&edE]3-e5JKFt,-e5JKF(0EFF!!!c d  % !Q & !#888 8  !  "sFF,F*$F,c3K|r |y|dy|durdy|durdy|r |y| r |y|fr ||Ed{y| r ||Ed{y |}|vrd||<|}||Ed{=yy7[7B7w)NreTrfFrgrbr^)r<rjrkrL_defaultrYrqrsrZrurvrwrSrxryr@rCrXrArDs rrZz%_make_iterencode.._iterencodes  a 1+  YL $YL %ZM 3 !*  5 !A,  D%= )'+@A A A 4 '+@A A A"a5w&$%BCC$%! A"1&;< < <"H%# B A =s6A-C0C 1C C 4CC CCCr^)rXrrYrrrqrrtrrr>rLrwrSrxryr@rCrArDrsrZrurvs````````` ``````````@@@rrWrWs_:gs#;-6"6"6"pN"N"N"N"`&&&: r)$r]re_jsonrc_encode_basestring_ascii ImportErrorrc_encode_basestringrrVcompilerr&HAS_UTF8rrangei setdefaultchrr"rSrUrr'objectr)rLrwrxryr@rCrArDrTrWr^rrrsV %J>4 / 0rzz,- 2::n %         tA#a&,"5"5a"89  <.)@,@4.;!;x!&x!z     w{% $%Ns3CCC)CCC&%C&)C32C3__pycache__/tool.cpython-312.opt-1.pyc000064400000010271152463413030013375 0ustar00 Th dZddlZddlZddlZddlmZdZedk(r eyy#e$r&Z eje jYdZ [ ydZ [ wwxYw)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) N)Pathcd}d}tj||}|jddtjddtj |jd dt d d |jd d dd|jdddd|jdd dd|j}|jddtd|jddddd !|jd"dddd#!|jd$d d%&|j}|j|j|jd'}|jr d|d<d(|d)<|j5} |jr d*|D}nt!j"|f}|j$tj&}n|j$j)d+d}|5} |D]*} t!j*| | fi|| j-d,, ddddddy#1swYxYw#t.$r} t1| d} ~ wwxYw#1swYyxYw)-Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilez%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z--no-ensure-ascii ensure_ascii store_falsez(disable escaping of non-ASCII characters)destrr z --json-linesznparse input using the JSON Lines format. Use with --no-indent or --compact to produce valid JSON Lines output.z--indentzJseparate items with newlines and use this number of spaces for indentation)r r r z--tab store_constindent z9separate items with newlines and use tabs for indentation)rrconstr z --no-indentz/separate items with spaces rather than newlinesz --compactz1suppress all whitespace separation (most compact))rr ) sort_keysrr),: separatorsc3FK|]}tj|yw)N)jsonloads).0lines "/usr/lib64/python3.12/json/tool.py zmain..AsrKs^  ; | z  s'AA  A__pycache__/scanner.cpython-312.opt-2.pyc000064400000006344152463413030014060 0ustar00 Th  ddlZ ddlmZdgZej dejejzejzZ dZ exse Zy#e$rdZYMwxYw)N) make_scannerrz2(-?(?:0|[1-9][0-9]*))(\.[0-9]+)?([eE][-+]?[0-9]+)?c Z |j |j|j tj|j |j |j |j|j|j|j f dfd}|S)Nc ||}|dk(r ||dzS|dk(r||dzf S|dk(r ||dzfS|dk(r|||dzdk(rd|dzfS|dk(r|||dzd k(rd |dzfS|d k(r|||d zd k(rd|d zfS ||}|I|j\}}}|s|r||xsdz|xsdz}n|}||jfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfSt|#t$r t|dwxYw)N"{[nnullttrueTffalseFNNaNIInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxnextcharmintegerfracexpres _scan_once match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstricts %/usr/lib64/python3.12/json/scanner.pyr'z#py_make_scanner.._scan_onces /c{H s?a8 8 _q 16K):DB B _a0*= = _C!G!4!>q= _C!G!4!>q= _C!G!4!?#'> !  % =!" GT3s!'TZR"8CI2"FG(<  _C!G!4!=!%(#'1 1 _C!G!4 !B!*-sQw6 6 _C!G!4 !C!+.a7 7$ $A /$$ . /s D??Ecb ||jS#jwxYw)N)clear)rr r'r)s r3 scan_oncez"py_make_scanner..scan_onceAs% fc* JJLDJJLs.) r0r,r1 NUMBER_REmatchr2r.r/r-r*r+r))contextr6r'r(r)r*r+r,r-r.r/r0r1r2s @@@@@@@@@@@@r3py_make_scannerr:s''L%%K''L??L ^^F%%K!!I++N%%K11 <rFst 4   BJJ9ZZ",,* - 8t0 GNsAAA__pycache__/__init__.cpython-312.opt-2.pyc000064400000010365152463413030014164 0ustar00 Th6 dZgdZdZddlmZmZddlmZddlZedd d d ddd Z dd d d dddddd d Z dd d d dddddd d Z eddZ dZ ddddddddZddddddddZy)z2.0.9)dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r rclsrrr sort_keysc |s(|r&|r$|r"| ||| | s| stj|} n(|t}|d||||||| | d| j|} | D]} |j| yN)r r r rrrrr)_default_encoder iterencoderwrite)objfpr r r rrrrrrkwiterablechunks &/usr/lib64/python3.12/json/__init__.pyrrxs(T 9 :+= "#..s3 ;C8|)Yv!y85789C 3   c |s'|r%|r#|r!||||| s| stj|S|t}|d|||||||| d| j|Sr)rencoder) rr r r rrrrrrrs rrrs'R 9 :+= "&&s++ {   %6w)   fSk r ) object_hookobject_pairs_hookcz|j}|tjtjfry|tjtj fry|tj ryt|dk\r"|ds |drdSdS|ds|d s|d rd Sd Sy t|d k(r |dsy|dsy y )Nzutf-32zutf-16z utf-8-sigr r z utf-16-bez utf-32-bez utf-16-lez utf-32-lezutf-8) startswithcodecs BOM_UTF32_BE BOM_UTF32_LE BOM_UTF16_BE BOM_UTF16_LEBOM_UTF8len)b bstartswiths rdetect_encodingr3s,,KF'')<)<=>F'')<)<=>6??# 1v{t#$A$; 7K 7t#$A$!A$; ?K ?  Q1tt r rr# parse_float parse_intparse_constantr$c F t|jf||||||d|S)Nr4)rread)rrr#r5r6r7r$rs rrrsC"  R [9%9J ROQ RRr c  t|tr|jdr`td|dt|tt fs"t d|jj|jt|d}|!||||||stj|S|t}|||d<|||d<|||d<|||d <|||d <|d i|j|S) Nuz-Unexpected UTF-8 BOM (decode using utf-8-sig)r z5the JSON object must be str, bytes or bytearray, not surrogatepassr#r$r5r6r7r) isinstancestrr)rbytes bytearray TypeError __class____name__decoder3_default_decoderr)srr#r5r6r7r$rs rrr+s(@!S << !!"Q"#Q( (!eY/0##$;;#7#7"8:; ; HH_Q' 9 +  +"5  "'8'@&&q)) {'=$"3 '=#;!-  99  A r ) __version____all__ __author__decoderrrencoderrr*rrrrDr3rrrr rrKs`B   - 1    $$tD$<~!tDD$7t44H<dttR2dtt<r __pycache__/tool.cpython-312.pyc000064400000010271152463413030012436 0ustar00 Th dZddlZddlZddlZddlmZdZedk(r eyy#e$r&Z eje jYdZ [ ydZ [ wwxYw)aCommand-line tool to validate and pretty-print JSON Usage:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) N)Pathcd}d}tj||}|jddtjddtj |jd dt d d |jd d dd|jdddd|jdd dd|j}|jddtd|jddddd !|jd"dddd#!|jd$d d%&|j}|j|j|jd'}|jr d|d<d(|d)<|j5} |jr d*|D}nt!j"|f}|j$tj&}n|j$j)d+d}|5} |D]*} t!j*| | fi|| j-d,, ddddddy#1swYxYw#t.$r} t1| d} ~ wwxYw#1swYyxYw)-Nzpython -m json.toolzZA simple command line interface for json module to validate and pretty-print JSON objects.)prog descriptioninfile?zutf-8)encodingz-a JSON file to be validated or pretty-printed)nargstypehelpdefaultoutfilez%write the output of infile to outfilez --sort-keys store_trueFz5sort the output of dictionaries alphabetically by key)actionr r z--no-ensure-ascii ensure_ascii store_falsez(disable escaping of non-ASCII characters)destrr z --json-linesznparse input using the JSON Lines format. Use with --no-indent or --compact to produce valid JSON Lines output.z--indentzJseparate items with newlines and use this number of spaces for indentation)r r r z--tab store_constindent z9separate items with newlines and use tabs for indentation)rrconstr z --no-indentz/separate items with spaces rather than newlinesz --compactz1suppress all whitespace separation (most compact))rr ) sort_keysrr),: separatorsc3FK|]}tj|yw)N)jsonloads).0lines "/usr/lib64/python3.12/json/tool.py zmain..AsrKs^  ; | z  s'AA  A__pycache__/decoder.cpython-312.pyc000064400000033133152463413030013070 0ustar00 Th0 dZddlZddlmZ ddlmZddgZejejzejzZ e dZe dZe d ZGd deZeeed Zej(d e Zej(d e ZdddddddddZej0fdZdeej0fdZexseZej(de ZdZdej0efdZej0efdZGddeZ y#e$rdZYwxYw)zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infceZdZdZdZdZy)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos c|jdd|dz}||jdd|z }d||||fz}tj||||_||_||_||_||_y)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgs %/usr/lib64/python3.12/json/decoder.pyrzJSONDecodeError.__init__sv4C(1,ciia--2c65#5NND&)  c`|j|j|j|jffS)N) __class__rrr)rs r __reduce__zJSONDecodeError.__reduce__*s$~~$((DHH===rN)__name__ __module__ __qualname____doc__rrrrrrs >r)z -InfinityInfinityNaNz[0-9A-Fa-f]{4}z(.*?)(["\\\x00-\x1f])"\/ r   )r$r%r&bfnrtc|||dz}| t|jdSd}t|||#t$rYwxYw)Nr zInvalid \uXXXX escape)intgrouprr)sr_mescrs r _decode_uXXXXr7<sX Qa.C  syy{B' ' #C #q# &&   s9 AATcg}|j}|dz } |||}| td|||j}|j\} } | r|| | dk(rn| dk7r)|rdj | } t| |||| z ||} | dk7r || } |dz }nht||}|d z }d |cxkrd krAnn>|||d zd k(r3t||dz}d|cxkrdkrnnd|d z dz|dz zz}|dz }t|} || dj||fS#t $rtd||dwxYw#t $rdj | } t| ||wxYw)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atr$r%z"Invalid control character {0!r} atuzInvalid \escape: {0!r}iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr7chrjoin)r4r@strict_br5chunks_appendbeginchunkcontent terminatorrr6charuniuni2s r py_scanstringrRFsFmmG !GE 1c  =!"CQN Niik#lln  G     4 :AA*M%c1c22 # 6C&C #: 3#w 1HC3'C 1HC&&1Sq>U+B$Qa0T+V+!sV|&:tf}%MNC1HCs8D W X 776?C + 6!"C"#U,15 6 6 3/66s;%c1c22 3sD*E*E(E-z [ \t\n\r]*z cL|\}} g} | j} |i}|j} || | dz} | dk7r^| |vr||| j} || | dz} | dk(r$||| }|| dzfSi} ||| } | | dzfS| dk7r td|| | dz } t || |\}} | ||}|| | dzdk7r/||| j} || | dzdk7r td|| | dz } || |vr&| dz } || |vr||| dzj} ||| \}} | ||f || } | |vr||| dzj} || } | dz } | dk(rnP| d k7rtd || dz ||| j} || | dz} | dz } | dk7rtd|| dz !| || }|| fSt| } ||| } | | fS#t $rYwxYw#t $r}td||jdd}~wwxYw#t $rd} YwxYw) Nr r$}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer>,Expecting ',' delimiter) r? setdefaultr@rrrC StopIterationvaluedict) s_and_endrG scan_once object_hookobject_pairs_hookmemo_w_wsr4r@pairs pairs_appendmemo_getnextcharresultkeyr[errs r JSONObjectrks FAs E< ! _!CQM M1HC af-SsC  Sq>S Q*.."CS1W~$%&?CHH q v}qS6S=Qa.,,.C M"1c*JE3 c5\" vH3C!Gn((*S6 q s?  _!";QaH HCjnnSq> q s?!CQaQ QS V$"5)s{ KEE" #:C     M!"3Q B L M H s<.-G G,3(H G)(G), H5H  H H#"H#c:|\}}g}|||dz}||vr"|||dzj}|||dz}|dk(r||dzfS|j} |||\} }|| |||dz}||vr"|||dzj}|||dz}|dz }|dk(r ||fS|dk7rtd||dz  |||vr&|dz }|||vr|||dzj}#t$r} td|| jdd} ~ wwxYw#t $rY5wxYw)Nr ]rVrWrX)r@r?rZrr[rC) r]r^rbrcr4r@valuesrgrJr[rjs r JSONArrayros FAs FS1W~H3C!Gn  "Sq>3sQwmmG  M"1c*JE3 Sq> s?Qa.$$&CS1W~H q s?  3;_!";QaH H v}qS6S=Qa.,,.C'  M!"3Q B L M"   s* C%7-D% D .DD  DDcLeZdZdZddddddddZej fdZddZy) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)r_ parse_float parse_intparse_constantrGr`c ||_|xst|_|xst|_|xst j |_||_||_ t|_ t|_ t|_i|_t#j$||_y)a``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)r_floatrqr2rr _CONSTANTS __getitem__rsrGr`rk parse_objectro parse_arrayr parse_stringrar make_scannerr^)rr_rqrrrsrGr`s rrzJSONDecoder.__init__syF'&/%")c,F 0F0F !2&$&  --d3rc|j|||dj\}}|||j}|t|k7r td|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder@lenr)rr4rbobjr@s rdecodezJSONDecoder.decodeMsW ??1"Q(,,.?9SCjnn #a&=!,37 7 rc |j||\}}||fS#t$r}td||jdd}~wwxYw)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. rVN)r^rZrr[)rr4r}rr@rjs rr~zJSONDecoder.raw_decodeXsQ M~~a-HCCx M!"3Q B L Ms A<A)r) rrrr r WHITESPACEmatchrr~r!rrrrs3:'+4"-4`&++  r)!r rejsonr_jsonr c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrur#PosInfNegInfrrrvcompile HEXDIGITS STRINGCHUNK BACKSLASHrr7rRrWHITESPACE_STRrkroobjectrr!rrrsO 0 + , R\\!BII- El u v>j>6   BJJ(% 0 bjj159 Ds Dt$T  '__'"& **9 z *] RZZ u - Z-->Ob(2'7'7^"Jf&foLsDD  D __pycache__/decoder.cpython-312.opt-1.pyc000064400000033133152463413030014027 0ustar00 Th0 dZddlZddlmZ ddlmZddgZejejzejzZ e dZe dZe d ZGd deZeeed Zej(d e Zej(d e ZdddddddddZej0fdZdeej0fdZexseZej(de ZdZdej0efdZej0efdZGddeZ y#e$rdZYwxYw)zImplementation of JSONDecoder N)scanner) scanstring JSONDecoderJSONDecodeErrornaninfz-infceZdZdZdZdZy)ra Subclass of ValueError with the following additional properties: msg: The unformatted error message doc: The JSON document being parsed pos: The start index of doc where parsing failed lineno: The line corresponding to pos colno: The column corresponding to pos c|jdd|dz}||jdd|z }d||||fz}tj||||_||_||_||_||_y)N rz%s: line %d column %d (char %d)) countrfind ValueError__init__msgdocposlinenocolno)selfrrrrrerrmsgs %/usr/lib64/python3.12/json/decoder.pyrzJSONDecodeError.__init__sv4C(1,ciia--2c65#5NND&)  c`|j|j|j|jffS)N) __class__rrr)rs r __reduce__zJSONDecodeError.__reduce__*s$~~$((DHH===rN)__name__ __module__ __qualname____doc__rrrrrrs >r)z -InfinityInfinityNaNz[0-9A-Fa-f]{4}z(.*?)(["\\\x00-\x1f])"\/ r   )r$r%r&bfnrtc|||dz}| t|jdSd}t|||#t$rYwxYw)Nr zInvalid \uXXXX escape)intgrouprr)sr_mescrs r _decode_uXXXXr7<sX Qa.C  syy{B' ' #C #q# &&   s9 AATcg}|j}|dz } |||}| td|||j}|j\} } | r|| | dk(rn| dk7r)|rdj | } t| |||| z ||} | dk7r || } |dz }nht||}|d z }d |cxkrd krAnn>|||d zd k(r3t||dz}d|cxkrdkrnnd|d z dz|dz zz}|dz }t|} || dj||fS#t $rtd||dwxYw#t $rdj | } t| ||wxYw)aScan the string s for a JSON string. End is the index of the character in s after the quote that started the JSON string. Unescapes all valid JSON string escape sequences and raises ValueError on attempt to decode an invalid string. If strict is False then literal control characters are allowed in the string. Returns a tuple of the decoded string and the index of the character in s after the end quote.r NzUnterminated string starting atr$r%z"Invalid control character {0!r} atuzInvalid \escape: {0!r}iiz\uiii ) appendrendgroupsformat IndexErrorKeyErrorr7chrjoin)r4r@strict_br5chunks_appendbeginchunkcontent terminatorrr6charuniuni2s r py_scanstringrRFsFmmG !GE 1c  =!"CQN Niik#lln  G     4 :AA*M%c1c22 # 6C&C #: 3#w 1HC3'C 1HC&&1Sq>U+B$Qa0T+V+!sV|&:tf}%MNC1HCs8D W X 776?C + 6!"C"#U,15 6 6 3/66s;%c1c22 3sD*E*E(E-z [ \t\n\r]*z cL|\}} g} | j} |i}|j} || | dz} | dk7r^| |vr||| j} || | dz} | dk(r$||| }|| dzfSi} ||| } | | dzfS| dk7r td|| | dz } t || |\}} | ||}|| | dzdk7r/||| j} || | dzdk7r td|| | dz } || |vr&| dz } || |vr||| dzj} ||| \}} | ||f || } | |vr||| dzj} || } | dz } | dk(rnP| d k7rtd || dz ||| j} || | dz} | dz } | dk7rtd|| dz !| || }|| fSt| } ||| } | | fS#t $rYwxYw#t $r}td||jdd}~wwxYw#t $rd} YwxYw) Nr r$}z1Expecting property name enclosed in double quotes:zExpecting ':' delimiterExpecting valuer>,Expecting ',' delimiter) r? setdefaultr@rrrC StopIterationvaluedict) s_and_endrG scan_once object_hookobject_pairs_hookmemo_w_wsr4r@pairs pairs_appendmemo_getnextcharresultkeyr[errs r JSONObjectrks FAs E< ! _!CQM M1HC af-SsC  Sq>S Q*.."CS1W~$%&?CHH q v}qS6S=Qa.,,.C M"1c*JE3 c5\" vH3C!Gn((*S6 q s?  _!";QaH HCjnnSq> q s?!CQaQ QS V$"5)s{ KEE" #:C     M!"3Q B L M H s<.-G G,3(H G)(G), H5H  H H#"H#c:|\}}g}|||dz}||vr"|||dzj}|||dz}|dk(r||dzfS|j} |||\} }|| |||dz}||vr"|||dzj}|||dz}|dz }|dk(r ||fS|dk7rtd||dz  |||vr&|dz }|||vr|||dzj}#t$r} td|| jdd} ~ wwxYw#t $rY5wxYw)Nr ]rVrWrX)r@r?rZrr[rC) r]r^rbrcr4r@valuesrgrJr[rjs r JSONArrayros FAs FS1W~H3C!Gn  "Sq>3sQwmmG  M"1c*JE3 Sq> s?Qa.$$&CS1W~H q s?  3;_!";QaH H v}qS6S=Qa.,,.C'  M!"3Q B L M"   s* C%7-D% D .DD  DDcLeZdZdZddddddddZej fdZddZy) raSimple JSON decoder Performs the following translations in decoding by default: +---------------+-------------------+ | JSON | Python | +===============+===================+ | object | dict | +---------------+-------------------+ | array | list | +---------------+-------------------+ | string | str | +---------------+-------------------+ | number (int) | int | +---------------+-------------------+ | number (real) | float | +---------------+-------------------+ | true | True | +---------------+-------------------+ | false | False | +---------------+-------------------+ | null | None | +---------------+-------------------+ It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their corresponding ``float`` values, which is outside the JSON spec. NT)r_ parse_float parse_intparse_constantrGr`c ||_|xst|_|xst|_|xst j |_||_||_ t|_ t|_ t|_i|_t#j$||_y)a``object_hook``, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the given ``dict``. This can be used to provide custom deserializations (e.g. to support JSON-RPC class hinting). ``object_pairs_hook``, if specified will be called with the result of every JSON object decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. If ``strict`` is false (true is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. N)r_floatrqr2rr _CONSTANTS __getitem__rsrGr`rk parse_objectro parse_arrayr parse_stringrar make_scannerr^)rr_rqrrrsrGr`s rrzJSONDecoder.__init__syF'&/%")c,F 0F0F !2&$&  --d3rc|j|||dj\}}|||j}|t|k7r td|||S)zlReturn the Python representation of ``s`` (a ``str`` instance containing a JSON document). r)idxz Extra data) raw_decoder@lenr)rr4rbobjr@s rdecodezJSONDecoder.decodeMsW ??1"Q(,,.?9SCjnn #a&=!,37 7 rc |j||\}}||fS#t$r}td||jdd}~wwxYw)a=Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended. This can be used to decode a JSON document from a string that may have extraneous data at the end. rVN)r^rZrr[)rr4r}rr@rjs rr~zJSONDecoder.raw_decodeXsQ M~~a-HCCx M!"3Q B L Ms A<A)r) rrrr r WHITESPACEmatchrr~r!rrrrs3:'+4"-4`&++  r)!r rejsonr_jsonr c_scanstring ImportError__all__VERBOSE MULTILINEDOTALLFLAGSrur#PosInfNegInfrrrvcompile HEXDIGITS STRINGCHUNK BACKSLASHrr7rRrWHITESPACE_STRrkroobjectrr!rrrsO 0 + , R\\!BII- El u v>j>6   BJJ(% 0 bjj159 Ds Dt$T  '__'"& **9 z *] RZZ u - Z-->Ob(2'7'7^"Jf&foLsDD  D __pycache__/scanner.cpython-312.opt-1.pyc000064400000006404152463413030014054 0ustar00 Th dZddlZ ddlmZdgZejdejejzejzZ dZ exse Zy#e$rdZYMwxYw)zJSON token scanner N) make_scannerrz2(-?(?:0|[1-9][0-9]*))(\.[0-9]+)?([eE][-+]?[0-9]+)?c Z |j |j|j tj|j |j |j |j|j|j|j f dfd}|S)Nc ||}|dk(r ||dzS|dk(r||dzf S|dk(r ||dzfS|dk(r|||dzdk(rd|dzfS|dk(r|||dzd k(rd |dzfS|d k(r|||d zd k(rd|d zfS ||}|I|j\}}}|s|r||xsdz|xsdz}n|}||jfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfSt|#t$r t|dwxYw)N"{[nnullttrueTffalseFNNaNIInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxnextcharmintegerfracexpres _scan_once match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstricts %/usr/lib64/python3.12/json/scanner.pyr'z#py_make_scanner.._scan_onces /c{H s?a8 8 _q 16K):DB B _a0*= = _C!G!4!>q= _C!G!4!>q= _C!G!4!?#'> !  % =!" GT3s!'TZR"8CI2"FG(<  _C!G!4!=!%(#'1 1 _C!G!4 !B!*-sQw6 6 _C!G!4 !C!+.a7 7$ $A /$$ . /s D??Ecb ||jS#jwxYw)N)clear)rr r'r)s r3 scan_oncez"py_make_scanner..scan_onceAs% fc* JJLDJJLs.) r0r,r1 NUMBER_REmatchr2r.r/r-r*r+r))contextr6r'r(r)r*r+r,r-r.r/r0r1r2s @@@@@@@@@@@@r3py_make_scannerr:s''L%%K''L??L ^^F%%K!!I++N%%K11 <rGst 4   BJJ9ZZ",,* - 8t0 GNsAAA__pycache__/scanner.cpython-312.pyc000064400000006404152463413030013115 0ustar00 Th dZddlZ ddlmZdgZejdejejzejzZ dZ exse Zy#e$rdZYMwxYw)zJSON token scanner N) make_scannerrz2(-?(?:0|[1-9][0-9]*))(\.[0-9]+)?([eE][-+]?[0-9]+)?c Z |j |j|j tj|j |j |j |j|j|j|j f dfd}|S)Nc ||}|dk(r ||dzS|dk(r||dzf S|dk(r ||dzfS|dk(r|||dzdk(rd|dzfS|dk(r|||dzd k(rd |dzfS|d k(r|||d zd k(rd|d zfS ||}|I|j\}}}|s|r||xsdz|xsdz}n|}||jfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfS|dk(r|||dzdk(r d|dzfSt|#t$r t|dwxYw)N"{[nnullttrueTffalseFNNaNIInfinity- z -Infinity) IndexError StopIterationgroupsend)stringidxnextcharmintegerfracexpres _scan_once match_numbermemo object_hookobject_pairs_hook parse_arrayparse_constant parse_float parse_int parse_object parse_stringstricts %/usr/lib64/python3.12/json/scanner.pyr'z#py_make_scanner.._scan_onces /c{H s?a8 8 _q 16K):DB B _a0*= = _C!G!4!>q= _C!G!4!>q= _C!G!4!?#'> !  % =!" GT3s!'TZR"8CI2"FG(<  _C!G!4!=!%(#'1 1 _C!G!4 !B!*-sQw6 6 _C!G!4 !C!+.a7 7$ $A /$$ . /s D??Ecb ||jS#jwxYw)N)clear)rr r'r)s r3 scan_oncez"py_make_scanner..scan_onceAs% fc* JJLDJJLs.) r0r,r1 NUMBER_REmatchr2r.r/r-r*r+r))contextr6r'r(r)r*r+r,r-r.r/r0r1r2s @@@@@@@@@@@@r3py_make_scannerr:s''L%%K''L??L ^^F%%K!!I++N%%K11 <rGst 4   BJJ9ZZ",,* - 8t0 GNsAAA__pycache__/__init__.cpython-312.opt-1.pyc000064400000032461152463413030014164 0ustar00 Th6 dZdZgdZdZddlmZmZddlmZddl Z ed d d d ddd Z d d d d ddddd d d Z d d d d ddddd d dZ eddZ dZddddddddZddddddddZy)a JSON (JavaScript Object Notation) is a subset of JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data interchange format. :mod:`json` exposes an API familiar to users of the standard library :mod:`marshal` and :mod:`pickle` modules. It is derived from a version of the externally maintained simplejson library. Encoding basic Python object hierarchies:: >>> import json >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) '["foo", {"bar": ["baz", null, 1.0, 2]}]' >>> print(json.dumps("\"foo\bar")) "\"foo\bar" >>> print(json.dumps('\u1234')) "\u1234" >>> print(json.dumps('\\')) "\\" >>> print(json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True)) {"a": 0, "b": 0, "c": 0} >>> from io import StringIO >>> io = StringIO() >>> json.dump(['streaming API'], io) >>> io.getvalue() '["streaming API"]' Compact encoding:: >>> import json >>> mydict = {'4': 5, '6': 7} >>> json.dumps([1,2,3,mydict], separators=(',', ':')) '[1,2,3,{"4":5,"6":7}]' Pretty printing:: >>> import json >>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4)) { "4": 5, "6": 7 } Decoding JSON:: >>> import json >>> obj = ['foo', {'bar': ['baz', None, 1.0, 2]}] >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj True >>> json.loads('"\\"foo\\bar"') == '"foo\x08ar' True >>> from io import StringIO >>> io = StringIO('["streaming API"]') >>> json.load(io)[0] == 'streaming API' True Specializing JSON object decoding:: >>> import json >>> def as_complex(dct): ... if '__complex__' in dct: ... return complex(dct['real'], dct['imag']) ... return dct ... >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', ... object_hook=as_complex) (1+2j) >>> from decimal import Decimal >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') True Specializing JSON object encoding:: >>> import json >>> def encode_complex(obj): ... if isinstance(obj, complex): ... return [obj.real, obj.imag] ... raise TypeError(f'Object of type {obj.__class__.__name__} ' ... f'is not JSON serializable') ... >>> json.dumps(2 + 1j, default=encode_complex) '[2.0, 1.0]' >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) '[2.0, 1.0]' >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) '[2.0, 1.0]' Using json.tool from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } $ echo '{ 1.2:3.4}' | python -m json.tool Expecting property name enclosed in double quotes: line 1 column 3 (char 2) z2.0.9)dumpdumpsloadloads JSONDecoderJSONDecodeError JSONEncoderzBob Ippolito )rr)rNFT)skipkeys ensure_asciicheck_circular allow_nanindent separatorsdefault) r r r rclsrrr sort_keysc |s(|r&|r$|r"| ||| | s| stj|} n(|t}|d||||||| | d| j|} | D]} |j| y)aSerialize ``obj`` as a JSON formatted stream to ``fp`` (a ``.write()``-supporting file-like object). If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the strings written to ``fp`` can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. Nr r r rrrrr)_default_encoder iterencoderwrite)objfpr r r rrrrrrkwiterablechunks &/usr/lib64/python3.12/json/__init__.pyrrxsZ 9 :+= "#..s3 ;C8|)Yv!y85789C 3   c |s'|r%|r#|r!||||| s| stj|S|t}|d|||||||| d| j|S)avSerialize ``obj`` to a JSON formatted ``str``. If ``skipkeys`` is true then ``dict`` keys that are not basic types (``str``, ``int``, ``float``, ``bool``, ``None``) will be skipped instead of raising a ``TypeError``. If ``ensure_ascii`` is false, then the return value can contain non-ASCII characters if they appear in strings contained in ``obj``. Otherwise, all such characters are escaped in JSON strings. If ``check_circular`` is false, then the circular reference check for container types will be skipped and a circular reference will result in an ``RecursionError`` (or worse). If ``allow_nan`` is false, then it will be a ``ValueError`` to serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). If ``indent`` is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. ``None`` is the most compact representation. If specified, ``separators`` should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and ``(',', ': ')`` otherwise. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the ``.default()`` method to serialize additional types), specify it with the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. rr)rencoder) rr r r rrrrrrrs rrrs{X 9 :+= "&&s++ {   %6w)   fSk r ) object_hookobject_pairs_hookcz|j}|tjtjfry|tjtj fry|tj ryt|dk\r"|ds |drdSdS|ds|d s|d rd Sd Sy t|d k(r |dsy|dsy y )Nzutf-32zutf-16z utf-8-sigr r z utf-16-bez utf-32-bez utf-16-lez utf-32-lezutf-8) startswithcodecs BOM_UTF32_BE BOM_UTF32_LE BOM_UTF16_BE BOM_UTF16_LEBOM_UTF8len)b bstartswiths rdetect_encodingr3s,,KF'')<)<=>F'')<)<=>6??# 1v{t#$A$; 7K 7t#$A$!A$; ?K ?  Q1tt r rr# parse_float parse_intparse_constantr$c Dt|jf||||||d|S)aDeserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. r4)rread)rrr#r5r6r7r$rs rrrs>&  R [9%9J ROQ RRr c t|tr|jdr`td|dt|tt fs"t d|jj|jt|d}|!||||||stj|S|t}|||d<|||d<|||d<|||d <|||d <|d i|j|S) aRDeserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance containing a JSON document) to a Python object. ``object_hook`` is an optional function that will be called with the result of any object literal decode (a ``dict``). The return value of ``object_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders (e.g. JSON-RPC class hinting). ``object_pairs_hook`` is an optional function that will be called with the result of any object literal decoded with an ordered list of pairs. The return value of ``object_pairs_hook`` will be used instead of the ``dict``. This feature can be used to implement custom decoders. If ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. ``parse_float``, if specified, will be called with the string of every JSON float to be decoded. By default this is equivalent to float(num_str). This can be used to use another datatype or parser for JSON floats (e.g. decimal.Decimal). ``parse_int``, if specified, will be called with the string of every JSON int to be decoded. By default this is equivalent to int(num_str). This can be used to use another datatype or parser for JSON integers (e.g. float). ``parse_constant``, if specified, will be called with one of the following strings: -Infinity, Infinity, NaN. This can be used to raise an exception if invalid JSON numbers are encountered. To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` kwarg; otherwise ``JSONDecoder`` is used. uz-Unexpected UTF-8 BOM (decode using utf-8-sig)r z5the JSON object must be str, bytes or bytearray, not surrogatepassr#r$r5r6r7r) isinstancestrr)rbytes bytearray TypeError __class____name__decoder3_default_decoderr)srr#r5r6r7r$rs rrr+s#D!S << !!"Q"#Q( (!eY/0##$;;#7#7"8:; ; HH_Q' 9 +  +"5  "'8'@&&q)) {'=$"3 '=#;!-  99  A r )__doc__ __version____all__ __author__decoderrrencoderrr*rrrrDr3rrrr rrLs`B   - 1    $$tD$<~!tDD$7t44H<dttR2dtt<r