whoami7 - Manager
:
/
home
/
creaupfw
/
public_html
/
wp-includes
/
assets
/
Upload File:
files >> /home/creaupfw/public_html/wp-includes/assets/Tools.zip
PK 4q�Z����9 9 READMEnu �[��� This directory contains a number of Python programs that are useful while building or extending Python. audiopy Audiopy is a program to control the Solaris audio device, allowing you to choose both the input and output devices, and to set the output volume, that can be run either as a command-line script, or as a Tkinter application. bgen Generate complete extension modules from a description. Still under development! WARNING: bgen has been removed in 3.0. compiler Tools used to maintain the compiler package in the standard library. faqwiz FAQ Wizard. See http://www.python.org/cgi-bin/faqw.py for a live example. freeze Create a stand-alone executable from a Python program. gdb Python code to be run inside gdb, to make it easier to debug Python itself (by David Malcolm). i18n Tools for internationalization. pygettext.py parses Python source code and generates .pot files, and msgfmt.py generates a binary message catalog from a catalog in text format. pynche A Tkinter-based color editor. scripts A number of useful single-file programs, e.g. tabnanny.py by Tim Peters, which checks for inconsistent mixing of tabs and spaces, and 2to3, which converts Python 2 code to Python 3 code. unicode Tools used to generate unicode database files for Python 2.0 (by Fredrik Lundh). versioncheck A tool to automate checking whether you have the latest version of a package (by Jack Jansen). webchecker A link checker for web sites. world Script to take a list of Internet addresses and print out where in the world those addresses originate from, based on the top-level domain country code found in the address. A generic benchmark suite is maintained separately at https://github.com/python/performance PK 5q�Zw/=L� � scripts/fixnotice.pyonu �[��� � �fc @ sz d Z d a d d l Z d d l Z d d l Z d a d a d a d d � Z d � Z d � Z e d k rv e � n d S( s� (Ostensibly) fix copyright notices in files. Actually, this script will simply replace a block of text in a file from one string to another. It will only do this once though, i.e. not globally throughout the file. It writes a backup file and then does an os.rename() dance for atomicity. Usage: fixnotices.py [options] [filenames] Options: -h / --help Print this message and exit --oldnotice=file Use the notice in the file as the old (to be replaced) string, instead of the hard coded value in the script. --newnotice=file Use the notice in the file as the new (replacement) string, instead of the hard coded value in the script. --dry-run Don't actually make the changes, but print out the list of files that would change. When used with -v, a status will be printed for every file. -v / --verbose Print a message for every file looked at, indicating whether the file is changed or not. s� /*********************************************************** Copyright (c) 2000, BeOpen.com. Copyright (c) 1995-2000, Corporation for National Research Initiatives. Copyright (c) 1990-1995, Stichting Mathematisch Centrum. All rights reserved. See the file "Misc/COPYRIGHT" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. ******************************************************************/ i����Nt i c C s+ t t � GH| r | GHn t j | � d S( N( t __doc__t globalst syst exit( t codet msg( ( s/ /usr/lib64/python2.7/Tools/scripts/fixnotice.pyt usage4 s c C s6 y5 t j t j d d d d d d d g � \ } } Wn# t j k rZ } t d | � n Xx� | D]� \ } } | d k r� t d � qb | d k r� d a qb | d k r� d a qb | d k r� t | � } | j � a | j � qb | d k rb t | � } | j � a | j � qb qb Wx | D] } t | � qWd S( Ni t hvt helps oldnotice=s newnotice=s dry-runt verboses -hs --helpi s -vs --verboses --dry-runs --oldnotices --newnotice( s -hs --help( s -vs --verbose( t getoptR t argvt errorR t VERBOSEt DRYRUNt opent readt OLD_NOTICEt closet NEW_NOTICEt process( t optst argsR t optt argt fp( ( s/ /usr/lib64/python2.7/Tools/scripts/fixnotice.pyt main; s. c C s� t | � } | j � } | j � | j t � } | d k rS t rO d G| GHn d St s_ t rk d G| GHn t ru d S| | t | | t t � } | d } | d } t | d � } | j | � | j � t j | | � t j | | � d S( Ni s no change:s change:s .news .bakt w( R R R t findR R R R t lent writet ost rename( t filet ft datat it newt backup( ( s/ /usr/lib64/python2.7/Tools/scripts/fixnotice.pyR X s( t __main__( R R R R R R R R R R R t __name__( ( ( s/ /usr/lib64/python2.7/Tools/scripts/fixnotice.pyt <module> s PK 5q�ZFw|��! �! scripts/cleanfuture.pynu ȯ�� #! /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() PK 6q�ZӔ&�� � scripts/eptags.pynu ȯ�� #! /usr/bin/python2.7 """Create a TAGS file for Python programs, usable with GNU Emacs. usage: eptags pyfiles... The output TAGS file is usable with Emacs version 18, 19, 20. Tagged are: - functions (even inside other defs or classes) - classes eptags warns about files it cannot open. eptags will not give warnings about duplicate tags. BUGS: Because of tag duplication (methods with the same name in different classes), TAGS files are not very useful for most object-oriented python projects. """ import sys,re expr = r'^[ \t]*(def|class)[ \t]+([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*[:\(]' matcher = re.compile(expr) def treat_file(filename, outfp): """Append tags found in file named 'filename' to the open file 'outfp'""" try: fp = open(filename, 'r') except: sys.stderr.write('Cannot open %s\n'%filename) return charno = 0 lineno = 0 tags = [] size = 0 while 1: line = fp.readline() if not line: break lineno = lineno + 1 m = matcher.search(line) if m: tag = m.group(0) + '\177%d,%d\n' % (lineno, charno) tags.append(tag) size = size + len(tag) charno = charno + len(line) outfp.write('\f\n%s,%d\n' % (filename,size)) for tag in tags: outfp.write(tag) def main(): outfp = open('TAGS', 'w') for filename in sys.argv[1:]: treat_file(filename, outfp) if __name__=="__main__": main() PK 6q�ZR� � scripts/pysource.pyonu �[��� � �fc @ s� d Z d Z d d d d g Z d d l Z d d l Z e j d � Z e Z d � Z d � Z d � Z d � Z d � Z e d d � Z e d k r� x e d g � D] Z e GHq� Wd GHx% e d g d e �D] Z e GHq� Wn d S( sC List python source files. There are three functions to check whether a file is a Python source, listed here with increasing complexity: - has_python_ext() checks whether a file name ends in '.py[w]'. - look_like_python() checks whether the file is not binary and either has the '.py[w]' extension or the first line contains the word 'python'. - can_be_compiled() checks whether the file can be compiled by compile(). The file also must be of appropriate size - not bigger than a megabyte. walk_python_files() recursively lists all Python files under the given directories. s Oleg Broytmann, Georg Brandlt has_python_extt looks_like_pythont can_be_compiledt walk_python_filesi����Ns [ --]c C s t r | GHn d S( N( t debug( t msg( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyt print_debug s c C s� y t j | � j } Wn( t k r@ } t d | | f � d SX| d k re t d | | f � d Sy t | d � SWn( t k r� } t d | | f � d SXd S( Ns %s: permission denied: %si s! %s: the file is too big: %d bytest rUs %s: access denied: %si ( t ost statt st_sizet OSErrorR t Nonet opent IOError( t fullpatht sizet err( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyt _open! s c C s | j d � p | j d � S( Ns .pys .pyw( t endswith( R ( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyR 2 s c C s� t | � } | d k r t S| j � } | j � t j | � rS t d | � t S| j d � sq | j d � ru t Sd | k r� t St S( Ns %s: appears to be binarys .pys .pywt python( R R t Falset readlinet closet binary_ret searchR R t True( R t infilet line( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyR 5 s c C su t | � } | d k r t S| j � } | j � y t | | d � Wn( t k rp } t d | | f � t SXt S( Nt execs %s: cannot compile: %s( R R R t readR t compilet ExceptionR R ( R R t codeR ( ( s. /usr/lib64/python2.7/Tools/scripts/pysource.pyR J s c c s" | d k r g } n x| D]� } t d | � t j j | � rY | | � r| Vqq t j j | � rt d � x� t j | � D]� \ } } } x* | D]"