GRAYBYTE WORDPRESS FILE MANAGER3357

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.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
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /lib64/python2.7/Tools/scripts/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /lib64/python2.7/Tools/scripts//cleanfuture.py
#! /usr/bin/python2.7

"""cleanfuture [-d][-r][-v] path ...

-d  Dry run.  Analyze, but don't make any changes to, files.
-r  Recurse.  Search for all .py files in subdirectories too.
-v  Verbose.  Print informative msgs.

Search Python (.py) files for future statements, and remove the features
from such statements that are already mandatory in the version of Python
you're using.

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.

Overwrites files in place, renaming the originals with a .bak extension. If
cleanfuture finds nothing to change, the file is left alone.  If cleanfuture
does change a file, the changed file is a fixed-point (i.e., running
cleanfuture on the resulting .py file won't change it again, at least not
until you try it again with a later Python release).

Limitations:  You can do these things, but this tool won't help you then:

+ A future statement cannot be mixed with any other statement on the same
  physical line (separated by semicolon).

+ A future statement cannot contain an "as" clause.

Example:  Assuming you're using Python 2.2, if a file containing

from __future__ import nested_scopes, generators

is analyzed by cleanfuture, the line is rewritten to

from __future__ import generators

because nested_scopes is no longer optional in 2.2 but generators is.
"""

import __future__
import tokenize
import os
import sys

dryrun  = 0
recurse = 0
verbose = 0

def errprint(*args):
    strings = map(str, args)
    msg = ' '.join(strings)
    if msg[-1:] != '\n':
        msg += '\n'
    sys.stderr.write(msg)

def main():
    import getopt
    global verbose, recurse, dryrun
    try:
        opts, args = getopt.getopt(sys.argv[1:], "drv")
    except getopt.error, msg:
        errprint(msg)
        return
    for o, a in opts:
        if o == '-d':
            dryrun += 1
        elif o == '-r':
            recurse += 1
        elif o == '-v':
            verbose += 1
    if not args:
        errprint("Usage:", __doc__)
        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))
                or name.lower().endswith(".py")):
                check(fullname)
        return

    if verbose:
        print "checking", file, "...",
    try:
        f = open(file)
    except IOError, msg:
        errprint("%r: I/O Error: %s" % (file, str(msg)))
        return

    ff = FutureFinder(f, file)
    changed = ff.run()
    if changed:
        ff.gettherest()
    f.close()
    if changed:
        if verbose:
            print "changed."
            if dryrun:
                print "But this is a dry run, so leaving it alone."
        for s, e, line in changed:
            print "%r lines %d-%d" % (file, s+1, e+1)
            for i in range(s, e+1):
                print ff.lines[i],
            if line is None:
                print "-- deleted"
            else:
                print "-- change to:"
                print line,
        if not dryrun:
            bak = file + ".bak"
            if os.path.exists(bak):
                os.remove(bak)
            os.rename(file, bak)
            if verbose:
                print "renamed", file, "to", bak
            g = open(file, "w")
            ff.write(g)
            g.close()
            if verbose:
                print "wrote new", file
    else:
        if verbose:
            print "unchanged."

class FutureFinder:

    def __init__(self, f, fname):
        self.f = f
        self.fname = fname
        self.ateof = 0
        self.lines = [] # raw file lines

        # List of (start_index, end_index, new_line) triples.
        self.changed = []

    # Line-getter for tokenize.
    def getline(self):
        if self.ateof:
            return ""
        line = self.f.readline()
        if line == "":
            self.ateof = 1
        else:
            self.lines.append(line)
        return line

    def run(self):
        STRING = tokenize.STRING
        NL = tokenize.NL
        NEWLINE = tokenize.NEWLINE
        COMMENT = tokenize.COMMENT
        NAME = tokenize.NAME
        OP = tokenize.OP

        changed = self.changed
        get = tokenize.generate_tokens(self.getline).next
        type, token, (srow, scol), (erow, ecol), line = get()

        # Chew up initial comments and blank lines (if any).
        while type in (COMMENT, NL, NEWLINE):
            type, token, (srow, scol), (erow, ecol), line = get()

        # Chew up docstring (if any -- and it may be implicitly catenated!).
        while type is STRING:
            type, token, (srow, scol), (erow, ecol), line = get()

        # Analyze the future stmts.
        while 1:
            # Chew up comments and blank lines (if any).
            while type in (COMMENT, NL, NEWLINE):
                type, token, (srow, scol), (erow, ecol), line = get()

            if not (type is NAME and token == "from"):
                break
            startline = srow - 1    # tokenize is one-based
            type, token, (srow, scol), (erow, ecol), line = get()

            if not (type is NAME and token == "__future__"):
                break
            type, token, (srow, scol), (erow, ecol), line = get()

            if not (type is NAME and token == "import"):
                break
            type, token, (srow, scol), (erow, ecol), line = get()

            # Get the list of features.
            features = []
            while type is NAME:
                features.append(token)
                type, token, (srow, scol), (erow, ecol), line = get()

                if not (type is OP and token == ','):
                    break
                type, token, (srow, scol), (erow, ecol), line = get()

            # A trailing comment?
            comment = None
            if type is COMMENT:
                comment = token
                type, token, (srow, scol), (erow, ecol), line = get()

            if type is not NEWLINE:
                errprint("Skipping file %r; can't parse line %d:\n%s" %
                         (self.fname, srow, line))
                return []

            endline = srow - 1

            # Check for obsolete features.
            okfeatures = []
            for f in features:
                object = getattr(__future__, f, None)
                if object is None:
                    # A feature we don't know about yet -- leave it in.
                    # They'll get a compile-time error when they compile
                    # this program, but that's not our job to sort out.
                    okfeatures.append(f)
                else:
                    released = object.getMandatoryRelease()
                    if released is None or released <= sys.version_info:
                        # Withdrawn or obsolete.
                        pass
                    else:
                        okfeatures.append(f)

            # Rewrite the line if at least one future-feature is obsolete.
            if len(okfeatures) < len(features):
                if len(okfeatures) == 0:
                    line = None
                else:
                    line = "from __future__ import "
                    line += ', '.join(okfeatures)
                    if comment is not None:
                        line += ' ' + comment
                    line += '\n'
                changed.append((startline, endline, line))

            # Loop back for more future statements.

        return changed

    def gettherest(self):
        if self.ateof:
            self.therest = ''
        else:
            self.therest = self.f.read()

    def write(self, f):
        changed = self.changed
        assert changed
        # Prevent calling this again.
        self.changed = []
        # Apply changes in reverse order.
        changed.reverse()
        for s, e, line in changed:
            if line is None:
                # pure deletion
                del self.lines[s:e+1]
            else:
                self.lines[s:e+1] = [line]
        f.writelines(self.lines)
        # Copy over the remainder of the file.
        if self.therest:
            f.write(self.therest)

if __name__ == '__main__':
    main()

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
June 15 2024 08:34:37
root / root
0755
analyze_dxp.py
4.106 KB
April 10 2024 04:58:41
root / root
0755
analyze_dxp.pyc
4.637 KB
April 10 2024 04:58:46
root / root
0644
analyze_dxp.pyo
4.637 KB
April 10 2024 04:58:46
root / root
0644
byext.py
3.852 KB
April 10 2024 04:58:41
root / root
0755
byext.pyc
4.415 KB
April 10 2024 04:58:46
root / root
0644
byext.pyo
4.415 KB
April 10 2024 04:58:46
root / root
0644
byteyears.py
1.599 KB
April 10 2024 04:58:41
root / root
0755
byteyears.pyc
1.365 KB
April 10 2024 04:58:46
root / root
0644
byteyears.pyo
1.365 KB
April 10 2024 04:58:46
root / root
0644
checkappend.py
4.548 KB
April 10 2024 04:58:41
root / root
0755
checkappend.pyc
4.771 KB
April 10 2024 04:58:46
root / root
0644
checkappend.pyo
4.771 KB
April 10 2024 04:58:46
root / root
0644
checkpip.py
0.739 KB
April 10 2024 04:58:41
root / root
0755
checkpip.pyc
1.02 KB
April 10 2024 04:58:46
root / root
0644
checkpip.pyo
1.02 KB
April 10 2024 04:58:46
root / root
0644
checkpyc.py
1.963 KB
April 10 2024 04:58:41
root / root
0755
checkpyc.pyc
1.93 KB
April 10 2024 04:58:46
root / root
0644
checkpyc.pyo
1.93 KB
April 10 2024 04:58:46
root / root
0644
classfix.py
5.813 KB
April 10 2024 04:58:41
root / root
0755
classfix.pyc
4.091 KB
April 10 2024 04:58:46
root / root
0644
classfix.pyo
4.091 KB
April 10 2024 04:58:46
root / root
0644
cleanfuture.py
8.376 KB
April 10 2024 04:58:41
root / root
0755
cleanfuture.pyc
7.221 KB
April 10 2024 04:58:46
root / root
0644
cleanfuture.pyo
7.188 KB
April 10 2024 04:58:44
root / root
0644
combinerefs.py
4.277 KB
April 10 2024 04:58:41
root / root
0755
combinerefs.pyc
4.156 KB
April 10 2024 04:58:46
root / root
0644
combinerefs.pyo
4.124 KB
April 10 2024 04:58:44
root / root
0644
copytime.py
0.647 KB
April 10 2024 04:58:41
root / root
0755
copytime.pyc
0.915 KB
April 10 2024 04:58:46
root / root
0644
copytime.pyo
0.915 KB
April 10 2024 04:58:46
root / root
0644
crlf.py
0.596 KB
April 10 2024 04:58:41
root / root
0755
crlf.pyc
0.835 KB
April 10 2024 04:58:46
root / root
0644
crlf.pyo
0.835 KB
April 10 2024 04:58:46
root / root
0644
cvsfiles.py
1.744 KB
April 10 2024 04:58:41
root / root
0755
cvsfiles.pyc
2.112 KB
April 10 2024 04:58:46
root / root
0644
cvsfiles.pyo
2.112 KB
April 10 2024 04:58:46
root / root
0644
db2pickle.py
3.486 KB
April 10 2024 04:58:41
root / root
0755
db2pickle.pyc
3.415 KB
April 10 2024 04:58:46
root / root
0644
db2pickle.pyo
3.415 KB
April 10 2024 04:58:46
root / root
0644
diff.py
2.018 KB
April 10 2024 04:58:41
root / root
0755
diff.pyc
2.33 KB
April 10 2024 04:58:46
root / root
0644
diff.pyo
2.33 KB
April 10 2024 04:58:46
root / root
0644
dutree.py
1.577 KB
April 10 2024 04:58:41
root / root
0755
dutree.pyc
2.178 KB
April 10 2024 04:58:46
root / root
0644
dutree.pyo
2.178 KB
April 10 2024 04:58:46
root / root
0644
eptags.py
1.448 KB
April 10 2024 04:58:41
root / root
0755
eptags.pyc
1.832 KB
April 10 2024 04:58:46
root / root
0644
eptags.pyo
1.832 KB
April 10 2024 04:58:46
root / root
0644
find_recursionlimit.py
3.392 KB
April 10 2024 04:58:41
root / root
0755
find_recursionlimit.pyc
5.54 KB
April 10 2024 04:58:46
root / root
0644
find_recursionlimit.pyo
5.54 KB
April 10 2024 04:58:46
root / root
0644
finddiv.py
2.458 KB
April 10 2024 04:58:41
root / root
0755
finddiv.pyc
3.219 KB
April 10 2024 04:58:46
root / root
0644
finddiv.pyo
3.219 KB
April 10 2024 04:58:46
root / root
0644
findlinksto.py
1.044 KB
April 10 2024 04:58:41
root / root
0755
findlinksto.pyc
1.392 KB
April 10 2024 04:58:46
root / root
0644
findlinksto.pyo
1.392 KB
April 10 2024 04:58:46
root / root
0644
findnocoding.py
2.742 KB
April 10 2024 04:58:41
root / root
0755
findnocoding.pyc
3.126 KB
April 10 2024 04:58:46
root / root
0644
findnocoding.pyo
3.126 KB
April 10 2024 04:58:46
root / root
0644
fixcid.py
9.761 KB
April 10 2024 04:58:41
root / root
0755
fixcid.pyc
7.667 KB
April 10 2024 04:58:46
root / root
0644
fixcid.pyo
7.667 KB
April 10 2024 04:58:46
root / root
0644
fixdiv.py
13.517 KB
April 10 2024 04:58:41
root / root
0755
fixdiv.pyc
13.524 KB
April 10 2024 04:58:46
root / root
0644
fixdiv.pyo
13.443 KB
April 10 2024 04:58:44
root / root
0644
fixheader.py
1.161 KB
April 10 2024 04:58:41
root / root
0755
fixheader.pyc
1.437 KB
April 10 2024 04:58:46
root / root
0644
fixheader.pyo
1.437 KB
April 10 2024 04:58:46
root / root
0644
fixnotice.py
2.979 KB
April 10 2024 04:58:41
root / root
0755
fixnotice.pyc
3.418 KB
April 10 2024 04:58:46
root / root
0644
fixnotice.pyo
3.418 KB
April 10 2024 04:58:46
root / root
0644
fixps.py
0.872 KB
April 10 2024 04:58:41
root / root
0755
fixps.pyc
0.946 KB
April 10 2024 04:58:46
root / root
0644
fixps.pyo
0.946 KB
April 10 2024 04:58:46
root / root
0644
google.py
0.507 KB
April 10 2024 04:58:41
root / root
0755
google.pyc
0.773 KB
April 10 2024 04:58:46
root / root
0644
google.pyo
0.773 KB
April 10 2024 04:58:46
root / root
0644
gprof2html.py
2.116 KB
April 10 2024 04:58:41
root / root
0755
gprof2html.pyc
2.224 KB
April 10 2024 04:58:46
root / root
0644
gprof2html.pyo
2.224 KB
April 10 2024 04:58:46
root / root
0644
h2py.py
5.813 KB
April 10 2024 04:58:41
root / root
0755
h2py.pyc
4.289 KB
April 10 2024 04:58:46
root / root
0644
h2py.pyo
4.289 KB
April 10 2024 04:58:46
root / root
0644
hotshotmain.py
1.448 KB
April 10 2024 04:58:41
root / root
0755
hotshotmain.pyc
1.819 KB
April 10 2024 04:58:46
root / root
0644
hotshotmain.pyo
1.819 KB
April 10 2024 04:58:46
root / root
0644
ifdef.py
3.631 KB
April 10 2024 04:58:41
root / root
0755
ifdef.pyc
2.212 KB
April 10 2024 04:58:46
root / root
0644
ifdef.pyo
2.212 KB
April 10 2024 04:58:46
root / root
0644
lfcr.py
0.604 KB
April 10 2024 04:58:41
root / root
0755
lfcr.pyc
0.859 KB
April 10 2024 04:58:46
root / root
0644
lfcr.pyo
0.859 KB
April 10 2024 04:58:46
root / root
0644
linktree.py
2.367 KB
April 10 2024 04:58:41
root / root
0755
linktree.pyc
1.978 KB
April 10 2024 04:58:46
root / root
0644
linktree.pyo
1.978 KB
April 10 2024 04:58:46
root / root
0644
lll.py
0.725 KB
April 10 2024 04:58:41
root / root
0755
lll.pyc
0.92 KB
April 10 2024 04:58:46
root / root
0644
lll.pyo
0.92 KB
April 10 2024 04:58:46
root / root
0644
logmerge.py
5.444 KB
April 10 2024 04:58:41
root / root
0755
logmerge.pyc
4.964 KB
April 10 2024 04:58:46
root / root
0644
logmerge.pyo
4.964 KB
April 10 2024 04:58:46
root / root
0644
mailerdaemon.py
7.756 KB
April 10 2024 04:58:41
root / root
0755
mailerdaemon.pyc
7.191 KB
April 10 2024 04:58:46
root / root
0644
mailerdaemon.pyo
7.191 KB
April 10 2024 04:58:46
root / root
0644
md5sum.py
2.329 KB
April 10 2024 04:58:41
root / root
0755
md5sum.pyc
2.849 KB
April 10 2024 04:58:46
root / root
0644
md5sum.pyo
2.849 KB
April 10 2024 04:58:46
root / root
0644
methfix.py
5.334 KB
April 10 2024 04:58:41
root / root
0755
methfix.pyc
4.028 KB
April 10 2024 04:58:46
root / root
0644
methfix.pyo
4.028 KB
April 10 2024 04:58:46
root / root
0644
mkreal.py
1.589 KB
April 10 2024 04:58:41
root / root
0755
mkreal.pyc
1.934 KB
April 10 2024 04:58:46
root / root
0644
mkreal.pyo
1.934 KB
April 10 2024 04:58:46
root / root
0644
ndiff.py
3.719 KB
April 10 2024 04:58:41
root / root
0755
ndiff.pyc
3.769 KB
April 10 2024 04:58:46
root / root
0644
ndiff.pyo
3.769 KB
April 10 2024 04:58:46
root / root
0644
nm2def.py
2.386 KB
April 10 2024 04:58:41
root / root
0755
nm2def.pyc
2.891 KB
April 10 2024 04:58:46
root / root
0644
nm2def.pyo
2.891 KB
April 10 2024 04:58:46
root / root
0644
objgraph.py
5.876 KB
April 10 2024 04:58:41
root / root
0755
objgraph.pyc
4.817 KB
April 10 2024 04:58:46
root / root
0644
objgraph.pyo
4.817 KB
April 10 2024 04:58:46
root / root
0644
parseentities.py
1.679 KB
April 10 2024 04:58:41
root / root
0755
parseentities.pyc
2.028 KB
April 10 2024 04:58:46
root / root
0644
parseentities.pyo
2.028 KB
April 10 2024 04:58:46
root / root
0644
patchcheck.py
7.499 KB
April 10 2024 04:58:41
root / root
0755
patchcheck.pyc
8.914 KB
April 10 2024 04:58:46
root / root
0644
patchcheck.pyo
8.914 KB
April 10 2024 04:58:46
root / root
0644
pathfix.py
4.228 KB
April 10 2024 04:58:41
root / root
0755
pathfix.pyc
3.748 KB
April 10 2024 04:58:46
root / root
0644
pathfix.pyo
3.748 KB
April 10 2024 04:58:46
root / root
0644
pdeps.py
3.844 KB
April 10 2024 04:58:41
root / root
0755
pdeps.pyc
3.145 KB
April 10 2024 04:58:46
root / root
0644
pdeps.pyo
3.145 KB
April 10 2024 04:58:46
root / root
0644
pickle2db.py
3.85 KB
April 10 2024 04:58:41
root / root
0755
pickle2db.pyc
3.729 KB
April 10 2024 04:58:46
root / root
0644
pickle2db.pyo
3.729 KB
April 10 2024 04:58:46
root / root
0644
pindent.py
16.768 KB
April 10 2024 04:58:41
root / root
0755
pindent.pyc
11.288 KB
April 10 2024 04:58:46
root / root
0644
pindent.pyo
11.288 KB
April 10 2024 04:58:46
root / root
0644
ptags.py
1.195 KB
April 10 2024 04:58:41
root / root
0755
ptags.pyc
1.374 KB
April 10 2024 04:58:46
root / root
0644
ptags.pyo
1.374 KB
April 10 2024 04:58:46
root / root
0644
pysource.py
3.756 KB
April 10 2024 04:58:41
root / root
0755
pysource.pyc
3.915 KB
April 10 2024 04:58:46
root / root
0644
pysource.pyo
3.915 KB
April 10 2024 04:58:46
root / root
0644
redemo.py
5.656 KB
April 10 2024 04:58:41
root / root
0755
redemo.pyc
5.126 KB
April 10 2024 04:58:46
root / root
0644
redemo.pyo
5.126 KB
April 10 2024 04:58:46
root / root
0644
reindent-rst.py
0.271 KB
April 10 2024 04:58:41
root / root
0755
reindent-rst.pyc
0.47 KB
April 10 2024 04:58:46
root / root
0644
reindent-rst.pyo
0.47 KB
April 10 2024 04:58:46
root / root
0644
reindent.py
11.149 KB
April 10 2024 04:58:41
root / root
0755
reindent.pyc
9.403 KB
April 10 2024 04:58:46
root / root
0644
reindent.pyo
9.365 KB
April 10 2024 04:58:44
root / root
0644
rgrep.py
1.457 KB
April 10 2024 04:58:41
root / root
0755
rgrep.pyc
1.837 KB
April 10 2024 04:58:46
root / root
0644
rgrep.pyo
1.837 KB
April 10 2024 04:58:46
root / root
0644
serve.py
1.12 KB
April 10 2024 04:58:41
root / root
0755
serve.pyc
1.56 KB
April 10 2024 04:58:46
root / root
0644
serve.pyo
1.56 KB
April 10 2024 04:58:46
root / root
0644
setup.py
0.411 KB
April 10 2024 04:58:41
root / root
0644
setup.pyc
0.535 KB
April 10 2024 04:58:46
root / root
0644
setup.pyo
0.535 KB
April 10 2024 04:58:46
root / root
0644
suff.py
0.606 KB
April 10 2024 04:58:41
root / root
0755
suff.pyc
0.883 KB
April 10 2024 04:58:46
root / root
0644
suff.pyo
0.883 KB
April 10 2024 04:58:46
root / root
0644
svneol.py
2.861 KB
April 10 2024 04:58:41
root / root
0755
svneol.pyc
2.836 KB
April 10 2024 04:58:46
root / root
0644
svneol.pyo
2.759 KB
April 10 2024 04:58:44
root / root
0644
texcheck.py
9.039 KB
April 10 2024 04:58:41
root / root
0644
texcheck.pyc
8.18 KB
April 10 2024 04:58:46
root / root
0644
texcheck.pyo
8.18 KB
April 10 2024 04:58:46
root / root
0644
texi2html.py
68.188 KB
April 10 2024 04:58:41
root / root
0755
texi2html.pyc
81.37 KB
April 10 2024 04:58:46
root / root
0644
texi2html.pyo
81.37 KB
April 10 2024 04:58:46
root / root
0644
treesync.py
5.647 KB
April 10 2024 04:58:41
root / root
0755
treesync.pyc
5.85 KB
April 10 2024 04:58:46
root / root
0644
treesync.pyo
5.85 KB
April 10 2024 04:58:46
root / root
0644
untabify.py
1.187 KB
April 10 2024 04:58:41
root / root
0755
untabify.pyc
1.546 KB
April 10 2024 04:58:46
root / root
0644
untabify.pyo
1.546 KB
April 10 2024 04:58:46
root / root
0644
which.py
1.592 KB
April 10 2024 04:58:41
root / root
0755
which.pyc
1.594 KB
April 10 2024 04:58:46
root / root
0644
which.pyo
1.594 KB
April 10 2024 04:58:46
root / root
0644
win_add2path.py
1.582 KB
April 10 2024 04:58:41
root / root
0644
win_add2path.pyc
2.021 KB
April 10 2024 04:58:46
root / root
0644
win_add2path.pyo
2.021 KB
April 10 2024 04:58:46
root / root
0644
xxci.py
2.731 KB
April 10 2024 04:58:41
root / root
0755
xxci.pyc
3.923 KB
April 10 2024 04:58:46
root / root
0644
xxci.pyo
3.923 KB
April 10 2024 04:58:46
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF