Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../usr/lib64/python3....
File: _sitebuiltins.py
"""
[0] Fix | Delete
The objects used by the site module to add custom builtins.
[1] Fix | Delete
"""
[2] Fix | Delete
[3] Fix | Delete
# Those objects are almost immortal and they keep a reference to their module
[4] Fix | Delete
# globals. Defining them in the site module would keep too many references
[5] Fix | Delete
# alive.
[6] Fix | Delete
# Note this means this module should also avoid keep things alive in its
[7] Fix | Delete
# globals.
[8] Fix | Delete
[9] Fix | Delete
import sys
[10] Fix | Delete
[11] Fix | Delete
class Quitter(object):
[12] Fix | Delete
def __init__(self, name, eof):
[13] Fix | Delete
self.name = name
[14] Fix | Delete
self.eof = eof
[15] Fix | Delete
def __repr__(self):
[16] Fix | Delete
return 'Use %s() or %s to exit' % (self.name, self.eof)
[17] Fix | Delete
def __call__(self, code=None):
[18] Fix | Delete
# Shells like IDLE catch the SystemExit, but listen when their
[19] Fix | Delete
# stdin wrapper is closed.
[20] Fix | Delete
try:
[21] Fix | Delete
sys.stdin.close()
[22] Fix | Delete
except:
[23] Fix | Delete
pass
[24] Fix | Delete
raise SystemExit(code)
[25] Fix | Delete
[26] Fix | Delete
[27] Fix | Delete
class _Printer(object):
[28] Fix | Delete
"""interactive prompt objects for printing the license text, a list of
[29] Fix | Delete
contributors and the copyright notice."""
[30] Fix | Delete
[31] Fix | Delete
MAXLINES = 23
[32] Fix | Delete
[33] Fix | Delete
def __init__(self, name, data, files=(), dirs=()):
[34] Fix | Delete
import os
[35] Fix | Delete
self.__name = name
[36] Fix | Delete
self.__data = data
[37] Fix | Delete
self.__lines = None
[38] Fix | Delete
self.__filenames = [os.path.join(dir, filename)
[39] Fix | Delete
for dir in dirs
[40] Fix | Delete
for filename in files]
[41] Fix | Delete
[42] Fix | Delete
def __setup(self):
[43] Fix | Delete
if self.__lines:
[44] Fix | Delete
return
[45] Fix | Delete
data = None
[46] Fix | Delete
for filename in self.__filenames:
[47] Fix | Delete
try:
[48] Fix | Delete
with open(filename, "r") as fp:
[49] Fix | Delete
data = fp.read()
[50] Fix | Delete
break
[51] Fix | Delete
except OSError:
[52] Fix | Delete
pass
[53] Fix | Delete
if not data:
[54] Fix | Delete
data = self.__data
[55] Fix | Delete
self.__lines = data.split('\n')
[56] Fix | Delete
self.__linecnt = len(self.__lines)
[57] Fix | Delete
[58] Fix | Delete
def __repr__(self):
[59] Fix | Delete
self.__setup()
[60] Fix | Delete
if len(self.__lines) <= self.MAXLINES:
[61] Fix | Delete
return "\n".join(self.__lines)
[62] Fix | Delete
else:
[63] Fix | Delete
return "Type %s() to see the full %s text" % ((self.__name,)*2)
[64] Fix | Delete
[65] Fix | Delete
def __call__(self):
[66] Fix | Delete
self.__setup()
[67] Fix | Delete
prompt = 'Hit Return for more, or q (and Return) to quit: '
[68] Fix | Delete
lineno = 0
[69] Fix | Delete
while 1:
[70] Fix | Delete
try:
[71] Fix | Delete
for i in range(lineno, lineno + self.MAXLINES):
[72] Fix | Delete
print(self.__lines[i])
[73] Fix | Delete
except IndexError:
[74] Fix | Delete
break
[75] Fix | Delete
else:
[76] Fix | Delete
lineno += self.MAXLINES
[77] Fix | Delete
key = None
[78] Fix | Delete
while key is None:
[79] Fix | Delete
key = input(prompt)
[80] Fix | Delete
if key not in ('', 'q'):
[81] Fix | Delete
key = None
[82] Fix | Delete
if key == 'q':
[83] Fix | Delete
break
[84] Fix | Delete
[85] Fix | Delete
[86] Fix | Delete
class _Helper(object):
[87] Fix | Delete
"""Define the builtin 'help'.
[88] Fix | Delete
[89] Fix | Delete
This is a wrapper around pydoc.help that provides a helpful message
[90] Fix | Delete
when 'help' is typed at the Python interactive prompt.
[91] Fix | Delete
[92] Fix | Delete
Calling help() at the Python prompt starts an interactive help session.
[93] Fix | Delete
Calling help(thing) prints help for the python object 'thing'.
[94] Fix | Delete
"""
[95] Fix | Delete
[96] Fix | Delete
def __repr__(self):
[97] Fix | Delete
return "Type help() for interactive help, " \
[98] Fix | Delete
"or help(object) for help about object."
[99] Fix | Delete
def __call__(self, *args, **kwds):
[100] Fix | Delete
import pydoc
[101] Fix | Delete
return pydoc.help(*args, **kwds)
[102] Fix | Delete
[103] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function