Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/lib64/python3....
File: keyword.py
#! /usr/libexec/platform-python
[0] Fix | Delete
[1] Fix | Delete
"""Keywords (from "graminit.c")
[2] Fix | Delete
[3] Fix | Delete
This file is automatically generated; please don't muck it up!
[4] Fix | Delete
[5] Fix | Delete
To update the symbols in this file, 'cd' to the top directory of
[6] Fix | Delete
the python source tree after building the interpreter and run:
[7] Fix | Delete
[8] Fix | Delete
./python Lib/keyword.py
[9] Fix | Delete
"""
[10] Fix | Delete
[11] Fix | Delete
__all__ = ["iskeyword", "kwlist"]
[12] Fix | Delete
[13] Fix | Delete
kwlist = [
[14] Fix | Delete
#--start keywords--
[15] Fix | Delete
'False',
[16] Fix | Delete
'None',
[17] Fix | Delete
'True',
[18] Fix | Delete
'and',
[19] Fix | Delete
'as',
[20] Fix | Delete
'assert',
[21] Fix | Delete
'break',
[22] Fix | Delete
'class',
[23] Fix | Delete
'continue',
[24] Fix | Delete
'def',
[25] Fix | Delete
'del',
[26] Fix | Delete
'elif',
[27] Fix | Delete
'else',
[28] Fix | Delete
'except',
[29] Fix | Delete
'finally',
[30] Fix | Delete
'for',
[31] Fix | Delete
'from',
[32] Fix | Delete
'global',
[33] Fix | Delete
'if',
[34] Fix | Delete
'import',
[35] Fix | Delete
'in',
[36] Fix | Delete
'is',
[37] Fix | Delete
'lambda',
[38] Fix | Delete
'nonlocal',
[39] Fix | Delete
'not',
[40] Fix | Delete
'or',
[41] Fix | Delete
'pass',
[42] Fix | Delete
'raise',
[43] Fix | Delete
'return',
[44] Fix | Delete
'try',
[45] Fix | Delete
'while',
[46] Fix | Delete
'with',
[47] Fix | Delete
'yield',
[48] Fix | Delete
#--end keywords--
[49] Fix | Delete
]
[50] Fix | Delete
[51] Fix | Delete
iskeyword = frozenset(kwlist).__contains__
[52] Fix | Delete
[53] Fix | Delete
def main():
[54] Fix | Delete
import sys, re
[55] Fix | Delete
[56] Fix | Delete
args = sys.argv[1:]
[57] Fix | Delete
iptfile = args and args[0] or "Python/graminit.c"
[58] Fix | Delete
if len(args) > 1: optfile = args[1]
[59] Fix | Delete
else: optfile = "Lib/keyword.py"
[60] Fix | Delete
[61] Fix | Delete
# load the output skeleton from the target, taking care to preserve its
[62] Fix | Delete
# newline convention.
[63] Fix | Delete
with open(optfile, newline='') as fp:
[64] Fix | Delete
format = fp.readlines()
[65] Fix | Delete
nl = format[0][len(format[0].strip()):] if format else '\n'
[66] Fix | Delete
[67] Fix | Delete
# scan the source file for keywords
[68] Fix | Delete
with open(iptfile) as fp:
[69] Fix | Delete
strprog = re.compile('"([^"]+)"')
[70] Fix | Delete
lines = []
[71] Fix | Delete
for line in fp:
[72] Fix | Delete
if '{1, "' in line:
[73] Fix | Delete
match = strprog.search(line)
[74] Fix | Delete
if match:
[75] Fix | Delete
lines.append(" '" + match.group(1) + "'," + nl)
[76] Fix | Delete
lines.sort()
[77] Fix | Delete
[78] Fix | Delete
# insert the lines of keywords into the skeleton
[79] Fix | Delete
try:
[80] Fix | Delete
start = format.index("#--start keywords--" + nl) + 1
[81] Fix | Delete
end = format.index("#--end keywords--" + nl)
[82] Fix | Delete
format[start:end] = lines
[83] Fix | Delete
except ValueError:
[84] Fix | Delete
sys.stderr.write("target does not contain format markers\n")
[85] Fix | Delete
sys.exit(1)
[86] Fix | Delete
[87] Fix | Delete
# write the output file
[88] Fix | Delete
with open(optfile, 'w', newline='') as fp:
[89] Fix | Delete
fp.writelines(format)
[90] Fix | Delete
[91] Fix | Delete
if __name__ == "__main__":
[92] Fix | Delete
main()
[93] Fix | Delete
[94] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function