Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/lib64/python3..../json
File: scanner.py
"""JSON token scanner
[0] Fix | Delete
"""
[1] Fix | Delete
import re
[2] Fix | Delete
try:
[3] Fix | Delete
from _json import make_scanner as c_make_scanner
[4] Fix | Delete
except ImportError:
[5] Fix | Delete
c_make_scanner = None
[6] Fix | Delete
[7] Fix | Delete
__all__ = ['make_scanner']
[8] Fix | Delete
[9] Fix | Delete
NUMBER_RE = re.compile(
[10] Fix | Delete
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
[11] Fix | Delete
(re.VERBOSE | re.MULTILINE | re.DOTALL))
[12] Fix | Delete
[13] Fix | Delete
def py_make_scanner(context):
[14] Fix | Delete
parse_object = context.parse_object
[15] Fix | Delete
parse_array = context.parse_array
[16] Fix | Delete
parse_string = context.parse_string
[17] Fix | Delete
match_number = NUMBER_RE.match
[18] Fix | Delete
strict = context.strict
[19] Fix | Delete
parse_float = context.parse_float
[20] Fix | Delete
parse_int = context.parse_int
[21] Fix | Delete
parse_constant = context.parse_constant
[22] Fix | Delete
object_hook = context.object_hook
[23] Fix | Delete
object_pairs_hook = context.object_pairs_hook
[24] Fix | Delete
memo = context.memo
[25] Fix | Delete
[26] Fix | Delete
def _scan_once(string, idx):
[27] Fix | Delete
try:
[28] Fix | Delete
nextchar = string[idx]
[29] Fix | Delete
except IndexError:
[30] Fix | Delete
raise StopIteration(idx)
[31] Fix | Delete
[32] Fix | Delete
if nextchar == '"':
[33] Fix | Delete
return parse_string(string, idx + 1, strict)
[34] Fix | Delete
elif nextchar == '{':
[35] Fix | Delete
return parse_object((string, idx + 1), strict,
[36] Fix | Delete
_scan_once, object_hook, object_pairs_hook, memo)
[37] Fix | Delete
elif nextchar == '[':
[38] Fix | Delete
return parse_array((string, idx + 1), _scan_once)
[39] Fix | Delete
elif nextchar == 'n' and string[idx:idx + 4] == 'null':
[40] Fix | Delete
return None, idx + 4
[41] Fix | Delete
elif nextchar == 't' and string[idx:idx + 4] == 'true':
[42] Fix | Delete
return True, idx + 4
[43] Fix | Delete
elif nextchar == 'f' and string[idx:idx + 5] == 'false':
[44] Fix | Delete
return False, idx + 5
[45] Fix | Delete
[46] Fix | Delete
m = match_number(string, idx)
[47] Fix | Delete
if m is not None:
[48] Fix | Delete
integer, frac, exp = m.groups()
[49] Fix | Delete
if frac or exp:
[50] Fix | Delete
res = parse_float(integer + (frac or '') + (exp or ''))
[51] Fix | Delete
else:
[52] Fix | Delete
res = parse_int(integer)
[53] Fix | Delete
return res, m.end()
[54] Fix | Delete
elif nextchar == 'N' and string[idx:idx + 3] == 'NaN':
[55] Fix | Delete
return parse_constant('NaN'), idx + 3
[56] Fix | Delete
elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity':
[57] Fix | Delete
return parse_constant('Infinity'), idx + 8
[58] Fix | Delete
elif nextchar == '-' and string[idx:idx + 9] == '-Infinity':
[59] Fix | Delete
return parse_constant('-Infinity'), idx + 9
[60] Fix | Delete
else:
[61] Fix | Delete
raise StopIteration(idx)
[62] Fix | Delete
[63] Fix | Delete
def scan_once(string, idx):
[64] Fix | Delete
try:
[65] Fix | Delete
return _scan_once(string, idx)
[66] Fix | Delete
finally:
[67] Fix | Delete
memo.clear()
[68] Fix | Delete
[69] Fix | Delete
return scan_once
[70] Fix | Delete
[71] Fix | Delete
make_scanner = c_make_scanner or py_make_scanner
[72] Fix | Delete
[73] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function