Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/imh-pyth.../lib/python2....
File: keyword.py
#! /usr/bin/env 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
'and',
[16] Fix | Delete
'as',
[17] Fix | Delete
'assert',
[18] Fix | Delete
'break',
[19] Fix | Delete
'class',
[20] Fix | Delete
'continue',
[21] Fix | Delete
'def',
[22] Fix | Delete
'del',
[23] Fix | Delete
'elif',
[24] Fix | Delete
'else',
[25] Fix | Delete
'except',
[26] Fix | Delete
'exec',
[27] Fix | Delete
'finally',
[28] Fix | Delete
'for',
[29] Fix | Delete
'from',
[30] Fix | Delete
'global',
[31] Fix | Delete
'if',
[32] Fix | Delete
'import',
[33] Fix | Delete
'in',
[34] Fix | Delete
'is',
[35] Fix | Delete
'lambda',
[36] Fix | Delete
'not',
[37] Fix | Delete
'or',
[38] Fix | Delete
'pass',
[39] Fix | Delete
'print',
[40] Fix | Delete
'raise',
[41] Fix | Delete
'return',
[42] Fix | Delete
'try',
[43] Fix | Delete
'while',
[44] Fix | Delete
'with',
[45] Fix | Delete
'yield',
[46] Fix | Delete
#--end keywords--
[47] Fix | Delete
]
[48] Fix | Delete
[49] Fix | Delete
iskeyword = frozenset(kwlist).__contains__
[50] Fix | Delete
[51] Fix | Delete
def main():
[52] Fix | Delete
import sys, re
[53] Fix | Delete
[54] Fix | Delete
args = sys.argv[1:]
[55] Fix | Delete
iptfile = args and args[0] or "Python/graminit.c"
[56] Fix | Delete
if len(args) > 1: optfile = args[1]
[57] Fix | Delete
else: optfile = "Lib/keyword.py"
[58] Fix | Delete
[59] Fix | Delete
# scan the source file for keywords
[60] Fix | Delete
fp = open(iptfile)
[61] Fix | Delete
strprog = re.compile('"([^"]+)"')
[62] Fix | Delete
lines = []
[63] Fix | Delete
for line in fp:
[64] Fix | Delete
if '{1, "' in line:
[65] Fix | Delete
match = strprog.search(line)
[66] Fix | Delete
if match:
[67] Fix | Delete
lines.append(" '" + match.group(1) + "',\n")
[68] Fix | Delete
fp.close()
[69] Fix | Delete
lines.sort()
[70] Fix | Delete
[71] Fix | Delete
# load the output skeleton from the target
[72] Fix | Delete
fp = open(optfile)
[73] Fix | Delete
format = fp.readlines()
[74] Fix | Delete
fp.close()
[75] Fix | Delete
[76] Fix | Delete
# insert the lines of keywords
[77] Fix | Delete
try:
[78] Fix | Delete
start = format.index("#--start keywords--\n") + 1
[79] Fix | Delete
end = format.index("#--end keywords--\n")
[80] Fix | Delete
format[start:end] = lines
[81] Fix | Delete
except ValueError:
[82] Fix | Delete
sys.stderr.write("target does not contain format markers\n")
[83] Fix | Delete
sys.exit(1)
[84] Fix | Delete
[85] Fix | Delete
# write the output file
[86] Fix | Delete
fp = open(optfile, 'w')
[87] Fix | Delete
fp.write(''.join(format))
[88] Fix | Delete
fp.close()
[89] Fix | Delete
[90] Fix | Delete
if __name__ == "__main__":
[91] Fix | Delete
main()
[92] Fix | Delete
[93] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function