GRAYBYTE WORDPRESS FILE MANAGER3966

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 : /usr/lib64/python2.7/Tools/scripts/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /usr/lib64/python2.7/Tools/scripts//patchcheck.py
#! /usr/bin/python2.7
import re
import sys
import shutil
import os.path
import subprocess
import sysconfig

import reindent
import untabify


# Excluded directories which are copies of external libraries:
# don't check their coding style
EXCLUDE_DIRS = [os.path.join('Modules', '_ctypes', 'libffi'),
                os.path.join('Modules', '_ctypes', 'libffi_osx'),
                os.path.join('Modules', '_ctypes', 'libffi_msvc'),
                os.path.join('Modules', 'expat'),
                os.path.join('Modules', 'zlib')]
SRCDIR = sysconfig.get_config_var('srcdir')


def n_files_str(count):
    """Return 'N file(s)' with the proper plurality on 'file'."""
    return "{} file{}".format(count, "s" if count != 1 else "")


def status(message, modal=False, info=None):
    """Decorator to output status info to stdout."""
    def decorated_fxn(fxn):
        def call_fxn(*args, **kwargs):
            sys.stdout.write(message + ' ... ')
            sys.stdout.flush()
            result = fxn(*args, **kwargs)
            if not modal and not info:
                print "done"
            elif info:
                print info(result)
            else:
                print "yes" if result else "NO"
            return result
        return call_fxn
    return decorated_fxn


def get_git_branch():
    """Get the symbolic name for the current git branch"""
    cmd = "git rev-parse --abbrev-ref HEAD".split()
    try:
        return subprocess.check_output(cmd, stderr=subprocess.PIPE)
    except subprocess.CalledProcessError:
        return None


def get_git_upstream_remote():
    """Get the remote name to use for upstream branches

    Uses "upstream" if it exists, "origin" otherwise
    """
    cmd = "git remote get-url upstream".split()
    try:
        subprocess.check_output(cmd, stderr=subprocess.PIPE)
    except subprocess.CalledProcessError:
        return "origin"
    return "upstream"


@status("Getting base branch for PR",
        info=lambda x: x if x is not None else "not a PR branch")
def get_base_branch():
    if not os.path.exists(os.path.join(SRCDIR, '.git')):
        # Not a git checkout, so there's no base branch
        return None
    version = sys.version_info
    if version.releaselevel == 'alpha':
        base_branch = "master"
    else:
        base_branch = "{0.major}.{0.minor}".format(version)
    this_branch = get_git_branch()
    if this_branch is None or this_branch == base_branch:
        # Not on a git PR branch, so there's no base branch
        return None
    upstream_remote = get_git_upstream_remote()
    return upstream_remote + "/" + base_branch


@status("Getting the list of files that have been added/changed",
        info=lambda x: n_files_str(len(x)))
def changed_files(base_branch=None):
    """Get the list of changed or added files from git."""
    if os.path.exists(os.path.join(SRCDIR, '.git')):
        # We just use an existence check here as:
        #  directory = normal git checkout/clone
        #  file = git worktree directory
        if base_branch:
            cmd = 'git diff --name-status ' + base_branch
        else:
            cmd = 'git status --porcelain'
        filenames = []
        st = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
        try:
            for line in st.stdout:
                line = line.decode().rstrip()
                status_text, filename = line.split(None, 1)
                status = set(status_text)
                # modified, added or unmerged files
                if not status.intersection('MAU'):
                    continue
                if ' -> ' in filename:
                    # file is renamed
                    filename = filename.split(' -> ', 2)[1].strip()
                filenames.append(filename)
        finally:
            st.stdout.close()
    else:
        sys.exit('need a git checkout to get modified files')

    filenames2 = []
    for filename in filenames:
        # Normalize the path to be able to match using .startswith()
        filename = os.path.normpath(filename)
        if any(filename.startswith(path) for path in EXCLUDE_DIRS):
            # Exclude the file
            continue
        filenames2.append(filename)

    return filenames2


def report_modified_files(file_paths):
    count = len(file_paths)
    if count == 0:
        return n_files_str(count)
    else:
        lines = ["{}:".format(n_files_str(count))]
        for path in file_paths:
            lines.append("  {}".format(path))
        return "\n".join(lines)


@status("Fixing whitespace", info=report_modified_files)
def normalize_whitespace(file_paths):
    """Make sure that the whitespace for .py files have been normalized."""
    reindent.makebackup = False  # No need to create backups.
    fixed = []
    for path in (x for x in file_paths if x.endswith('.py')):
        if reindent.check(os.path.join(SRCDIR, path)):
            fixed.append(path)
    return fixed


@status("Fixing C file whitespace", info=report_modified_files)
def normalize_c_whitespace(file_paths):
    """Report if any C files """
    fixed = []
    for path in file_paths:
        abspath = os.path.join(SRCDIR, path)
        with open(abspath, 'r') as f:
            if '\t' not in f.read():
                continue
        untabify.process(abspath, 8, verbose=False)
        fixed.append(path)
    return fixed


ws_re = re.compile(br'\s+(\r?\n)$')

@status("Fixing docs whitespace", info=report_modified_files)
def normalize_docs_whitespace(file_paths):
    fixed = []
    for path in file_paths:
        abspath = os.path.join(SRCDIR, path)
        try:
            with open(abspath, 'rb') as f:
                lines = f.readlines()
            new_lines = [ws_re.sub(br'\1', line) for line in lines]
            if new_lines != lines:
                shutil.copyfile(abspath, abspath + '.bak')
                with open(abspath, 'wb') as f:
                    f.writelines(new_lines)
                fixed.append(path)
        except Exception as err:
            print 'Cannot fix %s: %s' % (path, err)
    return fixed


@status("Docs modified", modal=True)
def docs_modified(file_paths):
    """Report if any file in the Doc directory has been changed."""
    return bool(file_paths)


@status("Misc/ACKS updated", modal=True)
def credit_given(file_paths):
    """Check if Misc/ACKS has been changed."""
    return os.path.join('Misc', 'ACKS') in file_paths


@status("Misc/NEWS.d updated with `blurb`", modal=True)
def reported_news(file_paths):
    """Check if Misc/NEWS.d has been changed."""
    return any(p.startswith(os.path.join('Misc', 'NEWS.d', 'next'))
               for p in file_paths)


def main():
    base_branch = get_base_branch()
    file_paths = changed_files(base_branch)
    python_files = [fn for fn in file_paths if fn.endswith('.py')]
    c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))]
    doc_files = [fn for fn in file_paths if fn.startswith('Doc') and
                 fn.endswith(('.rst', '.inc'))]
    misc_files = {p for p in file_paths if p.startswith('Misc')}
    # PEP 8 whitespace rules enforcement.
    normalize_whitespace(python_files)
    # C rules enforcement.
    normalize_c_whitespace(c_files)
    # Doc whitespace enforcement.
    normalize_docs_whitespace(doc_files)
    # Docs updated.
    docs_modified(doc_files)
    # Misc/ACKS changed.
    credit_given(misc_files)
    # Misc/NEWS changed.
    reported_news(misc_files)

    # Test suite run and passed.
    if python_files or c_files:
        end = " and check for refleaks?" if c_files else "?"
        print
        print "Did you run the test suite" + end


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