Current Path: > > lib64 > > > > python2.7 > Tools > scripts
Operation : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 162.0.232.56 | Your IP: 216.73.216.111 Domains : 1034 Domain(s) Permission : [ 0755 ]
Name | Type | Size | Last Modified | Actions |
---|---|---|---|---|
analyze_dxp.py | File | 4205 bytes | April 10 2024 04:58:41. | |
analyze_dxp.pyc | File | 4748 bytes | April 10 2024 04:58:46. | |
analyze_dxp.pyo | File | 4748 bytes | April 10 2024 04:58:46. | |
byext.py | File | 3944 bytes | April 10 2024 04:58:41. | |
byext.pyc | File | 4521 bytes | April 10 2024 04:58:46. | |
byext.pyo | File | 4521 bytes | April 10 2024 04:58:46. | |
byteyears.py | File | 1637 bytes | April 10 2024 04:58:41. | |
byteyears.pyc | File | 1398 bytes | April 10 2024 04:58:46. | |
byteyears.pyo | File | 1398 bytes | April 10 2024 04:58:46. | |
checkappend.py | File | 4657 bytes | April 10 2024 04:58:41. | |
checkappend.pyc | File | 4886 bytes | April 10 2024 04:58:46. | |
checkappend.pyo | File | 4886 bytes | April 10 2024 04:58:46. | |
checkpip.py | File | 757 bytes | April 10 2024 04:58:41. | |
checkpip.pyc | File | 1044 bytes | April 10 2024 04:58:46. | |
checkpip.pyo | File | 1044 bytes | April 10 2024 04:58:46. | |
checkpyc.py | File | 2010 bytes | April 10 2024 04:58:41. | |
checkpyc.pyc | File | 1976 bytes | April 10 2024 04:58:46. | |
checkpyc.pyo | File | 1976 bytes | April 10 2024 04:58:46. | |
classfix.py | File | 5952 bytes | April 10 2024 04:58:41. | |
classfix.pyc | File | 4189 bytes | April 10 2024 04:58:46. | |
classfix.pyo | File | 4189 bytes | April 10 2024 04:58:46. | |
cleanfuture.py | File | 8577 bytes | April 10 2024 04:58:41. | |
cleanfuture.pyc | File | 7394 bytes | April 10 2024 04:58:46. | |
cleanfuture.pyo | File | 7361 bytes | April 10 2024 04:58:44. | |
combinerefs.py | File | 4380 bytes | April 10 2024 04:58:41. | |
combinerefs.pyc | File | 4256 bytes | April 10 2024 04:58:46. | |
combinerefs.pyo | File | 4223 bytes | April 10 2024 04:58:44. | |
copytime.py | File | 663 bytes | April 10 2024 04:58:41. | |
copytime.pyc | File | 937 bytes | April 10 2024 04:58:46. | |
copytime.pyo | File | 937 bytes | April 10 2024 04:58:46. | |
crlf.py | File | 610 bytes | April 10 2024 04:58:41. | |
crlf.pyc | File | 855 bytes | April 10 2024 04:58:46. | |
crlf.pyo | File | 855 bytes | April 10 2024 04:58:46. | |
cvsfiles.py | File | 1786 bytes | April 10 2024 04:58:41. | |
cvsfiles.pyc | File | 2163 bytes | April 10 2024 04:58:46. | |
cvsfiles.pyo | File | 2163 bytes | April 10 2024 04:58:46. | |
db2pickle.py | File | 3570 bytes | April 10 2024 04:58:41. | |
db2pickle.pyc | File | 3497 bytes | April 10 2024 04:58:46. | |
db2pickle.pyo | File | 3497 bytes | April 10 2024 04:58:46. | |
diff.py | File | 2066 bytes | April 10 2024 04:58:41. | |
diff.pyc | File | 2386 bytes | April 10 2024 04:58:46. | |
diff.pyo | File | 2386 bytes | April 10 2024 04:58:46. | |
dutree.py | File | 1615 bytes | April 10 2024 04:58:41. | |
dutree.pyc | File | 2230 bytes | April 10 2024 04:58:46. | |
dutree.pyo | File | 2230 bytes | April 10 2024 04:58:46. | |
eptags.py | File | 1483 bytes | April 10 2024 04:58:41. | |
eptags.pyc | File | 1876 bytes | April 10 2024 04:58:46. | |
eptags.pyo | File | 1876 bytes | April 10 2024 04:58:46. | |
find_recursionlimit.py | File | 3473 bytes | April 10 2024 04:58:41. | |
find_recursionlimit.pyc | File | 5673 bytes | April 10 2024 04:58:46. | |
find_recursionlimit.pyo | File | 5673 bytes | April 10 2024 04:58:46. | |
finddiv.py | File | 2517 bytes | April 10 2024 04:58:41. | |
finddiv.pyc | File | 3296 bytes | April 10 2024 04:58:46. | |
finddiv.pyo | File | 3296 bytes | April 10 2024 04:58:46. | |
findlinksto.py | File | 1069 bytes | April 10 2024 04:58:41. | |
findlinksto.pyc | File | 1425 bytes | April 10 2024 04:58:46. | |
findlinksto.pyo | File | 1425 bytes | April 10 2024 04:58:46. | |
findnocoding.py | File | 2808 bytes | April 10 2024 04:58:41. | |
findnocoding.pyc | File | 3201 bytes | April 10 2024 04:58:46. | |
findnocoding.pyo | File | 3201 bytes | April 10 2024 04:58:46. | |
fixcid.py | File | 9995 bytes | April 10 2024 04:58:41. | |
fixcid.pyc | File | 7851 bytes | April 10 2024 04:58:46. | |
fixcid.pyo | File | 7851 bytes | April 10 2024 04:58:46. | |
fixdiv.py | File | 13841 bytes | April 10 2024 04:58:41. | |
fixdiv.pyc | File | 13849 bytes | April 10 2024 04:58:46. | |
fixdiv.pyo | File | 13766 bytes | April 10 2024 04:58:44. | |
fixheader.py | File | 1189 bytes | April 10 2024 04:58:41. | |
fixheader.pyc | File | 1471 bytes | April 10 2024 04:58:46. | |
fixheader.pyo | File | 1471 bytes | April 10 2024 04:58:46. | |
fixnotice.py | File | 3051 bytes | April 10 2024 04:58:41. | |
fixnotice.pyc | File | 3500 bytes | April 10 2024 04:58:46. | |
fixnotice.pyo | File | 3500 bytes | April 10 2024 04:58:46. | |
fixps.py | File | 893 bytes | April 10 2024 04:58:41. | |
fixps.pyc | File | 969 bytes | April 10 2024 04:58:46. | |
fixps.pyo | File | 969 bytes | April 10 2024 04:58:46. | |
google.py | File | 519 bytes | April 10 2024 04:58:41. | |
google.pyc | File | 792 bytes | April 10 2024 04:58:46. | |
google.pyo | File | 792 bytes | April 10 2024 04:58:46. | |
gprof2html.py | File | 2167 bytes | April 10 2024 04:58:41. | |
gprof2html.pyc | File | 2277 bytes | April 10 2024 04:58:46. | |
gprof2html.pyo | File | 2277 bytes | April 10 2024 04:58:46. | |
h2py.py | File | 5953 bytes | April 10 2024 04:58:41. | |
h2py.pyc | File | 4392 bytes | April 10 2024 04:58:46. | |
h2py.pyo | File | 4392 bytes | April 10 2024 04:58:46. | |
hotshotmain.py | File | 1483 bytes | April 10 2024 04:58:41. | |
hotshotmain.pyc | File | 1863 bytes | April 10 2024 04:58:46. | |
hotshotmain.pyo | File | 1863 bytes | April 10 2024 04:58:46. | |
ifdef.py | File | 3718 bytes | April 10 2024 04:58:41. | |
ifdef.pyc | File | 2265 bytes | April 10 2024 04:58:46. | |
ifdef.pyo | File | 2265 bytes | April 10 2024 04:58:46. | |
lfcr.py | File | 618 bytes | April 10 2024 04:58:41. | |
lfcr.pyc | File | 880 bytes | April 10 2024 04:58:46. | |
lfcr.pyo | File | 880 bytes | April 10 2024 04:58:46. | |
linktree.py | File | 2424 bytes | April 10 2024 04:58:41. | |
linktree.pyc | File | 2025 bytes | April 10 2024 04:58:46. | |
linktree.pyo | File | 2025 bytes | April 10 2024 04:58:46. | |
lll.py | File | 742 bytes | April 10 2024 04:58:41. | |
lll.pyc | File | 942 bytes | April 10 2024 04:58:46. | |
lll.pyo | File | 942 bytes | April 10 2024 04:58:46. | |
logmerge.py | File | 5575 bytes | April 10 2024 04:58:41. | |
logmerge.pyc | File | 5083 bytes | April 10 2024 04:58:46. | |
logmerge.pyo | File | 5083 bytes | April 10 2024 04:58:46. | |
mailerdaemon.py | File | 7942 bytes | April 10 2024 04:58:41. | |
mailerdaemon.pyc | File | 7364 bytes | April 10 2024 04:58:46. | |
mailerdaemon.pyo | File | 7364 bytes | April 10 2024 04:58:46. | |
md5sum.py | File | 2385 bytes | April 10 2024 04:58:41. | |
md5sum.pyc | File | 2917 bytes | April 10 2024 04:58:46. | |
md5sum.pyo | File | 2917 bytes | April 10 2024 04:58:46. | |
methfix.py | File | 5462 bytes | April 10 2024 04:58:41. | |
methfix.pyc | File | 4125 bytes | April 10 2024 04:58:46. | |
methfix.pyo | File | 4125 bytes | April 10 2024 04:58:46. | |
mkreal.py | File | 1627 bytes | April 10 2024 04:58:41. | |
mkreal.pyc | File | 1980 bytes | April 10 2024 04:58:46. | |
mkreal.pyo | File | 1980 bytes | April 10 2024 04:58:46. | |
ndiff.py | File | 3808 bytes | April 10 2024 04:58:41. | |
ndiff.pyc | File | 3859 bytes | April 10 2024 04:58:46. | |
ndiff.pyo | File | 3859 bytes | April 10 2024 04:58:46. | |
nm2def.py | File | 2443 bytes | April 10 2024 04:58:41. | |
nm2def.pyc | File | 2960 bytes | April 10 2024 04:58:46. | |
nm2def.pyo | File | 2960 bytes | April 10 2024 04:58:46. | |
objgraph.py | File | 6017 bytes | April 10 2024 04:58:41. | |
objgraph.pyc | File | 4933 bytes | April 10 2024 04:58:46. | |
objgraph.pyo | File | 4933 bytes | April 10 2024 04:58:46. | |
parseentities.py | File | 1719 bytes | April 10 2024 04:58:41. | |
parseentities.pyc | File | 2077 bytes | April 10 2024 04:58:46. | |
parseentities.pyo | File | 2077 bytes | April 10 2024 04:58:46. | |
patchcheck.py | File | 7679 bytes | April 10 2024 04:58:41. | |
patchcheck.pyc | File | 9128 bytes | April 10 2024 04:58:46. | |
patchcheck.pyo | File | 9128 bytes | April 10 2024 04:58:46. | |
pathfix.py | File | 4329 bytes | April 10 2024 04:58:41. | |
pathfix.pyc | File | 3838 bytes | April 10 2024 04:58:46. | |
pathfix.pyo | File | 3838 bytes | April 10 2024 04:58:46. | |
pdeps.py | File | 3936 bytes | April 10 2024 04:58:41. | |
pdeps.pyc | File | 3220 bytes | April 10 2024 04:58:46. | |
pdeps.pyo | File | 3220 bytes | April 10 2024 04:58:46. | |
pickle2db.py | File | 3942 bytes | April 10 2024 04:58:41. | |
pickle2db.pyc | File | 3819 bytes | April 10 2024 04:58:46. | |
pickle2db.pyo | File | 3819 bytes | April 10 2024 04:58:46. | |
pindent.py | File | 17170 bytes | April 10 2024 04:58:41. | |
pindent.pyc | File | 11559 bytes | April 10 2024 04:58:46. | |
pindent.pyo | File | 11559 bytes | April 10 2024 04:58:46. | |
ptags.py | File | 1224 bytes | April 10 2024 04:58:41. | |
ptags.pyc | File | 1407 bytes | April 10 2024 04:58:46. | |
ptags.pyo | File | 1407 bytes | April 10 2024 04:58:46. | |
pysource.py | File | 3846 bytes | April 10 2024 04:58:41. | |
pysource.pyc | File | 4009 bytes | April 10 2024 04:58:46. | |
pysource.pyo | File | 4009 bytes | April 10 2024 04:58:46. | |
redemo.py | File | 5792 bytes | April 10 2024 04:58:41. | |
redemo.pyc | File | 5249 bytes | April 10 2024 04:58:46. | |
redemo.pyo | File | 5249 bytes | April 10 2024 04:58:46. | |
reindent-rst.py | File | 278 bytes | April 10 2024 04:58:41. | |
reindent-rst.pyc | File | 481 bytes | April 10 2024 04:58:46. | |
reindent-rst.pyo | File | 481 bytes | April 10 2024 04:58:46. | |
reindent.py | File | 11417 bytes | April 10 2024 04:58:41. | |
reindent.pyc | File | 9629 bytes | April 10 2024 04:58:46. | |
reindent.pyo | File | 9590 bytes | April 10 2024 04:58:44. | |
rgrep.py | File | 1492 bytes | April 10 2024 04:58:41. | |
rgrep.pyc | File | 1881 bytes | April 10 2024 04:58:46. | |
rgrep.pyo | File | 1881 bytes | April 10 2024 04:58:46. | |
serve.py | File | 1147 bytes | April 10 2024 04:58:41. | |
serve.pyc | File | 1597 bytes | April 10 2024 04:58:46. | |
serve.pyo | File | 1597 bytes | April 10 2024 04:58:46. | |
setup.py | File | 421 bytes | April 10 2024 04:58:41. | |
setup.pyc | File | 548 bytes | April 10 2024 04:58:46. | |
setup.pyo | File | 548 bytes | April 10 2024 04:58:46. | |
suff.py | File | 621 bytes | April 10 2024 04:58:41. | |
suff.pyc | File | 904 bytes | April 10 2024 04:58:46. | |
suff.pyo | File | 904 bytes | April 10 2024 04:58:46. | |
svneol.py | File | 2930 bytes | April 10 2024 04:58:41. | |
svneol.pyc | File | 2904 bytes | April 10 2024 04:58:46. | |
svneol.pyo | File | 2825 bytes | April 10 2024 04:58:44. | |
texcheck.py | File | 9256 bytes | April 10 2024 04:58:41. | |
texcheck.pyc | File | 8376 bytes | April 10 2024 04:58:46. | |
texcheck.pyo | File | 8376 bytes | April 10 2024 04:58:46. | |
texi2html.py | File | 69825 bytes | April 10 2024 04:58:41. | |
texi2html.pyc | File | 83323 bytes | April 10 2024 04:58:46. | |
texi2html.pyo | File | 83323 bytes | April 10 2024 04:58:46. | |
treesync.py | File | 5783 bytes | April 10 2024 04:58:41. | |
treesync.pyc | File | 5990 bytes | April 10 2024 04:58:46. | |
treesync.pyo | File | 5990 bytes | April 10 2024 04:58:46. | |
untabify.py | File | 1215 bytes | April 10 2024 04:58:41. | |
untabify.pyc | File | 1583 bytes | April 10 2024 04:58:46. | |
untabify.pyo | File | 1583 bytes | April 10 2024 04:58:46. | |
which.py | File | 1630 bytes | April 10 2024 04:58:41. | |
which.pyc | File | 1632 bytes | April 10 2024 04:58:46. | |
which.pyo | File | 1632 bytes | April 10 2024 04:58:46. | |
win_add2path.py | File | 1620 bytes | April 10 2024 04:58:41. | |
win_add2path.pyc | File | 2069 bytes | April 10 2024 04:58:46. | |
win_add2path.pyo | File | 2069 bytes | April 10 2024 04:58:46. | |
xxci.py | File | 2797 bytes | April 10 2024 04:58:41. | |
xxci.pyc | File | 4017 bytes | April 10 2024 04:58:46. | |
xxci.pyo | File | 4017 bytes | April 10 2024 04:58:46. |
#! /usr/bin/python2.7 # Released to the public domain, by Tim Peters, 03 October 2000. """reindent [-d][-r][-v] [ path ... ] -d (--dryrun) Dry run. Analyze, but don't make any changes to, files. -r (--recurse) Recurse. Search for all .py files in subdirectories too. -n (--nobackup) No backup. Does not make a ".bak" file before reindenting. -v (--verbose) Verbose. Print informative msgs; else no output. -h (--help) Help. Print this usage information and exit. Change Python (.py) files to use 4-space indents and no hard tab characters. Also trim excess spaces and tabs from ends of lines, and remove empty lines at the end of files. Also ensure the last line ends with a newline. If no paths are given on the command line, reindent operates as a filter, reading a single source file from standard input and writing the transformed source to standard output. In this case, the -d, -r and -v flags are ignored. You can pass one or more file and/or directory paths. When a directory path, all .py files within the directory will be examined, and, if the -r option is given, likewise recursively for subdirectories. If output is not to standard output, reindent overwrites files in place, renaming the originals with a .bak extension. If it finds nothing to change, the file is left alone. If reindent does change a file, the changed file is a fixed-point for future runs (i.e., running reindent on the resulting .py file won't change it again). The hard part of reindenting is figuring out what to do with comment lines. So long as the input files get a clean bill of health from tabnanny.py, reindent should do a good job. The backup file is a copy of the one that is being reindented. The ".bak" file is generated with shutil.copy(), but some corner cases regarding user/group and permissions could leave the backup file more readable than you'd prefer. You can always use the --nobackup option to prevent this. """ __version__ = "1" import tokenize import os, shutil import sys import io verbose = 0 recurse = 0 dryrun = 0 makebackup = True def usage(msg=None): if msg is not None: print >> sys.stderr, msg print >> sys.stderr, __doc__ def errprint(*args): sep = "" for arg in args: sys.stderr.write(sep + str(arg)) sep = " " sys.stderr.write("\n") def main(): import getopt global verbose, recurse, dryrun, makebackup try: opts, args = getopt.getopt(sys.argv[1:], "drnvh", ["dryrun", "recurse", "nobackup", "verbose", "help"]) except getopt.error, msg: usage(msg) return for o, a in opts: if o in ('-d', '--dryrun'): dryrun += 1 elif o in ('-r', '--recurse'): recurse += 1 elif o in ('-n', '--nobackup'): makebackup = False elif o in ('-v', '--verbose'): verbose += 1 elif o in ('-h', '--help'): usage() return if not args: r = Reindenter(sys.stdin) r.run() r.write(sys.stdout) return for arg in args: check(arg) def check(file): if os.path.isdir(file) and not os.path.islink(file): if verbose: print "listing directory", file names = os.listdir(file) for name in names: fullname = os.path.join(file, name) if ((recurse and os.path.isdir(fullname) and not os.path.islink(fullname) and not os.path.split(fullname)[1].startswith(".")) or name.lower().endswith(".py")): check(fullname) return if verbose: print "checking", file, "...", try: f = open(file, "rb") except IOError, msg: errprint("%s: I/O Error: %s" % (file, str(msg))) return r = Reindenter(f) f.close() newline = r.newlines if isinstance(newline, tuple): errprint("%s: mixed newlines detected; cannot process file" % file) return if r.run(): if verbose: print "changed." if dryrun: print "But this is a dry run, so leaving it alone." if not dryrun: bak = file + ".bak" if makebackup: shutil.copyfile(file, bak) if verbose: print "backed up", file, "to", bak f = open(file, "wb") r.write(f) f.close() if verbose: print "wrote new", file return True else: if verbose: print "unchanged." return False def _detect_newlines(lines): newlines = {'\r\n' if line[-2:] == '\r\n' else '\n' if line[-1:] == '\n' else '\r' if line[-1:] == '\r' else '' for line in lines} newlines.discard('') newlines = tuple(sorted(newlines)) if not newlines: return '\n' if len(newlines) == 1: return newlines[0] return newlines def _rstrip(line, JUNK='\r\n \t'): """Return line stripped of trailing spaces, tabs, newlines. Note that line.rstrip() instead also strips sundry control characters, but at least one known Emacs user expects to keep junk like that, not mentioning Barry by name or anything <wink>. """ i = len(line) while i > 0 and line[i-1] in JUNK: i -= 1 return line[:i] class Reindenter: def __init__(self, f): self.find_stmt = 1 # next token begins a fresh stmt? self.level = 0 # current indent level # Raw file lines. self.raw = f.readlines() # Save the newlines found in the file so they can be used to # create output without mutating the newlines. self.newlines = _detect_newlines(self.raw) if isinstance(self.newlines, tuple): self.newline = self.newlines[0] else: self.newline = self.newlines # File lines, rstripped & tab-expanded. Dummy at start is so # that we can use tokenize's 1-based line numbering easily. # Note that a line is all-blank iff it's newline. self.lines = [_rstrip(line).expandtabs() + self.newline for line in self.raw] self.lines.insert(0, None) self.index = 1 # index into self.lines of next line # List of (lineno, indentlevel) pairs, one for each stmt and # comment line. indentlevel is -1 for comment lines, as a # signal that tokenize doesn't know what to do about them; # indeed, they're our headache! self.stats = [] def run(self): tokenize.tokenize(self.getline, self.tokeneater) # Remove trailing empty lines. lines = self.lines while lines and lines[-1] == self.newline: lines.pop() # Sentinel. stats = self.stats stats.append((len(lines), 0)) # Map count of leading spaces to # we want. have2want = {} # Program after transformation. after = self.after = [] # Copy over initial empty lines -- there's nothing to do until # we see a line with *something* on it. i = stats[0][0] after.extend(lines[1:i]) for i in range(len(stats)-1): thisstmt, thislevel = stats[i] nextstmt = stats[i+1][0] have = getlspace(lines[thisstmt]) want = thislevel * 4 if want < 0: # A comment line. if have: # An indented comment line. If we saw the same # indentation before, reuse what it most recently # mapped to. want = have2want.get(have, -1) if want < 0: # Then it probably belongs to the next real stmt. for j in xrange(i+1, len(stats)-1): jline, jlevel = stats[j] if jlevel >= 0: if have == getlspace(lines[jline]): want = jlevel * 4 break if want < 0: # Maybe it's a hanging # comment like this one, # in which case we should shift it like its base # line got shifted. for j in xrange(i-1, -1, -1): jline, jlevel = stats[j] if jlevel >= 0: want = have + getlspace(after[jline-1]) - \ getlspace(lines[jline]) break if want < 0: # Still no luck -- leave it alone. want = have else: want = 0 assert want >= 0 have2want[have] = want diff = want - have if diff == 0 or have == 0: after.extend(lines[thisstmt:nextstmt]) else: for line in lines[thisstmt:nextstmt]: if diff > 0: if line == self.newline: after.append(line) else: after.append(" " * diff + line) else: remove = min(getlspace(line), -diff) after.append(line[remove:]) return self.raw != self.after def write(self, f): f.writelines(self.after) # Line-getter for tokenize. def getline(self): if self.index >= len(self.lines): line = "" else: line = self.lines[self.index] self.index += 1 return line # Line-eater for tokenize. def tokeneater(self, type, token, (sline, scol), end, line, INDENT=tokenize.INDENT, DEDENT=tokenize.DEDENT, NEWLINE=tokenize.NEWLINE, COMMENT=tokenize.COMMENT, NL=tokenize.NL): if type == NEWLINE: # A program statement, or ENDMARKER, will eventually follow, # after some (possibly empty) run of tokens of the form # (NL | COMMENT)* (INDENT | DEDENT+)? self.find_stmt = 1 elif type == INDENT: self.find_stmt = 1 self.level += 1 elif type == DEDENT: self.find_stmt = 1 self.level -= 1 elif type == COMMENT: if self.find_stmt: self.stats.append((sline, -1)) # but we're still looking for a new stmt, so leave # find_stmt alone elif type == NL: pass elif self.find_stmt: # This is the first "real token" following a NEWLINE, so it # must be the first token of the next program statement, or an # ENDMARKER. self.find_stmt = 0 if line: # not endmarker self.stats.append((sline, self.level)) # Count number of leading blanks. def getlspace(line): i, n = 0, len(line) while i < n and line[i] == " ": i += 1 return i if __name__ == '__main__': main()
SILENT KILLER Tool